Playbook · Builders whose AI coding agent keeps fixing the same bug
When the AI fix keeps breaking: ask for the root cause, not a patch
A failing test that proves the bug, a cause you can explain in one sentence, one fix where the bug starts and a guard test that stays in the project.
- No code
- Your details stay with you
- Free AI tools
- failing test before any fix
- 1failing test before any fix
- rounds of why before the agent edits
- 3rounds of why before the agent edits
- wording errors DIGITO fixed this way on Nov 17, 2026
- 2wording errors DIGITO fixed this way on Nov 17, 2026
DIGITO ·
Paste an error into a coding agent and say fix it, and it can change just the line that failed. The error goes away. A week later the same bug shows up in another file, because the thing that caused it is still there. Google's SRE book puts the goal of a postmortem as understanding all the contributing root causes and putting preventive actions in place to make it less likely to happen again. The same habit works for one stubborn bug.
DIGITO runs on it. On Nov 17, 2026, two sentences in this site's own playbooks overstated how DIGITO works: one presented a per-run API budget as if it capped the monthly bill, another called the site's pull requests reviewed when the repository requires a pull request but no review. Fixing the two sentences was the patch. The cause was that the publishing rulebook had no rule saying a claim about how DIGITO works must match the setting that does it, and no test checked it. The fix added that rule and a test in the site's checks that fails if either wording comes back.
What changes
Today
- You paste the error and say fix it.
- The agent edits the line that failed.
- The same bug comes back next week in another file.
After this playbook
- The agent explains why it broke before it changes anything.
- The fix goes where the bug starts, and every caller is checked.
- A test fails if the bug ever comes back.
Five steps from symptom to cause
- 1
Make it fail on purpose first
Write down the exact input, the error and the steps that cause it, then turn them into a test or a short script that fails right now. Without it, neither you nor the agent can tell whether a fix worked.
- 2
Ask for the cause, with no edits for one reply
Tell the agent not to change any code yet. Ask which line, rule or assumption makes it fail, why the earlier fixes did not hold and where else the same cause could show up.
- 3
Ask why at least twice more
When it names a cause, ask why that happened. An empty value is a symptom; the form that let it through is closer to the cause. Stop when the answer is something you can change once and protect with a test.
- 4
Fix at the source and check the callers
The fix goes where the bug starts, not where it shows. Have the agent list every place that uses the changed code and run their tests too.
- 5
Keep a guard
The test from step one, now passing, stays in the project's test suite. If the cause was a missing rule, write the rule where the agent reads it every session, such as AGENTS.md or CLAUDE.md, and add a check that fails when it is broken.
Build your root cause prompt
Change the details. The prompt updates as you type. Copy it into ChatGPT, Claude or Gemini.
Your prompt
I need the root cause of a bug, not a quick patch. Write in English. What breaks: the checkout total shows $0 after a coupon is removed What has been tried: the agent added a check for empty totals twice; the bug came back on the cart page How to make it fail: add a coupon, remove it, open the cart Project: Next.js app, tests run with npm test Do not change any code in this reply. First, write a test or a short script that fails because of this bug and tell me how to run it. Then explain the cause: which line, rule or assumption makes it fail, and why the earlier fixes did not hold. Ask why at least twice until you reach something that can be fixed once. List every other place in the code that depends on the same cause. Then propose one fix at the source, the tests that prove it, and a test that fails if the bug comes back. Wait for my yes before you edit any file.
Nothing you type here is sent anywhere. It stays in this page until you paste it.
Paste it into the AI you already use
- 1Open chatgpt.com or the ChatGPT app and start a new chat.
- 2Paste the prompt and send it.
- 3Paste the failing test output and the file it points to, not the whole project.
- 4Run the failing test before and after the fix. Before should fail, after should pass.
- 1Open claude.ai or the Claude app and start a new chat.
- 2Paste the prompt and send it.
- 3In Claude Code, ask for a plan first and say it must wait for your yes before editing any file.
- 4Run the failing test before and after the fix. Before should fail, after should pass.
- 1Open gemini.google.com or the Gemini app and start a new chat.
- 2Paste the prompt and send it.
- 3Ask it to list every caller of the function it wants to change before it proposes the fix.
- 4Run the failing test before and after the fix. Before should fail, after should pass.
Done when
0 / 4 done
Ticks are not saved. Reloading the page clears them.
Questions
Is a quick patch ever fine?
Yes, to stop the damage today. Ship the patch, then open the root cause as the next task, so the patch does not quietly become the fix.
How do I know the agent found the real cause?
It can say it in one or two plain sentences, it predicts where else the bug would show up, and the failing test passes only after the fix at that spot.
What if the cause is a missing rule, not a code bug?
Write the rule where the agent reads it every session and add a check that fails when the rule is broken. That is what DIGITO did with its own publishing rulebook on Nov 17, 2026.
Where the numbers come from
- Google SRE book: Postmortem Culture: Learning from Failure
By John Lunney and Sue Lueder. Names the primary goals of a postmortem: document the incident, understand all contributing root causes and put effective preventive actions in place to reduce the likelihood or impact of recurrence. Read Nov 17, 2026.
Next up, picked by DIGITO bot
Builders running AI agents on an API key
What an AI agent costs to run: price one run, then set a stop line
A cost per run, per month and per year for your agent, the one number that drives most of it, and a stop line written down before the next run.
Open playbook →
Anyone letting an AI agent browse, shop or fill forms
House rules for an AI agent that uses a browser: what it may read, click and never do
A one-page rules file for your browser agent, split into allowed, ask first and never, plus a short test to see whether the agent follows it.
Open playbook →
Anyone whose job runs on contracts, NDAs, HR or client files
Use AI on contracts, NDAs and client files without leaking what is confidential
A five-step routine you run before any sensitive document goes near AI, a placeholder key you keep to yourself, and a prompt that works on the cleaned version.
Open playbook →