Feature: Context window usage indicator with threshold alerts
Feature Request
Problem
There's no visibility into how much of the context window has been consumed during a Claude Code session. Sessions silently degrade as context fills up — auto-compression kicks in reactively at the limit, but by then you've often lost important reference material. Users have no way to proactively manage session lifecycle.
OpenAI's Codex provides a live token count during chat, which makes it easy to gauge when to wrap up or start fresh. Claude Code has nothing equivalent.
Proposed Solution
1. Live context usage indicator in the status line
- Show current token usage as a percentage or fraction (e.g.,
Context: 47% (94K/200K)) - Always visible, updates after each message exchange
2. Threshold alerts at configurable checkpoints
- At 50%: Subtle notification — "Context at 50%. Consider whether remaining work fits this session."
- At 75%: Moderate notification — "Context at 75%. Good time to commit progress and evaluate session scope."
- At 90%: Strong notification — "Context at 90%. Recommend closing session and creating a handoff."
- Thresholds should be configurable in settings (e.g.,
contextAlerts: [50, 75, 90])
3. /context command
- Show current usage breakdown: system prompt, conversation history, tool results, cached content
- Estimate remaining capacity in practical terms (e.g., "~50K tokens remaining — roughly 3-4 more tool-heavy exchanges")
Why This Matters
- Prevents wasted work: When context silently compresses, the model loses file contents and earlier decisions. A proactive indicator lets users commit and hand off before degradation.
- Cost awareness: Heavy sessions burn through tokens. Visibility helps users make informed decisions about when to start fresh vs. continue.
- Session planning: Complex multi-file tasks benefit from knowing upfront whether they'll fit in one session or need to be split.
Prior Art
- OpenAI Codex: Live token count visible during chat — simple and effective
- ChatGPT: Shows "memory full" indicator when context is saturated
- Cursor: Shows token usage in status bar
Implementation Notes
The data already exists internally — Claude Code tracks token usage for billing and knows when to trigger auto-compression. This is primarily a UI/UX feature to surface existing information.
Minimal version: just add Context: X% to the status line. That alone would be transformative.
---
Filed from a real session where ~180K tokens of context (20+ file reads, agent explorations, 1100-line file creation, multi-step debugging) accumulated without any visibility until the user asked "what does the context window look like?"
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