Install command
Not provided
Feature-rich statusline using Python's Rich library for beautiful formatting, progress bars, and real-time token cost tracking
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Not provided
Config snippet
Provided
Copy snippet
Provided
Prerequisites
6 to clear
Platforms
1 listed
Difficulty
3/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Prerequisite readiness
6 prerequisites to line up before setup.
Safety & privacy surface
2 safety and 2 privacy notes across 3 risk areas. Review closely: credentials & tokens, network access.
#!/usr/bin/env python3
import sys
import json
from rich.console import Console
from rich.text import Text
console = Console()
# Read JSON from stdin
try:
data = json.load(sys.stdin)
except json.JSONDecodeError:
console.print("[red]Error: Invalid JSON input[/red]")
sys.exit(1)
# Extract session data
model = data.get('model', 'unknown')
workspace = data.get('workspace', {}).get('path', '~').replace(f"{os.path.expanduser('~')}", '~')
tokens = data.get('session', {}).get('totalTokens', 0)
cost = data.get('session', {}).get('estimatedCost', 0.0)
git_branch = data.get('git', {}).get('branch', None)
# Build status components
status = Text()
# Model indicator with emoji
status.append("🤖 ", style="bold")
status.append(f"{model}", style="bold cyan")
status.append(" │ ", style="dim")
# Directory
status.append("📁 ", style="bold")
status.append(f"{workspace}", style="yellow")
# Git branch if available
if git_branch:
status.append(" │ ", style="dim")
status.append(" ", style="bold")
status.append(f"{git_branch}", style="magenta")
# Token usage
status.append(" │ ", style="dim")
status.append("🎯 ", style="bold")
status.append(f"{tokens:,}", style="green" if tokens < 100000 else "yellow")
# Cost with dynamic coloring
if cost > 0:
status.append(" │ ", style="dim")
status.append("💰 ", style="bold")
cost_color = "green" if cost < 0.10 else "yellow" if cost < 1.0 else "red"
status.append(f"${cost:.3f}", style=cost_color)
console.print(status){
"statusLine": {
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py",
"refreshInterval": 1000
}
}{
"statusLine": {
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py",
"refreshInterval": 1000
}
}
Extended version with Rich progress bar showing token usage percentage
#!/usr/bin/env python3
import sys
import json
import os
from rich.console import Console
from rich.text import Text
from rich.progress import BarColumn, Progress
console = Console()
try:
data = json.load(sys.stdin)
except json.JSONDecodeError:
console.print("[red]Error: Invalid JSON input[/red]")
sys.exit(1)
model = data.get('model', {}).get('display_name') or data.get('model', {}).get('id') or 'unknown'
workspace_path = data.get('workspace', {}).get('current_dir') or data.get('workspace', {}).get('path') or data.get('cwd', '~')
workspace = workspace_path.replace(os.path.expanduser('~'), '~')
workspace = os.path.basename(workspace)
tokens = data.get('cost', {}).get('total_lines_added') or data.get('session', {}).get('totalTokens', 0)
cost = data.get('cost', {}).get('total_cost_usd') or data.get('session', {}).get('estimatedCost', 0.0)
# Token limit (adjust based on model)
if 'sonnet' in model.lower() or 'opus' in model.lower():
token_limit = 1000000
else:
token_limit = 200000
token_percentage = min((tokens / token_limit) * 100, 100)
# Git branch
git_branch = None
if os.path.exists('.git'):
try:
import subprocess
result = subprocess.run(
['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
capture_output=True,
text=True,
timeout=1
)
if result.returncode == 0:
git_branch = result.stdout.strip()
except (subprocess.TimeoutExpired, FileNotFoundError):
pass
status = Text()
status.append("🤖 ", style="bold")
status.append(f"{model}", style="bold cyan")
status.append(" │ ", style="dim")
status.append("📁 ", style="bold")
status.append(f"{workspace}", style="yellow")
if git_branch:
status.append(" │ ", style="dim")
status.append(f"{git_branch}", style="magenta")
status.append(" │ ", style="dim")
status.append("🎯 ", style="bold")
token_style = "green" if token_percentage < 50 else "yellow" if token_percentage < 80 else "red"
status.append(f"{tokens:,}", style=token_style)
status.append(f" ({token_percentage:.1f}%)", style="dim")
if cost > 0:
status.append(" │ ", style="dim")
status.append("💰 ", style="bold")
cost_color = "green" if cost < 0.10 else "yellow" if cost < 1.0 else "red"
status.append(f"${cost:.3f}", style=cost_color)
console.print(status)
Version with configurable color themes via environment variables
#!/usr/bin/env python3
import sys
import json
import os
from rich.console import Console
from rich.text import Text
console = Console()
try:
data = json.load(sys.stdin)
except json.JSONDecodeError:
console.print("[red]Error: Invalid JSON input[/red]")
sys.exit(1)
# Theme configuration (via environment variables)
theme = os.environ.get('RICH_STATUSLINE_THEME', 'default')
themes = {
'default': {
'model': 'bold cyan',
'directory': 'yellow',
'git': 'magenta',
'token_low': 'green',
'token_med': 'yellow',
'token_high': 'red',
'cost_low': 'green',
'cost_med': 'yellow',
'cost_high': 'red'
},
'dark': {
'model': 'bold white',
'directory': 'bright_white',
'git': 'bright_magenta',
'token_low': 'bright_green',
'token_med': 'bright_yellow',
'token_high': 'bright_red',
'cost_low': 'bright_green',
'cost_med': 'bright_yellow',
'cost_high': 'bright_red'
},
'minimal': {
'model': 'cyan',
'directory': 'white',
'git': 'white',
'token_low': 'white',
'token_med': 'white',
'token_high': 'white',
'cost_low': 'white',
'cost_med': 'white',
'cost_high': 'white'
}
}
colors = themes.get(theme, themes['default'])
model = data.get('model', {}).get('display_name') or data.get('model', {}).get('id') or 'unknown'
workspace_path = data.get('workspace', {}).get('current_dir') or data.get('workspace', {}).get('path') or data.get('cwd', '~')
workspace = workspace_path.replace(os.path.expanduser('~'), '~')
workspace = os.path.basename(workspace)
tokens = data.get('cost', {}).get('total_lines_added') or data.get('session', {}).get('totalTokens', 0)
cost = data.get('cost', {}).get('total_cost_usd') or data.get('session', {}).get('estimatedCost', 0.0)
git_branch = None
if os.path.exists('.git'):
try:
import subprocess
result = subprocess.run(
['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
capture_output=True,
text=True,
timeout=1
)
if result.returncode == 0:
git_branch = result.stdout.strip()
except (subprocess.TimeoutExpired, FileNotFoundError):
pass
status = Text()
status.append("🤖 ", style="bold")
status.append(f"{model}", style=colors['model'])
status.append(" │ ", style="dim")
status.append("📁 ", style="bold")
status.append(f"{workspace}", style=colors['directory'])
if git_branch:
status.append(" │ ", style="dim")
status.append(f"{git_branch}", style=colors['git'])
status.append(" │ ", style="dim")
status.append("🎯 ", style="bold")
token_style = colors['token_low'] if tokens < 100000 else colors['token_med'] if tokens < 500000 else colors['token_high']
status.append(f"{tokens:,}", style=token_style)
if cost > 0:
status.append(" │ ", style="dim")
status.append("💰 ", style="bold")
cost_style = colors['cost_low'] if cost < 0.10 else colors['cost_med'] if cost < 1.0 else colors['cost_high']
status.append(f"${cost:.3f}", style=cost_style)
console.print(status)
Complete setup script with Rich library installation and Python version verification
#!/bin/bash
# Installation script for Python Rich Statusline
# Check Python version
if ! command -v python3 &> /dev/null; then
echo "Python 3 is required but not installed"
echo "Install Python 3: macOS (brew install python3), Linux (sudo apt-get install python3 or sudo yum install python3)"
exit 1
fi
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
echo "Python version: $PYTHON_VERSION"
# Check if Rich is installed
if ! python3 -c "import rich" 2>/dev/null; then
echo "Installing Rich library..."
python3 -m pip install rich --user || python3 -m pip install rich
echo "Rich library installed"
else
echo "Rich library already installed"
fi
# Verify Rich installation
if python3 -c "import rich" 2>/dev/null; then
RICH_VERSION=$(python3 -c "import rich; print(rich.__version__)" 2>/dev/null || echo "unknown")
echo "Rich version: $RICH_VERSION"
else
echo "Error: Rich library installation failed"
exit 1
fi
# Test emoji support
if python3 -c "print('🤖 📁 🎯 💰')" &> /dev/null; then
echo "Emoji support verified: 🤖 📁 🎯 💰"
else
echo "Warning: Emoji support may not be available"
fi
# Test Rich console
if python3 -c "from rich.console import Console; Console().print('[bold green]Test[/bold green]')" &> /dev/null; then
echo "Rich console working"
else
echo "Warning: Rich console test failed"
fi
# Check for truecolor support
if [ -n "$COLORTERM" ] && [ "$COLORTERM" = "truecolor" ]; then
echo "Truecolor support enabled"
else
echo "Note: Set COLORTERM=truecolor for best color support"
fi
# Create statuslines directory
mkdir -p .claude/statuslines
cat > .claude/statuslines/python-rich-statusline.py << 'SCRIPT_EOF'
#!/usr/bin/env python3
import sys
import json
import os
from rich.console import Console
from rich.text import Text
console = Console()
try:
data = json.load(sys.stdin)
except json.JSONDecodeError:
console.print("[red]Error: Invalid JSON input[/red]")
sys.exit(1)
model = data.get('model', {}).get('display_name') or data.get('model', {}).get('id') or 'unknown'
workspace_path = data.get('workspace', {}).get('current_dir') or data.get('workspace', {}).get('path') or data.get('cwd', '~')
workspace = workspace_path.replace(os.path.expanduser('~'), '~')
workspace = os.path.basename(workspace)
tokens = data.get('cost', {}).get('total_lines_added') or data.get('session', {}).get('totalTokens', 0)
cost = data.get('cost', {}).get('total_cost_usd') or data.get('session', {}).get('estimatedCost', 0.0)
git_branch = None
if os.path.exists('.git'):
try:
import subprocess
result = subprocess.run(
['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
capture_output=True,
text=True,
timeout=1
)
if result.returncode == 0:
git_branch = result.stdout.strip()
except (subprocess.TimeoutExpired, FileNotFoundError):
pass
status = Text()
status.append("🤖 ", style="bold")
status.append(f"{model}", style="bold cyan")
status.append(" │ ", style="dim")
status.append("📁 ", style="bold")
status.append(f"{workspace}", style="yellow")
if git_branch:
status.append(" │ ", style="dim")
status.append(f"{git_branch}", style="magenta")
status.append(" │ ", style="dim")
status.append("🎯 ", style="bold")
token_style = "green" if tokens < 100000 else "yellow" if tokens < 500000 else "red"
status.append(f"{tokens:,}", style=token_style)
if cost > 0:
status.append(" │ ", style="dim")
status.append("💰 ", style="bold")
cost_color = "green" if cost < 0.10 else "yellow" if cost < 1.0 else "red"
status.append(f"${cost:.3f}", style=cost_color)
console.print(status)
SCRIPT_EOF
chmod +x .claude/statuslines/python-rich-statusline.py
# Add to settings.json
if [ ! -f .claude/settings.json ]; then
echo '{"statusLine":{"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py","refreshInterval":1000}}' > .claude/settings.json
else
jq '.statusLine = {"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py","refreshInterval":1000}' .claude/settings.json > .claude/settings.json.tmp
mv .claude/settings.json.tmp .claude/settings.json
fi
echo "Python Rich Statusline installed successfully!"
echo "Note: Ensure terminal supports truecolor for best color rendering"
echo "Set with: export COLORTERM=truecolor"
Install the Rich library: pip3 install rich or python3 -m pip install rich. Verify installation: python3 -c 'import rich'. Check Python path: python3 -c 'import sys; print(sys.path)'. If using virtual environment, activate it first. For user installation: python3 -m pip install --user rich. Verify Rich version: python3 -c 'import rich; print(rich.version)'.
Ensure terminal supports Unicode emojis. Use iTerm2, Kitty, or Windows Terminal. Test with: python3 -c 'print("🤖 Test")'. Verify terminal encoding: locale charmap (should be UTF-8). Set encoding: export LANG=en_US.UTF-8. Check font supports emojis: Install emoji-capable font (e.g., Noto Color Emoji). Test emoji rendering: python3 -c "from rich.console import Console; Console().print('🤖 📁 🎯 💰')".
Enable truecolor support. Set COLORTERM=truecolor environment variable or use a terminal that supports 24-bit color. Verify truecolor: python3 -c "from rich.console import Console; c = Console(); print(c.is_terminal, c.color_system)". Check terminal: iTerm2, Kitty, Windows Terminal support truecolor. Test colors: python3 -c "from rich.console import Console; Console().print('[bold red]Red[/bold red] [bold green]Green[/bold green]')". If still issues, check terminal color settings.
Rich has some startup overhead. Consider increasing refreshInterval to 2000-3000ms or use the minimal-powerline statusline instead. Check Python startup time: time python3 -c 'import rich'. Optimize imports: Only import what's needed (from rich.console import Console, from rich.text import Text). Consider using faster alternatives: Use bash statusline for better performance. Profile script: python3 -m cProfile script.py to identify bottlenecks.
Rich requires Python 3.7+. Check Python version: python3 --version (should be 3.7+). Verify Python 3: which python3 (should return path). If Python 3.6 or older, upgrade: macOS (brew install python3), Linux (sudo apt-get install python3.8 or newer). Check if python3 points to correct version: python3 -c 'import sys; print(sys.version)'.
Check Git installed: git --version. Verify subprocess works: python3 -c "import subprocess; print(subprocess.run(['git', '--version'], capture_output=True, text=True).stdout)". Check timeout: Script uses 1 second timeout - increase if Git is slow. Verify Git command: python3 -c "import subprocess; result = subprocess.run(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], capture_output=True, text=True, timeout=1); print(result.stdout)". Check .git directory: os.path.exists('.git') should return True.
Verify JSON input: echo '$input' | python3 -m json.tool (should parse without errors). Check JSON structure: echo '$input' | python3 -c "import json, sys; data = json.load(sys.stdin); print(data.keys())". Verify stdin: Script reads from sys.stdin - ensure JSON is piped correctly. Test with sample JSON: echo '{"model":{"display_name":"test"}}' | python3 script.py. Check error handling: Script should print error message and exit gracefully on invalid JSON.
Check JSON field names: echo '$input' | python3 -c "import json, sys; data = json.load(sys.stdin); print(data.get('cost', {}).get('total_cost_usd'))". Verify field extraction: Script checks multiple field names (cost.total_cost_usd, session.estimatedCost). Check if fields exist: echo '$input' | python3 -c "import json, sys; data = json.load(sys.stdin); print('cost' in data, 'session' in data)". Verify data structure: Some Claude Code versions may use different field names. Update script to check additional field names if needed.
Show that Python Rich Statusline - Statuslines is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/statuslines/python-rich-statusline)Python Rich Statusline - Statuslines side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
1 trust signal differ across this comparison (Submitter).
| Field | Feature-rich statusline using Python's Rich library for beautiful formatting, progress bars, and real-time token cost tracking Open dossier | Real-time burn rate monitor showing cost per minute, tokens per minute, and projected daily spend to prevent budget overruns during Claude Code sessions. Open dossier | Real-time AI cost tracking statusline with per-session spend analytics, model pricing, and budget alerts Open dossier | Claude Code statusline that reads Anthropic Claude Code Analytics Admin API data and shows daily estimated cost, hourly pace, sessions, and budget pressure. Open dossier |
|---|---|---|---|---|
| Next steps | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| SubmitterDiffers | — | — | — | MkDev11 |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | statuslines | statuslines | statuslines | statuslines |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored | MkDev11 |
| Added | 2025-10-01 | 2025-10-25 | 2025-10-16 | 2026-06-04 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓Runs as a Claude Code statusline command on refresh and depends on the local Python/Rich environment being available. Does not perform network calls or write files, but statusline failures may affect prompt/status rendering until dependencies are installed. | ✓Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session. | ✓Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session. | ✓Claude Code Analytics data is daily aggregated and can lag recent activity, so the burn-rate display is a pacing signal rather than real-time billing control. Keep the refresh interval moderate because the statusline calls an authenticated Admin API endpoint. Treat budget thresholds as operational prompts; reconcile invoices and Console reports before making spending decisions. |
| Privacy notes | ✓Reads Claude Code statusline JSON from stdin, including model, workspace path, token usage, estimated cost, and Git branch when present. Displays workspace path, Git branch, token usage, and cost information in the local terminal statusline. | ✓Reads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine. | ✓Reads the Claude Code statusline JSON from stdin (model, token usage, and cost) and renders it in the local terminal; it does not send data off-machine. | ✓The script sends an Admin API request to Anthropic and receives organization-level Claude Code analytics. It prints aggregate cost, session, and budget numbers, not email addresses, model names, prompts, file paths, or code. Admin API keys can expose organization analytics; store them in a scoped local secret manager or shell environment with restricted access. The script feeds the API key to curl through a config file descriptor instead of command-line arguments and unsets the exported key before launching curl, reducing process-list exposure on shared machines. |
| Prerequisites |
|
|
|
|
| Install | — | — | — | — |
| Config | | | | |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Source-backed guides for putting this to work.
Master MCP server development from scratch.
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.