Where your tokens go — and when the reset hits.
Tokens aren't free and they aren't endless. The default status line pretends they are. This one shows you what's left of your 5-hour and 7-day budget, how many tokens you've roughly burned, when it resets — and what the session has cost so far. One line, instead of prompting blind.
↳ Pinned at the bottom of the terminal where claude runs. Stays there while you work. More on typical setups below.
Three lines, four things you don't otherwise see.
The typical question after two hours of work: "Where did my tokens go?" The default status line doesn't answer that. It shows model and context, that's it. Once you're actually working, you want to know where your budget is going right now — before the limit, before the reset, before the expensive session.
Three typical setups. Whichever one you run — the bar works.
Claude Code is a CLI tool — the status line lives in the shell where claude runs. The three setups I see most often:
Paste the block straight into the terminal — done.
You paste the prompt into the terminal where claude is currently running — i.e. where the bar should later show up. Claude takes it like a normal request, drops the script at ~/.claude/statusline-command.sh, patches your ~/.claude/settings.json, and shows you a test run at the end. You don't have to set anything up manually. Clean variant, no emojis — if the race variant is more your thing, see tweaks below.
Bau mir eine Claude-Code-Statusline analog zu Max Fraunhofers Setup. Bevor du loslegst, drei Pre-Flight-Checks:
1. `jq` installiert? — `command -v jq` checken. Wenn nicht: zeig mir den passenden Install-Command (macOS: `brew install jq`, Debian/Ubuntu: `sudo apt install -y jq`, Fedora: `sudo dnf install jq`, Arch: `sudo pacman -S jq`, Windows: `scoop install jq`) und frag, ob du's für mich ausführen sollst.
2. Frag mich nach meinem Claude-Plan, um die Token-Budgets zu setzen. Schlag mir diese Werte vor und lass mich wählen (Default: Max 5x, weil das meistens stimmt):
- Pro: TOKEN_BUDGET=50000, WEEKLY_TOKEN_BUDGET=null (Pro hat kein Wochen-Limit, dann zweite Bar weglassen)
- Max 5x: TOKEN_BUDGET=200000, WEEKLY_TOKEN_BUDGET=2000000
- Max 20x: TOKEN_BUDGET=800000, WEEKLY_TOKEN_BUDGET=8000000
Wenn ich's nicht weiss: Default setzen und einen Kommentar im Script lassen, wo ich's später anpasse.
3. Statusline-JSON-Schema checken: ruf `claude --print --output-format json --include-partial-messages "echo"` oder das aktuelle Doc-Beispiel ab und schau, ob die Felder `rate_limits.five_hour`/`seven_day` und `context_window` drin sind. Wenn nicht: kurz warnen, dass meine Claude-Code-Version eventuell zu alt ist — Script läuft trotzdem, zeigt nur weniger.
Dann zum Bau. Zwei Zeilen Output:
Zeile 1 (dim, grau): model | ctx XX% | git-branch | session-name
Zeile 2+3 (Akzentfarbe, RGB konfigurierbar): zwei Rate-Limit-Bars
[5h] [████░░░░░░░░░░░░░░░░] 20% (~40k/200k tokens) | reset in 2h15m @ 14:30 CEST | $1.23
[7d] [██████░░░░░░░░░░░░░░] 30% (~600k/2M tokens) | resets Sun 09:00 CEST
Spec:
- Datei: ~/.claude/statusline-command.sh, ausführbar, shebang /bin/sh (POSIX, kein bash-ismus).
- Liest JSON von stdin via jq. Felder: .model.display_name, .context_window.used_percentage,
.workspace.current_dir, .worktree.branch, .session_name, .rate_limits.five_hour.{used_percentage,resets_at},
.rate_limits.seven_day.{used_percentage,resets_at}, .cost.total_cost_usd.
- Konstanten am Datei-Anfang: TOKEN_BUDGET, WEEKLY_TOKEN_BUDGET (aus Pre-Flight 2), ACCENT_RGB="213;0;28".
- Progress-Bar: 20 Zellen breit, ausschliesslich █ und ░ (KEINE Emojis, KEINE Auto-Icons).
- Token-Schaetzung: pct/100 * Budget, mit k/M-Suffix.
- Reset-Strings in TZ=Europe/Berlin, mit `date -r` (macOS) UND `date -d "@ts"` (Linux) als Fallback.
- Labels [5h] und [7d] fix in eckigen Klammern, damit beide Bars vertikal aligned sind.
- ANSI: \033[2m fuer dim, \033[38;2;${ACCENT_RGB}m fuer Akzent, \033[0m reset.
- Wenn ein Wert fehlt: Zeile/Segment skippen, nicht crashen.
Danach patche ~/.claude/settings.json:
"statusLine": { "type": "command", "command": "sh /Users/<user>/.claude/statusline-command.sh" }
(Pfad mit `echo $HOME` ermitteln, nicht hardcoden.)
Zeig mir am Schluss einen Test-Run mit Dummy-JSON, damit ich sehe wie es rendert.
What Claude writes into your settings.json — briefly explained.
The second part of the prompt patches ~/.claude/settings.json. If you already have one and want to handle this yourself, here's the entry:
{
"statusLine": {
"type": "command",
"command": "sh /Users/YOUR-USER/.claude/statusline-command.sh"
}
}
Three constants at the top of the script — the rest is taste.
Once the bars are running for the first time, these are the things you most often touch.
Your tokens are expensive. Treat them that way.
Two minutes of setup. After that you stop running blind into the limit.
Sources + further reading
- Anthropic — Status Line docs (fields, JSON schema, examples): docs.anthropic.com/claude-code/statusline
- Anthropic — Settings reference (all keys in settings.json): docs.anthropic.com/claude-code/settings
- Anthropic — Rate limits and plan budgets compared: anthropic.com/pricing
- Antigravity setup — if you haven't installed Claude Code yet, start here: /en/ressourcen/antigravity-setup/