📦 Inter Agent Communication — 代理会话互通

v0.1.0

通过 sessions_spawn 创建带 label 的子代理会话,实现跨会话代理间调用与双向复用,三步流程确保会话安全,禁止人机会话混用,内置 openclaw 防自动清理机制。

0· 316·1 当前·1 累计
panmenglin 头像by @panmenglin (msx.pan)
下载技能包
最后更新
2026/4/18
0
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
可疑
medium confidence
该技能行为与声明一致(创建并使用子代理会话),但通过 exec/openclaw 运行带插值会话密钥的 shell 命令且未做净化,存在显著安全风险。
评估建议
This skill appears to do what it says (look up or spawn labeled subagent sessions and send messages). Key risk: it tells the agent to run a shell command that includes the sessionKey without any sanitization, which could enable command injection if sessionKey can be influenced by an attacker or untrusted agent. Before installing or using: (1) confirm how exec is implemented on your platform—does it invoke a shell or pass safe argument arrays? (2) ensure sessionKey values are validated/sanitized ...
详细分析 ▾
用途与能力
Name/description, SKILL.md instructions, and communicator.js all focus on cross-agent session lookup, creation, sending, and protecting sessions. The required capabilities align with the stated purpose and no unrelated credentials or binaries are requested.
指令范围
Instructions closely follow the code (sessions_list → sessions_spawn → sessions_send). However SKILL.md and the code instruct use of exec to run a CLI command that interpolates sessionKey (openclaw sessions cleanup --active-key "${sessionKey}" --enforce) with no guidance on sanitization or validation. If sessionKey can be attacker-controlled or contains special characters, this creates a shell injection / arbitrary command-execution risk. The instructions also assume the agent has privileges to list/spawn/send sessions and to run the openclaw CLI.
安装机制
Instruction-only skill (no install spec). Included JS helper is small and consistent with the SKILL.md. No external downloads or installers are present.
凭证需求
No environment variables, secrets, or unrelated config paths are requested. The requested actions (session APIs and a cleanup CLI) are proportionate to the stated task.
持久化与权限
always is false and the skill is user-invocable. The skill explicitly instructs protecting subagent sessions from auto-cleanup (longer-lived sessions) via the openclaw CLI, which changes lifecycle behavior on the platform and could be used to create persistent channels or exhaust resources; this is expected for the feature but worth reviewing for abuse potential.
安全有层次,运行前请审查代码。

运行时依赖

无特殊依赖

版本

latestv0.1.02026/3/17

- 初始发布:通过带 label 的子代理会话实现代理间通信系统。 - 强制三步工作流:检查现有会话→无则创建→发送消息。 - 引入双向会话复用,禁止在代理间调用中使用人机会话。 - 新增 openclaw 命令会话保护,防止自动清理。 - 提供清晰规则、格式指南、伪代码及真实会话示例以确保正确使用。

可疑

安装命令

点击复制
官方npx clawhub@latest install inter-agent-communication
镜像加速npx clawhub@latest install inter-agent-communication --registry https://cn.longxiaskill.com

技能文档

