claw-router
星标18
分支1
更新时间2026年3月7日 09:08
Trait-based intelligent model routing — automatically routes messages to the best AI model
安装
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
SKILL.md
readonly菜单
Trait-based intelligent model routing — automatically routes messages to the best AI model
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | claw-router |
| description | Trait-based intelligent model routing — automatically routes messages to the best AI model |
Automatically selects the optimal AI model for each message based on complexity tier and task type, matched against user-declared model trait profiles.
Message → 8-dimension scoring → Tier (complexity)
→ Keyword classification → TaskType (scenario)
→ Extract traits [Tier, TaskType]
→ Score each model's traits against message traits
→ Select best match (LLM arbitration if tied)
| Tier | Scenario |
|---|---|
| TRIVIAL | Greetings, confirmations, emoji |
| SIMPLE | One-step Q&A, translations, lookups |
| MODERATE | Writing, comparisons, summaries |
| COMPLEX | Coding, debugging, multi-step analysis |
| EXPERT | System design, formal proofs, architecture |
| Type | Scenario |
|---|---|
| coding | Programming, debugging, code generation |
| writing | Writing, creative content, copywriting |
| chat | Casual conversation, greetings |
| analysis | Reasoning, comparison, evaluation |
| translation | Translation |
| math | Mathematics, formulas, calculations |
| research | Research, papers, literature review |
| other | Unclassified (default fallback) |
Declare a models array in OpenClaw plugin config. Each model specifies an id and its traits:
{
"models": [
{
"id": "anthropic/claude-sonnet",
"traits": ["coding", "analysis", "COMPLEX", "EXPERT"]
},
{
"id": "openai/gpt-4o-mini",
"traits": ["chat", "translation", "TRIVIAL", "SIMPLE"]
},
{
"id": "google/gemini-pro",
"traits": ["writing", "research", "MODERATE", "COMPLEX"]
}
]
}
Trait vocabulary (fixed):
TRIVIAL / SIMPLE / MODERATE / COMPLEX / EXPERTcoding / writing / chat / analysis / translation / math / research / otherWhen models is not configured, all messages use the default model (no routing).
When enabled, LLM is invoked in two scenarios:
{
"llmScoring": {
"enabled": true,
"model": "deepseek-ai/DeepSeek-V3-Chat",
"apiKey": "sk-xxx",
"baseUrl": "https://api.siliconflow.cn"
}
}
/route — Show routing status and stats/route <message> — Test-route a messageclaw_route — Programmatic routing querynpx tsx --test test/engine.test.ts test/scorer.test.ts test/task-classifier.test.ts test/model-matcher.test.ts