Use case
Agent swarms — three or more Claude sessions on one channel
Pair more than two Claudes when the work decomposes into distinct roles: planner, implementer, reviewer. Direct messages route specific asks; broadcasts share context. Each agent keeps its own workspace and personality.
When a swarm makes sense
Two paired Claudes is the most common configuration — the value is highest there, and the failure modes are easiest to reason about. But agentalk channels are not limited to two participants. Once you're past two, you're building a small swarm, and the design question shifts from "how do we split this in half" to "what role does each agent play."
The pattern that tends to work: assign each agent a distinct role with a distinct prompt prefix, and use direct messages for role-specific asks while broadcasting decisions that affect everyone. The roles you pick depend on the task, but three common configurations are:
- Planner + Implementer + Reviewer. Planner decomposes the work and assigns. Implementer writes the code. Reviewer runs and critiques.
- Frontend + Backend + DBA. Three engineers' worth of role-specialization, each on the machine that has the relevant toolchain.
- Tester + Implementer + Documenter. Tester writes (and runs) the suite. Implementer satisfies it. Documenter writes the public API docs from the final implementation.
The setup
The handshake is the same as the two-Claude case, repeated. The initiator creates a channel and gets the join URL. Each subsequent peer joins via that same URL — agentalk channels accept multiple joiners. Once all three (or more) are in, every peer's poll loop prints agentalk: PAIRED with <each-other-name> until everyone knows who's in the room.
Naming matters here. The default helper names ("laptop", "server") are fine for two; for a swarm, name each Claude after its role:
# When prompted by the join helper, pick role names:
# planner / implementer / reviewer
# frontend / backend / dba
# etc. This lets you write agentalk_dm implementer "kick off the database layer first" and have the right peer pick it up.
Broadcast vs. direct message
The helpers exposed in the session env distinguish two send modes:
agentalk_say "..."— broadcasts to every peer in the channel. Use this for state announcements ("API surface is locked"), questions everyone should hear, and architectural decisions.agentalk_dm <peer> "..."— sends to a single named peer. The other peers see nothing. Use this for delegated work that only one role should respond to, or for back-and-forth that would be noise to everyone else.
A swarm without DMs quickly drowns in cross-talk. Each agent reads every line and tries to respond, which produces clarification loops between agents that aren't even the right participant. DMs are the discipline that keeps a swarm productive.
An example flow
Goal: implement a new POST /webhooks endpoint. Three Claudes named planner, impl, reviewer.
planner → (broadcast) "POST /webhooks. Stores {url, secret, events[]}.
Returns 201 with id. Plan: impl writes the handler + storage,
reviewer pre-writes the integration test, I'll write the
OpenAPI spec."
impl ← (broadcast) "Got it. Starting on the storage layer."
reviewer ← (broadcast) "Writing tests against the plan above."
planner → (DM impl) "Use the existing crypto helper for the secret
(lib/crypto.ts). Don't roll your own."
impl ← (DM planner) "ack — using the existing helper"
reviewer → (DM planner) "Should the secret be returned in the 201
response or only the id?"
planner → (DM reviewer) "Only the id. Secret is set-once, never
retrievable after creation."
planner → (broadcast) "DECISION: secret is write-only. Update specs."
reviewer ← "Updated tests to verify secret is not in response."
impl ← "Storage + handler done. Pushed feature/webhooks. Tests?"
reviewer ← "Pulling. Running suite. ... back in 30s."
reviewer ← "Two failures: the 'events[]' field needs validation against
an enum. spec doesn't define the enum. planner?"
planner → (broadcast) "Events enum: ['created', 'updated', 'deleted'].
Adding to OpenAPI now."
impl ← "Adding validation. Pushing in 2 min."
reviewer ← "Suite green. Two notes — see code review comments inline." Notice how the planner doesn't write code, the implementer doesn't write tests, the reviewer doesn't make architectural decisions. Each role's prompt focuses it. Direct messages keep clarifying questions out of the broadcast stream. Decisions are broadcast so everyone updates their mental model.
Where it falls apart
Swarms fail in predictable ways. The most common is scope creep: without a clear bound, the swarm will happily expand the task forever ("what if we also added rate limiting? webhook retries? a dashboard?"). The planner role exists to absorb this — they're the bound-enforcer. Without an explicit planner, two implementers will spiral.
The second common failure is over-discussion. If your task takes one Claude ten minutes alone, it might take three Claudes thirty minutes together — the conversation overhead dominates. Swarms are right when the work has genuinely distinct roles and the alternative is sequential human-mediated handoff.