vbcherepanov/claude-statusbar
vbcherepanov/claude-statusbar has 29 GitHub stars and 1 forks. Star changes are not measured yet. Last checked 2026-11-14 13:10 UTC. Last push 2026-11-04.
Gemessener Sternzuwachs
- in 24h
- Verlauf wird gesammelt
- in 7 days
- Verlauf wird gesammelt
- in 15 days
- Verlauf wird gesammelt
- in 1 month
- Verlauf wird gesammelt
NettoΓ€nderungen in ΓΌberlappenden ZeitrΓ€umen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht QualitΓ€t.
Γber uns
π₯οΈ A rich, two-line status bar for Claude Code CLI β real-time model, context usage, tokens, cost, duration, git branch, cache stats and more in your terminal
EntwicklerwerkzeugeREADME.md
Originalclaude-statusline
A rich, three-line status bar for Claude Code CLI β works on macOS, Linux, WSL2, and Windows.
Displays real-time session metrics directly in your terminal β model, context usage, tokens, cost, duration, git branch, cache stats, subscription usage limits, and more.
Opus 5.5 high | [ββββββββββββββββββββ] 42% of 1.0M #1 | β156.8K β23.4K | cache r:89.0K w:45.0K
$1.47 | β± 5m42s (api 3m18s) | +245/-31 | β feature/x | π my-project | π’ PR#42 | [N]
Ultra | 7d [ββββββββββ] 52% β»1d20h | Fable [ββββββββββ] 70% β»1d20h
What's new in 1.4.0
- Limits follow your plan. Plans without a 5-hour window no longer show a
5hgauge, and a stale ornullresponse can't freeze the line. - Fable gauge. The separate weekly Fable limit gets its own bar.
- Subscription name.
Pro,MaxorUltraat the start of the limits line. - Effort level next to the model name, coloured by level.
- Readable secondary text. Labels, separators and reset times are light gray;
STATUSLINE_MUTED_COLORchanges the shade. - No more HTTP 429 loops. Failed usage requests back off and honour
Retry-After.
Full history: CHANGELOG.md.
Why this exists
Claude Code's built-in status line shows the model name and a terse percentage. That's fine until you:
- Burn through your 5-hour / 7-day subscription quota without noticing and get cut off mid-task.
- Hit context auto-compaction and lose state because you didn't see 85% approaching.
- Rack up API cost on long sessions with no live $ counter.
- Lose track of cache hits vs writes when debugging performance.
- Switch between projects and forget which branch you're on.
claude-statusline solves all of it in a single shell script β zero runtime dependencies beyond jq and curl, ~20 ms per update, no daemon, no background process.
What it shows
Line 1 β model, context, tokens, cache
Model EFFORT | [ββββββββββββ] PCT% of SIZE #W | βinput βoutput | cache r:READ w:WRITE
- Model name β which Claude model is active (color: cyan bold)
- Effort level β
low,medium,high,xhighormax, when the model supports it - Context usage bar β 20-char visual progress bar with color thresholds (green < 70% β yellow < 90% β red)
- Compaction counter
#Nβ increments every time the context window gets compacted during a session - Token counts β input (
β) and output (β) withK/Mformatting - Cache stats β cache read / write token counts
Line 2 β cost, time, diff, git, context
$COST | β± DURATION (api API_DUR) | +ADDED/-REMOVED | β BRANCH | π DIR | [N]
- Cost in USD (yellow)
- Duration total and API-only separately
- Lines added/removed during the session
- Git branch (when in a repo)
- Working directory name
- PR badge β
π’ PR#N(open) Β·β PR#N(approved) Β·π΄ PR#N(changes requested) Β·π‘ PR#N(draft) Β·π’ MR#N(GitLab) Β·Β· no PR(repo detected, no open PR on this branch). Sourced from Claude Code's documentedpr.*andworkspace.repostdin fields; the oldergithub.*shape still works. - Vim mode
[N]/[I]indicator (when vim mode is active) - Sub-agent name (when an agent is running)
β >200Kwarning when tokens exceed 200K
Line 3 β Claude subscription limits
Pro | 5h [ββββββββββ] 68% β»2h41m | 7d [ββββββββββ] 52% β»1d20h
Max | 5h [ββββββββββ] 68% β»2h41m | 7d [ββββββββββ] 52% β»1d20h | Fable [ββββββββββ] 70% β»1d20h
Ultra | 7d [ββββββββββ] 52% β»1d20h | Fable [ββββββββββ] 70% β»1d20h
Shows remaining quota with a fuel-gauge colour (green > 50% β yellow > 20% β red) and a countdown to reset. Only the limits your plan actually has appear: a plan without a 5-hour window simply has no 5h gauge. The examples show what each plan is documented to have: on Pro, Fable runs on usage credits, and verified Ultra accounts have no 5-hour limit. The gauges follow what the server returns, so plan changes need no update here.
| Gauge | Source |
|---|---|
5h, 7d |
Claude Code's documented rate_limits stdin field. Before the session's first API response, the cached endpoint below. |
Fable and other per-model or per-surface limits |
https://api.anthropic.com/api/oauth/usage, limits[] rows. This endpoint is undocumented and may change; Claude Code's stdin doesn't carry these limits. |
spend |
rate_limits.spend_limit behind a Claude apps gateway. |
Subscription name (Pro, Ultra, β¦) |
plan_display_name from the undocumented /api/oauth/profile, refreshed hourly and cached in ~/.claude/.usage-plan. If that fails, derived from the OAuth credential. |
The endpoint is cached for 2 minutes and every failure is backed off (Retry-After on HTTP 429, 5 minutes otherwise), so a failing endpoint is never retried on each render. A ~ before the percentage (~59%) means the cached value is more than 15 minutes old. Windows whose reset time has passed are hidden.
The Fable percentage is what the server reports for that limit. On Max and Ultra, Fable can use up to 50% of the weekly limit and also draws from the regular weekly limit, so 7d falls as you use it too.
Limits in Codex
This status line covers Claude Code only. Codex CLI doesn't run custom status line scripts, but its own footer has built-in limit items. Add them to ~/.codex/config.toml; an item appears only when your plan has that window:
[tui]
status_line = ["model-with-reasoning", "context-used", "total-input-tokens", "total-output-tokens", "estimated-thread-cost", "git-branch", "project-name", "five-hour-limit", "weekly-limit"]
Platform support
| Feature | macOS | Linux | WSL2 | Windows (Git Bash) |
|---|---|---|---|---|
| Status bar | β | β | β | β |
| Usage limits (OAuth) | β Keychain | β libsecret β file | β file | β Cred Manager β file |
| Desktop notifications | β
osascript |
β
notify-send* |
β
notify-send* |
β
BurntToast* |
| Installer | install.sh |
install.sh |
install.sh |
install.ps1 |
* β optional. If the notifier isn't installed the feature silently no-ops (status line still works).
WSL2 is treated as Linux (detected via /proc/version). If you want native Windows toast notifications from inside WSL2 you'll need WSLg + a Linux notifier, or invoke BurntToast via powershell.exe.
Requirements
- jq β JSON processor
- curl β for usage limits API (skips gracefully if missing)
- bash β 3.2+ (macOS default) or any modern 4/5
- Claude Code CLI β v1.0+ with status line support
- Optional:
notify-send(Linux),libsecret-tools(Linux),BurntToast(Windows)
Install jq on your platform:
| OS | Command |
|---|---|
| macOS | brew install jq |
| Debian/Ubuntu | sudo apt-get install jq |
| Fedora/RHEL | sudo dnf install jq |
| Arch | sudo pacman -S jq |
| Alpine | sudo apk add jq |
| Windows | winget install jqlang.jq or choco install jq |
Installation
macOS / Linux / WSL2
git clone https://github.com/vbcherepanov/claude-statusbar.git
cd claude-statusbar
bash install.sh
Windows (Git Bash + PowerShell)
git clone https://github.com/vbcherepanov/claude-statusbar.git
cd claude-statusbar
powershell -ExecutionPolicy Bypass -File install.ps1
(You can also run bash install.sh inside Git Bash on Windows β it'll work the same way.)
The installer will:
- Detect your OS and check dependencies with platform-specific install hints
- Copy
statusline.shto~/.claude/statusline.sh - Add the
statusLineconfig to~/.claude/settings.json - Prompt before overwriting existing files
Manual install
cp statusline.sh ~/.claude/statusline.sh
chmod +x ~/.claude/statusline.sh
Add to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "/ABSOLUTE/PATH/TO/.claude/statusline.sh",
"padding": 2
}
}
On Windows the command is bash 'C:/Users/YOU/.claude/statusline.sh'.
Restart Claude Code.
How it works
Claude Code pipes session JSON to stdin every ~300 ms. The script:
- Parses all 16 fields in a single
jqcall with@shfor safe eval - Formats values in pure bash (no
bc, noawk, no extra subshells) - Reads usage limits from stdin, plus a 2-minute cache of the usage endpoint with backoff (background on macOS/Windows, sync on Linux/WSL2 β because Claude Code kills backgrounded child processes on exit)
- Writes threshold flags at 70% / 85% / 95% context for hook integration
- Outputs up to three ANSI-coloured lines
Execution time: ~20 ms on macOS (cache warm), ~100 ms on Linux cold start.
The code is a single self-contained shell script. No daemon. No database. No network except the cached usage-limits endpoint.
Configuration
All toggles are environment variables β set them in your shell profile or a wrapper script.
| Variable | Default | Purpose |
|---|---|---|
STATUSLINE_USAGE_LIMITS |
1 |
Set 0 to disable all usage limit lines (no network calls) |
STATUSLINE_MUTED_COLOR |
250 |
256-color number for secondary text (labels, separators, reset times). Use a darker gray such as 240 on a light background |
STATUSLINE_PLAN |
1 |
Set 0 to hide the subscription name |
STATUSLINE_WINDOW_COUNTER |
1 |
Set 0 to disable #N compaction counter |
STATUSLINE_FLAGS |
1 |
Set 0 to disable threshold flag files |
STATUSLINE_FLAG_DIR |
~/.claude/.context-flags |
Custom directory for flag files |
STATUSLINE_GITHUB |
1 |
Set 0 to hide the PR badge from line 2 |
CLI flags
statusline.sh --version # prints: claude-statusline 1.4.0
statusline.sh --help # flags, env vars, and link to repo
Threshold flags
When context usage crosses 70 / 85 / 95 %, the script writes a JSON file to $STATUSLINE_FLAG_DIR. Claude Code hooks can watch this directory to trigger auto-save, notifications, or whatever else.
{"pct":87,"in":"156.8K","out":"23.4K","cost":"$1.47","dur":"5m42s","cwd":"/path","t":"2026-04-19T16:06:42Z"}
At 85% and 95% you also get a native desktop notification (macOS / Linux / WSL2 / Windows β see Platform support).
Usage limits β credential resolution
Fetches subscription quota using your Claude OAuth token. The script tries, in order:
- macOS β Keychain via
security find-generic-password - Windows β Credential Manager via
powershell.exe+CredentialManagermodule - Linux/WSL2 β libsecret via
secret-tool - Everywhere β fallback to
~/.claude/.credentials.json(0600perms)
The file fallback is what makes Linux work out-of-the-box (Claude Code doesn't write to the Linux keyring). It's also why you can have a broken keyring on macOS/Windows and the script still works.
Requires claude.ai OAuth login. API-key users will simply not see line 3.
Testing
cat examples/sample-input.json | bash statusline.sh
You can pipe this to the script on any platform to see a rendered status line without launching Claude Code.
bash tests/run.sh
Runs the regression suite offline: curl and the credential stores are stubbed.
Uninstall
bash uninstall.sh
Or manually:
rm ~/.claude/statusline.sh
rm -rf ~/.claude/.context-flags ~/.claude/.usage-cache.json ~/.claude/.usage-next-attempt ~/.claude/.usage-plan
# Remove the "statusLine" key from ~/.claude/settings.json
Support the project
If this saves you time (or subscription cost), consider buying me a coffee:
There's also a Sponsor button at the top of the GitHub repo (.github/FUNDING.yml β PayPal).
Contributing
Bug reports and PRs welcome, especially platform-specific fixes. The entire thing is one shell script β you can read it in 10 minutes.
Before a PR:
bash -n statusline.sh install.sh uninstall.sh # syntax
shellcheck statusline.sh install.sh uninstall.sh # lint (optional)
cat examples/sample-input.json | bash statusline.sh # smoke test