Edison SinaniAI implementation architectBook a call

AI Team Playbook / Rule 6 of 12

One task, one worktree, one pull request

Every task is built in its own worktree, on its own branch, and lands as one pull request under 400 changed lines.

Contents

The playbook

  1. Overview

Before code

  1. 1Write the constitution first
  2. 2One instruction file, under 200 lines
  3. 3Prose is advice, hooks are enforcement
  4. 4Three gates before any code
  5. 5A walkable demo before any screen

Building

  1. 6One task, one worktree, one pull request
  2. 7Every contract has a file and two tests

Reviewing

  1. 8AI review first, and filtered
  2. 9Human review by risk tier
  3. 10Done means the evidence is in the pull request

Over time

  1. 11Measure five numbers from day one
  2. 12Protect the people who are still learning

Appendix

  1. AInstall checklist
  2. BOther tools, limits and sources
  3. CTightening the process
  4. DRun the agent with no entitlements

Get the kit

Who owns it
Every developer. The lead may allow an exception with the override label and a written reason.
In the kit
.github/workflows/ci.ymldocs/specs/_template/tasks.mddocs/review-policy.md
Enforced by
The pr-size check in CI fails any pull request over 400 lines unless it carries the size/xl-override label. Branch protection requires the check.

Why

In 107,026 agent-written pull requests, the smallest tenth, with a median of two lines changed, conflicted on merge about 10 percent of the time. Pull requests of 46 to 185 changed lines conflicted 32 to 33 percent of the time [3]. Reviewers also go through 11.8 percent more review rounds on agent-written code than on human-written code [4]. Both costs grow with size, and both are paid by a human.

Why 400. It is about the point where a careful reviewer can still hold the whole change in their head in one sitting. Zalando’s teams, after watching agent pull requests grow, agreed fixed size limits among themselves rather than enforcing them with tooling [11]. A team that wants a different number writes its reason into the review policy.

How

Start each task in a worktree. A worktree is a second working copy of the repository on the same machine, on its own branch. Two developers, or one developer with two tasks, never touch each other’s files.

# from the repository root, on the main branch, up to date
claude --worktree task-128-2-derive-titles

The worktree lands under .claude/worktrees/, which is ignored by git. Permissions granted in one worktree are saved to the main checkout, so nobody approves the same command again for every task. When the pull request merges, delete the worktree.

Size the task before starting it. The task list from rule 4 already sized it: one pull request, one person, under a day. If it will not fit, the task’s Touches line usually shows where to split. A migration plus its code plus its screen is three pull requests, merged in order.

Run parallel tasks only when their files do not overlap. Two tasks whose Touches lists share a file are never marked [P]. Anything that changes a contract runs first, alone, and merges before anything that depends on it starts. Rule 7 says why.

Count only real lines. The CI check excludes lockfiles, snapshots, contract manifests and generated migration files. Over the limit, it fails with a message that says to split, or to add the size/xl-override label with a reason in the pull request body. The reviewer reads that reason.

Do not fix unrelated things on the way. Anything found while working on a task becomes a tracker entry, not part of this diff. This is the rule most often broken, and the one that makes review slow.

References

  1. 3Daniel Ogenrwot and John Businge, "AgenticFlict: A Large-Scale Dataset of Merge Conflicts in AI Coding Agent Pull Requests on GitHub", arXiv 2604.03551, April 2026. 107,026 pull requests. arxiv.org/abs/2604.03551
  2. 4Suzhen Zhong, Shayan Noei, Ying Zou and Bram Adams, "Human-AI Synergy in Agentic Code Review", arXiv 2603.15911, March 2026. 278,790 review conversations across 300 open source projects. arxiv.org/abs/2603.15911
  3. 11Zalando Engineering, "Agentic Engineering at Zalando: a snapshot", August 2026. engineering.zalando.com/posts/2026/08/agentic-engineering-at-zalando-a-snapshot.html