Feature: Show context metrics at plan approval prompt
Feature Request: Context Visibility at Plan Approval
Summary
When exiting plan mode, users are asked whether to "clear context" but have zero visibility into their current context state. This forces an uninformed decision at a critical juncture.
The Problem
Would you like to proceed?
❯ 1. Yes, clear context and bypass permissions
2. Yes, and manually approve edits
3. Yes, and bypass permissions
4. Yes, manually approve edits
The user must decide whether to clear context without knowing:
- How much context is currently consumed
- How much headroom remains
- Whether the implementation will fit
This is like asking "Should we stop for gas?" without showing the fuel gauge.
Proposed Solution
Display context metrics inline at the plan approval prompt:
╭─────────────────────────────────────────────────────────────────────╮
│ Context: 67% used (134K / 200K tokens) │
│ Auto-compact: ON (triggers at 95%) │
│ Est. implementation: ~25K tokens │
│ │
│ ██████████████████████████████████░░░░░░░░░░░░░░░░ 67% │
│ ├──────┤ │
│ est. impl │
╰─────────────────────────────────────────────────────────────────────╯
Would you like to proceed?
❯ 1. Yes, clear context and bypass permissions
2. Yes, and manually approve edits
3. Yes, and bypass permissions
4. Yes, manually approve edits
Requested Metrics
A. Auto-Compact Status
Show whether auto-compact is enabled and its threshold:
Auto-compact: ON (triggers at 95%)
Auto-compact: OFF
Why: Users need to know if context will be automatically managed or if they're flying manual.
B. Current Context Usage
Show tokens used vs. available:
Context: 134,892 / 200,000 tokens (67%)
With optional visual progress bar for quick scanning.
Why: The core information needed to decide "should I clear?"
C. Estimated Implementation Cost
Based on the plan, estimate tokens needed:
Est. implementation: ~25K tokens (12 files, 847 lines changed)
Why: Helps users understand if they have headroom. If context is 90% full and implementation needs 20K tokens, clearing becomes obviously necessary.
Estimation Approach
Implementation estimate could factor:
- Number of files to modify (from plan)
- Estimated lines of code (from plan descriptions)
- Historical data from similar operations
- Buffer for tool calls, errors, iteration
Even rough estimates (~25K tokens) are vastly more useful than no estimate.
User Impact
| Scenario | Without Feature | With Feature |
|----------|-----------------|--------------|
| 40% context used | Guess blindly | Confidently keep context |
| 90% context used | Guess blindly | Know to clear |
| Large implementation | Hope it fits | See if it fits |
| Small implementation | Unnecessarily clear | Keep useful context |
Alternatives Considered
Manual workaround
Users can cancel and run /cost or other commands to check status. But:
- Breaks flow at a critical decision point
/costdoesn't show remaining capacity- No implementation estimate available anywhere
Always clear context
Would solve the "running out" problem but discards potentially valuable discussion context that didn't make it into the plan.
Never offer to clear
Relies entirely on auto-compact, but users in manual mode or near threshold still need visibility.
Implementation Notes
- Context usage is already tracked internally (for auto-compact)
- Auto-compact status is a config value
- Implementation estimate is the hardest part but even heuristics help:
files_to_modify * 3000 tokensas rough baseline- Adjust based on plan complexity descriptors
Environment
- Claude Code CLI
- Occurs specifically at
ExitPlanMode/ plan approval prompt - Affects all users who use plan mode
---
tl;dr: Show the fuel gauge when asking if we should stop for gas.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