Most OpenClaw documentation tells you what the system does. This post tells you how it's built — the architecture behind the agent, the data flow between components, and how security fits into each layer. If you're a CTO, ops lead, or technical evaluator deciding whether to deploy OpenClaw for a team, this is the layer-by-layer picture you need.

The Five-Layer Architecture

OpenClaw's architecture is organized as a coordinated pipeline: five horizontal layers, each with a distinct role. Reading top to bottom, data flows from your tools and systems, through a normalization gateway, into the agent processing core, and out through an action layer to wherever it needs to land.

This layered design is intentional. OpenClaw is not a monolithic application — each layer can be deployed, secured, updated, and scaled independently.

Layer 1 — Input Sources
Email (Gmail/Outlook) · Calendar · Slack/Discord/Telegram/Signal · CRM (HubSpot/Salesforce) · Task systems (Notion/Asana) · Webhooks · Any API/RSS
↓ events normalized
Layer 2 — Integration Gateway
Single entry point · Normalizes signals from all sources → common internal event format · Auth + connection management · Channel routing · Rate limiting
↓ processed events
Layer 3 — Agent Core
Orchestrator → Specialized Agents → Shared Memory Layer → Execution Engine
↓ action decisions
Layer 4 — Output / Action Layer
Message sends · Record updates · File writes · API calls · Email/calendar actions · Tool results logged to memory
↓ delivered to
Layer 5 — External Integrations
The same input sources — now receiving actions back (email sent, record updated, message delivered, task created)

Layer 1: Input Sources

The top of the stack is your existing toolset — the platforms and systems OpenClaw monitors continuously. No manual triggering required after setup. OpenClaw connects to these sources and listens for events that match your configured workflows.

What counts as an "input source" is broad:

The key property: OpenClaw is event-driven at this layer. It doesn't poll continuously in a loop — it receives and routes inbound events, which is both more efficient and more secure.

Layer 2: Integration Gateway

All incoming signals pass through a single gateway before the agent ever sees them. This is OpenClaw's normalization layer — it translates heterogeneous inputs (a Slack message, a new Salesforce lead, a calendar event) into a common internal event format the agent core can process consistently.

The gateway also handles:

Deployment note: The gateway is what you configure when you run openclaw gateway start. For self-hosted deployments, it should bind to 127.0.0.1 (not 0.0.0.0) and be accessed remotely via Tailscale. Exposing the gateway directly to the internet is the single most common security mistake — and what the SecurityScorecard report flagged in 40,000+ instances.

Layer 3: Agent Core

This is the processing engine. The agent core has four sub-components:

Orchestrator

The top-level controller. Receives processed events from the gateway, decides which agent handles them, sequences multi-step task chains, and manages the turn loop. When you send a message to your OpenClaw instance, the orchestrator is what reads your SOUL.md, selects the appropriate model, and decides which tools to invoke.

Specialized Agents

Individual AI agents assigned to specific domains or workflows. In a minimal setup, this is a single general-purpose agent. In more sophisticated deployments, you might have dedicated agents for email triage, research, code review, or customer operations — each with its own SOUL.md constraints and tool access scope.

OpenClaw's ACP (Agent Coding Protocol) allows specialized agents like Codex, Claude Code, or custom agents to be spawned for specific tasks and report results back to the orchestrator.

Shared Memory Layer

A structured context store that all agents can read and write. This is what enables continuity across sessions and cross-agent coordination. The memory layer maps directly to the files in your workspace:

Execution Engine

Translates agent decisions into actions. When the agent decides to send a message, write a file, run a shell command, or call an API, the execution engine routes that action through the appropriate tool — subject to the permission model configured in your gateway.

Layer 4: Output / Action Layer

The output layer handles delivery of the agent's decisions to the real world. This includes:

Layer 5: External Integrations

The same systems that feed events into Layer 1 receive the outputs from Layer 4. The loop closes: an incoming Slack message triggers an agent action, which sends a Slack reply and updates a Notion record. The integration points are the same on both ends — which keeps the architecture simple and auditable.

Security at Each Layer

Layer 1 — Input

Source allowlisting. Only configured providers can inject events. Untrusted content flagged as EXTERNAL in prompt context.

Layer 2 — Gateway

Bind to 127.0.0.1. Tailscale for remote access. Owner-only commands enforced here. DM and group allowlists.

Layer 3 — Agent Core

SOUL.md defines behavior constraints. Approval gates before destructive actions. Prompt injection protections in system context.

Layer 4 — Output

Elevated exec requires explicit approval. File writes logged. Shell commands scoped by allowlist. API calls rate-limited.

Current threat landscape: All of the critical CVEs in 2026 (CVE-2026-41352, CVE-2026-41349) targeted the gateway and execution engine layers — not the agent core logic itself. Proper gateway binding and current patching addresses both. The architecture is sound; the risk is misconfigured deployment.

What This Means for Deployment Decisions

A few practical implications of the architecture:

Self-hosting on a mini PC beats VPS for most users. The gateway layer benefits from local network binding — a mini PC at home or in the office is inherently less exposed than a cloud VPS. Local network + Tailscale for remote access is the canonical secure deployment pattern.

Memory architecture determines capability ceiling. The shared memory layer is the part most people underinvest in. A well-structured SOUL.md + memory.md + domain files is what separates a demo from a production agent. The orchestrator is only as good as the context it has to work with.

The execution engine's approval gates are the primary safety control. If you're deploying OpenClaw with elevated permissions (shell exec, file write, API calls), the approval gate configuration in your gateway is the last line of defense. Don't skip it.

The layered design makes skills safe to add. Skills extend the execution engine with new tools, but they can't bypass the gateway's access controls or the orchestrator's permission model. A skill that tries to do something outside its declared scope will be stopped at the execution layer.

The ClawReady Take

We see a lot of OpenClaw deployments. The architecture is sound — the five-layer design is clean and the security model is correct when properly configured. The problems we fix consistently are at Layer 2 (gateway misconfiguration, wrong bind address, no access control), Layer 3 (no memory architecture, generic SOUL.md), and Layer 4 (no approval gates on elevated actions).

If you understand the architecture, the setup isn't magic — it's just configuration. The goal of ClawReady is to make that configuration fast and correct, rather than something you iterate to over several debugging sessions.

Get Your OpenClaw Architecture Right from Day One

ClawReady sets up every layer correctly — gateway binding, memory architecture, approval gates, local model routing, and security hardening. You get the architecture working the way it's designed to, not the way a rushed tutorial set it up.

See What We Set Up →