Claude Code vs OpenClaw: Architecture Comparison Report
> Research task: Analyze adoptable designs from the leaked Claude Code source > Research agent: Agent 4 - Architecture Comparison > Date: 2026-04-02
Executive Summary
Anthropic's Claude Code was accidentally leaked on March 31, 2026 (~512,000 lines of source), revealing its internal architecture and many unreleased features. This report compares Claude Code with OpenClaw, extracts adoptable design patterns, and proposes an implementation roadmap.
Core findings:
- Claude Code uses a three-layer memory architecture (MEMORY.md index → topic files → raw transcripts); OpenClaw uses a file + vector hybrid
- Claude Code has 40+ built-in tools; OpenClaw extends via a Skills plugin system
- Claude Code uses Ink + Bun; OpenClaw uses Node.js + Gateway architecture
- Claude Code hides the KAIROS/ULTRAPLAN multi-agent coordination system; OpenClaw already has a subagent architecture
- BUDDY terminal pet: a Tamagotchi-style companion with 18 species (hidden via
String.fromCharCode()), rarity tiers, a 1% shiny chance, and stats (DEBUGGING / PATIENCE / CHAOS / WISDOM / SNARK). Species is deterministically derived from a Mulberry32 PRNG seeded by userId hash + salt'friend-2026-401'. - Undercover Mode: a controversial feature that strips Anthropic-related information when submitting PRs to open-source projects ("let the AI impersonate a human"). Potentially violates open-source transparency norms.
- Dream / KAIROS memory system — four layers: 1.
- Strict Write Discipline: memory indexes are updated only after confirmed successful file writes; agents treat their own memory as "hints," not facts, and verify before acting.
- KAIROS: an always-on background daemon performing
autoDreamconsolidation during user idle time; supports team memory paths shared across Claude Code instances. - ULTRAPLAN: offloads complex planning to a remote Cloud Container Runtime (CCR) running Opus 4.6 for up to 30 minutes; results approved from phone/browser and returned via the sentinel value
__ULTRAPLAN_TELEPORT_LOCAL__. - Coordinator Mode: one Claude instance manages parallel worker agents via a mailbox system and Unix Domain Sockets.
- 40+ tools (file ops, Glob/Grep/LSP, Bash, WebFetch, Notebook, MultiEdit, Todo) gated by six permission layers: config allowlist → auto-mode classifier → coordinator gate → swarm worker gate → Bash classifier → interactive user confirmation.
- Runtime: Node.js 22+ / Bun; ~420K lines; MIT-licensed
- Gateway control plane (port 18789): sessions, channel routing, tool dispatch, events — connecting 20+ channels (Slack, Discord, Telegram, WhatsApp, iMessage, Signal...)
- Skills system (three tiers): Bundled (core), Managed (ClawHub), Workspace (
./skills/), declared inSKILL.mdfrontmatter - Memory:
MEMORY.md(user-editable, curated) + daily logsmemory/YYYY-MM-DD.md+ LanceDB vector semantic search - Subagents:
sessions_spawnAPI, currently limited to timeout-based termination; no resource limits, no bidirectional communication, no post-mortem tracking - Features like Undercover Mode raise ethical concerns and are not recommended for implementation
- KAIROS's always-on mode requires privacy and user-consent mechanisms
- All background automated actions need explicit user consent
- Claude Code leak analysis (Ars Technica)
- OpenClaw architecture docs
- memsearch memory system
- Claude Code feature leak list
Key points
Claude Code highlights
MEMORY.md: lightweight index pointers (~150 chars each), always in context, stores *locations* not data
2. Topic files: actual project knowledge, fetched on demand
3. Raw transcripts: only grep-searched for specific identifiers, never fully re-read
4. AutoDream nightly consolidation: Orient → Collect → Consolidate → Prune
OpenClaw overview
Head-to-head comparison
| Feature | Claude Code | OpenClaw | |---|---|---| | Runtime | Bun | Node.js 22+ / Bun | | UI | Ink (terminal React) | Native apps (Swift/Kotlin) + Web + Canvas | | Tools | 40+ built-in, 6-layer permissions | Declarative Skills, per-skill permissions | | Memory | 3-layer, AutoDream auto-consolidation, strict write discipline | Markdown + SQLite + LanceDB, manual/heartbeat consolidation | | Multi-agent | Coordinator, Swarm, UDS mailbox, ULTRAPLAN | sessions_spawn, result auto-reporting | | Channels | Terminal only | 20+ messaging platforms | | License | Closed source (leaked) | MIT open source |
Recommended adoptable patterns (priority order)
High priority: 1. Strict Write Discipline — only update memory after confirmed write success; prevents memory pollution (low effort, high impact) 2. AutoDream consolidation — Orient/Collect/Consolidate/Prune pipeline in heartbeat or scheduled tasks (medium effort, high impact) 3. Layered permission system — config allowlist, auto classifier, coordinator gate, Bash classifier, sandbox check, user confirm in SKILL.md (high effort, high impact)
Medium priority: 4. BUDDY terminal pet — deterministic species from user ID, ASCII rendering (low effort) 5. ULTRAPLAN-style remote deep planning — async long-horizon planning on stronger models (high effort) 6. Subagent resource limits — memory, cost, output size, tool-call caps, stuck detection (medium effort)
Low priority: team memory sharing, voice mode enhancement, visual pet variants.
Suggested roadmap
1. Weeks 1–2: Strict write discipline; simplified BUDDY 2. Weeks 2–4: AutoDream pipeline; MEMORY.md index format optimization 3. Months 1–2: Permission layers in SKILL.md; subagent resource limits 4. Month 3+: Remote planning service; team memory sharing
Philosophical differences
| Claude Code | OpenClaw | |---|---| | Product-first: polished single experience | Platform-first: extensible multi-channel architecture | | Centralized, all built-in | Distributed: Gateway + Skills | | Terminal-native (Ink) | Cross-platform (iOS/Android/macOS/Web) | | Model-driven (Claude capabilities) | Tool-driven (rich tool ecosystem) |
Claude Code leads in: terminal UX, automatic memory consolidation, permission security, remote deep planning. OpenClaw leads in: channel coverage (20+ platforms), extensibility, multi-platform support, open-source community.