OpenClaw Team Builder
Manage your AI agent team: add agents to any position in the org tree, deploy templates, run health checks, auto-fix issues, and rollback changes.
Setup
The script is at ~/.openclaw/skills/team-builder/scripts/team-builder.sh. It requires openclaw CLI and python3.
CODEBLOCK0
All examples below use $TB as shorthand.
View Org Tree
CODEBLOCK1
JSON output example:
CODEBLOCK2
Add an Agent
CODEBLOCK3
Parameters
| Parameter | Required | Default | Description |
|---|
| INLINECODE4 | Yes | - | Agent ID (english, kebab-case) |
| INLINECODE5 |
No | same as id | Display name |
|
--emoji | No | 🤖 | Agent emoji |
|
--role | No | 通用AI助手 | Role description for SOUL.md |
|
--parent | No | main | Parent agent ID in org tree |
|
--soul | No | auto |
auto,
template:<key>, or
skip |
|
--model | No | inherit | Model override |
|
--feishu-app-id | No | - | Feishu bot App ID |
|
--feishu-secret | No | - | Feishu bot App Secret |
|
--yes | No | false | Skip confirmation prompts |
Soul modes
- -
auto — Generate SOUL.md from role description + org relationships - INLINECODE18 — Use built-in template (also sets name/emoji/role automatically)
- INLINECODE19 — Keep OpenClaw default template
Goal-Driven Team Suggestion
Given a business goal, recommend the best team configuration from built-in templates.
CODEBLOCK4
JSON output example:
CODEBLOCK5
Supported scenarios: ecommerce(电商), content(内容创作), devteam(研发), startup(创业), consulting(专业服务), solo(超级个体).
AI Agent Workflow: Creating a New Agent
When the user wants to add a new agent, follow these exact steps in order.
CRITICAL: Collect ALL info in ONE message. Do NOT use multi-step Q&A — session context may be lost between messages.
Step 1: Ask ONE compound question (all in a single message):
"好的!帮你创建新助手,请一次性告诉我:
1️⃣ 名字和 emoji(比如:小财 💰)
2️⃣ 核心任务(一句话,比如:负责报销和财务)
3️⃣ 自主级别:建议/执行/全自动
4️⃣ 语调:专业/亲切/简洁
比如:'小财 💰,负责报销和预算,全自动,简洁'"
If the user gives a short answer (e.g. "财务助手"), infer reasonable defaults:
- - name: 小财 emoji: 💰 role: 财务管理 level: 执行 tone: 专业
If the user gives partial info, fill in sensible defaults and proceed. Do NOT ask follow-up questions.
Step 2: Immediately construct and execute (do NOT use openclaw agents add directly):
CODEBLOCK6
Then restart gateway:
CODEBLOCK7
The script automatically: creates agent, generates SOUL.md, configures agentToAgent, and binds to ALL enabled channels (Telegram, Discord, Feishu, WeChat, iMessage).
Step 3: Confirm to user (in the SAME response as execution):
"✅ 已创建并加入团队!已自动绑定所有可用渠道。"
Then show the tree:
CODEBLOCK8
Step 4: Channel configuration (in the SAME response):
After creation, check which channels the agent is missing:
CODEBLOCK9
Then guide the user based on missing_channels:
"📡 缺少以下渠道:
要配置独立的 bot 吗?
- - Telegram:请到 @BotFather 创建 bot,把 token 发给我
- Discord:请到 Developer Portal 创建 bot,把 token 发给我
- 飞书:请提供 App ID 和 App Secret
- 不需要的话可以跳过。"
When user provides credentials:
CODEBLOCK10
Then restart gateway:
CODEBLOCK11
IMPORTANT:
- - Always use
$TB --add, never directly call INLINECODE29 - Never split into multiple Q&A rounds — collect everything in one message
- If user says something like "加个客服" — use the template: INLINECODE30
- After
--add, always show channel binding status and offer feishu config
Deploy Solo Template
Deploy the "Super Individual" team: 4 specialist agents under main (dev, design, content, data).
CODEBLOCK12
Already-existing agent IDs are automatically skipped.
List Role Templates
CODEBLOCK13
Available templates: xingzheng(行政), caiwu(财务), hr(人力), kefu(客服), yunying(运营), falv(法务), neirong(内容), shuju(数据), jishu(技术)
Channel Management
View channel status, agent bindings, and add new bots for agents.
CODEBLOCK14
JSON output example:
CODEBLOCK15
Channel Model
- - Each Agent can have its own bot (Telegram/Discord/Feishu etc.)
- A shared bot can only bind to ONE agent
- To have multiple agents on the same channel, each needs its own bot
How to create bots (guide the user):
- - Telegram: Talk to @BotFather on Telegram →
/newbot → get token - Discord: Discord Developer Portal → New Application → Bot → Copy Token
- Feishu: 飞书开放平台 → 创建应用 → 获取 App ID + App Secret
AI Agent Workflow: Channel Configuration
After creating an agent, check channel status and guide the user:
CODEBLOCK16
If the agent has missing channels, ask the user:
"📡 目前缺少以下渠道绑定:
要为 配置独立的 bot 吗?
- - Telegram:请先到 @BotFather 创建 bot,把 token 发给我
- Discord:请到 Developer Portal 创建 bot,把 token 发给我
- 飞书:请提供 App ID 和 App Secret
也可以跳过,之后随时用 --channels 配置。"
When the user provides credentials, execute:
CODEBLOCK17
Then restart gateway and confirm:
CODEBLOCK18
Health Check
Scans for: gateway status, agentToAgent config, allow list completeness, SOUL.md presence, binding completeness, hierarchy file.
CODEBLOCK19
JSON output example:
CODEBLOCK20
Auto-Fix
Automatically fixes issues found by health check: restart gateway, enable agentToAgent, fill allow list, generate missing SOUL.md, add bindings, init hierarchy.
CODEBLOCK21
Team Status
Full overview: org tree, agent list, a2a config, bindings, SOUL.md line counts, backup count.
CODEBLOCK22
Rollback
Every operation creates a backup. Rollback restores config, hierarchy, and SOUL.md files, and deletes agents created in that operation.
CODEBLOCK23
Workflow Examples
"帮我加一个财务助手"
CODEBLOCK24
"看看团队现在什么状态"
CODEBLOCK25
"团队体检一下,有问题就修"
CODEBLOCK26
"刚才加错了,撤回"
CODEBLOCK27
Notes
- - All write operations auto-backup before executing (max 5 backups kept)
- Run
openclaw gateway restart after changes to apply - The script preserves existing agents — never overwrites
- TUI mode (no args) provides a full interactive menu for human use
OpenClaw 团队构建器
管理你的AI代理团队:在组织树的任意位置添加代理,部署模板,运行健康检查,自动修复问题,以及回滚更改。
设置
脚本位于 ~/.openclaw/skills/team-builder/scripts/team-builder.sh。需要 openclaw CLI 和 python3。
bash
TB=bash ~/.openclaw/skills/team-builder/scripts/team-builder.sh
以下所有示例均使用 $TB 作为简写。
查看组织树
bash
人类可读的树形结构
$TB --tree
JSON 输出(用于解析)
$TB --tree --json
JSON 输出示例:
json
{
main: {name:软软,emoji:😘,role:director,reports_to:null,manages:[xingzheng],description:},
xingzheng: {name:xingzheng,emoji:🤖,role:worker,reports_to:main,manages:[],description:}
}
添加代理
bash
完整命令行模式(无提示)
$TB --add \
--id finance-lead \
--name 小财-财务助手 \
--emoji 💰 \
--role 负责报销审核、预算管理、财务报表 \
--parent main \
--soul auto \
--yes
使用内置角色模板(自动填充角色描述)
$TB --add \
--id caiwu \
--soul template:caiwu \
--parent main \
--yes
带模型覆盖和飞书配置
$TB --add \
--id translator \
--name 翻译官 \
--emoji 🌐 \
--role 负责中英文翻译 \
--parent main \
--model anthropic/claude-sonnet-4-6 \
--feishu-app-id cli_xxx \
--feishu-secret yyy \
--yes
参数
| 参数 | 必填 | 默认值 | 描述 |
|---|
| --id | 是 | - | 代理ID(英文,短横线命名) |
| --name |
否 | 同ID | 显示名称 |
| --emoji | 否 | 🤖 | 代理表情符号 |
| --role | 否 | 通用AI助手 | SOUL.md的角色描述 |
| --parent | 否 | main | 组织树中的父代理ID |
| --soul | 否 | auto | auto、template:
或 skip |
| --model | 否 | 继承 | 模型覆盖 |
| --feishu-app-id | 否 | - | 飞书机器人App ID |
| --feishu-secret | 否 | - | 飞书机器人App Secret |
| --yes | 否 | false | 跳过确认提示 |
灵魂模式
- - auto — 根据角色描述和组织关系生成SOUL.md
- template: — 使用内置模板(同时自动设置名称/表情符号/角色)
- skip — 保留OpenClaw默认模板
目标驱动团队建议
根据业务目标,从内置模板中推荐最佳团队配置。
bash
获取推荐(人类可读)
$TB --suggest --goal 电商平台运营
JSON输出(用于AI代理解析)
$TB --suggest --goal 电商平台运营 --json
JSON输出示例:
json
{
goal: 电商平台运营,
matched_scenario: ecommerce,
scenario_name: 电商团队,
recommended_agents: [
{id: kefu, template: kefu, reason: 处理客户咨询和售后},
{id: yunying, template: yunying, reason: 运营数据分析和活动策划}
],
deploy_commands: [$TB --add --id kefu --soul template:kefu --parent main --yes, ...],
total_agents: 4
}
支持的场景:ecommerce(电商)、content(内容创作)、devteam(研发)、startup(创业)、consulting(专业服务)、solo(超级个体)。
AI代理工作流:创建新代理
当用户想要添加新代理时,请按顺序执行以下确切步骤。
关键:在一次消息中收集所有信息。不要使用多步问答——会话上下文可能在消息之间丢失。
第1步:提出一个复合问题(全部在一条消息中):
好的!帮你创建新助手,请一次性告诉我:
1️⃣ 名字和表情符号(比如:小财 💰)
2️⃣ 核心任务(一句话,比如:负责报销和财务)
3️⃣ 自主级别:建议/执行/全自动
4️⃣ 语调:专业/亲切/简洁
比如:小财 💰,负责报销和预算,全自动,简洁
如果用户给出简短回答(例如财务助手),推断合理的默认值:
- - 名称:小财 表情符号:💰 角色:财务管理 级别:执行 语调:专业
如果用户提供部分信息,填写合理的默认值并继续。不要追问。
第2步:立即构建并执行(不要直接使用 openclaw agents add):
bash
$TB --add \
--id <短横线命名ID> \
--name <名称> \
--emoji <表情符号> \
--role 核心任务:<任务>。自主级别:<级别>。语调:<语调> \
--parent main \
--soul auto \
--yes
然后重启网关:
bash
openclaw gateway restart
脚本自动:创建代理、生成SOUL.md、配置agentToAgent,并绑定到所有启用的渠道(Telegram、Discord、飞书、微信、iMessage)。
第3步:向用户确认(在与执行相同的响应中):
✅ <名称> 已创建并加入团队!已自动绑定所有可用渠道。
然后显示树形结构:
bash
$TB --tree
第4步:渠道配置(在与执行相同的响应中):
创建后,检查代理缺少哪些渠道:
bash
$TB --channels --agent --json
然后根据 missing_channels 引导用户:
📡 <名称> 缺少以下渠道:
要配置独立的机器人吗?
- - Telegram:请到 @BotFather 创建机器人,把 token 发给我
- Discord:请到 Developer Portal 创建机器人,把 token 发给我
- 飞书:请提供 App ID 和 App Secret
- 不需要的话可以跳过。
当用户提供凭证时:
bash
Telegram
$TB --channels --agent --channel telegram --token --yes
Discord
$TB --channels --agent --channel discord --token --yes
飞书
$TB --channels --agent --channel feishu --feishu-app-id --feishu-secret --yes
然后重启网关:
bash
openclaw gateway restart
重要:
- - 始终使用 $TB --add,永远不要直接调用 openclaw agents add
- 永远不要分成多轮问答——在一次消息中收集所有信息
- 如果用户说类似加个客服——使用模板:$TB --add --id kefu --soul template:kefu --parent main --yes
- 在 --add 之后,始终显示渠道绑定状态并提供飞书配置
部署单人模板
部署超级个体团队:主代理下的4个专业代理(开发、设计、内容、数据)。
bash
使用默认值部署
$TB --solo --yes
使用特定模型部署
$TB --solo --model anthropic/claude-sonnet-4-6 --yes
跳过SOUL生成
$TB --solo --soul skip --yes
已存在的代理ID会自动跳过。
列出角色模板
bash
人类可读
$TB --templates
JSON
$TB --templates --json
可用模板:xingzheng(行政)、caiwu(财务)、hr(人力)、kefu(客服)、yunying(运营)、falv(法务)、neirong(内容)、shuju(数据)、jishu(技术)
渠道管理
查看渠道状态、代理绑定,以及为代理添加新机器人。
bash
列出所有渠道和绑定
$