Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion docs/DISCORD_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,46 @@ Bot 在 Discord 中显示为"在线"即连接成功。

---

## Step 5b:配置频道权限隔离(重要!)

> **Warning**:如果不做权限隔离,单个 bot 服务多个 Agent 时可能会在错误的频道发送消息,导致不同 Agent(如 CoS 和 Ops)的对话混在一起。此问题已在 [Issue #34](https://github.com/AlexAnys/opencrew/issues/34) 中报告。以下步骤可以避免此问题。

核心思路:bot 只能在**明确分配给它的频道**中发送消息。在服务器级别拒绝发送消息权限,然后在每个频道中单独允许。

### 单 Bot 配置(默认方案)

1. **创建 bot 角色**(如"OpenCrew Bot"):
- 服务器设置 → 身份组 → 创建身份组
- **不要授予管理员权限** -- 管理员权限会绕过所有频道权限覆盖
- 授予以下服务器级权限:`查看频道`、`读取消息历史`、`添加反应`、`创建公开帖子`、`创建私密帖子`、`在帖子中发送消息`、`管理帖子`
- **不要授予**服务器级别的 `发送消息` 权限

2. **将角色分配给 bot**:
- 服务器设置 → 成员 → 找到 bot → 添加"OpenCrew Bot"角色

3. **为每个 Agent 频道添加权限覆盖**(`#hq`、`#cto`、`#build` 等):
- 点击频道名 → 编辑频道 → 权限
- 点击"+"添加"OpenCrew Bot"角色
- 将 `发送消息` 设为 **允许**(绿色勾号)

4. **验证**:bot 现在应该只能在你明确允许的频道中发送消息。可以测试 bot 是否无法在 Agent 频道之外的随机频道中发言。

### 多 Bot 配置

如果你为每个 Agent 运行独立的 bot,请为每个 bot 创建**单独的角色**:

1. 创建角色:"CoS Bot"、"CTO Bot"、"Builder Bot" 等
2. 每个角色:在服务器级别拒绝 `发送消息`(同上)
3. 每个角色:仅在指定频道允许 `发送消息`
- "CoS Bot" 角色 → 仅在 `#hq` 允许发送消息
- "CTO Bot" 角色 → 仅在 `#cto` 允许发送消息
- "Builder Bot" 角色 → 仅在 `#build` 允许发送消息
4. 为每个 bot 分配对应的角色

> **注意**:这就是 Issue #34 中提到的方案——频道不是"公开"让任何 bot 随意发送的,而是手动限制每个 bot 只能在其指定频道发送消息。

---

## Step 6:获取 Channel ID(两种方法)

### 方法 A(推荐):开启开发者模式复制
Expand Down Expand Up @@ -167,7 +207,7 @@ openclaw channels resolve --channel discord "#hq" --json
注意事项:
- 每个 Bot 需要单独邀请到服务器
- 超过 75 个服务器的 Bot 需要单独申请 Message Content Intent 审批
- OpenClaw 多账户支持仍在开发中,参考 [PR #3672](https://github.com/open-claw/open-claw/pull/3672)
- OpenClaw 多账户支持已在当前版本中可用。参见 [Issue #3306](https://github.com/openclaw/openclaw/issues/3306) 了解社区验证情况

> **提示**:Discord 服务器最多 50 个 Bot,OpenCrew 的 7 个 Agent 远低于此限制。对于大多数用户,单 Bot + 频道路由已经足够。

Expand Down
29 changes: 28 additions & 1 deletion docs/FEISHU_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,33 @@ OpenCrew 在 Slack 上的核心模型是"频道=岗位,Thread=任务"——每
- **"话题=任务"暂不可用** — 同一个群组内的所有对话是平铺的,不能按 thread 隔离不同任务
- 实际影响:当一个 Agent 同时处理多个任务时,对话会混在一起。对于轻量使用(一次一个任务)影响不大;高频并行任务场景下体验会打折扣

> 这是 OpenClaw 飞书插件的已知限制([Issue #10242](https://github.com/openclaw/openclaw/issues/10242)),不是飞书平台本身的限制。后续插件更新可能会解决。
> 这是 OpenClaw 飞书插件的已知限制([Issue #29791](https://github.com/openclaw/openclaw/issues/29791)),不是飞书平台本身的限制。

### 更新:`groupSessionScope`(OpenClaw >= 2026.3.1)

从 OpenClaw 2026.3.1 开始,内置飞书插件支持 `groupSessionScope: "group_topic"`,可以实现按话题隔离会话——等同于 Slack 的 thread 隔离行为。

启用方式:在你现有的飞书频道配置中添加 `groupSessionScope`(不要覆盖其他设置):

```yaml
channels:
feishu:
# ... 你现有的 appId、appSecret 等配置 ...
groupSessionScope: "group_topic" # 添加这一行
```

或通过命令行:

```bash
openclaw config set channels.feishu.groupSessionScope group_topic
```

启用后:
- 群组内的每个飞书话题拥有独立的会话隔离
- 并发任务不再互相干扰
- 行为与 Slack 的"thread = 任务"模型一致

> **注意**:`groupSessionScope` 需要使用 **OpenClaw 内置飞书插件**。社区插件([AlexAnys/feishu-openclaw](https://github.com/AlexAnys/feishu-openclaw))不支持此参数——你必须使用 OpenClaw >= 2026.3.1 自带的内置插件。

---

Expand Down Expand Up @@ -261,6 +287,7 @@ agents:
- 每个应用需独立配置事件订阅(`im.message.receive_v1`)和权限(参考 [Step 2](#step-2配置权限--事件订阅))
- "一群一 Agent"模式下,每个群只添加对应的 bot,避免消息重复
- A2A 通信不受影响 — 走 OpenClaw 内部 `sessions_send`,与 bot 数量无关
- **已知 Bug**:多账户模式下使用 `SecretRef`(如通过 Kubernetes Secret 或外部密钥管理器存储 `appSecret`)时,网关重启后凭证可能无法正确解析([OpenClaw Issue #47436](https://github.com/openclaw/openclaw/issues/47436))。临时方案:在配置文件中使用明文密钥(注意设置文件权限),或在修改凭证后重启两次网关

---

Expand Down
78 changes: 73 additions & 5 deletions docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,48 @@

---

## 前置条件
## 前置条件清单

在开始前,请确认
在开始前,逐项确认

- **OpenClaw 已安装并可用**:运行 `openclaw status` 能看到正常输出
- **Slack workspace 已创建**:你有管理员权限
- **基本命令行能力**:能在终端里复制粘贴命令执行(或者让你现有的 OpenClaw 代为执行)
- [ ] **OpenClaw 已安装并可用**:运行 `openclaw status` 能看到正常输出
- [ ] **消息平台已就绪**:Slack workspace、Discord 服务器或飞书组织——且你有管理员权限
- [ ] **基本命令行能力**:能在终端里复制粘贴命令执行(或者让你现有的 OpenClaw 代为执行)
- [ ] **已在平台上创建 Bot/App**:必须先创建 bot/app,然后再接入 OpenClaw(详见下方平台指南)

> 不确定 OpenClaw 怎么装?参考 [OpenClaw 官方文档](https://docs.openclaw.ai/)

### 正确的部署顺序

按以下顺序操作。最常见的错误是在消息平台上的 bot 还没配好之前就尝试配置 OpenClaw 绑定。

```
人工操作(你在平台上完成):
1. 在消息平台上创建 bot/app(Discord/Slack/飞书)
2. 在平台上配置权限和 intents/scopes
3. 邀请 bot 到你的服务器/workspace/群组
4. 创建 Agent 频道/群组

Agent 自动化(你的 OpenClaw agent 执行——参见 DEPLOY.md):
5. 把平台接入 OpenClaw(openclaw channels add)
6. 部署 OpenCrew 文件(shared 协议 + workspace)
7. 写入 OpenClaw 配置(Agent 绑定、Channel ID)
8. 重启 gateway(openclaw gateway restart)
9. 验证(发测试消息)
```

> 步骤 5-9 可以通过向你现有的 OpenClaw agent 发送 [DEPLOY.md](../DEPLOY.md) 中的部署提示来全自动完成。

### 平台接入指南

| 平台 | 接入指南 | 预计时间 |
|------|---------|---------|
| Slack | [SLACK_SETUP.md](SLACK_SETUP.md) | 约 15 分钟 |
| Discord | [DISCORD_SETUP.md](DISCORD_SETUP.md) | 约 15 分钟 |
| 飞书 | [FEISHU_SETUP.md](FEISHU_SETUP.md) | 约 20 分钟 |

> **提示**:先完成对应平台的接入指南(上述步骤 1-4),然后回到本文档继续 Phase 2。

---

## Phase 1:Slack 准备(约 20 分钟)
Expand Down Expand Up @@ -245,6 +277,42 @@ sudo chown -R $USER ~/.openclaw/

---

## 新手常见错误

以下是新用户最常遇到的问题:

### 1. 部署顺序搞反

**错误**:在消息平台上还没创建 bot 就尝试运行 `openclaw channels add` 或配置绑定。

**解决**:务必先在消息平台上创建并配置好 bot/app。参见上方[正确的部署顺序](#正确的部署顺序)。

### 2. 跳过频道权限隔离(Discord)

**错误**:使用单 bot 但保留默认权限,bot 可以在任何频道发消息。这会导致不同 Agent 的对话混在一起(Issue #34)。

**解决**:按照 Discord 接入指南中的[频道权限隔离](DISCORD_SETUP.md#step-5b配置频道权限隔离重要)步骤操作。

### 3. 忘记重启 gateway

**错误**:修改了配置或绑定但没有重启。配置不会自动生效。

**解决**:修改配置后务必运行 `openclaw gateway restart`,然后用 `openclaw status` 验证。

### 4. Channel ID 填错

**错误**:复制了错误的 Channel ID 或搞混了不同频道的 ID。

**解决**:逐个核对配置中的 Channel ID 与消息平台中的实际 ID。可以用 `openclaw channels resolve` 验证。

### 5. Bot 没被邀请到频道

**错误**:创建了频道但忘了邀请 bot(Slack)或添加 bot 角色(Discord)。

**解决**:Slack 中在每个频道执行 `/invite @bot名`。Discord 中确保 bot 角色有"查看频道"权限。飞书中通过群设置添加机器人。

---

## 常用命令速查

```bash
Expand Down
36 changes: 29 additions & 7 deletions docs/KNOWN_ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
- `replyToMode: "all"` 可以确保回复进 thread
- `channels.slack.thread.historyScope = "thread"` + `inheritParent=false` 可以确保 thread 内历史隔离

但它们**无法把每条新的 root message自动变成一个新 session**。
但它们**无法把"每条新的 root message"自动变成一个新 session**。

### 当前稳定做法(不改源码,推荐)
- **把“任务”定义为 thread**:每个任务都在一个 thread 里推进
- 在频道里只发很短的 root message当作锚点(标题/任务一句话),立刻在 thread 里继续对话
- **把"任务"定义为 thread**:每个任务都在一个 thread 里推进
- 在频道里只发"很短的 root message"当作锚点(标题/任务一句话),立刻在 thread 里继续对话
- 同一频道并行多个任务:开多个 thread

### 高级(不推荐新手):dist-level patch
Expand All @@ -39,16 +39,16 @@
## P1:A2A 可见性断裂(派单后 Slack thread 没有回复)

### 现象
`sessions_send` 触发后,目标 Agent 偶尔不在预期的 Slack thread 内回复,导致用户看到派了任务但没人做
`sessions_send` 触发后,目标 Agent 偶尔不在预期的 Slack thread 内回复,导致用户看到"派了任务但没人做"

### 当前机制:A2A 可见性契约(文档级兜底)
OpenCrew 采用两步触发
OpenCrew 采用"两步触发"
1) 在目标频道创建 Slack root message(可见锚点)
2) 用 `sessions_send` 触发目标 agent,在该 thread 的 sessionKey 内执行

并要求发起方在发送后检查 thread 是否出现回复,失败则标记 `failed-delivery` 并上报。

> 这是契约兜底,不是根治;根治需要上游在 Slack deliveryContext 方面更强的确定性。
> 这是"契约兜底",不是根治;根治需要上游在 Slack deliveryContext 方面更强的确定性。

---

Expand All @@ -64,7 +64,29 @@ OpenCrew 采用“两步触发”:

---

## P2:知识系统“跨 session 语义检索”仍在探索
## P1:飞书群聊会话隔离(OpenClaw >= 2026.3.1 已解决)

### 现象

飞书群聊中,同一群组内的所有对话是平铺的——没有 thread 级别的会话隔离。当一个 Agent 同时处理多个任务时,对话会混在一起。

### 解决方案

OpenClaw 2026.3.1 在内置飞书插件中引入了 `groupSessionScope: "group_topic"`。启用后,群组内的每个飞书话题(thread)拥有独立的会话隔离,与 Slack 的 thread 隔离行为一致。

```yaml
channels:
feishu:
groupSessionScope: "group_topic"
```

配置详情参见[飞书接入指南:groupSessionScope](FEISHU_SETUP.md#更新groupsessionscopeopenclaw--202631)。

> **注意**:此功能需要使用 OpenClaw 内置飞书插件。社区插件([AlexAnys/feishu-openclaw](https://github.com/AlexAnys/feishu-openclaw))不支持 `groupSessionScope`。

---

## P2:知识系统"跨 session 语义检索"仍在探索

当前 v1 依赖 Closeout + KO 提炼;跨 session 的语义检索/索引属于探索方向(欢迎贡献)。

Expand Down
42 changes: 41 additions & 1 deletion docs/en/DISCORD_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,46 @@ Make sure the bot has "View Channel" and "Send Messages" permissions in each cha

---

## Step 5b: Configure Channel Permission Isolation (Important!)

> **Warning**: Without channel permission isolation, a single bot serving multiple agents may send messages in the wrong channel, causing conversations from different agents (e.g. CoS and Ops) to mix together. This was reported in [Issue #34](https://github.com/AlexAnys/opencrew/issues/34). The steps below prevent this.

The core idea: the bot should only be able to **send messages** in channels that are explicitly assigned to it. At the server level, deny Send Messages; then allow it per-channel.

### Single-Bot Setup (default)

1. **Create a bot role** (e.g. "OpenCrew Bot"):
- Server Settings → Roles → Create Role
- **Do NOT grant Administrator** -- Administrator bypasses all channel overrides
- Grant these server-level permissions: `View Channels`, `Read Message History`, `Add Reactions`, `Create Public Threads`, `Create Private Threads`, `Send Messages in Threads`, `Manage Threads`
- **Do NOT grant** `Send Messages` at the server level

2. **Assign the role to the bot**:
- Server Settings → Members → find the bot → add the "OpenCrew Bot" role

3. **Add per-channel permission overrides** for each agent channel (`#hq`, `#cto`, `#build`, etc.):
- Click the channel name → Edit Channel → Permissions
- Click "+" to add the "OpenCrew Bot" role
- Set `Send Messages` to **Allow** (green checkmark)

4. **Verify**: The bot should now only be able to send messages in channels where you explicitly allowed it. Test by checking that the bot cannot post in a random channel outside the agent channels.

### Multi-Bot Setup

If you are running multiple bots (one per agent), create a **separate role for each bot**:

1. Create roles: "CoS Bot", "CTO Bot", "Builder Bot", etc.
2. For each role: deny `Send Messages` at the server level (same as above)
3. For each role: allow `Send Messages` only in the designated channel
- "CoS Bot" role → allow Send Messages only in `#hq`
- "CTO Bot" role → allow Send Messages only in `#cto`
- "Builder Bot" role → allow Send Messages only in `#build`
4. Assign each bot its corresponding role

> **Note**: This is the approach referenced in Issue #34 -- the channels are not "public" in the sense that any bot can post anywhere. Instead, you manually restrict each bot's send permission to its designated channel.

---

## Step 6: Get Channel IDs (two methods)

### Method A (recommended): Enable Developer Mode and copy
Expand Down Expand Up @@ -167,7 +207,7 @@ Create a separate Discord Application for each agent. Each bot gets its own iden
Things to keep in mind:
- Each bot must be invited to the server individually
- Bots in more than 75 servers require a separate Message Content Intent approval
- OpenClaw multi-account support is still in development -- see [PR #3672](https://github.com/open-claw/open-claw/pull/3672)
- OpenClaw multi-account support is available in current versions. See [Issue #3306](https://github.com/openclaw/openclaw/issues/3306) for community confirmation

> **Tip**: Discord servers allow up to 50 bots. OpenCrew's 7 agents are well within this limit. For most users, a single bot with channel routing is sufficient.

Expand Down
29 changes: 28 additions & 1 deletion docs/en/FEISHU_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,33 @@ Feishu does have a native "Topics" (话题) feature, but **OpenClaw's Feishu plu
- **"Thread = task" is not available** -- all conversations within a group are flat; you cannot isolate different tasks into separate threads
- Practical impact: when an Agent handles multiple tasks concurrently, conversations will intermingle. For light use (one task at a time) this is fine; for heavy parallel workflows it is a noticeable limitation

> This is a known limitation of the OpenClaw Feishu plugin ([Issue #10242](https://github.com/openclaw/openclaw/issues/10242)), not the Feishu platform itself. Future plugin updates may resolve this.
> This is a known limitation of the OpenClaw Feishu plugin ([Issue #29791](https://github.com/openclaw/openclaw/issues/29791)), not the Feishu platform itself.

### Update: `groupSessionScope` (OpenClaw >= 2026.3.1)

Starting with OpenClaw 2026.3.1, the built-in Feishu plugin supports `groupSessionScope: "group_topic"`, which enables per-topic session isolation -- equivalent to Slack's thread isolation behavior.

To enable it, add `groupSessionScope` to your existing Feishu channel config (do not overwrite your other settings):

```yaml
channels:
feishu:
# ... your existing appId, appSecret, etc. ...
groupSessionScope: "group_topic" # add this line
```

Or via CLI:

```bash
openclaw config set channels.feishu.groupSessionScope group_topic
```

With this setting enabled:
- Each Feishu topic within a group chat gets its own isolated session
- Concurrent tasks no longer intermingle
- The behavior matches the Slack "thread = task" model

> **Note**: `groupSessionScope` requires the **built-in OpenClaw Feishu plugin**. The community plugin ([AlexAnys/feishu-openclaw](https://github.com/AlexAnys/feishu-openclaw)) does not support this parameter -- you must use the built-in plugin that ships with OpenClaw >= 2026.3.1.

---

Expand Down Expand Up @@ -261,6 +287,7 @@ agents:
- Each app needs its own event subscriptions (`im.message.receive_v1`) and permissions (see [Step 2](#step-2-configure-permissions-and-event-subscriptions))
- In "one group per Agent" mode, add only the corresponding bot to each group to avoid duplicate messages
- A2A communication is unaffected -- it goes through OpenClaw's internal `sessions_send`, independent of bot count
- **Known bug**: When using multi-account mode with `SecretRef` (e.g. storing `appSecret` via a Kubernetes Secret or external secret manager), there is a known issue where credentials may not be resolved correctly on gateway restart ([OpenClaw Issue #47436](https://github.com/openclaw/openclaw/issues/47436)). Workaround: use plaintext secrets in the config file (with appropriate file permissions) until this is fixed, or restart the gateway twice after credential changes

---

Expand Down
Loading