A clean statusline for Claude Code with accurate token tracking, visual progress bar, and color-coded context warnings.
- π€ Model Display: Shows current Claude model (e.g., Opus 4.5, Sonnet 4)
- π Current Directory: Displays the basename of your working directory
- πΏ Git Integration: Shows current git branch when in a git repository
- π§ Context Usage: Color-coded percentage with visual progress bar
- π’ Green: < 50% used
- π‘ Yellow: 50-80% used
- π΄ Red: > 80% used
- π Output Style: Shows your active Claude Code output style
- Simplified Display: Removed cost and cache metrics for a cleaner statusline
- Accurate Context Tracking: Uses
used_percentagefield for precise context usage after compaction - Visual Progress Bar: 5-block bar (
βββββ) shows context usage at a glance - Color-Coded Warnings: Percentage changes color as you approach context limits
Latest stable version (recommended):
bash <(curl -fsSL https://raw.githubusercontent.com/bishnubista/cc-statusline/main/scripts/install.sh)Specific version:
VERSION=v3.1.0 bash <(curl -fsSL https://raw.githubusercontent.com/bishnubista/cc-statusline/main/scripts/install.sh)Then restart Claude Code!
Click to expand manual installation steps
# Download the statusline script
curl -fsSL https://raw.githubusercontent.com/bishnubista/cc-statusline/main/scripts/statusline.sh -o ~/.claude/statusline.sh
chmod +x ~/.claude/statusline.sh
# Configure Claude Code (create or update ~/.claude/settings.json)
cat > ~/.claude/settings.json << 'EOF'
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"padding": 0
}
}
EOF
# Restart Claude CodeExample in action:
Full example:
π€ Opus 4.5 | π cc-statusline | πΏ main | π§ 25% βββββ (72.3k) | π Explanatory
Breakdown of each section:
| Section | Example | Description |
|---|---|---|
| π€ Model | Opus 4.5 |
Current Claude model |
| π Folder | cc-statusline |
Working directory basename |
| πΏ Branch | main |
Git branch (if in repo) |
| π§ Context | 25% βββββ (72.3k) |
Usage %, visual bar, session tokens |
| π Style | Explanatory |
Output style setting |
Context usage at different levels:
Low usage: π§ 15% βββββ (12.3k) β Green
Medium usage: π§ 65% βββββ (89.2k) β Yellow
High usage: π§ 92% βββββ (156.4k) β Red (warning!)
This statusline focuses on context awareness:
- Accurate Percentage: Uses Claude Code's
used_percentagefield which accounts for context compaction and sub-agent runs - Visual Feedback: Progress bar and color coding let you see context state at a glance
- Git Branch: Avoid making changes on the wrong branch
- Clean & Minimal: Shows only what you need without clutter
cc-statusline/
βββ scripts/
β βββ statusline.sh # Main statusline script
β βββ install.sh # One-command installer
β βββ uninstall.sh # One-command uninstaller
βββ assets/
β βββ statusline-example.png # Screenshot
βββ CHANGELOG.md # Version history
βββ README.md # This file
βββ INSTALLATION.md # Detailed setup guide
βββ settings.json # Example configuration
-
Claude Code 2.0+ (uses newer JSON fields)
-
jq (JSON processor) - Install before running the installer:
# macOS brew install jq # Ubuntu/Debian sudo apt-get install jq
-
curl or wget (for installation only, usually pre-installed)
-
bash (pre-installed on macOS/Linux)
-
Git (optional, for branch display)
One-Command Uninstall:
bash <(curl -fsSL https://raw.githubusercontent.com/bishnubista/cc-statusline/main/scripts/uninstall.sh)Manual Uninstall:
rm ~/.claude/statusline.sh
# Then manually remove the statusLine section from ~/.claude/settings.jsonThe statusline is configurable by editing ~/.claude/statusline.sh after installation:
# In the color_pct() function, adjust thresholds:
if [ "$pct" -lt 50 ]; then # Green threshold
...
elif [ "$pct" -lt 80 ]; then # Yellow threshold
...# In the progress_bar() function:
local width=5 # Change to 10 for a wider barThe script receives this JSON from Claude Code:
{
"model": { "display_name": "Opus 4.5" },
"workspace": { "current_dir": "/path/to/project" },
"output_style": { "name": "Explanatory" },
"context_window": {
"used_percentage": 28.5,
"remaining_percentage": 71.5,
"context_window_size": 200000,
"total_input_tokens": 45000,
"total_output_tokens": 12000
}
}Current version: v3.1.0
See CHANGELOG.md for detailed release history and changes.
See INSTALLATION.md for detailed troubleshooting steps.
Common issues:
- Statusline not appearing: Check
~/.claude/settings.jsonsyntax - "jq: command not found": Install jq via your package manager
- Git branch not showing: Make sure you're in a git repository
- Colors not showing: Your terminal may not support ANSI colors
- Claude Code calls
statusline.shand passes JSON data via stdin - Script extracts model, directory, and token data from JSON
- Uses
used_percentagefor accurate context window state (handles compaction) - Calculates visual progress bar and applies color coding
- Checks if the current directory is a git repository
- Returns formatted statusline string with ANSI color codes
MIT License - Feel free to modify and distribute
Issues and pull requests welcome! This is a personal project, so feel free to fork and customize for your needs.
Built for the Claude Code community. Not affiliated with Anthropic.