Author丨Zheng Jiamei

Editor丨Cen Feng

From code reviews, automatically fixing CI failures, to handling merge conflicts and approving PRs, Claude became involved in a complete engineering process from commit to merge.

There is an obvious architectural change in this release: instead of letting a single Agent do all the work, Anthropic splits Code Review, PR Steward, and Claude Approvals into three independent components, which are responsible for review, repair, and approval respectively. They collaborate around the same PR. When a problem occurs in the code, the repair can be automatically triggered. After the repair is completed, the corresponding review and approval process will be entered.

Among them, the policy-driven approval mechanism introduced by Claude Ship has changed the way AI participates in code delivery. Teams can define the relationship between code paths, change scope, review results, and approval requirements through YAML files, and the system dynamically determines approval conditions based on actual modifications. There are clear rule boundaries for what operations the Agent can perform. Lei Feng plays

This architecture involves a deeper engineering problem: when AI starts to modify the code independently, and even participates in deciding whether the code can be merged, how to avoid execution, review and approval being concentrated in the hands of the same Agent? Claude Ship combines responsibility isolation with a strategy engine and gives his own implementation path.

01

PR becomes the public status layer for Agent collaboration

Claude Ship uses GitHub PR as a shared work object among the three components. Diff, Commit, CI check, review thread, and approval results are retained in the PR. Each Agent works based on these engineering statuses and writes back the execution results. In this way, task context no longer relies on conversation delivery, and the code version and operation record itself can take over subsequent tasks.

Workflow is driven by PR events. PR creation, branch push, inspection failure, and new review comments will all affect subsequent execution. Teams can choose from three review levels: Quick, Standard, and Deep, and set them to run when a PR is created, after each push, or upon manual request.

Code Review internally uses four stages of processing: Find, Verify, Rank and Post. In the Find phase, multiple agents read Diff and surrounding code in parallel to find problems from the perspectives of logic errors, security flaws, and boundary conditions. The scope of the review extends beyond the modified line, because the correct operation of local code often depends on the caller, data flow, and interface constraints.

The Verify stage is responsible for rechecking candidate findings to confirm whether the problem can be supported from the actual code path. The Rank stage performs deduplication and severity sorting. The Post stage writes the results into PR to form in-line review opinions and Check.

This design solves a typical problem in code review: the model can detect suspicious code, but it may not be able to determine whether it constitutes a real defect. Independent verification can filter out some judgments that lack contextual basis. It should be noted that Code Review uses a read-only mode to check the code and is not responsible for building and running the project, so CI is still required to provide actual execution results.

PR Steward runs in a cloud session and handles CI failures, merge conflicts and review feedback related to the current PR. It can modify files, push Commit, and explain the content and undo method of each modification. For code adjustments with a clear scope, it can be implemented directly, while when larger architectural trade-offs are involved, it will wait for developers to decide.

It also has clear triggering restrictions: PRs from Fork, Bot creation, and committers without repository write permissions will be skipped by default. During runtime, developers can adjust tasks via @claude or send @claude stop to terminate execution.

Architectural boundaries are important here: the PR Steward can write code, but does not have approval or merge permissions. It is responsible for producing new code versions, and subsequent approvals are handled by an independent mechanism. Repair and authorization are separated, preventing the agent performing the task from simultaneously becoming its own acceptor.

02

Compile warehouse specifications into approval policies

The core of Claude Approvals is .claude/approvals.yml in the repository. The team writes the approval requirements into structured rules, and the system matches the rules based on the files modified by the PR, and then calculates whether Claude can approve and how many manual approval seats are needed.

Each Rule mainly consists of paths, if, verify and override.

paths specifies the file range covered by the rule, if describes the conditions under which the rule is established, and verdict determines the approval result. Among them, claude has three states: approves, comments, and blocks, which respectively indicate that Claude is allowed to approve, only allowed to leave review comments, and blocked from approval. seats specifies the number of manual approvals, and you can also limit which GitHub Team the participants come from, or exclude PR authors.

This set of rules uses a file-by-file evaluation. The system will check which Rules apply to each modified file, and then summarize the results into the entire PR. If the same file matches multiple rules, the more restrictive result is retained, with priority in blocks, comments, and approves. The manual approval seats required by different rules also need to be met separately.

Directory-level configuration further solves the problem of rule maintenance for large warehouses. The system will look up the policy from the directory where the change file is located, and use the configuration that is closer to the file path, is in the Enforce state, and overwrites the file. The upper-level policy can continue to constrain the lower-level directories through nested: inherit. Organizations can maintain basic rules in the root directory, and business modules can set local requirements based on their own code characteristics.

Conditional expressions can also read PR attributes such as file number, Diff line number, author, initiator, and target branch, and support logical combinations such as ANY and ALL. Here is a detail: pr/diff_lines counts the change scale of the entire PR, rule/files_changed only counts the files covered by the current rule. The two statistical calibers allow the team to manage the overall modification scale and the approval requirements of local modules at the same time.

Override allows conditional branches to be added to the basic Verdict, and the system adopts the first established rule in the configuration order. It can adjust the number of manual approvers based on the review results, or change whether Claude has approval authority.

