---
name: factory-default
description: Stand up a small multi-agent factory with isolated worktrees, a written risk packet before code, a builder then a reviewer, and a human merge gate. Use when you set up or run coding agents on a shared repository.
license: MIT
---

# Factory default

A small, fixed shape for running coding agents on one repository: an orchestrator, one builder per change, one reviewer per commit, and a human who owns every irreversible step.

## Roles

- **Orchestrator**: plans, writes tickets, dispatches lanes and reads results. It does not own a shell, a process or a port, and it does not edit code.
- **Builder**: makes one change on its own worktree and opens a pull request.
- **Reviewer**: reads the exact commit the builder produced and returns PASS or FAIL, with findings.
- **Human**: owns merge, send, pay, publish and signing.

## One graph

Keep one factory graph, and use the same one every time:

```text
ticket -> risk packet -> builder on a new worktree -> pull request -> reviewer on the exact commit -> human gate
```

Do not run a second path for the same change.

## Rules

1. **Risk packet before code.** Before writing new code, the builder writes a short risk packet: what could go wrong, how it would show, and the guard for each. The packet stays outside the change.
2. **A new isolated worktree per lane.** The builder works on a new git worktree under the project's default worktree directory, on a new branch from a named base commit. Never in the live working tree.
3. **One worker per dirty tree.** A worktree with uncommitted changes belongs to exactly one worker. Nobody else writes to it.
4. **The reviewer reads the exact commit.** Review the full commit SHA the builder reported, not a branch name that can move.
5. **Never bypass permissions.** Agents run with their tool's normal permission prompts and the repository's branch protection. No bypass flags, no skipped hooks, no admin overrides.
6. **The orchestrator owns no shell, process or port.** It does not start servers, hold terminals or run long jobs. Builders and reviewers do the hands-on work.
7. **Cap open factory pull requests.** Set a small limit on open pull requests from the factory, and dispatch no new lane while the limit is reached.
8. **The human owns send, pay, publish and signing.** Merging, sending messages, paying, publishing and signing all need a human. No agent in the factory does them.

## Setup checklist

- [ ] A default worktree directory for the project, ignored by git.
- [ ] Branch protection on the main branch, with required checks.
- [ ] A written limit on open factory pull requests.
- [ ] A named human for merge, send, pay, publish and signing.
