Overview
Thestatusline command displays a compact, single-line status for integration with Claude Code hooks and shell prompts. It shows real-time information about the current session including model, costs, burn rate, and context usage.
The command uses a hybrid caching system that combines:
- Time-based expiry: Cache expires after a configurable refresh interval
- File modification detection: Immediate invalidation when transcript file changes
Usage
Flags
Command-Specific Flags
Controls the visualization of the burn rate status:
off: No visual indicatoremoji: Show emoji indicator (🟢/⚠️/🚨)text: Show text status (Normal/Moderate/High)emoji-text: Show both emoji and text
-BChoices: off, emoji, text, emoji-textSession cost source:
auto: Prefer Claude Code cost, fallback to ccusage calculationccusage: Always calculate using ccusagecc: Always use Claude Code’s pre-calculated costboth: Show both costs side by side for comparison
auto, ccusage, cc, bothEnable cache for status line output. Improves performance by reusing results when data hasn’t changed.Negatable: Use
--no-cache to disableRefresh interval in seconds for cache expiry. Cache is also invalidated immediately when transcript file is modified.Default: 30 seconds
Context usage percentage below which status is shown in green (0-100).Default: 50Validation: Must be less than
--context-medium-thresholdContext usage percentage below which status is shown in yellow (0-100). Above this threshold, status is shown in red.Default: 80Validation: Must be greater than
--context-low-thresholdUse cached pricing data for Claude models. Default is true for better performance in statusline.Short flag:
-ONegatable: Use --no-offline to fetch fresh pricingCommon Flags
Path to configuration file. Default: auto-discovery.
Show debug information.Short flag:
-dInput Format
The command expects JSON input from stdin matching Claude Code’s hook data format:Required Fields
session_id: Unique session identifiertranscript_path: Path to transcript JSONL filemodel.id: Model identifiermodel.display_name: Human-readable model name
Optional Fields
cost.total_cost_usd: Pre-calculated cost from Claude Codecontext_window.total_input_tokens: Current context tokenscontext_window.context_window_size: Maximum context window size
Output Format
Single-line status with emoji indicators:Status Components
- 🤖 Model: Display name of the model
- 💰 Costs:
- Session cost (from Claude Code or calculated)
- Today’s total cost
- Current block cost and time remaining
- 🔥 Burn Rate (if
--visual-burn-rateenabled):- Cost per hour
- Status indicator (🟢 Normal / ⚠️ Moderate / 🚨 High)
- 🧠 Context: Current tokens and percentage of limit
- Green: < 50% (or
--context-low-threshold) - Yellow: 50-80% (or
--context-medium-threshold) - Red: > 80%
- Green: < 50% (or
Burn Rate Thresholds
- 🟢 Normal: < 2,000 tokens/minute
- ⚠️ Moderate: 2,000-5,000 tokens/minute
- 🚨 High: > 5,000 tokens/minute
Caching Behavior
The hybrid caching system validates cache using two mechanisms:- Time-based: Cache expires after
--refresh-intervalseconds - File-based: Cache invalidates immediately when transcript file is modified
Cache Invalidation
- When transcript file modification time changes
- When refresh interval expires
- When cache is manually disabled with
--no-cache
Process Coordination
The command uses a semaphore file (stored in system temp directory) to prevent concurrent updates:- If another process is updating, returns cached output
- Includes deadlock protection by checking if updating process is still alive
Examples
Basic usage with hook data
Show emoji burn rate indicator
Compare cost sources
Disable caching for testing
Custom context thresholds
Faster refresh for development
Integration with Claude Code Hooks
This command is designed for integration with Claude Code’s hook system. Configure your hook to pipe data to statusline:Performance Considerations
- Default offline mode: Avoids API calls for pricing data
- Hybrid caching: Reduces computation while staying responsive
- Process coordination: Prevents concurrent updates from multiple hook calls
- Stale output on error: Returns last known good state if update fails
Cache files are stored in system temp directory under
ccusage-semaphore/. They are session-specific and automatically managed.Troubleshooting
No output or errors
- Ensure valid JSON input is provided via stdin
- Check that required fields (session_id, transcript_path, model) are present
- Use
--debugflag to see error details
Stale data
- Reduce
--refresh-intervalfor more frequent updates - Use
--no-cacheto bypass caching entirely - Check that transcript file path is correct
Context percentage not showing
- Ensure
context_windowdata is provided in hook input - Or verify transcript file is accessible for calculation