Simon Willison·· 20 天前AI 评分36
Geoffrey Huntley:用 pre-commit hook 强制 AI 智能体使用诊断库
Quoting Geoffrey Huntley
AI 导读
Geoffrey Huntley 提出用 pre-commit hook 检查 git diff,发现 AI 智能体绕过诊断模块直接调用可观测性模块时就让提交失败,并注入提示词要求智能体改用诊断库,效果"十全十美"。
摘要与补充说明
他认为与其靠 AGENTS.md 内省更新,不如用这种强制手段,因为文档总会漂移。
正文
13th October 2026
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.