Planner, Builder, Reviewer Agent Team in Parallel
One coding agent doing everything is slow and grades its own work. A small team is better: a Planner that splits the work, several Builders that write code at the same time, and a Reviewer that reads every change before you merge it. The hard part is keeping them out of each other's way: two agents in one folder overwrite each other's files, fight over the checked-out branch, and race for the same port.
This tutorial builds that team in AgentRQ. Each role is its own workspace. Named events hand the work from one role to the next, with no polling and no glue code. Each Builder runs in a fork with its own git worktree and branch, so three of them can work on one repository at once without a single conflict. You stay in the loop where it matters: you merge.
Every screenshot comes from a real run on November 29, 2026: one feature request, gift cards for a checkout, went through the whole loop.
What You Build
| Role | Workspace | Folder | Fires | Gets a task when |
|---|---|---|---|---|
| Planner | planner | ~/code/shop | plan_ready, once per work item | you ask for a feature |
| Builder | builder, plus one fork per item | a git worktree each | code_changed | plan_ready or changes_requested fires |
| Reviewer | reviewer | ~/code/shop-review | review_passed or changes_requested | code_changed fires |
| You | planner | none | nothing | review_passed fires |
Three ideas make it work:
- → One role, one workspace. A workspace is an isolated queue with its own agent, its own MCP token and its own folder. The role is written in the workspace's mission, so every agent that connects reads it.
- → Events carry the handoffs. An event is a name, like code_changed. A trigger subscribes a workspace to it: each time the event fires, that workspace gets a new task built from a template, with what the publisher sent pasted in.
- → Forks keep builders apart. A fork is a copy of a workspace with its own queue and agent. On the machine, AgentRQ gives it a git worktree on a new branch, so its files, its branch and its index are its own.
Before You Start
- → An AgentRQ account, and a computer enrolled with agentrqd 0.9.3 or newer, the first release that makes fork folders. See machines and the connect agents guidelines.
- → A git repository. The example is ~/code/shop.
- → Claude Code, or any agent you start through the ACP Gateway.
Step 1: Give Each Role Its Own Folder
Never put two agents that write in one folder. Git worktrees give you several checkouts of one repository that share its history but not their files. Run this once:
Both new worktrees are detached on purpose. Git lets a branch be checked out in only one worktree at a time, and main is already checked out in ~/code/shop. A detached reviewer can then run git switch --detach on any builder's branch while that builder still has it checked out.
You only need these three folders. The forks in step 5 get their worktrees from AgentRQ.
Step 2: Create a Workspace per Role
Create three workspaces: planner, builder and reviewer. In each one's settings, set the Working Directory to its folder from step 1, and write the role in the Mission Description.
1. Its own folder. The agent starts here, and a fork of this workspace makes its worktree from this repository. 2. The role, in plain words. Say what the agent does, what it never does, and which event it fires when it is done.
The three missions used in this run:
The planner's last rule matters most: work items that touch the same files cannot be built in parallel, whatever the folders.
Step 3: Name the Four Events
Open Events, click New Event, and create one event per handoff. Each event's payload guidelines tell the agent that fires it what to send.
| Event | Payload guidelines |
|---|---|
| plan_ready | One plan item: title, files it may change, branch name (feat/ and a short name), how to test it. |
| code_changed | Branch name, last commit SHA, what changed and what the reviewer should check first. |
| changes_requested | Branch name and a numbered list of what to fix. |
| review_passed | Branch name, last commit SHA, and a one-line summary for the merge. |
Step 4: Wire Each Event to a Role with a Trigger
Open plan_ready and click Add Trigger.
1. The role that gets the task: builder. 2. Its title: Build a plan item. 3. The instructions. Click Event payload to insert {{EVENT_PAYLOAD}}, which becomes the plan item the planner sent. Event FAQ inserts the questions and answers that came with it.
Lower in the form, keep Who works on it on Agent. 1. Then fire code_changed: under When the task is completed, fire, pick code_changed. AgentRQ adds a line to every task this trigger creates that tells the agent to publish code_changed, with that task's id, before it completes. 2. Save it with Create Trigger.
Add the other three triggers the same way:
| Event | Workspace | Who | Title | Then fire |
|---|---|---|---|---|
| plan_ready | builder | Agent | Build a plan item | code_changed |
| code_changed | reviewer | Agent | Review a change | nothing: its instructions say to fire review_passed or changes_requested |
| changes_requested | builder | Agent | Fix review comments | code_changed |
| review_passed | planner | Human | Merge a reviewed branch | nothing |
The reviewer's trigger fires nothing by itself, because a trigger can chain only one event and the reviewer has two outcomes. Its instructions name both, and the reviewer publishes one of them itself. The last trigger is assigned to Human: the loop ends with a task for you, not with an agent merging to main.
Step 5: Ask for a Feature and Watch It Fan Out
Create a task in planner: "Plan gift cards for checkout. Customers should be able to buy a gift card and redeem it at checkout." The planner read the code and fired plan_ready three times, once per item. Each one became a builder task.
1. The trigger: a builder task, then code_changed. 2. One builder task per plan item, listed on the event's page.
Every task a trigger creates gets the trigger's title. We renamed the three with Edit so each one says which item it is. Spin up names the fork after the task, so this also gives the forks clear names.
Step 6: Spin Up One Builder Fork per Task
The three tasks sit in builder, but one builder agent would work through them one at a time. To run them in parallel, give each task its own fork. Hover over a task and click the bolt, 1. Spin up in a fork.
Spin up asks one question: what to run, and where. 1. The fork's name comes from the task. 2. Where its agent runs: your machine. 3. Spin up forks builder, moves the task into the fork and starts an agent there, in one step.
You can also make a fork yourself: right-click builder in the sidebar, choose Fork workspace, 1. name it and 2. click Fork. Then move tasks into it with Move Task, and start its agent.
The first time a fork's agent starts, agentrqd makes its folder in ~/.agentrq/forks, in a folder named after the fork's id:
- → The builder's folder is in a git repository, so the fork gets a git worktree on a new branch named agentrq/fork- followed by the fork's id, checked out at the builder's HEAD. The builder agent then creates the plan's branch inside it. A folder that is not in a git repository gets a plain copy instead.
- → The fork's terminal opens with the exact git worktree add command it ran.
- → The worktree also gets the builder's untracked .mcp.json and .claude folder, with the builder's own AgentRQ entry taken out, so the fork's agent connects as the fork and never as its parent. If your repository commits .mcp.json, the fork's copy gets the fork's entry and is marked skip-worktree, so its token never shows up as a change.
1. Three builder forks, each with its own agent. They sit under builder in the sidebar with a fork mark. 2. Each one works in its own worktree, on its own branch, at the same time as the others.
A fork keeps its own name, queue, agent and folder. It shares the builder's memory, skills and settings, so a lesson one builder saves, such as "run make generate before the tests", the other two read on their next task.
Step 7: The Reviewer Picks Up Every Change
When a builder finishes, it publishes code_changed with its branch, and the reviewer gets a task. This run's UI builder sent:
1. The branch to review and 2. where to look first arrive in the reviewer's task, from the code_changed payload.
The reviewer runs git switch --detach feat/gift-card-ui in ~/code/shop-review. Worktrees share one repository, so a commit made in a fork's worktree is already there, with no push and no fetch. The builder fork still has the branch checked out, and that is fine: the reviewer is detached.
Step 8: Send Requested Changes Back to the Fork
In this run the reviewer passed the UI change and found a bug in the redeem change: a gift card balance larger than the order total made the total negative. It published changes_requested with a numbered list, and builder got a Fix review comments task.
That task lands in builder, the workspace the trigger names, not in the fork that wrote the branch. Move it there: right-click the task, choose Move Task, 1. pick the fork that built the branch, and 2. click Move. The fork's agent fixes it on the same branch, in the same worktree, and code_changed sends it back to the reviewer.
Step 9: You Merge
review_passed gives you a Merge a reviewed branch task in planner: 1. assigned to you, with 2. the branch from review_passed.
Merge the branch the way you always do. From the main checkout:
Then merge the fork back into builder: right-click it in the sidebar and choose Merge into builder. 1. The dialog shows the fork's worktree. 2. Tick Delete the fork's folder on the machine to remove the worktree as well. The git branch stays, so no commit is lost, but uncommitted changes in the folder go with it. 3. Merge stops the fork's agent, moves its tasks back to builder with their threads, and removes the fork.
A merge is refused while any of the fork's tasks is unfinished, so a fork cannot be merged away with work still in it. A fork cannot be deleted or archived, only merged.
How the Team Avoids Conflicts
| Conflict | What prevents it |
|---|---|
| Two agents editing the same files | Each agent has its own folder: three worktrees you make, plus one AgentRQ worktree per fork |
| Two builders changing the same lines | The planner's mission: items that can be built in parallel touch different files |
| A branch checked out in two places | Builders work on their own branch; the reviewer checks out detached |
| A fork connecting as its parent | The fork's .mcp.json gets the fork's own entry; a committed one is marked skip-worktree |
| One builder's task picked up by another | Every fork has its own queue: its agent never sees the other forks' tasks |
| Ports taken by another builder's dev server | Give each builder a port in its plan item, or tell builders to use any free port |
| Missing .env or node_modules in a fork | A worktree has only what git tracks, plus .mcp.json and .claude. Copy the .env yourself and install dependencies in each fork |
| Work the fork never got | A fork's worktree starts at the builder's last commit: uncommitted changes in builder are not in it |
| Losing work at the end | Merging moves every task back with its thread; deleting the folder keeps the branch |
Draw It as a Workflow Instead
The triggers above fire every time their event fires. To see the same loop as a graph and run it as a named pipeline, build it as a workflow: pick plan_ready as the start event, then drag each role onto the event it reacts to. Use one or the other: a workflow step and a trigger on the same event both create a task, so you would get each task twice.
Run It Without the Web App
Everything here also works from an agent. The supervisor workspace has workspace.fork and workspace.mergeFork for forks, and events.createTrigger for the wiring. A worker agent fires events with workspace publishEvent, the same call the planner, builders and reviewer made in this run. The MCP integration page lists every tool.
FAQ
Do I need a fork for every builder task? No. A builder without forks works through its tasks one at a time, in ~/code/shop-build. Fork when you want tasks to run at the same time.
Can the forks run different agents? Yes. Each fork has its own agent: Claude Code in one, an ACP agent such as Codex or Gemini CLI in another. Pick it in Spin up, under What to run.
Where is a fork's folder, and which branch is it on? In ~/.agentrq/forks on the machine that ran it, in a folder named after the fork's id, on a branch named agentrq/fork- followed by the fork's id. agentrqd serve --forks-dir puts the folders somewhere else, such as on another drive.
What if my folder is not a git repository? The fork gets a copy of the folder instead of a worktree. The rest is the same.
Can a fork be forked? No, forks are one level deep. The supervisor workspace and archived workspaces cannot be forked either.
Should I turn on YOLO mode for the builders? Only when you trust what they run. Every permission request otherwise waits for you, which is the point of the human in the loop. The trigger form has a YOLO mode switch per trigger.