Design multi-instance and multi-pass review architectures
Learning objectives
Separate generation from evidence-based review, combine local checks with integration analysis, and route findings using observed evidence and calibrated confidence. Control review scope, duplication, and completion honestly.
Separate the work from its author's narrative
An author reviewing the same conversation can remain anchored to the assumptions used to produce the artifact. A fresh review context can reduce that influence by examining the saved change against explicit requirements. It is a useful review design, not a guarantee that a second instance is statistically independent or more accurate on every task.
Give the reviewer the artifact or diff at an identified revision, the agreed plan, the relevant surrounding code, and concrete criteria for a finding. Omit the generator's private reasoning narrative, but retain the legitimate requirements and constraints. A reviewer deprived of a necessary caller contract can invent defects just as readily as an author can miss them.
The supplied glossary defines Context Isolation more narrowly: a subagent's intermediate tool calls stay inside that subagent, and only its final message returns to the parent. The parent therefore needs an adequate final evidence report and cannot assume it has received every intermediate tool result. This context boundary does not make the reviewer unbiased, establish its target bytes, isolate files, or prove that the returned claim was checked.
A request to “double-check” without a target or criterion may add little. A purposeful second pass that tests a specific boundary or dependency has a different role. Do not assume that extended thinking or a fresh conversation substitutes for executing a relevant test.
Split local and integration responsibilities
Local passes examine focused units: input handling within one file, a query's construction, or a component's failure branch. Each returns locations, premises, evidence, and unresolved questions. Record which files and areas were actually examined.
The integration pass follows behavior across interfaces. It checks data types, units, missing-value conventions, authorization propagation, error handling, transaction boundaries, and ordering between components. Merely ranking and deduplicating local findings is not an integration review: a cross-file defect can be absent from every individual local report.
A coordinator reconciles inconsistent premises before synthesizing the result. If one reviewer assumes a field is optional and another assumes it is always present, inspect the producer and contract. Do not choose the report with the more confident wording.
Worked example: a missing-value contract
Assume this teaching application has a documented contract: a missing email should be skipped, and a present email should be normalized. The relevant functions are in separate modules. The declared fictional producer is extractor.py:1, the consumer is normalizer.py:7, and the caller is importer.py:21; these locations establish the teaching cross-file map, not observations of a real checkout. For the guarded-versus-unguarded comparison, the admitted inputs are records with a missing email or a string email. Other accepted types remain a separate upstream-contract question, as illustrated by F3.
def extract_email(record):
return record.get("email")
def normalize_email(email):
return email.lower()
A local review can establish that extraction returns None for a missing key and normalization expects a value with .lower(). Those observations alone do not prove the application is defective: an intervening guard could make the combination valid.
The integration reviewer must inspect the actual caller. If it directly evaluates normalize_email(extract_email(record)) for every record, input {} reaches .lower() on None and fails. If the caller first checks for None and skips that record, the same local functions may satisfy the documented flow. Capture the actual path before reporting the defect. A concrete comparison for this teaching contract, with missing or string emails only, is the unguarded caller normalized = [normalize_email(extract_email(record)) for record in records] versus the guarded Python 3.8+ caller normalized = [normalize_email(email) for record in records if (email := extract_email(record)) is not None]. With records [{}], the first raises AttributeError and the second yields []; with [{"email":"[email protected]"}], both yield ["[email protected]"]. These are statically traced expected results. The separate F3 input-type question below remains pending for its own imagined upstream validator.
The finding should identify the caller and the unguarded transition, state the missing-input case, and suggest handling absence before normalization. Verify the repair with both the missing record and a valid email. Do not “fix” it by converting None to the string "none", which would violate the skip requirement.
Use multiple instances with a coherent contract
Assign distinct review questions rather than asking several instances to produce overlapping generic opinions. One can examine local rejection paths while another inspects authorization flow. Independent reads can run concurrently when they do not depend on each other's results. Synthesis and verification remain dependent stages.
A separate context does not imply a separate filesystem. Reviewers should usually inspect a stable revision with appropriate read permissions. If multiple workers also edit, use isolated working copies or another explicit coordination mechanism and review the resulting integration. A worktree can separate checkouts; it does not by itself prove that every external dependency is isolated.
Parallel execution can reduce elapsed time, but total time includes dispatch, queueing, the slowest required worker, synthesis, verification, and retries. Total resource consumption includes every worker, including failed attempts. Do not equate lower wall-clock time with proportionally lower cost or human effort.
Verify candidates before reporting
Use a structured finding with a location, summary, concrete failure scenario, impact, and evidence obtained. Verify that the location and revision are current. A code location is a locator, not proof by itself. Distinguish a candidate supported only by inspection from a failure reproduced in a test.
Confidence can help prioritize investigation after it has been evaluated against labeled cases. A self-reported score of 0.9 does not establish a 90% probability of correctness. A high-impact candidate with uncertain evidence may need human review; a low-impact style preference should not become blocking because the model is confident.
Keep review effort, finding severity, verification verdict, and repair outcome separate. The source describes product-specific effort levels and remembered defaults; inspect the effective setting rather than assuming that the word high guarantees broader coverage or that low guarantees fewer false positives. Likewise, a tool's CONFIRMED label should be accompanied by the check that justified it.
Specify the verification pass and its output
A verification pass should try to disprove each candidate using the current artifact and its actual contract. Supply the candidate records, the reviewed revision, the relevant code and requirements, and permission to run the necessary checks. Keep the generator's private reasoning out of this context. A fresh context still needs enough evidence to test the claim.
Use an application-owned finding record when the workflow needs per-finding confidence and uncertainty. The supplied ReportFindings schema includes fields such as level, verdict, and outcome; it does not define a numeric confidence field. level describes review effort, verdict describes verification, and outcome describes a repair disposition. None substitutes for a confidence estimate. The fields below belong to this teaching application and are not extra parameters to send to that vendor tool.
This prompt defines both the verification work and the record contract:
You are the verification reviewer. Review the supplied candidates against
revision r17, the saved diff, the surrounding code, and the stated requirements.
Try to refute each claim: inspect the actual caller, look for guards and
counterexamples, and run relevant checks when authorized and available.
Do not infer a failure from a function name or a previous reviewer's confidence.
Return one JSON record per candidate with every field below:
- finding_id: the unchanged candidate identifier.
- reviewed_revision: the revision named in the review input.
- verified_revision: the exact revision actually checked, or null if no check
was completed. Evidence for another revision does not verify this revision.
- location: an object containing file and a positive, one-based line number.
- summary: the defect claim being evaluated.
- failure_scenario: concrete input, relevant state, and claimed wrong behavior.
- impact: high, medium, or low; explain the consequence in failure_scenario.
- evidence: a list of objects containing revision, method, and result. Give
observed outputs or a trace through the applicable contract. Use [] if no
verification evidence was obtained; never invent a test run or its result.
- confidence: your estimate that the stated verification assessment is correct,
as a finite number from 0 through 1 inclusive, or null when no useful
estimate is possible.
- uncertainty: a list of specific unresolved premises or coverage limits;
use [] only when none is known for the stated claim and scope.
- status: candidate if unverified, confirmed if supported by the completed
check, rejected if refuted by it, or inconclusive if the check cannot decide.
Keep high-impact uncertainty visible even if your confidence is high. Retain
missing checks and failed attempts in the evidence and uncertainty. A status
or score is not proof. Do not mark code approved, deployed, or fixed here.
Here, confidence refers to the stated assessment: a high score for confirmed supports the defect claim, while a high score for rejected supports its refutation. A high score for inconclusive can express confidence that the available evidence cannot decide the claim; it does not establish a defect.
A schema validator must reject unknown statuses, missing required fields, and malformed values before routing. null confidence means unknown, not zero and not permission to advance. Booleans, numeric strings, nonfinite numbers, and numbers outside [0, 1] are invalid confidence values. These rules prevent an unchecked value from silently taking a permissive branch.
Worked example: route verified and uncertain findings
The following three records are fictional teaching data, not output from an executed model review. The first continues the email-import example. The other two illustrate an integration risk and an unverified candidate in the same imagined importer. Revision r17, filenames, line numbers, and check results are stipulated inputs. The stated check results illustrate what a verifier would record; they do not claim that these application checks were run for this lesson.
[
{
"finding_id": "F1",
"reviewed_revision": "r17",
"verified_revision": "r17",
"location": {"file": "importer.py", "line": 21},
"summary": "A missing email reaches normalization without a guard.",
"failure_scenario": "With record {} and a caller that directly normalizes the extracted value, None.lower() raises AttributeError and stops that record's import.",
"impact": "medium",
"evidence": [{"revision": "r17", "method": "executed_test", "result": "The missing-email fixture raised AttributeError at normalize_email; the documented contract requires skipping the record."}],
"confidence": 0.94,
"uncertainty": [],
"status": "confirmed"
},
{
"finding_id": "F2",
"reviewed_revision": "r17",
"verified_revision": "r17",
"location": {"file": "importer.py", "line": 48},
"summary": "The import may write a contact into another tenant.",
"failure_scenario": "A tenant-A import supplies a tenant-B contact ID. If the downstream writer trusts that ID without checking tenant ownership, it overwrites tenant B's contact, causing a high-impact isolation failure.",
"impact": "high",
"evidence": [{"revision": "r17", "method": "contract_trace", "result": "The inspected caller forwards the supplied ID to the writer; the writer implementation and its authorization guard were unavailable, so the trace does not establish a cross-tenant write."}],
"confidence": 0.99,
"uncertainty": ["The downstream writer's ownership check was not available for inspection or execution."],
"status": "inconclusive"
},
{
"finding_id": "F3",
"reviewed_revision": "r17",
"verified_revision": null,
"location": {"file": "normalizer.py", "line": 7},
"summary": "A non-string email may cause normalization to fail.",
"failure_scenario": "If a record contains email=42 and reaches the normalizer, calling lower() raises AttributeError; whether such a record passes the upstream validator has not been checked.",
"impact": "low",
"evidence": [],
"confidence": null,
"uncertainty": ["The accepted input types and upstream rejection path have not been inspected."],
"status": "candidate"
}
]
For this example, use the following ordered application policy. Its threshold of 0.8 is a teaching choice, not a vendor default or a universally justified cutoff. Production use requires empirical calibration against independently labeled, representative findings: compare score bands with observed correctness, examine false positives and missed defects, and reassess when the task or model changes. Such validation can justify a routing aid; it cannot turn a score into proof.
- Quarantine a malformed record for correction. Never treat an invalid confidence or unknown status as ready.
- Send a high-impact finding to a human whenever it remains uncertain, regardless of its numeric score. Uncertainty includes an inconclusive or unverified status, explicit unresolved premises, missing or stale verification evidence, unknown or low confidence, or a confidence policy that has not been calibrated.
- Send other findings for verification when they have no current verification evidence or remain uncertain. A claim of
confirmedwithout supporting evidence does not pass this gate. - Retain an adequately supported
rejectedfinding as rejected so it is not repeatedly raised without new evidence. Send an adequately supportedconfirmedfinding to triage.
In this policy, adequate support requires evidence for the reviewed revision, an appropriate verification status, no unresolved premise, and a score at or above the empirically justified threshold. The routing function checks record structure and declared evidence presence; a reviewer must still judge whether the evidence actually supports or refutes the claim. Merely inserting text into an evidence field cannot establish correctness.
The compact Python function below implements that policy for these application records. calibration_ready defaults to False; only the application owner may enable it after evaluating the relevant review population. The example call stipulates that calibration has already been accepted for this fictional population. The lesson does not claim to have calibrated a real model.
import math
def route_finding(finding, *, calibration_ready=False):
def nonempty(value):
return isinstance(value, str) and bool(value.strip())
if not isinstance(finding, dict) or type(calibration_ready) is not bool:
return "quarantine_record"
required = {
"finding_id", "reviewed_revision", "verified_revision", "location",
"summary", "failure_scenario", "impact", "evidence", "confidence",
"uncertainty", "status",
}
if not required.issubset(finding):
return "quarantine_record"
for name in ("finding_id", "reviewed_revision", "summary", "failure_scenario"):
if not nonempty(finding[name]):
return "quarantine_record"
verified = finding["verified_revision"]
if verified is not None and not nonempty(verified):
return "quarantine_record"
location = finding["location"]
if (not isinstance(location, dict)
or not nonempty(location.get("file"))
or type(location.get("line")) is not int or location["line"] < 1):
return "quarantine_record"
if finding["impact"] not in ("low", "medium", "high"):
return "quarantine_record"
if finding["status"] not in ("candidate", "confirmed", "rejected", "inconclusive"):
return "quarantine_record"
confidence = finding["confidence"]
if confidence is not None:
if type(confidence) not in (int, float):
return "quarantine_record"
if not 0 <= confidence <= 1 or not math.isfinite(confidence):
return "quarantine_record"
uncertainty = finding["uncertainty"]
evidence = finding["evidence"]
if not isinstance(uncertainty, list) or not all(map(nonempty, uncertainty)):
return "quarantine_record"
if not isinstance(evidence, list):
return "quarantine_record"
for item in evidence:
if not isinstance(item, dict) or not all(
nonempty(item.get(key)) for key in ("revision", "method", "result")
):
return "quarantine_record"
current_evidence = (
verified == finding["reviewed_revision"] and bool(evidence)
and all(item["revision"] == verified for item in evidence)
)
uncertain = (
finding["status"] in ("candidate", "inconclusive")
or bool(uncertainty) or not current_evidence
or confidence is None or not calibration_ready
or confidence < 0.8
)
if finding["impact"] == "high" and uncertain:
return "human_review"
if uncertain:
return "verification"
if finding["status"] == "rejected":
return "retain_rejected"
return "ready_for_triage"
With the JSON array loaded as findings, the following call has the expected routing decisions shown below; the code was statically traced here, not executed against an application:
for finding in findings:
print(finding["finding_id"], route_finding(finding, calibration_ready=True))
F1 ready_for_triage
F2 human_review
F3 verification
F1 has current supporting evidence and no stated uncertainty, so it enters triage. F2's 0.99 cannot override the missing ownership check or its inconclusive status; a human must resolve the possible high-impact failure. F3's null confidence and absent evidence keep it in verification. An otherwise complete, medium-impact confirmed record with confidence 0.45 also returns verification. Replacing confidence with true, "0.94", a nonfinite number, -0.1, or 1.1, or replacing status with an unknown value, returns quarantine_record. If calibration is not ready, F1 returns verification as well. Holding F1's current evidence, medium impact, empty uncertainty and stipulated calibration fixed, confidence 0 and 0.799 route to verification; exactly 0.8, 0.801 and 1 route to ready_for_triage. Confidence -0.001 or 1.001 is quarantined. Null routes to verification, not numeric zero. These are expected control-flow results, not a real model or executed application test.
ready_for_triage means the finding can be assessed and assigned; it does not mean the change is approved or the defect is fixed. A repair requires an actual change and a new verification against the repaired revision. Preserve rejected candidates, unresolved uncertainty, and incomplete checks in the review record rather than silently deleting them.
Reconcile and converge
Deduplicate findings by the underlying defect, affected behavior, and location, not just identical wording. Preserve materially different failure scenarios. Resolve contradictions by checking evidence and contracts. Track prior findings across revisions so a repaired issue is not repeatedly reported as new.
Use agreed convergence criteria. For example, after the initial pass a team may focus rereviews on unresolved important findings and newly affected behavior while suppressing new stylistic suggestions. Such a policy reduces noise but must not hide an important new defect introduced by the repair.
For a large review, partition the work explicitly and retain a coverage map. If a product rejects an oversized diff, record the refusal and choose a bounded review strategy. If the baseline or merge base is missing, establish the intended comparison before calling a whole-repository scan a change review. An empty diff means there is no change under that comparison; it does not demonstrate the repository is defect-free.
Record completion accurately
A final report states the reviewed revision, completed passes, verified findings, unresolved candidates, and coverage limitations. A worker that timed out or hit a turn limit is incomplete. Preserve its useful partial evidence without counting its assigned scope as fully checked.
Ratings and dismissals can improve review policy over time, but a reaction does not prove a finding was repaired. Recheck the implementation and acceptance case. Stop repeating equivalent checks after their criteria pass unless a new change, failure, or unresolved concern justifies another pass.
Distinguish aggregation from independent evidence
Sectioning divides work, such as a guardrail check separate from the main response. Aspect-specific evaluation asks different questions about the same artifact. Voting asks several reviewers to judge the same candidate under a declared aggregation rule. These arrangements are different. For a teaching three-reviewer vote requiring two supported votes, one supported vote, one refutation and one missing worker cannot become confirmed merely by counting available messages. Preserve the contradiction and missing scope and obtain evidence. Even two agreeing votes can share model, prompt or data errors; vote thresholds trade false positives and false negatives and need actual evaluation. High-impact uncertainty still needs the declared follow-up path.
For an idealized same-scope timing example, concurrent worker durations of 3, 5 and 4 minutes give a five-minute worker phase, not twelve elapsed minutes. If dispatch/admission takes one minute and required synthesis/verification takes two sequential minutes, elapsed time is eight minutes; worker consumption is twelve worker-minutes before other work. Add actual contention, waiting, failures and retries without double-counting overlap. These are unmeasured assumptions. The source's reported 20-minute average is neither a deadline nor proof that a slower review has inadequate parallelism.
Keep source-specific review settings and policies explicit
In the described local review interface, low/medium filter toward higher-confidence findings and high through max broaden coverage; none is a numeric finding-probability threshold. Explicit typed low-to-max selections are remembered; omission reuses that selection, or the current session effort if none has been set. A noninteractive -p selection does not update memory. ultra neither uses nor updates it. Treat these as supplied snapshot behavior requiring actual deployment support, not universal host settings.
The source's sample reporting bar for scripts/ is jointly near-certain and severe. It is an elevated bar, not an absolute exclusion. Any generated-code, vendor, lockfile or machine-authored-branch scope explicitly excluded by the actual authorized repository policy remains a visible coverage limitation. The source lists candidates for exclusion or reduced scrutiny, not universal exclusions. Important-only later rounds can suppress new nits while retaining prior identities and rechecking repairs; they must not hide newly introduced important defects. The described REVIEW.md mechanism does not expand @ imports, so necessary rules must actually be supplied, not merely referenced. Its pipeline-priority wording cannot override governing system/developer/user authority or establish completed coverage. For example, if the authorized repository policy says “new API routes must have an integration test,” supply that actual rule text to the reviewer and inspect the changed route and relevant test; merely writing @testing.md in this loader does not provide the rule or prove that a test exists. This is the source's illustrative repository policy, not a new universal requirement for every codebase.
The source-described ultra preflight defaults are 500 changed files and 8,000 changed lines. Record the actual base, counts and refusal before choosing a bounded authorized next step. The described oversized-diff refusal reports aggregate file and line counts without a per-file breakdown; it has not performed the semantic review. An empty diff is not a clean repository review. Missing merge base may switch to every tracked file, requiring a full clone under the described mechanism; establish that changed scope, permissions and coverage explicitly. These limits and fallback rules are snapshots, not independently verified current behavior. No example staging or committing action is performed here. In the described no-merge-base fallback, the same 500-file and 8,000-line preflight limits also apply to the expanded tracked-file target. A full clone does not remove those caps or itself complete the review.
Preserve native reporting and rerun states
The complete source-described native shape is shown below as a supplied interface snapshot, not a verified live installation or an invitation to send custom confidence fields. CONFIRMED and PLAUSIBLE are the optional verify-pass verdict values; they are not calibrated probabilities. Optional fields can legitimately be absent. A full clone, a version string, or this TypeScript declaration does not establish that a particular deployment supports or executed the tool.
type ReportFindingsOutput = {
count: number;
level?: "low" | "medium" | "high" | "xhigh" | "max";
findings: Array<{
file: string;
line?: number;
summary: string;
failure_scenario: string;
short_summary?: string;
category?: string;
verdict?: "CONFIRMED" | "PLAUSIBLE";
outcome?: "fixed" | "skipped" | "no_change_needed";
}>;
};
The supplied native ReportFindings schema has count, optional review level, and a findings array. Findings require file, summary, failure_scenario; line is optional and 1-based, and category, short_summary, verdict, outcome are conditional/optional. Count must equal the actual deduplicated array; order most severe first under the stated rubric. The snapshot gives base v2.1.196, category v2.1.199, short summary v2.1.212, and at most 32 findings per call. A cap must not silently discard coverage; partition/report any remaining checked scope explicitly. Missing optional category/summary does not prove old software. Inline-only reviews can omit verdict; absence alone proves neither failure nor false completion. Verdict reflects an actual verify pass; fixed/skipped/no_change_needed describe later handling, not numeric confidence. More precisely, the source sets outcome only on re-report after the fix-application phase; an initial report must not invent that phase. A complete expected initial inline-only example is {"count":1,"level":"medium","findings":[{"file":"importer.py","line":21,"summary":"A missing email reaches normalization without a guard.","failure_scenario":"Under the teaching missing-or-string contract, record {} reaches None.lower() in the unguarded caller."}]}. There is no native confidence field, verify-pass verdict or post-fix outcome in that example. A separate complete expected no-reportable-finding result after a stipulated completed check is {"count":0,"level":"medium","findings":[]}; it means only that the declared check and reporting policy produced no findings. Neither object is an actual native tool invocation.
For a completed teaching review with two unique factual findings and four style findings, a tally can say “2 factual, 4 style, revision r17, checked scope S.” A verified empty array means no reportable findings survived that check and policy, not no defects anywhere. A refused, failed, missing-output or timed-out review has no such clean conclusion. Preserve previous findings and actual fix-verification results even when reporting rules filter new suggestions.
The source describes GitHub reactions as later feedback collection, with reaction counts collected after the PR merges, not an immediate rerun or correctness adjudication. Treat this as supplied snapshot behavior, not evidence of a live collection event. Inline replies do not automatically request a review; a supported top-level @claude review request or configured push-triggered behavior can request another run. A request, push or reaction is not a completed check or repair. Actual posting, pushing or rating requires appropriate authorization; none is performed by this example.
Summary
Separate generation from review while preserving the real contract. Combine focused local analysis with an actual cross-file pass, verify candidates, and reconcile conflicting premises. Report coverage and completion from observed work, with confidence as a calibrated routing aid rather than a replacement for evidence.
