Agent engineering
Build an AI code review workflow that finishes
Give coding agents a way to verify behavior, assess review findings, and stop iterating. A practical guide with a worked example and a reusable review prompt.

A small bug fix should get smaller as you understand it. With an agent writing code and another reviewing it, the opposite can happen. Each comment produces another patch, each patch invites another review, and a straightforward change starts acquiring fallback paths, configuration options, and abstractions nobody requested.
A useful review workflow needs an exit condition. Decide what behavior must hold, what evidence can establish it, which findings deserve a fix, and when further iteration needs a human decision. Those choices belong in the task before the first review begins.
Theo’s discussion of Claude Code’s review process is useful background. His account of an unattended review loop growing for days illustrates a failure mode worth designing against. The workflow below applies that lesson to a single, bounded change.Theo / YouTube ↗
Give the change a boundary
Consider a fictional checkout bug: a customer double-clicks Pay during a slow request and submits the order twice. Before asking an agent to fix it, define the user-visible contract. One pending checkout attempt must create at most one order. A failed attempt must leave the customer able to retry. Existing successful payments must keep working.
That contract exposes an early design question. Disabling the button can prevent repeated clicks in one mounted view, but it cannot establish server-side uniqueness across retries, tabs, or reconnects. A reviewer should investigate whether the existing request and payment flow already provides that protection before proposing another mechanism.
Write down what this task includes: the duplicate-submission path and the behavior needed to recover from failure. Changing the payment provider, redesigning checkout, or replacing the application’s state management would require a separate decision. This boundary gives the reviewing agent a reason to reject unrelated improvements.
- Name the symptom and the affected user journey.
- State the behavior that must hold after the patch.
- Identify nearby behavior that could regress.
- Record explicit exclusions and the person who can approve a wider change.
Build a repeatable way to observe the behavior
A passing build establishes that the application can compile. The checkout bug needs evidence about overlapping requests and recovery. Give the agent a controllable slow response, a safe test environment, and a way to inspect how many orders were created. Define the expected result before running the candidate patch.
In the video, Theo describes testing T3 Code with prepared model events so an agent can exercise application behavior without a live model call for every scenario. The transferable idea is to make an external dependency controllable enough to reproduce the application’s difficult states.Theo / YouTube ↗
For the fictional checkout, prepare a delayed success response, a failure response, and a retry. Exercise the action while the response is pending. Check both the visible interface and the authoritative order record. Keep the setup reusable so a second person can reproduce the same observation.
A simulation has a boundary: it checks the behavior you modeled. Retain an integration check for the real payment contract in an appropriate test environment. Record which evidence came from a simulation and which came from the integration, especially when the two disagree.

Require an argument for each finding
Give the reviewer the original task, the diff, the surrounding call sites, and the verification results. Ask it to explain how a specific input or sequence of events reaches an incorrect result. A concern becomes actionable when someone can inspect the path from trigger to consequence.
“This might race” leaves the author to invent the problem. A useful finding identifies the relevant state, shows two requests passing the same check, and explains where duplicate creation remains possible. It should also distinguish behavior introduced by this patch from a separate problem already present in the code.
Anthropic documents automated bug review, separate security review, CI, and human approvals that vary with risk. It also describes verifying findings before posting them. These layers serve different purposes; passing one leaves the others’ questions open.Anthropic / claude.dev ↗
Assign a purpose to each check in your own workflow. A type checker can reject an invalid value shape. A request-level test can expose duplicate creation. A person familiar with the payment contract can challenge an assumption that both the implementation and the tests share. Extra review is useful when it contributes a different kind of evidence.
Theo also argues for having the authoring agent assess review feedback before handing the work back to a person. Apply that with a disposition for every finding: fix it, reject it with evidence, or escalate an unresolved decision. Accepting every suggestion can expand the change just as easily as ignoring every suggestion can hide a defect.Theo / YouTube ↗
Set the stopping rule before starting the loop
Choose an explicit review budget. For a small change, an initial review followed by a review of the fixes may be enough to start with. If a serious issue remains after that budget, pause for a decision about the approach. Reaching the budget never makes an unresolved defect acceptable.
Anthropic reports introducing a three-round cap, narrowing later reviews to the changed diff, and suppressing repeated findings after encountering excessive review cycles. That is a documented policy for its environment, rather than a universal number of rounds to copy.Anthropic / claude.dev ↗
Keep a short findings ledger attached to the change. Give each issue a stable identifier, its evidence, the decision, and the commit that addressed it. On the next pass, the reviewer can verify the repair and its affected paths without reopening settled questions under new wording.
Define completion in observable terms: the acceptance checks pass, relevant blocking findings are resolved, and the current diff still fits the task. Escalate if the patch keeps growing, reviewers disagree about intended behavior, or repeated fixes recreate the same failure. Those are reasons to reconsider the design.

