OpenClaw-5分钟安装部署+10分钟开启多智能体
WorkFisher
编辑于 2026年03月12日 15:59

关注我,分享最新最热门的AI知识哦!

🦞 ClawX 多机器人协作系统 - 通用部署教程

目标:从零开始,在电脑上部署 N 个协作的 AI 机器人

适合人群:完全新手,无需编程基础

预计时间:20-30 分钟

附赠小玩具:https://github.com/ringhyacinth/star-office-ui


📚 核心概念(30秒理解)

代码块
Plain
自动换行
复制代码
┌─────────────────────────────────────────┐
│           ClawX Gateway                 │
│      (一个程序管理所有 Bot)              │
└─────────────┬───────────────────────────┘
              │
     ┌────────┴────────┬─────────┬─────────┐
     │                 │         │         │
  ┌──▼──┐          ┌──▼──┐  ┌──▼──┐  ┌──▼──┐
  │Bot 1│          │Bot 2│  │Bot 3│  │Bot 4│
  │人格A│          │人格B│  │人格C│  │人格D│
  └─────┘          └─────┘  └─────┘  └─────┘
     │                 │         │         │
  Discord          Discord   Discord   Discord
  账户1            账户2     账户3     账户4
复制成功

三个核心文件

  • openclaw.json - 系统配置(绑定哪个 Bot 用哪个人格)

  • SOUL.md - 人格(性格、说话风格)

  • SKILL.md - 技能(工作流程、专业知识)


第1步:安装 ClawX

1.1 下载安装

  1. 访问 ClawX 官网下载安装包

官网链接:https://github.com/ValueCell-ai/ClawX/releases

网盘链接:

  1. 运行安装程序,一路"下一步"

  2. 设置一下自己的LLM API

  3. 完成安装

1.2 启动客户端(快吧,就这么简单)


第2步:创建 Discord Bot(建议直接把MD文档发给龙虾,跟他一起协作去处理)

暂时无法在飞书文档外展示此内容

命令:第一点:上下文超过70的时候提醒我。第二点,开始记忆储存,每次超过70后,开始运行,并且给我清理上下文的命令

重复以下步骤创建 N 个 Bot(本教程以 4 个为例)

2.1 进入开发者平台

访问:https://discord.com/developers/applications

2.2 创建 Bot

  1. 点击 New Application

  2. 输入名称(如 Bot-1)

  3. 点击 Create

2.3 获取 Token

  1. 左侧菜单点击 Bot

  2. 点击 Reset Token

  3. ⚠️ 立即复制并保存 Token!(只显示一次)

Token 格式:MTQ3ODQw...(很长的一串)

2.4 配置权限

在 Bot 页面,开启:

  • Presence Intent

  • MESSAGE CONTENT INTENT

  • SERVER MEMBERS INTENT

在 Bot Permissions,最好全部勾上

点击 Save Changes

2.5 邀请 Bot 到服务器

  1. 左侧点击 OAuth2URL Generator

  2. 勾选 bot,applications.commands

  3. 勾选权限:(尽量还是全部勾上)

    1. ✅ Send Messages

    2. ✅ Read Message History

    3. ✅ View Channels

  4. 复制底部生成的链接

  5. 打开链接,选择服务器,点击 Authorize(别急着打开,先创建服务器和频道)

2.6 记录信息

用记事本保存每个 Bot 的:

  • Token

  • Client ID(在 General Information 页面)

代码块
Plain
自动换行
复制代码
Bot-1: Token=xxx, ID=xxx
Bot-2: Token=xxx, ID=xxx
Bot-3: Token=xxx, ID=xxx
Bot-4: Token=xxx, ID=xxx
复制成功

第3步:配置 Discord 账户

3.1 添加账户到 ClawX

在 PowerShell 中运行:

代码块
PowerShell
自动换行
复制代码
# 添加 Bot-1
openclaw channels add --channel discord --account bot1 --token "你的Bot1_Token"

# 添加 Bot-2
openclaw channels add --channel discord --account bot2 --token "你的Bot2_Token"

# 添加 Bot-3
openclaw channels add --channel discord --account bot3 --token "你的Bot3_Token"

