Repository navigation
Conversation
Stener1
force-pushed
the
usage-claude-limits
branch
from
October 23, 2026 23:12
12e2cad to
3405503
Compare
|
@Stener1 is attempting to deploy a commit to the seanbrydonio's projects Team on Vercel. A member of the Team first needs to authorize it. |
Stener1
force-pushed
the
usage-claude-limits
branch
from
October 27, 2026 13:52
3405503 to
f707c3b
Compare
Contributor
Author
|
Rebased onto main ( Checks on the rebased head |
… limits Claude Code passes its plan limits (rate_limits.five_hour and seven_day) only to a status line. usage.py now reads them from ~/.berth/limits/<account>.json, which a status line writes, and reports them in Codex's window shape, so the Usage tile and the Home widget show them beside Codex's. The plugin README has the status line lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d agents A structured Claude Code agent (claude -p) runs no status line, so the limits file the Usage plugin reads stayed empty on a box whose agents all run that way. Each of its turns says the account's plan limits in a rate_limit_event; berthd now writes them to ~/.berth/limits/<account>.json as they come, keeping the newest reading and any window a turn leaves out. A log read back after a restart writes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n a real box usage-limits-live turns the Usage plugin on, puts a dev box's new sessions on a linked account, runs one Haiku turn and checks the limits file, Claude Code's own /usage (claude-usage.sh) and the screen's meters agree. dev-box.sh can give the box a HOME of its own (VERIFY_BOX_HOME) with a signed-in account linked in as acme-max, and drive.mjs's shot() can keep a single element. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stener1
force-pushed
the
usage-claude-limits
branch
from
October 28, 2026 16:12
f707c3b to
84bf934
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Usage screen showed Codex's 5-hour and weekly limits, but none for Claude Code. Claude Code doesn't write its limits to any file the plugin can read.
The agents Shipyard runs are structured (
claude -p, stream-json). Every turn they take emits arate_limit_event, which berthd already logs and then dropped:{"type":"rate_limit_event","rate_limit_info":{"status":"allowed","resetsAt":1793124000,"rateLimitType":"five_hour", "unifiedWindows":{"five_hour":{"utilization":0.84,"resetsAt":1793124000,"status":"allowed"}, "seven_day":{"utilization":0.29,"resetsAt":1793638800,"status":"allowed"}}}}This PR has berthd record those readings itself, and the plugin shows them.
live == false). Those readings are old, so berthd doesn't write them.rate_limit_eventarrives. Both writers use one shape ({"at", "limits": {"five_hour": {"used_percentage", "resets_at"}, …}}, plusaccountanddirfrom berthd). The reader ignores unknown keys, and berthd reads a file with extra keys (a status line's, another tool's) and writes it afresh when it's broken.features/usage-limits.md,scenarios/usage-limits-live.mjsandscripts/claude-usage.sh. The last one reads/usageas ground truth.dev-box.shgainsVERIFY_BOX_HOME/VERIFY_CLAUDE_ACCOUNT, so a dev box can have a HOME of its own (it never writes the real~/.berth/limits) with a signed-in account linked in under a neutral name.drive.mjs'sshot(name, locator)can now capture just one element.The open question from the first version
The first version left people to add a status-line snippet themselves, and asked whether berthd should take over the status line. It doesn't need to. Structured agents report their limits on every turn, so berthd records them with no setup. The snippet stays as an option only for sessions on Claude Code's own screen.
Follow-up (not in this PR)
berthd headlessrun steps (judges,internal/box/headless.go) also runclaude -p, and they could record the same event. This PR covers the structured driver only.Evidence
Real box, end to end (
verify-berthd, scenariousage-limits-live, ondev-box.sh upwith its own HOME; the test account linked in asacme-max):~/.berth/limits/acme-max.json: 5-hour 51%, weekly 23%,at2026-10-28T16:09:30.364Z./usagefor the same account, read seconds later (claude-usage.sh): 5-hour 51%, weekly 23%.5-hour limit= 51 andWeekly limit= 23. No console errors.On an account other agents were using at the same time, the file and
/usageagreed or differed by one point (/usageonce showed 23% weekly when the event said 0.22). The scenario allows that one point; the screen has to match the file exactly.Go:
internal/box/claudedriver_test.godrives the stand-in Claude through a served box with a temp HOME:resets_atin seconds);TestPlanLimitsKeepTheLatestReadingcovers four cases: an older reading, an empty one, another writer's file with extra keys, and a broken file.TestAClaudeAccountIsNamedAsTheUsagePluginNamesItcovers the naming. With the newcaseremoved, or the log read back as live, the end-to-end test fails.Checks, run locally:
go vet ./...passes.go test -race ./...passes, exceptTestTheCatalogIsCapped, which counts the commands on the machine it runs on and fails onmainthere too.cargo checkpasses (on macOS, on this branch's tree).pnpm typecheck:plugins,check:titles,check:type,check:grid,check:csp,check:themesandpnpm buildpass.pnpm testpasses (618, plus 24 plugin tests).npx tsc -p e2eand thedocs-sitebuild pass.Ask
Could a maintainer add the
run-cilabel? I can't add labels on this repo.🤖 Generated with Claude Code