Status line script for Claude Code that displays model, usage limits, git state, and workspace context in your terminal's status bar.
Real rate limit data. Other tools count tokens locally from transcript files. This script reads server-side five_hour and seven_day utilization from Anthropic's OAuth API -- the actual numbers the rate limiter tracks.
No permission prompts. It's a plain CLI script, not a sandboxed app. Keychain is read by delegating to /usr/bin/security -- an Apple-signed system binary that already has Keychain access. The script itself never touches the Security APIs, so macOS has no reason to prompt. Outbound network from CLI doesn't trigger the firewall dialog either.
- Model -- current model name
- Context window -- remaining % from Claude Code's input
- 5h usage -- session utilization with countdown to reset
- 1w usage -- weekly utilization with reset date
- Git -- branch, worktree (when in a git worktree), staged/modified counts, ahead/behind
- Live refresh -- cache updated automatically after each agent response via Claude Code
Stophook, with 30-second debounce
- Ruby (system Ruby on macOS works fine)
- macOS with Claude Code authenticated (
clauderun at least once)
curl -fsSL https://raw.githubusercontent.com/romacv/claude-plan-usage-statusline/main/install.sh | shOr manually: copy statusline.rb to ~/.claude/statusline.rb and add to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "ruby ~/.claude/statusline.rb",
"padding": 0
}
}curl -fsSL https://raw.githubusercontent.com/romacv/claude-plan-usage-statusline/main/uninstall.sh | shRemoves statusline.rb, refresh-usage-cache.sh, cache files, and the statusLine + Stop hook entries from settings.json.
- Reads OAuth token from macOS Keychain via
security find-generic-password - Calls
https://api.anthropic.com/api/oauth/usagewith the token - Caches the response locally; skips the API call if cache is fresh
- Collects git state via
git status/git rev-parse/git rev-list - Outputs a two-line status bar with model, context, usage, reset timer, and git info
- A
Stophook runsrefresh-usage-cache.shasynchronously after each agent response, keeping the cache fresh without blocking Claude Code. Debounced to at most one API call per 30 seconds.
For a native menu bar experience, check out Usage Battery for Claude Code on the Mac App Store.
## License
MIT