Agentic Pattern Libraryby Vikas Goyal
← All patterns
70

Independent Verifier

Also known as: out-of-process verification, fresh-context review, separate verifier

Check agent work in a fresh session that never saw how the code was written, so no agent grades itself.

TrackAI-native software delivery FamilyVerify Maturity Emerging ChangesVerificationContext
01

Problem

The agent that writes a change usually also tests and judges it. It carries its own assumptions into the tests, writes tests that confirm what it built, and reads its own diff charitably. Checks in the same session catch typos and obvious slips, but not a wrong assumption, because the checker shares it.

  • The author’s context biases its own checks.
  • A fresh context also lacks useful background.
  • A second session costs tokens and time.
  • Author and verifier can share blind spots if they share a model and prompt.
02

Solution

When the coding agent finishes, start a separate verifier session with a clean context. Give it only the spec or acceptance criteria, the diff, and the ability to run the code and tests, not the author’s conversation or reasoning. Its job is to write or extend tests from the spec, try to break the change, and report findings with evidence. The author agent fixes what it finds, and the verifier checks again. For risky changes, use a different model family or a different prompt for the verifier. Attach the verifier’s report to the pull request so human reviewers start from evidence rather than from the raw diff.

03

Diagram

Speccriteria Author agentwrites the change Diffcode + its tests Verifierfresh session Pull requestreport attached Findingsback to author spec only diff only passes fails fix and re-check

The verifier sees only the spec and the diff. It can't inherit the author's assumptions, so it catches the ones that are wrong.

04

When to use

Use it when

  • Agent changes merge with little human reading
  • Logic where a wrong assumption is costly
  • AI first-pass review is in place and you want stronger evidence
  • Long agent sessions where context may have drifted

Avoid it when

  • Tiny mechanical changes already covered by existing tests
  • No spec or acceptance criteria to check against
  • Low-risk repos with a tight token budget
05

Trade-offs

Latency A second session after the author finishes
Cost Roughly doubles agent tokens for checked changes
Complexity Session setup and a report format
Reliability Catches wrong assumptions the author can't see

Gains

  • Agent work is never graded only by its author
  • Reviewers get evidence, not just a diff
  • Tests are written from the spec, not from the code

Costs

  • Extra tokens and wait time for every checked change
  • The verifier misses context the author legitimately had
  • Back-and-forth between agents can stall without a cap
06

Worked example

Scenario
The Linkwatch team adds a per-user limit of 60 link checks per minute.
  1. Author agentImplements the limit with a fixed one-minute window and 4 tests. All tests pass.
  2. VerifierA fresh session gets the spec and the diff only. It writes 6 tests from the spec, including bursts that span a minute boundary.
  3. Finding119 checks get through in 2 seconds across a minute boundary. The author’s tests never crossed a boundary.
  4. FixThe author agent switches to a sliding window. The verifier reruns its 6 tests and all pass.
  5. Pull requestThe verifier’s report is attached. The reviewer reads the report and the window logic instead of the whole diff, and approves in 10 minutes.
07

Failure modes

FailureSymptomMitigation
Shared contextVerifier repeats the author's assumptionsPass only the spec and the diff, never the author's session
Rubber stampVerifier says "looks good" with no evidenceRequire tests run and outputs shown in every report
Shared blind spotsSame model misses the same class of bugUse a different model or prompt for high-risk changes
Endless back-and-forthAuthor and verifier loop without convergingCap the rounds, then escalate to a person