Repository navigation
Conversation
Claude Code writes its limits nowhere, so the Usage screen showed them only for Codex. Its `/usage` prints them, off the login the CLI already holds; usage.py now runs `claude --print --no-session-persistence --strict-mcp-config "/usage"` per signed-in account (its CLAUDE_CONFIG_DIR), from a folder of its own, at most every 5 minutes, and reports the session, the week and each model-scoped week. The screen and home widget show the extra windows by their own names, and a reset that can't be read keeps its percentage. Limits are now keyed by agent and account, since both agents have a "default". The approach follows Codenotch's ClaudeUsageCLI (MIT). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@tinhthanh is attempting to deploy a commit to the seanbrydonio's projects Team on Vercel. A member of the Team first needs to authorize it. |
tinhthanh
marked this pull request as draft
October 15, 2026 03:50
Collaborator
|
Hey this looks good! Let me know when its not draft!! |
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.
Why
The Usage plugin shows plan limits only for Codex. Its README says: "Claude Code doesn't write its limits anywhere the plugin can read". Claude Code's own
/usagedoes print them, using the login the CLI already holds:What
usage.py report. For each signed-in Claude account (default, plus every folder under~/.berth/accounts/claude), it runs:CLAUDE_CONFIG_DIRis set to that account's folder, or removed fordefault.~/.cache/berth-usage/claude-usage, so Claude Code files no project per read.--printasks no trust question,--no-session-persistencewrites no transcript, and--strict-mcp-configstarts no MCP server.Reading the output.
primary(300 min), the all-models week becomessecondary, and each model-scoped week goes in a newextra[]with its ownlabel.resets_at: null.Caching. At most one read per account every 5 minutes (
~/.cache/berth-usage/claude-limits.json,BERTH_USAGE_CLAUDE_LIMITS_TTL). A failed read keeps the last good one.BERTH_USAGE_CLAUDE_LIMITS=0turns the feature off.Keying. Limits are now keyed by
(agent, account); they were keyed by account alone, and both agents have adefault.UI.
LimitRowsand the home widget showextrawindows by their own label and tolerateresets_at: null.mock-usage.tsgets a Claude example.Docs. README and changelog are updated. The approach (flags, parsing, year choice) follows Codenotch's
ClaudeUsageCLI(MIT), credited in the code.Tests
plugins/usage/box/usage_test.py(9 tests): the real 2.1.296 output, the prose below not counting as limits, no session line, an unreadable reset,3pmwithout minutes,12am/12pm, a zone whose name contains "am", New Year in both directions, and the off switch.app/src/lib/usage-py.test.tsruns it frompnpm test(found by thesrc/lib/**/*.test.tsglob), so CI covers the Python. It is skipped withoutpython3.typecheck:plugins,check:titles,check:csp,check:themes,test(497/497) andbuildpass. The docs build passes.Tried for real
berth exec, the plugin's own path),reportreturns Claude limits: session 34–36%, week 69%, Fable week 36%./usagemakes); a cached read takes 0.05 s.🤖 Generated with Claude Code