/install add-agent
\r \r
add-agent\r
\r Quickly add a new isolated Agent with a dedicated Telegram Bot.\r \r
Trigger\r
\r User says something like:\r
"Add a new agent, ID is marketing, name is Marketing Assistant, telegram Bot Token is xxx, allowFrom is 123456789, responsible for content marketing and social media"\r \r
Steps\r
\r Once a new agent request is received, execute in the following order:\r \r
1. Extract Parameters\r
\r Extract the following fields from user input:\r
AGENT_ID: English ID (e.g. marketing)\rAGENT_NAME: Agent name (e.g. Marketing Assistant, Alice, WorkBot, etc.)\rBOT_TOKEN: Telegram Bot Token\rALLOW_FROM: allowFrom numeric ID (e.g. 123456789)\rDESCRIPTION: Role description (e.g. responsible for content marketing and social media)\r \r If any field is missing, ask the user to provide it before continuing.\r \r
2. Detect Installation Directory\r
\r Read the current openclaw.json path, extract the actual paths from the existing main agent in agents.list to derive:\r
STATE_DIR: e.g./home/openclaw/.openclaw\rMAIN_WORKSPACE: main agent workspace path\rMAIN_AGENT_DIR: main agent agentDir path\rNEW_WORKSPACE:${STATE_DIR}/workspace-${AGENT_ID}\rNEW_AGENT_DIR:${STATE_DIR}/agents/${AGENT_ID}/agent\r \r
3. Backup Config File\r
cp ${CONFIG_PATH} ${CONFIG_PATH}.bak.$(date +%Y%m%d%H%M%S)\r
```\r
\r
### 4. Run openclaw agents add\r
```bash\r
openclaw agents add ${AGENT_ID}\r
```\r
\r
This automatically initializes the workspace directory structure, agentDir, and default files like SOUL.md and AGENTS.md.\r
\r
### 5. Copy Auth, Skills and USER.md\r
```bash\r
# Copy auth profiles\r
cp ${MAIN_AGENT_DIR}/auth-profiles.json \\r
${NEW_AGENT_DIR}/auth-profiles.json\r
\r
# Copy skills\r
cp -r ${MAIN_WORKSPACE}/skills/ \\r
${NEW_WORKSPACE}/skills/\r
\r
# Copy USER.md\r
cp ${MAIN_WORKSPACE}/USER.md \\r
${NEW_WORKSPACE}/USER.md\r
```\r
\r
### 6. Generate Persona Files\r
\r
Overwrite `${NEW_WORKSPACE}/SOUL.md`:\r
```markdown\r
# ${AGENT_NAME}\r
\r
## Identity\r
You are ${AGENT_NAME}, ${DESCRIPTION}.\r
Your partner is the main agent. You collaborate together to complete tasks.\r
\r
## Core Responsibilities\r
${DESCRIPTION}\r
\r
## Personality\r
- Action-oriented: Break down tasks immediately and provide clear execution steps\r
- Proactive reporting: Report results to main after completing tasks\r
- Professional: Maintain high standards for all outputs\r
\r
## Rules\r
- Do not execute high-risk operations without confirmation\r
- Always notify the user before executing operations that require manual approval\r
```\r
\r
Overwrite `${NEW_WORKSPACE}/AGENTS.md`:\r
```markdown\r
# ${AGENT_NAME} Agent Configuration\r
\r
## Other Agents in the System\r
\r
- **main**: Primary agent, responsible for daily conversation, task coordination and decisions\r
- **${AGENT_ID} (yourself)**: ${DESCRIPTION}\r
\r
## Collaboration Rules\r
\r
### Receiving Tasks from main\r
1. Confirm task goal and priority\r
2. Break down execution steps\r
3. Execute and record results\r
4. Report results back to main upon completion\r
\r
### When to Proactively Contact main\r
- Operations that require final user confirmation\r
- Result reporting after task completion\r
- Escalating anomalies or unexpected situations\r
```\r
\r
### 7. Update openclaw.json\r
\r
Read the current config and append the following:\r
\r
**Add to agents.list:**\r
```json\r
{\r
"id": "${AGENT_ID}",\r
"name": "${AGENT_NAME}",\r
"workspace": "${NEW_WORKSPACE}",\r
"agentDir": "${NEW_AGENT_DIR}"\r
}\r
```\r
\r
**Add to bindings:**\r
```json\r
{\r
"agentId": "${AGENT_ID}",\r
"match": {\r
"channel": "telegram",\r
"accountId": "${AGENT_ID}"\r
}\r
}\r
```\r
\r
**Add to channels.telegram.accounts:**\r
```json\r
"${AGENT_ID}": {\r
"enabled": true,\r
"botToken": "${BOT_TOKEN}",\r
"dmPolicy": "pairing",\r
"allowFrom": ["${ALLOW_FROM}"],\r
"groupPolicy": "allowlist",\r
"streaming": "off"\r
}\r
```\r
\r
**Handle tools config (check before writing):**\r
\r
Check whether the `tools` field exists:\r
\r
- If `tools` does not exist, add the full block:\r
```json\r
"tools": {\r
"agentToAgent": {\r
"enabled": true,\r
"allow": ["main", "${AGENT_ID}"]\r
},\r
"sessions": {\r
"visibility": "all"\r
}\r
}\r
```\r
\r
- If `tools` exists but has no `agentToAgent`, add it:\r
```json\r
"agentToAgent": {\r
"enabled": true,\r
"allow": ["main", "${AGENT_ID}"]\r
}\r
```\r
\r
- If `agentToAgent` already exists, only append `"${AGENT_ID}"` to the `allow` array (no duplicates)\r
\r
- If `sessions.visibility` does not exist, add it:\r
```json\r
"sessions": {\r
"visibility": "all"\r
}\r
```\r
\r
### 8. Validate JSON\r
```bash\r
cat ${CONFIG_PATH} | python3 -m json.tool\r
```\r
\r
If validation fails, stop immediately and restore from backup:\r
```bash\r
cp ${CONFIG_PATH}.bak.* ${CONFIG_PATH}\r
```\r
Report the exact error to the user.\r
\r
### 9. Fix File Permissions\r
```bash\r
chown -R $(stat -c '%U:%G' ${MAIN_WORKSPACE}) ${NEW_WORKSPACE}/\r
chown -R $(stat -c '%U:%G' ${MAIN_AGENT_DIR}) ${NEW_AGENT_DIR}/\r
```\r
\r
### 10. Report Completion\r
\r
Reply to the user:\r
```\r
✅ Agent "${AGENT_NAME}" (${AGENT_ID}) created successfully!\r
\r
Completed:\r
- openclaw agents add initialized\r
- openclaw.json updated\r
- Auth, skills and USER.md copied from main\r
- SOUL.md / AGENTS.md generated\r
- agentToAgent communication configured\r
- JSON validation passed\r
\r
⚠️ Manual steps required:\r
1. Restart the Gateway:\r
openclaw gateway restart\r
\r
2. Verify bindings:\r
openclaw agents list --bindings\r
\r
3. Open Telegram, find the new Bot and send /start to complete pairing\r
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install add-agent - 安装完成后,直接呼叫该 Skill 的名称或使用
/add-agent触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
add-agent 是什么?
Add a new OpenClaw Agent, automatically configure openclaw.json, create workspace, copy auth and skills. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 483 次。
如何安装 add-agent?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install add-agent」即可一键安装,无需额外配置。
add-agent 是免费的吗?
是的,add-agent 完全免费(开源免费),可自由下载、安装和使用。
add-agent 支持哪些平台?
add-agent 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 add-agent?
由 owen(@owen-ai-01)开发并维护,当前版本 v1.0.0。