parallel-orchestrator
Skill5 starsChanged 8 days agoMITView on GitHub
On an app-dev-team project, use to launch the round's IC agents in parallel via the subagent tool (Task/Agent) once the board has ready tickets. Run by the /app-build orchestrator (the main session) as its step 2; holds the rules for safe concurrent agent execution.
In this repository25 other files it gives its agents.
- accessibility-gateSkill
- agent-isolationSkill
- architecture-builderSkill
- board-doctorSkill
- brownfield-onboardingSkill
- business-modelSkill
- content-designSkill
- context-preflightSkill
- database-migrationSkill
- defect-huntingSkill
- dependency-policySkill
- design-systemSkill
- house-conventionsSkill
- ic-workflowSkill
- intent-traceSkill
- localisationSkill
- mutation-testingSkill
- performance-reviewSkill
- prd-builderSkill
- requirements-intakeSkill
- role-activationSkill
- runtime-gateSkill
- spec-criticSkill
- sprint-plannerSkill
- team-protocolSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
One spawn per ticket, one slot per spawn: Never batch an owner's tickets into one prompt — compose takes exactly one --ticket, and two …
- Very specific: line 49
Use the slot path each lease prints (.agent-wt/ios-developer-1, -2).
- Very specific: line 67
Use its stdout as the spawn message verbatim: ticket, board entry, spec excerpts, the slot path as the project root, the integration branch …
- Very specific: line 96
It is also the studio kill switch: If .studio-stop exists at the repository root (or APP_TEAM_STOP is set), it refuses with EMERGENCY STOP …
- Very specific: line 111
Escalate the model on a retry: after REQUEST CHANGES: haiku → sonnet → opus, capped at opus, passed as the subagent tool's model parameter …
- Distinctive: line 118
persist across a sprint: instead of being respawned cold each round.
≈ “Common” is an estimate: at least 1 in 5 of the 383,637 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Parallel orchestrator
The one copy of the launch procedure, run from /app-build step 2 by the main session once
orchestrator.mjs round (step 0) is clear and the board has ready todo tickets. /app-build owns
everything before and after the launch — the round preconditions, verifying each DONE, the merge
gate, the wave pass and the journal — and holds the one copy of the verify-done outcomes, the model
ladder and the token form. Rare branches: references/build-loop-branches.md. The commands below
already enforce agent-isolation's orchestrator half; read
skills/agent-isolation/references/orchestrator.md only for a project that cannot use worktrees.
Procedure
- Pick the ready tickets from
node "${CLAUDE_PLUGIN_ROOT}/scripts/board.mjs" show --json:todo, everydependsOnmerged (qaordone) and its wave landed — a dependency whose wave is stillAWAITING INTEGRATIONis not on the integration branch the IC branches from. A ticket behind ablockeddependency is never ready and never reported by this rule — that is the doctor'sstrandedcheck at step 0. Spawn a designer, researcher or QA owner only when its ticket is ready — never "to get ahead".
1a. Preflight, then claim, then spawn — every ticket, QA- tickets included. Run
dispatch-preflight (/app-build top) first; claim only on CLEAR. Preflight checks the
scheduler's ready set, which only holds todo tickets, so a ticket claimed first is
in_progress and is refused. Then one append per ticket:
node "${CLAUDE_PLUGIN_ROOT}/scripts/board.mjs" move APP-001 claimed --by ios-developerclaimed is refused on a ticket whose dependency never merged. Spawn nobody for it and say why
in the standup. Claiming first also closes the window in which two orchestrators hand out the
same ticket.
- One spawn per ticket, one slot per spawn. Never batch an owner's tickets into one prompt —
composetakes exactly one--ticket, and two agents never share a slot. Slots are keyed<owner>-<n>, up to the scheduler's cap, so one platform can run several ICs at once. An owner with more ready tickets than free slots: the rest wait for a slot to free, in a later round.
2a. Lease the slot for each ticket:
node "${CLAUDE_PLUGIN_ROOT}/scripts/worktree-slot.mjs" lease --owner ios-developer --tickets APP-001
node "${CLAUDE_PLUGIN_ROOT}/scripts/worktree-slot.mjs" lease --owner ios-developer --tickets APP-004Use the slot path each lease prints (.agent-wt/ios-developer-1, -2). lease refuses when
the pool is full — that is the scheduler's cap (scheduler.mjs cap); raising it is a decision
about how much of the machine the studio may use, not a workaround.
2a-i. Every agent's prompt carries the destructive-command ban — git reset, git stash,
git checkout -- ., git clean, git add -A / . / commit -a (agent-isolation Rules 2, 5;
the hook enforces it).
2b. Check for file overlap, not just feature independence. List the files each ticket is likely
to touch (impl spec, the ticket's --file set). Any pair sharing a file is serialized.
Compose each agent's prompt with
spawn-prompt.mjs— do not hand-write it.node "${CLAUDE_PLUGIN_ROOT}/scripts/spawn-prompt.mjs" compose \ --root . --ticket APP-NNN --role <owner> --slot <the path lease printed>Use its stdout as the spawn message verbatim: ticket, board entry, spec excerpts, the slot path as the project root, the integration branch the IC cuts its branch from (
git checkout -b feat/APP-NNN-slug <integration branch>— never from the slot's last HEAD), the mintedToken:line, and the output contract inlined as literal text. A prompt that points at the contract gets back reports missing every field — measured, same model and role. The PreToolUse hookrequire-spawn-contract.shre-verifies every spawn naming a board ticket; a prompt it refuses was not composed.Gate roles are composed the same way, one ticket each:
--role code-reviewer(--mode design-qafor the design-QA pass, also forux-architect),tech-lead(second approval),security-reviewer(per-ticket review; required oncritical),verification-engineer,release-auditor. AQA-ticket's compose lists every ticket of the wave with its acceptance criteria and mints oneqa-engineertoken per listed ticket (Token for APP-NNN: …).
3a. Run the isolation gate, last, and obey it.
sh "${CLAUDE_PLUGIN_ROOT}/scripts/spawn-gate.sh" ios-developer-1 ios-developer-2 android-developer-1It takes the slot names you leased, because that is what has a tree each, and its exit code decides the launch:
0 GO→ spawn. With one slot it printsSERIALIZED— the legal one-writer path, valid only while the writer stays alone. Say so in the standup.1 REFUSED→ spawn nobody. It names the slots missing a worktree and prints thegit worktree addline for each. Create them and re-run, or serialize the round.2 CANNOT EVALUATE→ not a git repo. Serialize; never treat a 2 as a go-ahead.
It is also the studio kill switch. If .studio-stop exists at the repository root (or
APP_TEAM_STOP is set), it refuses with EMERGENCY STOP and the recorded reason: spawn nobody,
report what is unfinished, stop the loop. You never clear .studio-stop yourself. An operator
sets it with echo "reason" > .studio-stop and clears it with rm .studio-stop.
- Launch in a single message. Multiple subagent (
Task/Agent) invocations in the same assistant message, one per ticket, each given its own slot path. Sequential launches give up the parallelism. - Stream the reviews — do not wait for the batch. Each
DONEgoes through/app-buildstep 3 as it lands, against the baseintegration-branch.shresolves. verify-done has three outcomes —VERIFIED,REJECTED(re-spawn the developer),CANNOT EVALUATE(recordverified_static, do not re-spawn) — and the per-ticket default is--static, which is always the third. Spawn acode-reviewerfor each passing branch in the next message; reviewers run in parallel with each other and with still-running developers. - Escalate the model on a retry after
REQUEST CHANGES:haiku → sonnet → opus, capped at opus, passed as the subagent tool'smodelparameter (/app-buildstep 4). Arejectedverify-done retry is not an escalation: nothing was reviewed, so nothing said the work was hard.
Warm managers (optional — the portable default is respawn)
Where the harness supports named agents plus SendMessage, tech-manager and tech-lead may
persist across a sprint instead of being respawned cold each round. The only condition that
makes this safe: all durable state stays in files — the event log, the ledger, the board, the
fragments, the round journal. A warm manager is a cache, never a source; kill it and the next cold
respawn reads the same files and continues. With no named agents, respawn per round is the
portable baseline every other step assumes.
Anti-patterns
- Sequential launches when parallel is safe; parallel launches when two tickets share a file.
- One prompt carrying several tickets, or a second ticket in a slot still holding the first.
- Editing
docs/31-board.mdto record a result — it is generated from the log. - Retrying past a refusal — exit 1 from
board.mjsis a rule catching something; fix what it names. - Believing a
DONEyou did not verify, or spawning against a board you did not check. - Spawning without running
spawn-gate.sh— isolation you remembered is not isolation you checked. - Re-spawning after
REQUEST CHANGESat the tier that just failed.
Worked example
APP-001 todo ios-developer APP-003 todo backend-developer
APP-002 todo android-developer APP-004 todo ios-developer
APP-005 todo ios-developer (depends on APP-001)
[same message] Agent(ios-developer, APP-001, ios-developer-1) · Agent(ios-developer, APP-004, ios-developer-2)
· Agent(android-developer, APP-002, android-developer-1) · Agent(backend-developer, APP-003, …-1)
[as each DONE verifies] Agent(code-reviewer, feat/APP-00N-...)APP-005 is not launched until APP-001 merges; then it gets a fresh slot, branched from the integration branch, in parallel with whatever else is ready.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

