Stop it from changing code and make it state a hypothesis instead. An agent that has failed twice will keep trying variations of the same wrong theory, because nothing in the conversation has told it the theory is wrong. One prompt breaks that loop: forbid the edit, demand the evidence, and ask what else could cause the same symptom.
The prompt
Stop. You are going in circles. Do not change any code. Tell me what you believe the problem is, what evidence you have, and what else could explain the same symptom.
| When to use it | The moment you notice it trying the same kind of fix twice. Not the fifth time — the second. |
|---|---|
| Why it is worded that way | Three clauses do the work. "Do not change any code" stops the bleeding, because every failed attempt adds a change you will later have to unpick. "What evidence do you have" forces it to separate what it observed from what it assumed, and that gap is usually where the wrong theory lives. "What else could explain the same symptom" is the one that actually breaks the loop: it makes the agent generate a competing hypothesis instead of defending the current one. |
Why agents loop in the first place
A coding agent does not know that its last three attempts failed in the same way. Each turn it sees a conversation in which a fix was proposed, something still does not work, and the obvious next move is another fix. Nothing in that loop contains the sentence "the theory is wrong". You have to supply it.
What a good answer looks like
You want three things back: a specific claim about the cause, the observation that supports it, and at least one rival explanation. If the answer is vague — "there may be an issue with how the data is handled" — that is itself the finding. It means the agent does not know, and the next step is to get evidence rather than another edit.
What to do with the answer
Pick the smallest test that distinguishes the hypotheses and run that, not a fix. If the two explanations are "the save never fires" and "the save fires but is rejected", one log line settles it. Fixing before you know which is true is how a session ends with five changes and the original bug.
The version for when it has already made a mess
If several edits are already in, follow up with: "List every change you have made in this session, in order, in plain English, and tell me which one to undo first." Retreating to a known-good state is almost always faster than reasoning forward from a broken one.
The Operator Prompt Pack
This is one of 60 prompts, from the phase "Debug without guessing". The pack has the rest, each with the same reasoning underneath, plus the research they are built on and a house-rules file you paste in once.
Tools this applies to
| Tool | What it does | Price |
|---|---|---|
| Claude Code | An AI agent in your terminal that reads your files, edits them, runs commands and deploys. | ~€17–20/mo |
| Cursor | A code editor with AI. The step between browser builder and terminal. | ~$20/mo |
Every tool has its own page with what it costs and who should skip it. Some links are affiliate links.
More prompts like this
The prompt that makes an AI agent prove its code works
How do you verify that code written by an AI agent actually works?
The prompt that stops an AI agent touching everything
How do you stop an AI coding agent from refactoring or changing files you did not ask it to?