How OpenClaw Is Built: Architecture Explained
A technical overview of OpenClaw's components and how they fit together.
High-Level Overview
OpenClaw follows a client-server architecture with three main components:
CLI (Command Line Interface)
The CLI is your primary interface for managing OpenClaw. Install via npm, pnpm, or bun:
npm install -g openclaw@latest
Common commands:
- •
openclaw gateway start— Start the gateway - •
openclaw configure— Configure settings - •
openclaw status— Check status - •
openclaw chat— Start a chat session - •
openclaw security audit— Run security checks
Gateway
The gateway is the core service that powers OpenClaw. It handles:
- •Message routing — Routes messages between channels and agents
- •Agent orchestration — Manages agent state and memory
- •Tool execution — Runs tools on behalf of agents
- •Channel connections — Connects to Telegram, Discord, WhatsApp, etc.
- •Authentication — Validates tokens and permissions
The gateway runs as a local service (launchd on macOS, systemd on Linux) and exposes a WebSocket API on port 18789 by default.
Control UI / Dashboard
The web-based dashboard for managing OpenClaw. Access at:
http://127.0.0.1:18789
Features:
- • Agent configuration and monitoring
- • Channel management
- • Real-time activity logs
- • Configuration editor
- • Security settings
Models & Providers
OpenClaw connects to LLM providers through a unified API layer:
OpenAI
GPT-4, GPT-4o, o1
Anthropic
Claude 3.5, Claude 3
Ollama
Local models
OpenAI-Compatible
LM Studio, LiteLLM, custom
Configure providers in your openclaw.json config file.
Skills & Tools Layer
Skills extend OpenClaw's capabilities. They define what agents can do:
- • File operations — Read, write, search files
- • Web search — Search the web for information
- • Browser control — Browse websites, fill forms
- • Code execution — Run code in sandboxes
- • Custom skills — Build your own tools
Integrations / Channels
OpenClaw connects to messaging platforms through channel adapters:
Telegram
Bot API integration
Discord
Bot API with slash commands
Business API
Signal
Signal API
Config, Memory & State
OpenClaw persists data in ~/.openclaw/:
- •
openclaw.json— Main configuration - •
credentials/— Channel API keys - •
agents/— Agent memory and sessions - •
workspace/— Agent working files - •
skills/— Custom skills
Local vs Remote Deployment
🏠 Local
Run on your Mac mini, desktop, or laptop. Best for personal use.
☁️ VPS / Remote
Run on a cloud server for 24/7 availability. Best for production.
Security
OpenClaw is designed as a personal assistant — not a multi-tenant system. Key security points:
- • Gateway binds to loopback by default
- • Token-based authentication
- • Channel allowlists restrict who can message
- • Tool permissions control what agents can do
- • Elevated mode for sensitive operations
Ready to set up OpenClaw?
Install OpenClaw and explore the architecture yourself.