A rich, three-line status bar for Claude Code CLI.
Displays real-time session metrics directly in your terminal β model, context usage, tokens, cost, duration, git branch, cache stats, subscription usage limits, and more.
Claude Opus 4.6 | [ββββββββββββββββββββ] 42% of 200.0K #1 | β156.8K β23.4K | cache r:89.0K w:45.0K
$1.47 | β± 5m42s (api 3m18s) | +245/-31 | β main | π my-project | [N]
5h [ββββββββββ] 68% β»2h41m | 7d [ββββββββββ] 48% β»1d20h
- Model name β which Claude model is active
- Context usage bar β 20-char visual progress bar with color thresholds (green β yellow β red)
- Token counts β input/output tokens with human-readable formatting (K/M)
- Cache stats β cache read/write token counts
- Cost β total session cost in USD
- Duration β total time and API time separately
- Lines changed β added/removed lines count
- Git branch β current branch (when in a repo)
- Working directory β project folder name
- Vim mode β shows
[N]or[I]indicator when vim mode is active - Agent name β shows active sub-agent name
- Usage limits β 5-hour and 7-day subscription quota with progress bars and reset countdown
- 200K warning β warns when context exceeds 200K tokens
- Context threshold alerts β optional flag files at 70/85/95% for hook integration
- macOS notifications β optional native alerts at 85% and 95% thresholds
- jq β JSON processor (
brew install jq/apt install jq) - curl β for usage limits API calls (pre-installed on most systems)
- Claude Code CLI β v1.0+ with status line support
- bash β works with macOS bash 3.2+ and modern bash 4/5
- Keychain/libsecret β for OAuth token access (usage limits feature)
git clone https://github.com/anthropics/claude-statusline.git
cd claude-statusline
bash install.shThe installer will:
- Copy
statusline.shto~/.claude/statusline.sh - Add the
statusLineconfig to~/.claude/settings.json - Prompt before overwriting existing files
- Copy the script:
cp statusline.sh ~/.claude/statusline.sh
chmod +x ~/.claude/statusline.sh- Add to
~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "/Users/YOUR_USERNAME/.claude/statusline.sh",
"padding": 2
}
}- Restart Claude Code.
Claude Code pipes a JSON object to stdin on every status update. The JSON contains all session metrics:
{
"model": { "display_name": "Claude Opus 4.6" },
"cwd": "/Users/dev/project",
"vim": { "mode": "NORMAL" },
"agent": { "name": "" },
"exceeds_200k_tokens": false,
"context_window": {
"used_percentage": 42.5,
"total_input_tokens": 156800,
"total_output_tokens": 23400,
"context_window_size": 200000,
"current_usage": {
"cache_creation_input_tokens": 45000,
"cache_read_input_tokens": 89000
}
},
"cost": {
"total_cost_usd": 1.47,
"total_duration_ms": 342000,
"total_api_duration_ms": 198000,
"total_lines_added": 245,
"total_lines_removed": 31
}
}The script:
- Parses all 16 fields in a single
jqcall using@shfor safe eval - Formats values with pure bash (no subshells, no
bc, noawk) - Fetches usage limits via background API call with 2-minute cache
- Outputs three ANSI-colored lines
Total execution: ~20ms on macOS (usage limits cached, fetched in background).
The padding value in settings.json controls vertical space around the status line:
{
"statusLine": {
"type": "command",
"command": "/path/to/statusline.sh",
"padding": 2
}
}By default, the script writes flag files to ~/.claude/.context-flags/ when context usage crosses 70%, 85%, and 95%. These can be consumed by Claude Code hooks to trigger auto-save or other actions.
Disable this feature:
# In your shell profile or wrapper
export STATUSLINE_FLAGS=0Custom flag directory:
export STATUSLINE_FLAG_DIR=/tmp/claude-flagsAt 85% context usage, a "Glass" notification sounds. At 95%, a "Sosumi" alert fires. These use osascript and fail silently on Linux.
Fetches subscription quota data from https://api.anthropic.com/api/oauth/usage using your OAuth token. Cached for 2 minutes with background refresh β does not block the status line.
Requires claude.ai OAuth login. Token is read from:
- macOS: Keychain (
security find-generic-password) - Linux: libsecret (
secret-tool lookup) - Windows: Credential Manager (via PowerShell)
Disable this feature:
export STATUSLINE_USAGE_LIMITS=0Model | [ββββββββββββ] PCT% of SIZE #W | βinput βoutput | cache r:READ w:WRITE
| Segment | Color | Description |
|---|---|---|
| Model | Cyan bold | Active model display name |
| Progress bar | Green/Yellow/Red | 20-char block bar based on context % |
| Window counter | Dim | Context compaction count (#1, #2, ...) |
| Tokens | Green/Magenta | Input (β) and output (β) token counts |
| Cache | Dim | Cache read/write token stats |
$COST | β± DURATION (api API_DUR) | +ADDED/-REMOVED | β BRANCH | π DIR | [N]
| Segment | Color | Shown when |
|---|---|---|
| Cost | Yellow | Always |
| Duration | Blue | Always |
| Lines | Green/Red | Always |
| Git branch | Magenta | Inside a git repo |
| Directory | Dim | Always |
| Vim mode | Blue/Green | Vim mode is active |
| Agent | Cyan | Sub-agent is running |
| >200K warning | Red | Tokens exceed 200K |
5h [ββββββββββ] 68% β»2h41m | 7d [ββββββββββ] 48% β»1d20h
| Segment | Color | Description |
|---|---|---|
| 5h bar | Green/Yellow/Red | 5-hour usage remaining (fuel gauge style) |
| 5h reset | Dim | Time until 5-hour quota resets |
| 7d bar | Green/Yellow/Red | 7-day usage remaining |
| 7d reset | Dim | Time until 7-day quota resets |
Color thresholds: green (>50% remaining), yellow (20-50%), red (<20%).
Line 3 only appears when usage data is available (OAuth login, not API key).
bash uninstall.shOr manually:
rm ~/.claude/statusline.sh
# Remove "statusLine" key from ~/.claude/settings.jsonTest with sample data:
cat examples/sample-input.json | bash statusline.shIf you find this useful, you can buy me a coffee:
MIT