Agent swarm
Hand work to several AI agents at once. Each agent works on its own copy of your project, on its own branch, so the agents never get in each other's way and never touch your checkout. When an agent finishes, the result is posted to the room and appears in the Runs panel. You review the branch and merge it when you like it.
Supported agents: Claude Code (claude), Antigravity (agy), Codex (codex), Gemini CLI (gemini).
Start a swarm
Open the Swarm task window in any of these ways:
- Ctrl+Shift+A (also works while a terminal has focus)
- Swarm task in the room panel header
- The agent menu (⌄ next to + in the tab bar), then Assign task to agents…
- Ctrl+P, then
:swarm
Then:
- Check the Project. It defaults to the project you are in, and the agents work on that repository.
- Describe the task. To give each agent its own task, tick One task per line and write one task per line.
- Pick one or more agents. Every task goes to every agent you pick, so 3 tasks × 1 agent = 3 runs, and 1 task × 3 agents = 3 runs, which is handy for comparing answers.
- Optional: add a check command, such as
npm test. A result is accepted only if the check passes in that agent's copy of the project. If it fails, the run is marked failed and you can read why. - Click Start. The Runs panel opens and shows each run live.
The project must be a git repository. Each run starts from your current commit, so commit anything the agents should see first.
From a terminal
deffier swarm "Add input validation to the signup form" --agent agy
deffier swarm "Write tests for utils/date.ts" "Update the README install section" --agent agy --wait
deffier swarm "Fix the failing date test" --agent claude --agent agy --check "npm test" --wait
deffier swarm "Refactor the logger" --agent claude --profile claude2 # run on a specific account
- Several tasks: each quoted task becomes its own run.
--agent: repeat it for several agents. The default isclaude.--check: must pass before a result is accepted. You can repeat it.--profile: runs the agent on one of your account profiles (see Account profiles).--wait: follows the runs and prints each result. It exits with 0 only if every run was delivered.
Run it inside your project folder, or pass --project <folder>. The Deffier app must be running, because it does
the work; the command only hands it the tasks.
Talk to an agent that is already running
Each agent tab is a live session. To give the agent in a tab its next instruction from a script or from another agent:
deffier send @worker-agy "Now add tests for the new function"
deffier send "claude2 3" "y" # answer a yes/no question
send types the line into that tab's prompt and presses Enter. Use --no-enter to only type it. Session names
are shown in the sidebar and by deffier ls.
Room messages are different. deffier room send … --target @name posts to the room and shows a banner in
the target's terminal. Use them for notes and status; use swarm or send when you want an agent to act.
The message appears in the Room panel straight away, signed with the sender's session name (t2, worker-agy…).
In PowerShell write the target without @ (--target t3) or quote it ('@t3'): an unquoted @t3 is
PowerShell syntax and arrives empty.
Wait for another agent. deffier wait t3 returns when t3 is done, or quiet again after it was working.
deffier ls shows each session's live state (working, blocked, done, idle), the same as the sidebar.
deffier is a command in every Deffier terminal (PowerShell, cmd and Git Bash).
One agent leads the others
Agents in your project learn these commands from the room protocol: run Sync mesh in the room panel, or
deffier mesh sync, and it is written into CLAUDE.md and .gemini/rules. So you can ask a lead agent,
for example Claude in one tab:
Split this feature into three independent tasks and hand them to agy with
deffier swarm … --wait, then review the three branches and tell me which to merge.
The lead runs deffier swarm, waits for the results, and reviews each one with deffier autopilot diff <run id>.
This was tested for real:
- A Claude lead split a feature into two tasks.
- It handed both to Antigravity with one
deffier swarm --wait; they ran in parallel. - It reviewed each result with
deffier autopilot diff. - It recommended merging the good one and not the one whose worker had failed.
The whole thing took about two minutes. If the lead runs with restricted permissions, allow it
python …deffier.py:* (or deffier:*); that one rule covers handing out work and reviewing it.
Swarm with a lead
Deffier can run that pattern for you, with limits on every loop:
- Claude plans. It splits your goal into tasks.
- Workers do the tasks in parallel. By default these are 3 Antigravity workers.
- Claude reviews each result. It recommends merge, fix or drop.
- You merge.
Claude only reads files. It never edits, runs commands or merges.
Start one: open Swarm task (Ctrl+Shift+A) and tick Lead: Claude plans and reviews. Then set:
- Lead model: sonnet, opus or haiku.
- Lead account: your default login, or one of your Claude account profiles (
claude2…). - Worker groups: an agent and model with
[-] N [+], up to 8 workers in all. + group adds another agent, for example 2 agy and 1 Codex. The agy model list comes fromagy models. - Worker account: for Claude, Codex and Gemini groups, a profile such as
codex2, so the work uses that login's quota. Each run gets its own profile's login, plus your shared skills and plugins. agy workers always use agy's active account:agy1/agy2switch accounts for the whole PC, so a background worker can't use them. A profile that doesn't exist stops that task with the reason; it never falls back to another account. - Cost cap: for the whole swarm.
- Show me the plan first: on by default.
- Save for this project: writes these settings to
.deffier/swarm.json.
From a terminal:
deffier swarm "Add session expiry to login, with a warning banner and tests" --lead --workers agy:3 --wait
deffier swarm "..." --lead opus --workers agy:2:gemini-3.8-flash-high --workers codex:1 --cap 3
deffier swarms # list them; deffier swarms <id> shows one
deffier swarms <id> --cancel # or --resume
Follow it: the Swarm panel (Ctrl+6, or the network icon at the top right) shows the lead and one card per task:
- each card's agent, model and run state; drag cards to arrange them;
- an arrow from the lead to each task, and a dashed arrow when one task builds on another.
Below the cards, each task lists:
- its instructions and the files it may change;
- its check;
- the lead's verdict and reason;
- Run, which opens the run in Runs, and Merge.
While a swarm is active, a pill in the top bar shows its stage, how many workers are busy, and its cost. The pill is highlighted when the swarm needs you.
How a swarm runs
-
Planning. Claude reads the code (it gets the project's file list, so it doesn't spend turns searching) and replies with tasks. Each task says:
- exactly what to change;
- which files it may change;
- optionally, a check command that proves it works.
Two tasks that change the same files never run side by side: the second starts from the first one's result.
-
Plan review (if on). You see the tasks. Start workers, or Redo once with a note saying what to change. The checks Claude proposed run only if you saw the plan and started it.
-
Working. Each task is an ordinary run: its own copy of the project, its own branch, your checks, and the same permission pauses as any swarm task. A failed check sends the task back to its worker with the output, once, without involving Claude.
-
Review. When every task has ended, Claude reviews them all in one call, continuing its planning session so it doesn't reread the code. It answers merge, fix (with exact instructions) or drop for each task:
- It sees changed files, check results and the diff.
- A diff too large to show in full (over 40 KB per task, or 120 KB in all) is marked for you to review instead.
- Worker text is fenced off and marked as data, so a worker can't instruct the lead.
-
Fix rounds. A fix runs on top of that task's previous result, at most 2 rounds. If a fix changes nothing, or fails the same way again, the task stops and is marked for you.
-
Ready. Merge in the panel or in Runs. Merging uses your git identity, and refuses if your checkout has uncommitted changes. Nothing is ever merged for you.
Limits
| Limit | Default | When reached |
|---|---|---|
| Cost of the whole swarm (Claude's calls and Claude workers) | $2 | Running work finishes, nothing new starts, the swarm waits for you |
| Time for the whole swarm | 120 min | Same |
| Cost of one lead call | $0.50 | That call stops |
| Fix rounds per task | 2 | The task is marked for you |
| A plan that isn't valid | retried once | The swarm waits for you |
| Workers per swarm | 8 | |
| Runs on one account at once, across all swarms | 4 | New tasks wait for a free slot |
| Each task | 30 minutes, 2 attempts | The run fails or times out |
A swarm that waits for you says why. Resume continues it. After a cost or time cap you can also raise the
cap and resume: +$2 and resume or +60 min and resume, or type cap $5 in the panel. Workers are never moved to another account.
Typed commands in the panel's box cost nothing, because no model reads them:
workers 4;add 2 agy,remove 1 agy;cap $3;start,resume,cancel.
Anything else opens the setup window. Worker changes apply to tasks that haven't started; running ones are never touched.
If Deffier closes during a swarm, its running tasks stop, as other swarm runs do. When it starts again, the swarm waits for you, and Resume starts those tasks again.
.deffier/swarm.json and your OK
This file holds a project's lead settings, so the team shares them through git:
{
"lead": { "agent": "claude", "model": "sonnet", "max_cost_usd": 0.5 },
"workers": [ { "agent": "agy", "model": "gemini-3.8-flash-medium", "count": 3 } ],
"checks": [ { "run": "npm test" } ],
"review_plan": true, "max_fix_rounds": 2, "swarm_cost_cap_usd": 2, "swarm_wall_minutes": 120
}
A cloned project could put any command in checks, so Deffier runs those commands only after you approve them:
- Swarm task shows the commands with Allow these commands.
- Your approval is tied to the file's exact contents (a SHA-256 kept in
~/.swarmherd/trust.json): any change asks again. - Settings you save from the app count as approved.
- The CLI uses the file's checks only with
--use-file-checks, and only once you approved them in the app. - A program, an agent included, can't approve them or raise a swarm's caps through the CLI.
To share a setup, commit the file or send it. Whoever receives it gets the same prompt.
The phone shows active swarms on its Desk: stage, busy workers, cost and the reason it is waiting. It can't start or change a swarm.
Results
| Where | What |
|---|---|
| Runs panel (robot button, Ctrl+5) | Every run: state, the agent's answer, checks, changed files, live output; Cancel |
| Room | A Swarm message when each run is delivered or fails |
autopilot/<run id> branch |
The agent's work as one commit (git log -p autopilot/<run id>) |
deffier autopilot runs / show <run id> |
The same from a terminal |
A task that only asks a question (for example "explain this module") is delivered with the answer and no file changes.
Review and merge
From a terminal, or for a lead agent:
deffier autopilot diff <run id> # what the run changed: files and the diff (read-only)
deffier autopilot diff <run id> --stat # files only
deffier swarm --wait prints this command for every delivered run.
In the app, open the run in the Runs panel (Ctrl+5) and click it:
- View changes shows what the agent changed, as a diff.
- Merge into your branch merges the result branch into the branch you have checked out.
- The merge commit uses your own git identity.
- It refuses when your checkout has uncommitted changes. Commit or stash them first.
- If the result conflicts with your work, the merge is cancelled and nothing changes. The message tells you
which files conflict, and you can merge yourself with
git merge <branch>.
- Discard deletes the result branch.
Once you merge or discard, the run shows what you did.
Limits and costs
- Real agents use your accounts. Each run is a real request on the account that agent CLI is signed in to. Deffier never switches or rotates accounts on its own.
- Permissions: agents may read and edit files in their own copy of the project. Anything more, such as
running shell commands, needs your OK:
- Claude: when it needs a tool it wasn't given, the run pauses as Parked. The Runs panel shows what it asked for, with Allow and Deny. Allow resumes it with that permission for this run only.
- Antigravity: runs in
accept-editsmode. When it wants to run a command, the run is Parked in the same way. Allow re-runs it with commands allowed for that run only; nothing is saved to your agy settings.- If your agy settings already say always proceed, agy runs commands without asking. That is your agy setting, and Deffier respects it.
- Codex: runs with the
workspace-writesandbox. - Gemini: runs in
auto_editmode. - Claude may run the task's own check commands without asking, so it can verify its work. Nothing broader is allowed in advance.
- Nothing to show means failed. A run that ends with no answer and no changes is marked failed, with the reason, never "delivered". A failed run always says why. For example: "Your access token could not be refreshed. Please log out and sign in again" means that CLI needs you to sign in again.
- Temporary provider errors are retried. These include "overloaded", "high demand", rate limits, dropped connections and timeouts (such as agy's "authentication timed out"). Deffier waits 30 s, then 2 minutes, and retries on the same account. It never switches accounts. A login error or a quota that is used up is not retried.
- Cost (Claude). In our tests a small fix cost about $0.40 per run, because of Claude Code's own start-up
cost. Cap it with
--max-cost 0.5. Leading two agy workers and reviewing their results cost the lead about $0.23. - Waiting for you. With
--wait, a run that needs a permission prints what it asks for. Use Allow / Deny in the Runs panel, ordeffier autopilot approve <run id> --code <code>with the code the panel shows (only you can see it, so a lead agent cannot approve its workers' requests for you). - Each task has a 30-minute limit.
- Up to 20 tasks × 8 agents per request.
- The app must stay open. If it closes during a run, that run is marked as interrupted, and a swarm task that was waiting for approval fails too; start it again.