Files
openclaw/docs/surface.md

21 lines
1.6 KiB
Markdown
Raw Normal View History

---
2025-12-15 10:11:18 -06:00
summary: "Routing rules per surface (WhatsApp, Telegram, Discord, web) and shared context"
read_when:
- Changing surface routing or inbox behavior
---
2025-12-06 23:16:23 +01:00
# Surfaces & Routing
Updated: 2025-12-07
2025-12-06 23:16:23 +01:00
Goal: make replies deterministic per channel while keeping one shared context for direct chats.
2026-01-02 01:19:22 +01:00
- **Surfaces** (channel labels): `whatsapp`, `webchat`, `telegram`, `discord`, `imessage`, `voice`, etc. Add `Surface` to inbound `MsgContext` so templates/agents can log which channel a turn came from. Routing is fixed: replies go back to the origin surface; the model doesnt choose.
2025-12-23 02:44:38 +01:00
- **Reply context:** inbound replies include `ReplyToId`, `ReplyToBody`, and `ReplyToSender`, and the quoted context is appended to `Body` as a `[Replying to ...]` block.
2026-01-02 10:14:58 +01:00
- **Canonical direct session:** All direct chats collapse into the single `main` session by default (no config needed). Groups stay `surface:group:<id>` (rooms: `surface:channel:<id>`), so they remain isolated.
2026-01-04 14:32:47 +00:00
- **Session store:** Keys are resolved via `resolveSessionKey(scope, ctx, mainKey)`; the agent JSONL path lives under `~/.clawdbot/sessions/<SessionId>.jsonl`.
2025-12-13 13:25:49 +00:00
- **WebChat:** Always attaches to `main`, loads the full session transcript so desktop reflects cross-surface history, and writes new turns back to the same session.
2025-12-06 23:16:23 +01:00
- **Implementation hints:**
2026-01-02 01:19:22 +01:00
- Set `Surface` in each ingress (WhatsApp gateway, WebChat bridge, Telegram, Discord, iMessage).
2025-12-09 20:21:41 +00:00
- Keep routing deterministic: originate → same surface. Use the gateway WebSocket for sends; avoid side channels.
2025-12-06 23:16:23 +01:00
- Do not let the agent emit “send to X” decisions; keep that policy in the host code.