claude-statusbar
Health Pass
- License Γ’β¬β License: MIT
- Description Γ’β¬β Repository has a description
- Active repo Γ’β¬β Last push 0 days ago
- Community trust Γ’β¬β 20 GitHub stars
Code Fail
- rm -rf Γ’β¬β Recursive force deletion command in uninstall.sh
Permissions Pass
- Permissions Γ’β¬β No dangerous permissions requested
This is a shell script that generates a rich, informational status bar for the Claude Code CLI. It displays real-time session metrics such as token usage, cost, duration, and git branch information directly in the terminal.
Security Assessment
Overall risk: Low. The script processes JSON data piped to it via stdin by Claude Code and formats it for terminal output. It does not request dangerous system permissions. However, there are a few points to note. It requires `curl` and makes network requests to fetch subscription usage limits via an API. Additionally, the `uninstall.sh` script contains a recursive force deletion command (`rm -rf`), which is standard for cleaning up installations but warrants a quick manual review to ensure it only targets the intended directories. No hardcoded secrets were found, though the tool does rely on system keychain/libsecret for OAuth token access.
Quality Assessment
The project is actively maintained, with the most recent push occurring today. It uses the permissive MIT license, making it safe for most projects. The repository has a clear description and adequate documentation, including detailed installation instructions and feature explanations. It has garnered 20 GitHub stars, indicating a small but growing base of community trust among early adopters.
Verdict
Safe to use β it is a lightweight, MIT-licensed terminal script that is transparent in its operations and safe to integrate into your workflow.
π₯οΈ A rich, two-line status bar for Claude Code CLI β real-time model, context usage, tokens, cost, duration, git branch, cache stats and more in your terminal
claude-statusline
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
Features
- 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
Requirements
- 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)
Installation
Quick install
git clone https://github.com/anthropics/claude-statusline.git
cd claude-statusline
bash install.sh
The installer will:
- Copy
statusline.shto~/.claude/statusline.sh - Add the
statusLineconfig to~/.claude/settings.json - Prompt before overwriting existing files
Manual install
- 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.
How It Works
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).
Configuration
Padding
The padding value in settings.json controls vertical space around the status line:
{
"statusLine": {
"type": "command",
"command": "/path/to/statusline.sh",
"padding": 2
}
}
Context threshold flags
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=0
Custom flag directory:
export STATUSLINE_FLAG_DIR=/tmp/claude-flags
macOS notifications
At 85% context usage, a "Glass" notification sounds. At 95%, a "Sosumi" alert fires. These use osascript and fail silently on Linux.
Usage limits
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=0
Output Layout
Line 1
Model | [ββββββββββββ] 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 |
Line 2
$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 |
Line 3
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).
Uninstall
bash uninstall.sh
Or manually:
rm ~/.claude/statusline.sh
# Remove "statusLine" key from ~/.claude/settings.json
Testing
Test with sample data:
cat examples/sample-input.json | bash statusline.sh
Support
If you find this useful, you can buy me a coffee:
License
MIT
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found