MemoryRouterMemoryRouter

Multi-Agent Setup

Give each OpenClaw agent its own persistent memory vault.

Run multiple OpenClaw agents on one gateway — each with its own identity, its own Telegram bot, and its own MemoryRouter vault. No memory cross-contamination. Each agent remembers only its own conversations.


How It Works

OpenClaw supports multiple agents on a single gateway. Each agent gets:

  • Its own workspace (identity, memory files, skills)
  • Its own session store (conversation history)
  • Its own Telegram bot (separate chat interface)
  • Its own MemoryRouter vault (persistent memory)

One gateway process handles routing — messages go to the right agent based on bindings.


Step 1: Create Agents

openclaw agents add rex
openclaw agents add mika

This creates isolated workspaces:

~/.openclaw/workspace/          ← main agent
~/.openclaw/workspace-rex/      ← rex
~/.openclaw/workspace-mika/     ← mika

Each workspace has its own IDENTITY.md, USER.md, MEMORY.md, etc.


Step 2: Create Telegram Bots

Each agent needs its own Telegram bot. Go to @BotFather and create one per agent:

  1. /newbot → name it → get the token
  2. Repeat for each agent

Step 3: Wire Up Config

Add agents, bindings, and bot tokens to your openclaw.json:

{
  "agents": {
    "list": [
      { "id": "main", "workspace": "~/.openclaw/workspace" },
      { "id": "rex", "workspace": "~/.openclaw/workspace-rex" },
      { "id": "mika", "workspace": "~/.openclaw/workspace-mika" }
    ]
  },
  "bindings": [
    { "agentId": "main", "match": { "channel": "telegram", "accountId": "default" } },
    { "agentId": "rex", "match": { "channel": "telegram", "accountId": "rex" } },
    { "agentId": "mika", "match": { "channel": "telegram", "accountId": "mika" } }
  ],
  "channels": {
    "telegram": {
      "accounts": {
        "default": { "botToken": "MAIN_BOT_TOKEN" },
        "rex": { "botToken": "REX_BOT_TOKEN" },
        "mika": { "botToken": "MIKA_BOT_TOKEN" }
      }
    }
  }
}

Step 4: Restart and Verify

openclaw gateway restart
openclaw agents list --bindings

Step 5: Give Each Agent Its Own Memory

Create a separate memory key for each agent at app.memoryrouter.ai. Then set up each agent individually.

Open a chat with each agent's Telegram bot and paste the Self-Install Prompt with that agent's key. The agent handles everything — install, upload, verify.

Each agent runs openclaw mr <key> in its own context, configuring its own memory independently.

Option B: agentKeys config (single config, all agents)

If you prefer managing all keys in one place, use the agentKeys config map:

{
  "plugins": {
    "entries": {
      "mr-memory": {
        "enabled": true,
        "config": {
          "key": "mk_main_key",
          "agentKeys": {
            "rex": "mk_rex_key",
            "mika": "mk_mika_key"
          }
        }
      }
    }
  }
}

How it works:

  • Every hook resolves the key per-request from ctx.workspaceDir
  • workspace-rex → looks up agentKeys.rex → hits Rex's vault
  • If an agent isn't in the map, falls back to the global key
  • Single-agent setups: zero behavior change

Requires mr-memory v3.4.0+.


Uploading Agent History

Use the --key flag to upload data to any agent's vault from the main terminal:

# Upload Rex's conversation history
openclaw mr upload --key mk_rex_key --brain ~/.openclaw/agents/rex/sessions/

# Upload Rex's workspace files
openclaw mr upload --key mk_rex_key --workspace ~/.openclaw/workspace-rex/

# Check Rex's vault
openclaw mr status --key mk_rex_key

# Clear Rex's vault
openclaw mr delete --key mk_rex_key

The --key flag targets a specific vault without changing your own config. Use it any time you need to upload, check status, delete, or search another agent's vault from the main terminal.


Managing Agent Settings

Each agent manages its own settings. To change an agent's memory density, logging, or other config — just tell that agent directly in its chat:

  • "Run openclaw mr low" → changes that agent's density
  • "Run openclaw mr logging" → toggles that agent's debug logging

No cross-agent targeting needed. Each agent's config is self-referencing.


Key Points

  • One gateway, multiple agents — one process handles all agents, routing messages based on bindings
  • Each agent = separate Telegram bot — they show up as different bots to chat with
  • Isolation is built in — each agent gets its own workspace, session store, and auth
  • No context bleeds — agents can't see each other's conversations or memories
  • Bindings are deterministic — most specific match wins (peer > account > channel > default)
  • You can split by channel — e.g., WhatsApp → fast Sonnet agent, Telegram → Opus deep work agent

On this page