[FEATURE] Add configurable context usage warning threshold
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Problem Statement
When working in long Claude Code sessions, there's no proactive warning when context usage is getting high. Users only discover they're running low on context when Claude starts losing track of earlier conversation, autocompact kicks in unexpectedly, or they manually run /context.
Proposed Solution
Proposed Solution
Add a configurable warning threshold (e.g., 60%, 70%, 80%) that triggers an inline notification when context usage crosses that level. Something like:
⚠️ Context usage at 72% (144k/200k tokens). Consider using /compact or starting a fresh session.
Configuration
Could be a setting like:
"contextWarningThreshold": 70
Why This Matters
Heavy users doing iterative development work (debugging, building features across multiple files) often don't realize context is filling up until quality degrades. A simple warning would let users make informed decisions about when to compact or restart.
Alternative Solutions
- Status line config
Check if you can enable persistent token display in Claude Code settings. That way it's always visible — you'd just glance at it like a battery meter. Less intrusive than a popup warning.
- CLAUDE.md periodic check rule
Add something like:
After substantial work (every 5-10 exchanges or after completing a task), run /context silently and warn me if usage exceeds 60%.
Not bulletproof, but Claude Code will at least be prompted to check.
- Preprocessing hook (DIY)
Claude Code supports hooks that run before each message. You could write a small script that checks usage and injects a warning. More effort, but fully automatic. Would require some Node.js scripting.
- Terminal alias / wrapper
Create a simple alias or script that runs /context and parses the output, then alerts you. You'd run it manually but it'd be one keystroke.
- ccusage in a split terminal
Run npx ccusage@latest in a side pane with auto-refresh. Not integrated, but gives you a dashboard view while you work.
- Just start fresh more often
Honestly, the lowest-tech solution: make it a habit to start new sessions per feature/task instead of marathon sessions. Sidesteps the problem entirely.
Priority
Medium - Would be very helpful
Feature Category
Interactive mode (TUI)
Use Case Example
I'm working on a new module for my family management app (Node.js/Express/EJS/SQLite stack). A typical session looks like:
Discussing the feature requirements and approach
Having Claude generate complete file replacements (I work with full files, not snippets)
Testing, finding a CSS issue (often iOS Safari layout bugs)
Going back and forth debugging — "it's still showing a gap below the tab bar," "try this," "nope still there"
Iterating on the visual design — "actually let's change the color palette," "can we add a swipe gesture here"
An hour or two in, Claude starts losing the thread — forgetting which file we're working on, re-suggesting fixes we already tried, or ignoring constraints from earlier. I run /context and realize I'm at 80%+.
A warning at 60-70% would let me:
Finish the current task at a clean stopping point
Summarize what we've done before starting fresh
Avoid the frustrating "wait, we already tried that" loops when context degrades
Additional Context
Autocompact buffer creates a false sense of space — The 200k context shows ~45k reserved for autocompact, so usable space is really ~155k. By the time you're at "60%" displayed, you're actually closer to the edge than it appears.
The infrastructure already exists — /context already calculates and displays usage. This feature would just trigger that check automatically at a threshold instead of requiring manual invocation.
Paying Max users are likely the heaviest session users — People on $100-200/month plans are probably doing exactly the kind of long, iterative dev work where this matters most.
Common UX pattern — This is how disk space warnings, battery alerts, and API rate limit dashboards all work. Warn before the cliff, not after you've fallen off.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