swarm-inbox

Read and send inter-agent messages within a swarm team

Best use case

swarm-inbox is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Read and send inter-agent messages within a swarm team

Teams using swarm-inbox should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/swarm-inbox/SKILL.md --create-dirs "https://raw.githubusercontent.com/stevengonsalvez/agents-in-a-box/main/toolkit/packages/skills/swarm-inbox/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/swarm-inbox/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How swarm-inbox Compares

Feature / Agentswarm-inboxStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Read and send inter-agent messages within a swarm team

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# /swarm-inbox

Read your inbox or send messages to other team members.

## Usage

```bash
# Read your messages
/swarm-inbox

# Read with options
/swarm-inbox --last 10

# Send a message
/swarm-inbox --to <agent> --msg "message"

# Broadcast to all
/swarm-inbox --broadcast --msg "message"
```

## Arguments

| Argument | Description |
|----------|-------------|
| (none) | Read all messages in your inbox |
| `--last N` | Read only the last N messages |
| `--to <agent>` | Send message to specific agent (leader, agent-1, etc.) |
| `--msg "text"` | Message content |
| `--type <type>` | Message type (default: status) |
| `--broadcast` | Send to all team members |

## Message Types

| Type | Usage |
|------|-------|
| `task` | Assign work to an agent |
| `status` | Progress update |
| `handoff` | Pass work to another agent |
| `help` | Request assistance |
| `complete` | Task completion notification |
| `broadcast` | Message to all members |
| `shutdown` | Graceful termination request |

## Process

### Reading Inbox

When you receive `/swarm-inbox` (no send args):

1. **Detect Current Context**
   ```bash
   # Find which team and agent you are
   # This should be set in your session context
   TEAM_ID="$CURRENT_SWARM_TEAM"
   AGENT_NAME="$CURRENT_SWARM_AGENT"

   # Or detect from environment/session name
   SESSION_NAME=$(tmux display-message -p '#S' 2>/dev/null || echo "")
   if [[ "$SESSION_NAME" =~ ^swarm-([0-9]+)-(.+)$ ]]; then
     TEAM_ID="swarm-${BASH_REMATCH[1]}"
     AGENT_NAME="${BASH_REMATCH[2]}"
   fi
   ```

2. **Read Messages**
   ```bash
   source {{HOME_TOOL_DIR}}/utils/swarm-lib.sh

   MESSAGES=$(swarm_read_inbox "$TEAM_ID" "$AGENT_NAME" --last 20)

   if [ "$(echo "$MESSAGES" | jq 'length')" -eq 0 ]; then
     echo "No messages in inbox"
   else
     echo "=== Inbox: $AGENT_NAME ==="
     echo "$MESSAGES" | jq -r '.[] | "[\(.ts | split("T")[1] | split("+")[0])] \(.from) -> \(.type): \(.payload | tostring)"'
   fi
   ```

### Sending Messages

When you receive `/swarm-inbox --to <agent> --msg "text"`:

1. **Parse Arguments**
   ```bash
   TO_AGENT="agent-1"  # from --to
   MESSAGE="Task complete, ready for review"  # from --msg
   MSG_TYPE="${TYPE:-status}"  # from --type or default
   ```

2. **Construct Payload**
   ```bash
   # For simple text messages
   PAYLOAD=$(jq -n --arg msg "$MESSAGE" '{message: $msg}')

   # For task assignments (if type is task)
   # PAYLOAD='{"task_id": "bd-123", "action": "start", "context": "..."}'
   ```

3. **Send Message**
   ```bash
   swarm_send_message "$TEAM_ID" "$AGENT_NAME" "$TO_AGENT" "$MSG_TYPE" "$PAYLOAD"
   echo "Message sent to $TO_AGENT"
   ```

### Broadcasting

When you receive `/swarm-inbox --broadcast --msg "text"`:

```bash
PAYLOAD=$(jq -n --arg msg "$MESSAGE" '{message: $msg}')
swarm_broadcast "$TEAM_ID" "$AGENT_NAME" "broadcast" "$PAYLOAD"
echo "Broadcast sent to all team members"
```

## Example Output

