Git for AI Agent Teams: Branching, Review and Provenance When Most Commits Aren't Human
说明与用途
当大多数提交由 AI 代理生成时,Git 的人类假设会失效。解决方案是将代理隔离在独立的工作树中,强制使用原子提交并添加机器可读的尾注,限制 diff 大小,执行自动化检查,并按风险分层审查。
问题
When most commits are produced by AI agents, Git’s assumptions about authorship, commit intent, review bandwidth, and human‑paced history break, causing review bottlenecks, large diffs, missing context, shared working‑tree conflicts, and attribution problems.
结果
Implementing isolated worktrees, atomic commits, structured messages, bot identities, CI gates, diff caps, and risk‑tiered reviews transforms an agent‑heavy workflow into a human‑reviewable, reversible, and provenance‑rich process.
工作流
- 1. Human writes a task spec with explicit acceptance checks.
- 2. System creates a worktree and an agent/
<task>branch from a clean main. - 3. Agent works in isolation: small commits, structured messages, bot identity.
- 4. Agent runs the full verification suite; evidence is attached to the PR.
- 5. Automation enforces gates: green CI, diff‑size cap, CODEOWNERS for sensitive paths.
- 6. Human reviews at the risk tier earned by the change—skim auto‑verified, read critical.
- 7. Merge to a protected main; branch and worktree are deleted.
- 8. If misbehaviour occurs, revert first and re‑dispatch with a better spec.
证据
Agents should commit more strictly than humans, not less, because their history will be read during incident response: Small, atomic commits. One logical change per commit, enforced by task design.
The single highest‑leverage practice: every agent works in its own Git worktree on its own branch.
Review throughput. Agents generate plausible‑looking diffs at machine speed. Human review — the actual quality gate — becomes the bottleneck within the first week.
- 记录日期: 2026-10-22T08:26:09.017Z