statusline-install
Original:🇺🇸 English
Translated
Install a pre-configured Claude Code statusline with model, tokens, cost, lines changed, and context usage. A batteries-included alternative to /statusline with formatting and color thresholds already defined.
3installs
Sourcetommyxchow/ai
Added on
NPX Install
npx skill4agent add tommyxchow/ai statusline-installTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Statusline Specification
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%Data Sources
| Field | JSON Path |
|---|---|
| Model | |
| Total duration | |
| API duration | |
| Input tokens | |
| Output tokens | |
| Cost | |
| Lines added | |
| Lines removed | |
| Context % | |
Formatting Rules
Duration: Show as , , or — total time followed by API time in parentheses (always shown)
XsXmXh Ym- = 5 min total, 2 min waiting for API
5m (2m) - = 1 hour 15 min total, 45 min waiting for API
1h 15m (45m) - Empty state:
0s (0s)
Tokens:
- Raw number if < 1,000 →
850 - Lowercase for thousands →
k15k - Lowercase with 1 decimal for millions →
m1.2m
Cost:
- 4 decimal places if < $0.01 →
$0.0012 - 2 decimal places if ≥ $0.01 →
$0.12
Lines changed: Green for , Red for
+added-removedModel name: Reset/default terminal color (wrap with )
${RESET}Separators: Dim box-drawing character (U+2502)
│General styling: Duration, tokens, and cost should be dim
Context % Color Thresholds
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 |
ANSI Color Definitions (Bash)
Define colors using syntax so escape sequences are interpreted.
Use 24-bit true color format for precise colors:
$'...'\033[38;2;R;G;Bmbash
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}Null Handling
Default to for numeric fields when null/missing:
0- Tokens:
0 - Cost:
$0.0000 - Duration:
0s (0s) - Lines: /
+0-0 - Context:
0%
Only show for non-numeric fields like model name if truly unavailable.
--Platform Notes
- macOS/Linux: Use bash with the ANSI definitions above
- Windows: Use PowerShell 7+ (). Use backtick syntax instead:
pwsh
powershell
$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 and update with the statusLine configuration.
~/.claude/~/.claude/settings.json