The status line is the row at the bottom of Claude Code. You give it a shell script, Claude Code sends that script a JSON blob about the session, and whatever the script prints is shown. Model, folder, git branch, how full the context window is, what the session has cost so far: anything you can compute from that JSON or from your shell.
The number that matters most is context usage. A session gets worse and more expensive as the context window fills, and the status line shows it filling while you work.
Type /statusline with a description of what you want:
/statusline show model name, git branch and context percentage with a progress bar
Claude writes a script into ~/.claude/ and updates your settings. To remove it, /statusline delete.
Save a script, for example ~/.claude/statusline.sh:
#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
BRANCH=$(git -C "$DIR" branch --show-current 2>/dev/null)
echo "[$MODEL] ${DIR##*/} ${BRANCH:+($BRANCH)} | ${PCT}% context"
Make it executable with chmod +x ~/.claude/statusline.sh, then point your settings at it:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh"
}
}
Two optional fields: padding adds horizontal spacing, and refreshInterval re-runs the script every N seconds, for anything time-based such as a clock.
The JSON on stdin has a lot in it. The useful parts:
model.display_name: the model this session runs onworkspace.current_dir and workspace.project_dir: where Claude is now, and where the session startedworkspace.git_worktree: the worktree name, when you're in onecontext_window.used_percentage and context_window.remaining_percentage: how full the context is, already calculatedcontext_window.context_window_size: the maximum, 1,000,000 tokens on current modelscost.total_cost_usd: the session's estimated cost at list pricecost.total_duration_ms: how long the session has runrate_limits.five_hour.used_percentage and rate_limits.seven_day.used_percentage: how much of your plan's limits you have usedThe cost figure is computed on your machine at list price. On a subscription it measures usage, and you won't get a bill for that amount.
The script runs when the session starts, after each new assistant message, after /compact, when the permission mode changes, and on the refreshInterval if you set one, plus a few smaller triggers such as a rate-limit reset. Updates are debounced by 300 ms, so a burst of changes runs the script once. Keep the script fast, because it runs often. The example above calls git once per run, which is fine. A full git status in a big repo on every message is slow.
Colors work with ANSI escape codes, for example \033[32m for green, if your terminal supports them.
/clear between tasks or /compact with instructions./model, or if your subagents run on different models.Leave out anything you won't act on. I wrote about the same problem with monitoring in stuff I built to manage 100+ apps: a dashboard nobody checks makes you think something is being watched when nothing is.
New essays like this one, by email. No schedule, no slop.