claude-code - 💡(How to fix) Fix [Bug] Mode switch signals mislabeled and missing in system reminders to Claude [3 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#52271Fetched 2026-04-24 06:11:35
View on GitHub
Comments
3
Participants
3
Timeline
8
Reactions
0
Author
Timeline (top)
labeled ×5commented ×3

When switching modes via Shift+Tab in the Claude Code terminal, the mode shown in the user's UI consistently does not match the mode reflected in the system reminders delivered to Claude. As a result, Claude operates under mode rules that differ from the user's actual intent, leading to incidents such as unauthorized edits and out-of-scope execution.

Root Cause

When switching modes via Shift+Tab in the Claude Code terminal, the mode shown in the user's UI consistently does not match the mode reflected in the system reminders delivered to Claude. As a result, Claude operates under mode rules that differ from the user's actual intent, leading to incidents such as unauthorized edits and out-of-scope execution.

RAW_BUFFERClick to expand / collapse

Bug Report — Claude Code Mode Switching Signal Mismatch

Title

Claude Code's Plan/Accept mode switches are not correctly relayed to Claude (missing signals and mislabeling)

Summary

When switching modes via Shift+Tab in the Claude Code terminal, the mode shown in the user's UI consistently does not match the mode reflected in the system reminders delivered to Claude. As a result, Claude operates under mode rules that differ from the user's actual intent, leading to incidents such as unauthorized edits and out-of-scope execution.

Environment

  • OS: Windows 10 Pro (10.0.19045)
  • Shell: Windows PowerShell 5.1
  • Claude model: Opus 4.7 (1M context), model ID claude-opus-4-7[1m]
  • Claude Code: CLI (terminal)
  • Session scope: reproduced within a single continuous session

Reproduction Steps

  1. In a Claude Code terminal session, cycle modes by pressing Shift+Tab repeatedly (Default → Auto → Plan → Accept Edits, etc.)
  2. After each switch, ask Claude: "What mode are we in now?"
  3. Compare the system reminder Claude received with the mode actually shown in the terminal's mode indicator.

Expected Behavior

When the user changes modes via Shift+Tab, the next user-message turn should include a system reminder to Claude that accurately reflects the new mode:

  • PlanPlan mode is active
  • Accept EditsAccept Edits Active (or equivalent)
  • AutoAuto Mode Active
  • Default → appropriate Exited ... signals

Actual Behavior (Two Bugs)

Bug 1: Plan-mode switch is mislabeled as Auto Mode Active

  • Reproduction: 3 of 4 Plan-switch attempts in one session (2 mislabel, 1 missing)
  • Impact: Claude interprets itself as being in an "execution" mode, violates the edit-forbidden rule of Plan mode, and proceeds with code modifications → unauthorized, out-of-scope edits

Bug 2: Accept Edits mode switch is not delivered to Claude at all

  • Reproduction: 4 of 4 Accept transitions in one session (100% missing)
  • Trigger cases: direct Shift+Tab to Accept, as well as automatic return to Accept after ExitPlanMode approval — both fail identically
  • Impact: Claude never receives an Accept signal and misclassifies the state as "Default." The user's UI shows Accept while Claude thinks otherwise, breaking state synchronization

Collected Reproduction Data

#User UI actionReminder delivered to ClaudeOutcome
1Switch to Plan## Auto Mode ActivePlan→Auto mislabel
2Set Accept(no signal)Missing
3Switch to Plan (Shift+Tab ×2)(none) → Auto arrives next turnDelay + mislabel
4Switch to Plan (Shift+Tab ×2)Plan + Auto simultaneously activeContradictory reminders
5Plan → DefaultExited Plan Mode + Exited Auto ModeCorrect
6Default → Accept(no signal)Missing
7Accept → Plan## Auto Mode ActivePlan→Auto mislabel
8Stay in Plan, workingPlan reminder redeliveredCorrect
9ExitPlanMode → auto-return to AcceptExited Plan + Exited AutoAccept signal missing
10Switch to Plan## Auto Mode ActivePlan→Auto mislabel
11ExitPlanMode → auto-return to AcceptExited Plan + Exited AutoAccept signal missing

Reproduction Rate Summary

ModeAttemptsCorrectMislabeled / MissingFailure Rate
Plan403 mislabeled as Auto / 1 contradictory100%
Accept404 fully missing100%
Default11OK
Auto(multiple)CorrectOK

Severity / Impact

  • Severity: High
  • Unauthorized file edits can (and did in this session) occur — Plan mode was misread as Auto and edits proceeded
  • UX breakdown: the user must constantly ask "what mode are we in?" to confirm state
  • The "edits forbidden" safety guarantee of Plan mode is effectively nullified

Suggested Fixes (Priority Order)

  1. Deliver exclusively the Plan mode is active reminder on Plan transitions — never combine or replace with Auto Mode Active
  2. Emit an Accept Edits Active (or equivalent) reminder to the Claude API on Accept transitions — currently the mode appears only in the client UI and is never propagated
  3. Ensure system reminders represent a single, unambiguous mode state — disallow simultaneous delivery of Plan mode is active and Auto Mode Active

Additional Notes

  • Full session logs (conversation JSONL / system-reminder stream) can be found under the user's ~/.claude/projects/<project>/ directory if deeper analysis is needed
  • Data was collected in a real user session by intentionally cycling modes for QA purposes

This report was drafted with Claude's assistance during the affected session.

extent analysis

TL;DR

The most likely fix involves modifying the system reminders to accurately reflect the current mode, ensuring that Plan mode is active and Accept Edits Active reminders are delivered correctly and exclusively for their respective modes.

Guidance

  • Review the mode switching logic to prevent mislabeling of Plan mode as Auto Mode Active.
  • Implement a mechanism to deliver an Accept Edits Active reminder to the Claude API on Accept transitions.
  • Ensure that system reminders represent a single, unambiguous mode state, preventing simultaneous delivery of contradictory reminders.

Example

No code snippet is provided due to the lack of specific implementation details in the issue report.

Notes

The provided reproduction steps and data suggest a reliable method for reproducing the issue, which should aid in testing and verifying any proposed fixes.

Recommendation

Apply the suggested fixes in the priority order provided, starting with ensuring exclusive delivery of the Plan mode is active reminder on Plan transitions, followed by implementing the Accept Edits Active reminder for Accept transitions, and finally ensuring unambiguous mode state representation in system reminders. This approach directly addresses the identified bugs and their impacts.

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