ProofRun – AI 编程智能体的本地验证凭证
ProofRun – a local verification receipt for AI coding agents

原始链接: https://github.com/yebiguo/ProofRun

**ProofRun** 是一款验证工具,它能将测试结果与你的确切代码状态进行加密绑定。尽管 AI 编程助手常声称“测试已通过”,但它们可能依赖的是过时的运行结果。ProofRun 通过追踪代码的特定指纹(包括 Git 提交和未提交的更改)消除了这种模糊性。 如果你的代码哪怕改动了一个字节,ProofRun 也会自动将测试状态标记为 **STALE(过期)**,确保你永远不会依赖假设。 **主要功能:** * **确定性准确:** 它绕过基于 AI 的验证,改为执行真实的子进程并记录实际的退出代码。 * **拒绝“可能”:** 结果被严格分类为 `PASS`(通过)、`FAIL`(失败)、`STALE`(过期)或 `NOT RUN`(未运行)。 * **参数数组精确匹配:** 它比较的是实际的命令数组而非字符串,从而防止了 Shell 注入攻击。 * **离线且安全:** 无需网络调用、遥测或账户。 * **CI/CD 集成:** `proofrun status --strict` 命令可用于提交前钩子(pre-commit hooks)或 GitHub Actions,在所有必要测试针对当前状态成功运行之前,拦截部署流程。 ProofRun 旨在实现可问责性,它提供了一种强大的方法来验证你的代码是否确实经过了测试,而不仅仅是“大概没问题”。

抱歉。
相关文章

原文

ProofRun: run a check, it PASSes, edit the code, it goes STALE automatically

ProofRun doesn't judge whether your code is correct. It proves — cryptographically, not by asking nicely — which checks actually ran against the exact code you have right now.

An AI coding agent says "all tests pass." Is that true?

Maybe. It was true the last time the agent actually ran the tests. But that might have been three edits ago. The agent might not even remember running them — it might just be inferring "the change looks right, tests probably still pass." From the words alone, you have no way to tell "I ran it and it passed" apart from "I'm pretty sure it would pass."

ProofRun closes that gap. Not by making the agent more honest — by making the claim itself checkable.

$ proofrun run test -- pytest
...
test: pass (exit 0, 1841ms)

$ proofrun status
test                 PASS    (exit 0, 1841ms)

# code changes after this point — agent or human, doesn't matter

$ proofrun status
test                 STALE   (last run: pass, exit 0 — code changed since)

Every check result is bound to a fingerprint of your exact code state: the git commit, plus a hash of everything uncommitted — staged or not, tracked or not. Change a single byte, and the result flips to STALE automatically. Nobody has to remember to ask "does this PASS still count?"

curl -L https://github.com/yebiguo/proofrun/releases/download/v0.2.0/proofrun_linux_amd64.tar.gz | tar xz
# other platforms: https://github.com/yebiguo/proofrun/releases

Or build from source:

go install github.com/yebiguo/proofrun/cmd/proofrun@latest
proofrun init                      # writes .proofrun.yml
proofrun run test -- pytest        # runs pytest for real, binds the result
proofrun status --strict           # non-zero exit if anything isn't PASS

Why this, not just trusting the agent

  • No LLM calls, anywhere. ProofRun doesn't use AI to verify AI. It starts a real subprocess and reads its real exit code — that's the entire mechanism.
  • Four statuses, never a guess. PASS, FAIL, STALE, NOT RUN — each one comes from an observed execution, or the documented absence of one. There's no fifth "probably fine."
  • Fully offline. Zero network calls, zero telemetry, zero accounts.
  • Argv-exact, not string-matched. A check declared as pytest -k "foo bar" can't be satisfied by a command that merely looks similar once flattened to text — ProofRun compares real argument arrays, not strings.

What ProofRun deliberately does not do

It does not parse test output, does not judge code quality, and does not auto-fix anything. See AGENTS.md for the complete boundary.

Built by an AI agent, held accountable by one

ProofRun was written by an AI coding agent (Claude Code) under human direction, then went through several rounds of independent, read-only adversarial review before the first release. That review found that ProofRun's own command comparison could be tricked: a misquoted shell argument made a check silently run zero tests and still report PASS. Full repro, the exact fix, and why a simple patch wasn't enough → docs/case-study.md.

Every fix was verified against a real reproduction before being accepted — not just reviewed for plausibility. A tool built to hold AI agents accountable has no business existing if it can't survive that same scrutiny applied to itself.

proofrun init                      # generate .proofrun.yml
proofrun run <check-name> -- <cmd> # run <cmd> for real, bind exit code + duration to current git state
proofrun run-all [--only <name>]   # run every declared check, saving a result after each one
proofrun status [--strict]         # PASS / FAIL / STALE / NOT RUN per check; --strict exits non-zero if a required check isn't PASS
proofrun report [--json]           # full report, human- or machine-readable
checks:
  test:
    command: [pytest]
    required: true
  build:
    command: [npm, run, build]
    required: true
  lint:
    command: [ruff, check, .]
    required: false

command is an argv list, not a shell string — ProofRun never goes through a shell, and comparing what actually ran against what's declared has to be exact, element for element. required: true is what makes a check block status --strict, which is what you'd wire into a pre-commit hook or CI gate.

How the fingerprint works

Every result is bound to your current git HEAD plus a SHA-256 hash of git diff HEAD combined with the contents of any untracked, non-ignored files. proofrun status recomputes that fingerprint every time and compares it against what's stored locally — any mismatch, down to a single changed space or one new file, reports STALE.

on: pull_request
permissions:
  contents: read
jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: yebiguo/proofrun@v1

This does its own checkout of the exact PR head commit — it never trusts whatever the calling workflow already checked out, so a pull_request trigger can't silently hand it GitHub's synthetic merge-preview commit instead. It then clears out any receipt.json that came in on the PR branch, downloads a checksum-verified proofrun binary, and runs proofrun run-all for real before gating on proofrun status --strict. Nothing about a receipt checked into the PR branch is ever trusted — every result the gate sees was produced by this run.

Known limitation: this does not protect .proofrun.yml itself from being weakened by the same PR that changes the code — a PR could loosen or remove a check's command and the Action would faithfully re-run the weaker version. It warns (via a build annotation) when .proofrun.yml differs from the PR's base branch, but it does not block on that; review that diff the same way you'd review any other part of the change.

  • v0.3 — structured output support for common test runners (pytest, Jest, JUnit)
  • Signed, tamper-evident receipts are on the radar, not yet designed
  • Protecting .proofrun.yml itself from being weakened within the same PR that changes the code (currently only warned about, not blocked — see "Known limitation" above)

Issues and PRs welcome. This is a young, pre-1.0 project with a narrow, deliberate scope — see AGENTS.md before proposing anything that touches STALE detection or the receipt schema; those are the parts this project can least afford to get wrong.

MIT

联系我们 contact @ memedata.com