Voice
Intent Routing
Intent-based automatic routing plugin for OpenClaw โ classifies message complexity using local heuristics (zero LLM calls) and routes complex tasks to open-multi-agent running in AIO sandbox
Install
npm install
npm
README
<p align="center">
<img src="assets/logo.png" width="280" />
</p>
# OpenClaw Intent Routing
**Stop using one brain for every task.**
---
## The Problem
The OpenClaw ecosystem already has a wealth of harnesses โ Claude Code, Codex, Aider, open-multi-agent, ACPXโฆ each excelling at different things.
But OpenClaw currently operates as **single-thread + single-harness path**: every message takes the same route, goes to the same harness, processed by the same model.
This leads to three direct consequences:
| Scenario | What happens | What should happen |
|----------|-------------|-------------------|
| User says "Hello" | Opus processes it, seconds of latency, heavy token cost | Lightweight model responds instantly, near-zero cost |
| User says "Translate this" | Full harness pipeline | Fast model returns directly |
| User says "Design the schema, then build the API, then write tests" | Single agent, serial execution, limited quality | Multi-agent parallel collaboration |
**Simple tasks are over-processed** โ wasting tokens. **Complex tasks are under-served** โ quality suffers. **Multiple harnesses sit idle** โ capabilities wasted.
The root cause: **no dispatch layer.**
---
## What This Plugin Does
It adds a dispatch layer to OpenClaw. It solves two things:
### 1. One-Click Multi-Harness Integration
Different harnesses have different runtime requirements โ some need Node.js, some depend on Docker, some communicate via MCP. Manually setting up the integration (pulling images, configuring ports, installing dependencies, registering backends) is a high barrier.
This plugin has built-in environment management:
```
Install plugin โ Enable โ On first complex task, auto-completes:
Docker image pull โ Container start โ Health check โ
open-multi-agent clone โ Dependency install โ Build โ
ACP Backend registration โ Ready
```
- **Docker container self-management** โ Auto-pulls AIO sandbox image, starts container, maps ports, continuous health monitoring
- **open-multi-agent self-deployment** โ Auto-clones repo, detects package manager, installs dependencies, builds
- **ACP Backend self-registration** โ Registers as a standard ACP runtime backend, seamless integration with existing system
No manual image pulls. No port configuration. No startup scripts.
### 2. Automatic Routing by Task Complexity
Once the environment is ready, before each message reaches a harness, the plugin uses pure local rules (**zero LLM calls, zero latency, zero extra tokens**) to classify and route:
```
User message โ Intent classification (local < 1ms) โ Routing decision
โโ Simple โ Lightweight model (configurable)
โโ Complex โ AIO sandbox / Multi-agent
โโ Default โ Original binding route (unchanged)
```
---
## Classification Rules
16 built-in rules covering English and Chinese, evaluated by priority:
**Complex task signals (priority 10):**
| Rule | Example matches |
|------|----------------|
| Sequential execution | "First do X, then do Y" |
| Numbered steps | "Step 1: ..." / "Phase 1: ..." |
| Stage planning | "Phase 1: design" / "Stage 2: implement" |
| Numbered lists | "1. Do X\n2. Do Y" |
| Collaboration language | "collaborate" / "coordinate" / "work together" |
| Parallel execution | "in parallel" / "concurrently" / "at the same time" |
| Multiple deliverables | "build X and then implement Y" |
| Chinese sequence markers | "first...then...finally..." patterns |
**Long message rule (priority 15):** Over 500 characters
**Simple task rule (priority 20):** Under 200 characters with no complexity signals
The rule engine supports four matcher types: `regex`, `keyword`, `length`, `negation` โ freely composable and extensible.
---
## Install
```bash
git clone https://github.com/EchoOfZion/openclaw-intent-routing.git
cd openclaw-intent-routing
npm install
npm run build
npm test
```
---
## Configuration
Add to `~/.openclaw/config.json5`:
```json5
{
intentRouting: {
enabled: true,
// Routing rules
routes: {
"complex": {
agentId: "orchestrator",
executionMode: "acp",
acpBackend: "aio-oma"
},
"simple": {
modelOverride: "claude-3-5-haiku-20241022"
}
},
// AIO sandbox (optional, defaults shown)
aioSandbox: {
baseUrl: "http://localhost:8330",
autoStart: true,
containerName: "openclaw-aio-sandbox"
},
// open-multi-agent (optional)
openMultiAgent: {
repoUrl: "https://github.com/JackChen-me/open-multi-agent.git",
branch: "main"
}
}
}
```
To disable: set `enabled: false`. Zero side effects.
---
## Architecture
```
โโโโโโโโโโโโโโโโโ
โ User Message โ
โโโโโโโโโฌโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Intent Classifier (local) โ โ Zero LLM calls
โ 16 built-in + custom rules โ
โโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ
โ
โโ simple โโโ Model override (configurable) โโโ Fast response
โ
โโ complex โโ AIO Sandbox โโโ open-multi-agent โโโ Multi-agent collaboration
โ โ
โ โโ Docker auto-management
โ โโ OMA auto-deployment
โ โโ ACP Backend registration
โ
โโ default โโโ Original binding route (unchanged)
```
**Modules:**
| Module | Responsibility |
|--------|---------------|
| `intent-classifier` | Message classification engine, pure sync, no side effects |
| `intent-router` | Classification โ routing decision mapping |
| `aio-manager` | AIO sandbox Docker lifecycle management |
| `oma-installer` | open-multi-agent auto-install and build |
| `aio-backend` | ACP runtime backend implementation |
| `index` | Plugin entry point, hook registration |
---
## Project Structure
```
โโโ openclaw.plugin.json # Plugin manifest + config schema
โโโ package.json
โโโ tsconfig.json
โโโ skills/
โ โโโ intent-router/
โ โโโ SKILL.md # Agent instructions
โโโ src/
โโโ index.ts # Plugin entry
โโโ index.test.ts
โโโ integration-test.ts # End-to-end integration tests
โโโ routing/
โ โโโ intent-classifier.ts # Classification engine (16 rules)
โ โโโ intent-classifier.test.ts
โ โโโ intent-router.ts # Route mapping
โ โโโ intent-router.test.ts
โโโ sandbox/
โ โโโ aio-manager.ts # AIO sandbox management
โ โโโ aio-manager.test.ts
โ โโโ oma-installer.ts # OMA auto-installer
โ โโโ oma-installer.test.ts
โโโ backend/
โโโ aio-backend.ts # ACP runtime backend
โโโ aio-backend.test.ts
```
---
## Testing
```bash
# Unit tests (158)
npm test
# Integration tests (requires running AIO sandbox)
npx tsx src/integration-test.ts [baseUrl]
```
---
## Custom Rules
Add custom classification rules via config:
```json5
{
intentRouting: {
enabled: true,
routing: {
customRules: [
{
id: "custom:deploy",
category: "complex",
priority: 5,
matchers: [
{ type: "keyword", keywords: ["deploy", "rollback", "migration"] }
]
}
]
}
}
}
```
Rules are evaluated by `priority` (ascending). First rule where all matchers pass wins.
---
## Key Features
- **Zero LLM calls** โ Classification is entirely local, no token cost, no added latency
- **Lightweight** โ < 2500 lines of code (including tests), no runtime dependencies
- **Low intrusion** โ Plugin-based, does not modify OpenClaw core, disable to revert
- **One-click ready** โ Docker + OMA environment fully auto-provisioned
- **Fully configurable** โ Rules, routes, models all customizable
- **Well tested** โ 158 unit tests + 9 integration tests, verified on real AIO sandbox
---
## Docker & Remote Sandbox
The plugin auto-detects your Docker environment:
| Situation | What happens |
|-----------|-------------|
| Docker installed and running | Container auto-starts, zero manual steps |
| Docker installed but not running | Clear error: "Start Docker Desktop or run `sudo systemctl start docker`" |
| Docker not installed | Clear error with install link + remote sandbox alternative |
**No Docker? No problem.** Point to a remote AIO sandbox instead:
```json5
{
aioSandbox: {
baseUrl: "http://your-server:8330", // remote sandbox address
autoStart: false // skip local Docker
}
}
```
Simple task routing (model override) works without Docker โ it only needs Docker when routing complex tasks to AIO sandbox.
---
## Compatibility
- OpenClaw pluginApi >= 2026.3.24-beta.2
- Node.js >= 22
- Docker (local AIO sandbox) or a remote AIO sandbox URL
---
---
<p align="center">
<img src="assets/logo.png" width="280" />
</p>
# OpenClaw Intent Routing
**่ฎฉไฝ ็ Agent ไธๅ็จๅไธไธช่ๅญๅๆๆไบ**
---
## ้ฎ้ข
OpenClaw ็ๆๅทฒ็ปๆไบๅคง้ไผ็ง็ Harness โโ Claude CodeใCodexใAiderใopen-multi-agentใACPXโฆโฆ ๅฎไปฌๆ
้ฟไธๅ็ไบๆ
ใ
ไฝ OpenClaw ๅฝๅๆฏ **ๅ็บฟ็จ + ๅ Harness ่ทฏๅพ**๏ผๆๆๆถๆฏ่ตฐๅไธๆก่ทฏ็ฑ๏ผๅ็ปๅไธไธช Harness๏ผ็จๅไธไธชๆจกๅๅค็ใ
่ฟๅธฆๆฅไธไธช็ดๆฅๅๆ๏ผ
| ๅบๆฏ | ๅ็ไบไปไน | ๆฌ่ฏฅๆๆ ท |
|------|-----------|---------|
| ็จๆท่ฏด "ไฝ ๅฅฝ" | Opus ๅค็๏ผๆฐ็งๅๅบ๏ผๆถ่ๅคง้ token | ่ฝป้ๆจกๅๆฏซ็ง็บง่ฟๅ๏ผๅ ไน้ถๆๆฌ |
| ็จๆท่ฏด "็ฟป่ฏ่ฟๆฎต่ฏ" | ๅฎๆด Harness ๆต็จ | ๅฟซ้ๆจกๅ็ดๆฅๅฎๆ |
| ็จๆท่ฏด "ๅ
่ฎพ่ฎก schema๏ผๅๅ API๏ผๆๅๅๆต่ฏ" | ๅ Agent ไธฒ่กๅค็๏ผ่ดจ้ๅ้ | ๅค Agent ๅนถ่กๅไฝ๏ผๅๅธๅ
ถ่ |
**็ฎๅไปปๅก่ขซ่ฟๅบฆๅค็** โโ ๆตช่ดน tokenใ**ๅคๆไปปๅกๅค็่ฝๅไธ่ถณ** โโ ่ดจ้ๆๆใ**ๅคไธช Harness ๆ ๆณๅๅ** โโ ่ฝๅ่ขซ้ฒ็ฝฎใ
ๆฌ่ดจ้ฎ้ข๏ผ**ๆฒกๆ่ฐๅบฆๅฑใ**
---
## ่ฟไธชๆไปถๅไปไน
็ป OpenClaw ๅ ไธไธช่ฐๅบฆๅฑใ่งฃๅณไธคไปถไบ๏ผ
### 1. ๅค Harness ไธ้ฎๆฅๅ
ฅ
ไธๅ็ Harness ่ฟ่ก็ฏๅขๅๅผ โโ ๆ็้่ฆ Node.js๏ผๆ็ไพ่ต Docker๏ผๆ็่ตฐ MCP ๅ่ฎฎใๆๅจๆญๅปบๆฅๅ
ฅๆต็จ๏ผๆ้ๅใ้
็ซฏๅฃใ่ฃ
ไพ่ตใๆณจๅ backend๏ผ้จๆงๅพ้ซใ
ๆฌๆไปถๅ
็ฝฎไบๅฎๆด็็ฏๅข็ฎก็๏ผ
```
ๅฎ่ฃ
ๆไปถ โ ๅฏ็จ โ ้ฆๆฌก้ๅฐๅคๆไปปๅกๆถ่ชๅจๅฎๆ๏ผ
Docker ้ๅๆๅ โ ๅฎนๅจๅฏๅจ โ ๅฅๅบทๆฃๆฅ โ
open-multi-agent ๅ
้ โ ไพ่ตๅฎ่ฃ
โ ๆๅปบ โ
ACP Backend ๆณจๅ โ ๅฐฑ็ปช
```
- **Docker ๅฎนๅจ่ช็ฎก็** โโ ่ชๅจๆๅ AIO ๆฒ็ฎฑ้ๅใๅฏๅจใ็ซฏๅฃๆ ๅฐใๆ็ปญๅฅๅบท็ๆง
- **open-multi-agent ่ช้จ็ฝฒ** โโ ่ชๅจๅ
้ใๆฃๆตๅ
็ฎก็ๅจใๅฎ่ฃ
ไพ่ตใๆๅปบ
- **ACP Backend ่ชๆณจๅ** โโ ๆณจๅไธบๆ ๅ ACP ่ฟ่กๆถๅ็ซฏ๏ผไธ็ฐๆไฝ็ณปๆ ็ผ้ๆ
ไฝ ไธ้่ฆๆๅจๆ้ๅ๏ผไธ้่ฆ้
็ซฏๅฃ๏ผไธ้่ฆๅๅฏๅจ่ๆฌใ
### 2. ๆไปปๅกๅคๆๅบฆ่ชๅจ่ทฏ็ฑ
็ฏๅขๅฐฑ็ปชๅ๏ผๆฏๆกๆถๆฏๅฐ่พพ Harness ไนๅ
... (truncated)
voice
Comments
Sign in to leave a comment