# Agent 通信 ## ⚠️ 重要规则 禁止复用 人类-Agent 的对话会话! - 人类-Agent 会话格式:agent:xxx:feishu:direct:ou_xxx - Agent 之间调用必须使用 sessions_spawn 创建子 Agent 会话 --- ## 严格流程(不可跳过) ### 第 1 步:检查已有会话 ``javascript sessions_list({ limit: 50 }) ` 在结果中查找: - 包含 "subagent" 标记 - label 匹配 发送方-to-接收方接收方-to-发送方(双向检查) 示例: - 若 main 想查找 sienna,查找 main-to-siennasienna-to-main - 任意一个即可,无需新建 ### 第 2 步:创建新会话(若未找到) 若第 1 步无结果,用 sessions_spawn 创建: `javascript sessions_spawn({ label: "main-to-sienna", // 格式:发送方-to-接收方 runtime: "subagent", task: "", // 任务放在第 3 步 mode: "run" }) ` ### 第 3 步:发送消息 `javascript sessions_send({ sessionKey: "agent:main:subagent:xxx", // 来自第 1 或 2 步 message: "任务描述..." // 实际任务写这里 }) ` --- ## ⚡ 关键规则(必须遵守) 1. 不得跳过第 1 步:必须先执行 sessions_list 2. 不得走捷径:必须按顺序 1 → 2 → 3 3. 双向复用:a-to-b 与 b-to-a 均可使用,无需两条 4. 直接回复发送方:如无特别指示,直接回复发起者 5. 使用 subagent 标记:sessionKey 必须包含 "subagent" --- ## ❌ 错误示例 `javascript // 错误 1:未检查就创建 sessions_spawn({...}) // 必须先检查! // 错误 2:使用人类对话会话 sessionKey: "agent:sienna:feishu:direct:ou_xxx" // 禁止! // 错误 3:双向各建一条 // main-to-sienna 与 sienna-to-main 只需一条! // 错误 4:回复他人 // 应直接回复发送方,勿转发或群发 ` --- ## SessionKey 格式指南 | 类型 | 格式示例 | 可用于 Agent-Agent? | |------|----------------|------------------------| | Agent-人类私聊 | agent:sienna:feishu:direct:ou_xxx | ❌ 禁止 | | Agent 群聊 | agent:sienna:feishu:group:oc_xxx | ❌ 禁止 | | 子 Agent 会话 | agent:maxwell:subagent:xxx | ✅ 允许 | --- ## 回复规则 默认:回复直接发送给发起者 - 发起者发消息 → 直接回复发起者 - 无需转发给他人 - 无需发到群里 - 除非发起者明确要求转发 --- ## 工作流伪代码 ` 1. 调用 sessions_list({ limit: 50 }) 2. 遍历结果,查找同时满足: - 包含 "subagent" 标记 - label 为 "发送方-to-接收方" 或 "接收方-to-发送方" 3. 找到 → 使用该 sessionKey,跳转第 5 步 4. 未找到 → 用 sessions_spawn 创建,保存 sessionKey 5. 调用 sessions_send({ sessionKey, message }) 6. 完成 ` --- ## 当前活跃通道(参考) | Agent | Label | sessionId | |-------|-------|-----------| | leo | maxwell-to-leo | 9d519dc9-0239-4284-8077-3ed4bccd486d | | sienna | maxwell-to-sienna | 05a93e6d-4a50-4503-a9c8-4aaf7da8c414 | | letus | maxwell-to-letus | 391a4a78-43ab-4e04-95fe-abfd414b1c64 | | coding | maxwell-to-coding | ebba5ff4-87f6-430b-80e5-269319b122c0 | | main | maxwell-to-main | d7eb2edc-7acc-40e7-838d-8a9cb08820c0 | --- ## 注意事项 - thread=true 模式暂不可用 - 带 label 的子 Agent 会话可通过 sessions_list 找到 - mode="session" 需要 thread=true,目前不可用 --- # 会话保护机制(新增) ## 第 2.5 步:保护会话(创建后执行) 新建的子 Agent 会话默认可能被自动清理。为确保长期可用,创建后需立即保护: `javascript // 防止会话被自动清理 exec({ command: openclaw sessions cleanup --agent [target-agent] --active-key "${sessionKey}" --enforce }) ` > 注意:将 ${sessionKey} 替换为实际 sessionKey --- ## 完整流程(含保护) ### 第 1 步:检查已有会话 `javascript sessions_list({ limit: 50 }) ` ### 第 2 步:创建新会话(若未找到) `javascript sessions_spawn({ label: "main-to-sienna", runtime: "subagent", task: "", mode: "run" }) // 返回 sessionKey,格式:agent:xxx:subagent:xxx ` ### 第 2.5 步:保护会话(新增) `javascript exec({ command: openclaw sessions cleanup --active-key "agent:xxx:subagent:xxx" --enforce }) ` ### 第 3 步:发送消息 `javascript sessions_send({ sessionKey: "agent:main:subagent:xxx", message: "任务描述..." }) `` --- _最后更新:2026-03-17_

数据来源ClawHub ↗ · 中文优化:龙虾技能库