All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.20.0 - 2026-04-16
- Default to latest session — Session ID is now optional for all commands. When omitted, the most recent session from
~/.claude/statusline/is auto-detected and used (#60, #68) sessionssubcommand — Newcontext-stats sessionscommand lists recent sessions with project, model, token count, and last-activity time. Supports--minutes Nto widen the search window (#60, #68)
- Stricter
sessionsargument validation — Reject missing, zero, or negative--minutesvalues and stray positional arguments instead of silently ignoring them
- Modernized prefix stripping — Replaced
.replace("statusline.", "")andname[11:]withremoveprefix("statusline.")(Python 3.9+) across the CLI and state modules
- Compaction event detection — Detect
/compactevents (>50% context drop) in session state and annotate graphs with▼markers so users can see exactly when and where compaction occurred (#62, #67) - MI quality flagging at compaction — When a compaction event is detected, the MI score at that point is captured and flagged if below the warning threshold — alerting users to potentially lossy summaries (#65, #67)
- Actionable zone recommendations — Zone indicators (Plan/Code/Dump/ExDump/Dead) now include a brief recommendation so users know what action to take in each zone (#63, #66)
- Landing page — Added static GitHub Pages landing page highlighting the cache keep-warm feature and ContextStats rebrand (#66)
- Zone percentage thresholds — Corrected zone percentage thresholds in landing page to match actual code implementation (#64, #66)
- Landing page timeline arrows — Made cache-warm timeline arrows visible in landing page design
- 1M model zone thresholds recalibrated — Updated
ZONE_1M_*constants to better reflect observed context degradation onset (300-400k tokens), reducing the false-alarm window by 25-120k tokens (#64, #66) - README messaging — Pivoted to three-level analytics framework for improved clarity
- Brand identity — Fresh logo for ContextStats rebrand
- Example report — Added anonymized 30-day example report for reference
- Mermaid charts for visual analytics — Added Mermaid-based charts to the
context-stats reportoutput, providing visual token usage analytics alongside the existing text summaries
- Report period and session filtering — Fixed
generate_reportto show the correct reporting period and filter sessions bystart_timeso reports reflect actual session boundaries - Mermaid x-axis label overlap — Shortened x-axis labels in Mermaid charts to prevent text overlap on busy timelines
- CI workflow cleanup — Removed deleted
test_context_stats_subcommands.batsreference from the CI workflow to prevent spurious test failures
- Report rewrite with full analytics — Rewrote
generate_reportto produce comprehensive analytics matching the reference format: session summaries, token breakdowns, and chart data - Python-only codebase finalised — Completed removal of all remaining Node.js and Bash remnants; the project is now exclusively Python
- Comprehensive token usage analytics and reporting — Added full token usage analytics with charts, summaries, and reporting capabilities for session data (#56, #57)
- Python-only migration complete — Removed
context-stats.shshell script and all Bash/Node.js implementations; the project now ships a single Python-only codebase (#58, #59)
- README rewrite — Rewrote the README to highlight key features and improve overall clarity
- cache-warm dispatch in shell script —
context-stats <session_id> cache-warmwas silently rejected byscripts/context-stats.shwith "Unexpected argument: cache-warm". The shell script now delegates<session_id> cache-warm ...to the Python CLI alongside the existingexportandexplaindelegations.
- Cache-warm subcommand — Added
context-stats <session_id> cache-warmto keep a Claude Code session's prompt cache alive by periodically touching the cache via a background daemon. Supports fork/detach on Unix and subprocess fallback on Windows (#49, #54) - Cache graph type — Added
--type cacheto thecontext-statsgraph command to visualize cache creation and cache read token activity over time (#48) - E2E install smoke tests in pre-commit hook — Added clean end-to-end install smoke tests that run before each commit to catch install regressions early (#51, #53)
- Action-based CLI interface — Redesigned
context-statsto use a strict<session_id> <action>pattern (e.g.context-stats <id> graph,context-stats <id> export), replacing the previous flag-based interface for improved composability and discoverability (#50, #52)
- Windows CI pytest-cov exit code — Resolved spurious exit code 1 from
pytest-covon Windows by clearing the coverage tracer before process exit and using terminal reporter stats to determine final exit code (#54) - Windows CI failures in cache-warm tests — Fixed fork simulation tests (skipped on Windows), replaced
tmp_pathwithmkdtempto avoid coverage tracer conflicts, and added a SIGCHLD guard for Unix-only signal handling (#49) - E2E test robustness — Fixed eval injection, dead tmpdir usage,
set -eabort on npm pack, and ShellCheck warnings ine2e-install-test.sh(#51) - ESLint upgrade — Bumped eslint from 8.57.1 to 10.2.0 (dependabot)
- Auto-install Python package — Installation script now automatically installs or upgrades the
cc-context-statsPython package to match the shell script version. Previously, only the bash script was installed, causingcontext-stats exportand other Python subcommands to fail when invoked from outside the repo (#47) - Version validation for Python package — Added version checks in
context-stats.shthat detect if the Python package is missing or stale, displaying clear error messages and upgrade instructions (#47) - Circular package dependency — Removed self-referential dependency from
package.jsonthat violated npm package semantics (#47) - Bash test for Python version checks — Fixed integration test that validates Python version detection logic (#47)
- Version mismatch error icon — Corrected error message icon from
⚠to✗for consistency with other error messages (#47)
- Context report example and CLI coverage — Added
context-stats-export-output.mdas a full export example and added bash coverage forcontext-statssubcommands
- Export report structure — Refined exported Markdown with a
Generateblock,Executive Snapshot, key takeaways, chart explanations, timestamp-based chart axes, and clearer cache activity visuals - README landing page — Reworked the README around context zones, next-action guidance, live monitoring screenshots, export report examples, and installation/configuration flow
- Export session stats as Markdown — Added the
context-stats exportcommand to generate a markdown report for a session, with optional--outputsupport (#45, #46)
- Example statusline.conf — Added
examples/statusline.confwith full parameter reference and default values (#34, #35)
- UTF-8 encoding for config file I/O — Config file reads and writes now use explicit UTF-8 encoding, preventing encoding errors on systems with non-UTF-8 default locale (#34, #35)
- Simplified config setup — Replaced auto-generated inline template with bundled
examples/statusline.conf; usesimportlib.resourcesfor reliable resource access (#36, #37) - Synced standalone script templates — Standalone Python and Node.js scripts now share consistent first-run config behavior and autocompact default (#36, #37)
- Autocompact default set to false — Example config and script headers now correctly default
autocompact=false(#36, #37)
- Configurable zone indicator thresholds — Override default Plan/Code/Dump/ExDump/Dead zone boundaries via
~/.claude/statusline.conffor both standard and 1M-class models (#27, #31) - End-to-end CI tests — 4 new E2E jobs (
e2e-install-bash,e2e-install-npm,e2e-install-pip,e2e-exec) verify installation paths and script execution across Ubuntu/macOS with multiple runtime versions (#30, #32)
- Updated zone indicator screenshots — Refreshed
code-zone.pnganddump-zone.pngfor v1.12.0 documentation
- Unified context info and zone indicator colors — Context info (free tokens / percentage) and zone indicator (Plan/Code/Dump/ExDump/Dead) now share the same traffic-light color, giving a unified at-a-glance signal of context health. Previously, context info used a 3-color MI-based scheme while the zone indicator used a 5-color traffic-light scheme (#28)
- Zone screenshots in README — Display zone screenshots one per line for better visibility
- Per-property color support — Override colors for individual statusline elements (
color_context_length,color_project_name,color_branch_name,color_mi_score,color_zone,color_separator) with fallback chain: per-property key -> base color key -> built-in default (#23) - 5-state context zone indicators — Plan/Code/Dump/ExDump/Dead zones for 1M-class models with absolute token thresholds; standard models use percentage-based thresholds (#21)
- Zone always visible — Zone indicator now shows regardless of
show_misetting
- Statusline element reorder — Context info (project, branch, tokens, zone, MI) now appears first with model name moved to lowest priority position; model name is truncated first when terminal is narrow (#25)
- Full-word zone indicators — Changed from single-letter (P/C/D/X/Z) to full words (Plan/Code/Dump/ExDump/Dead) for clarity
- MI hidden by default —
show_midefaults tofalse; enable withshow_mi=truein config - README customization guide — Expanded README with detailed status line anatomy, color resolution diagram, per-element color control docs, and four example theme configurations (Tokyo Night, High Contrast, Minimal, Monochrome)
- CI lint failures — Resolved unused variable and missing curly brace lint errors across all implementations
- Backward-compatible color fallbacks — Per-property color keys gracefully fall back to legacy base color keys
- Version badges — Switched from badge.fury.io to shields.io for reliability
--versionflag for bash CLI —context-stats --versionnow works when installed via npm (was returning "Unknown option")- Quick Start docs — Show correct statusline command per install method (pip/npm vs shell script)
- Logo redesign — Curve now descends (MI declining) instead of ascending (context growing), reflecting the model intelligence pivot
- README messaging — Pivoted tagline to "Keep your model sharp. Ship with confidence." with MI as lead feature
- Statusline screenshots — Side-by-side green/yellow screenshots showing MI color changes
- Documentation — Updated all docs (configuration, context-stats, scripts) for v1.10+ MI features
- MI-aware color system — MI color thresholds now: green >= 0.90, yellow < 0.90 or context 40-80%, red <= 0.80 or context >= 80%. Context token color matches MI color for consistency
- Consistent pipe separators — All statusline fields now separated by
|instead of mixed brackets/spaces - Delta repositioned — Delta moved after MI:
... | MI:0.980 | +144 | session_id - Model name without brackets —
Opus 4.6 (1M context) | dirinstead of[Opus 4.6 (1M context)] dir
- Autocompact (AC) indicator — Removed from statusline to save space. AC setting is user-configured and doesn't need constant display
- MI redesign: pure utilization-based formula with per-model profiles — Replaced the 3-component composite (CPS+ES+PS) with
MI(u) = max(0, 1 - u^beta)where beta is model-specific. Eliminates zig-zag chart behavior caused by noisy cache efficiency and productivity metrics - Per-model degradation profiles — Opus (beta=1.8) retains quality longest, Sonnet (beta=1.5) moderate, Haiku (beta=1.2) degrades earliest. Model auto-detected from
model_idstring - 3-decimal MI display — MI now shows as
MI:0.995instead ofMI:1.00for better precision at low utilization - Color thresholds adjusted — Green >0.70 (was >0.65), Yellow >0.40 (was >0.35) to reflect the simplified pure-utilization scale
mi_curve_betaconfig default — Changed from1.5to0(meaning "use model-specific profile"). Set to a positive value to override
- ES (Efficiency Score) — Cache hit ratio metric removed from MI; it measured API caching behavior, not model intelligence
- PS (Productivity Score) — Lines-per-token metric removed from MI; it measured model activity, not intelligence degradation
IntelligenceConfigdataclass — Unused after redesign; beta is passed directly
- MI no longer needs previous state entry — Reduces file I/O when
show_delta=false - Beta fallback bug in context-stats — Was ignoring user-configured
mi_curve_betaand falling back to hardcoded 1.5 - MI computed for all entries unnecessarily — Now only computes MI for last entry when graph type is not
miorall - Hardcoded thresholds in renderer — Now uses
MI_GREEN_THRESHOLD/MI_YELLOW_THRESHOLDconstants
- Version reporting —
context-stats --versionnow correctly reports the installed version. Previously,__init__.pyandcontext-stats.shwere not bumped during release, causing stale version output
- Installation checker (
scripts/check-install.sh) — Verifies both statusline and context-stats CLI are properly installed regardless of method (bash, npm, pip). Checks command availability, settings.json configuration, and functional output. Runnable locally or viacurl | bash - MI monotonicity tests — 60 new tests across Python (25), Node.js (23), and Bash (12) ensuring MI score always reflects context length: more free context = higher MI. Tests cover CPS monotonicity, composite MI under varying ES/PS, fine-grained 1% resolution, zone alignment, and all beta values
- Shared monotonicity test vectors —
tests/fixtures/mi_monotonicity_vectors.jsonwith utilization steps, ES/PS scenarios, and beta variants for cross-implementation parity
- npm bin entry — Removed
claude-statuslinefrom npm bin (not a user-facing CLI) - Self-dependency — Removed accidental self-dependency in package.json
- Upgrade detection — Installer now detects and reports version upgrades
- npm package exports — Added proper bin entries for
context-statsCLI
- Model Intelligence (MI) score — Heuristic quality score estimating answer quality based on context utilization, cache efficiency, and output productivity. Inspired by the Michelangelo paper (arXiv:2409.12640). Displayed as
MI:X.XXin the statusline with green/yellow/red color coding - MI score in all implementations — MI computation available across Python package, standalone Python, Node.js, and Bash (via
awk) statusline scripts with full cross-implementation parity - MI timeseries graph —
context-stats --type mirenders MI score trajectory over time as an ASCII graph with decimal Y-axis labels - MI in session summary —
context-statssummary now shows MI score with sub-component breakdown (CPS, ES, PS) and interpretation text - Shared test vectors —
tests/fixtures/mi_test_vectors.jsonwith 6 vectors ensuring Python and Node.js produce identical MI scores within ±0.01 tolerance label_fnparameter forrender_timeseries()— Optional custom Y-axis label formatter, used by MI graph to display decimals instead of token counts- Bash feature parity —
statusline-full.shnow supports custom color overrides, state file rotation, MI score display, and all config keys (show_mi,mi_curve_beta,reduced_motion,show_io_tokens) - Config:
show_mi— Toggle MI score display (default:true) - Config:
mi_curve_beta— Adjust MI degradation curve shape (default:1.5)
- Compact context display — Removed "free" word from context info (
872,748 (87.3%)instead of872,748 free (87.3%)) across all implementations - Decoupled state reads from
show_delta— State file is now read when eithershow_deltaorshow_miis enabled, allowing MI to work independently of delta display - Node.js terminal width default — Changed from
80to200when no TTY is detected (matching Python behavior), preventingfitToWidthfrom dropping statusline parts in Claude Code's subprocess
- Node.js terminal width — Fixed
getTerminalWidth()defaulting to 80 in Claude Code's subprocess, which caused MI, delta, AC, and session parts to be silently dropped
- Configurable colors - Custom color themes via
~/.claude/statusline.confusing named colors (bright_cyan) or hex codes (#7dcfff). Six configurable slots:color_green,color_yellow,color_red,color_blue,color_magenta,color_cyan context-stats explaincommand - Diagnostic dump that pretty-prints Claude Code's JSON context with derived values (free tokens, autocompact buffer, effective free), active config, vim/agent/output_style extensions, and raw JSON. Supports--no-colorflag- 24-bit true color support - Hex color codes (
#rrggbb) are converted to ANSI 24-bit escape sequences for full RGB color customization - Cross-implementation sync documentation - Added sync points table to CLAUDE.md documenting triplicated logic across Python, Node.js, and Bash implementations
- ColorManager accepts overrides -
ColorManagernow takes an optionaloverridesdict, allowing config-driven color customization throughout the package - Git info uses configurable colors - Branch and change count colors now respect user color overrides in all three implementations
- Config parsing preserves raw values - Config reader now preserves case for color values while lowercasing only for boolean comparison
- Delta calculation parity - Python statusline now reads correct CSV indices (3+5+6) for context usage delta, matching Node.js behavior
- Missing duplicate-entry guard - Python statusline now skips state file writes when token count is unchanged, preventing file bloat
- Missing state file rotation - Python statusline now calls rotation after writes (10k/5k threshold), matching Node.js
- Missing git timeout - Added 5-second timeout to git subprocess calls in standalone Python statusline script
- Broad exception handling - Narrowed
except Exceptionto(OSError, ValueError)for state reads andOSErrorfor writes - Stale CSV format comments - Added missing
context_window_sizefield to header comments in both Python and Node.js scripts
- Delta parity tests - 4 new bats tests verifying Python/Node.js produce identical deltas, handle first-run/decrease/dedup correctly
- Footer version drift - Corrected stale version
1.2.3in bash script and1.0.0default in Python renderer to match actual release version - Footer project name - Renamed
claude-statuslinetocc-context-statsin the footer display across bash and Python implementations - Install version embedding - Install scripts now read version from
package.jsonand embed it into the installed script, preventing future version drift
- CLI
--versionflag -context-stats --version/-Vnow prints the current version - State file rotation - Automatic rotation at 10,000 lines (keeps most recent 5,000) to prevent unbounded file growth
- Session ID validation - Rejects path-traversal characters (
/,\,.., null bytes) for security - Git command timeout - 5-second timeout on git operations in both Python and Node.js implementations
- Core data pipeline unit tests - 51 tests across 6 classes covering config, state, formatters, graph, and CLI
- Cross-implementation parity test - Ensures Python and Node.js statusline scripts produce consistent output
- Stderr warnings - Critical error paths now emit warnings to stderr for debugging
- CSV format documentation - Formal specification of the 14-field state file format
- Comma guard for workspace paths - Commas in
workspace_project_dirare replaced with underscores before CSV write - Open-source standard files - Added CODE_OF_CONDUCT.md, CONTRIBUTING.md, SECURITY.md, and GitHub issue/PR templates
- NPM Package -
cc-context-statsnow available on npm for JavaScript/Node.js environments
- Package Metadata - Synchronized package descriptions across npm and PyPI for consistency
- Installation Section - Moved shell script installation to the top of README as the recommended method
- Bumped prettier from 3.7.4 to 3.8.0
- Context Zones - Status indicator based on context usage:
- 🟢 Smart Zone (< 40%): "You are in the smart zone"
- 🟡 Dumb Zone (40-80%): "You are in the dumb zone - Dex Horthy says so"
- 🔴 Wrap Up Zone (> 80%): "Better to wrap up and start a new session"
- Project name display - Header now shows "Context Stats (project-name • session-id)"
- Watch mode enabled by default -
context-statsnow runs in live monitoring mode (2s refresh) - Delta graph by default - Shows "Context Growth Per Interaction" instead of both graphs
- Added
--no-watchflag to show graphs once and exit - Simplified installer - no script selection, auto-overwrite existing files
- Renamed graph labels to focus on context (e.g., "Context Usage Over Time")
- Cleaned up session summary - removed clutter, highlighted status
- BREAKING: Renamed package from
cc-statuslinetocc-context-stats - BREAKING: Renamed
token-graphCLI command tocontext-stats - Pivoted project focus to real-time token monitoring and context tracking
- Updated tagline: "Never run out of context unexpectedly"
If upgrading from cc-statusline:
pip uninstall cc-statusline
pip install cc-context-statsThe claude-statusline command still works. Replace token-graph with context-stats.
- Fixed remaining context showing negative values in context-stats by using
current_used_tokensinstead of cumulativetotal_input_tokens + total_output_tokens - Fixed ANSI escape codes not rendering properly in watch mode by using
sys.stdout.write()instead ofprint()for cursor control sequences - Fixed color codes in summary statistics using ColorManager instead of raw ANSI constants
- pip/uv installable Python package (
cc-statuslineon PyPI) context_window_sizefield to state file for tracking remaining context- Remaining context display in context-stats summary
- Restored executable permissions on script files
- Fixed stdin detection in pipe mode using INTERACTIVE flag
- Cleaned up unused
show_io_tokensoption - Fixed shellcheck warnings in shell scripts
- Comprehensive test suite with Bats (Bash), pytest (Python), and Jest (Node.js)
- GitHub Actions CI/CD pipeline with multi-platform testing
- Code quality tools: ShellCheck, Ruff, ESLint, Prettier
- Pre-commit hooks for automated code quality checks
- EditorConfig for consistent formatting across editors
- CONTRIBUTING.md with development setup instructions
- Dependabot configuration for automated dependency updates
- Release automation workflow
- Full-featured status line script (
statusline-full.sh) - Git-aware status line script (
statusline-git.sh) - Minimal status line script (
statusline-minimal.sh) - Cross-platform Python implementation (
statusline.py) - Cross-platform Node.js implementation (
statusline.js) - Interactive installer script (
install.sh) - Configuration examples for Claude Code
- Autocompact (AC) buffer indicator
- Context window usage with color-coded percentages
- Git branch and uncommitted changes display
Initial development versions with basic status line functionality.