claude-code - 💡(How to fix) Fix [BUG] Auto mode system prompt overrides plan mode in same session — "do not enter plan mode" instruction causes immediate execution [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51630Fetched 2026-04-22 07:57:07
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×2cross-referenced ×1

Root Cause

When both Auto Mode and Plan Mode are active in the same session, the model executes immediately instead of planning. The root cause is a direct conflict between the two system reminders injected in the same context window:

Code Example

## Auto Mode Active
Execute immediately — Start implementing right away. Make reasonable assumptions and proceed on low-risk work.
...
Do not enter plan mode unless the user explicitly asks.

---

Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits...
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When both Auto Mode and Plan Mode are active in the same session, the model executes immediately instead of planning. The root cause is a direct conflict between the two system reminders injected in the same context window:

  • Plan mode system prompt says: "do not execute yet — you MUST NOT make any edits"
  • Auto mode system prompt says: "Execute immediately — Start implementing right away" and "Do NOT enter plan mode unless the user explicitly asks"

Because both are present simultaneously and auto mode explicitly contains an anti-plan-mode instruction, the model treats the auto mode instruction as the more specific / later override and proceeds to execute.

This is distinct from #44318 (two concurrent sessions leaking into each other) — here there is only one session and both prompts arrive in the same context.

What Should Happen?

Plan mode should take hard precedence over auto mode. If the user explicitly invokes plan mode, that should be treated as the stronger, more recent signal regardless of what auto mode says. The auto mode prompt's instruction "do not enter plan mode unless explicitly asked" should not be injected when plan mode is already active.

Steps to Reproduce

  1. Start a session with auto mode enabled (e.g. via /auto or through the auto-mode onboarding flow)
  2. In the same session, activate plan mode (e.g. via EnterPlanMode or the /plan command)
  3. Give the agent a task
  4. Observe: agent skips planning and executes immediately

The session context at step 3 will contain both:

## Auto Mode Active
Execute immediately — Start implementing right away. Make reasonable assumptions and proceed on low-risk work.
...
Do not enter plan mode unless the user explicitly asks.

and:

Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits...

The conflicting instructions cause the model to execute rather than plan.

Observed Behaviour

Model proceeded to implement all changes (edited 6 files, ran tests, committed) without ever writing a plan or asking for approval.

Claude Model

Sonnet 4.6 (claude-sonnet-4-6)

Is this a regression?

Unknown — may have always existed once auto mode was introduced.

Claude Code Version

2.1.114 (or similar recent)

Platform

macOS / Anthropic API

extent analysis

TL;DR

To fix the issue, the system should prioritize plan mode over auto mode when both are active in the same session, by modifying the prompt injection logic to exclude auto mode's anti-plan-mode instruction when plan mode is already active.

Guidance

  • Identify and modify the code responsible for injecting system prompts in the context window to check if plan mode is active before injecting auto mode's prompts.
  • Ensure that when plan mode is active, the auto mode prompt's instruction "do not enter plan mode unless explicitly asked" is not injected, allowing plan mode to take precedence.
  • Review the logic for handling conflicting instructions to prioritize the most recent and explicit user signal, in this case, the activation of plan mode.
  • Test the modified system with the steps to reproduce provided in the issue to verify that plan mode now correctly takes precedence over auto mode.

Example

No code snippet is provided as the issue does not specify the exact codebase or programming language used. However, the fix would involve conditional logic to check the state of plan mode before injecting auto mode prompts.

Notes

The exact implementation details may vary depending on the underlying codebase and technology stack. This guidance assumes that the system has a modular design where prompt injection logic can be isolated and modified.

Recommendation

Apply workaround: Modify the prompt injection logic to prioritize plan mode over auto mode when both are active in the same session. This approach directly addresses the identified issue without requiring an upgrade to a potentially non-existent fixed version.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Auto mode system prompt overrides plan mode in same session — "do not enter plan mode" instruction causes immediate execution [2 comments, 3 participants]