Bug-fix loop rules for CLAUDE.md or AGENTS.md
Agents that both fix and review can’t stop going back and forth: stop after two failed fixes, review only this round’s changes.
325 saves on X, as of
When fixing bugs, follow these rules:
1. If the same bug survives two fixes, stop. Tell me what you tried, what you changed, what still fails, and what I need to decide.
2. Only change code tied to this bug. List any old problems you spot; don't fix them.
3. When you find a problem, search for the same pattern first and fix every copy at once, not one spot at a time.
4. When reviewing, whether you do it yourself or hand it to another agent, look only at this round's changes. Don't repeat findings already raised.Use it
Add them to the CLAUDE.md or AGENTS.md in your project.
You get The agent fixes every copy of a bug, stops after two failed fixes and reviews only new changes.
The 4 most effective rules for ending Claude Code and Codex’s endless bug-fix loops.
When agents both fix and review the code, they can’t stop going back and forth, because 59% of what keeps getting flagged is old code that was already there in the first round. After the Claude Code team put similar limits on their own agent reviews, PRs needing 5+ rounds dropped from 8.9% to 1.5%, and PRs passing in one round rose from 65% to 78%.
Add them straight to CLAUDE.md or AGENTS.md, or send them before a bug fix.
Add Copybook to your agent, then ask it next time. Set it up
