OpenClaw Architecture Intelligence
DONE18 sub-pages of DeepWiki fetched. OpenClaw is a multi-channel AI agent GATEWAY — single persistent process routing messages across 7+ platforms to LLM-powered agents.
Key Findings
OpenClaw is a multi-channel AI agent GATEWAY (not a framework) — single persistent process routing messages across 7+ platforms
4-layer agent execution pipeline: runReplyAgent -> runAgentTurnWithFallback -> runEmbeddedPiAgent -> runEmbeddedAttempt
Pi Agent SDK (@mariozechner/pi-agent-core) is the runtime — proprietary, not reusable
Dual memory backend: QMD (external process) OR builtin (SQLite+FTS5+sqlite-vec with BM25+cosine hybrid, MMR, temporal decay)
WebSocket Protocol v3 with challenge-nonce handshake, RBAC (operator/node/user), rate limiting (3 req/60s on control plane writes)
JSONL session transcripts with write locks, compaction (summarization agent), and repair
Bootstrap context files (AGENTS.md, SOUL.md, MEMORY.md) auto-injected into system prompt — 20K per file, 150K total caps
Plugin system with lifecycle hooks: agent:beforeTurn, agent:afterTurn, message:beforeRoute, etc.
Docker sandbox isolation with 3 modes (off/non-main/all) for untrusted agent execution
Native iOS/Android/macOS apps as 'nodes' that pair with gateway and expose device capabilities
Action Recommendations
Apply workspace bootstrap pattern (AGENTS.md + SOUL.md + MEMORY.md) to our own ecosystem
Implement context compaction strategy: summarization agent at 80% context threshold
Use JSONL session persistence pattern for agent session transcripts
Apply doctor self-diagnostic pattern to agent health checks