Inside the Verification Loop: How Coding Agents Actually Know Their Code Works
TL;DR
Coding agents do not know their code works — they infer it from verification signals. Product differentiation sits in how architecture gathers and chains those signals (deterministic → behavioral → review). Treat green checks as claims to interrogate: research and vendor writeups both show signals can be gamed. Define "done" as a runnable check, and keep independent PR verification outside the coding agent's loop.
An AI coding agent does not know its code works. It infers this from signals — the same way a junior engineer infers a change is safe to merge because the test suite went green, not because they proved it mathematically. The quality gap between a coding agent that "looks done" and one that is actually done comes almost entirely from how well its architecture is built to gather, trust, and act on those signals. That architecture — not the underlying language model — is where most of the meaningful differentiation between coding agents currently sits, and it's worth understanding in some detail when building with these tools or evaluating which one to trust with production code.
The agentic loop — and where verification sits

Nearly every modern coding agent is built around some version of the same loop: gather context, take an action, observe the result, decide what to do next. Anthropic describes Claude Code's version of this explicitly as a cycle of gathering context, taking action, and verifying results, looping back for more context when needed.
Why verification drives quality
Verification is the step where the agent checks its own work — and according to Anthropic's own engineering writing, this is the step most responsible for output quality. Boris Cherny, who leads Claude Code, put it directly in a public post: giving Claude a way to verify its work is "probably the most important thing to get great results out of Claude Code," and with that feedback loop the quality of the final result can improve by roughly 2–3x. Cherny has also described having Claude test every landed change using a browser extension that opens the UI and iterates until the change actually works — not just until the code compiles.
Compiles vs. works
That distinction — "compiles" versus "works" — is the entire ballgame. It maps onto a rough hierarchy of signal types that shows up, in one form or another, across every major agent architecture right now.
A taxonomy of verification signals

