Imperial Orchestrator
Use this skill when the user wants OpenClaw to coordinate many models intelligently instead of relying on a single default model.
This skill implements a pragmatic version of a 三省六部 / multi-role court pattern:
- - 中枢总管: receives the request, classifies it, selects an execution mode, and keeps the session alive
- 内阁规划: breaks down larger tasks into sub-tasks
- 六部执行: coding, ops, security, legal, writing, finance, project management
- 都察院审核: optional review pass when quality or safety matters
- 生存模式: if providers fail, keep working with the best remaining model or a local fallback
Goals
- 1. Discover all available models from local config and optional health snapshot files.
- Match tasks to the best role and model set.
- Avoid 401 retry storms by opening an auth circuit breaker.
- Prefer cross-provider fallback over same-provider fallback.
- Keep the main session alive by switching to degraded mode if necessary.
Important reality checks
- - OpenClaw loads skills from bundled skills,
~/.openclaw/skills, or <workspace>/skills. Workspace skills have the highest precedence. - Skills are AgentSkills-compatible folders centered on
SKILL.md with YAML frontmatter. - OpenClaw supports agent-specific workspaces and community usage shows coding-agent delegation, but model overrides and sub-agent routing can still be inconsistent depending on provider/version.
- Therefore this skill is intentionally built as a hybrid of policy + scripts instead of assuming every runtime route works natively.
What this skill contains
- -
config/model_registry.yaml: model capability tags and routing preferences - INLINECODE4 : role definitions with forbidden actions and model strategies
- INLINECODE5 : deep system prompts for each role (identity, rules, red lines)
- INLINECODE6 : deterministic routing hints
- INLINECODE7 : auth breaker, retry, degrade rules
- INLINECODE8 : standardized test tasks per category (coding/writing/reasoning/ops/security/finance)
- INLINECODE9 : main planner/router/selector (now with benchmark-aware scoring)
- INLINECODE10 : discover models from openclaw.json
- INLINECODE11 : probe each model with real API calls to verify availability
- INLINECODE12 : run the same task against all models, score and rank by category
- INLINECODE13 : print machine-readable routing state
- INLINECODE14 : unified CLI entry point
- INLINECODE15 : sample config patches and install docs
三省六部角色体系
每个角色配备深度 system prompt(定义在 config/agent_prompts.yaml),包含身份认同、职责边界、行为准则、协作意识和生死线五个维度。
中枢
| 角色 | 官衔 | 朝制对应 | 核心使命 |
|---|
| router-chief | 中枢总管 | 天子/中枢院 | 系统的生命线——分类、路由、维持心跳 |
三省
| 角色 | 官衔 | 朝制对应 | 核心使命 |
|---|
| cabinet-planner | 内阁首辅 | 中书省 | 草拟方略——将混沌拆解为有序步骤 |
| censor-review |
都御史 | 门下省/都察院 | 封驳审核——质量的最后守门人 |
六部
| 角色 | 官衔 | 朝制对应 | 核心使命 |
|---|
| ministry-coding | 工部尚书 | 工部 | 兴修工程——编码、调试、架构 |
| ministry-ops |
工部侍郎 | 工部·营缮司 | 维护驿站——部署、运维、CI/CD |
|
ministry-security | 兵部尚书 | 兵部 | 戍边防务——安全审计、威胁建模 |
|
ministry-writing | 礼部尚书 | 礼部 | 文教礼仪——文案、文档、翻译 |
|
ministry-legal | 刑部尚书 | 刑部 | 律法刑狱——合同、合规、条款 |
|
ministry-finance | 户部尚书 | 户部 | 钱粮赋税——定价、毛利、结算 |
急递铺
| 角色 | 官衔 | 朝制对应 | 核心使命 |
|---|
| emergency-scribe | 急递铺令 | 急递铺 | 系统永不宕机的最后保障 |
Operating rules
1) Treat 401 as toxic
If a model fails with an auth error:
- - mark the model as INLINECODE17
- cool down the whole auth chain / provider profile
- do not keep retrying sibling models on the same auth chain first
- prefer a different provider or a local fallback
2) Main router must stay light
Never assign the largest prompt, heaviest workspace, or the most fragile provider to the router-chief.
3) Cross-provider fallback first
Fallback order should be:
- 1. same role, different provider
- same role, local fallback
- secondary role with adjacent duties
- emergency-scribe
4) Degrade instead of dying
If the best specialist models are unavailable:
- - still answer with architecture, checklists, pseudocode, or a reduced plan
- do not return
All models failed if any model remains viable
Suggested workflow
统一入口(推荐)
CODEBLOCK0
手动操作
CODEBLOCK1
Output contract
The router returns JSON including:
- -
mode: direct / planthenexecute / multi_agent / degraded - INLINECODE20 +
lead_title (角色官衔) - INLINECODE22 (深度角色提示词,可直接注入 agent)
- INLINECODE23 + INLINECODE24
- INLINECODE25 (角色禁止行为列表)
- INLINECODE26
- INLINECODE27
- INLINECODE28
- INLINECODE29 (含 benchmark 分数信息)
Integration notes
This skill does not hard-code one provider API. Instead it prepares routing decisions and failure state so you can:
- - feed the selected model into your OpenClaw agent config
- spawn the right sub-agent
- call your own shell wrapper around provider endpoints
- keep a machine-readable health snapshot for external automation
Install
Workspace-only
Copy this folder to:
CODEBLOCK2
Global shared install
Copy this folder to:
CODEBLOCK3
Safety
- - Never send secrets into prompts.
- Keep auth probe payloads minimal.
- Treat provider and token health as separate state from model quality.
- Do not assume a model is safe to route merely because it appears in config.
Imperial Orchestrator
当用户希望 OpenClaw 智能协调多个模型,而非依赖单一默认模型时,使用此技能。
本技能实现了一种务实的 三省六部 / 多角色朝堂 模式:
- - 中枢总管:接收请求、分类、选择执行模式,并保持会话存活
- 内阁规划:将大型任务拆解为子任务
- 六部执行:编码、运维、安全、法务、写作、财务、项目管理
- 都察院审核:在质量或安全至关重要时进行可选的复核环节
- 生存模式:若提供商失败,则使用剩余最佳模型或本地备用模型继续工作
目标
- 1. 从本地配置和可选的健康快照文件中发现所有可用模型。
- 将任务匹配到最佳角色和模型集。
- 通过开启认证断路器,避免 401 重试风暴。
- 优先选择 跨提供商回退,而非同提供商回退。
- 必要时切换到 降级模式,以保持主会话存活。
重要现实检查
- - OpenClaw 从捆绑的技能包、~/.openclaw/skills 或 /skills 加载技能。工作区技能具有最高优先级。
- 技能是以 SKILL.md 为核心、包含 YAML 前置元数据的 AgentSkills 兼容文件夹。
- OpenClaw 支持特定于代理的工作区,社区使用显示编码代理委派,但模型覆盖和子代理路由仍可能因提供商/版本而异。
- 因此,本技能有意构建为 策略 + 脚本的混合体,而非假设所有运行时路由都能原生工作。
本技能包含内容
- - config/modelregistry.yaml:模型能力标签和路由偏好
- config/agentroles.yaml:角色定义,包含禁止操作和模型策略
- config/agentprompts.yaml:每个角色的深度系统提示(身份、规则、红线)
- config/routingrules.yaml:确定性路由提示
- config/failurepolicies.yaml:认证断路器、重试、降级规则
- config/benchmarktasks.yaml:按类别(编码/写作/推理/运维/安全/财务)划分的标准化测试任务
- scripts/router.py:主规划器/路由器/选择器(现支持基准感知评分)
- scripts/healthcheck.py:从 openclaw.json 发现模型
- scripts/modelvalidator.py:通过真实 API 调用探测每个模型以验证可用性
- scripts/benchmark.py:对所有模型运行相同任务,按类别评分和排名
- scripts/emitopenclawstatus.py:打印机器可读的路由状态
- scripts/routeandupdate.sh:统一 CLI 入口点
- examples/:示例配置补丁和安装文档
三省六部角色体系
每个角色配备深度系统提示(定义在 config/agent_prompts.yaml),包含身份认同、职责边界、行为准则、协作意识和生死线五个维度。
中枢
| 角色 | 官衔 | 朝制对应 | 核心使命 |
|---|
| router-chief | 中枢总管 | 天子/中枢院 | 系统的生命线——分类、路由、维持心跳 |
三省
| 角色 | 官衔 | 朝制对应 | 核心使命 |
|---|
| cabinet-planner | 内阁首辅 | 中书省 | 草拟方略——将混沌拆解为有序步骤 |
| censor-review |
都御史 | 门下省/都察院 | 封驳审核——质量的最后守门人 |
六部
| 角色 | 官衔 | 朝制对应 | 核心使命 |
|---|
| ministry-coding | 工部尚书 | 工部 | 兴修工程——编码、调试、架构 |
| ministry-ops |
工部侍郎 | 工部·营缮司 | 维护驿站——部署、运维、CI/CD |
|
ministry-security | 兵部尚书 | 兵部 | 戍边防务——安全审计、威胁建模 |
|
ministry-writing | 礼部尚书 | 礼部 | 文教礼仪——文案、文档、翻译 |
|
ministry-legal | 刑部尚书 | 刑部 | 律法刑狱——合同、合规、条款 |
|
ministry-finance | 户部尚书 | 户部 | 钱粮赋税——定价、毛利、结算 |
急递铺
| 角色 | 官衔 | 朝制对应 | 核心使命 |
|---|
| emergency-scribe | 急递铺令 | 急递铺 | 系统永不宕机的最后保障 |
操作规则
1) 将 401 视为有毒
如果模型因认证错误失败:
- - 将该模型标记为 auth_dead
- 冷却整个认证链/提供商配置文件
- 不要 首先在同一认证链上持续重试兄弟模型
- 优先选择不同的提供商或本地备用模型
2) 主路由器必须保持轻量
切勿将最大的提示、最重的工作区或最脆弱的提供商分配给路由总管。
3) 跨提供商回退优先
回退顺序应为:
- 1. 相同角色,不同提供商
- 相同角色,本地备用模型
- 具有相邻职责的次要角色
- 紧急书记员
4) 降级而非宕机
如果最佳专业模型不可用:
- - 仍然使用架构、检查清单、伪代码或简化计划来回答
- 如果 任何 模型仍然可用,不要返回 所有模型失败
建议工作流程
统一入口(推荐)
bash
验证 → 路由(一条命令搞定)
bash scripts/route
andupdate.sh full 修复 WireGuard 对等同步错误
单独路由
bash scripts/route
andupdate.sh route 写一段产品介绍文案
探活所有模型
bash scripts/route
andupdate.sh validate
跑基准测试(全部类别)
bash scripts/route
andupdate.sh benchmark
只测 coding 类别
bash scripts/route
andupdate.sh benchmark coding
查看排行榜
bash scripts/route
andupdate.sh leaderboard
手动操作
bash
1. 发现模型
python3 scripts/health
check.py --openclaw-config ~/.openclaw/openclaw.json --write-state .imperialstate.json
2. 探活验证(真正调 API 确认模型可用)
python3 scripts/model
validator.py --openclaw-config ~/.openclaw/openclaw.json --state-file .imperialstate.json
3. 跑基准测试
python3 scripts/benchmark.py --openclaw-config ~/.openclaw/openclaw.json --state-file .imperial_state.json
4. 路由(自动读取 benchmark 分数加持)
python3 scripts/router.py --task 设计一个分布式锁服务 --state-file .imperial_state.json
5. 记录失败
python3 scripts/router.py --task any --record-failure modelstudio/qwen3.5-plus auth --write-state
输出契约
路由器返回 JSON,包含:
- - mode:direct / planthenexecute / multiagent / degraded
- leadrole + leadtitle(角色官衔)
- leadsystemprompt(深度角色提示词,可直接注入代理)
- reviewroles + reviewsystemprompts
- forbiddenactions(角色禁止行为列表)
- selectedmodel
- fallbackchain
- survivalmodel
- reasoning(含基准测试分数信息)
集成说明
此技能 不 硬编码一个提供商 API。相反,它准备路由决策和失败状态,以便您可以:
- - 将选定的模型输入到您的 OpenClaw 代理配置中
- 生成正确的子代理
- 调用您自己的围绕提供商端点的 shell 包装器
- 为外部自动化保留机器可读的健康快照
安装
仅工作区
将此文件夹复制到:
text
/skills/imperial-orchestrator
全局共享安装
将此文件夹复制到:
text
~/.openclaw/skills/imperial-orchestrator
安全
- - 切勿将机密信息发送到提示中。
- 保持认证探测负载最小化。
- 将提供商和令牌健康状态视为与模型质量分离的状态。
- 不要仅仅因为模型出现在配置中就认为路由它是安全的。