router-first-architecture
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRouter-First Architecture
路由优先架构
Route through domain routers before using individual tools. Routers abstract tool selection.
在使用单个工具前,先通过领域路由器进行路由。路由器可抽象工具选择过程。
Pattern
模式
Domain routers (like ) provide deterministic mapping from user intent to exact CLI commands. Always use the router first; only bypass for edge cases.
math-router领域路由器(如)提供从用户意图到精确CLI命令的确定性映射。始终优先使用路由器;仅在边缘情况下绕过它。
math-routerDO
应该做
- Call before any math operation
math-router route "<intent>" - Let domain skills co-activate with their router (via in skill-rules.json)
coActivate - Trust the router's confidence score; only fall back if
command: null - Keep trigger keywords/patterns in skill-rules.json broader than routing patterns
- 在执行任何数学操作前调用
math-router route "<intent>" - 让领域技能与其路由器共同激活(通过skill-rules.json中的配置)
coActivate - 信任路由器的置信度评分;仅当时才使用备选方案
command: null - 保持skill-rules.json中的触发关键词/模式比路由模式更宽泛
DON'T
不应该做
- Call individual scripts directly when a router exists
- Duplicate routing logic in individual skills
- Let domain skills bypass their router
- 当存在路由器时直接调用单个脚本
- 在单个技能中重复路由逻辑
- 让领域技能绕过其路由器
Co-Activation Pattern
共同激活模式
Domain skills should co-activate with their router:
json
{
"math/abstract-algebra/groups": {
"coActivate": ["math-router"],
"coActivateMode": "always"
}
}This ensures the router is always available when domain knowledge is activated.
领域技能应与其路由器共同激活:
json
{
"math/abstract-algebra/groups": {
"coActivate": ["math-router"],
"coActivateMode": "always"
}
}这确保了在领域知识被激活时,路由器始终可用。
Two-Layer Architecture
双层架构
- Skill-rules trigger layer: Nudges Claude to use the router (keywords, intent patterns)
- Router routing layer: Deterministic mapping to scripts via regex patterns
Keep the trigger layer broader than routing - the router should handle "not found" gracefully.
- Skill-rules触发层:引导Claude使用路由器(关键词、意图模式)
- 路由器路由层:通过正则表达式模式将意图确定性映射到脚本
保持触发层比路由层更宽泛——路由器应优雅处理"未找到"的情况。
Source Sessions
来源会话
- 2bbc8d6e: "Trigger layer was narrower than routing layer" - expanded triggers
- This session: Wired 8 domain math skills to co-activate with math-router
- 2bbc8d6e:"触发层比路由层更窄"——已扩展触发条件
- 本次会话:将8个领域数学技能与math-router关联为共同激活