diff --git a/prompts/08_subagents.md b/prompts/08_subagents.md index 7ad2b79..e1ecbbd 100644 --- a/prompts/08_subagents.md +++ b/prompts/08_subagents.md @@ -37,10 +37,22 @@ Prompt is all remaining arguments after flags. - N = 1: raw result - N > 1: results separated by `=== {job-id} ===` headers, in submission order +## Heterogeneous fan-out + +To run N subagents with N different prompts, combine with `execute_code` parallel steps — each step is one `subagent_spawn` shell invocation: + +``` +execute_code: steps=[ + {code: "subagent_spawn 'Summarize core/pkg/agent/loop.go'"}, + {code: "subagent_spawn 'Summarize core/pkg/backend/anthropic.go'"}, + {code: "subagent_spawn 'Summarize 9p/internal/p9/server.go'"} +] +``` + +Three concurrent subagents, three different prompts. Results appear under `=== step N ===` headers from `execute_code`. + ## Design rules **Same agent across parallel subagents.** Different agents produce different output schemas; concatenating them is incoherent. **Prompt for structured output when you need to parse results.** Tell subagents the exact format to respond in (numbered list, JSON, markdown sections) so you can extract what you need from the joined block. - -**All subagents receive the same prompt.** Differentiate their work inside the prompt — include a shard index, file path, or role description if the tasks differ.