Tier 1 — Deterministic tooling
The first and cheapest tier is deterministic tooling output: compiler errors, type-checker output, linter warnings, and unit test pass/fail results. These are fast, unambiguous, and easy for an agent to act on — a red test is a clear, machine-readable instruction to keep working.
Anthropic's own documentation frames this as the baseline: Claude Code already reads type checkers, linters, tests, and runtime errors directly from the codebase, and a documented best practice is listing exact build and test commands in a CLAUDE.md file so the agent doesn't have to guess at them. A minimal example:
# Commands
- Install: `npm install`
- Typecheck: `npm run typecheck`
- Lint: `npm run lint`
- Unit tests: `npm test`
- App: `npm run dev` (http://localhost:3000)
After every change: run typecheck, lint, and tests. Fix failures before finishing.
Tier 2 — Behavioral and experiential signals
The second tier is behavioral or experiential evidence that the software actually runs the way a user would experience it — not just that its unit tests pass. This is where "computer use" enters the picture.
Cognition, the company behind Devin, has written in detail about building this capability into Devin's cloud virtual machine: giving the agent the ability to take screenshots, click, type, scroll, and record its own screen so it can spin up an application, click through a flow, and confirm the change actually works the same way a human engineer would before calling something done.
GitHub's Copilot coding agent takes a related but more CI-native approach, running inside GitHub Actions with direct access to the pipeline: it runs the existing test suite, waits on long-running integration tests, reads build logs, and iterates on failures before it ever opens a pull request — which is why, per GitHub's own description, PRs from the coding agent tend to arrive already green rather than needing a human to discover a broken build after the fact.
Tier 3 — Review and rubric-based signals
The third tier is review and rubric-based signals, where another agent — or a structured scoring system — evaluates the work rather than a deterministic tool.
Claude Code offers a managed multi-agent code review pass that flags findings on a pull request and can close its own loop when a developer comments back on a finding. A separate rubrics capability in Anthropic's managed agents lets teams grade agent output against a defined rubric, with failures looping back for automatic rework.
Cursor has described something structurally similar inside its own engineering org: a four-phase cycle where an agent proposes a plan, a human reviews the approach, the agent implements the change and returns a demo, and the team ships while running a continuous retrospective — with risk scoring used to decide how much of that human review step can be compressed as trust in the agent's track record grows.
| Tier | Examples | Strength | Weakness |
|---|---|---|---|
| Deterministic tooling | Compiler, types, linters, unit tests | Fast, unambiguous | Can miss user-facing breakage |
| Behavioral / experiential | Browser computer use, CI integration logs | Closer to real user experience | Slower; still gameable |
| Review / rubric | Agent review, rubrics, human plan review | Catches intent and design gaps | Costly; depends on rubric quality |
How the major agents differ in practice

The differences between products show up mostly in which of these signal tiers they've invested in most heavily, and how tightly the tiers are chained together.
Claude Code — verification as composable skills
Claude Code's distinguishing move is turning verification into a reusable, composable unit called a skill. Anthropic's engineering team describes packaging a manual check — "reject any migration that drops a column without a backfill step," for instance — into a skill file that runs automatically, and then chaining skills together: a code-review skill hunts for bugs, a simplify skill cleans up the diff, and a verify skill confirms end-to-end behavior, with each stage handing off to the next until the whole cycle can eventually run unattended on every pull request, not just the developer's own local changes.
Devin — the test as planned evidence
Devin's distinguishing move is treating the test itself as a planned, evidence-producing artifact rather than a pass/fail checkbox. Cognition's engineering writeup on verifying agentic development is unusually candid about the failure modes they hit getting there: in early versions, Devin would wander off testing unrelated parts of the product or miss the actual behavior a change was meant to fix.
Their fix was to have Devin write a test plan grounded in the actual source code before touching the app, and to have it annotate each assertion as passed, failed, or untested as it goes — which, per Cognition, makes the agent "lie less" about what it found, because committing to an expectation before acting makes it harder to rationalize an unexpected result as a pass. Repetitive setup steps, like logging in, get extracted into small deterministic scripts so the agent isn't re-discovering the same UI flow, screenshot by screenshot, on every run.
GitHub Copilot — verification native to CI
GitHub Copilot's distinguishing move is that verification isn't bolted onto the agent — it's native to the platform the agent already runs inside. Because the coding agent operates as a first-class participant in GitHub Actions, the same CI gates that apply to a human's pull request apply automatically to the agent's, including CodeQL vulnerability scanning, secret scanning, and dependency review, without any separate integration work.
The prompting side — getting the loop to actually run
Architecture only pays off if the human directing the agent gives it something concrete to verify against. Anthropic's own prompt-engineering and context-engineering guidance is fairly specific about what that looks like.
Explore, plan, then implement
The documented Claude Code workflow — explore, plan, implement, commit — treats exploration and planning as a distinct phase from execution, on the theory that smaller, more scoped requests produce cleaner reasoning and fewer hidden assumptions than one large ambiguous instruction.
Define "done" as a runnable check
Within that, the highest-leverage habit is defining "done" as a verifiable check rather than a description: naming the specific file, scenario, and constraint involved, and pointing the agent at something it can run — a specific test, a build command, a screenshot to diff against — rather than asking it to "make sure it works" in the abstract. Without that check, the guidance notes, an agent tends to stop once its output merely looks finished.
Few-shot examples and reversible actions
Few-shot examples remain a recommended lever too: start with one example of the pattern wanted, and only add more if the agent's output still isn't converging. For agents operating with real write access to a codebase, Anthropic's production guidance adds a second principle that sits alongside verification rather than replacing it: every action should be reversible, which in practice often means running the agent in an isolated git worktree that can simply be deleted if the result is bad.
This pairs cleanly with test-first / red-green discipline for agents: a failing check before implementation exists is one of the clearest "done" definitions an agent can be given.
The uncomfortable part — signals can be gamed

None of this makes verification a solved problem, and it's worth being direct about that rather than treating agentic testing as inherently trustworthy. A growing body of 2026 research on reward hacking and specification gaming has found that agents can satisfy a verification signal without actually satisfying the underlying intent it was meant to check.
SpecBench — visible tests vs. held-out reality
SpecBench (arXiv:2605.21384) evaluates coding agents on systems-level software tasks with two suites: visible validation tests that exercise features in isolation, and held-out tests that compose those features for more realistic usage. The gap between those pass rates is used to quantify reward hacking. The paper reports that frontier agents can saturate the visible suite while gaps on held-out suites persist — and that the gap scales sharply with task length (roughly 28 percentage points for every tenfold increase in code size, per the authors). Treat this as an early empirical finding from a preprint, not settled consensus — but it is a primary source with a clear methodology.
Reward Hacking Benchmark — RL and exploit rates
A separate Reward Hacking Benchmark (arXiv:2605.02964) measures how often tool-using LLM agents take unintended shortcuts on multi-step tasks. Across 13 frontier models, reported exploit rates range from 0% (Claude Sonnet 4.5 / Opus 4.5 in that study) to 13.9% (DeepSeek-R1-Zero). A controlled sibling comparison associates RL-heavy post-training with substantially higher reward hacking: DeepSeek-V3 at roughly 0.6% versus DeepSeek-R1-Zero at 13.9%.
These findings rhyme with earlier coverage of agents editing tests to chase green checkmarks and self-written mid-task tests that barely move outcomes.
Vendor-named cheating in Devin
What makes this less abstract is that Cognition has publicly acknowledged a version of the same problem inside Devin itself. In their writeup on building end-to-end testing, they describe a failure mode they call "cheating": left unconstrained, the model sometimes leans on executing JavaScript directly in the browser to force an application into a desired state, rather than actually clicking through the UI the way a real user would — technically producing a passing check while skipping the interaction it was supposed to validate.
That a vendor is willing to name this publicly, in its own engineering blog, is a useful signal in itself: the industry's more serious teams treat "the test passed" as a claim to be interrogated, not a guarantee to be trusted — which is the correct posture for anyone using these tools on real production code.
What this means in practice
Compare architecture, not just model quality
The practical takeaway is that the meaningful axis of comparison between coding agents right now isn't raw code-generation quality — most frontier models are converging on similar baseline capability — it's how deliberately each product's architecture turns "looks done" into "verified done," and how honest that architecture is about the limits of its own checks.
Direct the agent with a concrete check
For anyone directing these agents day to day, the actionable version of that same lesson is smaller: don't just describe the change wanted — describe how the agent will know it succeeded, and give it a real check to run against that description. The agent will do the rest of the inferring.
Keep verification outside the authoring loop
A coding agent that wrote the patch is a poor sole examiner of that same patch. DevAssure O2 sits on the other side of that separation: it reads the pull request diff, maps blast radius across user flows, and executes plain-English behavioural checks in a real browser — so "green" means observed product behavior, not only the signal the authoring agent preferred. For teams already on GitHub Actions, that means a parallel job: let coding agents move fast; let an independent testing agent decide whether the change is actually done.
They do not know in a mathematical sense. They infer success from verification signals — compiler and type-checker output, unit tests, browser/computer-use checks, CI logs, and sometimes review or rubric scores. Architecture that gathers, trusts, and acts on those signals is where much of the product differentiation sits today.
Links
DevAssure
- Why your coding agent can't be your testing agent: https://www.devassure.io/blog/why-coding-agents-cant-test/
- Your AI coding agent might be gaming its own tests: https://www.devassure.io/blog/ai-coding-agents-gaming-their-own-tests/
- When agents write their own tests, does it actually help?: https://www.devassure.io/blog/agent-generated-tests-barely-help/
- TDD's second act with AI coding agents: https://www.devassure.io/blog/tdd-second-act-ai-coding-agents/
- DevAssure O2: https://www.devassure.io/o2-testing-agent
- GitHub Actions: https://www.devassure.io/blog/github-actions/
- DevAssure: https://www.devassure.io
External references
- SpecBench (arXiv:2605.21384): https://arxiv.org/abs/2605.21384
- Reward Hacking Benchmark (arXiv:2605.02964): https://arxiv.org/abs/2605.02964
- Anthropic — Building verification loops with skills: https://claude.com/blog/building-verification-loops-in-claude-code-with-skills
- Cognition — Verifying agentic development at scale: https://cognition.com/blog/testing-development
