Anthropic 推出 Claude Ship:按策略审查、修复并批准 Pull Request
原题Anthropic Introduces Claude Ship to Review, Fix, and Approve Pull Requests by Policy
推荐理由维护代码库的人可以借这套流程查清审查、修复与审批权限各落在哪一步,再决定哪些变更一定要由人确认。
读前速览
Anthropic 推出 Claude Ship,这是一套用于 GitHub PR 审查、自动修复和策略驱动审批的 AI 智能体,并提供可配置的安全控制。
Claude Ship 为 PR 生命周期的不同阶段提供了 3 种专用智能体
Code Review 会检查 PR 并发布发现的问题,且支持配置审查深度;PR Steward 会处理 CI 失败、合并冲突和审查反馈,但不会合并代码;Claude Approvals 则执行 .claude/approvals.yml 中定义的策略审批规则。
Approvals 使用声明式 YAML 策略控制哪些人必须审查,以及 Claude 是否可以批准
每条规则都会指定路径模式、所需的人工审批席位,以及 Claude 的处理方式(批准、评论或阻止)。系统可以满足 GitHub 的必需审批规则;对于修改策略文件本身的 PR,则依据默认分支上的策略进行判断。
社区反馈指出了自行审批和操纵 CI 的安全隐患
用户担心智能体可能削弱测试,或与人工审查流程发生竞速,因此建议在合并时锁定 SHA。批评者则质疑,能够编写代码的模型是否能安全地批准自己做出的变更,尤其是策略文件的变更。
Claude Ship 与 GitHub Copilot、Graphite、CodeRabbit 和 OpenAI Codex 等 AI 代码审查工具竞争
与这些竞品不同,Claude Ship 集成了策略驱动的审批,并通过 .claude/approvals.yml 配置提供更有条理的管理方式,因此定位为一套全面的工作流自动化工具。
完整摘要
Anthropic 推出 Claude Ship,这是一套面向 Claude Team 和 Enterprise 计划用户的 AI 智能体,可审查 GitHub Pull Request、推送自动修复,并根据团队制定的策略批准变更。该套件包括 Code Review(已正式发布)、PR Steward(测试版,可处理 CI 失败、合并冲突和审查反馈)以及 Claude Approvals(测试版,可执行 .claude/approvals.yml 中的策略)。管理员可以为每个代码库配置审查深度(Quick、Standard、Deep);Approvals 则通过策略文件确定所需的人工审批席位,以及 Claude 应批准、评论还是阻止变更。系统初期以观察模式运行,只报告策略判断结果而不强制执行,并按令牌用量计费。该服务不适用于启用 Zero Data Retention、HIPAA 配置或客户管理加密密钥的环境。
Anthropic 在 Claude Team 和 Enterprise 计划中推出了 Claude Ship,这是一组能够审查 GitHub 拉取请求、推送修复,并批准团队策略允许的更改的智能体。Code Review 已全面开放使用;PR Steward 和 Claude Approvals 处于测试阶段。Anthropic has introduced Claude Ship, a set of agents that can review GitHub pull requests, push fixes, and approve the changes a team's policy allows, on Claude Team and Enterprise plans. Code Review is generally available; PR Steward and Claude Approvals are in beta.
Code Review 会检查拉取请求、核实发现的问题并发布结果;管理员可为每个代码仓库选择 Quick、Standard 或 Deep。PR Steward 的设计目的不是批准或合并拉取请求。它会处理 CI 检查失败、合并冲突和评审反馈。Anthropic 建议先使用 Manual 模式,此模式下,只有拥有写入权限的人评论 @claude steward 后,它才会运行。开发者也可以在 Claude Code 中运行 /ship 来创建拉取请求、评审它并处理失败的检查。最终是否合并,仍取决于权限和分支规则。Code Review inspects a pull request, verifies findings, and posts them; administrators pick Quick, Standard, or Deep per repository. PR Steward is designed not to approve or merge. It works on failing CI, merge conflicts, and review feedback. Anthropic recommends Manual mode first, where it runs only after someone with write access comments @claude steward. Developers can also run /ship in Claude Code to open a pull request, review it, and work through failing checks. What merges still depends on permissions and branch rules.
当已连接的仓库在其默认分支中包含 .claude/approvals.yml,且文件中设有 version: 1 时,Claude Approvals 就会启动。每条规则都会设置路径模式和裁决结果:此次变更需要多少个人类审核者,以及 Claude 是批准、评论还是阻止。Anthropic 建议先使用 mode: observe;在此模式下,检查会报告策略将如何裁决,并且通常会通过。只有当 GitHub 将其设为必需检查时,它才会阻止合并。省略 mode 行则会强制执行该策略。Claude Approvals starts when a connected repository has .claude/approvals.yml, with version: 1, on its default branch. Each rule sets path patterns and a verdict: how many human seats the change needs, and whether Claude approves, comments, or blocks. Anthropic recommends mode: observe first, where the check reports what the policy would decide and normally passes. It blocks a merge only when GitHub requires it. Omitting the mode line enforces the policy.
作者可以占用一个席位,因此 seats: 1 意味着其他人都可以不必查看,而 seats: 0 则可能让机器人创建的拉取请求在没有任何人参与的情况下合并。Claude 的批准审查可以满足要求至少一项批准的 GitHub 规则。仅有 claude: approves 的规则不会自行启动 Code Review。Approvals 会从默认分支读取策略,因此修改该文件的拉取请求会按照已合并的规则进行判定。Anthropic 的入门策略要求对 .claude/ 下的路径由两个人审核,并且不允许 Claude 批准这些路径。使用费用按 token 计费。启用了零数据保留、HIPAA 配置或客户管理的加密密钥时,无法使用此功能。The author can fill a seat, so seats: 1 can mean nobody else has to look, and seats: 0 can let a bot-authored pull request merge with no person involved. Claude's approving review can satisfy a GitHub rule that requires one approval. A rule with claude: approves does not start Code Review by itself. Approvals reads the policy from the default branch, so a pull request that edits the file is judged by the rules already merged. Anthropic's starter policy asks for two people on paths under .claude/, and does not let Claude approve them. Usage is billed on tokens. It is unavailable with Zero Data Retention, a HIPAA configuration, or customer-managed encryption keys.
在 r/ClaudeCode 讨论帖中,u/redtear1115 写道,他们会从手动模式开始,尤其是针对 PR Steward:On the r/ClaudeCode thread, u/redtear1115 wrote that they would start with Manual mode, especially for PR Steward:
他们说,代理为了让 CI 检查变绿,可能会悄悄削弱测试,或只修补表面症状,让故障消失。后台推送也可能与人工审查发生竞态:如果 Steward 在审查后推送,我合并的就不再是我实际检查过的内容。他们建议将合并锁定到一个确切的 head SHA。An agent chasing a green CI check can quietly weaken a test or patch the symptom just to make the failure go away, they said. Background pushes can also race a human review: if Steward pushes after the review, I'm no longer merging what I actually checked. They suggested locking merges to an exact head SHA.
在 X 上,@NamAniket 认为,Anthropic 的数据并未展示其在任何非公司自有代码仓库上的成果,并发文称:On X, @NamAniket argued that Anthropic's figures do not show results on any repository the company does not own, posting:
当编写代码的模型同时也是审批代码的模型时,会发生什么?我敢打赌,不出 30 天,就会有人提交一个修改策略文件的 PR,而且它会被自动批准。What happens when the model that wrote the code is the one approving it, and bet that within 30 days someone shows a PR that edits the policy file getting auto-approved.
GitHub Copilot 代码审查、Graphite 的 AI 审查和 OpenAI 的 Codex 审查会在拉取请求中发表评论,但不会取代审批策略。启用 Automatic Approvals 后,CodeRabbit 可以发布批准审查,但仍受 GitHub 分支规则约束。团队长期以来一直使用 GitHub CODEOWNERS 和分支规则集,针对特定路径安排人工审查。Anthropic 将 Approvals 描述为类似于更智能的 CODEOWNERS 文件。GitHub Copilot code review, Graphite's AI reviews, and OpenAI's Codex reviews comment on pull requests without replacing an approval policy. CodeRabbit can post an approving review when Automatic Approvals is on, still subject to GitHub branch rules. Teams have long used GitHub CODEOWNERS and branch rulesets for path-based human reviews. Anthropic describes Approvals as working like a smarter CODEOWNERS file.
PR Steward 和 Approvals 仍处于测试阶段。已使用 Code Review 的团队可以添加 Steward 和一项观察模式策略;设置方法请参阅文档。PR Steward and Approvals remain in beta. Teams already on Code Review can add Steward and an observe-mode policy; setup is in the documentation.