Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simple, clean Claude Code statusline displaying model, directory, git branch, and output style

Notifications You must be signed in to change notification settings

bishnubista/cc-statusline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude Code Statusline

A clean statusline for Claude Code with accurate token tracking, visual progress bar, and color-coded context warnings.

Claude Code Statusline Version License

Features

  • πŸ€– 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

What's New in v3.1.0

  • Simplified Display: Removed cost and cache metrics for a cleaner statusline
  • Accurate Context Tracking: Uses used_percentage field 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

Quick Start

One-Command Install

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!

Manual Install

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 Code

What You'll See

Example in action:

Statusline Screenshot

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!)

Why This Statusline?

This statusline focuses on context awareness:

  • Accurate Percentage: Uses Claude Code's used_percentage field 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

Repository Structure

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

Requirements

  • 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)

Uninstall

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.json

Customization

The statusline is configurable by editing ~/.claude/statusline.sh after installation:

Change Color Thresholds

# In the color_pct() function, adjust thresholds:
if [ "$pct" -lt 50 ]; then      # Green threshold
    ...
elif [ "$pct" -lt 80 ]; then    # Yellow threshold
    ...

Change Progress Bar Width

# In the progress_bar() function:
local width=5    # Change to 10 for a wider bar

Available JSON Fields

The 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
  }
}

Version History

Current version: v3.1.0

See CHANGELOG.md for detailed release history and changes.

Troubleshooting

See INSTALLATION.md for detailed troubleshooting steps.

Common issues:

  • Statusline not appearing: Check ~/.claude/settings.json syntax
  • "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

How It Works

  1. Claude Code calls statusline.sh and passes JSON data via stdin
  2. Script extracts model, directory, and token data from JSON
  3. Uses used_percentage for accurate context window state (handles compaction)
  4. Calculates visual progress bar and applies color coding
  5. Checks if the current directory is a git repository
  6. Returns formatted statusline string with ANSI color codes

License

MIT License - Feel free to modify and distribute

Contributing

Issues and pull requests welcome! This is a personal project, so feel free to fork and customize for your needs.

Acknowledgments

Built for the Claude Code community. Not affiliated with Anthropic.

About

Simple, clean Claude Code statusline displaying model, directory, git branch, and output style

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages