Live progress bars in the Claude Code status line, showing context window usage, 5-hour session quota and 7-day weekly quota — the same numbers that appear on the claude.ai dashboard.
CONTEXT(Sonnet-4-6) ███░░░░░░░ 30% 306k/1.0M [sess:166k]
Tokens session ███░░░░░░░ 33% ↻ 47m
Tokens Week █░░░░░░░░░ 17% ↻ 2d
- CONTEXT(Model) — current model context window usage (input + cache tokens of the latest assistant response), with output tokens accumulated in the current session. The active model name is read dynamically from the current Claude Code transcript and highlighted in red.
- Tokens session — five-hour quota utilisation, with time until reset (Claude Pro/Max only)
- Tokens Week — seven-day quota utilisation, with time until reset (Claude Pro/Max only)
- Color-coded — green ≤70%, yellow 70–90%, red >90%
- Combines with existing status lines — wraps any prior
statusLinecommand instead of replacing it - Quota bars appear only when you are signed in with a Pro or Max plan; on free / API-only setups, only CONTEXT(Model) is shown
- Claude Code
>=2.0 (plugin system) - Node.js
>=18 - bash
>=4 - python3
Tested on Linux and native Windows with Cygwin bash. Should work on macOS and WSL.
Run these three commands in your terminal:
claude plugins marketplace add cleyton1986/claude-usage-bar
claude plugins install claude-usage-bar@claude-usage-bar
claude plugins listThe last command should show claude-usage-bar@claude-usage-bar with status enabled.
Then fully quit and reopen Claude Code (not just a new conversation — the app itself must restart). On the next session start the SessionStart hook runs automatically and wires the bars into your status line.
macOS note: if Claude Code is open in the Dock, right-click → Quit before reopening. A new conversation window is not enough.
/plugin marketplace add cleyton1986/claude-usage-bar
/plugin install claude-usage-bar@claude-usage-bar
Then fully quit and reopen Claude Code.
After restarting, send any message. The status line should show three rows:
CONTEXT(Sonnet-4-6) ███░░░░░░░ 30% 306k/1.0M [sess:166k]
Tokens session ███░░░░░░░ 33% ↻ 47m
Tokens Week █░░░░░░░░░ 17% ↻ 2d
If bars don't appear, see Troubleshooting.
git clone https://github.com/cleyton1986/claude-usage-bar.git
claude plugins marketplace add /absolute/path/to/claude-usage-bar
claude plugins install claude-usage-bar@claude-usage-barNo configuration required. The plugin auto-detects the current model, its context window (200k or 1M) and your plan tier. The [1m] and -1m model suffixes are used internally for context window detection but stripped from the display name to avoid ANSI escape collisions.
| File | Purpose |
|---|---|
src/hooks/setup.js |
SessionStart hook — installs the wrapper into settings.json (idempotent) |
src/hooks/update-usage.js |
UserPromptSubmit hook — caches session output tokens and quota as fallback |
src/statusline.sh |
Reads Claude Code's stdin JSON in real-time, renders the progress bars |
src/wrapper.sh |
Statusline glue — pipes stdin to your previous statusLine command and to the renderer, then concatenates outputs |
All values are read fresh on every render — there is no caching of live data.
Context bar (CONTEXT(Model))
- Model name: read directly from the latest JSONL transcript (
~/.claude/projects/**/*.jsonl) — reflects the actual model in use, including any proxy-routed model. - Context %: from
context_window.used_percentageon stdin (written by Claude Code after each API response), falling back to summinginput_tokens + cache_read + cache_creationfrom the current JSONL when stdin lacks it.
Tokens session and Tokens Week quota bars — three-tier, all real-time:
- stdin —
rate_limits.five_hour/rate_limits.seven_dayon the statusLine stdin JSON. Present for Claude.ai Pro/Max when the API response carriesanthropic-ratelimit-*headers. Not present when a proxy strips those headers. - OAuth endpoint (live HTTP) — when stdin lacks
rate_limits, the renderer callshttps://api.anthropic.com/api/oauth/usageusing the OAuth token in~/.claude/.credentials.json. This ensures quota is always current even through proxies. - Cache — written by the
UserPromptSubmithook as a last-resort fallback only. Stale if the OAuth call fails.
If neither source is available (e.g. API-key-only setup), the Tokens session/Tokens Week bars are simply skipped — the limits don't apply to API-billed accounts.
The percentages match the ones shown on the claude.ai dashboard — same source, same numbers.
Run the cleanup command first, then uninstall the plugin itself:
/usage-bar:uninstall
/plugin uninstall claude-usage-bar@claude-usage-bar
/usage-bar:uninstall restores your previous statusLine command (if any), removes the cache file, the saved previous-statusLine file, and the one-shot backup. If you skip it and run only /plugin uninstall, the next session will detect the stale statusLine entry pointing to the removed plugin cache and the bar simply won't render — your shell isn't affected, but you'll want to clear the dead entry manually:
node -e "const fs=require('fs'),p=require('os').homedir()+'/.claude/settings.json';const s=JSON.parse(fs.readFileSync(p,'utf8'));delete s.statusLine;fs.writeFileSync(p,JSON.stringify(s,null,2)+'\n')"Bars not showing after install
- Fully quit and reopen Claude Code — the
SessionStarthook only fires when the app starts a new session - Run
claude plugins listand verifyclaude-usage-bar@claude-usage-baris enabled - Check
~/.claude/settings.json— thestatusLine.commandshould point to.../claude-usage-bar/.../src/wrapper.sh - Send one message after restart so Claude Code writes fresh stdin/transcript data
Only CONTEXT(Model) bar shows, no Tokens session / Tokens Week
- Expected if you're on an API-key setup (no Pro/Max plan) — these limits don't exist for API-billed accounts
- Or Claude.ai OAuth credentials are missing/expired in
~/.claude/.credentials.json - Or the session hasn't made its first API call yet (rate-limit fields appear only after the first response)
Bars stuck at the same numbers
- The renderer reads live stdin/transcript/OAuth first; cache is only a fallback
- Send one message to force Claude Code to write new statusLine stdin/transcript data
- If quota stays stale, check whether Claude Code is still signed in to Claude.ai Pro/Max
settings.json keeps getting reset
- Some launchers (e.g. provider-switcher scripts) overwrite
~/.claude/settings.jsonon each start. Check~/.zshrc/~/.bashrcforalias claude=lines pointing to a switcher script.
Windows-specific: bars not showing or garbled output
- Ensure Cygwin bash is installed and
bashis on your PATH — the plugin shell scripts require it - Ensure Python 3 is installed — the renderer is an inline Python script inside
statusline.sh - If you see a
UnicodeEncodeErrorin the logs, your Python is using the wrong encoding — the v1.2.0+ fix addsPYTHONIOENCODING=utf-8automatically - If transcript/model data is missing, verify
cygpathis available (it ships with Cygwin) — it converts Cygwin paths to Windows paths for Python
- Quota fallback: when Claude Code's stdin lacks
rate_limits(e.g. through a proxy), the renderer callshttps://api.anthropic.com/api/oauth/usageusing the OAuth token already stored by Claude Code in~/.claude/.credentials.json. No token is sent elsewhere. - All other data comes from Claude Code's own session JSON on stdin and from local JSONL transcripts — no third-party services.
- Writes are restricted to
~/.claude/.usage-bar-*files and thestatusLinefield of~/.claude/settings.json - The wrapper strips control characters from the previous-statusLine command before executing it (prevents ANSI-escape injection)
MIT — see LICENSE.