Open Source · MITArchitecture Guide

OpenClaw
Unpacked

How does an autonomous personal AI assistant actually work?
The PiEmbeddedRunner agent loop, 24+ channels, plugin architecture, SQLite memory, and security model, mapped from source.

24+
Channels
50+
Tools
5
Platforms
346k
Stars
24.8k
Commits
Explore Architecture ↓

System Topology

Five boundaries: external channels and triggers, the Gateway on your machine, device nodes on your phone/Mac, external model providers, and external state the agent can reach via tools.

The Agent Loop

The PiEmbeddedRunner drives a continuous async loop. Messages arrive, context is compiled by prompt-builder.ts, the Pi agent core streams tool calls, and results route back through auto-reply.ts.

↺ Tool results feed back into PiEmbeddedRunner · Loop repeats

Click a node above

Each circle is a phase of the agent loop. Click to explore.

Architecture Explorer

Eight subsystems. The Gateway orchestrates everything through a WebSocket control plane. Plugins extend channels, tools, memory, and model providers.

Gateway
Identity
Channels
Skills
Safety
Nodes
Plugins
Memory
Gateway
server.ts · WS · port 18789
Identity Engine
prompt-builder · workspace
Channels (24+)
auto-reply.ts · routing
Skills + Tools
ClawHub · browser · sandbox
Safety
policy · pairing · sandbox
SOUL.md
immutable
Config
JSON5 · env · defaults
Nodes
macOS · iOS · Android
Plugins
extensions/ · loader.ts
Memory
SQLite · index · search
ClawHub
registry
Voice
wake + talk
Tailscale
remote access

Click a block

Architecture

Each block is a subsystem. Click to explore.

Channel Catalog

Core channels ship with OpenClaw. Additional channels load as plugins from extensions/. All route through auto-reply.ts.

Core Channels (in src/)
WhatsApp Telegram Signal BlueBubbles iMessage Slack Discord Google Chat IRC WebChat
Plugin Channels (in extensions/)
MS Teams Matrix WeChat Feishu LINE Mattermost Nostr Twitch Nextcloud Tlon Zalo Synology

Click a channel

Channels

Unified routing via auto-reply.ts. DM policies, group rules, allowlists per channel.

Plugin Architecture

The plugin loader (src/plugins/loader.ts) scans extensions/ for packages declaring openclaw.extensions in package.json. Four plugin types register into distinct slots.

Channel Plugin

New Messaging Surface

Registers into the channel router. Implements auth, inbound parsing, access control, outbound formatting. MS Teams, Matrix, WeChat are all channel plugins.

Tool Plugin

New Capability

Registers into the tool registry. Extends what the agent can do — browser, canvas, custom API integrations. Managed via ClawHub or workspace skills.

Memory Plugin

Storage Backend

Registers into memory search. memory-core (extensions/memory-core/) provides SQLite-backed indexing and vector search. Replaceable with custom backends.

Provider Plugin

Model Backend

Registers into model providers. Claude, GPT, Gemini, local models. OAuth + API key auth with failover chains. TypeBox schema validation.

Skill System

50+ built-in tools. Sandboxed via Docker for non-main sessions. Skills managed through ClawHub or workspace directory.

Core
bashreadwriteeditprocess
Browser & Visual
Browser ControlCanvas PushCanvas EvalCanvas SnapshotA2UI
Nodes & Device
Camera SnapCamera ClipScreen Recordlocation.getsystem.runsystem.notify
Agent Coordination
sessions_listsessions_historysessions_sendsessions_spawn
Automation
Cron JobsWebhooksGmail Pub/Sub
Platform & Voice
Discord ActionsSlack ActionsGateway ControlVoice WakeTalk ModeElevenLabs TTSTranscription

Memory System

Not flat markdown files. OpenClaw uses SQLite-backed memory with indexing and search, powered by the memory-core plugin. The prompt-builder queries memory search to inject relevant context per task.

Storage

SQLite Backend

Persistent storage via memory-core plugin in extensions/memory-core/. Replaces append-only markdown with structured, queryable storage.

Indexing

Memory Indexing

Facts and session history indexed for retrieval. Automatic extraction from conversations. Structured for fast lookup by the Context Compiler.

Search

Memory Search

The prompt-builder queries src/memory/ to find relevant context per task. Only matching facts injected — never the full history. Prevents context overflow.

Workspace Files

SOUL · USER · AGENTS · TOOLS

