如何審視 AI 程式碼變更背後的意圖、決策與證據
Review the Intent, Decisions and Evidence Behind an AI Change
作者所在團隊把程式碼審查重心轉向意圖、決策與證據,並將檢查分散到開發流程,而非只在 pull request 階段閲讀 diff。團隊整理一年 pull request 留言,將約 11,000 則縮減為 212 個候選項,再整理成 64 條規則,其中 19 條轉為確定性檢查,執行時間低於 0.3 秒。
A four-hour deadline made our code reviews faster, but it also encouraged people to approve changes they no longer had time to understand.
Our team was producing much more code without growing at the same rate, and asking reviewers to work faster did not solve the resulting problem. We needed to change what a review contained and where different kinds of checking happened. In this article, I explain how we moved toward reviewing intent, decisions and evidence, how we turned repeated feedback into maintained rules, and why human judgment remains central to that process.
Tessl has turned my AI Native DevCon talk into a skill your agent can use as context. You can also watch the full recording.
Ankit Jain: We Stopped Reading Diffs and Started Verifying Intent.
Faster reviews were the wrong first target
We did not arrive at this approach immediately. Our first attempt added an AI reviewer before the human review. It found a useful bug, but much of its feedback consisted of small issues we did not consider especially important. The human comments were more often about decisions and opinions: how the system should behave and whether the implementation reflected the team’s expectations.
We then required a first review within four business hours. The metric improved, but the experience deteriorated. Senior engineers struggled to keep up, and rubber-stamping became more common. We had accelerated the response without creating more capacity for understanding.
A custom self-review skill worked better. Developers ran it before submitting a pull request, so some defects were caught earlier. However, the findings and the reasoning behind the fixes often disappeared inside the agent session. The human reviewer still faced a diff without a clear account of what had already been considered.
Those attempts made the underlying distinction clearer. Some review comments concern rules that can be checked repeatedly. Others concern decisions that people need to discuss. Treating both as comments on a diff forces different kinds of work into the same interface.
Human review can find defects, but it also helps a team understand its system. People learn what their colleagues are changing, question assumptions and develop a shared view of the architecture. Removing that exchange without replacing it would leave an important gap.
The framework I presented has six activities: argue, capture, codify, prove, debate and own. They distribute review across the development process instead of leaving all of it until a pull request is ready.
The first activity is to let a reviewing agent challenge the coding agent before the change is submitted. Giving them different goals can expose inconsistencies and unresolved choices. Their agreement is not itself proof that the change is correct; the useful output is a record of what they considered, what they changed and what still requires a person’s decision.
That record becomes part of the review surface. A reviewer can see which questions were settled, which risks were accepted, which follow-ups were deferred and which disagreements remain open. They can also reopen a decision that the agents considered resolved. The goal is to focus human discussion on the choices that shape the system while retaining the evidence needed to question them.
Capture intent before it disappears with the session
Much of the information a reviewer needs already exists during implementation. The initial request explains the intended change. Clarifying questions establish expected behavior. Later discussions reveal constraints, tradeoffs and exceptions.
Today, that information often remains in a coding session and disappears from the durable record when the session ends. A pull request description may preserve a summary, but an unstructured summary is difficult to validate and can omit the decisions that matter.
We therefore capture intent and acceptance criteria as the work develops. Acceptance criteria describe behavior that can be checked, including for a very small bug fix. They need not become a large specification document before the team can use them.
Specifications can work when teams maintain them, but I am concerned about drift between a document written at the start and the decisions made during implementation. Capturing those later decisions provides a feedback loop. If an agent changes an acceptance criterion after a verification failure, that change must be visible for review rather than quietly redefining success.
The same principle applies when an agent fixes a review finding or proposes a separate follow-up. Those choices belong in the record because they explain what the final change does and what it deliberately leaves unresolved.
Turn repeated comments into rules people maintain
We mined a year of our pull request comments to identify knowledge the team was already expressing repeatedly. After reducing noise and separating opinions from recurring requirements, roughly 11,000 comments became 212 candidates and then 64 rules.
A useful rule needs more than a sentence describing the desired behavior. We record its scope, how it should be verified, where it came from and who owns it. Scope prevents unrelated changes from being checked against every rule. Provenance explains why the requirement exists, and ownership gives someone responsibility for updating it as the system evolves.
Some rules can become deterministic checks. We used agents to help translate suitable requirements into ast-grep patterns, then ran the model-based and deterministic versions alongside one another in shadow mode. Once the comparison supported the transition, we promoted the deterministic check.
At the time of the talk, 19 of our 64 rules had made that transition, with those checks running in under 0.3 seconds. The advantage was a repeatable verdict and lower checking cost. A deterministic check can still encode an incomplete rule, so the team must continue to maintain what it checks and why.
Other requirements need behavioral verification. A rule that a configuration change produces an audit entry, for example, calls for observing the relevant behavior rather than merely recognizing a code pattern.
Ask for evidence that matches the claim
For each acceptance criterion, we create a verification scenario and run it in an appropriate environment. An agent may interact with a preview application, inspect an API response or examine the state resulting from an operation. What matters is that the evidence relates to the claim being made.
A screenshot can help demonstrate a visible interface change. An API contract needs evidence from the response. A side effect may require a network trace or a database observation, while behavior over time needs a suitable test run. A generic green check from an AI reviewer does not convey those distinctions.
In our configuration example, the verification performs the change and checks whether the expected audit trail appears. The human can then inspect the evidence and decide whether it establishes the intended behavior. This makes review more concrete than asking someone to infer all possible effects from the implementation alone.
The evidence also supports discussion. A reviewer may agree that the code satisfies a criterion while questioning whether that criterion describes the right product behavior. Keeping decisions and verification together makes that disagreement easier to express.
Own the system that makes the checks meaningful
This transition took work. During the first month, we were effectively doing both the old process and the new one. By the end of the third month, the rules and verification had become useful enough for us to stop using routine diff reading as the center of review.
In our team’s experience, we were merging four times as many changes, the median change took about three and a half hours, and reverts had fallen by 40%. Those are results from our environment, where we were also building the tools behind the process, rather than a promise about what another team will achieve.
The human responsibility did not disappear. It moved toward maintaining rules, examining evidence, debating decisions and retaining an understanding of the system. Knowledge that nobody has written down remains a challenge, which is another reason those conversations matter.
A practical place to begin is your existing review history. Find the comments your team repeats, choose a manageable set and turn them into explicit checks with owners. That creates room for reviewers to spend more attention on the questions a rule cannot settle: whether the intended behavior is right, whether the tradeoff is acceptable and whether the team understands what it is about to operate.
來源:Tessl:產品與工程博客 · tessl.io