### Reading Inbox
```
=== Inbox: agent-1 ===
[11:30:15] leader -> task: {"task_id":"bd-007","action":"start"}
[11:45:22] agent-2 -> handoff: {"task_id":"bd-007","context":"Backend complete"}
[11:50:00] leader -> status: {"message":"Keep up the good work!"}
```

### Sending Messages
```bash
# Simple progress update
/swarm-inbox --to leader --msg "Task bd-007 at 50% progress"

# Request help
/swarm-inbox --to leader --type help --msg "Blocked on API auth issue"

# Task handoff
/swarm-inbox --to agent-2 --type handoff --msg '{"task_id":"bd-007","context":"Frontend ready for integration"}'

# Broadcast announcement
/swarm-inbox --broadcast --msg "Taking 5 min break, will resume shortly"
```

## Message Format

Messages are stored as JSONL (one JSON object per line):

```json
{
  "ts": "2026-02-03T11:30:15+00:00",
  "from": "leader",
  "to": "agent-1",
  "type": "task",
  "payload": {
    "task_id": "bd-007",
    "action": "start",
    "context": "Implement user authentication endpoint"
  }
}
```

## Polling Workflow

Agents should poll their inbox regularly:

```bash
# Poll loop (conceptual - implement in agent behavior)
while true; do
  NEW_MESSAGES=$(swarm_read_inbox "$TEAM_ID" "$AGENT_NAME" --last 5)

  for msg in $(echo "$NEW_MESSAGES" | jq -c '.[]'); do
    TYPE=$(echo "$msg" | jq -r '.type')
    case $TYPE in
      task)
        # Handle task assignment
        ;;
      shutdown)
        # Graceful shutdown
        ;;
      *)
        # Log other messages
        ;;
    esac
  done

  sleep 5
done
```

## Files

| File | Description |
|------|-------------|
| `{{HOME_TOOL_DIR}}/swarm/{team-id}/inbox/leader.jsonl` | Leader's inbox |
| `{{HOME_TOOL_DIR}}/swarm/{team-id}/inbox/agent-1.jsonl` | Agent 1's inbox |
| `{{HOME_TOOL_DIR}}/swarm/{team-id}/inbox/agent-N.jsonl` | Agent N's inbox |

Related Skills

swarm-status

8
from stevengonsalvez/agents-in-a-box

Display comprehensive status dashboard for a swarm team

swarm-shutdown

8
from stevengonsalvez/agents-in-a-box

Gracefully shutdown a swarm team

swarm-orchestration

8
from stevengonsalvez/agents-in-a-box

A tmux-based persistent multi-agent swarm system with file-based inter-agent messaging

swarm-join

8
from stevengonsalvez/agents-in-a-box

Join an existing swarm team as a worker agent

swarm-create

8
from stevengonsalvez/agents-in-a-box

Create a new self-sufficient swarm team from a Beads epic with N worker agents + a watchdog daemon that auto-recovers stuck panes and notify-only finalizes when the epic is done. Cross-provider (Claude/Codex/Copilot).

swarm-attach-watchdog

8
from stevengonsalvez/agents-in-a-box

Retrofit a watchdog daemon onto an existing v1 swarm (no recreation). Upgrades team.json to v2 schema and spawns the watchdog tmux session.

swarm-agent-troubleshooting

8
from stevengonsalvez/agents-in-a-box

Diagnose and fix swarm agent spawn failures when agents don't start processing tasks

workflow

8
from stevengonsalvez/agents-in-a-box

Guide through structured delivery workflow with plan, implement, validate phases

webapp-testing

8
from stevengonsalvez/agents-in-a-box

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

validate

8
from stevengonsalvez/agents-in-a-box

Verify implementation against specifications

ui-ux-pro-max

8
from stevengonsalvez/agents-in-a-box

UI/UX design intelligence. 67 styles, 96 palettes, 57 font pairings, 25 charts, 13 stacks (React, Next.js, Vue, Svelte, Astro, Nuxt, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, Jetpack Compose). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

tui-style-guide

8
from stevengonsalvez/agents-in-a-box

TUI style guide for consistent terminal interface design