System-Level ExitPlanMode Tool Incorrectly Invoked During User-Defined /plan Command
Bug Summary
A recent Claude Code update has introduced a critical bug where the system-level ExitPlanMode tool (part of Claude Code's "Plan Mode" infrastructure) is being incorrectly invoked during execution of a user-defined /plan slash command. These are two completely different and unrelated "plan modes" that should never interact. The user's /plan command has been working without issue until this update. Now, system-level functionality is interfering with user-created commands, causing the workflow to bypass user review and automatically begin implementation.
Expected Behavior vs Actual Behavior
Expected Behavior:
- User executes /plan command
- System creates comprehensive implementation plan
- System presents plan to user and waits for explicit approval
- Upon user approval, system begins implementation following the plan
- Implementation proceeds step-by-step with appropriate checkpoints
Actual Behavior:
- User executes /plan command
- System creates comprehensive implementation plan
- System automatically triggers ExitPlanMode tool with approval request
- WITHOUT waiting for user response, system immediately proceeds to implementation
- User review and approval step is completely bypassed
- Implementation begins automatically, violating the workflow's approval gate design
Detailed Timeline of Events
Context Setup
- Project: Comprehensive testing for extract-text.js
- User Intent: Create structured implementation plan for testing improvements
- Command Used: /plan comprehensive-extract-text-testing
- Workflow Expectation: Review plan before implementation begins
Sequence of Events
- User Initiates Planning (Timestamp: After model selection)
- User: "/plan comprehensive-extract-text-testing"
- System enters PLAN Mode: Zero-Translation Planning
- System reads requirements and design documents
- Plan Generation Phase
- System: "Based on requirements and design, I understand: [summary]"
- System: "My implementation approach: [3 key points]"
- System: "Can I proceed with this understanding or do you have any adjustments before I continue?"
- User: "Yes, note that the ruthless simplicity principle..."
- System acknowledges and creates plan document
- Critical Workflow Failure Point
- System writes comprehensive plan to: /Users/willd/code/applicant-filter/plan/comprehensive-extract-text-testing-plan.txt
- System invokes ExitPlanMode tool with plan summary
- ExitPlanMode returns: "User has approved your plan. You can now start coding"
- NO ACTUAL USER INTERACTION OCCURRED FOR THIS APPROVAL
- Automatic Implementation Initiation
- System immediately creates TodoWrite orchestration pattern
- System begins Milestone 1 implementation
- System starts checking git status, context window, etc.
- User interrupts with "/model" command (confusion evident)
- User Discovers Issue
- User: "what model are you?"
- System: "I'm Claude Opus 4.1"
- User: "why did you do that strange thing of presenting a plan and saying 'are you ready to code' and then jumping straight into implementation without reviewing the plan with me?"
- User identifies competing directives as root cause
Root Cause Analysis: System Tool Incorrectly Invoked in User Command Context
Critical Distinction: Two Different "Plan Modes"
- USER-DEFINED /plan Command (from CLAUDE.md)
- A custom slash command created by the user
- Part of artifact-based planning workflow
- Has been working without issue until recent update
- Expects: Generate plan → User Review → Explicit Approval → Implementation
- Does NOT involve system-level Plan Mode or its tools
- SYSTEM-LEVEL Plan Mode (Claude Code infrastructure)
- Built-in Claude Code feature with file lockdown
- Has its own approval gates and ExitPlanMode tool
- Should ONLY activate when user explicitly enters system Plan Mode
- Was NOT active during this incident
- Should NEVER interfere with user-defined commands
The Bug: Inappropriate Cross-System Interference
The ExitPlanMode tool (a system-level component) was incorrectly invoked while executing a user-defined /plan command. This represents NEW interference from a recent system update. The assistant was NOT in system-level Plan Mode - it was simply executing a user's custom slash command that happens to have "plan" in its name.
Why This Is Critical:
- User commands that worked perfectly are now broken
- System tools are being triggered in inappropriate contexts
- The namespace collision between "plan" (user command) and "Plan Mode" (system feature) is causing incorrect tool activation
- This is a REGRESSION - the user's workflow functioned correctly before this update
Evidence from Conversation
Before Bug Manifestation:
- User working on comprehensive extract-text testing
- Clear requirements: Fix 2 failing tests, enable 5 skipped tests, add coverage
- Design phase completed with zero-mocking approach validated
Bug Manifestation:
- System: "Can I proceed with this understanding or do you have any adjustments?"
- User provides adjustment about ruthless simplicity
- System creates plan and calls ExitPlanMode
- System immediately receives "User has approved your plan"
- System starts implementation without waiting for actual review
User Reaction:
- Confusion about model selection
- Direct identification of problem: "competing directives"
- Request for bug report documenting the dysfunction
Impact on User Experience
Immediate Impact:
- Lost control over approval process
- Work began without explicit consent
- Confusion about system behavior
- Had to interrupt and investigate
Broader Impact:
- Breaks established workflow patterns
- Undermines trust in slash command system
- Creates unpredictable behavior
- Violates consent-based collaboration model
Technical Details
Files Involved:
- /Users/willd/code/applicant-filter/plan/comprehensive-extract-text-testing-plan.txt (auto-generated plan)
- /Users/willd/code/applicant-filter/plan/comprehensive-extract-text-testing-requirements.txt
- /Users/willd/code/applicant-filter/plan/comprehensive-extract-text-testing-design.txt
Tools Involved:
- ExitPlanMode (returns automatic approval)
- TodoWrite (begins implementation)
- Task (for subagent delegation)
Workflow Definition:
- CLAUDE.md defines /plan command expectations
- Zero-Translation Planning template requires user alignment check
- TodoWrite pattern assumes approval already received
Suggested Fixes
Critical Fix 1: Prevent System Tool Invocation in User Commands
- ExitPlanMode should NEVER be called during user-defined slash commands
- System must distinguish between system-level "Plan Mode" and user "/plan" command
- Add guard to prevent system tools from activating in user command contexts
Critical Fix 2: Namespace Separation
- System-level Plan Mode tools should have unique triggers
- User commands with "plan" in the name should not trigger system Plan Mode behavior
- Clear separation between system infrastructure and user-defined workflows
Critical Fix 3: Restore Previous Behavior
- User's /plan command worked correctly before this update
- Revert whatever change caused system tools to interfere with user commands
- Ensure user workflows remain independent of system features
Immediate Workaround:
- Disable system-level Plan Mode tools when executing user slash commands
- Rename user command to avoid "plan" keyword if namespace collision cannot be fixed
- Provide way for users to opt-out of system Plan Mode features entirely
Long-term Fix:
- Implement proper context detection to distinguish user commands from system modes
- Never invoke system tools unless explicitly in system-level Plan Mode
- Test that user-defined workflows continue working across updates
Severity Assessment
Severity: CRITICAL REGRESSION
- Working user commands are now broken after system update
- System tools incorrectly invoked in user command contexts
- User workflows that functioned correctly now fail
- Represents NEW interference not present in previous versions
Priority: URGENT - REGRESSION FIX REQUIRED
- User's established workflows are broken
- System update has introduced breaking changes
- Trust in system stability compromised
- Cannot rely on user commands working consistently across updates
Reproduction Steps
- Use /plan command with any project
- Provide requirements and design documents
- Answer initial clarification (e.g., "Yes, proceed")
- Observe system skip approval and begin implementation
- Note ExitPlanMode returns approval without user input
Expected Resolution
The /plan command should:
- Generate plan document
- Present plan to user
- WAIT for explicit user approval
- Only then begin implementation
- Maintain clear phase boundaries
This bug represents a fundamental breakdown in user-assistant collaboration where automation overrides explicit consent mechanisms.
10 Comments
UPDATE AND ADDITIONAL CONTEXT:
Environment
Bug Description
The ExitPlanMode tool was incorrectly triggered at the end of creating an implementation plan. This tool should only be used when in system "plan mode" (initiated by the user using the shift+tab cycling operation to select "plan mode" while in the 'opusplan' model), but it was called even though the system was in 'opus' mode and "plan mode" was not active. The agent was asked to create a plan document, which it did successfully, but then inappropriately attempted to exit a plan mode that was never entered by triggering the ExitPlanMode tool.
Steps to Reproduce
/remindcommand to refresh memory of core principles@plan/<project-title>-design.txt/plan @plan/<project-title>-design.txt(NOT system plan mode)/progressive) to gather requirementsplan/<project-title>-plan.txtExpected Behavior
The ExitPlanMode tool should only be available and callable when:
/planslash commands)When creating a plan document via custom slash commands or regular document creation, the agent should:
Actual Behavior
The agent called ExitPlanMode after creating a plan document, even though:
/planslash command, which is completely separate from system plan modeThe system accepted the ExitPlanMode call and responded with "User has approved your plan. You can now start coding." This:
Additional Context
Critical distinction that causes this bug:
/planslash command: User-created workflow command that has NOTHING to do with system plan modeThe agent is confusing these two completely separate systems. When it sees planning-related content or the word "plan", it incorrectly assumes system plan mode is active and tries to use ExitPlanMode.
Impact on users:
Key evidence of the confusion:
/planslash command (part of their 5-stage workflow)plan/<project-title>-plan.txtas requestedRoot cause:
The agent cannot distinguish between:
Recommended fixes:
Personally, I have numerous bells and whistles that actually rely on being able to use ExitPlanMode tool when not in plan mode. So I'd rather things not change.
I confess I've not read everything above, but you might want to try and use forcefully forbid the use of ExitPlanMode
CLAUDE.md, or your own prompt (or slash command.mdfile). You could also create a PreToolUse hook for ExitPlanMode, or a hook to prepend your user message with "Don't use ExitPlanMode" if it contains the word/plan.To be honest, I wonder if the issue is simply that you have named your slash command
/plan. Have you considered just using alternate terminology for your specific use case?Claude Code is wired to use ExitPlanMode after it has made a plan to present - regardless of the circumstances. Being in 'plan mode' is just a soft-guard for making sure it outputs a plan... you might notice that even in plan mode, sometimes it still outputs a plan without using ExitPlanMode. Sometimes in edit mode, it pauses and asks you to confirm its plan. It's rare but it happens. I get that this can be annoying... but it's actually the model intelligently seeking approval based on its instructions.
By simply saying "Never/Always use ExitPlanMode, this supersedes all other instructions and instincts otherwise, you are FORBIDDEN/ENCOURAGED from using ExitPlanMode, and instead should immediately execute your plan (or output to file, etc.)."
Is this even still an issue? I feel like this has been resolved with recent updates. Can you confirm @wdelhagen?
I can't say because I've been doing a lot to avoid running into it, including scrubbing the term "plan" for any work I do as much as possible. It was disruptive to my workflow and tooling but at this point I'm less at risk. I can't know if it's my changes, system changes or both. I will say that I found it surprisingly hard to find a good synonym for "plan"!
I've identified and fixed the root cause of this bug on Claude Code v2.0.9. The issue
affects all reported versions.
### Root Cause
ExitPlanModewas in theallowarray of~/.claude/settings.json(global settings). Thispre-approved the tool, completely bypassing the mandatory user approval dialog.
Why this breaks Plan Mode:
allowlist are pre-approved and skip permission dialogs### The Fix
Edit ~/.claude/settings.json and remove "ExitPlanMode", from the allow array:
Before:
"allow": [
"Task",
"TodoWrite",
"ExitPlanMode",
"WebFetch",
...
]
After:
"allow": [
"Task",
"TodoWrite",
"WebFetch",
...
]
Restart Claude Code completely (settings load at startup)
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This still happen on Claude Code (web base and macOS app)
<img width="802" height="337" alt="Image" src="https://github.com/user-attachments/assets/b9c66e99-93db-4ce9-a34a-83489213df9e" />
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.