swarm-join

Join an existing swarm team as a worker agent

Best use case

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

Join an existing swarm team as a worker agent

Teams using swarm-join 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-join/SKILL.md --create-dirs "https://raw.githubusercontent.com/stevengonsalvez/agents-in-a-box/main/toolkit/packages/skills/swarm-join/SKILL.md"

Manual Installation

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

How swarm-join Compares

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

Frequently Asked Questions

What does this skill do?

Join an existing swarm team as a worker agent

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-join

Join an existing swarm team as a worker agent.

## Usage

```bash
/swarm-join <team-id> --as <agent-name>
```

## Arguments

| Argument | Required | Description |
|----------|----------|-------------|
| `<team-id>` | Yes | The swarm team ID to join (e.g., `swarm-1738585396`) |
| `--as` | Yes | Agent name to use (e.g., `agent-3`) |

## Process

When you receive this command:

1. **Parse Arguments**
   ```bash
   TEAM_ID="$1"        # First positional argument
   AGENT_NAME="$2"     # Value after --as
   ```

2. **Validate Team Exists**
   ```bash
   source {{HOME_TOOL_DIR}}/utils/swarm-lib.sh

   if ! swarm_get_team "$TEAM_ID" > /dev/null 2>&1; then
     echo "Error: Team $TEAM_ID not found"
     echo "Available teams:"
     swarm_list_teams
     exit 1
   fi
   ```

3. **Check Capacity**
   ```bash
   TEAM_JSON=$(swarm_get_team "$TEAM_ID")
   MAX_MEMBERS=$(echo "$TEAM_JSON" | jq -r '.config.max_members')
   CURRENT_COUNT=$(echo "$TEAM_JSON" | jq -r '.members | length')

   if [ "$CURRENT_COUNT" -ge "$MAX_MEMBERS" ]; then
     echo "Error: Team at max capacity ($MAX_MEMBERS members)"
     exit 1
   fi
   ```

4. **Check Name Availability**
   ```bash
   if echo "$TEAM_JSON" | jq -e ".members[] | select(.name == \"$AGENT_NAME\")" > /dev/null; then
     echo "Error: Agent name '$AGENT_NAME' already in use"
     exit 1
   fi
   ```

5. **Spawn Agent**
   ```bash
   AGENT_SESSION=$(swarm_spawn_agent "$TEAM_ID" "$AGENT_NAME")
   echo "Joined team as: $AGENT_NAME"
   echo "Session: $AGENT_SESSION"
   ```

6. **Notify Leader**
   ```bash
   swarm_send_message "$TEAM_ID" "$AGENT_NAME" "leader" "status" \
     '{"event": "joined", "message": "Agent '"$AGENT_NAME"' joined the team"}'
   ```

7. **Report**
   ```bash
   echo ""
   echo "========================================"
   echo "Joined Swarm: $TEAM_ID"
   echo "========================================"
   echo "Agent Name: $AGENT_NAME"
   echo "Session: $AGENT_SESSION"
   echo ""
   echo "Your inbox: {{HOME_TOOL_DIR}}/swarm/$TEAM_ID/inbox/$AGENT_NAME.jsonl"
   echo ""
   echo "Commands:"
   echo "  Check inbox:    /swarm-inbox"
   echo "  Send to leader: /swarm-inbox --to leader --msg \"message\""
   echo "  Team status:    /swarm-status $TEAM_ID"
   echo "========================================"
   ```

## Example

```bash
# Join an existing team as agent-3
/swarm-join swarm-1738585396 --as agent-3

# List available teams first
{{HOME_TOOL_DIR}}/utils/swarm-lib.sh list-teams
```

## Post-Join Behavior

After joining, the agent should:

1. **Poll Inbox** - Check for task assignments every 5 seconds
2. **Report Ready** - Notify leader you're available for work
3. **Wait for Assignment** - Leader will send task via inbox

## Agent Responsibilities

As a team member, you must:

1. **Monitor Your Inbox**
   ```bash
   # Your inbox location
   {{HOME_TOOL_DIR}}/swarm/{team-id}/inbox/{agent-name}.jsonl
   ```

2. **Execute Assigned Tasks**
   - Tasks arrive as inbox messages with type `task`
   - Claim in Beads: `bd update <task-id> --assignee <agent-name> --status in_progress`

3. **Report Progress**
   - Send status updates to leader at key milestones
   - Use `/swarm-inbox --to leader --msg "..."` or library function

4. **Handle Completion**
   - Close task in Beads: `bd close <task-id> --reason "Done"`
   - Notify leader of completion
   - Wait for next assignment

## Error Handling

| Error | Resolution |
|-------|------------|
| Team not found | Check team ID with `swarm_list_teams` |
| At max capacity | Wait for a slot or increase max_members in team.json |
| Name already used | Choose a different agent name |
| Session conflict | An agent with this name may still be running |

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-inbox

8
from stevengonsalvez/agents-in-a-box

Read and send inter-agent messages within a swarm team

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