statusline command provides a compact, single-line status display designed for integration with terminal hooks, shell prompts, and tmux/screen status bars.
Basic Usage
Statusline reads Claude Code hook data from stdin:Output Components
The status line includes several information segments:1. Model
2. Costs
- Session: Current conversation cost
- Today: Total cost for today
- Block: Current 5-hour billing block cost and time remaining
3. Burn Rate (Optional)
- 🟢 Normal: < 2000 tokens/min
- ⚠️ Moderate: 2000-5000 tokens/min
- 🚨 High: > 5000 tokens/min
4. Context Usage
- Green: < 70% (configurable)
- Yellow: 70-90% (configurable)
- Red: > 90%
Command Options
Cache Control
Enable or disable caching:- Time-based expiry: Cache expires after refresh interval (default: 30 seconds)
- File modification: Immediate invalidation when transcript changes
Refresh Interval
Customize cache expiry time (in seconds):Visual Burn Rate
Control burn rate visualization:off(default): No burn rate displayemoji: Show emoji indicator only (🟢/⚠️/🚨)text: Show text status only (Normal/Moderate/High)emoji-text: Show both emoji and text
Cost Source
Control where session costs come from:auto(default): Prefer Claude Code cost, fallback to ccusageccusage: Always calculate using ccusagecc: Always use Claude Code costboth: Show both costs side by side
both:
Context Thresholds
Customize color-coding thresholds for context usage (0-100):--context-low-threshold: Below this, show green (default: 70)--context-medium-threshold: Below this, show yellow (default: 90)- Above medium threshold: show red
Low threshold must be less than medium threshold. Both must be between 0 and 100.
Common Flags
Enable cache for status line output (default: true)
Refresh interval in seconds for cache expiry (default: 30)
Burn rate visualization:
off, emoji, text, emoji-text (default: off)Session cost source:
auto, ccusage, cc, both (default: auto)Context usage percentage below which status is shown in green (0-100, default: 70)
Context usage percentage below which status is shown in yellow (0-100, default: 90)
Use cached pricing data instead of fetching from API (default: true for statusline)
Path to configuration file (default: auto-discovery)
Show debug information (default: false)
Hook Integration
Claude Code Hooks
Create a hook script that pipes Claude Code data to statusline:~/.config/claude/hooks/on-session-update.sh
Shell Prompt (PS1)
Integrate with bash/zsh prompts:~/.bashrc
Tmux Status Bar
~/.tmux.conf
Input Format
Statusline expects JSON input with this structure:session_id: Claude Code session identifiermodel.id: Model identifiermodel.display_name: Human-readable model nametranscript_path: Path to session transcript file
cost.total_cost_usd: Pre-calculated session costcontext_window.total_input_tokens: Input tokens in contextcontext_window.context_window_size: Model’s context window size
Caching Behavior
Statusline uses a hybrid caching system for performance:Time-Based Expiry
Cache expires after the refresh interval (default: 30 seconds):File Modification Detection
Cache is immediately invalidated when the transcript file is modified, ensuring real-time updates during active sessions.Process Coordination
If another process is updating the cache, statusline returns the stale output to avoid concurrent updates and maintain responsiveness.Cache Location
Cache files are stored in:Examples
Minimal Status
Full Status with Burn Rate
Custom Context Thresholds
Compare Cost Sources
Disable Cache for Testing
Performance Considerations
Enable Caching
Always use caching for hooks called frequently:Offline Mode
Statusline defaults to--offline mode for faster performance (no API calls for pricing data).
Adjust Refresh Interval
Balance freshness vs. performance:- Shorter intervals (15-30s): More frequent updates, slightly higher CPU
- Longer intervals (60s+): Better performance, less frequent updates
Troubleshooting
”No input provided”
Ensure you’re piping JSON data to stdin:“Invalid input format”
Verify your JSON matches the expected schema. Required fields:session_idmodel.idmodel.display_nametranscript_path
”Error generating status”
With--cache enabled, statusline returns the last successful output on error. Disable cache to see the actual error:
Context shows “N/A”
Context calculation requires either:context_windowdata in hook input, OR- A valid transcript file at
transcript_path