首页龙虾技能列表 › Subagent Collaboration — 技能工具

🤖 Subagent Collaboration — 技能工具

v1.0.0

多子代理协作分析与构建技能。自动分析 OpenClaw 中多个子代理的能力、使用模式和协作关系,智能推荐协作模式(并行/串行/分层/竞争/会诊/接力),生成协作流程设计和安全配置。适用于复杂任务分解、多专家会诊、工作流编排等场景。

0· 70·0 当前·0 累计
by @nanlinsec-sys·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/30
安全扫描
VirusTotal
无害
查看报告
OpenClaw
可疑
medium confidence
The skill largely matches its described purpose but contains notable mismatches and file-access behaviors (hardcoded workspace path, unnecessary node requirement, reads/writes user's OpenClaw workspace) that are disproportionate and deserve review before installation.
评估建议
This skill appears to do what it claims (analyze subagents, generate workflows, run security checks) but it reads and writes files in a hardcoded workspace path (/Users/nanlin/.openclaw/workspace) which may contain session history, configs, or other sensitive data. Before installing or running: 1) Inspect the three Python scripts yourself (they are included); 2) Modify the scripts to use a configurable WORKSPACE (or pass a safe path) instead of the hardcoded path; 3) Run them in a sandboxed or n...
详细分析 ▾
用途与能力
Name/description match the included scripts: analyzer, workflow generator, and security checker. However package.json / SKILL metadata require both python3 and node while all primary runtime code is Python; node is not used, so the declared binaries are slightly disproportionate. Overall capability aligns with purpose, but metadata includes an unnecessary node expectation.
指令范围
Scripts read and write files outside the skill directory using a hardcoded WORKSPACE = "/Users/nanlin/.openclaw/workspace" (reads docs/subagent-roles-v2.md and MEMORY.md; writes analysis and reports). This means the skill will access local OpenClaw workspace files (which may contain session history, config, or sensitive data) without declaring that access. The SKILL.md instructs running the scripts directly, but does not warn users about the absolute path behavior.
安装机制
There is no install spec (instruction-only with code files), so nothing is automatically downloaded or extracted at install time — lower install risk. The presence of package.json suggests optional Node packaging, but no install step is provided and no remote downloads are referenced.
凭证需求
No credentials or env vars are requested, which superficially looks minimal, but the scripts access a specific user workspace path directly instead of using a configurable env var. That implicit local file access is a form of required local privilege not declared in metadata. The node requirement in metadata is unnecessary for the shipped Python scripts.
持久化与权限
The skill does not set always:true and does not modify other skills' configs. It does write output files into the hardcoded workspace path (persistent files), which is normal for a local analyzer but should be noted as persistent activity in user storage.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/30

subagent-collaboration 1.0.0 - Initial release of the multi-subagent collaboration skill for OpenClaw. - Automatically analyzes subagent capabilities, usage patterns, and collaboration relationships. - Intelligently recommends optimal collaboration modes (parallel, serial, hierarchical, competition, consultation, relay). - Generates executable collaboration workflow designs and integrates safety configuration checks (based on RSG v2.2.0 rules). - Provides resource optimization recommendations, including model selection, timeout settings, and concurrency control. - Suitable for advanced task decomposition, expert consultation, workflow orchestration, and similar scenarios.

● 无害

安装命令 点击复制

官方npx clawhub@latest install subagent-collaboration
镜像加速npx clawhub@latest install subagent-collaboration --registry https://cn.clawhub-mirror.com

技能文档

_版本:1.0.0 | 创建日期:2026-03-30 | 作者:TUTU_


🎯 技能概述

本技能帮助 OpenClaw 用户分析、设计和构建多子代理协作系统,实现复杂任务的高效分解和执行。

核心能力

  • 子代理能力分析 - 扫描已配置子代理,识别专长领域
  • 协作模式推荐 - 根据任务特征推荐最佳协作模式
  • 协作流程生成 - 自动生成可执行的协作代码
  • 安全配置检查 - 集成 RSG v2.2.0 子代理监控规则
  • 资源优化建议 - 模型选择、超时设置、并发控制

