/ai-stuff:dispatching-parallel-agentsfrom ai-stuff
Use ONLY when the developer has explicitly told you to dispatch subagents — never infer or self-authorize it. Splits 2+ independent tasks across isolated subagents, assigns them cheap models, and polls at a per-harness cadence that preserves prompt cache (Claude Code vs Codex/opencode).
Ships in ai-stuff. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.
When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially wastes time. Each investigation is independent and can happen in parallel.
Core principle: Dispatch one agent per independent problem domain. Let them work concurrently.
Local modification. This skill is imported from obra/superpowers and edited to (1) require explicit developer opt-in before any dispatch, (2) mandate cheap models for subagents, and (3) specify a per-harness polling cadence. The upstream dispatch guidance below is unchanged.
Authorization must be a direct instruction in the developer's own words, for example: "use subagents", "dispatch these in parallel", "spawn an agent per test file", or "delegate this".
These do NOT count as authorization:
If parallel dispatch would clearly help but you have not been told to use it, ask once:
"This looks like N independent problems. Want me to dispatch one subagent per problem in parallel? If not, I'll work through them sequentially."
Then wait for the answer. Absent an explicit yes, do the work yourself, in this session, sequentially. Dispatching without opt-in is a failure, not initiative.
One exception: handing a single output-heavy command (log parsing, sifting
build or CI output) to a cheap model — DeepSeek via the deepseek MCP or
Claude Haiku — so only its conclusion comes back needs no opt-in.
Subagents run cheap models. You (the coordinating session) run the expensive reasoning model; the delegated work is well-scoped execution, so pay for coordination, not for helpers.
Assign subagents one of these cheap/fast models:
| Cheap model | Notes |
|---|---|
| ChatGPT Luna | Fast general-purpose executor. |
| DeepSeek v4.1 Flash | Very low cost; good for mechanical/scripted edits. |
| Claude Sonnet | Cheap tier when a subagent needs stronger reasoning. |
| Muse-Spark | Cheap tier for lightweight/creative subtasks. |
Rules:
After dispatching background subagents, check on them by polling. Polling too often re-prefills the shared prompt cache and destroys cache retention, so use the cadence for the harness you are running in.
| Harness | Poll cadence |
|---|---|
| Claude Code | Every 4 minutes (manual) for cache retention. |
| Codex | Every 25 minutes (manual). |
| opencode running OpenAI models | Every 25 minutes (manual). |
| Any other harness | Wait for completion; do not poll faster than 25 minutes unless the developer says otherwise. |
Rules:
digraph when_to_use {
"Developer told you to use subagents?" [shape=diamond];
"Multiple failures?" [shape=diamond];
"Are they independent?" [shape=diamond];
"Single agent investigates all" [shape=box];
"One agent per problem domain" [shape=box];
"Can they work in parallel?" [shape=diamond];
"Sequential agents" [shape=box];
"Parallel dispatch" [shape=box];
"Developer told you to use subagents?" -> "Multiple failures?" [label="yes"];
"Developer told you to use subagents?" -> "Single agent investigates all" [label="no - ask first"];
"Multiple failures?" -> "Are they independent?" [label="yes"];
"Are they independent?" -> "Single agent investigates all" [label="no - related"];
"Are they independent?" -> "Can they work in parallel?" [label="yes"];
"Can they work in parallel?" -> "Parallel dispatch" [label="yes"];
"Can they work in parallel?" -> "Sequential agents" [label="no - shared state"];
}
Use when:
Don't use when:
Confirm the developer authorized subagents. Then group failures by what's broken:
Each domain is independent - fixing tool approval doesn't affect abort tests.
Each agent gets:
Issue all three subagent dispatches in the same response — they run in parallel, each on its assigned cheap model:
Subagent (cheap model): "Fix agent-tool-abort.test.ts failures"
Subagent (cheap model): "Fix batch-completion-behavior.test.ts failures"
Subagent (cheap model): "Fix tool-approval-race-conditions.test.ts failures"
# All three run concurrently.
Multiple dispatch calls in one response = parallel execution. One per response = sequential.
Check on the dispatched agents using the cadence in Harness Polling Cadence (Claude Code: every 4 minutes; Codex / opencode OpenAI: every 25 minutes, else wait for completion). Do not poll faster.
When agents return:
Good agent prompts are:
Model: DeepSeek v4.1 Flash (cheap tier)
Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
1. "should abort tool with partial output capture" - expects 'interrupted at' in message
2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
3. "should properly track pendingToolCount" - expects 3 results but gets 0
These are timing/race condition issues. Your task:
1. Read the test file and understand what each test verifies
2. Identify root cause - timing issues or actual bugs?
3. Fix by:
- Replacing arbitrary timeouts with event-based waiting
- Fixing bugs in abort implementation if found
- Adjusting test expectations if testing changed behavior
Do NOT just increase timeouts - find the real issue.
Return: Summary of what you found and what you fixed.
❌ Self-authorizing dispatch: "This is obviously parallel, I'll spawn agents" ✅ Opt-in first: Wait for the developer's explicit instruction, or ask.
❌ Premium models for subagents: Running every helper on the top-tier model ✅ Cheap models: ChatGPT Luna / DeepSeek v4.1 Flash / Claude Sonnet / Muse-Spark
❌ Polling in a tight loop: Re-prefilling context and wrecking cache ✅ Harness cadence: Claude Code every 4 min; Codex / opencode OpenAI every 25 min
❌ Too broad: "Fix all the tests" - agent gets lost ✅ Specific: "Fix agent-tool-abort.test.ts" - focused scope
❌ No context: "Fix the race condition" - agent doesn't know where ✅ Context: Paste the error messages and test names
❌ No constraints: Agent might refactor everything ✅ Constraints: "Do NOT change production code" or "Fix tests only"
❌ Vague output: "Fix it" - you don't know what changed ✅ Specific: "Return summary of root cause and changes"
No opt-in: The developer didn't ask for subagents - ask first or do it yourself Related failures: Fixing one might fix others - investigate together first Need full context: Understanding requires seeing entire system Exploratory debugging: You don't know what's broken yet Shared state: Agents would interfere (editing same files, using same resources)
Scenario: 6 test failures across 3 files after major refactoring (developer explicitly said "dispatch a subagent per failing test file").
Failures:
Decision: Independent domains - abort logic separate from batch completion separate from race conditions
Dispatch (cheap models):
Agent 1 (DeepSeek v4.1 Flash) → Fix agent-tool-abort.test.ts
Agent 2 (ChatGPT Luna) → Fix batch-completion-behavior.test.ts
Agent 3 (Claude Sonnet) → Fix tool-approval-race-conditions.test.ts
Polling: Claude Code session → checked every 4 minutes until all three returned.
Results:
Integration: All fixes independent, no conflicts, full suite green
After agents return:
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub pauldotsh/ai-stuff --plugin ai-stuff25 skills in this plugin
/brainstormingYou MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation./codebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary./frontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.