CodeDocs Vault

Tech Stack

Languages

Language Usage
TypeScript Core application (ES2023 target, strict mode, NodeNext modules) — ~558k LOC across 3,100+ files
Swift iOS and macOS native apps (apps/ios/, apps/macos/, apps/shared/OpenClawKit/)
Kotlin/Java Android native app (apps/android/, Gradle-based)
CSS/HTML Control UI (ui/ — Lit web components)

TypeScript dominates. The native apps are thin wrappers around the core Node.js process.

Runtime

Core Frameworks & Libraries

AI / Agent Framework

Dependency Purpose
@mariozechner/pi-agent-core Agent execution loop, message management, tool dispatch
@mariozechner/pi-ai LLM streaming (streamSimple), image content types
@mariozechner/pi-coding-agent createAgentSession(), SessionManager, SettingsManager — the coding agent SDK
@mariozechner/pi-tui Terminal UI for interactive agent sessions
@agentclientprotocol/sdk ACP (Agent Client Protocol) integration

The Pi agent framework is the backbone. OpenClaw wraps it with its own tool definitions, system prompt construction, channel routing, and plugin system. The SDK owns the inner agentic loop (LLM call → tool dispatch → result feedback → repeat), while OpenClaw manages everything around it: session lifecycle, multi-channel I/O, configuration, and extensibility.

Messaging Channels

Dependency Channel
@whiskeysockets/baileys WhatsApp (unofficial API)
grammy + @grammyjs/* Telegram
discord-api-types Discord
@slack/bolt + @slack/web-api Slack
@line/bot-sdk LINE

8 channels built-in, 20+ more via extensions.

Web & Networking

Dependency Purpose
express@^5 HTTP server for gateway and web channel
ws@^8 WebSocket server for real-time gateway communication
undici@^7 Modern HTTP client
playwright-core Browser automation for web tools

Storage & Data

Dependency Purpose
sqlite-vec SQLite with vector extension for embeddings
proper-lockfile File-based session locking
yaml, zod@^4 Config parsing and schema validation

System

Dependency Purpose
@lydell/node-pty Pseudo-terminal for bash tool execution
commander@^14 CLI argument parsing
chalk@^5 Terminal colors
sharp@^0.34 Image processing/resizing
croner Cron job scheduling

Build & Dev Tooling

Tool Purpose
tsdown@^0.20 (backed by rolldown) TypeScript bundler — outputs to dist/
vitest@^4 Test runner (unit, e2e, live, extension, gateway configs)
oxlint@^1.48 Linter (Rust-based, fast)
oxfmt@0.33 Formatter (Rust-based, fast)
typescript@^5.9 Type checking
tsx@^4 Development-time TypeScript execution

UI

Tool Purpose
lit@^3.3.2 Web component framework for control UI
vite@7.3.1 UI dev server and bundler
dompurify@^3 HTML sanitization
marked@^17 Markdown rendering

Why These Choices

Monorepo Structure

pnpm-workspace.yaml defines:
  - . (root — main openclaw package)
  - ui/ (control UI — Lit + Vite)
  - packages/clawdbot/ (compatibility shim)
  - packages/moltbot/ (compatibility shim)

Build Output

tsdown bundles into dist/ with these entry points:

Entry Output
src/entry.ts dist/entry.js — CLI bootstrap
src/index.ts dist/index.js — library API
src/cli/daemon-cli.ts dist/daemon-cli.js — daemon mode
src/plugin-sdk/index.ts dist/plugin-sdk/index.js — public plugin SDK
src/extensionAPI.ts dist/extensionAPI.js — extension runtime
src/hooks/bundled/*/handler.ts Bundled hook handlers