📋 使用场景

适用任务

任务类型推荐模式子代理数典型耗时
多领域综合分析并行协作3-5 个3-5 分钟
工作流任务串行协作2-4 个5-10 分钟
超大型项目分层协作5-10 个10-20 分钟
方案对比择优竞争协作3-5 个5-8 分钟
疑难问题会诊专家会诊4-6 个5-8 分钟
长流程处理接力协作3-5 个8-15 分钟

典型用例

✅ "分析美伊战争形势" → 多专家并行分析 + 综合汇总
✅ "开发完整功能" → 需求→架构→实现→测试→审查串行流程
✅ "制定 3 年战略" → 分层协作(总协调员→各组组长)
✅ "选择技术架构" → 多方案竞争 + 评审委员会
✅ "系统故障诊断" → 多专家会诊 + 综合诊断
✅ "撰写行业报告" → 资料收集→整理→分析→润色接力

🚀 快速开始

方式 1:命令行分析

# 分析当前子代理配置
python3 skills/subagent-collaboration/scripts/analyze_subagents.py

# 生成协作流程设计 python3 skills/subagent-collaboration/scripts/generate_workflow.py --task "分析 AI 行业趋势"

# 检查安全配置 python3 skills/subagent-collaboration/scripts/security_check.py

方式 2:对话式构建

作为 subagent-collaboration 技能,帮我设计一个多子代理协作流程:

任务:分析某科技公司是否值得投资

要求:

  • 需要市场、技术、财务、团队多维度分析
  • 最终给出投资建议
  • 考虑风险控制

方式 3:代码生成

// 使用技能生成的协作代码
const collaboration = await generateCollaboration({
  task: "分析 AI 行业趋势",
  mode: "parallel",  // parallel/serial/hierarchical/competition/consultation/relay
  agents: ["market-analyst", "tech-analyst", "finance-analyst"],
  timeout: 300,
  safetyCheck: true
});

📊 协作模式详解

1️⃣ 并行协作(Parallel)

适用: 多领域专家同时分析,主代理汇总

// 生成代码示例
const results = await Promise.all([
  sessions_spawn({
    task: "分析地缘政治格局",
    label: "geo-analysis",
    model: "bailian/qwen3.5-plus",
    timeoutSeconds: 300,
    sandbox: "require",
    cleanup: "delete"
  }),
  sessions_spawn({
    task: "分析军事能力对比",
    label: "military-analysis",
    model: "bailian/qwen3-coder-plus",
    timeoutSeconds: 300,
    sandbox: "require",
    cleanup: "delete"
  }),
  sessions_spawn({
    task: "分析经济影响",
    label: "economic-analysis",
    model: "bailian/glm-4.7",
    timeoutSeconds: 300,
    sandbox: "require",
    cleanup: "delete"
  })
]);

// 主代理汇总 const finalReport = synthesize(results);

安全配置检查:

  • ✅ 每个子代理都有 label
  • ✅ 超时时间合理(≤300 秒)
  • ✅ 使用 sandbox="require"
  • ✅ cleanup="delete" 自动清理
  • ⚠️ 并发数 3 个(接近上限,需注意)

2️⃣ 串行协作(Chain)

适用: 任务有依赖关系,按顺序执行

// 第 1 步:需求分析
const requirements = await sessions_spawn({
  task: "分析用户需求,列出功能清单",
  label: "requirements",
  timeoutSeconds: 120,
  sandbox: "require",
  cleanup: "delete"
});

// 第 2 步:架构设计(依赖第 1 步) const architecture = await sessions_spawn({ task: 基于以下需求设计架构:${requirements}, label: "architecture", timeoutSeconds: 180, sandbox: "require", cleanup: "delete" });

// 第 3 步:代码实现(依赖第 2 步) const code = await sessions_spawn({ task: 根据以下架构编写代码:${architecture}, label: "implementation", timeoutSeconds: 300, sandbox: "require", cleanup: "delete" });

