Skip to content

Latest commit

 

History

History
101 lines (77 loc) · 3.49 KB

File metadata and controls

101 lines (77 loc) · 3.49 KB

Available Scripts

Overview

Script Platform Requirements State Writes Features
statusline.py All Python 3 Yes Cross-platform, full-featured

Installation Methods

Method Statusline Command Context Stats Command
pip install context-stats claude-statusline context-stats

statusline.py

Python implementation. Works on Windows, macOS, and Linux without additional dependencies beyond Python 3.

Features:

  • Writes state files for context-stats CLI
  • Duplicate-entry deduplication
  • State file rotation (10k/5k threshold)
  • Model Intelligence (MI) with per-model profiles
  • 5-second git command timeout

Context Stats CLI

The context-stats command is installed as part of the context-stats Python package (pip install context-stats). See Context Stats for details.

Output Format

[Model] directory | branch [changes] | XXk free (XX%) [+delta] MI:0.XXX [AC:XXk] session_id

Architecture

graph LR
    A[Claude Code] -->|JSON stdin| B[Statusline Script]
    B -->|Parse| C[Model Info]
    B -->|Parse| D[Context Info]
    B -->|Check| E[Git Status]
    B -->|Read| F[Config File]
    B -->|Write| G[State File]
    C --> H[Format Output]
    D --> H
    E --> H
    F --> H
    H -->|stdout| A
Loading

Input Format

Scripts receive JSON via stdin from Claude Code:

{
  "model": {
    "display_name": "Opus 4.5"
  },
  "cwd": "/path/to/project",
  "session_id": "abc123",
  "context": {
    "tokens_remaining": 64000,
    "context_window": 200000,
    "autocompact_buffer_tokens": 45000
  }
}

Color Codes

The script uses consistent ANSI colors (defaults, overridable via ~/.claude/statusline.conf):

Per-Property Colors

Each statusline element has its own configurable color with a fallback chain:

Element Default Config Key Fallback
Context length Bold White color_context_length MI-based color
Project name Cyan color_project_name color_blue
Git branch Green color_branch_name color_magenta
MI score Yellow color_mi_score MI-based color
Zone indicator (zone color) color_zone Dynamic zone color
Separator/dim Dim color_separator

Base Colors

Color Code Usage Config Key
Cyan \033[0;36m Changes count color_cyan
Green \033[0;32m MI-based (good) color_green
Yellow \033[0;33m MI-based (warning) color_yellow
Red \033[0;31m MI-based (critical) color_red
Bold White \033[1;97m Context length default
Dim \033[2m Separator default
Reset \033[0m Reset formatting

See Configuration for details on overriding colors with named colors or hex codes.