Agent Council技能使用说明
代理委员会
为OpenClaw创建和管理自主AI代理的完整工具包,支持Discord集成。
本技能功能
代理创建:
- 创建具有独立工作空间的自主AI代理
- 生成SOUL.md(个性与职责文件)
- 生成HEARTBEAT.md(定时执行逻辑文件)
- 设置记忆系统(混合架构)
- 自动配置网关
- 将代理绑定至Discord频道(可选)
- 设置每日记忆定时任务(可选)
Discord频道管理:
- 通过API创建Discord频道
- 配置OpenClaw网关白名单
- 设置频道专属系统提示
- 重命名频道并更新关联引用
- 可选的工作空间文件搜索功能
安装指南
# Install from ClawHub
clawhub install agent-council
# Or manual install
cp -r . ~/.openclaw/skills/agent-council/
openclaw gateway config.patch --raw '{
"skills": {
"entries": {
"agent-council": {"enabled": true}
}
}
}'
第一部分:代理创建
快速开始
scripts/create-agent.sh \ --name "Watson" \ --id "watson" \ --emoji "🔬" \ --specialty "Research and analysis specialist" \ --model "anthropic/claude-opus-4-5" \ --workspace "$HOME/agents/watson" \ --discord-channel "1234567890"
工作流程
1. 收集需求
询问用户:
- 代理名称(例如:"Watson")
- 代理ID(小写,连字符分隔,例如:"watson")
- 表情符号(例如:"🔬")
- 专业领域(代理的职责)
- 模型(使用哪个LLM)
- 工作空间(创建代理文件的位置)
- Discord频道ID(可选)
2. 运行创建脚本
scripts/create-agent.sh \ --name "Agent Name" \ --id "agent-id" \ --emoji "🤖" \ --specialty "What this agent does" \ --model "provider/model-name" \ --workspace "/path/to/workspace" \ --discord-channel "1234567890" # Optional
脚本自动执行:
- ✅ 创建工作空间及内存子目录
- ✅ 生成 SOUL.md 和 HEARTBEAT.md 文件
- ✅ 更新网关配置(保留现有代理)
- ✅ 添加 Discord 频道绑定(如已指定)
- ✅ 重启网关以应用更改
- ✅ 提示设置每日记忆定时任务
3. 自定义智能体
创建后:
- SOUL.md- 完善个性、职责、边界
- HEARTBEAT.md- 添加定期检查和定时任务逻辑
- 工作空间文件- 添加智能体特定配置
智能体架构
自包含结构:
agents/ ├── watson/ │ ├── SOUL.md # Personality and responsibilities │ ├── HEARTBEAT.md # Cron execution logic │ ├── memory/ # Agent-specific memory │ │ ├── 2026-02-01.md # Daily memory logs │ │ └── 2026-02-02.md │ └── .openclaw/ │ └── skills/ # Agent-specific skills (optional)
记忆系统:
- 智能体特定记忆:<工作空间>/memory/YYYY-MM-DD.md
- 共享记忆访问:智能体可读取共享工作空间
- 每日更新:可选的摘要定时任务
定时任务:如果您的智能体需要计划任务:
- 创建包含执行逻辑的 HEARTBEAT.md
- 使用以下命令添加定时任务--session <智能体-id>
- SOUL.md 中的文档
示例
研究代理:
scripts/create-agent.sh \ --name "Watson" \ --id "watson" \ --emoji "🔬" \ --specialty "Deep research and competitive analysis" \ --model "anthropic/claude-opus-4-5" \ --workspace "$HOME/agents/watson" \ --discord-channel "1234567890"
图像生成代理:
scripts/create-agent.sh \ --name "Picasso" \ --id "picasso" \ --emoji "🎨" \ --specialty "Image generation and editing specialist" \ --model "google/gemini-3-flash-preview" \ --workspace "$HOME/agents/picasso" \ --discord-channel "9876543210"
健康追踪代理:
scripts/create-agent.sh \ --name "Nurse Joy" \ --id "nurse-joy" \ --emoji "💊" \ --specialty "Health tracking and wellness monitoring" \ --model "anthropic/claude-opus-4-5" \ --workspace "$HOME/agents/nurse-joy" \ --discord-channel "5555555555"
第二部分:Discord 频道管理
频道创建
快速开始
python3 scripts/setup-channel.py \ --name research \ --context "Deep research and competitive analysis"
工作流
- 运行设置脚本:
python3 scripts/setup-channel.py \ --name <channel-name> \ --context "<channel-purpose>" \ [--category-id <discord-category-id>]
- 应用网关配置(脚本显示的命令):
openclaw gateway config.patch --raw '{"channels": {...}}'
选项
使用类别:
python3 scripts/setup-channel.py \ --name research \ --context "Deep research and competitive analysis" \ --category-id "1234567890"
使用现有频道:
python3 scripts/setup-channel.py \ --name personal-finance \ --id 1466184336901537897 \ --context "Personal finance management"
频道重命名
快速开始
python3 scripts/rename-channel.py \ --id 1234567890 \ --old-name old-name \ --new-name new-name
工作流
- 运行重命名脚本:
python3 scripts/rename-channel.py \ --id <channel-id> \ --old-name <old-name> \ --new-name <new-name> \ [--workspace <workspace-dir>]
-
如果 systemPrompt 需要更新,则应用网关配置(由脚本显示)
-
提交工作区文件更改(如果--workspace参数被使用)
使用工作区搜索
python3 scripts/rename-channel.py \ --id 1234567890 \ --old-name old-name \ --new-name new-name \ --workspace "$HOME/my-workspace"
这将:
- 通过API重命名Discord频道
- 更新网关配置systemPrompt
- 搜索并更新工作空间文件
- 报告Git提交的文件变更
完成多智能体设置
从零开始的完整工作流程:
# 1. Create Discord channel
python3 scripts/setup-channel.py \
--name research \
--context "Deep research and competitive analysis" \
--category-id "1234567890"
# (Note the channel ID from output)
# 2. Apply gateway config for channel
openclaw gateway config.patch --raw '{"channels": {...}}'
# 3. Create agent bound to that channel
scripts/create-agent.sh \
--name "Watson" \
--id "watson" \
--emoji "🔬" \
--specialty "Deep research and competitive analysis" \
--model "anthropic/claude-opus-4-5" \
--workspace "$HOME/agents/watson" \
--discord-channel "1234567890"
# Done! Agent is created and bound to the channel
配置
Discord分类ID
选项1:命令行
python3 scripts/setup-channel.py \ --name channel-name \ --context "Purpose" \ --category-id "1234567890"
选项2:环境变量
export DISCORD_CATEGORY_ID="1234567890" python3 scripts/setup-channel.py --name channel-name --context "Purpose"
查找Discord ID
启用开发者模式:
- 设置 → 高级 → 开发者模式
复制ID:
- 右键点击频道 → 复制ID
- 右键点击分类 → 复制ID
脚本参考
create-agent.sh
参数:
- --name(必需)- 智能体名称
- --id(必需)- 智能体ID(小写,连字符分隔)
- --emoji(必填)- 代理表情符号
- --specialty(必填)- 代理的职责
- --model(必填)- 使用的LLM(提供商/模型名称)
- --workspace(必填)- 创建代理文件的路径
- --discord-channel(可选)- 绑定的Discord频道ID
输出:
- 创建代理工作区
- 生成SOUL.md和HEARTBEAT.md
- 更新网关配置
- 可选创建每日记忆定时任务
setup-channel.py
参数:
- --name(必填)- 频道名称
- --context(必填)- 频道用途/上下文
- --id(可选)- 现有频道ID
- --category-id(可选)- Discord 分类 ID
输出:
- 创建 Discord 频道(如果不存在)
- 生成网关 config.patch 命令
rename-channel.py
参数:
- --id(必需)- 频道 ID
- --old-name(必需)- 当前频道名称
- --new-name(必需)- 新频道名称
- --workspace(可选)- 要搜索的工作区目录
输出:
- 重命名 Discord 频道
- 更新网关系统提示(如果需要)
- 列出更新的文件(如果启用了工作区搜索)
网关集成
此技能与 OpenClaw 的网关配置集成:
代理:
{
"agents": {
"list": [
{
"id": "watson",
"name": "Watson",
"workspace": "/path/to/agents/watson",
"model": {
"primary": "anthropic/claude-opus-4-5"
},
"identity": {
"name": "Watson",
"emoji": "🔬"
}
}
]
}
}
绑定:
{
"bindings": [
{
"agentId": "watson",
"match": {
"channel": "discord",
"peer": {
"kind": "channel",
"id": "1234567890"
}
}
}
]
}
频道:
{
"channels": {
"discord": {
"guilds": {
"YOUR_GUILD_ID": {
"channels": {
"1234567890": {
"allow": true,
"requireMention": false,
"systemPrompt": "Deep research and competitive analysis"
}
}
}
}
}
}
}
智能体协调
您的主智能体使用 OpenClaw 内置的会话管理工具与专业智能体进行协调。
列出活跃智能体
查看所有活跃智能体及其近期活动:
sessions_list({
kinds: ["agent"],
limit: 10,
messageLimit: 3 // Show last 3 messages per agent
})
向智能体发送消息
直接通信:
sessions_send({
label: "watson", // Agent ID
message: "Research the competitive landscape for X"
})
等待响应:
sessions_send({
label: "watson",
message: "What did you find about X?",
timeoutSeconds: 300 // Wait up to 5 minutes
})
生成子智能体任务
对于复杂工作,在隔离会话中生成一个子智能体:
sessions_spawn({
agentId: "watson", // Optional: use specific agent
task: "Research competitive landscape for X and write a report",
model: "anthropic/claude-opus-4-5", // Optional: override model
runTimeoutSeconds: 3600, // 1 hour max
cleanup: "delete" // Delete session after completion
})
子智能体将:
- 在隔离环境中执行任务
- 将完成情况通知回您的会话
- 自我删除(如果清理选项设置为:"delete")
查看智能体历史
查看智能体近期工作内容:
sessions_history({
sessionKey: "watson-session-key",
limit: 50
})
协调模式
1. 直接委派(绑定至 Discord 的智能体):
- 用户向智能体的 Discord 频道发送消息
- 代理直接在频道中回复
- 主代理无需协调
2. 程序化委托(主代理 → 子代理):
// Main agent delegates task
sessions_send({
label: "watson",
message: "Research X and update memory/research-X.md"
})
// Watson works independently, updates files
// Main agent checks later or Watson reports back
3. 为复杂任务生成子代理:
// For longer-running, isolated work
sessions_spawn({
agentId: "watson",
task: "Deep dive: analyze competitors A, B, C. Write report to reports/competitors.md",
runTimeoutSeconds: 7200,
cleanup: "keep" // Keep session for review
})
4. 代理间通信:代理可以相互发送消息:
// In Watson's context
sessions_send({
label: "picasso",
message: "Create an infographic from data in reports/research.md"
})
最佳实践
何时使用Discord绑定:
- ✅ 领域特定代理(研究、健康、图像)
- ✅ 用户希望直接访问代理
- ✅ 代理应对频道活动做出响应
何时使用sessions_send:
- ✅ 程序化协调
- ✅ 主代理委托给专业代理
- ✅ 需要在同一会话中获取响应
何时使用sessions_spawn:
- ✅ 长时间运行任务(>5分钟)
- ✅ 复杂的多步骤工作
- ✅ 希望与主会话隔离
- ✅ 后台处理
示例:研究工作流程
// Main agent receives request: "Research competitor X"
// 1. Check if Watson is active
const agents = sessions_list({ kinds: ["agent"] })
// 2. Delegate to Watson
sessions_send({
label: "watson",
message: "Research competitor X: products, pricing, market position. Write findings to memory/research-X.md"
})
// 3. Watson works independently:
// - Searches web
// - Analyzes data
// - Updates memory file
// - Reports back when done
// 4. Main agent retrieves results
const results = Read("agents/watson/memory/research-X.md")
// 5. Share with user
"Research complete! Watson found: [summary]"
通信流程
主代理(您)↔ 专业代理:
User Request
↓
Main Agent (Claire)
↓
sessions_send("watson", "Research X")
↓
Watson Agent
↓
- Uses web_search
- Uses web_fetch
- Updates memory files
↓
Responds to main session
↓
Main Agent synthesizes and replies
绑定至 Discord 的代理:
User posts in #research channel
↓
Watson Agent (bound to channel)
↓
- Sees message directly
- Responds in channel
- No main agent involvement
混合方法:
User: "Research X" (main channel)
↓
Main Agent delegates to Watson
↓
Watson researches and reports back
↓
Main Agent: "Done! Watson found..."
↓
User: "Show me more details"
↓
Main Agent: "@watson post your full findings in #research"
↓
Watson posts detailed report in #research channel
故障排除
代理创建问题:
"代理未在 Discord 中出现"
- 验证频道 ID 是否正确
- 检查网关配置的绑定部分
- 重启网关:openclaw gateway restart
"模型错误"
- 验证模型名称格式:提供商/模型名称
- 检查网关配置中模型是否可用
频道管理问题:
"创建频道失败"
- 检查机器人是否拥有"管理频道"权限
- 验证 OpenClaw 配置中的机器人令牌
- 确保类别 ID 正确(如已指定)
"未找到类别"
- 验证分类ID是否正确
- 检查机器人是否有访问分类的权限
- 尝试不使用分类ID(将创建未分类项)
"频道已存在"
- 使用--id <频道ID>来配置现有频道
- 或者脚本将自动检测并配置它
使用案例
- 领域专家- 研究、健康、金融、编程代理
- 创意代理- 图像生成、写作、设计
- 任务自动化- 定时监控、报告、警报
- 多代理系统- 协调的专业代理团队
- Discord组织- 为不同代理领域构建结构化频道
高级:多代理协调
针对更大规模的多代理系统:
协调模式:
- 主代理将任务委托给专家
- 代理报告进度并请求帮助
- 为通用信息建立共享知识库
- 通过跨代理通信会话发送
任务管理:
- 与任务跟踪系统集成
- 基于代理专长分配工作
- 跟踪任务分配与完成情况
文档管理:
- 在主工作区维护代理名册
- 记录委托模式
- 为常见工作流保存操作规程
最佳实践
- 按类别组织频道- 将相关代理频道分组
- 使用描述性频道名称- 通过名称明确用途
- 设置特定的系统提示- 为每个频道提供清晰语境
- 记录代理职责- 保持 SOUL.md 文件更新
- 设置内存定时任务- 针对正在进行工作的智能体
- 单独测试智能体- 在集成到团队之前
- 安全更新网关配置- 始终使用 config.patch,切勿手动编辑
要求
机器人权限:
- 管理频道- 用于创建/重命名频道
- 查看频道- 用于读取频道列表
- 发送消息- 用于在频道中发布消息
系统:
- 已安装并配置 OpenClaw
- 通过 nvm 安装 Node.js/npm
- Python 3.6+(仅限标准库)
- Discord 机器人令牌(用于频道管理)
另请参阅
- OpenClaw 文档:https://docs.openclaw.ai
- 多智能体模式:https://docs.openclaw.ai/agents
- Discord 机器人设置:https://docs.openclaw.ai/channels/discord


微信扫一扫,打赏作者吧~