This policy calculation needs to take into account the failure of model calls. If the classifier that Override relies on does not return a result, the system will return to the basic Verdict. If the classifier appears in the if of the Rule itself but has no result, the approval check will fail. Therefore, the basic rules need to retain strict enough approval requirements to avoid accidentally relaxing permissions when the model is called abnormally.

There is also a key security design: Claude Approvals reads the policy file from the default branch. Modifications to the approval rules in the PR that have not yet been merged will not affect the current PR, and will only participate in subsequent evaluations after the rules enter the default branch. This prevents submitters from modifying the approval conditions through the code to be reviewed and lowers the threshold for their own code.

Claude Approvals cannot read CI results directly, tests and builds still need to be run as separate GitHub Required Checks. Its own Check also needs to be configured as Required Check to actually participate in merging constraints. Observe Mode allows the team to run the policy first, observe the approval results, and then decide whether to enable mandatory inspection.

03

Let semantic judgment be involved in approval

Path rules and PR attributes can describe where the modification occurred and how large it was, but they cannot fully express what happened to the code semantically. Claude Approvals supplements this layer of judgment through Classifier.

Teams can create classifiers in .claude/classifiers/ and define the model, prompts, input parameters, and output ranges through def.yml. Prompt is responsible for describing the judgment task, and outputs limits the results that the model can return, such as low, medium, and high. The policy engine reads these structured results and determines approval requirements based on conditions.

Anthropic has two built-in classifiers: claude/code_review and claude/diff.

The former reads the results of Code Review and returns pass if there are no unresolved Important level issues, and returns fail if there are still such issues. The latter compares the old and new Diff, classifies the change as trivial, same_intent or different, and determines whether subsequent code modifications continue the original intention.

This leads to a very technical design in Claude Approvals: reuse. After each PR push, whether the original manual approval is still valid needs to be re-judged based on the new version of the code. If all historical approvals are invalidated with every modification, a large number of local repairs need to be manually processed repeatedly. If old approvals are unconditionally retained, new code may inherit authorizations that are no longer applicable. Leifeng.com (public account: Leifeng.com)

reuse allows teams to set reuse conditions for manual approval seats and classifier results respectively. For example, only if the old and new Diffs are judged as same_intent and the new version of Code Review returns pass, the previous manual approval will continue to be counted.

There are actually two levels of judgment here: claude/diff checks whether the modification intention is continued, and claude/code_review checks whether there are still important problems in the current version. Only after the two conditions are combined can the system decide whether to retain historical approvals.

reuse also supports limiting the validity time of evaluation results through max_age. If the time limit is exceeded, recalculation is required. GitHub's revoked approvals are usually not automatically reinstated, and a force push may also affect the validity of old approvals. If an author once filled a manual approval seat, this seat may continue to be counted after reuse. Therefore, the team needs to exclude pr/authors through personnel rules to prevent authors from replacing independent reviewers.

Classifier can also configure tool permissions and execution budgets. Some classification tasks simply require reading Diffs, others may require looking at surrounding code or reviewing threads. The tool list determines what the classifier can access, and the budget limits the running time and token consumption.

The review found that there was also independent authority management. Teams can use findings to specify who has the authority to turn off findings generated by the classifier. A distinction needs to be made here between closing the review thread and fixing the code: the former only changes the processing status of the problem, while the latter changes the actual implementation. If there is a lack of personnel authority constraints, the review status may be artificially changed, which will affect subsequent approvals.

Semantic classification also has input risks. PR descriptions and code files may contain instruction text that interferes with model judgment, and model judgment may still be biased even if the output is restricted to fixed categories. Therefore, policies involving high-risk code should still retain manual approval, and permission requirements cannot be reduced based on classifier output alone.

04

Engineering challenges after automating code delivery

Claude Ship can reduce the wait time between code submission, review and fix, but the efficiency of software delivery is not entirely dependent on the speed of PR processing.

As agents continue to participate in code modifications, the quality of reviews, scope of fixes, and the cumulative impact of multiple rounds of modifications will become key factors in measuring the system. Especially in large projects, just because part of the code passes review does not mean that the entire system behaves as designed. leifeng.com

The cost of maintaining approval policies also needs to be considered. As business modules increase, team responsibilities are adjusted, and code structures evolve, the inheritance relationships, exception conditions, and classification standards between rules also need to be continuously updated. If the time saved by automation is consumed by policy maintenance and exception handling, its actual engineering benefits need to be re-measured.

Therefore, when evaluating Claude Ship, you can't just judge how many PRs it can handle independently. You also need to look at the rollback ratio, missed defects, frequency of manual intervention, and overall delivery cost. Compared with simply improving the speed of code production, how to make these automation capabilities run stably for a long time in complex engineering environments may be the next problem Anthropic needs to solve.

Reference link: https://claude.com/resources/articles/introducing-claude-ship

Original articles from Leifeng.com are prohibited from being reproduced without authorization. See the reprint instructions for details.

edit

Resend Email Modify Email