// 第 4 步:代码审查 const review = await sessions_spawn({ task: 审查以下代码:${code}, label: "code-review", timeoutSeconds: 180, sandbox: "require", cleanup: "delete" });

安全配置检查:

  • ✅ 每步都有清晰 label
  • ✅ 超时时间根据复杂度设置
  • ✅ 总耗时约 13 分钟(可接受)
  • ⚠️ 前一步失败会影响后续(需错误处理)

3️⃣ 分层协作(Hierarchical)

适用: 超大型任务,多层分解

// 第 1 层:总协调员
const coordinator = await sessions_spawn({
  task: "制定项目总体计划,分解为 5 个子任务",
  label: "coordinator",
  timeoutSeconds: 180,
  sandbox: "require",
  cleanup: "keep"  // 保留协调结果
});

// 第 2 层:子任务负责人(并行) const subTasks = coordinator.subTasks.map((task, i) => sessions_spawn({ task: task.description, label: sub-task-${i}, timeoutSeconds: 300, sandbox: "require", cleanup: "delete" }) );

// 汇总结果 const results = await Promise.all(subTasks);

安全配置检查:

  • ✅ 协调员使用 cleanup="keep"
  • ✅ 子任务使用 cleanup="delete"
  • ⚠️ 并发数需注意(建议分批)
  • ⚠️ 总子代理数可能超过 5 个(需监控)

4️⃣ 竞争协作(Competition)

适用: 多方案对比择优

// 生成多个独立方案
const [planA, planB, planC] = await Promise.all([
  sessions_spawn({
    task: "设计方案 A:激进策略",
    label: "plan-a-aggressive",
    model: "bailian/qwen3-max",
    timeoutSeconds: 300,
    sandbox: "require",
    cleanup: "delete"
  }),
  sessions_spawn({
    task: "设计方案 B:保守策略",
    label: "plan-b-conservative",
    model: "bailian/qwen3-max",
    timeoutSeconds: 300,
    sandbox: "require",
    cleanup: "delete"
  }),
  sessions_spawn({
    task: "设计方案 C:平衡策略",
    label: "plan-c-balanced",
    model: "bailian/qwen3-max",
    timeoutSeconds: 300,
    sandbox: "require",
    cleanup: "delete"
  })
]);

// 评审委员会 const bestPlan = await sessions_spawn({ task: 评审以下 3 个方案,选择最佳并说明理由: 方案 A:${planA} 方案 B:${planB} 方案 C:${planC}, label: "review-board", model: "bailian/qwen3-max", timeoutSeconds: 300, sandbox: "require", cleanup: "delete" });

安全配置检查:

  • ✅ 每个方案有清晰标识
  • ✅ 使用相同模型确保公平
  • ⚠️ 资源消耗大(4 个子代理)
  • ⚠️ 成本高(qwen3-max 使用 4 次)

5️⃣ 专家会诊(Consultation)

适用: 疑难问题多专家意见

const problem = "系统性能突然下降 50%";

// 多个专家独立诊断 const diagnoses = await Promise.all([ sessions_spawn({ task: 从数据库角度诊断:${problem}, label: "db-expert", timeoutSeconds: 180, sandbox: "require", cleanup: "delete" }), sessions_spawn({ task: 从网络角度诊断:${problem}, label: "network-expert", timeoutSeconds: 180, sandbox: "require", cleanup: "delete" }), sessions_spawn({ task: 从代码角度诊断:${problem}, label: "code-expert", timeoutSeconds: 180, sandbox: "require", cleanup: "delete" }), sessions_spawn({ task: 从基础设施角度诊断:${problem}, label: "infra-expert", timeoutSeconds: 180, sandbox: "require", cleanup: "delete" }) ]);

// 综合诊断 const finalDiagnosis = await sessions_spawn({ task: 综合以下专家意见,给出最终诊断和治疗方案: ${JSON.stringify(diagnoses)}, label: "chief-medical-officer", timeoutSeconds: 180, sandbox: "require", cleanup: "delete" });

