A two-person rule for AI coding agents
说明与用途
通过实现本地、SHA绑定的审批账本,确保 AI 代理生成的代码在经过适当审查后才能推送,防止过期审批和未经授权的推送,即使代理在无人监控的情况下运行。
问题
Ensuring that AI coding agents only ship code after a proper review, preventing stale approvals and unauthorized pushes in unattended multi-agent workflows.
结果
The twoperson workflow enforces commit-bound reviews, preventing stale approvals and unauthorized pushes, even when agents run unattended.
工作流
- Run twoperson install-hook to add a Claude Code Stop hook for the reviewer.
- Configure each agent to run in its own git worktree so inboxes resolve to the main tree.
- Builder writes a JSON review packet (goal, head SHA, files, tests) and publishes it.
- Reviewer claims the packet, records a verdict in the ledger.
- Twoperson enforces rules: rejects verdicts for unpublished packets, mismatched commit SHAs, or pushes without a matching approval.
- When a commit is rebased or amended, the approval becomes stale and is automatically refused.
- The builder cannot ship code until a valid, current review is present.
- The system logs all actions locally, providing an offline gate before any remote PR or branch protection.
证据
It records that a review happened, pins the verdict to one commit, and refuses to let the builder call anything "shipped" without one.
The Stop hook. twoperson install-hook adds a Claude Code Stop hook so the reviewer wakes when the builder's session ends, instead of polling on a timer.
- 记录日期: 2026-09-07T09:01:54.387Z