Quoting Geoffrey Huntley
Geoffrey Huntley's advice suggests AI coding agents are best steered not with more prompt text but with hard, mechanical enforcement via git hooks.
Simon Willison quotes developer Geoffrey Huntley on a trick for making AI coding agents follow his rules. Instead of writing ever-longer instruction files, which the agent may ignore or drift from, Huntley adds a pre-commit hook: a script that blocks a git commit if the code calls observability tools directly instead of his diagnostics library, then injects a message telling the AI to use the right library. He says this took the results from unreliable to 'ten out of ten'.
Geoffrey Huntley argues that prompt files like AGENTS.md drift and fail to control AI coding agents, so teams should enforce rules mechanically instead. His example: a pre-commit hook that rejects commits whose code bypasses his diagnostics module and injects a corrective instruction. Teams adopting AI coding tools gain reliability by encoding standards as code rather than prose; those relying on instructions alone face ongoing inconsistency.
Huntley describes replacing instruction drift in AGENTS.md with enforcement: a pre-commit hook inspects the git diff for direct calls to observability modules that bypass his diagnostics library, fails the commit, and injects a prompt telling the agent to use the diagnostics library. This closes the gap between stated agent instructions and actual behavior. The post is a single quoted passage; no tooling details, benchmark numbers, or implementation specifics are given.