Add "compact context" option when exiting plan mode + allow configuring default
Problem
The current default when exiting plan mode ("Yes, clear context and auto-accept edits") deletes all conversation history, assuming the plan document captures everything needed for execution.
In practice, plans are action-oriented ("1. Create component, 2. Add routes") not context-oriented. Implicit knowledge discovered during planning gets lost:
- File locations and patterns observed
- Design decisions and their rationale
- Constraints discovered during exploration
- Conventions in the existing codebase
This leads to worse implementations - Claude executes the plan but lacks the context that informed it.
Related issues: #18599, #18878
Proposed Solution
- Add a "compact context" option:
- Yes, compact context and auto-accept edits
- Yes, clear context and auto-accept edits (current)
- Yes, preserve full context
- Allow users to configure their preferred default in settings
Compacting provides the benefits of context reduction without discarding useful knowledge. The summary preserves decisions, patterns, and constraints while removing verbose tool outputs and exploration tangents.
This mirrors what experienced users already do manually: plan → compact → execute. The current "clear" option skips curation entirely.
Why compact is valuable
| Approach | Token reduction | Preserves context | Risk |
|----------|----------------|-------------------|------|
| Clear context | ✅ Maximum | ❌ None | High - loses implicit knowledge |
| Compact context | ✅ Significant | ✅ Curated summary | Low - proven workflow |
| Preserve full | ❌ None | ✅ Everything | Medium - stale context noise |
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