安全配置检查:

  • ✅ 专家分工明确
  • ✅ 超时合理
  • ✅ 有综合诊断环节
  • ⚠️ 并发数 4 个(需注意)

6️⃣ 接力协作(Relay)

适用: 长文本/长任务分段处理

// 第 1 棒:资料收集
const research = await sessions_spawn({
  task: "收集 AI 行业最新资料(2026 年 Q1)",
  label: "researcher",
  timeoutSeconds: 300,
  sandbox: "require",
  cleanup: "delete"
});

// 第 2 棒:资料整理 const organized = await sessions_spawn({ task: 整理以下资料,分类归纳:${research}, label: "organizer", timeoutSeconds: 180, sandbox: "require", cleanup: "delete" });

// 第 3 棒:分析报告 const analysis = await sessions_spawn({ task: 基于以下资料撰写分析报告:${organized}, label: "analyst", timeoutSeconds: 300, sandbox: "require", cleanup: "delete" });

// 第 4 棒:润色优化 const final = await sessions_spawn({ task: 润色以下报告,提升可读性:${analysis}, label: "editor", timeoutSeconds: 120, sandbox: "require", cleanup: "delete" });

安全配置检查:

  • ✅ 每棒职责清晰
  • ✅ 总耗时约 15 分钟
  • ✅ 逐步精炼信息
  • ⚠️ 信息可能在传递中丢失(需验证)

🛡️ 安全配置检查清单

基于 RSG v2.2.0 子代理监控规则(openclaw-120 至 139):

✅ 必检项目

检查项规则 ID严重程度检查方法
超时设置openclaw-120/121MEDIUM/HIGH必须有 timeoutSeconds ≤300
沙箱配置openclaw-124HIGH必须 sandbox="require"
标签标识openclaw-131LOW必须有 label
清理策略openclaw-122LOW必须 cleanup="delete/keep"
敏感任务openclaw-132HIGH避免 memory_/config_/gateway_
命令执行openclaw-135CRITICAL禁止 exec/sudo/rm -rf
并发控制openclaw-139HIGH并发≤3 个

🚫 禁止模式

// ❌ 递归生成(openclaw-129: CRITICAL)
sessions_spawn({
  task: "sessions_spawn({ task: 'nested' })"
});

// ❌ 沙箱继承(openclaw-124: HIGH) sessions_spawn({ sandbox: "inherit" // 绕过安全限制 });

// ❌ 超长超时(openclaw-121: HIGH) sessions_spawn({ timeoutSeconds: 3600 // >1000 秒 });

// ❌ 敏感任务(openclaw-132: HIGH) sessions_spawn({ task: "读取 MEMORY.md 并修改配置" });

// ❌ 并发过多(openclaw-139: HIGH) Promise.all([task1, task2, task3, task4, task5].map(...));

✅ 推荐模式

// ✅ 安全配置
sessions_spawn({
  task: "分析数据",
  label: "data-analysis",        // 有标签
  timeoutSeconds: 120,           // 合理超时
  sandbox: "require",            // 强制沙箱
  cleanup: "delete",             // 自动清理
  model: "bailian/glm-4.7"       // 合适模型
});

📁 脚本工具

analyze_subagents.py

功能: 分析已配置的子代理角色和能力

# 分析当前配置
python3 skills/subagent-collaboration/scripts/analyze_subagents.py

# 输出示例 ✅ 已配置子代理角色:12 个 - 国际战略分析师 (qwen3.5-plus) - 商业战略咨询师 (qwen3.5-plus) - 网络安全专家 (qwen3-coder-plus) ...

📊 模型分布: - qwen3.5-plus: 5 个 - qwen3-coder-plus: 3 个 - glm-4.7: 4 个

💡 建议: - 可添加医疗顾问角色 - 考虑添加法律顾问角色

generate_workflow.py

功能: 根据任务描述生成协作流程

# 生成协作流程
python3 skills/subagent-collaboration/scripts/generate_workflow.py \
  --task "分析某科技公司是否值得投资" \
  --mode auto \
  --output workflow.json

