"Use when you are about to launch two or more subagents that will each MODIFY the same repository concurrently, such as several independent feature/kernel additions in one fan-out. Mandates git worktree isolation per agent so concurrent edits never race on shared files, every agent can run its task skill unmodified and self-validate end to end, and the orchestrator integrates afterward."
Install
npx skillscat add syfi-servingstudio/servingstudiosim/dev-orchestrate-parallel-subagents Install via the SkillsCat registry.
Dev Orchestrate Parallel Subagents
When you fan out 2+ subagents that each write to the same repo, give each its
own git worktree. Do NOT run concurrent writing agents in one shared working
tree.
For how to split a whole arch addition into lanes, seedev-parallelize-arch-addition; this skill covers one writing agent's
isolation.
This is an orchestration concern, not a task concern: keep it out of the
task-specific skills (they should describe the normal single-agent flow). The
isolation lives here.
Why worktrees
- Shared-file races. Concurrent read-modify-write on shared files (module
barrels,mod.rs,__init__.py, lockfiles, registries) clobber each other —
the last writer silently drops the others' edits. - Flaky whole-repo validation.
cargo test/pytestover a tree that
several agents are mid-writing produces false failures. - Clean skills + clean roles. With isolation, each agent runs its task skill
unmodified (wire barrels, build, test, all in its own copy), self-validates end
to end, and you never hand-do implementer work. The task skill stays
single-agent; "don't stomp siblings" stops being its problem.
How to launch
- One worktree per agent: Agent tool
isolation: "worktree"(orgit worktree addand point the agent at it). One worktree = one branch = one
agent. - Tell each agent it OWNS its worktree: it MAY edit shared barrels and run full
validation freely — no sibling can stomp it. (Drop any "defer barrels / don't
run cargo" constraints — those were only needed for shared-tree runs.) - Each agent keeps its notes in its worktree's
progress.md(not committed)
and ends with a report to you: commit, files, tests, and anything that
departs from its brief.
Reuse the heavy envs (don't rebuild per worktree)
A fresh worktree has no gitignored build state (.venv, target/). Avoid
multi-GB rebuilds:
- Python / uv: the uv cache already holds every wheel (the main
.venvwas
synced from the same lock). When the cache and the worktree share a filesystem,uv sync/uv runhardlinks/clones from the cache — no download, no copy,
near-instant. If they are on different filesystems (copy fallback), either setUV_CACHE_DIRonto the worktree's filesystem, or setUV_PROJECT_ENVIRONMENT=<main>/.venvsouv runreuses the main env directly
(zero work; valid because the worktree'spyproject/lock are identical). - Rust / cargo: optionally
CARGO_TARGET_DIR=<main>/targetto share build
artifacts — concurrentcargothen serializes on the build lock (correct, just
not parallel at the compile step). Otherwise each worktree compiles fresh.
Integration (orchestrator, after agents finish)
- Review each worktree's diff and its report.
- Merge: new files are disjoint; the shared barrels get a one-line addition per
agent → take the union of those lines (a trivial conflict to resolve).
Fold each agent'sprofiling/profile.dbrows in withlauncher kernel-profile merge-db, never by choosing one side, and commit
the database separately (dev-finalize-model-additionstep 5). - Run one consolidated validation on the merged tree: whole-repo build +
tests + any cross-agent invariant that only holds on the union (e.g. a
registry validator that sees all agents' entries only after merge — each
isolated worktree validated against just its own + baseline). - Stop each finished agent once it has no Slurm job or tmux session left.
- Retire merged worktrees by archiving them under
old-wt/, as the rootCLAUDE.mddescribes; nevergit worktree remove. Keep the rootworktree.mdcurrent.
When NOT to isolate
- A single writing agent (no concurrency) — use the normal tree.
- Read-only / research agents — no writes, no races.
- Agents provably on fully disjoint files with zero shared-file edits — but
barrels / lockfiles usually betray hidden sharing; when unsure, isolate.