OpenClaw Task Router 6 Specialist Models Auto Fallback
Production-grade multi-agent orchestration for OpenClaw
Route tasks to the best AI model. Get real-time status. Never wait at a blank terminal.
Quick Start Β· Agents Β· How It Works Β· Customize Β· Gist Mirror
A single prompt + config that turns your OpenClaw instance into an AI command center. Instead of one model doing everything poorly, 6 specialist agents handle what they're best at:
| You Say | Router Picks | Model | Why |
|---|---|---|---|
| "Plan the architecture" | plan |
GLM-5.1 | High reasoning for design decisions |
| "Build the payment module" | build |
Kimi K2.6 | Strong multi-file code generation |
| "Debug the 500 error" | debug |
DeepSeek V4 Pro | Deep code understanding, terminal work |
| "Review PR #42" | review |
Kimi K2.6 | Thorough analysis with high thinking |
| "Convert this screenshot to code" | visual |
MiMo V2 Omni | Vision-native model |
| "Find where sessions are handled" | fast |
DeepSeek V4 Flash | Cheap, fast, good enough |
All models served via OpenCode β one API, one subscription, no per-provider keys needed.
- π§ Smart Task Classification β automatically routes to the right specialist
- β‘ Async Delegation β spawns agents and returns instantly; no waiting
- π 2-Minute Heartbeat β live status trees showing what's running, blocked, or done
- π Automatic Fallback β when a model hits its rate limit, switches to the next best
- π‘οΈ Hallucination Prevention β hard NEVER/ALWAYS constraints from production experience
- π Loop Detection β catches stuck agents and intervenes
- π° Cost Optimization β cheap models for simple tasks, powerful reasoning for complex ones
npm install -g openclaw openclaw onboard
See the OpenClaw docs for full setup.
# Clone this repo or download directly mkdir -p ~/.openclaw/workspace curl -o ~/.openclaw/workspace/AGENTS.md https://raw.githubusercontent.com/FaridLU/openclaw-task-router/main/AGENTS.md
Where does OpenClaw look for AGENTS.md? OpenClaw loads
AGENTS.mdfrom the workspace directory at session start. Default:~/.openclaw/workspace/. Configure it inopenclaw.json:{ "agents": { "defaults": { "workspace": "/path/to/your/workspace" } } }
Add the openclaw.json from this repo to your OpenClaw config:
cp openclaw.json ~/.openclaw/openclaw.json # Then edit to add your OpenCode API key and any personal preferences
Or manually add the 6 specialist agents to your existing config β see openclaw.json for the full template.
Just talk to OpenClaw normally:
Plan a microservices architecture for our e-commerce app
Debug the 500 error in production
Review PR #42
The router announces the chosen agent and model, then returns instantly. Every 2 minutes you'll see:
Router
βββ plan (Microservices architecture) β GLM-5.1 (thinking: high) [RUNNING]
βββ fast (Search session handling) β DeepSeek V4 Flash (thinking: off) [FINISHED: Found in auth/views.py]
| Agent | Best For | Primary Model | Thinking | Fallback Chain |
|---|---|---|---|---|
plan |
Architecture, specs, design docs | GLM-5.1 | High | Kimi K2.6 |
build |
Features, refactors, multi-file | Kimi K2.6 | High | DeepSeek V4 Pro β Qwen 3.6 Plus |
debug |
Production errors, terminal work | DeepSeek V4 Pro | Medium | Kimi K2.6 β DeepSeek V4 Flash |
review |
Code review, security audits | Kimi K2.6 | High | DeepSeek V4 Pro |
visual |
Screenshots, mockups, UI analysis | MiMo V2 Omni | Off | Qwen 3.6 Plus |
fast |
Quick edits, search, tests, docs | DeepSeek V4 Flash | Off | Qwen 3.5 Plus |
All models via OpenCode (opencode-go/) provider β opencode.ai
User β Task Router β Classify β Spawn Specialist Agent β Return to User
β
βββββββββββββββββββββββββββββββββββββββ
β plan β GLM-5.1 (high thinking) β
β build β Kimi K2.6 (high thinking) β
β debug β DeepSeek V4 Pro (medium) β
β review β Kimi K2.6 (high thinking) β
β visual β MiMo V2 Omni (no thinking) β
β fast β DeepSeek V4 Flash (no thinking)β
βββββββββββββββββββββββββββββββββββββββ
β
Agent finishes β Result appears in session
If the primary model is unavailable (rate limit, outage, etc.):
plan: GLM-5.1 β Kimi K2.6
build: Kimi K2.6 β DeepSeek V4 Pro β Qwen 3.6 Plus
debug: DeepSeek V4 Pro β Kimi K2.6 β DeepSeek V4 Flash
review: Kimi K2.6 β DeepSeek V4 Pro
visual: MiMo V2 Omni β Qwen 3.6 Plus
fast: DeepSeek V4 Flash β Qwen 3.5 Plus
You never see the switch. The router handles it and reports fallbacks in the next heartbeat.
Replace any model in openclaw.json with your preferred provider:
{
"id": "plan",
"model": {
"primary": "anthropic/claude-sonnet-4-20250514",
"fallbacks": ["opencode-go/kimi-k2.6"]
}
}Works with any OpenRouter, OpenAI, Anthropic, or local model provider OpenClaw supports.
Define new specialists in openclaw.json and add routing rules to AGENTS.md:
{
"id": "security",
"description": "Security audits and vulnerability scanning",
"model": { "primary": "opencode-go/deepseek-v4-pro" }
}Change high β medium β off per agent to trade reasoning depth for speed/cost:
{ "id": "fast", "thinking": "off" } // cheapest, fastest
{ "id": "debug", "thinking": "medium" } // balanced
{ "id": "plan", "thinking": "high" } // deepest reasoning| Problem | Solution |
|---|---|
| One model does everything poorly | 6 specialists, each best at their job |
| Expensive reasoning on simple tasks | Fast agent uses Flash (cheap), complex tasks use Pro |
| Waiting at a blank screen | Async delegation β instant confirmation |
| No visibility into agent status | 2-minute heartbeat trees |
| Model outages break everything | Automatic fallback chains |
| AI hallucinates nonexistent code | Hard NEVER constraints + mandatory search-before-write |
openclaw-task-router/
βββ AGENTS.md β The router prompt (copy to ~/.openclaw/workspace/)
βββ openclaw.json β Full agent configuration (copy to ~/.openclaw/)
βββ README.md β This file
βββ LICENSE β MIT
βββ CHANGELOG.md β Version history
βββ examples/
βββ demo-session.md β Example router conversation
- Fork this repo
- Create your feature branch (
git checkout -b feature/my-improvement) - Commit your changes
- Push to the branch (
git push origin feature/my-improvement) - Open a Pull Request
This is a living project. Every time the router makes a mistake, update the Anti-Patterns section in AGENTS.md to encode the lesson.
- Farid (@FaridLU) β OpenClaw power user who wanted the ultimate AI orchestration experience
- Claw π β The OpenClaw Task Router agent that eats its own dogfood
Powered by OpenCode models β one API, six specialists, zero per-provider keys.
MIT β use it, fork it, share it.