Skip to main content
šŸŽ¤ Luca Berton is speaking at Red Hat Summit & KubeCon EU 2026!Learn more →
Back to Blog

OpenClaw Architecture Deep Dive

Deep dive into OpenClaw's architecture — the gateway, sessions, tool system, memory layer, and channel providers that make it tick.

Luca BertonFebruary 15, 20262 min read

High-Level Architecture

OpenClaw has four main components:

Channels (Discord, Telegram, etc.)
    ↕
  Gateway (message routing)
    ↕
  Sessions (conversation state)
    ↕
  Tools (actions: files, web, exec)

The Gateway

The gateway is the central daemon. It: - Manages connections to messaging platforms - Routes inbound messages to the right session - Handles heartbeats and cron jobs - Serves the web interface

bash
openclaw gateway start   # Start
openclaw gateway stop    # Stop
openclaw gateway status  # Check health

Sessions

Each conversation lives in a session:

  • Main session — direct chat with the user
  • Sub-agent sessions — spawned for isolated tasks
  • Channel sessions — per-channel in group chats

Sessions maintain their own message history and can spawn child sessions for parallel work.

Related Course

Master this topic with hands-on labs

Go beyond reading — build real projects in sandboxed environments with expert video guidance.

Browse Courses →

The Tool System

OpenClaw provides tools that the LLM can invoke:

File Operations

  • read — read file contents (text and images)
  • write — create or overwrite files
  • edit — surgical find-and-replace edits

System

  • exec — execute shell commands
  • process — manage background processes

Web

  • web_search — search via Brave API
  • web_fetch — fetch and extract page content
  • browser — full browser automation

Communication

  • message — send messages across channels
  • tts — text-to-speech
  • nodes — control paired devices

Agent Orchestration

  • sessions_spawn — create sub-agents
  • sessions_send — cross-session messaging
  • subagents — manage running sub-agents

Memory Layer

Memory is file-based, stored in the workspace:

workspace/
ā”œā”€ā”€ SOUL.md           # Agent personality
ā”œā”€ā”€ USER.md           # User profile
ā”œā”€ā”€ AGENTS.md         # Operating rules
ā”œā”€ā”€ MEMORY.md         # Long-term memory
ā”œā”€ā”€ HEARTBEAT.md      # Periodic check config
└── memory/
    ā”œā”€ā”€ 2026-02-15.md # Daily notes
    └── heartbeat-state.json

Channel Providers

Each messaging platform has a provider that: - Authenticates with the platform API - Receives and sends messages - Handles platform-specific features (reactions, threads, media)

Supported: Discord, Telegram, WhatsApp, Signal, Slack, IRC, Google Chat, iMessage.

Stay Updated

Get weekly IT automation tips

Docker, Ansible, Terraform, MLOps — curated insights delivered to your inbox. No spam.

Subscribe Free →

Skills System

Skills extend agent capabilities:

skills/
ā”œā”€ā”€ weather/
│   └── SKILL.md
ā”œā”€ā”€ discord/
│   └── SKILL.md
└── healthcheck/
    └── SKILL.md

The agent reads SKILL.md when a task matches the skill's description.

Request Flow

  1. User sends message on Discord
  2. Discord provider receives it
  3. Gateway routes to the correct session
  4. Session adds message to context
  5. LLM generates response (may invoke tools)
  6. Tools execute and return results
  7. LLM formulates final response
  8. Response sent back via Discord provider

---

Ready to go deeper? Check out our hands-on course: OpenClaw Agent — practical exercises you can follow along on your own machine.

Further reading

To go deeper, agentic Ansible automation with OpenClaw expands on these patterns in production.

Ready to learn by doing?

Stop reading tutorials — start building. Expert video courses with hands-on labs in real sandboxed environments.

Share this article
LB
Luca Berton

Docker Captain, IT automation expert, Red Hat Summit & KubeCon speaker. Building hands-on education for DevOps engineers at CopyPasteLearn.

Related Articles

Explore topics

Browse more articles on the topics covered here.