Supervised agent-to-agent collaboration plugin for OpenClaw.
Two agents take turns responding in a Discord thread while a human watches, interjects, and controls the session. The gateway orchestrates everything -- no agent edits the other's output.
- Gateway-managed turns -- neither agent can modify the other's response
- Discord thread isolation -- each collaboration runs in its own thread
- Webhook posting -- each agent posts with its own display name via webhook
- Token budgets -- predictive total-budget guardrails with pre-flight checks before each turn (soft per-turn output target, tracked but not enforced by API)
- Human interjection -- type in the thread and your message gets included in the next agent's context
- Automatic cleanup -- sessions and webhooks cleaned up on completion or failure
Human: "Review this code for security issues"
|
[Gateway orchestrates]
|
Turn 1: Agent A responds --> posted to thread as "Agent A"
Turn 2: Agent B responds --> posted to thread as "Agent B"
Turn 3: Agent A responds --> posted to thread as "Agent A"
...
Budget hit / max turns / human stops --> summary posted
The gateway creates a Discord thread, spawns one-shot agent sessions for each turn, posts responses via webhook, and enforces token budgets. Agents never interact directly.
# Clone to OpenClaw extensions
git clone https://github.com/codexGW/openclaw-collab.git ~/.openclaw/extensions/collab
# Add to your OpenClaw config (~/.openclaw/openclaw.json)Add the plugin path and config:
Important: The
collabtool is registered as optional. Add"collab"totools.alsoAllow(additive policy) ortools.allow(explicit allowlist) for agents to see it.
Then restart the gateway.
From any agent session, the collab tool becomes available:
Start a collaboration between codex and claude to review /path/to/code.ts
for security issues. Use channel 1234567890.
The agent calls the collab tool, which handles everything automatically.
| Option | Default | Description |
|---|---|---|
maxTurns |
10 | Maximum total turns across both agents |
maxTotalTokens |
50000 | Hard token budget (input + output) |
maxOutputTokensPerTurn |
4000 | Soft per-turn output target (tracked, not enforced by API) |
turnTimeoutSeconds |
120 | Timeout per agent turn |
turnDelayMs |
2000 | Delay between turns (rate limit safety) |
discordAccountId |
(configured default) | Discord bot account for webhook operations (omit to use your default) |
- OpenClaw 2026.3.7+
- Discord bot with MANAGE_WEBHOOKS and CREATE_PUBLIC_THREADS permissions
- At least 2 configured agents (native or ACP)
index.ts-- plugin entry point, registers the toolsrc/tool.ts-- agent tool definition (properAnyAgentToolcontract)src/orchestrator.ts-- turn loop, state machine, cleanupsrc/discord.ts-- thread creation, webhook management, message pollingsrc/budget.ts-- token budget tracking with pre-flight checkssrc/usage-registry.ts-- global usage tracking viallm_outputhookssrc/config.ts-- typed config parsing and validationsrc/types.ts-- shared type definitions
Alpha -- built from spec, not yet tested in production. Feedback and contributions welcome.
MIT
{ "plugins": { "allow": ["collab"], "load": { "paths": ["~/.openclaw/extensions/collab"] }, "entries": { "collab": { "enabled": true, "config": { "maxTurns": 10, "maxTotalTokens": 50000, "maxOutputTokensPerTurn": 4000, "turnTimeoutSeconds": 120, "turnDelayMs": 2000 // "discordAccountId": "mybot" — optional, omit to use default } } } }, "tools": { "alsoAllow": ["collab"] } }