# multiagency-add-agent

Adopt this skill: https://proskills.md/skills/other/jimcadden-openclaw-multiagency-skills-multiagency-add-agent

Page: https://proskills.md/skills/other/jimcadden-openclaw-multiagency-skills-multiagency-add-agent
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/multiagency-add-agent/SKILL.md
size: 2455
upstream: https://github.com/jimcadden/openclaw-multiagency/blob/main/skills/multiagency-add-agent/SKILL.md

````text
---
name: multiagency-add-agent
description: Add a new agent to the multiagency workspace. Use when asked to create a new agent, add an agent, or set up a new AI assistant with its own workspace and identity.
disable-model-invocation: true
user-invocable: true
---

# Add New Agent

Creates a new agent workspace from the kit template, registers it in OpenClaw, and optionally sets up Telegram and/or Discord routing.

## Sandbox Warning

`add-agent.sh` writes to the shared workspace root and to `~/.openclaw/openclaw.json`. Both paths are outside any individual agent's sandbox boundary, so the script will fail if your session is sandboxed.

- **`mode: "non-main"` (default):** main sessions are not sandboxed — no action needed.
- **`mode: "all"`:** your main session is sandboxed. Enable elevated exec in your gateway config (`tools.elevated.enabled: true`) and run `/elevated on` in this session before executing the script.

## Run

```bash
{baseDir}/scripts/add-agent.sh [agent-name]
```

The script will:
1. Prompt for an agent name (if not given as argument)
2. Copy `workspace-template` to `<workspace>/<agent-name>/`
3. Prompt to customize `IDENTITY.md` and `USER.md`
4. Prompt for sandbox mode (`inherit` or `off`) and register the agent in `openclaw.json`
5. Offer to run Telegram and/or Discord setup
6. Commit changes to git

After running, restart the gateway:

```bash
openclaw gateway restart
```

## Sandbox Modes

When prompted during creation:

- **`inherit`** (default) — the new agent follows `agents.defaults.sandbox.mode`. Under `"non-main"`, non-main sessions (Telegram, Discord, group chats, etc.) will be sandboxed; main sessions will not.
- **`off`** — the agent is never sandboxed, regardless of the global default. Use this for agents that need to write outside their workspace (e.g., another orchestration agent).

## Environment

- `WORKSPACE_DIR` — override the workspace root (default: auto-detected from script location)
- `OPENCLAW_DIR` — override the OpenClaw config directory (default: `~/.openclaw`)

## Change Agent Sandbox Mode

To update sandbox mode for an agent after creation:

```bash
{baseDir}/skills/multiagency-add-agent/scripts/set-agent-sandbox.sh --agent <agent-id> --mode <off|inherit>
```

Then restart the gateway:

```bash
openclaw gateway restart
```

- `off` — disables sandboxing for that agent
- `inherit` — removes the per-agent override; agent follows the global default again
````

## File: README.md
upstream: https://github.com/jimcadden/openclaw-multiagency/blob/main/README.md

````text
# openclaw-multiagency

Multi-agent workspace toolkit for OpenClaw. Distributed via Git submodules.

## What's This?

A collection of skills and templates for running multiple OpenClaw agents with shared state management, git tracking, and easy Telegram/Discord setup.

## Quick Install (Recommended)

One-liner for fresh OpenClaw installs:

```bash
curl -fsSL https://raw.githubusercontent.com/jimcadden/openclaw-multiagency/main/install.sh | bash
```

With options:
```bash
curl -fsSL https://raw.githubusercontent.com/jimcadden/openclaw-multiagency/main/install.sh | bash -s -- --workspace ~/my-agents --agent assistant
```

**Options:**

| Flag | Default | Description |
|------|---------|-------------|
| `-w, --workspace DIR` | `~/workspaces` | Directory where agent workspaces are created |
| `-a, --agent NAME` | `main` | Name of the first agent |
| `-c, --openclaw-dir DIR` | `~/.openclaw` | Path to OpenClaw config directory (use if OpenClaw is installed in a non-default location) |

**Requirements before running:**
- OpenClaw must be installed and initialized (`~/.openclaw/openclaw.json` must exist)
- `git` and `python3` must be on your PATH

## When to Use This

| Scenario | What to Run |
|----------|-------------|
| **Fresh OpenClaw install** (no agents yet) | `curl .../install.sh \| bash` (above) |
| **Already have agents** | `./kit/skills/multiagency-bootstrap/scripts/migrate.sh` |

### Fresh Install

The install script handles everything:
- Creates your workspace directory
- Initializes git repo
- Adds the kit as a submodule
- Checks out the latest stable tag
- Runs bootstrap to create your first agent

### Migrating Existing Agents

Already have agents with IDENTITY.md, MEMORY.md, etc.? Use the migration script:

