← 返回 Skills 市场
306
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install auto-agent-router
功能描述
根据消息命令自动路由到子 Agent。**Agent 应该:收到消息时首先检查是否包含 /coder、/writer 等命令,如果是则调用 sessions_spawn 启动对应子 Agent。**
使用说明 (SKILL.md)
Auto Agent Router - 自动子 Agent 路由
根据消息中的命令自动路由到合适的子 Agent,实现并发处理和专业化分工。
🎯 When to Use
Agent 行为准则
收到每条消息时,首先检查是否包含命令:
✅ USE this skill when:
- 消息开头是
/coder→ 启动 coder Agent (qwen3-coder-next) - 消息开头是
/writer→ 启动 writer Agent (qwen3.5-plus) - 消息开头是
/analyze→ 启动 analyst Agent (qwen3.5-plus) - 消息开头是
/research→ 启动 researcher Agent (gemini-3.1-pro) - 消息开头是
/review→ 启动 reviewer Agent (qwen3-max) - 消息开头是
/devops→ 启动 devops Agent (qwen3.5-plus) - 消息开头是
/auto→ 自动判断合适的 Agent
检查流程:
- 收到消息 → 首先检查开头是否包含
/xxx命令 - 如果有命令 → 调用
sessions_spawn启动对应子 Agent - 如果没有命令 → 主 Session 直接处理
🚫 When NOT to Use
❌ DON'T use this skill when:
- 消息中没有命令 → 主 Session 直接处理
- 命令不在消息开头 → 如"请帮我 /coder"不触发
- 简单问答不需要子 Agent → 主 Session 处理即可
- 命令在消息中间或结尾 → 不触发路由
📋 Trigger Rules
触发格式(严格模式)
| 格式 | 示例 | 结果 |
|---|---|---|
| 命令开头 | /coder 写代码 |
✅ 触发 |
| @名字 + 命令 | @小牛马 /coder 写代码 |
✅ 触发 |
| 消息中包含命令 | 请帮我 /coder 写代码 |
❌ 不触发 |
可用命令
| 命令 | Agent | 模型 | 用途 |
|---|---|---|---|
/coder |
coder | qwen3-coder-next | 代码任务 |
/writer |
writer | qwen3.5-plus | 写作任务 |
/analyze |
analyst | qwen3.5-plus | 数据分析 |
/research |
researcher | gemini-3.1-pro | 调研任务 |
/review |
reviewer | qwen3-max | 审查优化 |
/devops |
devops | qwen3.5-plus | 运维操作 |
/auto |
自动判断 | 根据内容 | 智能路由 |
🔧 How to Use
基本用法
用户发送命令:
/coder 写个 Hello World
Agent 响应:
✅ 🧑💻 已启动 **coder** (代码专家) 处理您的任务
─────────────────────
🤖 处理者:Agent: 🧑💻 coder
模型:dashscope/qwen3-coder-next
带@的命令
用户发送:
@小牛马 /writer 写周报
处理流程:
- 去掉@名字 →
/writer 写周报 - 匹配命令 →
/writer - 启动 Agent → writer
- 返回结果
📁 Implementation
核心组件
~/.openclaw/workspace/skills/auto-agent-router/
├── SKILL.md # 本文档
├── config.json # 路由配置
├── auto-trigger.py # 触发检测
├── dingtalk-command.py # 命令解析
├── router.py # 路由匹配
└── logger.py # 日志记录
调用方式
检测命令:
python3 ~/.openclaw/workspace/skills/auto-agent-router/auto-trigger.py "/coder 写代码"
查看配置:
cat ~/.openclaw/workspace/skills/auto-agent-router/config.json
查看日志:
tail -f /tmp/auto-route-handler.log
🔄 Workflow
用户消息:/coder 写代码
↓
1. 检测命令 (auto-trigger.py)
- 去掉@名字
- 检查开头是否匹配命令
↓
2. 解析命令 (dingtalk-command.py)
- 提取命令类型
- 提取任务内容
↓
3. 路由匹配 (router.py)
- 查找 config.json
- 确定目标 Agent
↓
4. 启动 Agent (sessions_spawn)
- 创建子 Agent Session
- 分配任务
↓
5. 返回结果
- 子 Agent 完成任务
- 推送结果给用户
📊 Response Format
启动回复
✅ 🧑💻 已启动 **coder** (代码专家) 处理您的任务
─────────────────────
🤖 处理者:Agent: 🧑💻 coder
模型:dashscope/qwen3-coder-next
完成回复
[子 Agent 的任务结果]
─────────────────────
🤖 处理者:Agent: 🧑💻 coder
运行时间:3s • Tokens: 20k
⚙️ Configuration
config.json
{
"enabled": true,
"autoRoute": true,
"flexible": false,
"bot_names": ["小牛马", "xiaoniuma", "AI 助手", "..."],
"rules": [
{
"type": "coding",
"keywords": ["代码", "函数", "bug"],
"agent": "coder",
"model": "dashscope/qwen3-coder-next",
"priority": "high"
}
],
"fallback": {
"agent": null,
"model": "dashscope/qwen3.5-plus"
}
}
自定义 Agent
编辑 config.json 的 rules 数组添加新规则:
{
"type": "custom",
"keywords": ["关键词 1", "关键词 2"],
"agent": "custom_agent",
"model": "模型名称",
"priority": "medium"
}
📝 Notes
- 严格模式:命令必须在消息开头,中间或结尾不触发
- @名字可选:支持带@或不带@的命令
- 自动学习:支持自动学习新的机器人名字
- 并发处理:多个子 Agent 可以并行运行
- Session 隔离:每个子 Agent 有独立的 Session
- 日志位置:
/tmp/auto-route-handler.log
🧪 Testing
测试命令
# 测试触发
python3 ~/.openclaw/workspace/skills/auto-agent-router/auto-trigger.py "/coder 写代码"
# 测试@命令
python3 ~/.openclaw/workspace/skills/auto-agent-router/auto-trigger.py "@小牛马 /coder 写代码"
# 测试不触发
python3 ~/.openclaw/workspace/skills/auto-agent-router/auto-trigger.py "请帮我 /coder"
预期结果
| 输入 | 输出 |
|---|---|
/coder 写代码 |
✅ 触发,路由到 coder |
@小牛马 /coder 写代码 |
✅ 触发,路由到 coder |
请帮我 /coder |
❌ 不触发,主 Session 处理 |
🔗 Related
- MEMORY.md - 包含配置和使用记录
- sessions_spawn - 启动子 Agent 的工具
最后更新: 2026-02-28
版本: 1.0.0
安全使用建议
This skill appears to do what it says: detect slash commands, match rules, and prepare child-Agent sessions. Before installing, please: 1) Inspect agent configs under ~/.openclaw/workspace/agents — ensure they don’t contain API keys or secrets that you don't want read. The skill will read those files (and SOUL.md) to build system prompts. 2) Review the skill's SKILL.md for invisible unicode/control characters (pre-scan flagged unicode-control-chars). 3) If you dislike the skill auto-saving discovered bot names, note that it writes to its own config.json via save_bot_name; you can disable or audit that behavior by editing the code. 4) Logs go to /tmp/auto-route-handler.log and may include message text (sometimes truncated) — monitor or rotate that file if privacy is a concern. 5) Understand that this skill prepares spawn metadata but relies on the host/platform (sessions_spawn) to actually create child agents; confirm your platform's spawning/auth model. If any agent configs contain secrets, do not enable this skill until those files are sanitized.
功能分析
Type: OpenClaw Skill
Name: auto-agent-router
Version: 1.0.0
The OpenClaw AgentSkills skill bundle 'auto-agent-router' is designed for message routing to sub-agents. The `SKILL.md` provides clear instructions for the AI agent to use the platform's `sessions_spawn` tool based on message commands, without instructing any malicious actions or unauthorized data access. The Python code (e.g., `router.py`, `dingtalk-command.py`) primarily handles message parsing, configuration loading, and preparing parameters for the `sessions_spawn` tool. Crucially, a `subprocess.run` call in `router.py` that could have posed a shell injection risk is commented out, indicating a design choice to rely on the OpenClaw platform's native agent spawning mechanism rather than direct shell execution. File operations are limited to reading skill configurations and logging to `/tmp`, which are benign activities. There is no evidence of data exfiltration, persistence, or other malicious intent.
能力评估
Purpose & Capability
Name/description match the code and SKILL.md. The code looks for slash commands, matches rules in config.json, and prepares information to start sub-Agents. Requested binaries (python3) are appropriate. No unrelated env vars, binaries, or external APIs are required.
Instruction Scope
Instructions and code are narrowly scoped to detecting commands and routing. The code does read ~/.openclaw/workspace/agents (agent configs and SOUL.md) and returns a system_prompt; it does not itself call an external 'sessions_spawn' service — SKILL.md states sessions_spawn is used by the host to actually spawn child agents. The skill writes/updates its own config.json (save_bot_name) and writes logs to /tmp/auto-route-handler.log. If agent config files under your workspace contain sensitive information, this skill will read them.
Install Mechanism
There is no install spec (instruction-only skill with bundled Python code). No network downloads or third-party package installs are performed by the skill itself.
Credentials
The skill requires no secrets or environment variables. However it accesses user-local paths: it reads ~/.openclaw/workspace/agents and SOUL.md files and reads/writes its own config.json in the skill directory and the /tmp log file. Accessing the workspace to enumerate/from agents is consistent with finding available agents, but could expose sensitive fields if other agent configs contain tokens or secrets.
Persistence & Privilege
always:false and no special privileges. The skill modifies only its own config.json (to save discovered bot names) and writes logs to /tmp. It does not attempt to modify other skills' configs or system-wide settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install auto-agent-router - 安装完成后,直接呼叫该 Skill 的名称或使用
/auto-agent-router触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
auto-agent-router 1.0.0
- Initial release of the auto-agent-router skill.
- Routes messages to specialized sub-Agents based on strict command detection at the message start (e.g., /coder, /writer).
- Supports concurrent session spawning for different tasks and clean session isolation.
- Configuration and routing rules managed via config.json; supports custom commands and agent types.
- Includes command trigger detection and logging for transparency and debugging.
- Does not route if commands are not at the beginning of the message or not recognized.
元数据
常见问题
Auto Agent Router 是什么?
根据消息命令自动路由到子 Agent。**Agent 应该:收到消息时首先检查是否包含 /coder、/writer 等命令,如果是则调用 sessions_spawn 启动对应子 Agent。**. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 306 次。
如何安装 Auto Agent Router?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install auto-agent-router」即可一键安装,无需额外配置。
Auto Agent Router 是免费的吗?
是的,Auto Agent Router 完全免费(开源免费),可自由下载、安装和使用。
Auto Agent Router 支持哪些平台?
Auto Agent Router 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Auto Agent Router?
由 johnson(@jiangzhiyu)开发并维护,当前版本 v1.0.0。
推荐 Skills