Channels & routing
OpenClaw routes replies back to the 渠道 where a message came from. The 模型 does not choose a 渠道; routing is deterministic and controlled by the host configuration.Key terms
- 渠道:
whatsapp、telegram、discord、slack、signal、imessage、webchat。 - AccountId: per‑渠道 account instance (when supported).
- AgentId: an isolated workspace + 会话 store (“brain”).
- SessionKey: the bucket key used to store context and control concurrency.
Session key shapes (examples)
Direct messages collapse to the agent’s main 会话:agent:<agentId>:<mainKey>(默认:agent:main:main)
- 群组:
agent:<agentId>:<channel>:group:<id> - 频道/房间:
agent:<agentId>:<channel>:channel:<id>
- Slack/Discord 话题会在基础键后附加
:thread:<threadId>。 - Telegram 论坛主题会将
:topic:<topicId>嵌入到群组键中。
agent:main:telegram:group:-1001234567890:topic:42agent:main:discord:channel:123456:thread:987654
Routing rules (how an agent is chosen)
Routing picks one agent for each inbound message:- 精确对等匹配(
bindings包含peer.kind+peer.id)。 - 公会匹配(Discord)通过
guildId。 - 团队匹配(Slack)通过
teamId。 - 账户匹配(渠道上的
accountId)。 - Channel match (any account on that 渠道).
- 默认代理(
agents.list[].default,否则为列表第一项,回退到main)。
Broadcast groups (run multiple agents)
Broadcast groups let you run multiple agents for the same peer when OpenClaw would normally reply (for example: in WhatsApp groups, after mention/activation gating). Config:Config overview
agents.list:命名的代理定义(工作区、模型等)。bindings:将入站渠道/账户/对等端映射到代理。
会话存储
会话存储位于状态目录下(默认为~/.openclaw):
~/.openclaw/agents/<agentId>/sessions/sessions.json- JSONL 记录与存储并存
session.store 和 {agentId} 模板覆盖存储路径。
WebChat 行为
WebChat 附加到选定的代理,并默认为该代理的主会话。因此,WebChat 允许您在一个位置查看该代理的跨通道上下文。回复上下文
入站回复包括:ReplyToId、ReplyToBody和ReplyToSender(如果可用)。- 引用上下文作为
[Replying to ...]块附加到Body。
本页面源自 openclaw/openclaw,由 BeaversLab 翻译,遵循 MIT 协议 发布。