Review this change against the task and acceptance criteria below.
Inputs:
- Original task and explicit exclusions: [insert]
- Base revision and candidate revision: [insert]
- Acceptance criteria and affected user journeys: [insert]
- Verification commands, results, and known gaps: [insert]
- Existing findings and their dispositions: [insert]
For each finding, provide:
1. The affected file and line.
2. A concrete trigger or input.
3. The execution path and user-visible consequence.
4. Supporting code, reproduction, or test evidence.
5. Whether this change introduced it.
Separate blocking defects, decisions requiring human input, and optional observations. Do not request unrelated cleanup. State plainly if you found no blocking defects; do not invent findings to fill a quota.
The author must assess each finding: fix it, reject it with evidence, or escalate it. Do not automatically implement every suggestion.
Budget: one initial review and one follow-up review. On the follow-up, verify fixes and inspect their affected paths. Reopen a resolved finding only with new evidence. If a blocking issue remains or the scope must expand, stop and ask the owner to decide the next step. Never treat the budget as permission to merge.
Finish with unresolved blockers, verification gaps, and the current revision reviewed. Merge authorization follows the repository's existing policy.Make recurring mistakes harder to express
Repeated findings are information about the development environment. Theo recommends investigating the code structure first, then enforceable checks, before relying on more written instructions. That order is useful because it asks whether the failure can be prevented at its source.Theo / YouTube ↗
Suppose duplicate handling is implemented separately in several checkout entry points. Investigate whether they should share one operation with a clear uniqueness contract. If callers can accidentally omit required information, consider whether an API or type change can expose the omission. If the behavior depends on timing, preserve the failing sequence as a regression case.
Use repository guidance for context that remains necessary: which system owns an identifier, where to find a test fixture, or why a tempting approach violates a product constraint. A short instruction can point to an executable check. It cannot establish that the check passed.
Hand back a decision someone can make
The final handoff should explain the changed behavior, the evidence, the remaining uncertainty, and the recovery path. For the checkout example, that might include the reproduced duplicate, the mechanism preventing it, the retry result, and any integration behavior still requiring confirmation. Attach these observations to the revision that was actually checked.
Keep team understanding explicit too. Ask for a short explanation of the relevant request flow and why the patch belongs at that point. Have the responsible engineer challenge it against the code. A readable explanation helps transfer ownership; its plausibility alone does not verify the implementation.
Anthropic keeps human responsibility attached to shipped changes and uses staged release and rollback alongside review. It evaluates saved review effort against reverts and incidents, so time saved before merging does not hide time spent repairing production.Anthropic / claude.dev ↗
Before releasing your change, establish what can actually be undone. Reverting application code may leave created orders or external side effects in place. Name the person responsible for investigating a failure and the procedure for handling those effects. A recovery plan should describe the system you have.
Start with one frequently encountered bug class. Make it reproducible, define the review boundary, and record why each finding was accepted or rejected. When the workflow finishes, you should have a small patch, inspectable evidence, and a person able to explain the remaining risk.
Sources & further reading
Checked November 7, 2026. Definitions and guidance come from the references below; prompts and concepts are original sinabuilds work.
- Theo on review loops and convergence, 27:39–30:29 Theo / YouTube
Primary video, published November 6, 2026. English auto-generated captions retrieved November 7. Theo’s account is an anecdote, not a controlled comparison. No quantitative improvement is inferred here.
- Theo on repeatable application verification, 11:29–12:56 Theo / YouTube
Prepared model events and exercising T3 Code’s application behavior. The checkout example and its verification procedure are original teaching material.
- Theo on assessing automated review feedback, 20:46–22:40 Theo / YouTube
Source for agent assessment of review comments before a human handoff. The findings ledger and bounded prompt are this guide’s implementation suggestions.
- Theo on architecture, checks, and written guidance, 17:36–19:16 Theo / YouTube
Primary discussion of addressing repeated mistakes through code structure, static analysis, and then prose guidance. Also revisited at 39:23–41:24.
- How the Claude Code team does code review Anthropic / claude.dev
October 15, 2026 engineering article by Addy Osmani, Morgan Westlee Lunt, and Qing Wang. Cross-check for review layers, convergence changes, accountability, and release recovery. Internal practices are distinguished from this guide’s proposed workflow.