Real-time context health for Claude Code. Know when you're in the smart zone — before you hit the dumb zone.
curl -fsSL https://raw.githubusercontent.com/vertocode/ctxstat/main/install.sh | bashThat's it. The installer downloads statusline.sh, makes it executable, and wires up ~/.claude/settings.json automatically.
Start a Claude Code session — the statusline appears automatically.
Row 1 — Model · Tokens/% (Zone) context bar · ~Cost · Effort · Plan
Row 2 — Directory (branch*) +additions -deletions
Row 3 — Session duration · Session ID
Row 4 — Rate limits: current and weekly bars with reset times (requires Claude.ai OAuth)
- Model — display name from Claude Code
- Tokens / % — context usage with visual bar, color-coded by zone
- Zone — Smart / Watch / Caution / Dumb
- ~Cost — estimated input cost based on model pricing (Sonnet, Opus, Haiku, Fable)
- Effort — current effort level (▽ low / ◆ default / ▲ high)
- Plan — detected plan: Teams / Max / Pro / API
- Git diff stat —
+N -Nlines changed vs HEAD (green/red), only shown when in a git repo with changes - Session duration — time since session start
- Rate limits — current (5h) and weekly bars with reset times (Claude.ai OAuth only)
- Extra usage — credit spending vs monthly limit (Max plan with overage enabled)
| Zone | Range | Color |
|---|---|---|
| Smart | 0–39% | Green |
| Watch | 40–59% | Orange |
| Caution | 60–79% | Yellow |
| Dumb | 80–100% | Red |
bash(macOS or Linux)jq— JSON parsing (brew install jq/apt install jq)curl— for rate limit and plan data (optional)- Claude Code CLI
Rate limits and plan detection fetch from the Anthropic OAuth usage API. They appear automatically if you're logged in via Claude.ai OAuth. No API key needed.
Data is cached for 60 seconds in /tmp/claude/ctxstat-cache.json.
Works with any Claude Code session. Context window size comes directly from Claude Code's reported value — accurate across Sonnet, Opus, Haiku, Fable, and future models.
Colors, thresholds, and zone names are defined in statusline.sh:
zone_color()— ANSI color by zone namezone_name()— returns Smart / Watch / Caution / Dumbsession_cost()— per-model pricing for cost estimate- Bar width:
bw=8in the rate limits section
MIT
