Skip to content

About

Two-line status line for Claude Code: which checkout you're in, context remaining, and live session cost. Pure bash + jq — one file, no dependencies.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

StatusLine

A two-line status line for Claude Code.

It answers the three things I kept losing track of mid-session: which checkout am I in, how much context is left, and what is this costing me.

Opus 5 (1M)/high · StatusLine · wt:fix-login←master · fix/login · PR #412 approved
█████░░░░░░░ 38% ctx (620k left) · $1.23 · $7.40/hr · 81% cached · +128/-34 · 5h 22% (2h00m) · 7d 61% (3d11h)

Bash and jq. No Node, no network calls, nothing to npm install. One file, ~200 lines, renders in about 13 ms.

Install

curl -fsSL -o ~/.claude/statusline.sh \
  https://raw.githubusercontent.com/politekashif/StatusLine/main/statusline.sh
chmod +x ~/.claude/statusline.sh

Then point ~/.claude/settings.json at it:

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

If you already have a settings.json, back it up first — cp ~/.claude/settings.json ~/.claude/settings.json.bak — and add the statusLine key rather than replacing the file. Start a new session to pick it up.

Want to see it before you commit to it? Pipe a session payload straight in:

echo '{"model":{"display_name":"Opus"},"context_window":{"used_percentage":42}}' \
  | ~/.claude/statusline.sh

Requirements

Needs Why
bash ≥ 4.2 mapfile and printf '%(%s)T'. macOS ships bash 3.2 — brew install bash
jq the whole stdin payload is parsed in a single jq call
git optional. Without it the branch and dirty-marker fields simply don't render
awk optional. Only the burn-rate field uses it

Missing anything optional degrades one field. It never breaks the line.

The fields

Line 1 — where am I?

Field Shows
Opus 5 (1M)/high model, and reasoning effort when set
fast fast mode is on
agent:name you're inside a subagent
StatusLine current directory, basename only
wt:fix-login←master git worktree, and the branch it was cut from
fix/login branch. Green normally, orange on master/main, * if dirty
PR #412 approved PR number and review state — green approved, red changes requested

Line 2 — what is it costing?

Field Shows
█████░░░░░░░ 38% ctx (620k left) context used, and tokens still available
$1.23 session cost so far
$7.40/hr burn rate. Hidden for the first 60 s, when it's pure noise
81% cached share of input tokens served from cache — a direct cost lever
+128/-34 lines added and removed this session
5h 22% (2h00m) rate limit used, and time to reset
7d 61% (3d11h) same, weekly window

Everything on line 2 arrives free in the payload Claude Code pipes to the script. No API calls, nothing to poll.

Colours

Thresholds are all near the top of the file, and each is a plain if you can move.

Dim Green Yellow Orange Red
context — < 50% < 75% < 90% ≥ 90%
burn rate < $3/hr — < $10/hr — ≥ $10/hr
cache hit 40–69% ≥ 70% < 40% — —
rate limits < 60% — < 85% — ≥ 85%

The palette is 256-colour and picked to stay readable on both light and dark terminals. WIDTH=12 sets the length of the context bar.

Three rules I held to

Never break the UI. Missing jq, malformed input, a payload shape that changed under me — every path prints something minimal and exits 0. A status line that errors is worse than no status line.

One jq call, not twenty-five. This runs on every frame. Every field is read in a single pass.

No CI status, on purpose. I measured it: local git is ~5 ms, gh pr checks is ~539 ms. The only way to afford that is a background cache, and a bar confidently showing green CI that went red ten minutes ago is worse than showing nothing at all. Same reason git status runs with --untracked-files=no — on a repo with a big node_modules the scan makes the whole line stutter.

Licence

MIT. Take it, fork it, change the colours.

About

Two-line status line for Claude Code: which checkout you're in, context remaining, and live session cost. Pure bash + jq — one file, no dependencies.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages