- Home (README)
- Plain English
- Technical
- Privacy + safety
- Deployment
- Optimizations
- Reference
This is a "practical navigation guide" for new contributors/readers.
Tip: don't start by reading everything. Start from the Gateway and follow the path of one message.
| Directory | Purpose |
|---|---|
src/ |
TypeScript source (~50 subdirectories) |
docs/ |
Canonical documentation (source of truth) |
extensions/ |
Plugins (workspace packages) |
apps/ |
macOS/iOS/Android apps |
packages/ |
Shared workspace packages |
ui/ |
Web UI / dashboard |
skills/ |
Skill definitions |
scripts/ |
Build, release, and utility scripts |
test/ |
Integration / E2E tests |
Swabble/ |
Swabble integration |
exports/ |
Public API exports |
vendor/ |
Vendored third-party code |
patches/ |
Patch files for dependencies |
git-hooks/ |
Git hook scripts |
assets/ |
Static assets (images, icons) |
src/entry.ts— CLI entry (spawns/sets env, then loadssrc/cli/run-main.ts)src/cli/— CLI command definitionssrc/commands/— command implementations (~352 files)
src/gateway/server.impl.ts— Gateway startup, config validation/migration, runtime wiringsrc/gateway/server-ws-runtime.ts(and siblings) — WS server + RPC handler plumbingdocs/gateway/index.md— runbook that matches how it operates in prod
src/channels/— shared channel logic (identities, allowlists, gating, registry)- Per-channel folders with full adapters now live under
extensions/:extensions/telegram/,extensions/discord/,extensions/slack/,extensions/signal/,extensions/imessage/,extensions/whatsapp/,extensions/feishu/,extensions/line/, plus legacysrc/line/,src/whatsapp/(still insrc/) - Additional extension channels:
extensions/googlechat/,extensions/msteams/,extensions/matrix/,extensions/zalo/,extensions/zalouser/,extensions/irc/,extensions/nostr/,extensions/tlon/,extensions/twitch/,extensions/mattermost/,extensions/nextcloud-talk/,extensions/synology-chat/ docs/channels/— channel documentation (29 files including pairing, routing, groups)
src/auto-reply/— reply pipelinesrc/auto-reply/reply/agent-runner.ts— core agent-turn orchestratorsrc/agents/— agent framework (~1005 files, 12 subdirectories): tools, sandbox, auth profiles, skills, multi-agent
src/routing/— dedicated routing module:session-key.ts,resolve-route.ts,bindings.ts
src/security/— security-related logic (audits, policy, external content wrapping)docs/gateway/security/index.md— operator-facing threat model + checklist
The src/ directory contains ~50 subdirectories. Key ones beyond the entrypoints above:
| Directory | Files (approx.) | Purpose |
|---|---|---|
src/agents/ |
~1005 | Agent framework, tools, sandbox, auth profiles, skills |
src/gateway/ |
~410 | Gateway server, WS runtime, RPC handlers, config validation |
src/auto-reply/ |
~355 | Reply pipeline, agent turn orchestration |
src/cli/ |
~331 | CLI command definitions and parsing |
src/commands/ |
~429 | CLI command implementations |
src/infra/ |
~538 | Infrastructure: networking, SSRF guards, exec safety, archiving |
src/config/ |
~266 | Configuration schema, types, validation, migrations |
extensions/browser/src/browser/ |
~96 | Browser automation (CDP/Playwright) — moved from src/browser/ in Mar 27 sync 3 |
src/channels/ |
~191 | Shared channel logic, identities, allowlists, registry |
src/memory/ |
~106 | Memory/context management, QMD |
src/secrets/ |
~53 | Secret reference resolution, env substitution, audit |
src/cron/ |
~118 | Cron job scheduling |
src/plugins/ |
~245 | Plugin runtime and loading |
src/media-understanding/ |
~56 | Image/audio/video understanding via AI |
src/tui/ |
~48 | Terminal UI |
src/daemon/ |
~57 | Cross-platform Gateway service lifecycle (systemd, launchd, schtasks) |
src/hooks/ |
— | Lifecycle hooks system |
src/media/ |
— | Media handling (upload, download, conversion) |
src/plugin-sdk/ |
— | Plugin SDK for extension authors |
src/routing/ |
— | Message routing, session key derivation |
src/sessions/ |
— | Session management and compaction |
src/tts/ |
— | Text-to-speech |
src/web-search/ |
— | Web search integration and retrieval |
src/wizard/ |
— | Setup wizard |
src/logging/ |
— | Logging, redaction |
src/link-understanding/ |
— | URL preview / link understanding |
src/node-host/ |
— | Node.js host for sandboxed execution |
src/pairing/ |
— | Device pairing flow |
src/process/ |
— | Process management |
src/terminal/ |
— | Terminal integration |
src/types/ |
— | Shared TypeScript types |
src/utils/ |
— | General utilities |
src/shared/ |
— | Shared cross-module code |
src/acp/ |
— | ACP (Agent Communication Protocol) |
src/canvas-host/ |
— | Canvas/drawing host |
src/compat/ |
— | Compatibility layers |
src/context-engine/ |
— | Context management and orchestration |
src/docs/ |
— | In-app documentation helpers |
src/markdown/ |
— | Markdown processing |
src/scripts/ |
— | Source-level scripts |
src/test-helpers/ |
— | Test helper utilities |
src/test-utils/ |
— | Test utility functions |
From repo root:
-
Find where the Gateway is started:
- search:
startGatewayServer - file:
src/gateway/server.impl.ts
- search:
-
Find security audit logic:
- search:
security audit - docs:
docs/gateway/security/index.md, CLI docs indocs/cli/security.md
- search:
-
Find pairing:
- search:
pairinginsrc/pairing/anddocs/channels/pairing.md
- search:
-
Find a specific channel's allowlist behavior:
- search
allowFromordmPolicyin channel config types (src/config/types.*.ts— 30 files) and channel runtime
- search
-
Find ChatType / DM policy enum:
- search:
ChatType— used across channel adapters for group vs DM routing
- search:
-
Find text sanitization:
- search:
sanitizeUserFacingText— used in reply normalization and agent tools
- search:
-
Find memory search logic:
- search:
memorySearch— insrc/config/andsrc/memory/
- search:
- Pick a channel (e.g., Telegram).
- Find its monitor/adapter in
extensions/telegram/. - Follow where it emits a normalized event into shared channel/routing logic.
- The
src/routing/module resolves the route and derives a session key (session-key.ts,resolve-route.ts). src/hooks/may fire at pipeline stages (pre-reply, post-reply, etc.).- Track how the Gateway selects a session key.
- Jump into
src/auto-reply/reply/agent-runner.tsto see how the agent turn is run. - For multi-agent flows,
src/agents/orchestrates tool use, sub-agents, and sandbox interactions. - Track how the response is chunked/sent back.
- https://docs.openclaw.ai/start/getting-started
- https://docs.openclaw.ai/gateway
- https://docs.openclaw.ai/gateway/security
- https://docs.openclaw.ai/gateway/configuration
- https://docs.openclaw.ai/help/faq
This section tracks how well the explain-clawdbot/ documentation covers the codebase. Snapshot verified on 2026-03-26.
| Area | Files | Last Verified | Coverage | Notes |
|---|---|---|---|---|
| CLI Commands | 41 top-level commands (40 non-legacy) | 2026-03-15 | ✅ Complete | 01-plain-english/cli-commands.md |
| Gateway Config | 31 root + 14 gateway fields | 2026-03-15 | ✅ Complete | 99-reference/commands-and-troubleshooting.md |
| Security | 15 docs + 105 hardening logs + 261 PR refs + 95 issue refs | 2026-03-15 | ✅ Complete | 08-security-analysis/ |
| Architecture | Core paths, extensions/ channel layout | 2026-03-15 | ✅ Complete | 02-technical/architecture.md |
| Deployment | 4 runbooks | 2026-03-15 | ✅ Complete | 03-deploy/ |
| Privacy/Safety | 4 guides | 2026-03-15 | ✅ Complete | 04-privacy-safety/ |
| Gap | Impact | Priority |
|---|---|---|
| Browser automation (CDP) | Medium | Low (security-irrelevant) |
| Plugin SDK | Low | Low |
| TUI internals | Low | Low |
| Provider integrations | Medium | Medium (may have security implications) |
| Skill | Frequency | Scope |
|---|---|---|
doc-health-check |
Weekly | Single-file drift audit (report-only) |
align-docs-upstream |
As needed | Apply targeted doc fixes after drift is found |