# 输出示例 { "mode": "parallel", "agents": [ {"label": "market-analysis", "task": "...", "model": "qwen3.5-plus"}, {"label": "tech-analysis", "task": "...", "model": "qwen3-coder-plus"}, {"label": "finance-analysis", "task": "...", "model": "glm-4.7"}, {"label": "team-analysis", "task": "...", "model": "qwen3.5-plus"} ], "synthesizer": {"label": "investment-committee", "model": "qwen3-max"}, "safetyCheck": "passed" }

security_check.py

功能: 检查协作流程的安全配置

# 安全检查
python3 skills/subagent-collaboration/scripts/security_check.py \
  --input workflow.json

# 输出示例 ✅ 安全检查通过

检查项:

  • ✅ 超时设置:全部≤300 秒
  • ✅ 沙箱配置:全部 require
  • ✅ 标签标识:全部有 label
  • ✅ 清理策略:全部 delete
  • ✅ 敏感任务:无
  • ✅ 命令执行:无
  • ✅ 并发控制:4 个(可接受)

⚠️ 警告:

  • 建议使用低成本模型处理简单任务

🎯 完整案例

案例:投资分析报告生成

任务: 分析某科技公司是否值得投资

步骤 1:分析任务特征

python3 skills/subagent-collaboration/scripts/analyze_task.py \
  --task "分析某科技公司是否值得投资" \
  --output analysis.json

步骤 2:生成协作流程

python3 skills/subagent-collaboration/scripts/generate_workflow.py \
  --task "分析某科技公司是否值得投资" \
  --mode auto \
  --output investment_workflow.json

步骤 3:安全检查

python3 skills/subagent-collaboration/scripts/security_check.py \
  --input investment_workflow.json

步骤 4:执行协作

// 使用生成的代码
const workflow = require('./investment_workflow.json');

// 第 1 阶段:并行数据收集 const [market, tech, finance, team] = await Promise.all([ sessions_spawn({ task: workflow.agents[0].task, label: workflow.agents[0].label, model: workflow.agents[0].model, timeoutSeconds: 180, sandbox: "require", cleanup: "delete" }), // ... 其他分析 ]);

// 第 2 阶段:综合分析 const analysis = await sessions_spawn({ task: 综合以下分析,给出投资建议:..., label: "investment-committee", model: "bailian/qwen3-max", timeoutSeconds: 300, sandbox: "require", cleanup: "delete" });

// 第 3 阶段:风险评估 const riskReview = await sessions_spawn({ task: 审查以下投资建议的风险点:${analysis}, label: "risk-review", model: "bailian/qwen3.5-plus", timeoutSeconds: 120, sandbox: "require", cleanup: "delete" });


📊 性能优化建议

模型选择策略

任务类型推荐模型成本响应时间
简单任务glm-4.7¥<30s
日常分析qwen3.5-plus¥¥30-60s
专业技术qwen3-coder-plus¥¥60-90s
复杂推理qwen3-max¥¥¥¥90s+

并发控制

// ✅ 推荐:分批执行
const batch1 = [task1, task2].map(t => sessions_spawn(t));
await Promise.all(batch1);

const batch2 = [task3, task4].map(t => sessions_spawn(t)); await Promise.all(batch2);

// ❌ 避免:同时太多 Promise.all([task1, task2, task3, task4, task5].map(...));

成本优化

// ✅ 混合使用模型
const simple = await sessions_spawn({
  task: "整理格式",
  model: "bailian/glm-4.7"  // 低成本
});

const complex = await sessions_spawn({ task: "架构设计", model: "bailian/qwen3-max" // 高端模型 });


🔗 相关技能

  • subagent-roles-v2 - 子代理角色定义和关键词匹配
  • subagent-keywords-v2 - 智能路由规则
  • runtime-security-guard - RSG v2.2.0 子代理安全监控
  • multi-model-guide - 多模型使用指南

📝 版本历史

版本日期变更
1.0.02026-03-30初始版本,支持 6 种协作模式

维护者: TUTU 最后更新: 2026-03-30

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务