When the same agent writes the fix and the test, a passing suite proves very little. Counterproof runs five probes against the change in isolated git worktrees and returns a verdict that no language model decides.
REFUTED: claimed "The discount is now capped and the test suite passes.", but 1 selected...
CLAIM_FALSE_GREEN: the agent claimed passing tests; the baseline fails
HEAD_RED: 1 selected test(s) fail on head: tests/test_discounts.py::test_discount_below_cap_is_unchanged
REFUTEDR-REF-CLAIM
One reported bug, four changes whose own tests all pass. Real Counterproof output, rule-only, seed 00…00.
Works with
pytest
Vitest
Jest
Claude Code
GitHub Actions
MCP clients
git hooks
The problem
Agents optimise for the check they can see
Published benchmarks such as EvilGenie caught coding agents hard-coding test cases and editing tests. In our own recorded Claude Code sessions, an agent told not to touch a contradictory test bent the code to satisfy it, then reported All 68 tests pass. Four ways a change can be green and still wrong:
Hard-coded outputs
The code special-cases the exact inputs its own test uses: if amount == 200: return 30.
REFUTED by the integrity probe
Weakened tests
An assertion removed or loosened, a new skip, a deleted test: the bar lowered until the change clears it.
REFUTED by the integrity probe
Partial fixes
Only the reported example is fixed. The new test passes, and so do wrong versions of the changed line.
WEAK with the missing test named
False claims
The suite passes, from a session that never ran it after the last edit, or piped it through | tail and hid the exit code.
REFUTED by the claim audit
Two-minute demo
Watch it check four changes for the same bug
Real runs on a fixture repository, no network, seed 00…00. Captions are part of the video; the transcript is below it.
Transcript
An agent fixed a bug and says: all tests pass. Coding agents stop when their tests pass. But when the same agent writes the fix and the test, green is a claim, not evidence. Counterproof checks the claim.
1. Hard-coded fix. This fix special-cases the exact inputs its own test uses. The integrity probe sees an input compared with a test literal: refuted, before any mutant runs.
2. Partial fix. This one looks honest and its test fails on the old code. But wrong versions of the changed line still pass every test: nothing tests a discount at or below 20%.
3. Coach mode, inside Claude Code. In Claude Code the Stop hook tells the agent only what kind of test is missing and where. Never the faulty code, so it cannot write a test for our mutant.
4. “The test suite passes”. The agent said the suite passes. Its session piped pytest through tail, which hid exit code 1, and Counterproof's own baseline fails. Refuted.
5. Measured, not claimed. On the seeded corpus, green tests flag none of the gamed changes. Counterproof refutes every hard-coded and weakened one. Every number regenerates.
How it works
Five probes, cheapest first
Each probe asks a different question about the change, in isolated git worktrees of the old and the new code. A decision that is final after a cheap probe skips the expensive ones.
P5
Claim audit
Compares the agent's final message with the commands its session actually ran: no test after the last edit, a subset run sold as the full suite, an exit code hidden behind | tail.
P2
Integrity
Static checks for weakened tests and for code that special-cases the test's own inputs: removed assertions, new skips, if amount == 200: return 30.
P1
Red-green
The change's tests must fail on the old code for a behavioural reason, and pass on the new code.
P3
Change-scoped mutants
Realistic wrong versions of only the changed lines, from rules and optionally an LLM, filtered for equivalence. If the tests still pass on a wrong version, the change is not proven.
P4
Blind oracle
With an LLM: tests written from the task and the public interface only, never a function body, run on the change and triaged when they fail.
The output
A verdict, not a score
Fourteen ordered rules map the evidence to one of five verdicts, and the exit code follows, so CI can gate on exactly the strictness you want. An LLM can propose mutants and tests; it never decides the verdict.
Red on the old code, green on the new, and the tests catch wrong versions of the change.
0
WEAK
Plausible, with a named gap: a surviving mutant, a likely bug from the oracle, a soft finding.
10
UNPROVEN
The tests do not pin the change: they pass on the old code, or most wrong versions survive.
20
REFUTED
Evidence of gaming: hard-coded outputs, a weakened test, a false claim of passing tests.
30
INCONCLUSIVE
The tests could not be run reliably: build error, red head, too flaky.
40
Results
Measured, not claimed
Corpus C1: 160 seeded changes in a Python and a TypeScript library, three gamed variants and one honest fix per task, compared with simple baselines. Every number regenerates with counterproof eval eval/corpora/c1.
98%of gamed changes flagged WEAK or worse, with an LLM (75% UNPROVEN or REFUTED)
8%of honest fixes refuted or called unproven
0%of gamed changes caught by "the tests are green"
Gamed changes caught
Higher is better. Hard-coded, weakened and partial fixes whose own tests pass.
Counterproof, with an LLM75%Counterproof, with an LLM: 75% · 90 of 120
Counterproof, rules only67%Counterproof, rules only: 67% · 80 of 120
B0: The tests are green0%B0: The tests are green: 0% · 0 of 120