# 添加 Bot-4
openclaw channels add --channel discord --account bot4 --token "你的Bot4_Token"
复制成功

3.2 验证配置

代码块
PowerShell
自动换行
复制代码
openclaw channels list
复制成功

应该看到 4 个 Discord 账户 ✅


第4步:创建 AI 人格

4.1 创建目录

代码块
PowerShell
自动换行
复制代码
# 创建目录
New-Item -ItemType Directory -Path "$env:USERPROFILE\.openclaw\agents\bot1" -Force
New-Item -ItemType Directory -Path "$env:USERPROFILE\.openclaw\agents\bot2" -Force
New-Item -ItemType Directory -Path "$env:USERPROFILE\.openclaw\agents\bot3" -Force
New-Item -ItemType Directory -Path "$env:USERPROFILE\.openclaw\agents\bot4" -Force
复制成功

4.2 创建 SOUL.md(人格)

SOUL.md 定义机器人的"性格"

模板(保存到 agents\bot1\SOUL.md):

代码块
Markdown
自动换行
复制代码
# SOUL.md - Bot 1

## 身份

我是 Bot 1。

(在这里描述你的机器人是谁、做什么)

## 性格

(在这里描述性格特点)

## 沟通风格

(在这里描述说话方式)

## 团队协作

(如果需要协作,描述如何与其他 Bot 配合)
复制成功

为每个 Bot 创建 SOUL.md:

  • agents\bot1\SOUL.md

  • agents\bot2\SOUL.md

  • agents\bot3\SOUL.md

  • agents\bot4\SOUL.md

4.3 创建 SKILL.md(技能)

SKILL.md 定义机器人的"能力"

模板(保存到 agents\bot1\SKILL.md):

代码块
Markdown
自动换行
复制代码
# SKILL.md - Bot 1

## 核心能力

(列出这个 Bot 擅长什么)

## 工作流程

(描述工作步骤)

## 输出格式

(描述输出应该是什么样子)

## 注意事项

(任何重要的提醒)
复制成功

为每个 Bot 创建 SKILL.md:

  • agents\bot1\SKILL.md

  • agents\bot2\SKILL.md

  • agents\bot3\SKILL.md

  • agents\bot4\SKILL.md


第5步:绑定 Bot 和人格

5.1 编辑 openclaw.json

打开文件:C:\Users\你的用户名\.openclaw\openclaw.json

如果没有,创建一个,粘贴以下内容:

代码块
JSON
自动换行
复制代码
{
  "agents": {
    "list": [
      {
        "id": "bot1",
        "workspace": "C:\\Users\\你的用户名\\.openclaw\\workspace-bot1"
      },
      {
        "id": "bot2",
        "workspace": "C:\\Users\\你的用户名\\.openclaw\\workspace-bot2"
      },
      {
        "id": "bot3",
        "workspace": "C:\\Users\\你的用户名\\.openclaw\\workspace-bot3"
      },
      {
        "id": "bot4",
        "workspace": "C:\\Users\\你的用户名\\.openclaw\\workspace-bot4"
      }
    ]
  },
  "channels": {
    "discord": {
      "enabled": true,
      "allowBots": true,
      "groupPolicy": "allowlist",
      "guilds": {
        "你的服务器ID": {
          "channels": {
            "你的频道ID": {
              "allow": true,
              "requireMention": true
            }
          }
        }
      },
      "accounts": {
        "bot1": {
          "token": "你的Bot1_Token"
        },
        "bot2": {
          "token": "你的Bot2_Token"
        },
        "bot3": {
          "token": "你的Bot3_Token"
        },
        "bot4": {
          "token": "你的Bot4_Token"
        }
      }
    }
  },
  "bindings": [
    {
      "agentId": "bot1",
      "match": {
        "channel": "discord",
        "accountId": "bot1"
      }
    },
    {
      "agentId": "bot2",
      "match": {
        "channel": "discord",
        "accountId": "bot2"
      }
    },
    {
      "agentId": "bot3",
      "match": {
        "channel": "discord",
        "accountId": "bot3"
      }
    },
    {
      "agentId": "bot4",
      "match": {
        "channel": "discord",
        "accountId": "bot4"
      }
    }
  ]
}
复制成功