Immutable directives (SOUL.md), owner profile (USER.md), persona routing (AGENTS.md), and capability defs (TOOLS.md) still live as markdown in ~/.openclaw/workspace/.

Session Model

resolveSessionKey() in sessions.ts determines session ID: main for direct, dm:channel:id for DMs, group:channel:id for groups.

Main Session

Direct Chat

1:1 with owner. Full host access. Tools run on machine. No sandbox. Session key: main

Group Session

Channel / Group

Isolated per-channel. Mention or always-on activation. Queue modes. Key: group:channel:id

Sandbox Session

Docker Isolated

Non-main in Docker via sandbox.ts. Allowlist: bash, read, write. Denylist: browser, canvas, nodes.

Safety & Security

Three layers: inbound access control (DM pairing + allowlists), tool policy and exec security (profiles + ask mode), and sandbox isolation (Docker per-session). Run openclaw security audit to check posture.

Layer 1 — Inbound Access Control
Unknown DM

Pairing

Code issued, msg ignored

Known DM

Allowlisted

openclaw pairing approve

Groups

Mention Gate

requireMention · activation

Context

Visibility

all · allowlist · quote

Layer 2 — Tool Policy & Exec Security
Profile

Tool Profiles

messaging · minimal · full

Allow / Deny

Tool Lists

per-agent deny groups

Exec Security

security + ask

full · deny · always · off

Elevated

/elevated

per-session toggle

Default for personal setups: security="full", ask="off" · Tighten per your threat model

Layer 3 — Sandbox Isolation
Main

Full Host

Direct execution

Non-Main

Docker

per-session container

Restricted

Tool Allow/Deny

bash,read,write,edit ✓

Blocked

Denied Tools

browser,canvas,nodes ✗

Command Catalog

Slash commands in any channel + CLI commands via Commander.js.

Chat Commands
/new/reset/compact/status/think off|low|medium|high|xhigh(GPT-5.2/Codex)/verbose on|off/usage off|tokens|full
Admin
/restart/activation mention|always/elevated on|off
CLI (openclaw ...)
onboardgatewayagentchannels loginpairing approvedoctorsecurity auditconfigmodelsnodesupdate

Nodes & Companion Apps

Gateway is the control plane. Nodes expose device capabilities via node.invoke over WS.

Deployment Models

Four patterns. Same client interfaces (CLI, Web UI, mobile apps) across all.

Local Dev

pnpm dev

Developer machine
~/.openclaw/
Loopback

macOS Prod

LaunchAgent

macOS App
~/.openclaw/
Loopback + Tailscale

Linux / VM

systemd

VPS/VM
~/.openclaw/
SSH tunnel

Cloud

Fly.io

Docker container
Persistent volume
HTTPS ingress

A Day in the Life

Architecture is abstraction. Here's what it looks like running.

07:00

Morning Briefing

Cron fires. prompt-builder.ts loads SOUL + USER + memory search results. Weather, inbox, calendar skills. Summary to WhatsApp via auto-reply.ts.

Read ×3Cron
08:30

Voice Wake

"Hey Molty, first meeting?" Wake word triggers on macOS node. PiEmbeddedRunner fetches calendar, responds via ElevenLabs TTS.

ReadVoice
09:15

Inbox → Email Reply

Meeting request found. Agent drafts reply. Tool policy allows email send (exec security="full", ask="off" in personal mode). Email sends. If ask="always" were configured, owner would see a prompt first.

ReadWriteExec
11:00

Unknown DM

WhatsApp message from unknown. dmPolicy="pairing" kicks in. Code issued. Ignored until openclaw pairing approve.

PairingSecurity
14:00

Browser Research

"Analyse competitor pricing." Browser tool launches managed Chromium via CDP. Snapshots, extracts. All Read.

ReadBrowser
16:00

Agent-to-Agent

Research session uses sessions_send. Main session synthesises. Canvas push via A2UI.

sessions_sendCanvas
22:00

Memory Consolidation

Cron reviews. memory-core indexes new facts into SQLite. Session pruning compacts context. Tomorrow's prompt-builder has today.

CronSQLite

Control Plane

An agent you cannot observe is one you cannot trust.

Key Technologies

The stack under the hood.

Node.js 24 / 22.16+@mariozechner/pi-agent-coreCommander.js CLIws WebSocketLit Web ComponentsSQLite (memory)Docker (sandbox)TypeBox + ZodJSON5 configjiti (plugin loader)Swift (macOS/iOS)Kotlin (Android)