Quoting Geoffrey Huntley
Geoffrey Huntley, quoted by Simon Willison, describes a way to keep coding agents on the rails when they keep drifting away from a preferred internal library. His example: instead of trying to fix the drift through AGENTS.md, he writes a pre-commit hook that inspects the git diff for direct calls to observability modules that bypass his diagnostics module. When the hook finds a violation, it fails the commit and injects a prompt telling the agent to use the diagnostics library instead. In his words, the result goes from a persistent delta to "ten out of ten."
The technique pairs a deterministic check with a corrective message aimed at the model. A pre-commit hook is a script git runs before a commit is recorded; if it exits non-zero, the commit is blocked. AGENTS.md is a convention file coding agents read for project instructions. Huntley's point is that static instructions alone drift as an agent works, while a hook tied to the actual diff catches the violation at the moment it would otherwise land.
For teams running agents against a codebase with internal libraries, the pattern is a lightweight guardrail: encode the rule as a check on the diff, and use the failure as the delivery mechanism for the correction.
Based on reporting from the original publisher. Visit the source for full context and later updates.
Publisher excerpt
If the agent isn't using my diagnostics library, I could introspect and update AGENTS.md, but there's still a delta, and it'll drift. Instead, I write a pre-commit hook that checks the git diff for direct calls to observability modules that bypass my diagnostics module. Boom: fail the commit, inject a prompt telling the agent to use the diagnostics library. All of a sudden it's ten out of ten. — Geoffrey Huntley , nobody should type code by hand anymore. here's what's left. Tags: coding-agents , generative-ai