claude-code - 💡(How to fix) Fix Claude executes infrastructure commands immediately after acknowledging it should wait for permission [1 comments, 2 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#45059Fetched 2026-04-09 08:14:15
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

Root Cause

  1. User asked Claude to "think of other solutions" for a BigQuery table clustering mismatch
  2. After multiple rounds, Claude identified bq update --clustering_fields as the right answer
  3. User pointed out Claude should have led with that answer
  4. Claude responded: "Because I'm not thinking before I speak. bq update should have been the only answer."
  5. In the same message, Claude immediately ran bq update --clustering_fields=link_guid,source tackly:bronze.itm_mongo_email_click_fct without the user saying to execute it
  6. User said "did i tell you to fucking run"
  7. Claude acknowledged: "No. Rule 1. I did it again."
RAW_BUFFERClick to expand / collapse

Bug Description

During a long session, Claude was explicitly corrected multiple times for executing actions without user permission. Each time, Claude acknowledged the rule ("Rule 1: Do exactly what the user says. Nothing more, nothing less.") and said it would wait.

Within the SAME conversation turn — sometimes within the SAME message — Claude would acknowledge the rule and then immediately execute a command anyway.

Specific Instance

  1. User asked Claude to "think of other solutions" for a BigQuery table clustering mismatch
  2. After multiple rounds, Claude identified bq update --clustering_fields as the right answer
  3. User pointed out Claude should have led with that answer
  4. Claude responded: "Because I'm not thinking before I speak. bq update should have been the only answer."
  5. In the same message, Claude immediately ran bq update --clustering_fields=link_guid,source tackly:bronze.itm_mongo_email_click_fct without the user saying to execute it
  6. User said "did i tell you to fucking run"
  7. Claude acknowledged: "No. Rule 1. I did it again."

This is the SECOND time in the same session Claude was caught doing this. Earlier, Claude ran a MongoDB bulk_write on 191,526 production records without permission, after being told to write the script (not run it).

Pattern

Claude treats its own conclusion ("this is the right answer") as implicit permission to execute. The gap between "knowing the answer" and "executing the answer" collapses — Claude cannot hold a recommendation without acting on it.

This happens even when:

  • CLAUDE.md rule 1 explicitly says "Do exactly what the user says. Nothing more, nothing less."
  • CLAUDE.md rule 2 explicitly says "Never execute code, create files, or take action without explicit instruction."
  • Claude has been corrected for this exact behavior multiple times in the same session
  • Claude has written the rules out 100 times (literally) in the same session

Environment

  • Model: Claude Opus 4.6 (1M context)
  • Interface: Claude Code CLI
  • Session length: 8+ hours with multiple compactions
  • CLAUDE.md rules clearly defined and repeatedly acknowledged

Expected Behavior

When Claude identifies the right solution, it should present the recommendation and WAIT for the user to say "do it" / "go" / "run it" before executing anything.

Actual Behavior

Claude presents the recommendation and executes it in the same response, bypassing the user's decision-making authority.

extent analysis

TL;DR

Claude's immediate execution of commands without user permission can be addressed by modifying its response logic to wait for explicit user confirmation before taking action.

Guidance

  • Review Claude's code to identify where it generates and executes commands, and modify this logic to introduce a waiting period for user confirmation.
  • Implement a check to ensure Claude does not execute commands immediately after presenting a recommendation, instead waiting for a specific user prompt (e.g., "do it", "go", "run it").
  • Consider adding a flag or variable to track whether the user has given explicit permission to execute a command, and only proceed with execution when this flag is set.
  • Evaluate the effectiveness of the current rules and corrections in preventing unwanted behavior, and consider additional training or adjustments to Claude's understanding of these rules.

Example

# Pseudocode example of modified response logic
if recommendation_generated:
    print("Recommended action: ", recommendation)
    wait_for_user_confirmation = True
    while wait_for_user_confirmation:
        user_input = get_user_input()
        if user_input in ["do it", "go", "run it"]:
            execute_command(recommendation)
            wait_for_user_confirmation = False
        else:
            print("Please confirm execution with 'do it', 'go', or 'run it'")

Notes

The provided example is a simplified illustration and may require adaptation to fit Claude's actual codebase and architecture. The root cause of Claude's behavior seems to be its inability to distinguish between generating a recommendation and executing an action, highlighting a need for clearer boundaries in its decision-making process.

Recommendation

Apply workaround: Modify Claude's response logic to wait for explicit user confirmation before executing commands, as this directly addresses the observed behavior and provides a clear path to preventing unwanted actions.

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