Skip to content

Claude plan limits: 5 hours and week - #20

Merged
betodoescher merged 1 commit into
mainfrom
claude-limits
Oct 4, 2026
Merged

betodoescher merged 1 commit into
mainfrom
claude-limits

Conversation

@betodoescher

Copy link
Copy Markdown
Owner

Summary

Port of upstream Louis-CFM#159, adapted to the Windows/Linux home card.

  • Where the numbers come from. Claude Code only gives the plan limits (rate_limits.five_hour / seven_day: used % and reset time, Pro and Max) to its status line. coucou-hook --statusline relays just those limits to the app on a side thread and exits; nothing else from the status line input leaves the machine.
  • The user's own status line keeps working. Installing the Claude hooks now also sets statusLine. An existing command is kept hex-encoded in ours (--statusline --wrap <hex>), run through sh -c with the same input, and its output and exit code are passed through. Other fields (padding…) are untouched, reinstalling never wraps twice, and uninstalling puts the original command back. Same diff + backup + confirm flow as the hooks.
  • App. The pipe handles StatusLine without a session or log line, keeps the latest limits in claude-plan.json (rewritten only when a number moves or once a minute), and pushes them to the page.
  • Home card. The usage line shows Claude 42% (the higher of the two windows) instead of today's tokens once limits are known; the tooltip reads Claude plan: 42% of 5 hours (resets 14:30), 18% of week (resets Mon 09:00), plus the token count. A window past its reset counts as 0.
  • Settings flags installed Claude hooks without the status line as outdated, with an updated reinstall notice.

Test plan

  • cargo test -p coucou (status line wrap, rewrap, restore; limits parsing and validation)
  • cargo test -p coucou-hook (only the limits are relayed; hex round trip)
  • tsc --noEmit, npm run check
  • Simulated status line call against the running app: the wrapped line printed unchanged (6 ms), claude-plan.json written
  • Reinstall Claude hooks, run a real Claude Code session on a Pro/Max plan, hover the usage line

Claude Code only hands the limits to its status line, so the hooks install a
status line relay that wraps the user's own and restores it on uninstall.
@betodoescher
betodoescher merged commit 007c6d2 into main Oct 4, 2026
3 checks passed
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