Geoffrey Huntley:用 pre-commit 钩子治住 agent 乱调模块

Simon Willison · rss · 2026-10-13

Simon Willison 引述 Geoffrey Huntley《nobody should type code by hand anymore》中的工程技巧:当 coding agent 不使用自己的诊断库时,与其改 AGENTS.md(仍有偏差且会漂移),不如写一个 pre-commit 钩子,检查 git diff 中是否存在绕过诊断模块、直接调用可观测性模块的代码——命中即拒绝提交,并向 agent 注入提示要求改用诊断库。"Boom: 十分。"这是用确定性工程约束替代 prompt 约束的典型做法。

原文链接 →

「编程与Agent」频道最新

更多「编程与Agent」频道 AI 资讯 →