← knowledge.oriz.in

Parallel fan-out by default (background subagents)

rule rulesagentsubagentsparallelcontext-windowproductivity

Parallel fan-out by default (background subagents)

Sibling rule of parallel-by-default.md. That file says why to fan out. This file says how — concretely, using the harness's Agent tool with run_in_background: true, and sized to keep the orchestrator below Anthropic context-window limits.

What

Any work that can be parallelised across files, sites, services, or research questions MUST be fanned out via background subagents. The orchestrator (the chat agent the user is talking to) MUST NOT do that work itself when 2+ subagents could do it concurrently.

Sequential execution is the EXCEPTION, not the default. When chosen, it must be justified in the commit message, the task description, or the agent's reply.

Why

Three independent reasons, any one of which is sufficient:

  1. Anthropic context-window limits. Each subagent has its own context window. Searching 17 files in the orchestrator burns 17 files of orchestrator context. Searching them in 17 subagents returns one summary line per agent and burns ~zero orchestrator context. The user runs out of conversation 10x slower this way. See for current model context-window numbers — never answer from memory.
  2. Wall-clock. N parallel agents complete in roughly the time of the slowest one, not the sum. For a family of 11 sites + N extensions, this is the difference between minutes and an afternoon.
  3. Orchestrator availability. While background agents work, the orchestrator stays free to answer MCQs, accept new instructions, and refine the plan. Sequential blocks the user.

How

Use the Agent tool with run_in_background: true

Agent(
  description: "short label",
  prompt: "self-contained task; absolute paths; what to return",
  subagent_type: "general-purpose" | "Explore" | "claude" | ...,
  run_in_background: true
)

Choose the right subagent_type

Need Agent type
Search across many files / dirs Explore (read-only, summarises)
Multi-step task with edits + commits general-purpose or claude
Plan-only, no edits Plan
Catch-all claude

Worktree isolation

For agents that will edit files, pass isolation: "worktree" so each agent gets its own git worktree and they don't trample each other. The harness auto-cleans worktrees that are unchanged.

When NOT to fan out

Sequential is correct when:

In those cases, say so explicitly in the commit message or task description: "sequential because step 2 depends on step 1 output."

Examples (from this repo)

See also