Skip to content

Project Overview

OpenClaw is a personal AI assistant gateway that runs on your own device. It connects multiple messaging platforms (Telegram, Discord, WhatsApp, Slack, Signal, and more) to a single AI Agent, allowing you to talk to your AI assistant from any device and any platform.

Core Positioning

Unlike traditional chatbot frameworks, OpenClaw is not designed to "build a bot." Instead, its goal is to be your personal AI assistant. All channels connect to the same session system. The AI remembers context across platforms, executes tools, manages schedules, and can even control your browser.

Tech Stack

TechnologyPurpose
TypeScript (ESM)Core language, strict mode
Node.js >=22Runtime baseline
pnpmPackage manager + monorepo workspace
VitestTest framework, 70% coverage threshold
Oxlint / OxfmtLinting and formatting
Commander.jsCLI framework
wsWebSocket implementation
grammy / discord.js / @slack/boltChannel SDKs
Swift / KotlinNative apps (macOS, iOS, Android)

Version Strategy

OpenClaw uses date-based version numbers: YYYY.M.D-patch, for example 2026.2.6-3.

Release channels:

  • stable -- Tagged releases (vYYYY.M.D), npm dist-tag latest
  • beta -- Pre-releases (vYYYY.M.D-beta.N), dist-tag beta
  • dev -- main branch HEAD, dist-tag dev

Entry Points

OpenClaw has two main entry files:

src/entry.ts -- CLI Startup Entry

typescript
// src/entry.ts
process.title = "openclaw";
installProcessWarningFilter();
normalizeEnv();

// Respawn to suppress ExperimentalWarning
if (!ensureExperimentalWarningSuppressed()) {
  import("./cli/run-main.js")
    .then(({ runCli }) => runCli(process.argv))
    .catch((error) => { /* ... */ });
}

The entry file handles several critical tasks:

  1. Installs a Node.js experimental warning filter
  2. Normalizes environment variables
  3. If experimental warnings have not been suppressed, respawns a child process with the --disable-warning=ExperimentalWarning flag
  4. Parses CLI profile arguments and ultimately calls runCli()

src/index.ts -- Program Entry + Public API

typescript
// src/index.ts
loadDotEnv({ quiet: true });
normalizeEnv();
ensureOpenClawCliOnPath();
enableConsoleCapture();
assertSupportedRuntime();

const program = buildProgram();

if (isMain) {
  installUnhandledRejectionHandler();
  void program.parseAsync(process.argv);
}

This file serves a dual purpose: it is the buildProgram() entry point for the CLI, and it also exports the public API (config loader, session utilities, channel senders, etc.) for use by other packages and plugins.

Goals of This Tutorial

This tutorial focuses on source-level implementation -- it is not a usage guide for OpenClaw, but rather a deep dive into how the system is built:

  • How does the Gateway manage WebSocket connections and sessions?
  • How does the channel abstraction layer unify message formats across platforms?
  • How does the Agent runtime handle tool calls and streaming output?
  • How does the plugin system achieve hot-loading and lifecycle management?
  • How does the CLI organize commands and dependency injection?

Summary

  • OpenClaw is a personal AI assistant gateway that unifies multi-channel messaging
  • Built with TypeScript + Node.js in a monorepo architecture
  • Core components: Gateway, Channels, Agent, Plugins, CLI
  • This tutorial covers source-level implementation details, not usage instructions

Next: Architecture

OpenClaw Source Code Tutorial