Custom status line for Claude Code CLI.
Shows directory, git branch, context window usage with a progress bar, model name, session cost and your 5-hour / 7-day usage limits, plus the separate weekly Fable limit once you have used any of it — in one compact colored line:
konser/js/statusline | git:main ✓ | opus 5 45% ▓▓▓▓░░░░░░ 67k/1M | 5h:9% (11m) | 7d:4% (5d22h) | fable:2% (1d15h)
Everything except the token-type check and the Fable limit comes from the JSON that Claude Code feeds the script on stdin. That JSON has no per-model limits, so for subscription users the Fable percentage is fetched from https://api.anthropic.com/api/oauth/usage with the OAuth token from the keychain, cached in ~/.cache/statusline-fable and refreshed in the background at most every 2 minutes.
- Claude Code 2.1.80 or newer. The
rate_limitsfield arrived in 2.1.80; on older versions the5h/7dblock is silently omitted and the rest still works. jqandgit- macOS, or Linux with one caveat — see below
brew install jq
git clone https://github.com/konser80/cc-statusline.git
cd cc-statusline
./deploy.shdeploy.sh symlinks ~/.claude/statusline.sh to the script in the clone, so later updates take effect without re-running it.
Then point Claude Code at it in ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "/bin/bash ~/.claude/statusline.sh",
"padding": 0
}
}cd cc-statusline
git pullThat is the whole update. git clone recorded where to pull from, and the symlink means the new version is live immediately — no need to run deploy.sh again.
Forgot where you cloned it? readlink ~/.claude/statusline.sh prints the path.
The script itself is portable. The one macOS-specific call is security, used only to read the token prefix and decide whether to display session cost: sk-ant-oat* means a Pro/Max subscription, where the cost figure is meaningless, so it is hidden.
On Linux that call fails silently: session cost is always shown and the Fable block never appears, since it needs the OAuth token. Everything else — path, git, context window, 5h / 7d limits — works unchanged.
Usage blocks turn yellow above 70% and red above 90%.
./test-statusline.sh # render the line from sample dataTo capture what Claude Code actually sends, export STATUSLINE_DEBUG=1 in the shell you start Claude Code from. Each render then writes its stdin JSON to ~/.cache/statusline-input.json (mode 0600 — it contains session_id, cwd and transcript_path). Replay it with:
bash statusline.sh < ~/.cache/statusline-input.json