tak-cc-statusline
v0.4.0
Published
A minimal, colorful statusline for Claude Code
Maintainers
Readme
tak-cc-statusline
A minimal, colorful statusline for Claude Code.
Opus 4.6 · high | prepare-deploy-3a • feature/louis-prepare-deploy | █░░░░░░░░░ 7% | 5h 21% (3h 12m) • 7d 3% (6d 9h) • Fable 12%Install
npx -y tak-cc-statusline@latestThat's it. Restart Claude Code. First render shows blank usage stats — they appear on the second.
The installer prompts before overwriting any existing statusLine config or scripts. Existing fields like padding are preserved when updating.
Workspace trust required. Claude Code only runs statusline commands in directories you've accepted the workspace trust dialog for. If you see
statusline skipped · restart to fix, open Claude Code in that directory and accept the trust prompt.
Requirements
jq, curl, Node 14+ (for the installer only). Works on macOS and Linux. Honors $CLAUDE_CONFIG_DIR if you've set it.
What it shows
| Segment | Source |
|---|---|
| Model · effort | Claude Code, with (1M context) etc. stripped; reasoning effort (.effort.level) appended when reported |
| Session · branch | Claude Code's own session name (debegi-fa, or whatever you set with /rename), else the folder name; branch from git symbolic-ref |
| Context bar + % | Claude Code's context_window.used_percentage |
| 5h / 7d % | Anthropic OAuth usage endpoint (cached 60s) |
| Per-model weekly % | Same endpoint's model-scoped weekly limits (e.g. Fable 12%); shown only when your plan has them, and labeled with whatever name the API reports |
Bar color: green < 50%, yellow ≥ 50%, rose ≥ 75%, red ≥ 90%.
Session name
The first row names the session rather than the folder, since the folder is the one thing you already know — the same name Claude Code shows for the session elsewhere: debegi-fa derived from the folder, fix-voice-session-detector if you set it with /rename.
Claude Code keeps one record per live session in ~/.claude/sessions/<pid>.json and puts its name there, so that is where the label comes from, matched on the session id. Two fallbacks behind it: session_name from the statusline payload, which Claude Code sends once you have run /rename, and then the folder name.
Labels are cut to 24 columns with an ellipsis, counting CJK characters as the two columns they occupy. Raise LABEL_MAX in statusline.sh for longer ones.
Narrow terminals
Claude Code truncates each status line rather than wrapping it, so on a narrow terminal the right-hand segments would simply disappear. Instead the line splits once, into identity and metrics:
Opus 4.6 · high | encl-7d • main | █░░░░░░░░░ 7% | 5h 21% (3h 12m) • 7d 3% (6d 9h) • Fable 12% ← wide
Opus 4.6 · high | encl-7d • main ← narrow
█░░░░░░░░░ 7% | 5h 21% (3h 12m) • 7d 3% (6d 9h) • Fable 12%Two rows at most. On a narrow pane vertical space is scarcer than horizontal, and a third row costs more than the truncation it avoids — so past that point the tail gets cut (a branch name you already know, or the last usage figure) rather than a whole segment.
Width comes from $COLUMNS, which Claude Code sets for the statusline process. If it is missing everything stays on one line, which is also the exact output you get on a wide terminal — the split never changes a line that already fits.
Note that Claude Code re-runs the statusline on message and state changes, not on terminal resize, so after resizing the split catches up on the next turn. Add "refreshInterval": 2 to the statusLine block in settings.json if you want it to track the window immediately.
Customize
Both scripts live in ~/.claude/ after install — edit them in place.
- Colors:
pick_color()instatusline.sh - Bar width:
BAR_WIDTHnear the top ofstatusline.sh - Split threshold:
WIDTH_MARGIN— columns held back from$COLUMNS; raise it to split earlier - Bar characters:
█and░inbuild_bar()— try▓/▒,■/□,▰/▱ - Session label length:
LABEL_MAXnear the top ofstatusline.sh - Model / session / branch colors: search for
\033[38;2;near the bottom
Troubleshooting
statusline skipped · restart to fix
You haven't accepted the workspace trust dialog for the current directory. Restart Claude Code in that folder and accept the trust prompt — statusLine commands run shell scripts, so they require the same trust as hooks.
Usage stats don't appear
sh ~/.claude/fetch-usage.sh
cat ~/.claude/.statusline_usage_cacheA healthy cache is five lines: the 5h and 7d percentages, their two reset timestamps, and the per-model weekly limits (empty if your plan has none). If the file is empty, your OAuth token couldn't be read. macOS: check Keychain for Claude Code-credentials. Linux: check ~/.claude/.credentials.json exists.
API returns 401
The hardcoded user-agent: claude-code/2.1.11 may need bumping. Edit fetch-usage.sh.
Reset the caches
rm ~/.claude/.statusline_usage_cache ~/.claude/.statusline_token_cacheUninstall
rm ~/.claude/statusline.sh ~/.claude/fetch-usage.sh
rm -f ~/.claude/.statusline_usage_cache ~/.claude/.statusline_token_cacheThen remove the statusLine block from ~/.claude/settings.json.
Credits
Forked from xleddyl/claude-watch — most of the heavy lifting (rate-limit fetching, color scheme, original layout) is theirs. This package adds:
- npm one-liner install with conflict-aware prompts
- macOS + Linux portability
$CLAUDE_CONFIG_DIRsupport- Background fetch with locking, atomic writes, and retry throttling
- Per-model weekly limits from the usage endpoint's
limitsarray - Width-aware layout that splits into two rows instead of being truncated
- Session name in place of the folder name, read from Claude Code's session registry
License
MIT
