OpenClaw
OpenClaw is a self-hosted, multi-channel AI assistant that runs on your own devices. It connects to 25+ messaging platforms (WhatsApp, Telegram, Slack, Discord, Signal, iMessage, and more), orchestrates LLM-powered conversations with tool use, and supports an extensible plugin ecosystem. The gateway is the control plane — the product is the assistant.
🐚 TypeScript / Node.js 💬 25+ Channels 🔌 70+ Extensions 🤖 Multi-Model LLM
📚 What is this & why does it exist?
OpenClaw is an open-source personal AI assistant that you run on your own hardware. Unlike cloud-only assistants, OpenClaw gives you full control over your data, model providers, and integrations. It acts as a gateway between the messaging platforms you already use and any LLM provider, turning every chat app into an intelligent assistant interface.
💡 Real-world analogy
Think of OpenClaw as a multilingual personal secretary who sits at a reception desk with 25 phone lines. Each phone line connects to a different communication channel (WhatsApp, Slack, Discord, etc.). When a message comes in on any line, the secretary understands the context, consults the right expert (LLM provider), uses available tools (web search, image generation, MCP servers), and responds in the caller's language and format. You control which experts the secretary consults and what tools are available.
System Architecture
flowchart TD
subgraph User["User Layer"]
CLI["CLI / TUI"]
WebUI["Web UI"]
MobileApps["Mobile Apps"]
end
subgraph Gateway["Gateway Control Plane"]
Boot["Boot / Init"]
Auth["Auth & Rate Limiting"]
Router["Message Router"]
Sessions["Session Manager"]
end
subgraph Channels["Channel Layer"]
WA["WhatsApp"]
TG["Telegram"]
Slack["Slack"]
Discord["Discord"]
More["25+ more..."]
end
subgraph Core["Core Engine"]
Agents["Agent Orchestrator"]
Commands["Command Processor"]
AutoReply["Auto-Reply Engine"]
CtxEngine["Context Engine"]
end
subgraph AI["AI / LLM Layer"]
Providers["Provider Adapters"]
Tools["Tool Execution"]
MCP["MCP Bridge"]
ImgGen["Image Generation"]
end
subgraph Plugins["Plugin Ecosystem"]
PluginSDK["Plugin SDK"]
Bundled["Bundled Plugins"]
ExtDir["Extension Directory"]
end
subgraph Infra["Infrastructure"]
Config["Configuration"]
Store["Data Store"]
Cron["Cron Scheduler"]
Secrets["Secrets Vault"]
end
CLI --> Gateway
WebUI --> Gateway
MobileApps --> Gateway
Gateway --> Channels
Channels --> Core
Core --> AI
Core --> Plugins
AI --> Providers
Plugins --> MCP
Gateway --> Infra
Core --> Infra
Core Engine
Agents
The execution engine of OpenClaw. Manages agent lifecycles, streams LLM responses, handles tool calls (function calling, MCP), patches, sandboxed code execution, and provider-specific adapters for OpenAI, Anthropic, Google, and 15+ more.
Gateway
The central multiplexing server that handles client pairing, authentication, rate limiting, message routing, and Android/iOS node capability negotiation. Coordinates all other modules during startup.
Commands
Parses and dispatches user commands (/model, /image, /search, /admin), manages command aliases, permission gating, and provider-switching workflows.
Messaging & Channels
Channels
Provides the common interface for 25+ messaging platforms. Handles message normalization, allowlists, command gating, reaction acknowledgment, and channel-specific configuration (presence, chat types, media).
Extensions
Each extension implements the plugin contract to connect a specific service — from LLM providers (OpenAI, Anthropic, Ollama) to channels (WhatsApp, Telegram) to utilities (web search, image generation, voice calls).
Plugin & Extension System
Infrastructure
Message Flow: Channel to Agent
This sequence shows the complete lifecycle of an incoming user message, from arrival on a messaging channel through to the AI-generated response.
sequenceDiagram
participant User as User (WhatsApp/Telegram/...)
participant Ch as Channel Extension
participant GW as Gateway Router
participant Cmd as Command Processor
participant Agent as Agent Orchestrator
participant LLM as LLM Provider
participant Tool as Tool / MCP Server
User->>Ch: Send message
Ch->>GW: Normalized message (ChatMeta)
GW->>GW: Auth check + rate limit
GW->>Cmd: Route to command processor
Note over Cmd: Check for slash command prefix
alt Slash command (e.g. /model)
Cmd->>Cmd: Execute command handler
Cmd-->>Ch: Command response
else Natural language
Cmd->>Agent: Forward to agent
Agent->>Agent: Build context (history + system prompt)
Agent->>LLM: Stream request (OpenAI/Anthropic/...)
loop Streaming tokens
LLM-->>Agent: Token chunk
Agent-->>Ch: Forward chunk to user
end
opt Tool call requested
Agent->>Tool: Execute tool (MCP/function)
Tool-->>Agent: Tool result
Agent->>LLM: Continue with tool result
LLM-->>Agent: Final response
end
Agent-->>Ch: Complete response
end
Ch-->>User: Deliver response
Key insight: The Gateway owns authentication and routing. The Channel layer normalizes platform-specific messages into a unified format. The Agent orchestrator manages the LLM conversation lifecycle including streaming, tool use, and multi-turn context. Extensions implement the actual provider and channel connections.
Navigation Guide
| Level | What You'll Find | When to Use |
|---|---|---|
| 0 — Project Hub (this page) | Project overview, module map, architecture diagrams | Getting started, finding the right module |
| 1 — Module Overview | Architecture diagram, key components, sub-module cards, walkthrough | Understanding a module's purpose and structure |
| 2 — Sub-Module Deep Dive | Source-level types, algorithms, configs, code examples | Implementing, debugging, or extending code |
| Focus — Topic Deep Dive | Single mechanism or algorithm explained in detail | Deep understanding of a specific feature |
Directory Map
Project source tree
openclaw/
├── src/
│ ├── agents/ ← LLM orchestration, streaming, tool use
│ ├── gateway/ ← Control plane, auth, boot, routing
│ ├── channels/ ← Multi-channel messaging abstraction
│ ├── commands/ ← Slash command processing
│ ├── plugins/ ← Plugin bundling and lifecycle
│ ├── plugin-sdk/ ← SDK for building extensions
│ ├── infra/ ← Data store, caching, scheduling
│ ├── config/ ← Configuration management
│ ├── cli/ ← Command-line interface
│ ├── mcp/ ← Model Context Protocol bridge
│ ├── auto-reply/ ← Auto-reply engine
│ ├── context-engine/ ← Context management
│ ├── flows/ ← Setup wizards and flows
│ ├── shared/ ← Shared utilities
│ └── ... ← 20+ more sub-modules
├── extensions/ ← 70+ channel/provider extensions
│ ├── openai/ ← OpenAI provider adapter
│ ├── anthropic/ ← Anthropic provider adapter
│ ├── telegram/ ← Telegram channel
│ ├── whatsapp/ ← WhatsApp channel
│ ├── discord/ ← Discord channel
│ └── ... ← 65+ more extensions
├── packages/ ← Standalone packages
│ ├── clawdbot/ ← CLI bot package
│ ├── moltbot/ ← Alternative bot
│ └── memory-host-sdk/ ← Memory hosting SDK
├── apps/ ← Native applications
│ ├── android/ ← Android app (Kotlin)
│ ├── ios/ ← iOS app (Swift)
│ ├── macos/ ← macOS app (Swift)
│ └── shared/ ← Shared app logic (Swift)
├── ui/ ← Web UI (Vite + TypeScript)
├── vendor/ ← Vendored dependencies (a2ui)
├── skills/ ← Copilot skills
├── test/ ← Integration tests
├── scripts/ ← Build and utility scripts
├── openclaw.mjs ← CLI entry point
├── package.json ← Project manifest
└── tsconfig.json ← TypeScript configuration
Build & Tech Stack
Languages
TypeScript (primary), Swift (iOS/macOS), Kotlin (Android), Go (extensions)
Runtime
Node.js with ESM modules, pnpm workspace monorepo
Build System
tsdown (bundling), Vite (UI), Vitest (testing), pnpm workspaces
Key Dependencies
Mermaid, Highlight.js, SQLite (better-sqlite3), various LLM SDKs
Deployment
Docker, Fly.io, Render, self-hosted Node.js, Podman
Testing
Vitest with separate configs for unit, e2e, channels, contracts, extensions, gateway, live