<< All versions

Skill v1.0.0

currentAutomated scan96/100
cure-consulting-group/productengineeringskills/parallel-agent-orchestration
──Details
PublishedNovember 20, 2026 at 03:39 AM
Content Hashsha256:7ef355d7729e73fb...
Git SHA81e93573aff9
──Files
Files (1 file, 7.3 KB)
SKILL.md7.3 KBactive
SKILL.md · 139 lines · 7.3 KB

name: parallel-agent-orchestration description: "Runs parallel agents on one repo: decomposition, locks, budget, merges. Use when splitting a wave of work across 2+ agents or subagents." when_to_use: "NOT worktree mechanics (use git-worktree-manager). NOT unattended or scheduled runs (use engagement-automation)." argument-hint: "[wave-or-ticket-list]" metadata: version: "1.0.0" verified: 2026-09-23


Parallel Agent Orchestration

The operating model for running multiple agent sessions on one project at once. git-worktree-manager owns the mechanics (creating worktrees, ports, env files); this skill owns the judgment: what parallelizes, who owns the merge, how the token budget splits, and what must never run twice.

Cure default: any wave with 3+ independent tickets, or any day where a feature session and a review/hotfix session run simultaneously. Done when every ticket has a gate, an owner, and a place in the merge order.

When to delegate (and when not)

Delegate to subagents only when the work splits into pieces that are large (each worth a fresh context), independent (no shared files), and gated (iron rule 3). Small, coupled, or judgment-heavy work stays in one session. Caps: at most 4 concurrent writing agents and one level of nesting — subagents don't spawn subagents. Claude Code's defaults are far looser (20 concurrent, depth 3), so set CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS=4 and CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=1 (v2.1.217+) for fleet work. Codex won't spawn subagents unless told to, so when this skill's criteria are met, say explicitly "spawn one subagent per ticket below". Antigravity's /swarm (preview since 2026-11-10) fans one prompt out to a coordinator, workers in their own worktrees, and verifiers. It has no supported agent cap yet (the env vars above don't reach it) and burns quota faster, so don't use it for fleet work until it has one.

The iron rules

  1. One ticket = one worktree = one branch = one session. No agent works

across ticket boundaries. A session that discovers out-of-scope work files a ticket; it does not fix it.

  1. Parallelism buys wall-clock, not capacity. Rate limits are per-account

and shared: four concurrent Opus sessions burn one budget 4× faster. Parallelize to compress calendar time, never to "get more tokens."

  1. A script declares done, not the agent. Every parallel ticket needs an

executable acceptance gate (tests, lint, grep-check) before it is spawned. No gate → not parallelizable yet → write the gate first.

  1. Humans hold the merge. Parallel branches are proposals. Merging is a

serial, human act — this is the control that makes everything else safe.

  1. Brief isolated agents on shell discipline. A subagent spawned with

isolation: worktree may only run commands the harness can prove stay in its worktree. Every brief says: one plain command per Bash call; no cd $(…), loops or pipelines around git; no npx $var; wait with Monitor, not sleep. Unbriefed, these refusals were 37% of all agent tool errors across Cure repos (Aug–Oct 2026), nearly all from orchestrator-spawned general-purpose agents.

Step 1: Classify the parallel work

ScenarioPattern
Wave of scoped tickets (BACKLOG style)Worktree per ticket, cheap-model mechanical tickets first, judgment tickets serial on the strong model
Feature + hotfix + PR review same dayLong-lived feature worktree + two ephemeral worktrees (see git-worktree-manager)
Repo-wide mechanical changeOne orchestrating session fanning out subagents, one worktree each (Claude Code: isolation: worktree), not N manual sessions
Audit/review of a large surfaceParallel read-only subagents, one synthesis session; no worktrees needed (nothing mutates)
Two agents editing the same moduleDon't. Re-decompose until they don't (Step 2)

Step 2: Decompose along module boundaries, not ticket numbers

Merge conflicts scale roughly with the square of concurrent branches touching shared files. Before spawning sessions:

  1. List the files/dirs each ticket will touch (from its scope line).
  2. Overlaps between two tickets → serialize those two, or re-cut the boundary.
  3. Files everyone touches (lockfiles, generated docs, version manifests) →

designate ONE owner branch; everyone else leaves them alone and the owner regenerates after merge.

  1. If you can't predict the touched files, the ticket is under-scoped —

sharpen it before parallelizing, not after the conflict.

Step 3: Budget the fleet

Work typeModel/effortConcurrency
Judgment: architecture, review, audits, tricky debuggingStrong model; start at its default effort and raise only where your evals show a gain (Opus 5.5's default medium matches Opus 5 at high)Serial, or 2 max
Mechanical: migrations, test fixes, doc gen, scaffoldsCheaper model / lower effortParallel freely
Verification of others' outputStrong model, but read-onlyParallel (no write conflicts)

Watch the shared budget: if sessions start rate-limiting each other, cut concurrency before cutting model quality on judgment work.

Give a lead agent a time signal: append elapsed <s>s / <budget>s to each message the harness sends it (set the budget a little above the time you want), or, if you can't estimate one, tell it "Time matters here: the earlier a correct result is obtained, the better." Opus 5.5 paces to it and parallelizes more; a budget is advisory, so keep a hard timeout if you need one.

Step 4: Blast radius → autonomy

Extends Cure's unattended-run rule ("unattended runs report, humans apply"; full list in the plugin repo's docs/AUTOMATION.md) to interactive parallel work:

Blast radiusAutonomy
Low (additive files, isolated module, gate-covered)Run unattended in its worktree; review at merge
Medium (shared modules, config, CI, public interfaces)Run attended; human reads the diff before PR
High (migrations, deploys, releases, secrets, deletions, anything regulated)Never parallel, never unattended. Single owner, serial, human confirms each step

Step 5: Mutual exclusion on destructive ops

Two sessions must never both believe they own a destructive operation. Convention: a .cure-locks/ directory at repo root (gitignored).

bash
# claim (fails loudly if held)
mkdir .cure-locks 2>/dev/null; ln -s "$(git branch --show-current)-$$" .cure-locks/migrate 2>/dev/null \
|| { echo "LOCKED by $(readlink .cure-locks/migrate)"; exit 1; }
# release when done
rm .cure-locks/migrate

Locked ops: db migrations, release.sh, deploys, seed/reset scripts, secrets, billing — anything that is never run unattended. Stale lock (owner session gone) is a human call to break — never auto-broken by an agent.

Step 6: Merge discipline

  1. Merge order: lowest-risk first; the shared-file owner branch last.
  2. Every branch re-runs its gate after rebase — a green branch pre-rebase

proves nothing post-rebase.

  1. One conflict-heavy merge means Step 2 failed: fix the decomposition for

the next wave, don't get better at resolving conflicts.

Anti-patterns

  • Two sessions in the same working directory (silent overwrites — always a

worktree per session).

  • Parallelizing to "go faster" on judgment work: review quality drops faster

than wall-clock does.

All versions