Claude Code status line: how to set it up, and what to show
Set up Claude Code's status line in settings.json or with /statusline, what data it receives, what it cannot show, and how Caprock fills the gap.
The status line is the row above Claude Code's footer. It runs a command you choose, pipes the session's state to it as JSON, and shows whatever the command prints. You can write that command, ask Claude Code to write it, or point it at a tool.
Set it up
The shortcut is the /statusline command inside Claude Code. Describe what you want, and Claude Code writes a script into ~/.claude/ and the setting for you:
/statusline show model name and context percentage
/statusline remove takes it out again. By hand, add a statusLine key to ~/.claude/settings.json (or a project's settings). type is always command; command is a script path or an inline shell command:
{ "statusLine": { "type": "command", "command": "~/.claude/statusline.sh" } }
Or use Caprock's line:
- 1
Register caprock statusline as your statusLine command, after a backup of settings.json
caprock up offers the same when it starts.
- 2
Remove Caprock's entry and nothing else
What Claude Code passes in
| Field | What it is |
|---|---|
model.display_name | the model in use |
context_window.used_percentage | how full the context is, input tokens only; can be null early in a session |
cost.total_cost_usd | Claude Code's estimate at list price; resets to zero on /clear |
rate_limits.five_hour | how much of the five-hour window is used, and when it resets |
rate_limits.seven_day | the same for the seven-day window |
rate_limits is there only for Pro and Max subscribers (or behind a gateway with a spend limit), and only after the first response.The command runs when a session starts and again on each assistant message, after /compact, and on a few other changes, debounced at 300ms. If a new update arrives while your command is still running, Claude Code cancels it — so the command has to be fast.
What it cannot show
| On the line | A script reading stdin | Caprock's line |
|---|---|---|
| Model, context, session cost | yes | yes |
| Five-hour and seven-day windows | yes, on Pro and Max | yes, coloured as they fill |
| What the cache saved | no | yes, as a share of the bill |
| Turns and tool calls | no | yes |
| Today's total across sessions | no | no |
Everything on stdin is about this session, right now. A total across sessions or days needs something that has been keeping the record. That is what ccusage and Caprock add, in different ways. For a team, the record can also be an OpenTelemetry collector: Claude Code OpenTelemetry.
Caprock's status line
Here is the line on this session, with the Claude Code half of the input filled in by hand so it can be shown:
$ caprock statusline < sample.json ⛰ · Opus 5.5 · ctx 41% · $12.34 · 1842 turns · 1975 steps · cache −89% · 5h 23% resets 17:00 · 7d 61%
- Turns and steps — this session's turns and tool calls, from Caprock's own record.
- cache −89% — the share of the bill the prompt cache cut, computed the same way as the app's Cost screen. Not the hit rate: on my machine most sessions sit above 99%, so it barely moves — the two, measured side by side.
The line fits your terminal. When it is too wide, token totals go first, then the cache figure, then turns and steps; the model, context, cost and plan windows always stay. The plan windows are also sent to the app, so its Cost screen can show them — those numbers and the session id, nothing else from the JSON.
In the Caprock app, Settings → Status line picks the line: Full (the default) is all of the above; Short is model, context and the plan windows; Hidden prints nothing, so Claude Code gets its row back while the plan windows still reach Caprock; Off removes Caprock's entry from Claude Code's settings, never a line you set yourself.
ccusage or Caprock
| ccusage | Caprock | |
|---|---|---|
| Runs as | bun x or npx, no background process | a desktop app that records in the background |
| Session cost | yes | yes |
| Today's total | yes | no |
| Plan window | current five-hour block, time left | five-hour and seven-day, from Claude Code |
| Hourly burn rate | yes | no |
| Context | yes | yes |
If a day's total and a burn rate are what you want on the line, ccusage does that and Caprock does not. Caprock's line comes from the same record that holds every session on the machine, whether or not Caprock started it — who is waiting on you, how close each subscription is to its limit, what each pull request cost — kept past Claude Code's 30-day cleanup.
Troubleshooting
| Problem | Why | Fix |
|---|---|---|
| Caprock's counters are missing | the daemon was unavailable, slow or returned an error | open the Caprock app, or start the daemon with caprock up |
install left your old line in place | Caprock never overwrites a line you set | set command to caprock statusline yourself, and keep the old one somewhere |
| A hand-written path on Windows breaks | Git Bash treats unquoted backslashes as escapes | forward slashes, quoted |
Caprock's counters need a read from its local daemon, with a 40ms budget; past that you get the plain line, and the command always exits cleanly. caprock statusline --plain turns the counters off. On Windows, Claude Code runs status line commands through Git Bash when it is installed, so Caprock writes its own path with forward slashes and quotes.
Questions people ask
- How do I set up a status line in Claude Code?
- Type /statusline followed by what you want, such as "show model name and context percentage", or add a statusLine command to ~/.claude/settings.json.
- How do I remove the Claude Code status line?
- Run /statusline remove, or delete the statusLine key from settings.json.
- Can the Claude Code status line show my usage limits?
- Yes, on Pro and Max: rate_limits.five_hour and rate_limits.seven_day say how much of each window is used and when it resets, from the first response on.
- Why is context_window.used_percentage null?
- It can be null early in a session. It counts input tokens only.
- Is the cost on the status line my real bill?
- No. cost.total_cost_usd is Claude Code's estimate at list price; it may differ from your bill and resets to zero on /clear.
- Will Caprock overwrite my existing status line?
- No. caprock up and caprock statusline install leave it in place and say so; caprock statusline uninstall removes only Caprock's entry.
Sources
- Claude Code docs — Customize your status line, read 20 October 2026
- Claude Code docs — Settings reference: cleanupPeriodDays, read 20 October 2026
- ccusage — Statusline integration, read 20 October 2026
- Caprock docs — Settings → Status line: Full, Short, Hidden, Off (docs/app.md)
- Caprock contract — Statusline
- Caprock source — internal/statusline
Try it
The record of every coding agent you run, the sessions it did not start included. Free, open source; nothing leaves your machine.
Notarized by Apple. One file for Apple silicon and Intel, macOS 13 or later.
Or run it yourself:
Paste in Terminal: it installs Caprock and opens it.Or with Homebrew: brew install --cask dspv/tap/caprock-app