Back to News

Pre-commit hooks enforce agent use of diagnostics libraries

#coding-agents#pre-commit#diagnostics#git

Geoffrey Huntley proposes using pre-commit hooks to enforce coding agents' use of diagnostics libraries, failing commits that bypass them and injecting prompts to correct the agent. This addresses drift in AGENTS.md instructions by automating compliance checks at commit time.

Coverage timeline

  1. Simon Willison

    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 , git , agentic-engineering , ai , geoffrey-huntley , llms