Install a pre-configured Claude Code statusline with model, tokens, cost, lines changed, and context usage...
Create a statusline with this exact format:
Model β βTokens βTokens $Cost β Duration +Lines -Lines β Context%
Example output:
Opus β β15k β4k $1.23 β 5m (2m) +156 -23 β 42%
| Field | JSON Path |
|---|---|
| Model | .model.display_name |
| Total duration | .cost.total_duration_ms |
| API duration | .cost.total_api_duration_ms |
| Input tokens | .context_window.total_input_tokens |
| Output tokens | .context_window.total_output_tokens |
| Cost | .cost.total_cost_usd |
| Lines added | .cost.total_lines_added |
| Lines removed | .cost.total_lines_removed |
| Context % | .context_window.used_percentage |
Duration: Show as Xs, Xm, or Xh Ym β total time followed by API time in parentheses (always shown)
5m (2m) = 5 min total, 2 min waiting for API1h 15m (45m) = 1 hour 15 min total, 45 min waiting for API0s (0s)Tokens:
850k for thousands β 15km with 1 decimal for millions β 1.2mCost:
$0.0012$0.12Lines changed: Green for +added, Red for -removed
Model name: Reset/default terminal color (wrap with ${RESET})
Separators: Dim box-drawing character β (U+2502)
General styling: Duration, tokens, and cost should be dim
Auto-compact triggers at ~78%, so thresholds are calibrated accordingly:
| Range | Color | Meaning |
|---|---|---|
| 0-49% | Green | Plenty of room |
| 50-64% | Yellow | Getting used |
| 65-74% | Orange | Approaching auto-compact |
| 75%+ | Red | Near auto-compact trigger |
Define colors using $'...' syntax so escape sequences are interpreted.
Use 24-bit true color format \033[38;2;R;G;Bm for precise colors:
DIM=$'\033[38;2;153;153;153m' # #999999
GREEN=$'\033[38;2;55;166;96m' # #37A660
YELLOW=$'\033[33m'
ORANGE=$'\033[38;5;208m'
RED=$'\033[38;2;187;106;122m' # #BB6A7A
RESET=$'\033[0m'
Always wrap colored output with ${COLOR}text${RESET}.
Default to 0 for numeric fields when null/missing:
0$0.00000s (0s)+0 / -00%Only show -- for non-numeric fields like model name if truly unavailable.
pwsh). Use backtick syntax instead:$Dim = "`e[38;2;153;153;153m" # #999999
$Green = "`e[38;2;55;166;96m" # #37A660
$Yellow = "`e[33m"
$Orange = "`e[38;5;208m"
$Red = "`e[38;2;187;106;122m" # #BB6A7A
$Reset = "`e[0m"
Install to ~/.claude/ and update ~/.claude/settings.json with the statusLine configuration.