Skip to content

About

Brainmetrix-style Claude Code terminal statusline: model, context bar, 5h/7d usage, reset countdown, git branch and folder — one portable bash script, no VS Code extension.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code Statusline

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%.


What it shows

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.


Requirements

  • Claude Code CLI
  • jq — parses the JSON payload Claude Code pipes to the script
  • git, GNU date — branch segment and reset countdown (standard on Linux; on macOS install GNU coreutils or the countdown segment is simply omitted)

Install

git clone https://github.com/gapsong/claude-code-statusline
cd claude-code-statusline
./install.sh

install.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.

Manual install

cp statusline.sh ~/.claude/statusline.sh
chmod +x ~/.claude/statusline.sh

Then add to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline.sh",
    "padding": 0
  }
}

How it works

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.


Cost side-channel

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.


Credits

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.

License

MIT

About

Brainmetrix-style Claude Code terminal statusline: model, context bar, 5h/7d usage, reset countdown, git branch and folder — one portable bash script, no VS Code extension.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages