Agent-Selector

v1.0.3

自动根据任务描述在146+专业Agent之间安全切换,支持自动适配与手动指定,确保最适合的人格身份工作。

0· 190·0 current·0 all-time
byKrislu@krislu1221

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for krislu1221/agent-selector.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Agent-Selector" (krislu1221/agent-selector) from ClawHub.
Skill page: https://clawhub.ai/krislu1221/agent-selector
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install agent-selector

ClawHub CLI

Package manager switcher

npx clawhub@latest install agent-selector
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
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.
Assessment
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.

Like a lobster shell, security has layers — review code before you run it.

latestvk97cy42tya4k4p4ys6k1hp5yk5837zer
190downloads
0stars
3versions
Updated 1mo ago
v1.0.3
MIT-0

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 <YOUR_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}")

🔗 相关链接


📝 更新日志

v2.0.0 (2026-03-20) - 安全增强版

  • ✅ 添加路径白名单验证
  • ✅ 添加文件大小限制(100KB)
  • ✅ 添加输入长度限制(10000 字符)
  • ✅ 添加符号链接验证
  • ✅ 添加文件编码验证
  • ✅ 错误信息脱敏
  • ✅ 预编译正则表达式(防 DoS)

v1.0.0 (2026-03-19) - 初始版本

  • 基础 Agent 选择功能
  • 关键词匹配
  • RoundTable 集成

📄 许可证

MIT License - 虾软 Claw soft


Agent Selector - 让你成为任何需要的专家

Comments

Loading comments...