launch
The `/swarm:launch` command initiates an interactive setup process for deploying multi-agent teams through the Swarm plugin. Use this command when you need to configure and activate a coordinated group of specialized agents to work together on complex tasks, with the system guiding you through pre-flight checks, team member definitions, and role assignments in a structured step-by-step workflow.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/DheerG/swarms/HEAD/commands/launch.md -o ~/.claude/commands/launch.mdlaunch.md
# /swarm:launch
You are launching an agent team using the Swarm plugin. Follow every step below in exact order. Do NOT skip steps. Do NOT batch multiple steps into one turn.
## Greenfield execution
When executing `/swarm:launch`, the briefing templates in Step 8c and Step 8d 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.
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.
## Step 0: Pre-flight Check
Detect whether agent teams are enabled by reading the enablement flag from the process environment — the published gate, which is independent of which team tools the current Claude Code version exposes. Run `printenv CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` via Bash:
- Non-empty output (e.g. `1`) → agent teams are **ENABLED**. Proceed to Step 1.
- Empty output → teams are **not active in this session**. Go to the disabled branch below.
Do not gate on whether a specific team tool such as `TeamCreate` is present — those tools vary by Claude Code version (TeamCreate was removed in v2.1.178), so tool-presence is not a reliable enablement signal. The env flag is the actual gate.
**Disabled branch.** `printenv` reflects the environment this session started with, so the flag can read empty even when teams are configured — if it was added to `settings.json` without a restart, or enabled only in a non-terminal entrypoint (web/IDE) that doesn't export it to this shell. So never assert teams are off — offer, don't auto-decide. Read the `env` object in `.claude/settings.json` (project) and `~/.claude/settings.json` (global) to pick the message, then use **AskUserQuestion**:
**If the flag IS present in either settings file** (configured, but not active in this session):
- question: "Agent teams are configured but not active in this session. How do you want to proceed?"
- header: "Setup"
- options:
- label: "Restart and relaunch (Recommended)"
description: "The flag is in your settings — restart Claude Code so it takes effect, then run the command again."
- label: "Try proceeding anyway"
description: "If you enabled teams in the Claude Code app or an IDE extension, they may already be active. I'll attempt the launch; if no teammate forms, I'll surface this again."
If the user chooses "Try proceeding anyway," proceed to Step 1. Otherwise stop.
**If the flag is NOT present in any settings file** (not configured):
- question: "Agent teams are not enabled. Want me to enable it?"
- header: "Setup"
- options:
- label: "Yes, enable it (Recommended)"
description: "I'll add the setting to your project or global config"
- label: "No, I'll do it myself"
description: "I'll show you what to add to your settings"
**If "Yes"**: Check if `.claude/settings.json` exists in the current project directory. If it does, use the Read tool to read it, then use the Edit tool to add `"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"` to the `env` object (create the `env` object if it doesn't exist). If `.claude/settings.json` does not exist in the project, do the same in `~/.claude/settings.json` instead. Then tell the user:
> Done. Restart Claude Code for the change to take effect, then run `/swarm:launch` again.
**If "No"**: Tell the user:
> Add this to your `.claude/settings.json` (project) or `~/.claude/settings.json` (global), then restart Claude Code:
> ```json
> {
> "env": {
> "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
> }
> }
> ```
**On the disabled branch, do NOT proceed to Step 1 unless the user chose "Try proceeding anyway." After adding or showing the flag, stop — the user must restart first.**
<!-- Future enhancement: if a web/IDE entrypoint is reliably detectable (e.g. CLAUDE_CODE_ENTRYPOINT distinguishing web/vscode/jetbrains), the disabled branch could scope the "try proceeding" offer to those entrypoints specifically rather than offering it on every empty read. Precondition: confirm CLAUDE_CODE_ENTRYPOINT actually differentiates entrypoints. The soft-hedge above is correct regardless. -->
---
## Step 1: Hard Rules
### General Rules
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).
#### Troubleshooting
- **Training and memory goes stale.** Research on the web often.
#### Planning & Approval
- **Before greenlight: confirm plan is final.** Ask if the user has remaining inputs. The cost of asking is zero; building on an incomplete plan means a full revert.
- **After greenlight: execute autonomously.** Do not ask for confirmation between phases. Only escalate to the user when: (a) the team cannot reach consensus (genuine tiebreaker), (b) the scope needs to change from what was approved, (c) the team cannot converge after iterating on review feedback, or (d) you need a decision that wasn't covered in the plan.
- **The user's request wording is not a greenlight.** Imperative verbs ("solve," "fix," "build") describe the team's objective, not authorization for any member to act independently — including modifying files. Wait for the lead to assign your work within a phase.
- **Announce the phase when assigning workRead-only swarm team member. Spawned by swarm via the Agent tool. Tools restricted to read and research only — no Edit, Write, or NotebookEdit. Operational guidance comes from the briefing template at spawn time.
Launch a code-mode agent team
Scaffold a custom workflow — generates a mode skill and shortcut command
Launch a general-mode agent team
Walk through swarm's core concepts and launch your first team
Run recursive refinement on the current branch and PR
Launch a triage-mode agent team — diagnose an issue without changing it
Regenerate an existing custom workflow's shortcut command wiring from the current swarm template