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.
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