A two-line status bar for Claude Code that shows model info, project context, token usage, billing mode, and session duration — all at a glance.
Line 1 — Model name + version, project folder, git branch Line 2 — Context window progress bar, total tokens, billing mode, session timer
- Color-coded progress bar — green (< 70%), yellow (70–90%), red (≥ 90%) so you know when context is getting tight
- Token counter — combined input + output tokens, auto-formatted (823 tok → 4.2k tok → 1.2M tok)
- Billing mode indicator — detects whether you're on Claude Max (OAuth) or API billing
✅ Max(green) = Claude Max plan via OAuth⚠️ API(red) = API key billing? Auth(yellow) = Unknown
- Git branch — shows current branch with 5-second cache to avoid repeated git calls
- API thinking time — cumulative time Claude spent processing your requests (not wall-clock idle time)
- Debug mode — set
CLAUDE_STATUSLINE_DEBUG=1to dump the raw JSON input to/tmp/claude-statusline-debug.json
curl -o ~/.claude/statusline-command.sh \
https://gist.githubusercontent.com/raw/statusline-command.sh
chmod +x ~/.claude/statusline-command.shOr copy statusline-command.sh from this gist to ~/.claude/statusline-command.sh.
Add this to your ~/.claude/settings.json (create the file if it doesn't exist):
{
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline-command.sh",
"padding": 2
}
}If the file already has content, merge the statusLine key into the existing JSON object.
The status line appears on your next session. No other dependencies required — it's pure bash with jq for JSON parsing (which most systems already have).
Claude Code pipes a JSON object to the script's stdin on every render cycle. The JSON contains workspace info, model details, context window stats, and cost/duration data. The script parses it with a single jq call and formats the two-line output with ANSI color codes.
| Field | Description |
|---|---|
workspace.current_dir |
Current working directory |
model.display_name |
Model name (e.g., "Opus 4.6") |
model.id |
Full model ID (e.g., "claude-opus-4-6") |
context_window.used_percentage |
Context usage as a percentage |
context_window.total_input_tokens |
Total input tokens consumed |
context_window.total_output_tokens |
Total output tokens consumed |
cost.total_duration_ms |
Wall-clock session duration in milliseconds |
cost.total_api_duration_ms |
Cumulative API thinking time in milliseconds (used by default) |
- Git branch lookups are cached for 5 seconds
- Billing mode detection is cached for 60 seconds
- All token math is pure bash integer arithmetic (no external commands)
Fork this gist and tweak to your liking:
- Change the progress bar characters (
█and░) - Adjust color thresholds (lines 124–130)
- Add/remove fields from either line
- Change the cache TTLs
- Claude Code v1.0.71+ (status line support)
jq(for JSON parsing)bash4+- macOS or Linux (billing detection uses macOS Keychain on macOS; adjust for Linux)
