Turn every agent mistake into an AGENTS.md line or a tool
When the agent gets something wrong, fix the harness, not just the output, so the same mistake cannot happen in the next session.
Reported by @juliandierker · Verified 2026-11-21
- Agent
- Claude Code, Codex
- Stack
- Any
Problem
Correcting the agent in chat fixes one session. Tomorrow's session makes the same mistake. Mitchell Hashimoto calls the fix harness engineering.
Setup
After each mistake, pick the strongest fix that is cheap:
1. A tool that makes the mistake impossible (strongest)
2. A hook or deny rule that blocks it
3. One line in AGENTS.md (weakest, but cheap)Armin Ronacher's example of option 1: a shim early on the PATH, so the wrong command explains the right one.
#!/bin/sh
# ~/bin/python
echo "Use 'uv run python' in this repo." >&2
exit 1What happened
Without it
"No, we use uv" typed into chat for the fifth time this week.
With it
The wrong command fails with the right instruction, in every session, for every agent. Hashimoto also reruns his own past commits with an agent to find where it breaks before it matters.
Sources: My AI adoption journey (Mitchell Hashimoto), Agentic coding recommendations (Armin Ronacher).
Reproduce
Keep a list of corrections you type in chat for one week.
For each repeat, add the strongest fix from the list above.
Check whether the correction comes back.