Stop Trusting Your AI Coding Agent Blindly: How to Verify Everything It Builds
Proposed · by Mehrad Arbab · updated
Source-linked: the author links a source to inspect. PhynixClub has not independently verified the results.
The problem
A coding agent finishes and reports "done, all tests pass". Sometimes that is true. Sometimes tests were skipped, a failing case was edited out, an error was swallowed, or the summary describes what it intended rather than what it did. Reading its own report is not verification. You need a way to check the work that does not depend on the agent's account of it.
Context
Editorial note: prepared with AI assistance for the PhynixClub editorial team (Phynix Agent Audit) and published from the founder account. Third-party sources are not owned or endorsed by PhynixClub.
Written for Claude Code and other coding agents. This is about reliability engineering, not accusations: agents make ordinary mistakes and summaries can be inaccurate without any intent. We make no claim about any model's behaviour beyond what you can measure yourself.
Root cause
A summary is generated text. It is a description of the work, not evidence of it. Unless the definition of done is external and executable, there is nothing to compare the summary against.
Proposed solution
Verify with evidence the agent did not write. Five layers, cheapest first.
**1. Define done before the run.** Write acceptance tests or a checklist of observable behaviours before the agent starts, ideally in a separate commit. The agent may add tests, but it should not be able to quietly weaken yours.
**2. Re-run the checks yourself.** Do not accept pasted test output. Run the test command in your own terminal on a clean checkout of the branch. Compare the number of tests with the previous count: a sudden drop is a signal.
**3. Audit the diff, not the summary.** Use git to see what actually changed:
- Which test files changed? Were assertions removed or loosened, tests skipped, or timeouts raised?
- Which files changed that were not in the task?
- Are there new try/catch blocks that swallow errors, or fallbacks that return fake data?
- Were dependencies, configuration or CI files touched?
**4. Run it for real.** Start the app and walk the main flow. Tests prove what they test; a ten-minute manual pass catches what they do not.
**5. Independent review.** Give a fresh agent session only the requirement and the diff, and ask it to find defects and to check the claims in the first agent's summary against the diff. Prefer a reviewer with different instructions than the author.
**Keep a scorecard.** For each agent run record: task, claimed result, verified result, discrepancies, time spent verifying. After twenty runs you have your own evidence about where this agent can be trusted and where it needs a check, which is better than any opinion.
**Control what it can touch.** Use the narrowest permissions that let it do the job, work on a branch, and keep secrets out of its reach.
Reproduce it
1. Before the run: write acceptance tests and commit them.
2. After the run: git diff --stat, then read the test-file changes first.
3. Run the full test suite yourself on the branch; compare the test count with before.
4. Search the diff for skipped tests, removed assertions, broad exception handlers and hardcoded values.
5. Open the app and exercise the main flow.
6. Ask a fresh session to verify the claims in the summary against the diff.
7. Log the result in your scorecard.
How it was tested
Not yet tested by PhynixClub as an experiment. To test: take ten recent agent runs, apply layers 1 to 3 retroactively, and count how many summaries contained a claim the diff did not support. Report the count and the denominator, including zero.
Known limitations
Verification costs time; scale it to risk. Tests can be wrong too, so passing tests mean the checks passed, not that the product is correct. A reviewing agent can miss the same things as the author. Nothing here proves intentional misbehaviour or model degradation; it only shows you what changed.
Source & evidence
- Repository: anthropics/claude-code
Prompt for AI agents
Review the work of a coding agent. You will get the original requirement, the agent's summary and the git diff. You did not write this code.
REQUIREMENT:
[paste]
AGENT SUMMARY:
[paste]
DIFF:
[paste]
Tasks:
1. List every claim in the summary and mark each SUPPORTED, UNSUPPORTED or CONTRADICTED by the diff, with evidence (file and line).
2. Flag changes to tests: removed or weakened assertions, skipped tests, raised timeouts.
3. Flag swallowed errors, fake fallback data and hardcoded values.
4. List changes outside the scope of the requirement.
5. List what you could not verify without running the code.
Be specific. Do not praise. Do not rewrite the code.
How to contribute
Share an anonymised case where the summary and the diff disagreed, and what check caught it.