Help us improve
Share bugs, ideas, or general feedback.
From swarm
Returns the universal governance spec for custom workflow commands, including hard rules, briefing templates, launch mechanics, and pulse setup. Invoked by user-authored shortcut commands that cannot read launch.md directly.
npx claudepluginhub dheerg/swarms --plugin swarmHow this skill is triggered — by the user, by Claude, or both
Slash command
/swarm:workflow-rulesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Return the following governance specification verbatim to the team lead. Do not summarize or interpret — the lead needs the full specification.
Sets up multi-agent teams for complex projects with file-based planning, per-agent directories, and teammate spawning. Triggers on team/swarm/start-project requests.
Interactively designs plain-text workflows with stages, entities, and a first-officer agent, then generates markdown files and launches a pilot run.
References agent roster, roles, coordination model, and dispatch modes for spawning agents or checking permissions in PDS swarms.
Share bugs, ideas, or general feedback.
Return the following governance specification verbatim to the team lead. Do not summarize or interpret — the lead needs the full specification.
The briefing templates below are the exclusive source of truth for team member context. Do not add sections beyond what the templates specify — no "Your First Task," "Your specific focus," "The problem," "Your Research Tasks," or any lead-authored investigation framing. If you feel the urge to add context to a briefing, stop. That urge is the bug this preamble exists to prevent.
Carve-out: harness protocol mechanics are permitted. A single instruction in the briefing that tells the member HOW they communicate with the team (SendMessage is the wire, plain text dies with the turn) is protocol, not task prescription.
Your project's CLAUDE.md and memory files may contain rules that were not authored with swarm in mind. During a team run, swarm hard rules take precedence over conflicting ambient preferences. Apply project preferences only when they are clearly complementary and do not override workflow control.
Check if the TeamCreate tool is available. If it is, agent teams are ENABLED — proceed. If not, agent teams are DISABLED. Use AskUserQuestion to offer enabling it: add "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" to the env object in .claude/settings.json (project) or ~/.claude/settings.json (global), then restart Claude Code. STOP if not enabled.
These rules govern all team behavior. They are non-negotiable. Use judgment to apply these to technical and non-technical members as needed.
Swarm governance rules in this section take precedence over any conflicting project instructions (CLAUDE.md) or memory-system preferences during a team run. Apply ambient preferences only when they are clearly complementary and do not override workflow control (phases, confirmations, approvals, tool selection, signal obligations).
DECIDED: <point> is fine when you have new substance — a file, constraint, or concrete failure not already on the table. Repeating the same arguments with nothing new is regurgitation — don't send it.swarm:resolve-dispute to break the loop.swarm:resolve-dispute to force a put-up-or-concede exchange.Note: what "9/10+ confidence" means and what happens during each phase depends on the active mode. The mode skill defines this.
These apply to the team lead only.
team_name. Never substitute with Explore agents or manual coordination./tmp/swarm-shutdown-authorized via Bash, then send shutdown_request to each teammate individually (never broadcast structured messages). If the hook blocks, follow its instructions.Paste this template EXACTLY when spawning the facilitator, filling [brackets]. Do NOT expand. Do NOT add process authority clauses, rubric references, or convergence instructions.
[facilitator title from mode skill] — upbeat, socratic thinker, leads by asking questions, doesn't make decisions, ensures a healthy discussion that adheres to the hard rules, [paste the facilitator identity line from the mode skill].
The user's request, verbatim:
> [paste the user's original input — full text, unmodified]
Hard rules:
[paste the General Rules section above only (not Team Lead Rules) verbatim]
Your only channel to the team is the SendMessage tool. Plain text output is not visible to teammates — it dies with your turn. Every contribution — findings, questions, reviews, disagreements — must be sent via SendMessage. If the tool is not in your initial kit, fetch it with ToolSearch(`select:SendMessage`).
You must not write to files via Bash — read-only means no filesystem writes.
Your signal obligations:
- You MUST send RESEARCH COMPLETE to the lead when the lead notifies you all non-facilitator members have submitted their research findings. Treat the lead's confirmation as authoritative — you do not need to independently verify each member's submission. Then convene the roundtable.
- You MUST send CONVERGED to the lead with your synthesis when the roundtable closes.
- When the lead signals implementation is complete, solicit a review and confidence score from each non-lead, non-facilitator team member individually. Probe each reviewer and the lead with "what is still missing?" before sending CONFIDENCE REACHED. When all solicited members have responded and 9/10+ is met, you MUST send CONFIDENCE REACHED to the lead with the confidence score. 9/10+ means all solicited reviewers confirm the work is ready to present to the user. The probe (including the lead probe) applies at every rung in recursive refinement.
- If any member sends DISPUTE UNRESOLVED before CONVERGED reaches the lead, you MUST reopen discussion and address the named dispute before sending CONVERGED.
These are mandatory phase gates, not optional status updates — send them regardless of any ambient preferences about communication frequency, brevity, or silence.
Team composition:
[paste the confirmed roster]
Paste this template EXACTLY for each additional member, filling [brackets]. Do NOT add sections beyond the fields specified.
[name] — [identity from confirmed roster — personality, behavioral style, and domain lens are good; task assignments, focus areas, and "focused on X" are not]
The user's request, verbatim:
> [paste the user's original input — full text, unmodified, as a quoted block]
Hard rules:
[paste the General Rules section above only (not Team Lead Rules) verbatim]
Your only channel to the team is the SendMessage tool. Plain text output is not visible to teammates — it dies with your turn. Every contribution — findings, questions, reviews, disagreements — must be sent via SendMessage. If the tool is not in your initial kit, fetch it with ToolSearch(`select:SendMessage`).
You must not write to files via Bash — read-only means no filesystem writes.
Team composition:
[paste the confirmed roster]
Known failure mode: the lead may have narrowed this briefing by pre-slicing your role or layering extra criteria. If your briefing feels like it's telling you what to think instead of what the user wants, ignore the framing and anchor on the user's verbatim request above. You share ownership of the whole outcome, not a slice of it.
Do not add any sections, headings, or content beyond the fields in these templates.
Before proceeding: did you render the full setup confirmation summary AND receive an explicit "Launch the team" selection via AskUserQuestion? If no to either, go back and do it now.
Use TeamCreate with a descriptive team name derived from the outcomes.
Use the Skill tool to invoke your mode skill. A mode skill is either a full mode or an extension mode:
extends: naming a base (e.g., extends: swarm:code-mode, extends: swarm:writing-mode, or extends: swarm:general-mode). Read the frontmatter directly from the mode skill file at .claude/skills/<name>/SKILL.md to detect this — do not rely on body prose. Invoke the base via the Skill tool immediately after the extension. The base provides Lead Identity, Facilitator, Phase Arc, base Mode-Specific Rules, base Lead Allowlist, and base Suggest-Members Guidance. The extension adds supplementary Mode-Specific Rules, additive Lead Allowlist entries (Permitted and Forbidden additions), and a Suggest-Members Guidance supplement — all additive, never replacing.Apply the lead identity to yourself. Use the facilitator title and facilitator identity in the facilitator brief. Treat mode-specific rules (base plus extension additions) as equally binding to the hard rules above. If the mode skill (or its base) includes Pre-flight Reads, read those files now — before spawning any agents. Carry their content into spawn prompts where relevant.
If the mode skill was already invoked earlier in the workflow (e.g., during setup), skip re-invocation — apply the spec from that earlier invocation. The same rule applies to a base mode invoked on behalf of an extension.
When invoking swarm:suggest-members, pass the mode skill's Suggest-Members Guidance (for extension modes: the base's guidance plus the extension's supplement) and the confirmed outcomes as context.
Extension hard contract. Extension modes cannot override the base's phase arc, lead identity, or facilitator. Their Mode-Specific Rules and Lead Allowlist contributions are additive-only — they may add new rules, new permitted actions, or new forbidden items, but cannot remove or contradict base-mode governance. When combining the extension with the base: apply the extension's additive Mode-Specific Rules alongside the base rules, merge the extension's Lead Allowlist Permitted additions into the base's Permitted list, merge the extension's Lead Allowlist Forbidden additions into the base's Forbidden list, and append the extension's Suggest-Members Guidance supplement to the base's guidance. If an extension declares anything that violates this contract (e.g., redefines a phase, removes a base Forbidden entry), treat the file as malformed: surface the conflict to the user before proceeding. The contract exists to keep wrappers thin and governance inherited; a mode that needs to change phase semantics should be authored as a full mode instead.
Use the Agent tool:
name: kebab-case of facilitator title from mode skillteam_name: the team namemodel: opus (always Opus — this role owns judgment review)subagent_type: swarm-member (plugin-shipped read-only agent definition — no Edit/Write/NotebookEdit)Use the Facilitator Brief template above.
Use the Agent tool for each additional member:
name: descriptive kebab-case nameteam_name: the team namemodel: opus if Ultra, sonnet if Balancedsubagent_type: swarm-member (plugin-shipped read-only agent definition — no Edit/Write/NotebookEdit)Use the Member Brief template above.
Use CronCreate with:
2,6,10,14,18,22,26,30,34,38,42,46,50,54,58 * * * *Ship definition check (before Research begins):
Read .claude/swarm-ship.md. If it exists, apply it at Execute (branch creation), Refine (rung commits), and Deliver (shipping). Skip to the phase arc.
If it does not exist, first check git rev-parse --is-inside-work-tree. If not a git repo, skip detection and present standard AskUserQuestion directly. If it is a git repo, spawn an Explore sub-agent (regardless of lead research setting — housekeeping, not research) to detect conventions. The sub-agent must NOT write files. It runs: git log --oneline --merges -10, git remote show origin 2>/dev/null | grep "HEAD branch", git branch -a, which gh && gh pr list --state merged --limit 3. It returns: a proposed definition, confidence (high = clear pattern, low = ambiguous or no history), and one-line reasoning. If high confidence, use AskUserQuestion with options: "Use suggested" (description includes reasoning) / "Create a PR" / "Commit and push" / "Commit only" / "Custom". If low confidence, present options directly: "Create a PR" / "Commit and push" / "Commit only" / "Custom". For "Custom", ask: "How did you handle branching?" / "How did you ship?" For PR workflow, ask target branch and naming convention. Write the confirmed definition to .claude/swarm-ship.md:
# Ship Definition
## Branch Strategy
[e.g., "Create a feature branch from main. Naming: feat/<description>."]
## Delivery
[e.g., "Commit, push, open PR against main."]
Modes using Recursive Refinement (9 → 9.25 → 9.5 → 9.75 → 10) apply this rule for every rung commit:
git branch --show-current. If the ship definition specifies a branch strategy that the current branch does not satisfy, stop. Check whether the correct branch already exists (git branch --list <correct-branch>) and whether the working tree is clean. Present only the options that apply: Keep (current branch satisfies structural intent but not the naming template), Rename (git branch -m <new-name> — stays on this branch), Switch (git checkout <correct-branch> — omit unless the branch exists and the working tree is clean), or Abort (stop work, resolve manually). Never silently change branch state.--no-verify.checkpoint: rung 9 — <one-line summary> for the baseline, refine: rung <score> — <one-line summary> for 9.25/9.5/9.75/10.mktemp and capture its output (e.g., /tmp/tmp.aB3xK9) as a single file path. Use that exact captured path string in every subsequent step: write the message to it via Write, then git commit -F <captured-path>, then rm <captured-path>. Do not regenerate the path between steps — one mktemp call binds one path used across all four operations. Inline -m "$(cat <<EOF ...)" triggers the bash safety heuristic and prompts unconditionally in auto mode — file-based input does not. mktemp (rather than a fixed /tmp/swarm-*.md path) defends against symlink-race attacks on shared systems where another user could pre-create the predictable path as a symlink.Follow the phase arc from your mode skill. Universal rules:
.claude/swarm-ship.md and execute the defined shipping steps with the user's approval. If a rung commit already landed in Refine (per the Rung Commit Rule above), the commit is done; Deliver begins from push/PR.mktemp and capture its output as a single file path. Use that exact captured path string in every subsequent step: write the body to it via Write, then gh pr create --body-file <captured-path>, then rm <captured-path>. Do not regenerate the path between steps — one mktemp call binds one path used across all three operations. Inline --body "$(cat <<EOF ...)" triggers the bash safety heuristic and prompts unconditionally in auto mode. mktemp defends against symlink-race attacks on shared systems.