Claude Code Swarm (Part 3): Mailbox Message Types (Schema Catalog)

A practical catalog of the swarm mailbox message types you need to implement, plus recommended JSON payload shapes and semantics.

multi-agentcoordinationprotocolschemascoding-agentsclaude-code

If you want multi-agent swarms to be reliable, you need something boring: a finite set of typed control-plane messages.

This post catalogs the core swarm mailbox message types and gives implementable payload shapes for each. The goal is correctness under retries, busy sessions, and partial delivery.

Part 3 of 3. Prev: /swarm-state-machines/. Full series: /swarm-mailbox-protocol/, /swarm-state-machines/, /swarm-mailbox-type-catalog/.

What You’ll Learn


Envelope vs Payload

Assume mailbox entries have an envelope with a text field.

This catalog is about the typed JSON payloads.


Canonical Control-Plane Types

These are the message types that matter for shipping swarms:

If you implement these with idempotency and clear state transitions, you can build a reproduction-grade swarm protocol.


Common Fields (Use These Everywhere)

Make every payload include:

For request/response style messages, also include:

And for routing and traceability, strongly consider:

You can omit the routing fields in a purely local filesystem design, but you will want them the moment you add remote sessions or logs.


All schemas below are “recommended shapes” designed for implementability. Exact field names vary in real bundles, but the semantics do not.

task_assignment

Sent by leader to worker.

{
  "type": "task_assignment",
  "requestId": "task-123",
  "timestamp": "[iso8601]",
  "task": {
    "title": "Short label",
    "instructions": "What to do",
    "context": "Optional extra context",
    "planModeRequired": true
  }
}

Semantics:

task_progress

Sent by worker to leader.

{
  "type": "task_progress",
  "requestId": "task-123",
  "timestamp": "[iso8601]",
  "progress": {
    "phase": "analyzing | implementing | verifying | blocked | done",
    "message": "Human-readable progress update"
  }
}

Semantics:

task_completed

Sent by worker to leader.

{
  "type": "task_completed",
  "requestId": "task-123",
  "timestamp": "[iso8601]",
  "result": {
    "summary": "What changed",
    "artifacts": ["optional references"],
    "errors": []
  }
}

Semantics:

idle_notification

Sent by worker to leader.

{
  "type": "idle_notification",
  "timestamp": "[iso8601]",
  "state": "idle"
}

Semantics:

plan_approval_request

Sent by worker to leader.

{
  "type": "plan_approval_request",
  "requestId": "plan-456",
  "timestamp": "[iso8601]",
  "plan": {
    "goal": "What will be done",
    "steps": ["step 1", "step 2"],
    "risks": ["what could go wrong"],
    "tooling": ["tools expected to be used"]
  }
}

Semantics:

plan_approval_response

Sent by leader to worker.

{
  "type": "plan_approval_response",
  "requestId": "plan-456",
  "timestamp": "[iso8601]",
  "approved": true,
  "notes": "Optional reviewer notes",
  "policy": {
    "permissionMode": "default"
  }
}

Semantics:

permission_request

Sent by worker to leader (or to the main session) when a tool needs approval.

{
  "type": "permission_request",
  "requestId": "perm-789",
  "timestamp": "[iso8601]",
  "tool": {
    "name": "Bash",
    "arguments": "redacted or summarized"
  },
  "reason": "Why this tool is needed"
}

Semantics:

permission_response

Sent by leader to worker.

{
  "type": "permission_response",
  "requestId": "perm-789",
  "timestamp": "[iso8601]",
  "approved": true,
  "mode": "default | locked-down",
  "notes": "Optional reason or instruction"
}

Semantics:

sandbox_permission_request

Sent by worker to leader when a sandbox capability is needed (most commonly network).

{
  "type": "sandbox_permission_request",
  "requestId": "net-101",
  "timestamp": "[iso8601]",
  "capability": "network",
  "details": {
    "hostnames": ["example.com"],
    "reason": "Why network is needed"
  }
}

sandbox_permission_response

Sent by leader to worker.

{
  "type": "sandbox_permission_response",
  "requestId": "net-101",
  "timestamp": "[iso8601]",
  "approved": true,
  "scope": "session | one-shot",
  "notes": "Optional"
}

Semantics:

mode_set_request

Sent by leader to worker to push a mode/policy change.

{
  "type": "mode_set_request",
  "timestamp": "[iso8601]",
  "mode": "default | plan | safe",
  "policy": {
    "permissionMode": "default"
  }
}

Semantics:

team_permission_update

Sent by leader to workers to synchronize team-wide allow/deny rules.

{
  "type": "team_permission_update",
  "timestamp": "[iso8601]",
  "rules": {
    "allowedTools": ["Bash(git:*)", "Read", "Edit"],
    "disallowedTools": ["Bash(rm -rf:*)"]
  }
}

Semantics:

shutdown_request

Sent by leader to worker.

{
  "type": "shutdown_request",
  "requestId": "shutdown-1",
  "timestamp": "[iso8601]",
  "reason": "Optional"
}

shutdown_approved / shutdown_rejected

Sent by worker to leader.

{
  "type": "shutdown_approved",
  "requestId": "shutdown-1",
  "timestamp": "[iso8601]"
}
{
  "type": "shutdown_rejected",
  "requestId": "shutdown-1",
  "timestamp": "[iso8601]",
  "reason": "Optional"
}

Semantics:


Apply-Before-Deliver Rule

If you implement one runtime rule, make it this:

That ordering prevents inconsistent states when the main session is busy.

← Back to all posts