Custom statusline for Claude Code CLI. Displays context usage, session metrics, and workflow state.
┃━━━━━━━━━━━━━━●──────────────────│~~~~~~~~┃ 65K used (45K reserved) │ 50K / 155K │ 32% │ $0.42
stride: 1:4 ‹ │ pace: ⣤⣶⣿⣶⣤⣀ 8.2s │ coding
focus: → config.yml │ edits: build.sh (3)
skills: sample │ mcp: context7 exa │ cmds: commit
main +12/-3 ✓ 5m │ opus │ sess: 12m34s
- Progress bar - Visual context window usage with color thresholds
- Resource tracking - Token counts, costs, context percentage
- Rhythm metrics - Stride ratio (user:claude) with acceleration arrows (« ‹ · › »), pace sparkline, mode detection
- Focus tracking - Current file/directory concentration, edit counts
- Infrastructure - Skills loaded, MCP servers connected, slash commands used
- Session info - Git branch, model name, active session duration
- macOS (uses
pmsetfor sleep detection,stat -fsyntax) - jq - JSON processing
- Python 3.9+
curl -fsSL https://raw.githubusercontent.com/gezibash/claude-meter/main/install.sh | bashThis downloads the statusline and Python helpers to ~/.claude/. Claude Code will use it automatically on next session.
For contributing or customizing:
# Clone the repository
git clone https://github.com/gezibash/claude-meter.git
cd claude-meter
# Install dev dependencies (shellcheck, shfmt, yq, ruff, cocogitto)
task deps
# Build and link to ~/.claude
task linkThis creates:
~/.claude/statusline.sh- symlink to the built script~/.claude/transcript_parser.py- Python transcript parser~/.claude/context_parser.py- Python context parser
Edit config.yml to customize:
options:
bar_width: 40 # Progress bar width
bar_style: ascii # ascii | blocks
warn_threshold: 50 # Yellow at 50%
high_threshold: 70 # Orange at 70%
crit_threshold: 80 # Red at 80%
ctx_overhead: 18000 # System prompt tokens
ctx_buffer: 45000 # Autocompact reserve
domains:
- resources # Order matters for display
- rhythm
- focus
- infra
- sessionAfter editing, run task build && task link to apply changes.
Toggle domains at runtime via environment variables:
export CLAUDE_METER_RESOURCES=0 # Hide resources domain
export CLAUDE_METER_RHYTHM=1 # Show rhythm domain (default)
export CLAUDE_METER_FOCUS=1 # Show focus domain (default)
export CLAUDE_METER_INFRA=1 # Show infra domain (default)
export CLAUDE_METER_SESSION=1 # Show session domain (default)task lint # Run shellcheck on source files
task fmt # Format source files with shfmt
task build # Assemble and minify
task dev:test # Test with sample JSON input
task clean # Remove build artifactsClaude Code pipes JSON to the statusline script on each update:
{"model": {...}, "session_id": "...", "transcript_path": "...", "context_window": {...}, "cost": 0.42}The script:
- Parses the JSON input
- Reads the transcript file for detailed metrics
- Caches expensive computations (context parsing, sleep times)
- Outputs formatted ANSI text for display
┃━━━━━━━━━━━━━━●──────────────────│~~~~~~~~┃
used (colored) buffer (gray)
- Used segment: Context tokens consumed (● marks current position)
- Buffer segment: Autocompact reserve (~45K tokens, shown as
~) - Colors: green <50%, yellow 50-70%, orange 70-80%, red >80%
- resources - Progress bar, token counts, cost
- rhythm - Stride ratio (user:claude messages), pace sparkline, mode (exploring/coding/shipping/etc)
- focus - Current file/dir concentration, edit revision counts
- infra - Local skills, MCP servers, slash commands used
- session - Git branch/status, model name, session duration
- Create
src/domains/mydomain.sh:# shellcheck shell=bash # shellcheck disable=SC2154,SC2034 # Provides: domain_mydomain # Requires: transcript (from core/input) domain_mydomain="my output"
- Add to
config.ymldomains list - Add case to
src/output/99-assemble.sh - Run
task build && task link
See CLAUDE.md for detailed architecture documentation.
MIT License - see LICENSE for details.