Skip to content

feat(plugins): the usage screen shows Claude Code's 5-hour and weekly limits - #185

Draft
Stener1 wants to merge 1 commit into
cosscom:mainfrom
Stener1:usage-claude-limits
Draft

Stener1 wants to merge 1 commit into
cosscom:mainfrom
Stener1:usage-claude-limits

Conversation

@Stener1

@Stener1 Stener1 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Summary

The Usage screen shows Codex's 5-hour and weekly limits but none for Claude Code, because Claude Code writes its limits into no file the plugin can read. Claude Code does pass them to its status line, though: rate_limits.five_hour and rate_limits.seven_day, each with used_percentage and resets_at (docs), on Pro and Max, after a session's first reply.

This PR reads them from ~/.berth/limits/<account>.json, a file a status line writes:

 usage.py report
+  claude_limits(): for each Claude account (default, ~/.berth/accounts/claude/<name>)
+    read ~/.berth/limits/<account>.json  {"at": ISO, "limits": <the status line's rate_limits>}
+    five_hour → primary (300 min), seven_day → secondary (10080 min), in Codex's Window shape
+  "limits": codex limits + claude limits
 usage-view / home widget: unchanged logic; "Codex reports the new window…" → the agent's own name
  • Since it uses Codex's shape, the agent tile, the per-login dedupe by email, the "as of …" age, "reset since", and the Home widget all work for Claude with no new UI code.
  • No file means no limits, same as before. A file for a name that isn't a known account is ignored.
  • The plugin README has the snippet to add to a status line script (jq, written atomically). The changelog and docs/guides/home.mdx are updated.

Open question for review

Users still have to add the snippet to their status line themselves. berthd could do it for them, for example with a berthd limits record that a status line pipes to, or by installing a status line that records the limits and then runs the user's own. I left that out because a status line is personal, and berthd taking it over seemed like your call. Happy to add either one.

Evidence

  • Real box (Linux, three Claude accounts with status-line files): python3 -I plugins/usage/box/usage.py report 7 returns a claude limits entry per account, normalized (for example primary {used_percent: 9, window_minutes: 300}, secondary {used_percent: 1, window_minutes: 10080}). Codex's entry is unchanged.
  • App, ?mock=1 (the mock now has a Claude limits entry): the Claude Code tile shows "5-hour limit · as of 1m ago · 18% used · Resets Thu 05:24 PM" and "Weekly limit · 41% used · Resets Sun 05:14 PM", above the Codex tile's rows as before. No console errors.
  • Checks: pnpm typecheck:plugins, check:type, check:titles, check:grid, pnpm test (577 pass), build:plugins, and the docs-site build all pass. No Go changes.

🤖 Generated with Claude Code

… 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>
@Stener1
Stener1 force-pushed the usage-claude-limits branch from 12e2cad to 3405503 Compare October 23, 2026 23:12
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

@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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant