Architecture

Think in layers:

  • Channels bring messages in.
  • The Gateway routes and manages sessions.
  • The Agent executes via tools and memory.
  • Providers run models.

The minimal data flow

  1. A message arrives (DM, group, webhook, or Control UI).
  2. The Gateway normalizes it and picks a session key.
  3. The Agent runs an agent turn (tool calls + model calls).
  4. Output streams back to the originating surface (Control UI / channel).

In practice, this means:

  • “Messaging” is just an ingress surface.
  • The Gateway is the long-lived process that owns state and routing.
  • The model is a dependency behind a provider, not the system.

Where state lives (so you can debug)

  • Config: ~/.openclaw/openclaw.json
  • Workspace (skills, memory, prompts): ~/.openclaw/workspace
  • Sessions: under ~/.openclaw/agents/<agentId>/sessions/
  • Logs: typically under /tmp/openclaw/ (see gateway logging docs)

Next links