Requirements
Python 3.10 or newer. Claude Code; v2.1.153 or newer for the multi-line layout on narrow terminals. Optional: git for branch info, the gh CLI for the PR number.
Install
pip install context-statsuv pip install context-statsConfigure
Wire the status line into Claude Code:
context-stats doctor --fixOr add this to ~/.claude/settings.json by hand:
{ "statusLine": { "type": "command", "command": "claude-statusline" } }Settings live in ~/.claude/statusline.conf as key=value lines, no spaces around =. The file is created with defaults on first run.
show_deltatokens used since the last refresh. Default true.show_miModel Intelligence score. Default false.show_costsession cost in USD. Default true.show_effortreasoning effort next to the model. Default true.show_pacmanzone icon next to the zone label. Default true.show_prpull-request number for the current branch (needs gh). Default true.show_sessionsession ID. Default true.show_tpsgeneration throughput in tokens/s. Default false.show_accountlogged-in Claude account email. Default false.token_detailexact token counts (true) or abbreviated, like 64.0k (false). Default true.autocompactset true when autocompact is on in Claude Code's /config. Default false.color_<element>18 named colors or any #rrggbb hex, such ascolor_mi_score=#ff9e64.
First run
Restart Claude Code. On the next turn the status line shows, for example:
my-project | main [3] | 64,000 free (32.0%)·Code·ᗤ | MI:0.918 | +2,500 | $0.42 | Opus 4.6·high | abc-123
Commands
context-stats doctorcheck the install chain; exits non-zero on failurecontext-stats doctor --fixwrite the statusLine block into settings.json, with a backupcontext-stats sessionssessions active in the last 5 minutes;--minutes 30widens the windowcontext-stats graphlive context-growth graph for the latest sessioncontext-stats graph --type allevery graph: delta, cumulative, cache, mi, io, tpscontext-stats graph -w 5 / --no-watchrefresh every 5 seconds / draw once and exitcontext-stats <session_id> graphgraphs for a specific sessioncontext-stats export --output report.mdMarkdown deep-dive of the latest sessioncontext-stats report --since-days 30cost and cache report across all projects
Troubleshooting
- Status line not appearingrun
context-stats doctorand apply the fix it prints. - context-stats: command not foundadd ~/.local/bin to PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc - Configuration not taking effectremove spaces around = (
show_delta=true), then restart Claude Code. - Delta always shows zerothe first refresh sets a baseline; check the state file grows with
wc -l ~/.claude/statusline/statusline.*.state
Uninstall
[proof needed — documented uninstall command], then remove the statusLine block from ~/.claude/settings.json.