Skip to content

Verifying agent work

Coding with agents · topic coding-with-agents/verification

Code you did not write needs a different kind of reading. This topic covers reviewing an agent's diff against the specification rather than for plausibility, observing the system as it runs, narrowing a fault systematically, turning checks into loops the agent can run itself within limits you set, relying on deterministic gates over model opinions, and attacking your own agent before someone else does.

Concepts

Reviewing code you did not write
Reading an agent's diff as a reviewer, not an author: you have no memory of why each line exists, so every line has to justify itself. Look for changes outside the brief, silent behavior changes, deleted tests, copied patterns applied wrongly and comments that describe intent rather than what the code does. Read the code, not the agent's summary of it. glossary
Verifying against the specification
Checking the result against the success criteria written before the work, item by item, instead of judging whether the change looks reasonable. This catches the plausible-but-wrong result, the criterion quietly dropped and the edge case skipped. If a criterion cannot be checked, either the spec or the verification design needs fixing before the change is accepted. glossary
Observing a running system
Running the changed software and watching what it actually does: the logs it writes, the requests it makes, the state it leaves behind, the screen it renders. Tests prove what they cover; observation catches what nobody thought to test. For agent work, running it yourself is also the check that the agent's report of "tests pass" is true. glossary
Isolating a fault
Narrowing a failure to its cause by systematic steps: reproduce it, shrink the input, bisect the change, add observation at the boundary, confirm the hypothesis before fixing. Agents can help at each step but will also guess fixes; insisting on a reproduced, explained cause before any patch is what keeps the fix from becoming a new bug. glossary
Bounded self-checking loops
Giving the agent a check it can run itself, such as a test suite, a linter or a build, and letting it iterate until the check passes, with a limit on attempts and a rule for what it may change. The bound matters: an unbounded loop will eventually satisfy the check by weakening it. The human verifies the check is still honest at the end. glossary
Deterministic gates
Checks whose outcome does not depend on a model's judgment: tests, type checks, linters, builds and schema validation. They give the same answer for the same input, so they can block a merge. A review by another model adds a second opinion and finds things a gate cannot, but it can be wrong or be persuaded in the same way as the first model, so it never replaces the gate. glossary
Red-teaming your own agent
Deliberately trying to make your own agent misbehave before relying on it: feeding it a file with hidden instructions, pasting it a web page you did not read, asking for something its permissions should stop, giving it an ambiguous brief and seeing how far it runs. The aim is to learn what it does under pressure, in a sandbox where nothing real can be damaged. What you find becomes a permission change, an instruction or a gate. glossary

Lessons

Your reference

Each lesson above adds its takeaways and its example here once you finish it. Your reference lists every lesson you have finished.

Reproducing a fault before the agent fixes it

Unlocks when you finish Reproducing a fault before the agent fixes it.

Attacking your own agent before someone else does

Unlocks when you finish Attacking your own agent before someone else does.

Reviewing a diff you did not write, against the spec

Unlocks when you finish Reviewing a diff you did not write, against the spec.

Giving the agent a check it can run, with a limit

Unlocks when you finish Giving the agent a check it can run, with a limit.

Sources

  • Brilliant VER Verification, Brilliant, Coding with AI skills map (reference)
  • Academy ai-fluency-for-builders AI Fluency for builders, Claude Academy (course)
  • Academy claude-code-in-action Claude Code in action, Claude Academy (course)