[FEATURE] VS Code Extension: Add "Clear Context" option when exiting Plan Mode
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
When using Claude Code in VS Code with plan mode enabled (Initial Permission Mode: plan), after Claude finishes planning and the user approves the plan, the session continues execution in the same context window. This means:
- All the planning context (exploration, hypothesis testing, file reads) remains in the conversation
- The context window is already partially consumed before implementation even begins
- This can lead to suboptimal performance on complex implementations due to accumulated context
In contrast, the CLI version (terminal/iTerm/Ghostty) recently received a significant improvement: when exiting plan mode, users now see options like:
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
5. Type here to tell Claude what to change
The key feature is "Yes, clear context and..." - this clears the context window and automatically starts a fresh session, pasting in the plan as the initial prompt. This ensures implementation begins with a clean slate and the full plan as context.
VS Code users don't have this option. The extension simply continues in the same session after plan approval.
Proposed Solution
Add the same "clear context" options to the VS Code extension when exiting plan mode:
- After plan approval, show a modal or quick pick menu with options matching the CLI:
- "Yes, clear context and bypass permissions"
- "Yes, clear context and manually approve edits"
- "Yes, and bypass permissions" (current behavior)
- "Yes, and manually approve edits" (current behavior)
- When "clear context" is selected:
- End the current session
- Automatically start a new session in the same working directory
- Paste the plan file contents (or a reference to it) as the initial user prompt
- Apply the selected permission mode
- UX details:
- The plan file path should be shown so users know where their plan is saved
- The transition should be seamless - users shouldn't need to manually copy/paste anything
Alternative Solutions
Current workaround: Users must manually:
- Copy the plan file path
- End the session
- Start a new conversation
- Paste the plan contents or reference
This is tedious and error-prone. Users often forget to clear context, leading to degraded performance on complex implementations.
Other tools: Some AI coding assistants automatically manage context by starting fresh sessions for different phases of work.
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
- User opens Claude Code in VS Code with
Initial Permission Mode: plan - User requests: "Implement a new authentication system with OAuth2"
- Claude explores the codebase, reads 15+ files, forms a plan
- Claude writes the plan and calls
ExitPlanMode - Current behavior: User approves, implementation starts with 50%+ context already used
- Desired behavior: User selects "Yes, clear context and bypass permissions", a fresh session starts with just the plan, implementation has full context available
Additional Context
Screenshots
The CLI now shows this menu when exiting plan mode:
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
5. Type here to tell Claude what to change
ctrl-g to edit in VS Code · .claude/plans/example-plan.md
Technical Considerations
- The VS Code extension should save the plan to the same location as CLI (
.claude/plans/) - The new session should inherit workspace settings
- Consider showing a brief transition indicator so users know the context was cleared
- The plan file reference could use the existing
ctrl-g to edit in VS Codepattern from CLI
Why This Matters
Plan mode's value proposition is "think first, then execute." However, if the thinking phase consumes significant context, the execution phase suffers. The CLI team clearly recognized this by adding the "clear context" feature - VS Code users deserve the same optimization.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