Proof Agent
Independent adversarial verification for AI work. The worker and the verifier are always separate agents — self-verification is not verification.
When to Verify
Verify automatically when:
- - Subagent changed 3+ files
- ANY changed file matches:
*auth*, *secret*, *permission*, Dockerfile, INLINECODE4 - User explicitly asks for verification
Skip verification for:
- - Formatting-only changes (whitespace, linting fixes)
- INLINECODE5 changes
How to Verify
- 1. Spawn an independent verifier subagent — the worker CANNOT verify its own work
- Give the verifier ONLY: the original request, files changed, and approach taken
- Do NOT share the worker's self-assessment or test results
- The verifier must run its own commands and provide evidence
- If no subagent ran (manual changes or user says "verify this"), use
git diff output as the approach summary
Verification Prompt
Use this prompt when spawning the verifier subagent:
CODEBLOCK0
Verdicts
- - PASS — All checks passed with evidence
- FAIL — Issues found. Report to user with specifics. Retry up to 3 times if fixable.
- PARTIAL — Some checks passed, others couldn't be verified. Report what's unverifiable.
After Verification
- - PASS: Report summary to user, proceed
- FAIL: Report issues to user. If auto-fixable, spawn worker to fix, then re-verify (max 3 attempts)
- PARTIAL: Report to user, let them decide whether to proceed
Scripts
scripts/verify.sh [base-ref]
Auto-extracts git diff, changed files, commit messages, and sensitive file detection. Outputs a filled verification prompt ready to send to the verifier subagent. Default base:
HEAD~1.
CODEBLOCK1
scripts/fact-check.sh <file> [file2 ...]
Extracts and validates factual claims from files:
- - URLs → HTTP status check
- npm packages → registry version lookup
- GitHub Actions → tag/SHA existence check
CODEBLOCK2
Returns exit code 1 if any checks fail.
Configuration
Projects can customize via proof-agent.yaml in the repo root (loaded by proof_agent/config.py):
CODEBLOCK3
Key Principle
The worker and verifier must be separate agents. Self-verification is not verification.
验证代理
针对AI工作的独立对抗性验证。工作代理与验证代理始终是独立的——自我验证不算验证。
何时验证
在以下情况下自动验证:
- - 子代理修改了 3个及以上文件
- 任何修改的文件匹配:auth、secret、permission、Dockerfile、.env
- 用户明确要求验证
以下情况跳过验证:
- - 仅涉及格式修改(空白字符、代码规范修复)
- .gitignore 文件修改
如何验证
- 1. 生成一个独立的验证子代理——工作代理不能验证自己的工作
- 仅向验证代理提供:原始请求、修改的文件、所采用的方法
- 不要分享工作代理的自我评估或测试结果
- 验证代理必须运行自己的命令并提供证据
- 如果没有子代理运行(手动修改或用户说验证这个),使用 git diff 输出作为方法摘要
验证提示
生成验证子代理时使用以下提示:
验证请求
原始请求
{用户要求的内容}
修改的文件
{文件列表}
采用的方法
{工作代理做了什么——如果没有子代理运行,则使用 git diff 摘要}
你的任务
你是一个独立的验证代理。进行这些修改的工作代理不能验证自己的工作——只有你可以做出裁决。
审查清单
- 1. 正确性:代码是否真正实现了请求的要求?
- 错误与边界情况:回归问题、未处理的错误、遗漏的情况?
- 安全性:漏洞、暴露的密钥、权限问题?
- 构建:是否能顺利构建/编译/通过代码规范检查?
- 事实:任何声明、版本号或URL是否可验证?请检查它们。
规则
- - 对于每一项检查,包含你实际运行的命令及其输出
- 不要相信工作代理的任何说法
- 在运行至少3条验证命令之前,不要给出通过结论
- 你没有关于工作代理测试结果的任何信息——请独立验证
裁决
使用Markdown标题(### 通过、### 失败或### 部分通过)给出唯一的裁决:
通过
所有检查通过。每个声明都有命令输出作为支持。
失败
发现存在问题。将每个问题以项目符号列出(- 文件、行号、问题描述、严重程度:严重/主要/次要)。
部分通过
部分检查通过,部分无法验证。列出两者并提供证据。
裁决结果
- - 通过 — 所有检查通过并有证据
- 失败 — 发现问题。向用户报告具体细节。如果可修复,最多重试3次。
- 部分通过 — 部分检查通过,其他无法验证。报告无法验证的内容。
验证之后
- - 通过:向用户报告摘要,继续执行
- 失败:向用户报告问题。如果可自动修复,生成工作代理进行修复,然后重新验证(最多3次尝试)
- 部分通过:向用户报告,由用户决定是否继续
脚本
scripts/verify.sh [基准分支]
自动提取git差异、修改的文件、提交消息和敏感文件检测。输出已填充的验证提示,准备发送给验证子代理。默认基准:HEAD~1。
bash
bash scripts/verify.sh # 验证最后一次提交
bash scripts/verify.sh main # 验证自main分支以来的所有修改
scripts/fact-check.sh <文件> [文件2 ...]
从文件中提取并验证事实性声明:
- - URL → HTTP状态检查
- npm包 → 注册表版本查询
- GitHub Actions → 标签/SHA存在性检查
bash
bash scripts/fact-check.sh src/content/articles/en/my-article.md
bash scripts/fact-check.sh .github/workflows/*.yml
如果任何检查失败,返回退出码1。
配置
项目可以通过仓库根目录下的 proof-agent.yaml 进行自定义(由 proof_agent/config.py 加载):
yaml
thresholds:
minfileschanged: 3
always_verify:
- /auth
- /secret
- /permission
- /Dockerfile
- /.env
never_verify:
- /.gitignore
retry:
max_attempts: 3
escalateonmax: true
核心原则
工作代理和验证代理必须是独立的。自我验证不算验证。