System-Level ExitPlanMode Tool Incorrectly Invoked During User-Defined /plan Command

Status Closed — not planned
Maintainer reply None cached
Activity 10 comments · opened Aug 19, 2025 · closed Jan 19, 2026

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:

  1. User executes /plan command
  2. System creates comprehensive implementation plan
  3. System presents plan to user and waits for explicit approval
  4. Upon user approval, system begins implementation following the plan
  5. Implementation proceeds step-by-step with appropriate checkpoints

Actual Behavior:

  1. User executes /plan command
  2. System creates comprehensive implementation plan
  3. System automatically triggers ExitPlanMode tool with approval request
  4. WITHOUT waiting for user response, system immediately proceeds to implementation
  5. User review and approval step is completely bypassed
  6. 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

  1. 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
  1. 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
  1. 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
  1. 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)
  1. 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"

  1. 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
  1. 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:

  1. System: "Can I proceed with this understanding or do you have any adjustments?"
  2. User provides adjustment about ruthless simplicity
  3. System creates plan and calls ExitPlanMode
  4. System immediately receives "User has approved your plan"
  5. 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

  1. Use /plan command with any project
  2. Provide requirements and design documents
  3. Answer initial clarification (e.g., "Yes, proceed")
  4. Observe system skip approval and begin implementation
  5. Note ExitPlanMode returns approval without user input

Expected Resolution

The /plan command should:

  1. Generate plan document
  2. Present plan to user
  3. WAIT for explicit user approval
  4. Only then begin implementation
  5. Maintain clear phase boundaries

This bug represents a fundamental breakdown in user-assistant collaboration where automation overrides explicit consent mechanisms.

View original on GitHub ↗

10 Comments

wdelhagen · 1 year ago

UPDATE AND ADDITIONAL CONTEXT:

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.85 (Claude Code)
  • Operating System: macOS 14.6.1
  • Terminal: iTerm2

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

  1. User runs /remind command to refresh memory of core principles
  2. User provides a design document reference: @plan/<project-title>-design.txt
  3. User invokes CUSTOM slash command /plan @plan/<project-title>-design.txt (NOT system plan mode)
  4. Agent uses progressive interviewing (/progressive) to gather requirements
  5. Agent creates the implementation plan document successfully at plan/<project-title>-plan.txt
  6. Agent inappropriately calls ExitPlanMode tool despite never being in system plan mode
  7. System responds with "User has approved your plan. You can now start coding."
  8. This corrupts the context window and interrupts workflow

Expected Behavior

The ExitPlanMode tool should only be available and callable when:

  1. The user has explicitly selected the 'opusplan' model as the active model
  2. The user has explicitly entered SYSTEM plan mode via shift+tab cycling
  3. The system is actively in plan mode (NOT when using custom /plan slash commands)

When creating a plan document via custom slash commands or regular document creation, the agent should:

  1. Create the plan document
  2. Inform the user it's complete
  3. NEVER call ExitPlanMode since system plan mode was never entered

Actual Behavior

The agent called ExitPlanMode after creating a plan document, even though:

  1. The system was in regular 'opus' mode, NOT 'opusplan' mode
  2. System plan mode was never activated via shift+tab
  3. The user was using a CUSTOM /plan slash command, which is completely separate from system plan mode
  4. The task was to create a plan document via custom workflow, not system plan mode

The system accepted the ExitPlanMode call and responded with "User has approved your plan. You can now start coding." This:

  • Corrupted the context window with inappropriate system messages
  • Interrupted the established custom workflow
  • Created confusion about whether the user had actually approved something
  • Injected system plan mode artifacts into a non-plan-mode conversation

Additional Context

Critical distinction that causes this bug:

  1. SYSTEM plan mode: Activated via shift+tab to select 'opusplan' model - this is when ExitPlanMode should be used
  2. CUSTOM /plan slash command: User-created workflow command that has NOTHING to do with system plan mode

The 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:

  • This bug has occurred multiple times
  • Each occurrence corrupts the context window with system messages
  • Interrupts carefully designed custom workflows
  • Creates confusion about approval states
  • Forces users to add explicit warnings to their CLAUDE.md files banning ExitPlanMode

Key evidence of the confusion:

  • User invoked custom /plan slash command (part of their 5-stage workflow)
  • Agent created plan/<project-title>-plan.txt as requested
  • Agent then called ExitPlanMode (system tool for 'opusplan' mode)
  • System injected "User has approved your plan" message into non-plan-mode context

Root cause:
The agent cannot distinguish between:

  • Custom user workflows that happen to involve planning
  • System plan mode that requires ExitPlanMode

Recommended fixes:

  1. ExitPlanMode should ONLY be available when system is actually in 'opusplan' mode
  2. Better documentation/training for agents about the distinction between system modes and custom commands
  3. Consider renaming ExitPlanMode to ExitSystemPlanMode for clarity
  4. Add safeguards to prevent ExitPlanMode from being called outside of actual plan mode context
kierr · 1 year ago

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 .md file). 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.)."

d3layd · 1 year ago

Is this even still an issue? I feel like this has been resolved with recent updates. Can you confirm @wdelhagen?

wdelhagen · 1 year ago

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"!

jontaxproduction · 1 year ago

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

ExitPlanMode was in the allow array of ~/.claude/settings.json (global settings). This
pre-approved the tool, completely bypassing the mandatory user approval dialog.

Why this breaks Plan Mode:

  • Tools in the allow list are pre-approved and skip permission dialogs
  • ExitPlanMode MUST show a UI dialog by design (to display the plan for user review)
  • Pre-approval bypasses this critical safety feature
  • Tool returns "User has approved your plan" immediately without user interaction

### 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)

github-actions[bot] · 10 months ago

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.

quangthien27 · 10 months ago

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" />

github-actions[bot] · 8 months ago

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.

marcindulak · 8 months ago

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.

github-actions[bot] · 8 months ago

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.