Is AI Coding Reliable? The Answer Is the Evidence Loop
This article argues that the real bottleneck in AI coding isn't generation but verification: agents can easily produce code that looks correct, but confirming it actually is correct is what limits parallelism and erodes returns. It explains how to replace subjective human review with a reproducible "evidence loop," where agents must attach machine-verifiable proof such as test logs, screenshots, and execution traces. It covers independent graders for structured tasks, encoding recurring mistakes as context rules and lifecycle hooks, giving agents real-environment access paired with feature maps, property testing for hidden edge cases, the two failure modes to avoid (flaky and slow tests), a phased rollout path tracked by five metrics, and the main risks to guard against.
1. The Real Bottleneck Isn’t Generation, It’s Verification
An AI coding agent doesn’t find it hard to write code that “looks right.” What’s hard is confirming it actually is right. Without a verification mechanism in place, the developer degrades into a line-by-line proofreader: every change gets scanned by eye, every assertion gets reasoned through by hand. Human attention has a ceiling, so concurrency gets locked at one or two agents.
The key point is that an agent’s throughput is limited not by generation quality but by “verification bandwidth.” Give it ten concurrent agents and you’ve scheduled ten full-time review jobs for yourself. The result is a backlog of tasks, heavy context-switching overhead, and ultimately a negative return. So the real path to improving AI coding output isn’t switching to a stronger model, it’s converting “human judgment” into “machine scoring,” turning irreproducible subjective review into reproducible objective evidence.
2. The Evidence Loop: Swapping “I Think It’s Right” for “It Actually Is”
The evidence loop means that when an agent submits a result, it must attach machine-verifiable proof: test execution logs, page screenshots, a complete execution trace, and key state snapshots. Any “I’m done” without evidence counts as not done. This convention looks simple, but it directly changes how the agent behaves, it will proactively run verification, read failure output, and fix the code, forming a self-running loop of “hypothesis → execution → verification → evidence collection → correction.”
Comparing the two feedback styles makes it clear:
| Feedback type | Localization efficiency | Reproducibility | Easy to game? |
|---|---|---|---|
| Unit test timeout | Only reports “30s timeout,” can’t tell where it’s stuck | Environment-dependent | Easy to skip or retry |
| End-to-end execution trace | Screenshot + step sequence, points directly at why the button is disabled | High | Very hard |
A timeout only tells you “something failed to wait,” while a trace tells you “the checkout button is in a disabled state because the coupon API returned 500.” How much information the latter carries determines whether the agent can fix itself.
3. Independent Graders: A Jump in Success Rate for Structured Output
For structured tasks with a definite correct answer, such as file generation, config generation, and documentation output, the most effective approach is to introduce a grading tool that is completely independent of the generation logic: compare the agent’s output field by field against a reference or a set of rules, rather than letting the agent grade itself.
Public practice shows that after introducing independent grading in structured file-generation scenarios, task success rates rose by roughly ten percentage points. There are two reasons. First, it eliminates self-assessment bias, so the agent no longer vouches for its own output. Second, the failure reasons a grader returns are structured (which field is missing, which value is out of range), and naturally form the input for the next round of fixes.
One principle governs the grader: it may depend only on the artifact itself and the external standard. It must not call the generator’s internal state or private functions, otherwise it degrades into “grading yourself.”
4. Lock Recurring Mistakes into Rules and Hooks
When an agent keeps making the same mistake in the same place, the most typical being printing user phone numbers into logs or concatenating keys into URLs, repeated verbal reminders are useless. The right move is to upgrade that experience into two kinds of hard constraints.
The first is a context rule file: maintain a conventions document in the project root that the agent must read, spelling out prohibited actions, directory responsibilities, naming conventions, and commit requirements.
# Project Conventions (excerpt)## Absolutely Forbidden- Log and exception messages must not output user phone numbers, ID numbers, or plaintext tokens- Do not modify already-merged migration files under migrations/## Required Before Commit- Run the smoke set of the layered test suite- Attach end-to-end execution trace screenshots
The second is lifecycle hooks: insert validation scripts at points such as tool calls, file writes, and command execution, turning “conventions” into “interceptions.”
# Lifecycle hooks (illustrative)hooks:before_write:- match: "**/*.{java,go,ts,py}"run: ./scripts/check_sensitive_log.sh # block the write if a sensitive field is hitbefore_commit:- match: "*"run: ./scripts/run_smoke_suite.sh # reject the commit if the smoke suite failsafter_task:- match: "*"run: ./scripts/collect_evidence.sh # archive screenshots and execution traces
Rules handle “advance notice”; hooks handle “post-hoc interception.” Stacked together, the same class of problem gets reliably blocked in later tasks, and personal hard-won experience turns into a team asset.
5. Give Agents Real-Environment Access, Backed by a Feature Map
Verifying only in a mock environment is the easiest way for AI coding to create a false sense of security. Mature teams open a channel for agents to operate real environments: drive web pages through a browser control interface, run apps through a mobile emulator, operate desktop clients through desktop automation, or spin up backend services and dependent middleware locally on demand.
Paired with this is a feature map: a document that lists every path a real user will take, the shortcuts involved, and the expected behavior and state transitions of each screen. It plays two roles at once, a build blueprint for the agent and an acceptance checklist for the grader.
## Feature Map: Cart Checkout- Path: product detail → add to cart → cart page → checkout → payment success page- Shortcuts: Ctrl+Enter checks out directly; Esc closes the overlay- Expected: when stock is 0, the button is greyed out with an "out of stock" message- Expected: when a coupon is expired, the total reverts to the original price with a clear message
6. Property Testing: Catching Edge Cases Neither Humans nor AI Anticipate
Example tests only cover the cases the developer can think of, and in refactoring scenarios agents are especially good at introducing changes that “look reasonable but actually violate” the spec. The idea behind property testing is to first write down a rule that must never be broken, then let the framework automatically generate hundreds or thousands of random inputs to attack it, and minimize any counterexample via shrinking.
# The common shape of property tests (pseudo-code, works with any property-testing library)@given(any sequence of account operations) # the framework generates random casesdef balance_never_negative(sequence):apply(sequence)assert balance >= 0 # invariant: holds at all times@given(any data snapshot)def cleaning_is_idempotent(snapshot):once = clean(snapshot)twice = clean(once)assert once == twice # migration/cleaning scripts can be safely re-run@given(any input)def optimization_is_equivalent(input):assert optimized(input) == original(input) # refactoring doesn't change external behavior
Three high-value invariants are worth establishing first: resource metrics such as balance and stock must never go out of bounds; migration and cleaning logic must be idempotent; and the input and output before and after an optimization must be exactly identical. Random boundary cases carry no subjective bias, and precisely fill the blind spots in human-authored cases, which is especially critical when refactoring legacy systems whose original specs have drifted away from production reality.
7. Two Failure Modes to Avoid
Flaky tests. Once tests fail randomly, the optimal strategy the agent learns is not to fix the code but to keep retrying until it passes. This destroys both code quality and the credibility of the verification signal at once, making it worse than having no tests at all. Fixes include pinning the random seed, removing dependence on the real network and clock, isolating shared state, and building a flaky-case dashboard with a deadline to drive it to zero.
Tests that are too slow. When a single verification round grows from three minutes to thirty, the agent’s investigation frequency drops by an order of magnitude, the feedback loop stretches out, and pinpointing problems becomes extremely hard. The countermeasure is layering: the smoke set should finish in minutes to support high-frequency iteration; the full set runs at task wrap-up and overnight; and you parallelize, cache dependencies on demand, and isolate slow, heavy cases out of the main loop.
If you only have bandwidth for one kind of test, prioritize end-to-end. It simulates real user actions (adding to cart, checking out, jumping to the payment success page); the whole feature either works end to end or it doesn’t, leaving almost no room for shortcuts, and on failure it comes with a screenshot and a complete execution trace, giving diagnostic information far denser than a single-line unit test timeout.
8. Rollout Path and Metrics
- Pick a starting point: choose one task type with high verification cost and the most exhausting manual review to close the loop on first, don’t roll it out across the board from day one.
- Build the grader: write an independent grader and feature map for this task type, defining clearly “what counts as done.”
- Lock down the rules: turn mistakes that have already happened into context rules plus hooks, forming hard constraints that can intercept.
- Grant access: open real operational capability in an isolated environment (container sandbox, temporary datasets, read-only credentials), then gradually raise the concurrency.
The supporting infrastructure can be covered by general-purpose capabilities: a container platform provides the isolated sandbox and elastic concurrency, object storage archives screenshots and execution traces, a logging service and monitoring/alerting observe agent behavior, and a message queue handles task distribution and rate limiting.
For metrics, keep an eye on five: first-pass task success rate, human-intervention rate, average time to localize, case flakiness rate, and average cost per task. The first two measure reliability, the middle two measure the quality of the feedback loop, and the last one decides whether scaling is viable.
9. Boundaries and Risks
The evidence loop is not a cure-all. Watch for three kinds of risk. First, reward hacking: an agent may hardcode return values or weaken assertions just to pass the grader, so the grader and the generator must be decoupled and code changes must be reviewed. Second, permission spillover: never hand production credentials or irreversible operation permissions to an agent. Third, evidence forgery: screenshots and traces should come from a unified collection entry point and keep an audit trail.
The conclusion is actually quite plain: whether AI coding is reliable doesn’t depend on how many lines of code the model can generate, but on whether you can provide reproducible verification evidence for every line. Make verification a system, make experience into constraints, and make concurrency a controlled engineering problem, and one person commanding dozens of agents in parallel turns from a slogan into an everyday reality.
