[FEATURE] Expose rate limit / 5-hour usage data for status line and external tooling
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
The /usage command shows the current 5-hour rate limit consumption, but this data is only accessible interactively inside a session. There's no way for external scripts — like the status line command — to read this data programmatically.
Users who set up a status line to monitor context window usage naturally want to also track how much of their 5-hour rate limit window they've consumed, but there's no file, environment variable, API endpoint, or CLI flag that exposes it.
Proposed Solution
Expose the 5-hour usage data externally via one or more of:
- A local state file (e.g.
~/.claude/usage.json) updated after each API call - A CLI flag like
claude --usagethat outputs current usage as JSON - An environment variable available to status line commands
This would let users wire rate limit tracking into their status line or other monitoring tooling.
Alternative Solutions
Currently the only option is to manually run /usage inside the session and visually check. There's no workaround for automated or passive tracking.
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
- User configures a status line script to show context window usage
- User also wants to see "5hr limit: 42% used" alongside the context bar
- The status line script reads from ~/.claude/usage.json or calls claude --usage
- The rate limit percentage is appended to the status line output
- User can pace their work and avoid hitting limits unexpectedly
Additional Context
This came up while configuring the Claude Code status line feature. Context window tracking works great via status line, but rate limit data is locked behind the interactive /usage command with no external access path.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