ADR-062: Claude Code Statusline Configuration System
| Field | Value |
|---|---|
| Status | Accepted |
| Date | 2026-01-09 |
| Author | Hal Casteel |
| Reviewers | Claude Opus 4.5 |
| Category | Developer Experience |
| Tags | statusline, configuration, CLI, UX |
1. Executive Summaryβ
This ADR documents the comprehensive statusline configuration system for Claude Code, providing developers with real-time visibility into project state, git status, model usage, system resources, and development environment. The system is fully configurable via JSON, allowing users to toggle sections on/off based on their preferences.
2. Contextβ
2.1 Problem Statementβ
Claude Code users need immediate visibility into:
- Current project context
- Git repository state
- Model and context window usage
- Development environment status
- System resource availability
- Active task tracking
Without this information readily available, developers must manually check multiple sources, reducing productivity and situational awareness.
2.2 Requirementsβ
| Requirement | Priority | Description |
|---|---|---|
| Real-time updates | P0 | Status must reflect current state |
| Configurability | P0 | Users can toggle sections on/off |
| Performance | P0 | Must not add noticeable latency |
| Cross-platform | P1 | Support macOS and Linux |
| Color-coded | P1 | Visual distinction between status types |
| Non-intrusive | P1 | Multi-line format with logical grouping |
3. Decisionβ
Implement a bash-based statusline system with JSON configuration that displays real-time information across 7 configurable sections.
3.1 Architectureβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Claude Code Runtime β
β β β
β βΌ β
β βββββββββββββββββββ β
β β JSON Input β β
β β (stdin pipe) β β
β ββββββββββ¬βββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β statusline-command.sh β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β Configuration Loader β β β
β β β ~/.claude/statusline-config.json β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β β
β β ββββββββββββββββββΌβββββββββββββββββ β β
β β βΌ βΌ βΌ β β
β β ββββββββββββ ββββββββββββ ββββββββββββ β β
β β β Section β β Section β β Section β ... β β
β β β Enabled? β β Enabled? β β Enabled? β β β
β β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ β β
β β β β β β β
β β βΌ βΌ βΌ β β
β β ββββββββββββ ββββββββββββ ββββββββββββ β β
β β β Generate β β Generate β β Generate β β β
β β β Content β β Content β β Content β β β
β β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ β β
β β βββββββββββββββββ΄ββββββββββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββββ β β
β β β Assemble & β β β
β β β Output Line β β β
β β ββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββ β
β β Terminal Line β β
β βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
3.2 File Locationsβ
| File | Path | Purpose |
|---|---|---|
| Script | ~/.claude/statusline-command.sh | Main statusline generator |
| Config | ~/.claude/statusline-config.json | Section toggle configuration |
| Settings | ~/.claude/settings.json | Claude Code settings (references script) |
4. Statusline Sectionsβ
4.1 Section Overviewβ
| # | Section | Icon | Key | Default | Description |
|---|---|---|---|---|---|
| 1 | Project | π | project | true | Current working directory name |
| 2 | Git | β | git | true | Branch, status, sync state |
| 3 | Claude | π€ | claude | true | Model, context usage, tokens |
| 4 | Environment | β | environment | true | Dev tools and runtimes |
| 5 | System | π» | system | true | Hardware resources |
| 6 | Identity | π€ | identity | true | User, host, time |
| 7 | Task | π | task | true | Active CODITECT task ID |
4.2 Section 2: Git (β)β
Purpose: Provide comprehensive git repository status at a glance.
| Element | Symbol | Color | Description |
|---|---|---|---|
| Branch name | β | Green | Current branch or commit hash |
| Clean status | β | Green | Working tree is clean |
| Dirty status | β | Red | Uncommitted changes exist |
| Ahead count | βn | Green | Commits ahead of remote |
| Behind count | βn | Red | Commits behind remote |
| Stash count | S:n | Yellow | Number of stashed changes |
| File count | nf | Yellow | Number of changed files |
Examples:
| Status Line | Meaning |
|---|---|
mainβ | On main, clean |
mainβ 3f | On main, dirty, 3 files changed |
featureββ2 | On feature, clean, 2 ahead |
mainββ1β3 S:2 5f | Dirty, 1 ahead, 3 behind, 2 stashes, 5 files |
4.3 Section 3: Claude (π€)β
Purpose: Display model information and context window utilization.
| Element | Format | Description |
|---|---|---|
| Model name | Opus/Sonnet/Haiku | Current Claude model |
| Context % | n% | Context window usage percentage |
| Token flow | nKβnK | Input tokens β Output tokens (in thousands) |
Model Colors:
| Model | Color | ANSI Code |
|---|---|---|
| Opus | Magenta | \033[35m |
| Sonnet | Blue | \033[34m |
| Haiku | Green | \033[32m |
| Unknown | White | \033[97m |
Context Usage Colors:
| Range | Color | Meaning |
|---|---|---|
| 0-49% | Green | Plenty of room |
| 50-79% | Yellow | Getting full |
| 80-100% | Red | Near limit |
4.4 Section 4: Environment (β)β
Purpose: Show active development tools, runtimes, and project type indicators.
| Element | Icon | Color | Condition |
|---|---|---|---|
| Python venv | π | Magenta | $VIRTUAL_ENV set or .venv/ exists |
| Node.js | β¬’ | Green | package.json exists + node installed |
| Docker | π³ | Blue | Running containers > 0 |
| Rust | π¦ | Red | Cargo.toml exists |
| Go | π· | Cyan | go.mod exists |
| TypeScript | TS | Blue | tsconfig.json exists |
| Version | vX.Y.Z | Dim | From package.json or pyproject.toml |
4.5 Section 5: System (π»)β
Purpose: Display hardware resource status for awareness of system constraints.
| Element | Icon | Color Logic | Source |
|---|---|---|---|
| Battery | π/β‘/πͺ« | Green (charging/ok), Red (<20%) | pmset -g batt |
| Memory | πΎ | Blue | vm_stat |
| Disk | πΏ | Dim | df -h |
Battery Icons:
| Icon | Meaning | Condition |
|---|---|---|
| β‘ | Charging | "charging" in pmset output |
| π | On battery (ok) | >= 20% |
| πͺ« | Low battery | < 20% |
4.6 Section 7: Task (π)β
Purpose: Display the active CODITECT task ID for project tracking integration.
| Element | Color | Source |
|---|---|---|
| Task ID | White | $CODITECT_TASK environment variable |
Condition: Only displays if $CODITECT_TASK is set.
Integration:
export CODITECT_TASK="A.9.1.3" # Set before starting Claude Code
5. Configurationβ
5.1 Configuration Fileβ
Location: ~/.claude/statusline-config.json
Full Schema:
{
"_comment": "Toggle sections on/off. Set to false to hide a section.",
"sections": {
"project": true,
"git": true,
"claude": true,
"environment": true,
"system": true,
"identity": true,
"task": true
},
"_section_descriptions": {
"project": "π Current directory name",
"git": "β Branch, status, ahead/behind, stash, file count",
"claude": "π€ Model name, context %, token usage (inβout)",
"environment": "β Python venv, Node version, Docker, language icons, package version",
"system": "π» Battery, RAM usage, disk space",
"identity": "π€ User, hostname, time, timezone",
"task": "π Active CODITECT task ID (requires $CODITECT_TASK env var)"
},
"_usage": "Edit this file to customize your statusline. Changes take effect immediately."
}
5.2 Preset Configurationsβ
| Preset | Sections Enabled | Use Case |
|---|---|---|
| Full | All 7 | Maximum visibility |
| Minimal | project, claude | Clean, focused |
| Dev Focus | project, git, claude, environment | Development work |
| System Monitor | project, claude, system | Resource-aware |
| Git Focus | project, git, claude | Version control focus |
Minimal Configuration:
{
"sections": {
"project": true,
"git": false,
"claude": true,
"environment": false,
"system": false,
"identity": false,
"task": false
}
}
5.3 Configuration Commandsβ
| Action | Command |
|---|---|
| Edit config | nano ~/.claude/statusline-config.json |
| Enable section | jq '.sections.system = true' ~/.claude/statusline-config.json | sponge ~/.claude/statusline-config.json |
| Disable section | jq '.sections.system = false' ~/.claude/statusline-config.json | sponge ~/.claude/statusline-config.json |
| Reset to full | Copy full config from ADR |
| View current | cat ~/.claude/statusline-config.json |
6. Color Systemβ
6.1 ANSI Color Codesβ
| Color | Code | Escape Sequence | Usage |
|---|---|---|---|
| Cyan | 36 | \033[36m | Separators, username |
| Green | 32 | \033[32m | Good status, names |
| Yellow | 33 | \033[33m | Warnings, time |
| Red | 31 | \033[31m | Errors, alerts |
| Blue | 34 | \033[34m | Info, Sonnet model |
| Magenta | 35 | \033[35m | Opus model, Python |
| Grey | 90 | \033[90m | Brackets, labels |
| White | 97 | \033[97m | Task ID |
| Dim | 2 | \033[2m | Secondary info |
| Reset | 0 | \033[0m | Clear formatting |
6.2 Semantic Color Meaningsβ
| Color | Semantic Meaning |
|---|---|
| Green | Positive: clean, ahead, good battery, success |
| Yellow | Warning: moderate usage, stashes, file changes |
| Red | Alert: dirty, behind, high usage, low battery |
| Blue | Informational: memory, Sonnet, Docker |
| Magenta | Special: Opus, Python |
| Cyan | Structural: separators, user identity |
| Grey/Dim | De-emphasized: brackets, secondary data |
7. Integration with CODITECT-CORE-INITIAL-SETUP.pyβ
7.1 Installation Flowβ
CODITECT-CORE-INITIAL-SETUP.py
β
βββ Phase 1: Core Installation
β
βββ Phase 2: Symlink Creation
β
βββ Phase 3: Machine ID Generation
β
βββ Phase 4: Context Database
β
βββ Phase 5: Hooks Configuration
β
βββ Phase 6: Statusline Setup βββ NEW
β
βββ Create statusline-command.sh
βββ Create statusline-config.json
βββ Update settings.json
7.2 Setup Functionβ
def setup_statusline(claude_dir: Path) -> None:
"""Configure Claude Code statusline with comprehensive system status."""
# Create statusline script
script_path = claude_dir / "statusline-command.sh"
script_path.write_text(STATUSLINE_SCRIPT)
script_path.chmod(0o755)
# Create default configuration (all sections enabled)
config_path = claude_dir / "statusline-config.json"
config_path.write_text(json.dumps({
"sections": {
"project": True,
"git": True,
"claude": True,
"environment": True,
"system": True,
"identity": True,
"task": True
}
}, indent=2))
# Update settings.json
settings_path = claude_dir / "settings.json"
settings = json.loads(settings_path.read_text()) if settings_path.exists() else {}
settings["statusLine"] = str(script_path)
settings_path.write_text(json.dumps(settings, indent=2))
print("β Statusline configured")
8. Troubleshootingβ
8.1 Common Issuesβ
| Issue | Cause | Solution |
|---|---|---|
| No statusline displayed | Settings not configured | Check ~/.claude/settings.json has statusLine |
| Sections missing | Config disabled | Check ~/.claude/statusline-config.json |
| Git info missing | Not in git repo | Normal - only shows in git repos |
| Environment empty | No dev tools detected | Normal - only shows detected tools |
| Colors not showing | Terminal doesn't support | Use terminal with ANSI support |
| jq errors | jq not installed | brew install jq or apt install jq |
8.2 Debug Commandsβ
# Test statusline manually
echo '{"workspace":{"current_dir":"'"$PWD"'"}}' | bash ~/.claude/statusline-command.sh
# Check configuration
cat ~/.claude/statusline-config.json | jq .
# Verify settings
cat ~/.claude/settings.json | jq .statusLine
# Check script permissions
ls -la ~/.claude/statusline-command.sh
8.3 Reset to Defaultsβ
# Reset configuration to full
cat > ~/.claude/statusline-config.json << 'EOF'
{
"sections": {
"project": true,
"git": true,
"claude": true,
"environment": true,
"system": true,
"identity": true,
"task": true
}
}
EOF
9. Real-World Examplesβ
9.1 Full Configuration Exampleβ
Output:
β[π:coditect-rollout-master]β[β:mainβ S:1 5f]β
β[π€:Opus 55% 85.0Kβ25.0K]β
β[β:πvenv β¬’22.1.0 π¦ v2.0.0]β[π»:β‘85% πΎ8.2GB πΏ120Gi]β
β[π€:halcasteel@mac 14:23:45PST]β[π:A.9.1.3]β
9.2 Minimal Configuration Exampleβ
Config:
{
"sections": {
"project": true,
"git": false,
"claude": true,
"environment": false,
"system": false,
"identity": false,
"task": false
}
}
Output:
β[π:my-project]β
β[π€:Opus 42% 55.0Kβ18.2K]β
- Clean, focused view with only project and Claude status
10. Performance Considerationsβ
10.1 Execution Time Budgetβ
| Section | Typical Time | Optimization |
|---|---|---|
| Project | <1ms | Direct variable |
| Git | 10-50ms | Only if in repo |
| Claude | <1ms | JSON parsing only |
| Environment | 5-20ms | File existence checks |
| System | 20-50ms | System calls |
| Identity | <5ms | Quick commands |
| Task | <1ms | Environment variable |
| Total | 40-130ms | Well within budget |
10.2 Optimization Techniquesβ
- Lazy evaluation: Sections only computed if enabled
- Early exit: Git checks abort if not in repo
- Cached config: Config read once per invocation
- Parallel-safe: No locks or shared state
11. Consequencesβ
Positiveβ
- Real-time visibility into all development state
- Fully configurable via JSON
- Performance optimized with lazy evaluation
- Cross-platform support (macOS, Linux)
- Color-coded for quick visual scanning
- Integrated with CODITECT task tracking
Negativeβ
- Shell dependency - Requires bash 4+
- jq dependency - Required for JSON parsing
- macOS-specific commands for some features
12. Referencesβ
- Claude Code Documentation
- ADR-057: CODITECT Core Initial Setup
- ADR-058: Machine-Specific Session Logs
- ANSI Escape Codes
Document Version: 1.0.0 Last Updated: 2026-01-09 Next Review: 2026-04-09