返回首页

对比阅读

对比阅读:AI Coding Tools Are More Capable — Engineers Want Auditing, Not Stronger Models 与 AI 编程助手越来越能干 — 工程师最想要的不是更强的模型,是'审计'

AEN
AnthropicClaude CodeHooks·

AI Coding Tools Are More Capable — Engineers Want Auditing, Not Stronger Models

This week a 10,000-word tutorial topped Juejin's trending chart — not about how well AI coding assistants write code, but about how engineers force a hard brake before the AI moves. Tools like Cursor, Claude Code, and Codex now do far more than chat or autocomplete: they edit files directly and run shell commands. Anthropic's answer is Hooks: scripts that automatically trigger checks at the key points where the AI acts — an electronic fence around an increasingly capable "intern."

What this is

Hooks are Claude Code's "lifecycle hook" configuration: at fixed points — before and after each tool call, session start or end, context compaction — scripts automatically run checks. Anthropic provides five handler types — shell commands, HTTP endpoints, MCP tools (the standard protocol that lets AI call other software), one-shot model judgments, and sub-agents with tools — which combine into workflows like "after the AI edits a file, auto-run formatting checks" or "force an interception before executing a dangerous command." Configuration lives in JSON files, scoped at three levels: user, project, and local-private. The logic mirrors the pre-commit hooks and CI pipelines familiar from any code repository — upgrading the rule from "a line in the prompt" to "mandatory execution in the pipeline."

Industry view

Supporters argue Hooks fill a required gap as AI coding tools move from "toy" to "production": no enterprise will let an unaudited AI touch production code, and Hooks at least give teams one unified, enforced entry point. Critics are equally clear: Hooks remain a developer-oriented answer — you need to write JSON, you need to know shell scripting, and traditional-industry managers can't use it. The real enterprise solution should be managed services, UI consoles, and audit backends; Anthropic is pushing governance responsibility onto users themselves. Others note that the agent-type handler is still labeled experimental in official docs, with no stability guarantee — treating it as a production-grade "AI supervisor" is premature.

Impact on regular people

For enterprise IT: if your teams are already using AI coding tools, mechanisms like Hooks should be elevated to the team-policy level — otherwise individual developers' local configs stay invisible and unauditable. For individual careers: "using AI to write code" and "supervising AI writing code" will become two separate skills; the latter resembles operations or compliance roles, and demand there could turn out more stable. For consumer markets: once AI tools start performing real actions on your behalf (not just chatting), regulators and vendors will eventually have to settle responsibility boundaries — and self-built solutions like Hooks are only a stopgap.
来源: juejin.cn
BZH
AnthropicClaude CodeHooks·

AI 编程助手越来越能干 — 工程师最想要的不是更强的模型,是'审计'

本周掘金上一篇万字教程登顶热榜——它讲的不是 AI 编程助手多会写代码,而是工程师怎么在它动手前强制踩一脚刹车。Cursor、Claude Code、Codex 这批工具现在不仅能聊、能补全代码,还能直接改文件、跑 shell 命令。Anthropic 给出的解法叫 Hooks:在 AI 干活的关键节点自动触发检查脚本,相当于给一个越来越能干的'实习生'装上电子围栏。

这是什么

Hooks 是 Claude Code 提供的一种'生命周期钩子'配置:在 AI 每次执行工具调用前后、会话开始或结束、上下文压缩等固定时间点,自动触发一段脚本去做检查。Anthropic 提供五种 handler——shell 命令、HTTP 接口、MCP 工具(让 AI 调用其他软件的标准协议)、一次性模型判断、带工具的子 Agent——可以组合出'AI 改完文件自动跑格式检查'、'准备执行危险命令前强制拦截'这类流程。配置写在 JSON 文件里,分用户级、项目级、本机私有三档。逻辑上和代码仓库里常见的 pre-commit(提交前自动跑检查)、CI(持续集成)类似——把规则从'提示词里写一句'升级成'流程里强制跑'。

行业怎么看

支持者认为这是 AI 编程工具从'玩具'走向'生产'必须补的一课:企业不可能让一个没有审计日志的 AI 直接动生产代码,Hooks 至少给团队一个统一的强制入口。但反对意见同样明确:Hooks 仍然是开发者视角的解法,要写 JSON、要懂 shell 脚本,传统行业的管理者用不上;真正的企业级方案应该是托管服务、UI 控制台、审计后台,而 Anthropic 把治理责任推给了用户自己。还有人提醒,agent 类型的 handler 在官方文档里仍标注为 experimental(实验性功能),稳定性没保障,把它当成生产级的'AI 监工'还为时过早。

对普通人的影响

对企业的 IT 部门:内部如果已经让团队用 AI 编程工具,应该把 Hooks 这类机制提到团队规范层级来谈,否则单个开发者的本地配置既不可见也不可审计。对个人职场:未来'会用 AI 写代码'和'会监管 AI 写代码'会变成两件事,后者更像运维或合规岗,需求反而可能更稳。对消费市场:当 AI 工具开始替你做真实操作(不只是聊天),监管层和厂商迟早要谈清责任边界,Hooks 这种自建方案只是过渡。
来源: juejin.cn