一键导入
swarm-fan-out
Fan-out parallel specialists for concurrent analysis. Dispatch read-only reviewers, researchers, and analyzers against a target.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Fan-out parallel specialists for concurrent analysis. Dispatch read-only reviewers, researchers, and analyzers against a target.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Dispatch a swarm using any orchestration pattern. Routes to the appropriate pattern-specific skill based on the selected preset.
Map-reduce orchestration. Parallel mappers process input chunks independently, then a dedicated reducer merges all outputs.
Pipeline and task-graph orchestration. Sequential stages with dependency edges — linear chain or arbitrary DAG.
Speculative orchestration. Competing implementations in isolated worktrees, evaluated by a judge who selects the winner.
Self-claiming pool orchestration. Workers race to claim tasks from a shared pool, loop until the pool is empty.
| name | swarm-fan-out |
| description | Fan-out parallel specialists for concurrent analysis. Dispatch read-only reviewers, researchers, and analyzers against a target. |
This skill is invoked by the
swarmdispatcher. You should already have the goal, target, and selected roles from the dispatcher. If invoked directly, start from step 1.
Orchestrate parallel specialist agents for concurrent analysis of code, PRs, or topics. You become the team lead, spawn read-only specialists, collect their findings, and synthesize a unified report.
Core principle: Fan-out N specialists, collect findings, synthesize, present. No file edits, no implementation — analysis only.
isolation: worktree configured on the
roleYou MUST complete these steps in order:
Determine from the user's request:
If unclear, ask the user. Do not guess scope.
Roles come from $CLAUDE_PLUGIN_ROOT/config/swarm-roles.yaml.
Read the config file to get available roles and presets.
Selection priority:
pr-review presetIf the user requests roles not in the config, tell them what's available and ask for clarification. Do not invent roles on the fly.
The dispatcher has already validated config shape (role existence,
required fields, subagent_type values). The checks below cover
fan-out-specific semantics.
roles list must contain at least 1 entry.
If empty or missing, report the error and abort.roles list contains exactly 1 role,
warn the user that fan-out orchestration adds overhead with no
parallelism benefit. Offer to run a single agent directly instead.Only one team can exist per session. Before creating a new team, check if one already exists.
If a team exists:
TeamDelete)./resume): agents
from the previous session are gone but the team and task list
persist. Offer the user two options:
TeamDelete the orphaned team, then
proceed with a fresh swarm.TaskList for completed
tasks, synthesize any available findings from completed tasks,
then TeamDelete and optionally re-run incomplete tasks.Present the dispatch plan using AskUserQuestion:
I'll dispatch a swarm with these specialists:
- security-reviewer: Review for vulnerabilities
- performance-reviewer: Analyze performance issues
- quality-reviewer: Code quality and maintainability
Target: [files/PR/scope]
Proceed?
Do NOT spawn anything until the user confirms. No surprise token costs.
Use format: swarm-fan-out-{goal-slug}-{timestamp}
Example: swarm-fan-out-pr-review-1708200000
Generate the timestamp from the current date/time as a Unix epoch.
TeamCreate with team_name: "swarm-fan-out-{goal-slug}-{timestamp}"
One task per role via TaskCreate:
subject: imperative title (e.g., "Review authentication module for
security vulnerabilities")description: detailed scope, target files, reporting expectationsactiveForm: present-continuous spinner label (e.g., "Reviewing
authentication security")All tasks are independent — no blocks/blockedBy dependencies in v1.
For each role, spawn one teammate via Agent with:
team_name: the team name from step 5name: the role name (e.g., security-reviewer)subagent_type: from the role config (typically Explore)model: from the role config (if specified)isolation: from the role config (if specified)run_in_background: trueprompt: composed from three parts (see below)Before spawning, check each role's isolation field:
isolation: worktree is set:
subagent_type to general-purpose (even if the role says
Explore or omits the field)Role {name}: using general-purpose (worktree isolation requires write access)isolation: "worktree" to the Agent tool callisolation is absent: use the role's subagent_type as-is (default:
Explore), do not pass isolation to AgentEach teammate's prompt is composed from:
Your name is {name}. You are part of team {team_name}.
Instructions:
- Claim your task from TaskList, mark it in_progress, then completed
when done.
- Send your findings to the team lead via SendMessage when complete.
- Include a summary field in your message (5-10 words).
The prompt field from swarm-roles.yaml for this role.
## Goal
{goal description from user}
## Target
{target files, PR, scope, or other context}
{any additional context the user provided}
All task-specific context MUST be in the spawn prompt — teammates do not have access to the lead's conversation history.
Teammates send findings via SendMessage. Messages are delivered
automatically — you do not need to poll.
Normal flow: Wait for all specialists to report. Teammates go idle after sending — this is expected behavior.
Error handling:
Once all specialists have reported (or you've noted non-reporters):
Synthesize findings into a unified report organized by severity or theme, not by specialist. Cross-reference overlapping findings.
## Swarm Analysis Report
**Goal:** {goal}
**Target:** {target}
**Specialists:** {list of roles that reported}
### Critical Issues
{findings rated critical/high, with file:line references}
### Important Issues
{findings rated medium/important}
### Suggestions
{lower-priority findings and recommendations}
### Summary
{brief overall assessment — 2-3 sentences}
If specialists disagree, note the disagreement rather than silently picking one perspective.
After presenting the report:
Wait for the user to decide next steps. They may:
When the user indicates they're done:
shutdown_request to each teammate via SendMessage
(include the monitor agent if watchdog: true was active)shutdown_response from each. If an agent does not
respond after a reasonable wait, send one nudge message. If
still unresponsive, proceed — the agent may have crashed or
terminated.TeamDelete to clean up. TeamDelete is the authoritative
cleanup mechanism — it will fail if active agents remain. If
it fails, retry after unresponsive agents have timed out.subagent_type: Explore — no file
edits, no Bash, no Write. This is enforced at the agent-type level.