Run Counterproof in Claude Code, GitHub Actions, MCP and git
The same verification, at the moment it is cheapest to act on: while the agent is still working, when it pushes, and when the pull request opens.
Claude Code: coach mode
counterproof init --claude
This adds a Stop hook to .claude/settings.json. When Claude finishes a turn, the hook runs the fast profile on the working tree with the session transcript and Claude's final message:
- REFUTED blocks the stop, with the reason.
- WEAK or UNPROVEN returns one line of context, so Claude keeps working.
- The hint names the class of gap and its location only, never mutant code, oracle tests or the seed, and a later audit uses a fresh seed. The agent cannot simply write a test for our mutant.
From a recorded session, after Claude fixed a discount cap and added one test:
Counterproof: WEAK. A boundary change at
src/ledger/discounts.py:19is not detected by any test: add a test where the two sides of that comparison are equal.
Claude added the boundary test and stopped. The hook never re-runs while Claude is continuing because of it, gives up after 90 seconds without blocking, and needs counterproof on PATH.
GitHub Actions
Install your project's test dependencies first, then add the action. It comments one certificate on the pull request (updated on every push), uploads SARIF to code scanning and writes the certificate to the job summary.
on: pull_request
permissions: {contents: read, pull-requests: write, security-events: write}
jobs:
counterproof:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with: {fetch-depth: 0}
- run: pip install -e . pytest pytest-cov # your project and its tests
- uses: sudais-khalid/counterproof/action@v1
with:
fail-on: refuted # or unproven / weak
provider: none # or deepseek / anthropic with the matching key input
| Input | Default | Meaning |
|---|---|---|
fail-on | refuted | Fail the job at this verdict or worse |
profile | full | fast, full or paranoid |
provider | none | LLM provider; forks always run with none, so keys never reach untrusted code |
anthropic-api-key, openai-api-key, deepseek-api-key | Key for the chosen provider | |
test-python | python3 on PATH | Interpreter with the project's test dependencies |
comment, upload-sarif | true | Post the PR comment, upload SARIF |
working-directory, base, head | the PR | What to verify |
Outputs: verdict and run-id.
MCP
claude mcp add counterproof -- counterproof mcp
Any MCP client can use the stdio server. It exposes verify_change, get_report and explain_mutant. Agents get the redacted certificate (classes and locations, no mutant code) unless a human commits [mcp] reveal_mutants = true.
git pre-push
counterproof init --git-hook --fail-on refuted
Installs a pre-push hook that verifies each pushed range with the fast profile and blocks the push only at the verdict you set.