Someone dropped a Python statusline wrapper for Claude Code on Hacker News this week, and if you're deep in extended-context work, this is worth bookmarking. The gist from user Reebz wraps around claudeline—the popular plugin that puts usage stats in your terminal—and layers on calculations claudeline can't do natively: true context token math against a 1M denominator, inverted quota bars (remaining instead of used), and git metadata parsed directly from the transcript.

What Makes This Different

The core upgrade is how it calculates context percentage. Claudeline reports tokens relative to whatever compaction window you've configured via CLAUDE_CODE_AUTO_COMPACT_WINDOW. Reebz's wrapper reads the latest usage block from the live transcript jsonl—summing input_tokens, cache_creation_input_tokens, and cache_read_input_tokens—and divides by a hardcoded 1M (or 200k if you're not on extended-context Opus). That means your progress bar genuinely reflects where you are against the model's actual ceiling, independent of when auto-compact fires. The color zones from claudeline still pass through, so risk signaling stays consistent with your configured threshold.

Session Duration and TODO Tracking

The wrapper parses the transcript jsonl for session start time and computes duration on the fly—no more guessing how long you've been in a sesh. It also reads TodoWrite, TaskCreate, TaskUpdate, and TaskStop events to surface active versus pending tasks right in the status bar as ▶N ⏳M or "No tasks" when empty. Git integration shells out to git for branch name and dirty file count, displayed on the right side of the statusline alongside the project folder name.

Time Formatting and Bar Widths

Reset times get rounded to the nearest hour and formatted as lowercase 12-hour (1am, 2pm) instead of claudeline's default. The context bar doubles from 5 to 10 cells wide for better resolution on longer sessions. Quota bars invert: they fill toward 100% showing remaining budget rather than draining from used allocation—a preference thing, but cleaner if you track your daily/hourly burn rates.

Installation and Tunables

Prereqs are Python 3.9+ (preinstalled on macOS) and the claudeline binary at ~/.claude/bin/claudeline. Install via Claude Code's plugin marketplace or direct download from GitHub releases, save statusline.py to that same bin directory, then configure ~/.claude/settings.json with a command-type statusLine pointing to python3 /path/to/statusline.py. The wrapper has tunable constants: TRUE_CONTEXT_WINDOW (1M default), EXTENDED_TOKEN_THRESHOLD (300k before 🥵 appears versus claudeline's 200k), CTX_WIDTH and QUOTA_WIDTH for bar dimensions, and TRANSCRIPT_TAIL_BYTES controlling how much of the transcript gets scanned per render.

Key Takeaways

  • True context % is computed from raw usage blocks divided by actual model ceiling, not compaction threshold
  • Quota bars show remaining budget (drain toward empty) instead of used amount
  • Git branch and dirty state appear on the right alongside project folder name
  • Session duration and TODO counts are parsed live from the transcript jsonl

The Bottom Line

This is a solid piece of engineering for power users who want visibility into extended context sessions. The true 1M math alone justifies it if you're regularly pushing past 500k tokens—the visual feedback that compact is coming at ~84% versus some arbitrary threshold makes a real difference when you're in the zone. Grab the gist, tweak the tunables to match your workflow, and stop guessing where you are in your context window.