Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deep Dive into OpenClaw — Table of Contents

Generated by: Claude Opus 5 (claude-opus-5) / Claude Opus 4.6 (earlier chapters) Tools: Claude Code + OpenClaw + OpenCode Last updated: 2026-08-02 Source baseline: v2026.3.9 (v2026.3.8-170-g665f67726) GitHub: https://github.com/0xtresser/OpenClaw-Book


Language

中文版本


Three Layers

The book is organized shallow-to-deep, but you don't have to read it in order. The three layers stand on their own:

Layer Parts Read it to Source code required?
Usage Part I (Ch. 1–10) Install and use OpenClaw No
Implementation Parts II–X (Ch. 11–42) Understand how each subsystem works Yes
Insight Part XI (Ch. 43–45) Extract transferable design lessons and risk judgment Better after the implementation layer

From Chapter 11 on, most chapters end with a 🔬 Source Deep Dive section. It sits closer to the source than the main text and carries a higher information density, tracing the real implementation line by line along with the issues behind it.

The main text is for understanding structure; the deep dive is for understanding trade-offs. If you only want to know what a piece does, the main text is enough. If you're going to modify it, or reproduce it in your own project, read the deep dive.


  • Why this book exists, and who it's for
  • What OpenClaw is: a personal AI assistant that runs on your own devices
  • How the book is organized, and how to read it
  • Source version (v2026.3.9)
  • Prerequisites: TypeScript basics, Node.js runtime concepts, WebSocket, basic operating-system knowledge

Part I: Getting Started

From zero to fluent. No source reading required — follow along and it works.

Chapter 1: Understanding OpenClaw

Chapter 2: Installation and Quick Start

Chapter 3: Connecting Channels

Chapter 4: Conversation and Tools

Chapter 5: Scheduling and Automation

Chapter 6: The Skills Ecosystem

Chapter 7: Model Configuration and Optimization

Chapter 8: Regional Platforms and Deployment

Chapter 9: Multi-Agent in Practice

Chapter 10: Advanced Techniques and Best Practices


Part II: Gateway Control Plane

Chapter 11: Gateway Server Architecture

Chapter 12: Gateway Protocol and Type System

Chapter 13: Session Management

Chapter 14: Channel Routing and Message Dispatch


Part III: AI Agent Runtime

Chapter 15: Pi Agent Runtime Core

Chapter 16: Model Providers and Failover

Chapter 17: System Prompts and Context Assembly

Chapter 18: Streaming and Block Replies


Part IV: Multi-Channel Messaging System

Chapter 19: Channel Adapter Abstraction

Chapter 20: Core Channel Implementations

Chapter 21: Channel Extension Mechanism


Part V: Tool System and Automation

Chapter 22: Tool System Overview

Chapter 23: Bash Tools and Process Management

Chapter 24: Browser Control

Chapter 25: Canvas and A2UI

Chapter 26: Cron Scheduling and Automation

Chapter 27: Node System


Part VI: Memory, Skills, and Ecosystem

Chapter 28: Memory System

Chapter 29: Skill System

Chapter 30: Hook System


Part VII: Security, Configuration, and Infrastructure

Chapter 31: Configuration System

Chapter 32: Security Model

Chapter 33: CLI Tools

Chapter 34: Infrastructure


Part VIII: Client Apps and Web UI

Chapter 35: Web Console UI

Chapter 36: Native Client Apps


Part IX: Deployment and Operations

Chapter 37: Deployment

Source-level deep dive on cross-platform service installation: Appendix F.

Chapter 38: Monitoring and Troubleshooting


Part X: Advanced Topics and Practice

Chapter 39: Multi-Agent Architecture

Chapter 40: ACP (Agent Communication Protocol)

Chapter 41: TUI (Terminal User Interface)

Chapter 42: Hands-On Project: Build Your Own AI Assistant


Part XI: Source Reading and Design Insight

The first forty-two chapters took OpenClaw apart like a machine, each answering how is this piece implemented?

