Available Scripts

April 7, 2026 · View on GitHub

Overview

ScriptPlatformRequirementsState WritesFeatures
statusline.pyAllPython 3YesCross-platform, full-featured

Installation Methods

MethodStatusline CommandContext Stats Command
pip install context-statsclaude-statuslinecontext-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

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:

ElementDefaultConfig KeyFallback
Context lengthBold Whitecolor_context_lengthMI-based color
Project nameCyancolor_project_namecolor_blue
Git branchGreencolor_branch_namecolor_magenta
MI scoreYellowcolor_mi_scoreMI-based color
Zone indicator(zone color)color_zoneDynamic zone color
Separator/dimDimcolor_separator

Base Colors

ColorCodeUsageConfig Key
Cyan\033[0;36mChanges countcolor_cyan
Green\033[0;32mMI-based (good)color_green
Yellow\033[0;33mMI-based (warning)color_yellow
Red\033[0;31mMI-based (critical)color_red
Bold White\033[1;97mContext length default
Dim\033[2mSeparator default
Reset\033[0mReset formatting

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