OpenClaw Source Code Analysis Textbook
A comprehensive deep-dive into the OpenClaw open-source AI assistant framework — from core concepts to advanced internals, structured for engineers at every level.
Recommended Reading Paths
| Reader Type | Recommended Path |
|---|---|
| 🆕 Complete Beginner | All of Getting Started → Architecture 01-02 → Application 01 |
| 💻 Experienced Engineer | All of Architecture → All of Data Flow → All of Mechanisms |
| 🤖 AI App Developer | Getting Started → All of Application → Extension 03 |
| 🔧 Open Source Contributor | Getting Started 02-03 → Architecture 04 → All of Extension |
Table of Contents
🟢 Getting Started — Understanding OpenClaw
| Chapter | Title | Difficulty |
|---|---|---|
| 00-01 | What Is OpenClaw? | 🟢 Beginner |
| 00-02 | Codebase Tour | 🟢 Beginner |
| 00-03 | Running Locally: Startup Flow & Entry Tracing | 🟡 Intermediate |
🏗️ Architecture — System Design Overview
| Chapter | Title | Difficulty |
|---|---|---|
| 01-01 | System Architecture Layers | 🟡 Intermediate |
| 01-02 | Gateway Core | 🟡 Intermediate |
| 01-03 | Plugin System | 🟡 Intermediate |
| 01-04 | Module Boundaries & SDK Contract | 🔴 Advanced |
🔄 Data Flow — Tracing the Message Path
| Chapter | Title | Difficulty |
|---|---|---|
| 02-01 | Message Lifecycle | 🟡 Intermediate |
| 02-02 | Routing Engine | 🟡 Intermediate |
| 02-03 | Agent Call Loop | 🔴 Advanced |
⚙️ Mechanisms — Deep Dives
| Chapter | Title | Difficulty |
|---|---|---|
| 03-01 | Plugin SDK Design | 🔴 Advanced |
| 03-02 | Authentication System | 🔴 Advanced |
| 03-03 | Channel Integration Patterns | 🟡 Intermediate |
| 03-04 | Memory & MCP | 🔴 Advanced |
| 03-05 | Security Model | 🔴 Advanced |
🚀 Application — Skills & Multi-Agent Collaboration
| Chapter | Title | Difficulty |
|---|---|---|
| 04-01 | Skill System | 🟢 Beginner |
| 04-02 | Writing High-Quality Skills | 🟡 Intermediate |
| 04-03 | Multi-Agent Collaboration (ACP) | 🔴 Advanced |
| 04-04 | Agent Scope & Context Management | 🔴 Advanced |
| 04-05 | Automation & Scheduled Tasks | 🟡 Intermediate |
🛠️ Extension — Building on OpenClaw
| Chapter | Title | Difficulty |
|---|---|---|
| 05-01 | Tutorial: Write a Channel Plugin | 🟡 Intermediate |
| 05-02 | Tutorial: Integrate a New LLM Provider | 🔴 Advanced |
| 05-03 | Tutorial: Create a Skill | 🟢 Beginner |
Key Concepts Glossary
| Term | One-line Definition |
|---|---|
| Gateway | The control plane — receives channel messages, routes to agents, manages auth and config |
| Channel | A messaging platform adapter (Telegram/Discord/Slack etc.) for inbound/outbound message conversion |
| Agent | The AI reasoning engine — calls LLMs, uses tools, memory, and skills to complete tasks |
| Plugin | A code-based extension: Channel Plugin, Provider Plugin, or Capability Plugin |
| Skill | A Markdown instruction file — not code; tells the Agent how to perform specific workflows |
| Provider | An LLM service adapter (OpenAI/Anthropic/Ollama etc.) handling model calls and auth |
Difficulty Legend
- 🟢 Beginner: Accessible to all readers, no prior programming experience needed
- 🟡 Intermediate: Requires familiarity with TypeScript and Node.js
- 🔴 Advanced: Requires experience with systems design and software architecture