5.2 关键配置说明

bindings(绑定)- 最重要!

代码块
JSON
自动换行
复制代码
"bindings": [
  {
    "agentId": "bot1",        // 使用哪个人格
    "match": {
      "channel": "discord",   // 在哪个平台
      "accountId": "bot1"     // 哪个 Discord 账户
    }
  }
]
复制成功

这个配置决定了:当你在 Discord 艾特 Bot-1 时,用 bot1 的人格回复。

requireMention

代码块
JSON
自动换行
复制代码
"requireMention": true
复制成功

作用:只在被艾特时响应,避免 Bot 自言自语。


第6步:启动和测试

6.1 重启 Gateway

代码块
PowerShell
自动换行
复制代码
# 停止
openclaw gateway stop

# 等待 3 秒
Start-Sleep -Seconds 3

# 启动
openclaw gateway start
复制成功

6.2 验证状态

代码块
PowerShell
自动换行
复制代码
openclaw status
复制成功

应该看到 Discord │ ON │ OK │ accounts 4/4 ✅

6.3 测试 Bot

在 Discord 频道中:

代码块
Plain
自动换行
复制代码
@Bot-1 你好
@Bot-2 你好
@Bot-3 你好
@Bot-4 你好
复制成功

每个 Bot 应该根据其 SOUL.md 中定义的性格回复 ✅


🎯 完成!

你现在拥有

  • ✅ N 个 Discord Bot 在线

  • ✅ 每个 Bot 有独立的人格(SOUL.md)

  • ✅ 每个 Bot 有独立的技能(SKILL.md)

  • ✅ Bot 之间可以协作


附录

A. 如何让 Bot 互相艾特

在 SOUL.md 中添加:

代码块
Markdown
自动换行
复制代码
## 如何艾特其他 Bot

使用 Discord 原生格式:
- 艾特 Bot-2: `<@Bot2的Client_ID>`
- 艾特 Bot-3: `<@Bot3的Client_ID>`

示例:
复制成功

<@123456789> 请继续处理

代码块
Plain
自动换行
复制代码
复制成功

B. 常用命令

代码块
PowerShell
自动换行
复制代码
# 查看 Gateway 状态
openclaw status

# 查看 Channels
openclaw channels list

# 查看日志
openclaw channels logs

# 运行诊断
openclaw doctor

# 重启 Gateway
openclaw gateway restart
复制成功

C. 文件结构

代码块
Plain
自动换行
复制代码
C:\Users\你的用户名\.openclaw\
├── openclaw.json          # 主配置
├── agents\
│   ├── bot1\
│   │   ├── SOUL.md        # Bot1 人格
│   │   └── SKILL.md       # Bot1 技能
│   ├── bot2\
│   │   ├── SOUL.md
│   │   └── SKILL.md
│   ├── bot3\
│   │   ├── SOUL.md
│   │   └── SKILL.md
│   └── bot4\
│       ├── SOUL.md
│       └── SKILL.md
复制成功

D. 获取服务器/频道 ID

  1. Discord 设置 → 高级 → 开启 开发者模式

  2. 右键服务器图标 → 复制 ID(服务器 ID)

  3. 右键频道 → 复制 ID(频道 ID)

E. 常见问题

Bot 不响应

  1. 检查 Token 是否正确

  2. 检查 Gateway 是否启动:openclaw status

  3. 检查日志:openclaw channels logs

Bot 回复错误人格

检查 bindings 配置是否正确

Bot 无法艾特其他 Bot

确保使用 <@Client_ID> 格式


F. 下一步

现在框架已经搭建好了,你可以:

  1. 编辑 SOUL.md - 定义每个 Bot 的性格

  2. 编辑 SKILL.md - 定义每个 Bot 的技能

  3. 测试协作 - 让 Bot 之间互相配合

提示:ClawX 会在对话时自动读取 SOUL.md 和 SKILL.md,修改后立即生效(无需重启)。


教程版本:1.0 | 最后更新:2026-03-05