```bash
./kit/skills/multiagency-bootstrap/scripts/migrate.sh
```

With options (defaults shown):
```bash
./kit/skills/multiagency-bootstrap/scripts/migrate.sh --workspace ~/.openclaw/workspace --openclaw-dir ~/.openclaw
./kit/skills/multiagency-bootstrap/scripts/migrate.sh --dry-run   # preview changes without making them
```

The migration script:
- Validates prereqs (git, python3, openclaw config) before touching anything
- Adds the kit as a git submodule and checks out the latest release tag
- Creates `shared/skills/` with kit symlinks
- Wires per-agent symlinks through `shared/skills/`
- Preserves all existing agent data (IDENTITY.md, MEMORY.md, etc.)
- Prompts before committing

See `skills/multiagency-bootstrap/SKILL.md` for manual steps and agent-driven migration.

## What's Included

| Component | Purpose |
|-----------|---------|
| `multiagency-bootstrap` | One-time setup script — creates first agent, wires up config |
| `multiagency-add-agent` | Add additional agents to an existing workspace |
| `multiagency-state-manager` | Git workflow for committing workspace changes |
| `multiagency-telegram-setup` | Interactive Telegram bot creation |
| `multiagency-discord-setup` | Interactive Discord bot creation |
| `multiagency-kit-guide` | Quick reference for kit usage, update and health-check scripts |
| `workspace-template/` | Starter files for new agents (SOUL.md, USER.md, etc.) |

## Creating Agents

After the initial setup, you can add more agents using the add-agent script:

```bash
cd ~/workspaces
bash kit/skills/multiagency-add-agent/scripts/add-agent.sh my-new-agent
```

The script walks you through identity customization, optional Telegram/Discord bot setup, and commits the result.

**Examples:**

```bash
# Basic — prompts for agent name interactively
bash kit/skills/multiagency-add-agent/scripts/add-agent.sh

# Pass the name directly
bash kit/skills/multiagency-add-agent/scripts/add-agent.sh research

# Use a non-default workspace location
WORKSPACE_DIR=~/my-agents bash kit/skills/multiagency-add-agent/scripts/add-agent.sh writer

# Use a non-default OpenClaw config directory
OPENCLAW_DIR=~/.config/openclaw bash kit/skills/multiagency-add-agent/scripts/add-agent.sh assistant
```

## Updating the Kit

From within your workspace directory, run the update script:

```bash
cd ~/workspaces
bash kit/skills/multiagency-kit-guide/scripts/update-kit.sh
```

The script will show available versions and prompt you to choose. You can also specify a version directly:

```bash
# Update to a specific version
bash kit/skills/multiagency-kit-guide/scripts/update-kit.sh v0.3.1

# Update to the latest version without prompts
bash kit/skills/multiagency-kit-guide/scripts/update-kit.sh latest --yes
```

The update script handles everything: fetches the latest tags, checks out the selected version, re-syncs `shared/skills` symlinks, syncs workspace-template changes to existing agents, commits, and restarts the gateway.

## Structure

```
~/workspaces/
├── kit/                           # this submodule
│   └── skills/
│       ├── multiagency-bootstrap/
│       ├── multiagency-add-agent/
│       ├── multiagency-state-manager/
│       ├── multiagency-telegram-setup/
│       ├── multiagency-discord-setup/
│       └── multiagency-kit-guide/
├── shared/skills/                 # symlinks to kit
│   ├── multiagency-state-manager -> ../kit/skills/multiagency-state-manager
│   ├── multiagency-telegram-setup -> ../kit/skills/multiagency-telegram-setup
│   └── multiagency-discord-setup  -> ../kit/skills/multiagency-discord-setup
└── main/                          # your agent
    └── multiagency-state-manager -> ../shared/skills/multiagency-state-manager
```

## Requirements

- OpenClaw 2026.3.8+ (must be initialized — `~/.openclaw/openclaw.json` must exist)
- Git
- Python 3 (for config updates and channel setup scripts)

## Verifying Your Install

After running the install script, use the health check to verify the workspace is correctly wired up:

```bash
bash ~/workspaces/kit/skills/multiagency-kit-guide/scripts/check-setup.sh
```

Expected output:
```
✅ Kit directory exists
✅ Kit is a git repo
✅ Kit is on a tagged release
✅ multiagency-state-manager symlink exists
✅ multiagency-telegram-setup symlink exists
✅ multiagency-discord-setup symlink exists
✅ <agent-name>
✅ Git repository initialized
```

**Running the installer smoke tests** (for contributors and testers):

```bash
bash scripts/test-install.sh
```

This exercises all installer failure modes in isolation — unknown flags, missing prereqs, missing config — without touching any real OpenClaw state.

## License

MIT
````
