Questions about Counterproof and AI-written code
How do I check that tests written by an AI agent actually test the fix?
Run counterproof verify on the change. It checks that the new tests fail on the old code and pass on the new, that no test was weakened and no input was special-cased, and that realistic wrong versions of the changed lines make the tests fail. If a wrong version still passes, the certificate names the missing test.
What is mutation testing for AI-written code?
Mutation testing makes small wrong versions of the code (mutants) and checks whether the tests notice. Counterproof mutates only the lines the agent changed, adds realistic faults written by an LLM, filters out mutants that behave the same as the original, and turns the result into a verdict a CI job can gate on.
How is this different from my CI being green?
A green suite only says the tests the change came with pass. When an AI agent writes both the fix and the tests, it can make them pass without fixing anything: hard-code the test's inputs, weaken an assertion, or fix only the reported example. Counterproof asks whether the tests would notice if the change were wrong, and whether the agent's claims match what it actually ran.
Claude Code says all tests pass. Can I trust it?
Check it. Give Counterproof the session transcript with counterproof verify --transcript, and the claim audit compares the agent's final message with the commands it actually ran: no test run after the last edit, a subset of the suite sold as the full suite, or an exit code hidden behind | tail. The other probes then check whether the passing tests prove the change at all. With counterproof init --claude, a Stop hook runs this before the agent can finish.
How do I detect reward hacking or hard-coded test outputs in agent code?
Counterproof's integrity probe flags code the change added that special-cases the test's own inputs, such as if amount == 200: return 30, and tests the change weakened: removed assertions, new skips, deleted tests. A hard-coded or weakened change is REFUTED. On the seeded corpus, every hard-coded and every weakened change was refuted (80 of 80).
How is it different from mutation testing tools like mutmut or Stryker?
Classic mutation testing mutates the whole code base with fixed operators and reports a score. Counterproof mutates only the changed lines, adds realistic LLM-written faults and an overfit mutant, filters equivalent mutants with a static check, an LLM judge and fuzzing, and combines the result with agent-aware probes (integrity, red-green, a blind oracle and a claim audit) into one verdict.
Does my code leave my machine?
Not by default. With provider = none, the default, everything runs locally and the mutants come from rules. With an LLM provider, only the changed lines, their context, the task text and test snippets are sent; secrets are redacted, .env files, lockfiles and excluded paths are never sent, and the certificate names the provider that saw code.
Which languages and test runners are supported?
Python with pytest, and TypeScript or JavaScript with Vitest or Jest. Counterproof uses the project's own environment and runners and never installs packages.
How long does a run take, and what does it cost?
On the evaluation fixtures the median full run takes under half a minute. The full profile targets five minutes for a change under 300 lines and the fast profile 90 seconds. Rule-only runs cost nothing; with an LLM every run has a hard dollar budget (0.30 USD by default), and answers are cached.
Can an agent game Counterproof itself?
Counterproof is designed against it. Coach-mode hints name the kind of missing test and its location, never the mutant or the oracle tests; a later audit uses a fresh seed; configuration is read from the base commit, so a change cannot loosen its own thresholds; and a waiver only counts once a human has committed it.
Should I block merges on WEAK?
Start with --fail-on refuted, which only fails on evidence of gaming. WEAK names a concrete gap, such as an untested boundary, and is worth reading on every pull request; teams that want tests to pin every change can gate on weak.
Does it replace code review?
No. It gives the reviewer evidence about whether the tests prove the change. It does not approve merges or judge design.
Does Counterproof change my repository?
No. Runs happen in isolated git worktrees under your cache directory, from a snapshot of your working tree. Blind-oracle tests stay in the run directory until you accept one with counterproof export-oracle.
How do I cite Counterproof?
Cite the Zenodo archive: Khalid, S. (2026). Counterproof: verifying that code changes by AI coding agents are proven by their tests. Zenodo. https://doi.org/10.5281/zenodo.24102199. That DOI always resolves to the latest version, and each release has its own DOI. The repository's CITATION.cff gives the same reference in BibTeX and other formats through GitHub's Cite this repository button.
How accurate is it?
The results page has the measured numbers for seeded changes, real Claude Code sessions and real agent pull requests, next to simple baselines, together with the limits we know about. The corpora are small, and the page says so.