Codebase Navigation ๐ŸŸข

Before diving into source code, you need a map. This chapter gives you a complete overview of OpenClaw's directory structure so you can quickly find any piece of code.

Learning Objectives

After reading this chapter, you'll be able to:


I. Top-Level Directory Structure

openclaw/
โ”œโ”€โ”€ src/              โ† Core runtime source code (~40K lines TypeScript)
โ”œโ”€โ”€ extensions/       โ† Official plugins (channel/provider/capability)
โ”œโ”€โ”€ skills/           โ† Built-in Skills (~60 directories)
โ”œโ”€โ”€ packages/         โ† Shared utility packages
โ”œโ”€โ”€ ui/               โ† Web UI (React)
โ”œโ”€โ”€ scripts/          โ† Build and maintenance scripts
โ”œโ”€โ”€ docs/             โ† Documentation
โ””โ”€โ”€ openclaw.mjs      โ† CLI entry point

II. src/ Subdirectory Breakdown

This is the heart of OpenClaw:

Core Control

DirectoryRole
src/gateway/HTTP/WebSocket server, authentication, routing
src/routing/Message-to-agent routing engine
src/agents/Agent reasoning, Bootstrap, compaction
src/plugins/Plugin discovery, loading, registry

Infrastructure

DirectoryRole
src/config/Configuration loading, parsing, validation
src/sessions/Session storage (SQLite-based)
src/infra/Utilities (backoff, heartbeat, outbound)
src/logging/Structured logging system
src/security/Prompt injection protection, secret handling

Channels

DirectoryRole
src/channels/Channel types, adapters, plugin interfaces
src/auto-reply/Reply strategies (heartbeat, thinking, streaming)

Integration

DirectoryRole
src/acp/Agent Coordination Protocol (multi-agent)
src/tasks/Task registry and executor
src/cron/Cron job types and normalization
src/secrets/Secret reference resolution

SDK

DirectoryRole
src/plugin-sdk/Public Plugin SDK (channel, provider, capability contracts)
src/cli/CLI commands and argument parsing

III. extensions/ Plugin Directory

90+ official plugins, organized by type:

Channel Plugins (Platform Adapters)

extensions/telegram/          โ† Telegram Bot
extensions/discord/           โ† Discord Bot
extensions/slack/             โ† Slack Bot
extensions/bluebubbles/       โ† iMessage (via BlueBubbles)
extensions/signal/            โ† Signal Messenger
extensions/matrix/            โ† Matrix Protocol
extensions/msteams/           โ† Microsoft Teams
extensions/email/             โ† Email (SMTP/IMAP)
extensions/sms-twilio/        โ† SMS (via Twilio)
extensions/line/              โ† LINE
extensions/wechat/            โ† WeChat
...

LLM Provider Plugins

extensions/anthropic/         โ† Anthropic Claude (default)
extensions/openai/            โ† OpenAI GPT-4, o1
extensions/ollama/            โ† Local Ollama models
extensions/google-gemini/     โ† Google Gemini
extensions/mistral/           โ† Mistral AI
extensions/groq/              โ† Groq (fast inference)
extensions/amazon-bedrock/    โ† AWS Bedrock
extensions/anthropic-vertex/  โ† Claude on Google Vertex
...

Capability Plugins

extensions/memory-core/       โ† Local vector memory
extensions/mcporter/          โ† MCP Server launcher
extensions/acpx/              โ† ACP extensions
...

IV. skills/ Directory

~60 built-in Skills grouped by category:

skills/
โ”œโ”€โ”€ coding-agent/             โ† Programming assistant
โ”œโ”€โ”€ github/                   โ† Git/GitHub workflow
โ”œโ”€โ”€ taskflow/                 โ† Task flow management
โ”œโ”€โ”€ summarize/                โ† Summary generation
โ”œโ”€โ”€ notion/                   โ† Notion integration
โ”œโ”€โ”€ obsidian/                 โ† Obsidian notes
โ”œโ”€โ”€ discord/                  โ† Discord workflow
โ”œโ”€โ”€ slack/                    โ† Slack workflow
โ”œโ”€โ”€ spotify-player/           โ† Music playback control
โ”œโ”€โ”€ weather/                  โ† Weather queries
โ”œโ”€โ”€ sag/                      โ† Skill-as-Agent (create new Skills)
โ”œโ”€โ”€ skill-creator/            โ† Skill creation assistant
...

V. Key Files Reference

FileSizeRole
openclaw.mjsEntryCLI wrapper, version check, launch core
src/entry.ts11KBMain entry point, runCli()
VISION.md-Design philosophy document
CLAUDE.md-Architecture boundary constraints
src/plugin-sdk/core.ts21KBPlugin SDK public API entry
src/plugin-sdk/entrypoints.ts-All SDK entry points
package.json-Exports map (SDK entry point definitions)

Summary

  1. src/ = Core runtime: gateway, routing, agents, plugins โ€” all key logic is here.
  2. extensions/ = Capability library: 90+ official plugins, organized by type.
  3. skills/ = Instruction library: 60 built-in Markdown Skills.
  4. Plugin SDK entry is src/plugin-sdk/core.ts: all public APIs re-exported from here.

โ† What Is OpenClaw | โ†’ Running Locally: Startup Flow