This part changes the lens: put the magnifying glass down, step back, and extract the shapes that recur across the codebase, the patterns worth stealing, and the risks you need to know about.

Specific line numbers expire. Shapes don't.

Chapter 43: Engineering Panorama

  • 43.1 Positioning and Evolution
    • Four engineering tracks and four renames; the heart is borrowed (pi-mono is embedded, not written)
    • The agent's personality is a set of git-manageable Markdown files
  • 43.2 Scale and Subsystem Map
    • Six verified numbers: 507,227 lines, 1,935 tests, 18,005 commits, 40 extensions, 52 skills
    • A reverse index from code to chapter; three counterintuitive facts
  • 43.3 AI-Collaborative Development
    • AGENTS.md is not a contributing guide — it's a case book of agent mistakes
    • Three rule categories: AI code pathologies / multi-agent safety / merge gates
  • 43.4 Source Reading Paths
    • Four paths; use the 1,935 test filenames as the spec
    • Anti-recommendation: don't start with the 2,096-line assembly file

Chapter 44: Design Themes Running Through the Codebase

Chapter 45: Risks and Transferable Lessons

  • 45.1 Ten Engineering Patterns Worth Stealing
    • Selection criterion: they hold up outside OpenClaw's context
    • With a "pick by system characteristics" mapping table
  • 45.2 Risk and Improvement List
    • One verified defect (systemd.ts:484/528uninstalling the node stops the gateway)
    • Three architecture-level risks + seven correctness/maintainability risks
    • Every risk is the invoice for one of Chapter 44's advantages
  • 45.3 A Contrasting Route
    • Twelve decision points, nearly all opposite
    • Three key contrasts: who errors teach / where trust collapses / the cost curve of channel abstraction
  • 45.4 Epilogue: From Tool to Infrastructure
    • A working agent takes ~200 lines. What are the other 499,800 doing?
    • Three principles to take away

Appendices

Complete JSON5 config example · full config key reference

Three frame types · the connect handshake (protocol version 3) · all 110 methods · 19 event types · four auth layers

Every built-in tool, its schema and purpose · how the seven-layer policy pipeline trims the set

Dependency map · message sequence diagram · directory-to-chapter reference · three verification techniques

Every technical term in this book, with explanation

  • Per-platform quirk patches — launchd's persisted disabled state, systemd's dual-scope bus fallback, schtasks' localized-text trap
  • The service file as the source of configuration truth (readCommand reverse parsing)
  • One verified defect: systemd install/uninstall ignores the unit-name override
  • node-host exec security: a pure-function policy core plus four runtime re-verifications
  • The six things people most often get wrong (including the "two pairing systems" warning)
  • Four-level transport fallback; three Tailscale modes; credential precedence rules
  • OpenAI-compatible API limits, and SSRF defenses are orthogonal to the allowlist
  • Port and config key quick reference

Scope

Part Chapters Estimated words
Part I: Getting Started 10 ~80,000
Part II: Gateway Control Plane 4 ~44,000
Part III: AI Agent Runtime 4 ~44,000
Part IV: Multi-Channel Messaging 3 ~33,000
Part V: Tool System and Automation 6 ~40,000
Part VI: Memory, Skills, Ecosystem 3 ~25,000
Part VII: Security, Config, Infrastructure 4 ~36,000
Part VIII: Client Apps and Web UI 2 ~6,000
Part IX: Deployment and Operations 2 ~6,000
Part X: Advanced Topics and Practice 4 ~20,000
Part XI: Source Reading and Design Insight 3 ~24,000
Appendices 7 ~14,000
Total 45 chapters + 7 appendices ~372,000

About

《深入 OpenClaw》。全网第一本介绍 OpenClaw 的书,用 OpenClaw + OpenCode + Opus 写成。A book introducing OpenClaw, written by OpenClaw + OpenCode + Opus

Topics

Resources

Stars

238 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors