Tools
Collab
Supervised agent-to-agent collaboration plugin for OpenClaw
Configuration Example
{
"plugins": {
"load": {
"paths": [
"/path/to/existing/extensions",
"~/.openclaw/extensions/collab"
]
},
"entries": {
"collab": {
"enabled": true,
"config": {
"maxTurns": 10,
"maxTotalTokens": 50000,
"maxOutputTokensPerTurn": 4000,
"turnTimeoutSeconds": 120,
"turnDelayMs": 2000,
"discordAccountId": "default" // omit to use your configured default
}
}
}
}
}
README
# openclaw-collab
Supervised agent-to-agent collaboration plugin for [OpenClaw](https://github.com/openclaw/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.
## Features
- **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, bypassing Discord's bot-to-bot limitation
- **Token budgets** -- predictive total-budget guardrails with pre-flight checks before each turn
- **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
## How it works
```
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.
## Install
```bash
# 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:
```json
{
"plugins": {
"load": {
"paths": [
"/path/to/existing/extensions",
"~/.openclaw/extensions/collab"
]
},
"entries": {
"collab": {
"enabled": true,
"config": {
"maxTurns": 10,
"maxTotalTokens": 50000,
"maxOutputTokensPerTurn": 4000,
"turnTimeoutSeconds": 120,
"turnDelayMs": 2000,
"discordAccountId": "default" // omit to use your configured default
}
}
}
}
}
```
Then restart the gateway.
## Usage
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.
## Configuration
| 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` | "default" | Discord bot account for webhook operations |
## Requirements
- OpenClaw 2026.3.2+
- Discord bot with MANAGE_WEBHOOKS and CREATE_PUBLIC_THREADS permissions
- At least 2 configured agents (native or ACP)
## Architecture
- `index.ts` -- plugin entry point, registers the tool
- `src/tool.ts` -- agent tool definition (proper `AnyAgentTool` contract)
- `src/orchestrator.ts` -- turn loop, state machine, cleanup
- `src/discord.ts` -- thread creation, webhook management, message polling
- `src/budget.ts` -- token budget tracking with pre-flight checks
- `src/usage-registry.ts` -- global usage tracking via `llm_output` hooks
- `src/config.ts` -- typed config parsing and validation
- `src/types.ts` -- shared type definitions
## Status
**Alpha** -- built from spec, not yet tested in production. Feedback and contributions welcome.
## Related
- [Feature Request: Supervised Agent-to-Agent Collaboration Sessions](https://github.com/openclaw/openclaw/issues/40325)
- [OpenClaw Plugin Docs](https://docs.openclaw.ai/tools/plugin)
## License
MIT
tools
Comments
Sign in to leave a comment