Swarm
Claude Code plugin for multi-pattern multi-agent orchestration, using CC's built in Agent Swarm as the engine — dispatches and coordinates specialist sub-agents in fan-out, pipeline, map-reduce, speculative, and swarm configurations.
npx -y skills add ben-alkov/the_swarm --skill swarmAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Dispatch a swarm using any orchestration pattern. Routes to the appropriate pattern-specific skill based on the selected preset.
SKILL.md
7.6 KB, ~1.8k tokens by cl100k_base, as published. Nobody here has run it
Swarm Dispatcher
Overview
Route swarm requests to the appropriate pattern skill. Read the preset config, determine the pattern, and follow the corresponding skill.
Goal Slug Generation
When pattern skills create team names, they use the format
swarm-{pattern}-{goal-slug}-{timestamp}. Generate the goal slug
from the user's goal description
- Lowercase only
- Replace spaces and special characters with hyphens
- Remove all characters except
a-z,0-9, and- - Collapse consecutive hyphens into one
- Truncate to 30 characters maximum
- Strip leading and trailing hyphens
- Abort if empty: if the slug is empty after all transformations (e.g., goal was all special characters), abort with: "Could not generate a valid team name from the provided goal."
Examples
- "PR review" →
pr-review - "Security audit of auth module" →
security-audit-of-auth-module - "Fix the OAuth2/OIDC integration!!!" →
fix-the-oauth2-oidc-integrat
Pass the goal slug through to the pattern skill along with the goal, target, and preset.
Stale Worktree Cleanup
Before starting any swarm, check for leftover worktrees from previous sessions
git worktree list
If worktrees exist that are not associated with the current session (stale branches from crashed or abandoned swarms), offer the user two options
- Remove stale worktrees:
git worktree remove <path>for each stale entry. This reclaims disk space but the branches persist and can still be merged - Keep them: the user may want to inspect or recover work
Only worktrees whose branch names match the swarm-* naming
convention should be flagged. Non-swarm worktrees are outside
this plugin's scope.
Steps
-
Identify goal and target from the user's request. If unclear, ask
-
Read roles config from
$CLAUDE_PLUGIN_ROOT/config/swarm-roles.yaml -
Select preset or roles using the same priority as v1. When resolving roles, check for inline definitions in the preset first (entries with a
nameandpromptfield), then fall back to global role names in theroles:section- User specifies a preset name -> use it
- User specifies individual role names -> use those (fan-out)
- User describes what they want -> match to preset/roles
- Default for "review" ->
pr-reviewpreset
-
Validate config — check the resolved preset and roles for structural problems before routing to a pattern skill. Abort or warn as indicated
Required role fields
Every role referenced by the preset (whether global or inline) must have
prompt— non-empty. An inline role missingpromptmeans the agent would be spawned with no instructions. Abortsubagent_type— must be one ofExploreorgeneral-purpose. Missing or unrecognized values (typos likeExplorer) cause opaque spawn failures. Abort
Isolation consistency
If a role specifies
isolation: worktreebut itssubagent_typeis notgeneral-purpose, warn thatsubagent_typewill be overridden togeneral-purposeat spawn time (worktree isolation requires write access). This is not an error — pattern skills handle the override — but the role definition is internally inconsistent and should be fixed.Numeric fields
worker_count(swarm) andapproach_count(speculative) must be positive integers when present. Non-numeric values, zero, or negative values are invalid. AbortTopology-pattern agreement
The preset's declared
patternmust match the topology keys present in the preset config:Pattern Expected keys Unexpected keys fan-outrolesstages,nodespipelinestagesornodesbare rolestask-graphnodesstageswithoutdepends_onmap-reducemap_role,reduce_roleroles,stagesspeculativeapproach_role,judge_roleroles,stagesswarmworker_roleroles,stagesIf unexpected keys are present, warn that the declared pattern may not match the intended topology. Ask the user to confirm.
Watchdog prerequisite
If the preset has
watchdog: true, verify that themonitorrole exists in the globalroles:section. If missing, abort — the watchdog cannot be spawned without a role definition.Deprecated preset completeness
If the preset has
deprecated: truebut nosuccessorfield, warn that no replacement can be suggested. The user can still proceed.Reserved names
If any role name in the preset matches
monitororjudge, warn that these names have special behavior in hooks (exemption from quality gates, speculative gate branching). Using them as regular specialist names will cause incorrect gate logic. -
Determine pattern from the selected preset's
patternfield. If absent, default tofan-out. If the preset hasdeprecated: true, warn the user and suggest thesuccessorpreset instead. Proceed only if the user confirms -
Route to pattern skill — read and follow the corresponding skill
Pattern Skill fan-out(or absent)swarm-fan-outswarmswarm-swarmpipelineswarm-pipelinetask-graphswarm-pipelinemap-reduceswarm-map-reducespeculativeswarm-speculativeRead the skill file and follow its checklist from step 1. Pass through: goal, target, selected roles/preset, and any user context.
-
Watchdog modifier — if the preset has
watchdog: true, the lead must spawn a monitor agent immediately after creating the team (the pattern skill's "Create Team" step). Spawn it BEFORE spawning any specialist/worker agents.Use the
monitorrole from$CLAUDE_PLUGIN_ROOT/config/swarm-roles.yaml.Read
monitor_cron_interval_secondsfrom$CLAUDE_PLUGIN_ROOT/.claude-plugin/settings.json(default: 60). Include the resolved interval in the monitor's spawn prompt.name:monitorsubagent_type: from the monitor role config (typicallyExplore)run_in_background:trueprompt:- Identity: "Your name is monitor. You are part of team {team_name}."
- Immediately send a "Monitoring started" message to the team lead via SendMessage (this satisfies the idle hook gate)
- Call CronCreate with:
intervalSeconds: {monitor_cron_interval_seconds} (read from$CLAUDE_PLUGIN_ROOT/.claude-plugin/settings.json, default 60)prompt: "Check TaskList for anomalies: tasks stuck in_progress, idle workers without findings, failed or blocked tasks. Send a SendMessage alert to the team lead for each anomaly found. Do not intervene directly — report only."
- Do not intervene directly — report to the lead
The monitor does not get its own task — it observes and reports. Include the monitor in shutdown (send
shutdown_requestto it).Pattern skills do NOT spawn the monitor. This section is the single source of truth for monitor spawning.
Gives 0 of the 12 instructions most agent orchestration skills give in ~1.8k tokens
Counted across 742 of the 995 authors here whose files we hold, read 2026-08-06
- run the full test suite after integrating changesin 53 of 742, across 20 files
- reference existing artifacts by path or URLin 52 of 742, across 22 files
- dispatch one agent per independent problem domainin 50 of 742, across 17 files
- verify fixes do not conflictin 45 of 742, across 13 files
- include a suggested skills section in the documentin 45 of 742, across 15 files
- redact sensitive informationin 41 of 742, across 11 files
- save to the temporary directory of the operating systemin 39 of 742, across 9 files
- tailor the document to user-provided focus argumentsin 39 of 742, across 9 files
- spot check agent changes for systematic errorsin 34 of 742, across 7 files
- write a handoff document summarising the current conversationin 31 of 742, across 6 files
- assign each agent a specific scopein 23 of 742, across 8 files
- provide specific scope and clear goalin 23 of 742, across 5 files
Said here and by no other author read
- read the preset config and determine the pattern
- generate a goal slug from the user goal description
- lowercase the slug and remove special characters
- collapse consecutive hyphens and truncate the slug
- abort if the goal slug is empty
- read roles config from the swarm roles file
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.