[BUG] Edit tool not blocked during plan mode — file modifications succeed when they should be rejected
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
During an active plan mode session, the Edit tool successfully modified a source file (src/app.jsx). Plan mode instructions explicitly state edits are forbidden except to the plan file, but the Edit tool executed without rejection.
What Should Happen?
During an active plan mode session, the Edit tool successfully modified a source file (src/app.jsx). Plan mode instructions explicitly
state edits are forbidden except to the plan file, but the Edit tool executed without rejection.
Expected: Edit tool should reject the modification with an error, similar to how ExitPlanMode was rejected when the user declined
Actual: The edit was applied to the source file
Session context: Claude Opus 4.6 (1M context), CLI session, macOS
Error Messages/Logs
Steps to Reproduce
Steps to reproduce:
- Enter plan mode via /update-help or EnterPlanMode
- While plan mode is active, use the Edit tool to modify a non-plan file
- The edit succeeds instead of being blocked
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.83
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
7 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Update / Cross-reference: This appears to be the same regression reported in detail in #39713.
Root cause identified:
The bypass became prominent and consistent after two specific CLI prompt changes:
<system-reminder>(the same low-priority bucket used by Plan Mode).Result:
Plan Mode is still only a low-priority system-reminder. The model now gives higher salience to tool/workflow instructions and executes writes, builds, git commits, API mutations, etc. immediately — exactly as described here and in #39713.
It worked correctly (or the issue was minimal/non-existent) in 2.1.81 and earlier.
Suggested fix (same as in #39713):
Enforce Plan Mode at the tool permission layer (hard block on
Edit,Write,Bashwith non-read-only commands, etc.) instead of relying only on a system-reminder.This is a regression, not the original design.
<img width="1235" height="1110" alt="Image" src="https://github.com/user-attachments/assets/0c656188-761e-4a51-bbef-99ae84321586" />
Same root cause as #38255. Until plan mode gets native enforcement, a PreToolUse hook can catch this:
Toggle with
touch ~/.claude/plan-mode-active/rm ~/.claude/plan-mode-active.Install:
npx cc-safe-setup --install-example plan-mode-edit-guardClosing for now — inactive for too long. Please open a new issue if this is still relevant.
Try turning off
Use auto mode during planhttps://github.com/anthropics/claude-code/issues/38255#issuecomment-4463782751This 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.