A powerful, feature-rich statusline for Claude Code that displays comprehensive session information including directory, git status, model name, token usage, and real-time cost tracking.
- 🗂️ Full directory path with
~home directory replacement - 🌿 Git integration:
- Current branch name
- Working directory status (modified
!/ untracked?) - Commits ahead/behind upstream (
↑N/↓M)
- 🤖 Model information - Current Claude model (Opus, Sonnet, Haiku)
- 📊 Token usage tracking - Real-time token count with comma formatting
- 💰 Cost calculation - Session cost based on model-specific pricing
- 🎨 Color-coded display for easy visual scanning
Example output:
~/Dev/apeiros/data on develop? [Sonnet 4.5 | 7,599,934 ($3.22)]
Colors:
- Green: Directory path
- Magenta: Git branch and model name
- Cyan: Ahead/behind indicators
- Red/Green: Git status (modified/untracked)
- Yellow: Token count
- Green: Cost
-
Copy the script to your Claude Code config directory:
curl -o ~/.claude/statusline-command.sh https://raw.githubusercontent.com/levz0r/claude-code-statusline/main/statusline.sh chmod +x ~/.claude/statusline-command.sh
-
Update your Claude Code settings (
~/.claude/settings.json):{ "statusLine": { "type": "command", "command": "/bin/bash /Users/YOUR_USERNAME/.claude/statusline-command.sh" } }Replace
YOUR_USERNAMEwith your actual username.
Note: This PowerShell version is provided as-is and has not been tested on Windows. Please report any issues or improvements!
-
Copy the PowerShell script:
# Create .claude directory if it doesn't exist New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude" # Download the script Invoke-WebRequest -Uri "https://raw.githubusercontent.com/levz0r/claude-code-statusline/main/statusline.ps1" -OutFile "$env:USERPROFILE\.claude\statusline-command.ps1"
-
Update your Claude Code settings (typically at
%USERPROFILE%\.claude\settings.json):{ "statusLine": { "type": "command", "command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"%USERPROFILE%\\.claude\\statusline-command.ps1\"" } } -
Ensure PowerShell execution policy allows the script:
# Check current policy Get-ExecutionPolicy # If needed, set to allow local scripts (run as Administrator) Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
-
jq - JSON processor for parsing transcript data
# macOS brew install jq # Ubuntu/Debian sudo apt-get install jq # Fedora sudo dnf install jq
-
bc - Basic calculator for cost calculations (usually pre-installed)
No additional requirements! PowerShell has built-in JSON parsing and math capabilities.
The script parses the Claude Code session transcript file to calculate:
- Input tokens - Fresh tokens processed without caching
- Cache read tokens - Tokens retrieved from prompt cache (90% cheaper)
- Cache write tokens - Tokens used to create cache entries
- Output tokens - Tokens generated by Claude
Total tokens = input + cache_read + cache_write + output
Pricing is automatically detected based on your current model:
- Input: $3.00 per million tokens
- Cache read: $0.30 per million tokens
- Cache write: $3.75 per million tokens
- Output: $15.00 per million tokens
- Input: $15.00 per million tokens
- Cache read: $1.50 per million tokens
- Cache write: $18.75 per million tokens
- Output: $75.00 per million tokens
- Input: $0.25 per million tokens
- Cache read: $0.03 per million tokens
- Cache write: $0.30 per million tokens
- Output: $1.25 per million tokens
The statusline shows:
- Current branch name
!for modified/staged files (red)?for untracked files (green)↑Nfor N commits ahead of upstream (cyan)↓Nfor N commits behind upstream (cyan)↑N↓Mfor diverged branches (cyan)
Edit the script to customize:
- Colors (ANSI escape codes)
- Separators and formatting
- Token/cost display format
- Git status indicators
Bash (Linux/macOS):
\033[32m # Green
\033[35m # Magenta
\033[36m # Cyan
\033[33m # Yellow
\033[31m # Red
\033[0m # ResetPowerShell (Windows):
"`e[32m" # Green
"`e[35m" # Magenta
"`e[36m" # Cyan
"`e[33m" # Yellow
"`e[31m" # Red
"`e[0m" # ResetThe statusline refreshes based on Claude Code's update frequency. Try:
- Running a command in Claude Code
- Changing directories
- Making a git commit
Ensure:
jqis installed and in your PATH- The transcript file exists and is readable
- You've had at least one assistant response in the session
Verify:
- The model name in the statusline matches your actual model
- Pricing constants in the script match current Claude API rates
bcis installed for calculations (Linux/macOS)
- Colors not showing: Ensure you're using Windows Terminal or a terminal that supports ANSI escape codes (PowerShell 5.1+ or Windows 10+)
- Execution policy error: Run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUseras described in installation - Path issues: Make sure paths use backslashes and are properly escaped in the JSON settings file
- Script not found: Verify the path in settings.json points to the correct location:
%USERPROFILE%\.claude\statusline-command.ps1
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - feel free to use and modify as needed.
Built for the Claude Code community. Inspired by powerline and other terminal statusline tools.
Created with ❤️ by Lev Gelfenbuim for better Claude Code visibility and cost tracking.
