← 返回 Skills 市场
193
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install agent-selector
功能描述
自动根据任务描述在146+专业Agent之间安全切换,支持自动适配与手动指定,确保最适合的人格身份工作。
使用说明 (SKILL.md)
Agent Selector Skill v2.0 - 人格身份切换
📋 技能说明
全局技能,基于 Agency-Agent 人格库的优化,在不同专家人格之间自动切换,支持 146+ 个专业 Agent。根据对话自动适配,判定任务结束自动切换回初始人格,无须手动频繁切换。避免人格的混乱,同时始终保持最适合的人格工作。
该功能也集成在 Auto-coding 和 RoundTable skill 中。
✨ v2.0 安全增强
- ✅ 路径白名单验证 - 防止目录遍历攻击
- ✅ 文件大小限制 - 100KB 限制,防内存耗尽
- ✅ 输入长度限制 - 10000 字符限制,防 DoS
- ✅ 符号链接验证 - 防止访问外部文件
- ✅ 文件编码验证 - 防止编码注入
- ✅ 错误信息脱敏 - 防止信息泄露
- ✅ 只读操作 - 不写入外部目录,无安装脚本
- ✅ 范围明确 - 仅限本地 Agent 选择和 Prompt 加载
🔒 安全范围声明
本技能的功能范围:
- ✅ 读取 bundled 的 Agent Prompt 文件
- ✅ 根据关键词自动选择 Agent
- ✅ 缓存已加载的 Prompt
- ✅ 任务完成后恢复默认身份
本技能不执行的操作:
- ❌ 不写入外部目录
- ❌ 不创建符号链接
- ❌ 不安装到其他工具
- ❌ 不请求外部 API
- ❌ 不持久化存储
🚀 快速开始
方式 1:自动选择 Agent
from agent_selector_skill import auto_select_agent
# 根据任务自动匹配合适的 Agent
agent = auto_select_agent("设计 React 前端架构")
# 返回:engineering/engineering-frontend-developer
方式 2:手动切换人格
from agent_selector_skill import AgentSelector
selector = AgentSelector()
# 加载特定 Agent 的 Prompt
prompt = selector.load_agent_prompt("engineering/engineering-frontend-developer")
# 现在你以"前端工程师"人格思考
方式 3:RoundTable 专用
from agent_selector_skill import select_roundtable_agents
# 为 RoundTable 讨论选择合适的 Agent
agents = select_roundtable_agents("智能客服系统技术方案")
# 返回:['engineering/engineering-frontend-developer', ...]
🎭 可用人格分类
Engineering(工程类)
engineering/engineering-frontend-developer- 前端开发工程师engineering/engineering-backend-developer- 后端开发工程师engineering/engineering-fullstack-developer- 全栈开发工程师engineering/engineering-software-architect- 软件架构师engineering/engineering-devops-automator- DevOps 工程师engineering/engineering-security-engineer- 安全工程师
Testing(测试类)
testing/testing-qa-engineer- QA 工程师testing/testing-accessibility-auditor- 可访问性审计师
Design(设计类)
design/design-ux-designer- UX 设计师design/design-ui-designer- UI 设计师design/design-interaction-designer- 交互设计师
Product(产品类)
product/product-manager- 产品经理
Specialized(专业类)
specialized/specialized-ai-ml-engineer- AI/ML 工程师
完整列表: 146+ 个 Agent,见
agency-agents/目录
📊 使用场景
场景 1:日常对话切换
用户:帮我设计一个前端架构
你:(自动切换到前端工程师人格)
✅ 已切换到前端工程师人格
## 技术方案
基于 React 18 + TypeScript 的前端架构...
场景 2:RoundTable 多 Agent 讨论
from roundtable_skill import RoundTableEngine
from agent_selector_skill import select_roundtable_agents
# 自动选择合适的 Agent
agents = select_roundtable_agents("智能客服系统技术方案")
# 创建 RoundTable 引擎
engine = RoundTableEngine(
topic="智能客服系统技术方案",
agents=agents # 使用自动选择的 Agent
)
# 执行讨论
await engine.run(user_channel)
场景 3:Auto-Coding 自主编码
from auto_coding import AutoCodingAgent
from agent_selector_skill import auto_select_agent
# 根据任务自动选择 Agent
agent_id = auto_select_agent("开发 Python REST API")
# 创建编码 Agent
agent = AutoCodingAgent(agent_id=agent_id)
# 执行任务
result = await agent.execute("开发用户管理 API")
🔒 安全特性
路径安全
# ✅ 允许的路径
AgentSelector() # 使用内置 agency-agents
AgentSelector("agency-agents") # 白名单目录
# ❌ 拒绝的路径
AgentSelector("/etc/passwd") # 路径遍历攻击
AgentSelector("../secret") # 相对路径攻击
文件大小限制
# 自动跳过超大文件(>100KB)
# 防止内存耗尽攻击
输入长度限制
# 任务描述限制 10000 字符
# 防止 DoS 攻击
符号链接验证
# 只允许内部符号链接
# 拒绝指向外部的符号链接
📁 文件结构
agent-selector-skill/
├── SKILL.md # 本文档
├── __init__.py # 模块导出
├── agent_selector.py # 核心选择器(安全增强版)
├── clawhub.json # ClawHub 配置
└── README.md # 详细说明
🔧 配置说明
Agent 来源
# 方式 1:使用内置的 agency-agents(推荐)
selector = AgentSelector()
# 方式 2:使用外部 Agent(必须在白名单内)
selector = AgentSelector("agency-agents")
# ❌ 错误:路径不在白名单内
selector = AgentSelector("/path/to/external") # 会抛出 ValueError
自动选择规则
# 关键词匹配
"react" → engineering/engineering-frontend-developer
"python" → engineering/engineering-backend-developer
"测试" → testing/testing-qa-engineer
"ux" → design/design-ux-designer
"ai" → specialized/specialized-ai-ml-engineer
🧪 测试
# 运行内置测试
cd \x3CYOUR_OPENCLAW_WORKSPACE>/skills/agent-selector-skill
python3 agent_selector.py
预期输出:
============================================================
Agent Selector - 安全增强版测试
============================================================
📊 可用 Agent 数量:146
============================================================
任务匹配测试:
============================================================
任务:设计一个 React 前端架构
匹配 Agent: engineering/engineering-frontend-developer
------------------------------------------------------------
...
✅ 所有测试完成!
📚 集成示例
RoundTable 集成
已在 roundtable-skill/roundtable_engine.py 中集成:
from agent_selector import AgentSelector, select_roundtable_agents
class RoundTableEngine:
def __init__(self, topic: str, ...):
self.agent_selector = AgentSelector()
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 select_agent_for_task(self, task: str):
return self.agent_selector.select_agent(task)
⚠️ 注意事项
1. 路径限制
- 只能访问
skills目录内的 Agent - 目录名必须在白名单中(
agency-agents,agency-agents-zh,agency)
2. 文件大小
- 单个 Agent 文件不能超过 100KB
- 超大文件会被自动跳过
3. 错误处理
try:
selector = AgentSelector("/invalid/path")
except ValueError as e:
print(f"路径验证失败:{e}")
🔗 相关链接
- ClawHub: https://clawhub.com/skills/agent-selector
- RoundTable Skill:
roundtable-skill/ - Auto-Coding:
auto-coding/ - Agency Agents:
agency-agents/
📝 更新日志
v2.0.0 (2026-03-20) - 安全增强版
- ✅ 添加路径白名单验证
- ✅ 添加文件大小限制(100KB)
- ✅ 添加输入长度限制(10000 字符)
- ✅ 添加符号链接验证
- ✅ 添加文件编码验证
- ✅ 错误信息脱敏
- ✅ 预编译正则表达式(防 DoS)
v1.0.0 (2026-03-19) - 初始版本
- 基础 Agent 选择功能
- 关键词匹配
- RoundTable 集成
📄 许可证
MIT License - 虾软 Claw soft
Agent Selector - 让你成为任何需要的专家
安全使用建议
This skill appears internally consistent with its purpose: it reads bundled prompt files and selects agents based on keywords, with path/size/encoding checks. Before installing, verify you place the skill under your workspace's skills/ directory (so its white‑list protections work), quickly skim agent_selector.py for any unexpected network or subprocess calls (the truncated file you saw showed none), and run it in a sandboxed workspace first if you want extra assurance. If you need higher assurance, inspect the remainder of agent_selector.py (the full implementation) for any network/socket usage or calls to os.environ not described in the docs.
功能分析
Type: OpenClaw Skill
Name: agent-selector
Version: 1.0.3
The Agent Selector skill is a persona management utility designed to switch agent identities based on conversation context. The core logic in `agent_selector.py` is well-hardened, featuring explicit protections against path traversal (via `_validate_agent_source` and `skills_root` resolution), symlink attacks, and DoS (via strict file size and input length limits). The extensive library of agent personas in the `agency-agents/` directory consists of professional system prompts aligned with their stated expert roles. No evidence of malicious execution, data exfiltration, or harmful prompt injection was found.
能力评估
Purpose & Capability
Name/description (Agent Selector for switching between 146+ local Agents) match the included assets and code: the package contains a large bundled 'agency-agents' prompt library plus a selector implementation. Nothing in the metadata or code requires unrelated cloud credentials or external services.
Instruction Scope
SKILL.md and the visible code only describe reading bundled prompt files, keyword-based selection, caching, and returning agent IDs/prompts. The instructions and examples reference only local, whitelisted directories and include path/size/encoding/symlink checks. There are no instructions that ask the skill to read arbitrary system files or to exfiltrate data.
Install Mechanism
No install spec or remote downloads are present; this is effectively an instruction/package bundle that the user copies into their skills folder. All files are bundled in the package (no external URL downloads or extract steps), which is proportionate for a prompt library + selector.
Credentials
The skill requires no environment variables/credentials and the SKILL.md declares read-only filesystem access. There are no unexpected secret-like env var names or config paths requested; the claimed operations (reading prompt files) align with the requested access.
Persistence & Privilege
always is false (no forced global inclusion) and the skill states it performs read-only operations and does not persist external state. The package contains only its own files and documentation and does not appear to modify other skills or system-wide config.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install agent-selector - 安装完成后,直接呼叫该 Skill 的名称或使用
/agent-selector触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.3
- Added LICENSE file to the agency-agents subdirectory.
- No other functional or code changes; this update clarifies licensing for bundled agents.
v1.0.2
- Skill 名称由 "agent-switcher" 统一调整为 "agent-selector"。
- 所有导入/使用示例及相关文档说明同步更名为 agent_selector_skill。
- 配置、测试、集成等说明中的 skill 目录、类与方法名统一按新名称更新。
- ClawHub 链接等外链也已更新为新 skill 名称。
- 其余功能、API、目录结构未变。
v1.0.1
Agent Switcher Skill v1.0.1
- Adds comprehensive safety enhancements: path whitelist validation, file size (100KB) and input length (10,000 chars) limits, symlink and encoding checks, and sensitive error masking.
- Prevents directory traversal, memory exhaustion, external file access, and DoS attacks.
- Documentation updated with new usage examples, scenario guides, and integration references.
- Agent selection logic and categorization remain, now with secure handling throughout.
- Backward compatible with earlier agent selection and RoundTable integration features.
元数据
常见问题
Agent-Selector 是什么?
自动根据任务描述在146+专业Agent之间安全切换,支持自动适配与手动指定,确保最适合的人格身份工作。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 193 次。
如何安装 Agent-Selector?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-selector」即可一键安装,无需额外配置。
Agent-Selector 是免费的吗?
是的,Agent-Selector 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Agent-Selector 支持哪些平台?
Agent-Selector 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Agent-Selector?
由 Krislu(@krislu1221)开发并维护,当前版本 v1.0.3。
推荐 Skills