Two-pipeline isolation protocol (worktree and information-level)
This protocol governs how teammates are isolated from each other in the two-pipeline architecture. There are two levels of isolation: worktree isolation (filesystem-level) and pipeline isolation (information-level).
The two-pipeline architecture enforces strict information barriers between the code pipeline and the test pipeline:
spec.md (from planner), request.md, impact.mdtest-spec.md, sim-spec.md, audit.md, simulation.mdimplementation.md, code changes, unit teststest-spec.md (from planner), , request.mdimpact.mdspec.md, sim-spec.md, implementation.md, simulation.mdaudit.md, validation evidencesim-spec.md (from planner), request.md, impact.mdspec.md, test-spec.md, implementation.md, audit.mdsimulation.md, DGP code, simulation harness coderequest.md, impact.md, target repo read accessspec.md, test-spec.md, and sim-spec.md (simulation workflows only)Leader is responsible for enforcing pipeline isolation at dispatch time:
spec.md in the prompt, NEVER mention test-spec.md or sim-spec.mdtest-spec.md in the prompt, NEVER mention spec.md, sim-spec.md, or implementation.mdsim-spec.md in the prompt, NEVER mention spec.md, test-spec.md, or implementation.mdWhy: If builder knows what tests will be run, it can "teach to the test" — passing validation without actually satisfying the requirement. If tester knows how the code works, it can't provide truly independent verification. If simulator knows the implementation details, it can't provide independent evaluation of finite-sample properties. The multi-pipeline design ensures adversarial verification: all sides must independently converge on the same correct result.
Use isolation: "worktree" when dispatching any teammate that writes to the target repository:
Worktree isolation gives each writing teammate its own working copy of the repository. This prevents concurrent writers from interfering with each other and ensures that partial work from one teammate never corrupts another's checkout.
Do not use worktree isolation for non-writing teammates:
Tester is dispatched after all writing teammates (builder, simulator) complete and merge back. This ensures tester always validates the fully merged code:
The key principle: writers finish first, tester validates the merged result. This eliminates the race condition where tester might validate pre-change code.
Every writing teammate receives an explicit write surface in its dispatch prompt. The write surface lists the exact files and directories that the teammate is allowed to modify.
src/ and scriber owns docs/, neither may touch the other's directory.mailbox.md describing the needed change and continues with its own surface.status.md and files under locks/ (at .repos/workspace/<repo-name>/runs/<request-id>/locks/). Teammates must never write to these paths.implementation.md, docs.md) to the run directory. This is always within their allowed surface.Leader is responsible for ensuring non-overlapping surfaces before dispatch. If a request requires two writers to touch the same file (e.g., builder and scriber both need to edit a README that contains code examples), leader must serialize them: dispatch the first writer, wait for completion, then dispatch the second with the updated state.
The Agent tool only merges back committed changes. If a writing teammate (builder, simulator, scriber) leaves uncommitted changes in the worktree, those changes are permanently lost when the worktree is cleaned up. There is no recovery.
Every writing teammate's agent definition includes a mandatory "Before Completing" step that requires:
git add <files> — stage all created/modified filesgit commit -m "<role>: <summary>" — commit locally within the worktreeThis is a local worktree commit, not the final target-branch commit. Shipper creates the final commit later.
After a writing teammate completes in its worktree:
git log --oneline -3 and/or git diff --stat in the target repo to confirm the writing teammate's changes are present in the main checkout. If changes are missing, raise HOLD and alert the user — do NOT silently proceed.Important for two-pipeline architecture: Tester is always dispatched AFTER all writing teammates' worktrees merge back, so it validates the actual merged code — but it does so using test-spec.md scenarios, not knowledge of what builder or simulator changed.
| Teammate | Pipeline | Writes to target repo? | Use worktree? | Receives |
|---|---|---|---|---|
| planner | Bridge | No | No | request.md, impact.md |
| builder | Code | Yes | Yes | spec.md (NEVER test-spec.md or sim-spec.md) |
| tester | Test | No (runs commands) | No | test-spec.md (NEVER spec.md or sim-spec.md) |
| simulator | Simulation | Yes | Yes | sim-spec.md (NEVER spec.md or test-spec.md) — workflows 11, 12 only |
| scriber (scriber) | All | Yes | Yes | ALL artifacts (reads everything to produce process record) |
| scriber (implementer) | Docs | Yes | Yes | spec.md (NEVER test-spec.md) — replaces builder in docs-only workflow |
| reviewer | Convergence | No (reviews only) | No | ALL artifacts |
| shipper | — | No (git/gh commands) | No | review.md, credentials.md |
| leader | Control | No (runtime only) | N/A | ALL artifacts |