A Brainmetrix-style statusline for Claude Code in the terminal — model, context usage, 5-hour / 7-day rate limits, reset countdown, git branch and folder, right under your prompt. One portable bash script. No VS Code extension required.
✨ Opus 4.8 │ █········· 13% │ Session:6% │ Weekly:19% │ ↻ 1h 26m │ ⎇ main │ 📁 my-project
Colors follow green → yellow → red at 50% and 80%.
| Segment | Description |
|---|---|
✨ Opus 4.8 |
Current Claude model |
█········· 13% |
Context-window usage (10-cell bar, green → yellow → red) |
Session:6% |
5-hour rolling usage |
Weekly:19% |
7-day usage |
↻ 1h 26m |
Time until the 5-hour limit resets |
⎇ main |
Git branch of the working folder |
📁 my-project |
Current folder |
Every segment degrades gracefully: if Claude Code doesn't supply a field (older
versions may omit context_window / rate_limits), that segment reads 0%, while
model, branch and folder always work.
- Claude Code CLI
jq— parses the JSON payload Claude Code pipes to the scriptgit, GNUdate— branch segment and reset countdown (standard on Linux; on macOS install GNU coreutils or the countdown segment is simply omitted)
git clone https://github.com/gapsong/claude-code-statusline
cd claude-code-statusline
./install.shinstall.sh copies statusline.sh to ~/.claude/statusline.sh and registers it in
~/.claude/settings.json (backing up any existing settings first). It's idempotent —
safe to re-run. Open a new prompt in Claude Code and the statusline appears.
cp statusline.sh ~/.claude/statusline.sh
chmod +x ~/.claude/statusline.shThen add to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"padding": 0
}
}Claude Code calls the statusLine command on every prompt and pipes a JSON payload on
stdin (model, context_window.used_percentage, rate_limits.five_hour /
seven_day, workspace.current_dir, …). statusline.sh reads those fields with jq
and renders the coloured line. It's a self-contained ~70-line script — read it, tweak
it, make it yours.
On every render the script also writes the real session numbers Claude Code hands it to a small per-session file, purely as a side effect — the visible statusline is unchanged. Other tools (e.g. a cost-tracking hook, or a fleet dashboard) can read the authoritative figures from there instead of estimating them:
${TMPDIR:-/tmp}/harness-cost-<session_id>.json
{"ts":1785941046,"cost_usd":0.4213,"context_pct":13,"rate_5h_pct":6,"rate_7d_pct":19}
Written atomically (temp file + mv, so a reader never sees a half file). Fields absent
from the payload are omitted rather than written as null; with no session_id nothing
is written. It never fails the statusline. Nothing reads this file by default — it's just
a source of truth for tools that want one. Run ./test/statusline.test.sh to verify.
A native-terminal rebuild of the excellent Claude Statusline VS Code extension by Vivek Singh Rajput (Brainmetrix), for people who live in the terminal rather than the VS Code status bar.
MIT