Claude Code status line: how to set it up, and what to show

Dmitriy Solodukha · checked against Caprock v0.140.1

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

    Register caprock statusline as your statusLine command, after a backup of settings.json

    caprock up offers the same when it starts.

  2. 2

    Remove Caprock's entry and nothing else

What Claude Code passes in

The fields people put on the line, from the JSON object Claude Code sends on stdin.
FieldWhat it is
model.display_namethe model in use
context_window.used_percentagehow full the context is, input tokens only; can be null early in a session
cost.total_cost_usdClaude Code's estimate at list price; resets to zero on /clear
rate_limits.five_hourhow much of the five-hour window is used, and when it resets
rate_limits.seven_daythe same for the seven-day window
The cost may differ from your bill. 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

What each kind of status line can show.
On the lineA script reading stdinCaprock's line
Model, context, session costyesyes
Five-hour and seven-day windowsyes, on Pro and Maxyes, coloured as they fill
What the cache savednoyes, as a share of the bill
Turns and tool callsnoyes
Today's total across sessionsnono
Claude Code now passes the cache hit ratio, but not what the cache saved in money.

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

Two status lines that keep a record, from each project's docs.
ccusageCaprock
Runs asbun x or npx, no background processa desktop app that records in the background
Session costyesyes
Today's totalyesno
Plan windowcurrent five-hour block, time leftfive-hour and seven-day, from Claude Code
Hourly burn rateyesno
Contextyesyes

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

Status line problems.
ProblemWhyFix
Caprock's counters are missingthe daemon was unavailable, slow or returned an erroropen the Caprock app, or start the daemon with caprock up
install left your old line in placeCaprock never overwrites a line you setset command to caprock statusline yourself, and keep the old one somewhere
A hand-written path on Windows breaksGit Bash treats unquoted backslashes as escapesforward 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

Try it

The record of every coding agent you run, the sessions it did not start included. Free, open source; nothing leaves your machine.

Download for Mac

Notarized by Apple. One file for Apple silicon and Intel, macOS 13 or later.

Or run it yourself:

curl -fsSL https://caprock.dev/mac.sh | sh

Paste in Terminal: it installs Caprock and opens it.Or with Homebrew: brew install --cask dspv/tap/caprock-app