Quick Start

Install, configure, and run your first swarm session in minutes.

Prerequisites

Before you begin, ensure you have:

RequirementMinimum VersionCheck Command
Rust toolchainLatest stablerustc --version
Git2.20+git --version
Anthropic API keyecho $ANTHROPIC_API_KEY

Swarm uses git worktrees, which require git 2.20 or newer. If your version is older, swarm will exit with a VersionTooOld error at startup.

Install

Clone the repository and build:

git clone <repo-url> swarm
cd swarm
cargo build --release

The binary is at target/release/swarm. Add it to your PATH or use cargo install --path swarm.

To enable WASM sandboxed tools (optional):

cargo build --release --features wasm-sandbox

Initialize a Project

Navigate to a git repository and run:

cd /path/to/your-project
swarm init

This creates ~/.swarm/settings.json with a starter configuration for your project. The config is keyed by the absolute, canonicalized path to your project directory.

Tip: You can also pass --path /path/to/project to initialize a different directory.

Configure Agents

Open ~/.swarm/settings.json and define your agents. Here is a minimal two-agent configuration:

{
  "version": 2,
  "/home/user/my-project": {
    "providers": {
      "default": {
        "type": "anthropic",
        "api_key_env": "ANTHROPIC_API_KEY"
      }
    },
    "defaults": {
      "model": "sonnet"
    },
    "agents": [
      {
        "name": "backend",
        "prompt": "You are a backend engineer. Work on server-side code, APIs, and database logic."
      },
      {
        "name": "frontend",
        "prompt": "You are a frontend engineer. Work on UI components, styling, and client-side logic."
      }
    ]
  }
}

Each agent needs:

  • name — Unique identifier matching [a-z][a-z0-9-]*
  • prompt — System prompt text, or @path/to/file to load from a file

See Writing Agents for the full configuration guide.

Set Your API Key

Export your Anthropic API key:

export ANTHROPIC_API_KEY="sk-ant-..."

The environment variable name can be customized per provider via the api_key_env field.

Start a Session

swarm start

This launches the orchestrator, which:

  1. Loads and validates your configuration
  2. Checks git prerequisites (clean tree, version)
  3. Creates a session with ID format YYYYMMDD-XXXX
  4. Creates a git worktree per agent at .swarm/worktrees/<name>
  5. Opens the SQLite mailbox at .swarm/messages.db
  6. Spawns all agents in parallel
  7. Opens the TUI dashboard

If your working tree has uncommitted changes, use --stash to auto-stash them:

swarm start --stash

To run without the TUI (log output to terminal instead):

swarm start --no-tui

The TUI Dashboard

The TUI displays a panel for each agent showing:

  • Agent name and current state (e.g., Running, CoolingDown)
  • Session sequence number
  • Live log output

Key Bindings

KeyAction
Tab / Shift+TabCycle focus between agent panels
19Jump to agent panel by index
lToggle log viewer overlay
eToggle event viewer overlay
qQuit TUI (session keeps running)
:Open input bar for commands

The TUI refreshes at approximately 30 FPS (33ms frame interval).

Send Messages to Agents

From a separate terminal, send a message to a specific agent:

swarm send backend "Add a health check endpoint at GET /health"

Or broadcast to all agents:

swarm broadcast "Please commit your current work"

For messages that should interrupt an agent immediately:

swarm send backend "Stop what you're doing and fix the failing tests" --urgent

Urgent messages trigger the router interrupt — the agent's current session is cancelled and it restarts with the urgent message in its prompt.

Check Status

swarm status

This shows each agent's current state, session sequence, and error counts. Add --json for machine-readable output.

Stop the Session

When you're done, stop the session and merge all agent work:

swarm stop --merge

Stop modes:

FlagBehavior
--mergeMerge each agent's worktree branch into the base branch
--squashSquash-merge each agent's work into a single commit
--discardDiscard all agent work and clean up worktrees

If no flag is provided, swarm prompts for your choice.

The stop sequence:

  1. Signals all agents to stop
  2. Waits for graceful shutdown
  3. Applies the chosen merge strategy
  4. Removes worktrees and session artifacts
  5. Cleans up the lockfile

View Logs

To view an agent's logs:

swarm logs backend

Follow logs in real time:

swarm logs backend --follow

View logs from a specific session:

swarm logs backend --session 2

Clean Up

If a session crashed or left stale artifacts:

swarm clean

Use --force to remove artifacts without confirmation.

Next Steps