Skip to content

docs(subagent-driven-development): expand parallel-dispatch red flag with worktree pattern - #1213

Closed
zyrill wants to merge 1 commit into
obra:mainfrom
zyrill:fix/subagent-parallel-worktree-guidance
Closed

zyrill wants to merge 1 commit into
obra:mainfrom
zyrill:fix/subagent-parallel-worktree-guidance

Conversation

@zyrill

@zyrill zyrill commented Apr 18, 2026

Copy link
Copy Markdown

Problem

The current Red Flag entry in skills/subagent-driven-development/SKILL.md:

Dispatch multiple implementation subagents in parallel (conflicts)

reads as a blanket prohibition on parallelism, which throws away one of the main reasons to use subagent-driven development. The actual failure mode is shared-worktree contention, not parallelism itself.

Real-world failure modes (one shared worktree, N implementers)

  • git-index races on concurrent git add / git commit
  • pre-commit hook contention (lockfile collisions, lint state corruption, husky retries clobbering each other)
  • stash pollution — one agent's WIP leaks into another agent's diff
  • orphan-import typecheck breaks — agent A imports from a file agent B just deleted (or vice versa); both agents' commits look fine in isolation, the merged tree is broken

Fix

Per-agent isolation, not per-agent serialization. Each implementer gets its own git worktree on a short-lived branch; the orchestrator dispatches in parallel and serializes only the merge step (git merge --ff-only per branch). Read-only agents (exploration, review, audit) can still share a worktree safely.

This is exactly what superpowers:using-git-worktrees already scaffolds, so the updated line points there explicitly. Net effect: 10-agent dispatches become safe and routine instead of forbidden.

Change

One-line edit to the Red Flags section. No structural changes.

- - Dispatch multiple implementation subagents in parallel (conflicts)
+ - Dispatch multiple implementation subagents in parallel **without per-agent git worktrees** — shared-worktree parallelism causes git-index races, pre-commit hook contention, stash pollution, and orphan-import typecheck breaks. The fix is NOT to cap agent count; the fix is to give each agent its own `git worktree` on its own short-lived branch and let the orchestrator serialize the merges (`git merge --ff-only` per branch). Use `superpowers:using-git-worktrees` as the scaffolder. Read-only agents (exploration, review, audit) may share a worktree.

Origin

Hit by a real 10-agent dispatch on a Drizzle/RBAC migration sweep — every failure mode above fired in the same session. Switching to one worktree per agent + ff-only merge made the next 10-way dispatch land cleanly.

…with worktree pattern

The current "Never dispatch multiple implementation subagents in parallel
(conflicts)" line is too prescriptive — it implies parallelism is forbidden,
when the actual problem is shared-worktree contention.

Real-world failure modes when N agents share one worktree:
  - git-index races on concurrent stage/commit
  - pre-commit hook contention (lockfile collisions, lint state corruption)
  - stash pollution from one agent's WIP leaking into another's diff
  - orphan-import typecheck breaks (agent A imports from a file agent B
    just deleted, or vice versa)

The fix is NOT to cap agent count — that throws away the main reason for
subagent-driven development. The fix is per-agent isolation:

  1. Each implementer gets its own `git worktree` on a short-lived branch
  2. Orchestrator dispatches N implementers in parallel, each in its own tree
  3. Orchestrator serializes the merge step (`git merge --ff-only` per branch)
  4. Read-only agents (exploration, review, audit) may share a worktree safely

This is exactly what `superpowers:using-git-worktrees` already scaffolds, so
the new wording points there explicitly. Net effect: 10-agent dispatches
become safe and routine instead of forbidden.
@obra obra added documentation Improvements or additions to documentation subagents Retired: use skill:subagent-driven-development / skill:dispatching-parallel-agents worktrees Retired: use skill:using-git-worktrees pr-template-rules-ignored PR filed after template was added but didn't use it labels Apr 27, 2026
@obra obra added the skill:subagent-driven-development The subagent-driven-development skill label Sep 20, 2026
@obra

obra commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Hi @zyrill! I'm Claude, helping @obra triage. SDD dispatches implementers one at a time by design; changing that needs eval evidence. Changes to skill wording shape agent behavior, so they need eval evidence (see "Skill Changes Require Evaluation" in CLAUDE.md). Closing it isn't a judgment about you or your work; we're clearing out PRs against main (new work lands on dev) that aren't going in as they stand. Thanks for the contribution!

— Claude (Opus 5.5, claude-opus-5-5), Claude Code 2.1.283, session 49301b31-b716-41b8-a316-80b8461e0de9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pr-template-rules-ignored PR filed after template was added but didn't use it skill:subagent-driven-development The subagent-driven-development skill subagents Retired: use skill:subagent-driven-development / skill:dispatching-parallel-agents worktrees Retired: use skill:using-git-worktrees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants