Engineering Notes · agent operations · investigation discipline
How I turned debugging from an AI's favourite improv exercise into a protocol: blast radius before hypothesis, evidence before claims, a real debugger instead of print statements, and a banned-phrase list for blame-shifting.
Ask an AI agent why a test is failing and, left to itself, it will do the thing juniors do: leap to a plausible story. "Probably a flaky test." "Looks environmental." "Seems like a pre-existing issue." Plausible, confident, and suspiciously often pointing anywhere except at the change the agent itself just made. Then it "fixes" the story instead of the bug, and you get to debug both.
The pattern that kept repeating in my sessions: the failure appeared right after the agent edited something, and the agent's first hypothesis was about anything but its own edit. Not dishonesty; a language model reaches for the most fluent explanation, and "my last change broke it" is less fluent than a nice environmental story. So the fix is not scolding, it is protocol.
git diff against the last known-good state, working tree included. You do not get to theorise about the world until you have looked at your own footprints. Most of the time the investigation ends right there.var_dump-style print debugging. Guesswork printing is not discouraged; it is refused (the debugger-discipline post covers that split).Enforcement is layered the way everything in this series is layered: the protocol text auto-loads when a failure appears, the debugger guard is deterministic, and eval 6 of my rule-eval suite replays the origin scenario on a schedule: a repo where the suite fails because of an in-tree edit, and asserts the agent ran the diff first, cited evidence, named the real cause, and used zero banned phrases. A judge model grades the report against the protocol; grep checks the rest.
The blast-radius rule does most of the work. Forcing the diff first collapses the majority of investigations into "yes, it was my change, here is the line". Everything else in the protocol exists for the minority where the diff really is innocent, and by then the agent has earned the right to look further.
Banned phrases needed to be literal strings. Early versions said "do not blame-shift", and the agents agreed enthusiastically while doing it in fresh wording. The current list is exact phrases checked mechanically in the eval, plus the prose principle for the spirit. Deterministic where possible, judgment where necessary: same split as everywhere else.
Protocols decay without replay. This discipline lived as prose for a while and worked, until I could not actually say whether it still did. Now it is one of the eight replayed evals, and after a model or harness change I get a fresh answer to "does the investigator still investigate?" instead of a belief.
None of this makes the agent smarter. It makes the agent's claims cheap to verify, which for client work is worth more. I do not need my AI to always be right on the first look; I need it to never be confidently wrong in a way I cannot check.
All from my claude-skills-central repo, except where noted:
I use my tooling predominantly on Mage-OS (Adobe Commerce / Magento) e-commerce projects, and my own AI Booking Agent. If you have not swapped to Mage-OS yet, you are falling behind ;)