版本: 2.0.0
发布日期: 2026-03-20
作者: Krislu
许可证: MIT
agent-selector-skill/
├── SKILL.md # 技能文档
├── README.md # 本文件
├── __init__.py # 模块导出
├── agent_selector.py # 核心选择器(安全增强版)
└── clawhub.json # ClawHub 配置
clawhub install agent-selector# 复制技能目录到 skills 文件夹
cp -r agent-selector-skill <YOUR_OPENCLAW_WORKSPACE>/skills/注意:技能包已包含完整的 agency-agents 目录,无需额外配置符号链接。
from agent_selector_skill import auto_select_agent
agent = auto_select_agent("设计 React 前端架构")
print(f"推荐 Agent: {agent}")
# 输出:engineering/engineering-frontend-developerfrom agent_selector_skill import AgentSelector
selector = AgentSelector()
prompt = selector.load_agent_prompt("engineering/engineering-frontend-developer")
# 现在你以"前端工程师"人格思考from agent_selector_skill import select_roundtable_agents
agents = select_roundtable_agents("智能客服系统技术方案")
print(f"推荐 Agent: {', '.join(agents)}")
# 输出:engineering/engineering-frontend-developer, engineering/engineering-backend-developer, ...v2.0 版本添加了全面的安全加固:
# ✅ 允许
AgentSelector()
AgentSelector("agency-agents")
# ❌ 拒绝(抛出 ValueError)
AgentSelector("/etc/passwd")
AgentSelector("../secret")- 单个文件最大:100KB
- 防止内存耗尽攻击
- 任务描述最大:10000 字符
- 防止 DoS 攻击
- 只允许内部符号链接
- 拒绝指向外部的符号链接
- 只接受 UTF-8 编码
- 防止编码注入
- 不暴露完整路径
- 不暴露内部错误详情
- engineering-frontend-developer
- engineering-backend-developer
- engineering-fullstack-developer
- engineering-software-architect
- engineering-devops-automator
- engineering-security-engineer
- ... (40+ 个)
- design-ux-architect
- design-ui-designer
- design-ux-researcher
- design-interaction-designer
- ... (20+ 个)
- testing-qa-engineer
- testing-accessibility-auditor
- testing-security-auditor
- ... (15+ 个)
- product-manager
- product-owner
- ... (10+ 个)
- specialized-ai-ml-engineer
- specialized-blockchain-developer
- ... (30+ 个)
完整列表: 见
agency-agents/目录
已在 roundtable-skill 中集成:
# roundtable-skill/roundtable_engine.py
from agent_selector import AgentSelector, select_roundtable_agents
class RoundTableEngine:
def __init__(self, topic: str, ...):
self.agents = select_roundtable_agents(topic)已在 auto-coding 中集成:
# auto-coding/agent_controller.py
from agent_selector import AgentSelector
class AgentController:
def __init__(self):
self.agent_selector = AgentSelector()
def execute(self, task: str):
agent_id = self.agent_selector.select_agent(task)
# 使用选中的 Agent 执行任务cd agent-selector-skill
python3 agent_selector.py============================================================
Agent Selector - 安全增强版测试
============================================================
📊 可用 Agent 数量:146
============================================================
任务匹配测试:
============================================================
任务:设计一个 React 前端架构
匹配 Agent: engineering/engineering-frontend-developer
------------------------------------------------------------
任务:编写 Python 后端 API
匹配 Agent: engineering/engineering-backend-developer
------------------------------------------------------------
...
✅ 所有测试完成!
- 只能访问
skills目录内的 Agent - 目录名必须在白名单中
- 需要手动创建
agency-agents符号链接 - 指向
agency-agents-zh目录
try:
selector = AgentSelector("/invalid/path")
except ValueError as e:
print(f"路径验证失败:{e}")新增功能:
- ✅ 路径白名单验证
- ✅ 文件大小限制(100KB)
- ✅ 输入长度限制(10000 字符)
- ✅ 符号链接验证
- ✅ 文件编码验证
- ✅ 错误信息脱敏
- ✅ 预编译正则表达式(防 DoS)
改进:
- 支持多级 Agent 路径(如
game-development/unity/unity-developer) - 优化 Agent 扫描性能
- 改进错误处理
修复:
- 修复路径遍历漏洞
- 修复符号链接跟随问题
- 修复错误信息泄露
- 基础 Agent 选择功能
- 关键词匹配
- RoundTable 集成
MIT License
Copyright (c) 2026 虾软 Claw soft
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- ClawHub: https://clawhub.com/skills/agent-selector
- GitHub: https://github.com/openclaw/skills/agent-selector
- 文档: https://docs.openclaw.ai/skills/agent-selector
如有问题,请:
- 查看 SKILL.md 详细文档
- 运行
python3 agent_selector.py测试 - 提交 Issue 到 ClawHub
Agent Selector - 让你成为任何需要的专家