Skip to content

Commit 4d6b8f5

Browse files
sourcehawkclaude
andauthored
fix(skills/fanning-out-with-worktrees): give each dispatched subagent a scratch folder of its own (#78)
Parallel subagents share the orchestrator's scratchpad. Two of them that write a temporary file of the same name, such as a PR body for --body-file, overwrite each other, and a PR can go out with its sibling's body. The worktree isolates the repo, not these files. The dispatch prompt now carries the absolute path of a folder that only that subagent uses, and the rule to write its temporary files there. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5da32db commit 4d6b8f5

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • skills/fanning-out-with-worktrees

‎skills/fanning-out-with-worktrees/SKILL.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Each dispatch prompt MUST include:
6161
3. **Implementation skills.** `superpowers:test-driven-development` + `feature-dev-workflow:testing-a-feature` for every change, and `feature-dev-workflow:writing-code-comments` for every comment the change adds, edits, or deletes.
6262
4. **PR completion.** A stack layer's subagent skips this item and reports to the orchestrator, which opens the stack's PRs (see the stack paragraph above). A sequential layer's subagent reports its finished branch and head commit without pushing, because the orchestrator pushes the stack's worktree with `gh stack push`. A parallel layer's subagent pushes its branch from its temporary worktree first, then reports. Every other subagent, when the implementation is done and verified, invokes `feature-dev-workflow:opening-a-pull-request`. The base and body keyword depend on `sub_pr_target` in the state file: when `feature-branch`, use `--base <type>/<slug>` and `Towards #<sub-issue>` in the body (`Fixes`/`Closes` don't fire on non-default-branch merges; `Towards` keeps the issue open until the orchestrator closes it manually after the merge); when `main`, use `--base main` and the type-appropriate closing keyword in the body — `Fixes #<sub-issue>` for a bug sub-issue, `Closes #<sub-issue>` otherwise; either fires automatically on merge to the default branch (see `feature-dev-workflow:opening-a-pull-request` for the distinction). No sub-PR keyword closes the epic, and in main mode the epic stays open for the user (see Step 7). The subagent reports the PR URL back to the orchestrator.
6363
5. **Bounded commands.** The bounded command line for every heavy command the subagent will run (tests, lint, build, typecheck), copied from the orchestrator's record, and the rule to use no other form. A subagent does not see the orchestrator's project memory, so a prompt without them sends it to the plain commands, and a wave of plain test runs is what freezes the machine. **REQUIRED SUB-SKILL:** `feature-dev-workflow:bounding-heavy-commands` (§Dispatching subagents) before writing the first dispatch prompt of a wave. When the wrapper cannot run on the machine, its §When the wrapper cannot run decides the prompts and the order of the dispatch.
64+
6. **A scratch folder of its own.** The absolute path of a folder that only this subagent uses for files that do not belong in the repo: PR and comment bodies for `--body-file`, review output, logs, and one-off scripts. Make it `<scratchpad>/<sub-name>/` when your harness gives you a scratchpad or temporary directory, or a fresh `mktemp -d` when it does not, and create it before the dispatch. Tell the subagent to write such files there and nowhere else. A worktree isolates the repo, not the temporary files: subagents get the orchestrator's scratchpad, so two that write a file of the same name, such as `pr-body.md`, overwrite each other, and a PR goes out with its sibling's body. Use the same folder in every later message or re-dispatch to that subagent's sub-PR.
6465

6566
Each dispatch prompt also carries this instruction for the subagent: **OPTIONAL SUB-SKILL:** `simple-english:simple-english` for the prose of your commit bodies, code and doc comments, and PR body. If it is available, load it before you draft and write the sentences under it. Where its formatting rules (headings, bold, lists, or its register for chat replies) differ from the host skill or its template, the host skill and its template win. It sets sentence style only: the commit subject keeps the project's commit convention, and the project's comment rules still decide whether a comment exists and what it may say. If it is not available, do not stop or wait for it: write short, plain, active sentences and say in your report that it was missing. The orchestrator, not the subagent, gives the user the install hint (`/plugin marketplace add AminBlg/SimpleEnglish`, then `/plugin install simple-english@simple-english`), at most once per session.
6667

0 commit comments

Comments
 (0)