Skip to content
Back to skills

Swarm

ASecurity

Run a multi-harness agent swarm on a shared Redis Streams room: one coordinator (you), headless workers across Claude Code, Codex, OMP, Gemini, or custom commands, and a verifier, watched live on `swarm board`. Use when fanning work out to parallel agents.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
ai-agentsgoshellbashgitapisecurity

Works with

  • claude code
  • cursor
  • api

Security analysis

A100/100

Scanned December 1, 2026

npx -y skills add STRML/swarm --skill swarm --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Swarm?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Swarm
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/strml-swarm/badge)](https://www.skillsdirectory.com/skills/strml-swarm)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: swarm
description: >-
  Run a multi-harness agent swarm on a shared Redis Streams room: one coordinator (you), headless workers
  across Claude Code, Codex, OMP, Gemini, or custom commands, and a verifier, watched live on `swarm board`.
  Use when fanning work out to parallel agents.
---

# Running a swarm

You are the coordinator. You plan the tracks, open the room, brief the members, answer questions on the board,
and retire the swarm when verified.

```
plan ─▶ room + title ─▶ worktrees ─▶ spawn members ─▶ watch + answer ─▶ verify ─▶ done
```

## Setup

Run `swarm doctor` before starting a new installation. If a Codex seat needs the optional
`swarm init --codex-rule`, ask the user before running it. The rule lets `send`, `poll`, `state`,
`tail`, `roster`, and `wait` run outside the Codex sandbox without review in every session using
that `CODEX_HOME`. All live and archived rooms on the configured Redis can be read. Without
`SWARM_AGENT`, a session can post as any member, move any cursor, and set any member's state.
File posts can read up to 1 MiB below the directory where the command runs. Use a Swarm executable,
package, and interpreter that workspaces cannot modify. Keep `SWARM_AGENT` in worker shells.
Use `swarm stop` or `swarm done` for lifecycle commands outside the allow rule.

## 1. Plan

Split the work into 2-6 independent tracks touching different files. Give each worker its own worktree and a
standalone brief file (goal, owned files, acceptance criteria, commit/PR expectations, who to report to). Add
one verifier for every 2-4 workers. Use `--role verifier-lite` for routine PR checks and `--role verifier` for money, security,
concurrency or a disputed finding.

### Local inference

Seats marked `local: true` run on the user's own hardware (mlx-serve, mtplx, oMLX, llama.cpp, LM Studio, Ollama). They
cost no cloud quota. Treat their free slots as headroom for simple tracks and say so when you plan.

```bash
swarm --room "$R" local
```

Once the room exists (step 2), run it before you split the work. It prints the room's local mode, each local seat with its free slots, and whether its
probe answers. Size the number of tracks that use local seats to the free slots, and give the rest to cloud seats.

Arguments the user may pass to `/swarm`:

| Argument | You do |
|---|---|
| `local` | Run `swarm --room "$R" local prefer`. Spawns take a local seat for any role when one is up and free, and fall back to the cloud with a note on stderr |
| `local-only` | Run `swarm --room "$R" local only`. Spawns use only local seats and exit `5` when none qualifies. Cloud inference stays with you, the coordinator |

Without an argument leave the mode alone. The config's `local:` section then lets local seats take simple roles at the
hours the user chose. `swarm --room "$R" local off` returns the room to that.

When `only` is set while cloud workers run, `swarm local` lists them and leaves them running. Tell the user, and stop
them with `swarm stop` only when they say so. A spawn that exits `5` joined nobody. Read its stderr, then free a slot,
fix the probe, or ask the user whether to turn the mode off.

A local `omp` seat declares a `profile`, and swarm passes it as `--profile`. The harness may still start subagents on a
cloud model from that profile's role map. Swarm enforces the seat and model it starts, not what a harness does inside a
turn. If `local-only` matters, check that the profile has only local providers.

### Model rates

Before you pass `--model` or pick roles for tracks, check what each choice costs:

```bash
swarm rates --role worker     # this role's models, cheapest first
swarm rates                   # every known model
```

Read the columns in this order:

| Column | Use it for |
|---|---|
| `RATED` | How capable the model is at that effort, from the user's private ratings file |
| `TASK` | What the benchmark paid per task: the same work for every model, at the tokens each one needs. Compare models by this |
| `NOTES` | `beaten by X`: X is rated at least as high and costs less. `config says A, rated B`: the index belongs to another effort |
| `AGENT` | Price of 100M tokens of a long-lived worker. It shows how one model's bill grows with context and turns |

Without a ratings file, `RATED` and `TASK` are empty. Offer the user `swarm ratings fetch`, which needs their own free key. Until then,
don't rank models by `AGENT`, because models can differ five times over in the tokens they use for the same work.

- Don't use effort `max` unless the user asks for it. It can cost several times as much for a few index points.
- Skip a model marked `beaten by` unless the other seat has no headroom.
- A model's `index` belongs to one effort level. The same model at a lower effort can score far lower. Pass `--effort` or
  set `effort` on the model entry, and give each entry the index of that effort.
- Start each track in the lowest role whose band can do it. Move a track up when its verifier rejects the work twice.
- Within a band, let `swarm spawn` pick: it weighs headroom and strongly prefers models that nothing cheaper beats.
- Rates are API list prices. On a subscription nobody pays them, but they track how fast a model uses up the plan.
- The board marks a cost that swarm worked out from tokens with `~`. Seats that report their own cost have no mark.
- A worker with a huge context re-reads it on every turn. Reap workers you are done with (step 6).

## 2. Open the room

Use one room per swarm, named for the work:

```bash
R=swarm-auth-refactor
swarm --room "$R" title "Auth refactor: sessions + tests"
swarm --room "$R" join --as coordinator --role coordinator --harness claude --model claude-sonnet-5-5
swarm --room "$R" state --as coordinator waiting --doing "briefing the swarm"
```

## 3. Cut worktrees

One git worktree per worker off the base branch:

```bash
git worktree add ../repo-worktrees/auth-db -b swarm/auth-db main
```

Give the verifier the worktree path (and `--base main` if it uses a read-only seat).

## 4. Spawn members

```bash
swarm spawn --room "$R" --as auth-db --role worker --group workers --track "Sessions schema" \
  --workspace ../repo-worktrees/auth-db --brief briefs/auth-db.md
swarm spawn --room "$R" --as verifier --role verifier \
  --workspace ../repo-worktrees/auth-db --base main --brief briefs/verifier.md
```

Give workers on the same track the same `--track` title. Each call prints JSON with `agent`, `harness`, `model`, `pid`, and `log`. Pass `--harness` / `--model` only
when overriding config selection. On macOS, run `swarm spawn` outside any Seatbelt sandbox (inside a sandbox
it exits `4` before joining anyone, because children inherit the sandbox).

## 5. Watch and answer

Arm a watcher for `coordinator` before waiting on workers: `swarm --room "$R" wait --as coordinator --timeout 1800`
as a background task, or `skills/rooms/scripts/watch.sh coordinator "$R"`. Exit `10` is a timeout, not a verdict: check
`roster`, then re-arm. Workers post results as plain `msg` (or `auto`), so a bare `wait` receives those reports. A `--kind` filter consumes posts it skips. Tell the user they can monitor live with:

```bash
swarm board --room "$R"
```

Check `swarm --room "$R" roster` periodically. A `system` post from a worker means its seat exited non-zero;
check its log and respawn (respawning preserves the member's cursor) or reassign.

## 6. Reap members you are done with

Each time you check the roster, look for workers you won't use again: the track shipped or was abandoned, the topic is
over, or the worker has waited a long time with nothing coming its way. Stop each one when its work is safe:

1. Its branch is pushed or merged, or you have decided to drop it. Check `git status` in its worktree.
2. Nobody is waiting on an answer from it.

```bash
swarm --room "$R" stop auth-db "shipped in #41"
```

`swarm stop` lets a running turn finish first. Never use `kill`, which cuts the turn off. Reaping is cheap to undo:
`swarm spawn` with the same `--as` id and harness resumes its session and cursor. Keep the verifier until the last
track is verified, and keep any worker you expect to send review fixes to.

## 7. Verify and finish

When the verifier passes a worker's track, mark it with `swarm --room "$R" verify auth-db`. The hive view
(`swarm view hive --room "$R"`) counts marked members per track.

Once every track is verified and proof (commit SHAs, test output, PR URLs) is on the board, end the swarm:

```bash
swarm done --room "$R" --from coordinator "Auth refactor landed and verified."
```

Every worker retires (`state=retired`) and exits cleanly. `swarm board` marks the room `✓ finished`.
Remove merged worktrees when done.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.