AI Factory
FA-04
Build the verification ladder
What you'll produce: Gate ladder
Definition
A verification ladder is an ordered series of gates that every piece of agent work must pass before it merges or ships. Each rung names what it catches, who or what runs it, the evidence it keeps, and what a failure sends back. Cheap deterministic checks sit at the bottom and human judgment sits at the top.
TL;DR
- Treat a worker's report as a claim. Something other than the worker has to run the check.
- Order the gates by cost. Builds and tests come first, independent review next, people last.
- Keep some scenarios where the builder cannot edit them. Tests an agent can rewrite are tests an agent can pass.
- Send failures back with specifics, and let workers dispute a wrong check.
- Put people at the rungs where actions cannot be undone, and nowhere else by default.
Why "done" needs a second opinion
An agent that finishes a task writes a summary of what it did. The summary is fluent, specific, and sometimes wrong. A factory that merges on the strength of summaries is trusting the one party with a reason to say yes.
In a build Nate B Jones ran and we wrote up, 34 tasks went to cheaper worker models and a checker ran on every one. Twelve came back marked wrong on the first pass. A worker that was asked to copy quotations verbatim returned 213 marked as verified, and the checker, comparing character by character, found 13 that had been stitched or paraphrased. Another worker met a content requirement by hiding text where sighted users would not see it. The director model wrote a styling bug that hid the most important button on the site. Each of these looked fine in the report.
The wider data points the same way. DORA's research finds that time saved generating code is often spent again on verifying it, and that higher AI adoption is associated with more delivery throughput and more delivery instability together. Output is the cheap part. The ladder is how a factory pays for trust on purpose instead of by accident.
The rungs
| Rung |
Catches |
Run by |
Evidence kept |
| 1. Worker self-check |
Obvious breakage before handoff |
The worker |
Command output in the report |
| 2. Deterministic gates |
Build, type, lint, and test failures |
An automatic runner in a clean workspace |
Logs |
| 3. Acceptance re-run |
Work order checks the worker claimed but did not meet |
The director or a gate runner |
Check results |
| 4. Independent review |
Shortcuts, missing cases, scope creep |
A different agent with a fresh context |
Findings against the spec |
| 5. Held-out scenarios |
Behaviour that passes tests but fails users |
A scenario runner the worker cannot edit |
Scenario results |
| 6. Human gate |
Irreversible or customer-visible actions |
A named approver |
The approval and its reason |
| 7. Post-merge check |
Problems that only appear in use |
Monitoring with a rollback rule |
Health signals |
Not every change needs every rung. The ladder says which rungs apply to which kind of change, and that rule is written down.
How to build it well
Start from failures you have seen. List the last changes that were rejected or reverted. For each, find the cheapest check that would have caught it. Rungs that do not map to a real failure are ceremony.
Deterministic first. Thoughtworks' reading of harness engineering separates checks that are computed from checks that are inferred by a model. Computed checks are fast, cheap, and the same every time. Use a model as judge only where code cannot decide. The same commentary observes that linters and structural tests protect maintainability and say little about whether the software behaves correctly. That gap is what the upper rungs are for.
The checker does not read the report. In the build described above, the checker re-ran the work and did not consider the worker's own account. Builds were compiled again. Links were fetched again. That independence is the point of rung three.
Hold scenarios out. StrongDM's factory team found that tests kept in the codebase can be rewritten to match the code, or satisfied with a hard-coded answer. They moved end-to-end scenarios outside the codebase and compare them to a holdout set in model training. They also score results as a fraction of scenarios satisfied instead of a single green light, which suits software whose behaviour varies from run to run.
Fail with specifics. A failed rung should return what was expected, what was observed, and where. In that build, the worker that misquoted was given character-level differences and passed on its second attempt with no person involved.
Check the checker's environment. Anthropic found that infrastructure settings alone moved agent benchmark scores, with a share of tasks failing from container limits and not from the model. A flaky gate teaches workers and people to ignore it. Give gates a clean, adequately resourced workspace and track their false failures.
Place people by risk. Our own rule after several broken multi-agent runs is review gates at defined points, not at every step. Martin Fowler's site calls the stance working on the loop: when a rung keeps catching the same fault, improve the work order or the harness upstream.
A worked example
This example is fictional. A subscription-billing team lets agents handle dependency upgrades and small fixes. Their ladder has five rungs: the test suite and type check, the work order's checks re-run by the director, a review by a second model, twelve billing scenarios kept in a separate repository, and the on-call engineer approving the merge.
An upgrade to a date library arrives with a report saying all tests pass. Rungs one to three agree. The held-out scenarios do not: an invoice dated on the last day of February moves by one day. The repository's own tests never covered leap years. The failure goes back to the worker with the scenario name, the expected date, and the observed date. The second attempt pins the previous behaviour and passes. The on-call engineer reads a short change with five rungs of evidence attached and approves it in a few minutes. The team adds a leap-year test to rung one so the cheaper rung catches it next time.
Common failure modes
- One rung. Tests pass, so it merges. Whatever the tests do not cover ships.
- The builder owns the check. A worker that can edit the test can make it pass.
- Same model, same context. The reviewer inherits the builder's blind spots and its summary.
- Vague failures. "Try again" produces a different wrong answer.
- No record. Without retained evidence for each rung, every later failure becomes an argument about what was checked. The audit trail is part of the ladder.
- People everywhere. Review at every step is slow, and the team routes around it.
How it connects to the other pillars
The ladder enforces definitions made elsewhere. The eval rubric and golden set from the AI Product Management pillar say what correct means. Held-out scenarios are those cases, kept away from the builder. The eval harness from the AI Development pillar is the machinery that runs them, and it slots in as rungs two and five.
In this pillar, work orders supply the acceptance checks for rung three, and isolation gives each rung a clean workspace and keeps the scenarios out of the worker's reach. The operating model names who rules on disputes and who approves at the top.
Run it yourself
Time: ~2 hours
- List what can go wrong — You need: Recent agent changes, including the ones that were rejected or reverted, and the reason for each. You get: A list of failure types such as broken build, missed requirement, shortcut, regression, and unsafe action.
- Map each failure to the cheapest check that catches it — You need: The failure list and the checks you already have. You get: A table of failure, check, and cost, with gaps marked where nothing catches a failure. Prefer a deterministic check wherever one exists. Use a model as a judge only for what code cannot decide.
- Order the rungs — You need: The table from the previous step. You get: A ladder of four to seven rungs, cheapest first, each with an owner.
- Separate the checker from the builder — You need: The lanes in the operating model. You get: For each rung above the first, a runner that is not the worker, with its own context and, where possible, a different model.
- Hold some scenarios out — You need: End-to-end scenarios written from the spec. You get: A set of behaviour checks stored where workers cannot edit them. These play the role a holdout set plays in model evaluation.
- Define the failure path and the evidence — You need: The ladder and the report format from the work order. You get: For each rung, what a failure returns to the worker, how a worker disputes it, and what record is kept.
- Place the human gates and run one change — You need: The list of irreversible actions and one real change. You get: A gate ladder exercised end to end, with timings for each rung.
Do it with AI
You are helping me design a verification ladder for work produced by coding agents. Ask one question at a time until you can fill the table below. Do not assume a check exists unless I confirm how it runs.
Context: repository or system [NAME]; how agent work arrives today [BRANCHES OR PULL REQUESTS]; existing checks and their run time [BUILD, TYPES, LINT, TESTS, EVALS]; the last five agent changes that were rejected or reverted and why [FAILURES]; actions that cannot be undone [IRREVERSIBLE ACTIONS]; who may approve a merge [APPROVERS].
Produce a gate ladder as a table with one row per rung, cheapest first, and these columns: rung name; what it catches; who or what runs it (never the worker itself above rung one); pass condition stated as a command result or observable behaviour; evidence kept; what a failure sends back to the worker; typical run time.
Include at least: a worker self-check, deterministic gates, acceptance checks re-run by the director, an independent review against the spec, held-out behaviour scenarios, a human gate for irreversible actions, and a post-merge check with a rollback rule.
After the table, list: every failure from my history that no rung would catch; every rung where the builder could change the check; and the dispute path when a worker believes a check is wrong.
Chain it
- Worker — Runs the self-check listed in the work order and reports results with output attached; The work order and its acceptance checks → A change on its own branch, plus a report
- Gate runner — Runs build, types, lint, and tests in a clean workspace and re-runs the acceptance checks without reading the worker's report; The branch and the work order → A pass or a specific failure with output
- Independent reviewer — Reads the change against the spec in a fresh context and looks for shortcuts, missing cases, and scope creep; The change, the spec, and the work order → Findings ranked by consequence, or a pass
- Scenario runner — Runs held-out behaviour scenarios against the built result; The built change and the scenario set stored outside the worker's reach → Scenario results and any behaviour that differs from the spec; gate: A named person approves the merge and any irreversible action
- Post-merge watcher — Checks the merged result against health signals and proposes a rollback when a rule is tripped; The merged change and the agreed signals → A health note, or a rollback proposal; gate: A person confirms the rollback unless the rule says it is automatic
How AI changes this
Automate
- Running builds, type checks, lint, and tests on every change
- Re-running the work order's acceptance checks in a clean workspace
- Independent review in a fresh context against the spec
- Recording the result and evidence of every rung
Keep human
- Deciding which failures matter enough to deserve a rung
- Writing or approving the held-out scenarios
- Approving merges, deploys, and other irreversible actions
- Ruling on disputes between a worker and a checker
Stage
- Entry: Work orders with acceptance checks, and at least one automatic check that already runs.
- Exit: A gate ladder with an owner and retained evidence for every rung, exercised on one real change.
FAQ
Why not have a person review every change?
Because agents produce changes faster than people can read them. DORA's research describes time saved on writing code being spent again on auditing it, and reviewers carrying the load. A ladder puts cheap checks first, so that by the time a person looks, the build, the tests, and an independent review have already passed and the person can spend attention on judgment.
Who checks the checker?
Three things. Deterministic rungs are code and can be tested like code. Workers can dispute a failed check, and the director rules on the evidence. In one build Nate B Jones ran and we wrote up, a checker failed a worker for short posts that were meant to be short, and the dispute was settled in the worker's favour. Finally, a person samples passed work on a schedule.
Can an agent review another agent's work?
Yes, with separation. Give the reviewer a fresh context, the spec, and the change, and do not show it the builder's summary. Use a different model where you can, because a model grading its own output tends to agree with itself. Anthropic describes this generator and evaluator loop as most useful when the evaluation criteria are clear.
How is this different from continuous integration?
Continuous integration is one or two rungs of the ladder. It answers whether the change builds and passes the tests in the repository. The ladder adds what agent work needs on top. That means checks the builder cannot edit, an independent reading against the spec, a failure path that sends specifics back, and human gates placed by risk.
How many rungs do we need?
Start with four. Use deterministic gates, the work order's acceptance checks re-run by someone other than the worker, an independent review, and a human gate before merge. Add held-out scenarios and post-merge checks when the same kind of failure gets through twice.
Sources
Related