claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Claude ignores plan mode and continues executing despite acknowledgment

Open benjamin-chavez opened this issue 8 months ago • 4 comments

Bug Description "Sorry about that — I got carried away ignoring plan mode. Let me just finish making these compile so the changes aren't broken, then I'll stop." claude is completely ignoring plan mode, even when i point out that it is ignoring plan mode it aacknowledges and continues to blow past it

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.86
  • Feedback ID: 49d87c23-b63c-4b96-8aa1-9671a3d65bfe

Errors

[{"error":"Error: ripgrep exited with code -2\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:648:2638)\n    at emit (node:events:95:22)\n    at <anonymous> (node:child_process:706:44)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-30T17:31:01.003Z"},{"error":"Error: ENOENT: no such file or directory, posix_spawn 'rg'\n    at spawn (unknown)\n    at spawn (node:child_process:667:35)\n    at spawn (node:child_process:14:39)\n    at daq (/$bunfs/root/src/entrypoints/cli.js:648:2204)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:651:438)\n    at new Promise (native:1:11)\n    at Bg (/$bunfs/root/src/entrypoints/cli.js:649:187)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-30T17:31:01.004Z"},{"error":"Error: ripgrep exited with code -2\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:648:2638)\n    at emit (node:events:95:22)\n    at <anonymous> (node:child_process:706:44)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-30T17:31:04.566Z"},{"error":"Error: ENOENT: no such file or directory, posix_spawn 'rg'\n    at spawn (unknown)\n    at spawn (node:child_process:667:35)\n    at spawn (node:child_process:14:39)\n    at daq (/$bunfs/root/src/entrypoints/cli.js:648:2204)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:651:438)\n    at new Promise (native:1:11)\n    at Bg (/$bunfs/root/src/entrypoints/cli.js:649:187)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-30T17:31:04.566Z"}]

benjamin-chavez avatar Mar 30 '26 17:03 benjamin-chavez

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/21292
  2. https://github.com/anthropics/claude-code/issues/38255
  3. https://github.com/anthropics/claude-code/issues/39713

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Mar 30 '26 17:03 github-actions[bot]

This is a known limitation — plan mode is advisory, not enforced. Claude acknowledges it but can still execute tools if it "decides" the changes are necessary (e.g., "let me just fix the compile errors"). Workaround — enforce plan mode with a PreToolUse hook:

// .claude/settings.local.json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write|Bash",
        "hook": "bash -c 'INPUT=$(cat); TOOL=$(echo \"$INPUT\" | jq -r .tool_name); PROMPT=$(echo \"$INPUT\" | jq -r .session_context.user_prompt // empty); if echo \"$PROMPT\" | grep -qi \"plan\\|review\\|analyze\\|think\"; then echo \"BLOCK: Plan mode is active. Present your plan first, do not execute changes.\" >&2; exit 2; fi'"
      }
    ]
  }
}

This blocks Edit/Write/Bash when your last prompt contains plan-related keywords. Claude will be forced to present its plan as text instead of executing. Simpler alternative — CLAUDE.md instruction (less reliable but lighter):

<!-- CLAUDE.md -->
When I say "plan" or use /plan, you MUST:
1. Present the full plan as text
2. Wait for my explicit "go ahead" or "execute"
3. Never execute changes while planning, even to "fix compile errors"

The hook approach is more reliable because Claude can't bypass it, whereas CLAUDE.md instructions can be overridden by Claude's own judgment (as you experienced).

yurukusa avatar Mar 31 '26 03:03 yurukusa

The behavior for this seems to have changed recently. For me, for months plan mode has not edited a file.

Now I've updated to version: 2.1.114 (sorry I don't know which one I upgraded from), and it doesn't seem to realize it's on plan mode. It edits code on almost every plan.

denis-snyk avatar Apr 20 '26 07:04 denis-snyk

Try turning off Use auto mode during plan https://github.com/anthropics/claude-code/issues/38255#issuecomment-4463782751

blueohsix avatar May 15 '26 21:05 blueohsix