← Back to dashboard

OpenClaw Integration Guide

What is OpenClaw?

The real model

A daemon plus a CLI, not an SDK — and the config file is the whole programming model.

There is nothing to import: `npm i -g openclaw@latest --allow-scripts=openclaw` on Node 24.16+ or 26.1+ (npm 12 blocks the lifecycle scripts without that flag, the #1 "installed but broken" report), then `openclaw onboard --install-daemon`. The project has published 700+ GitHub security advisories in 2026, so stay on latest or extended-stable (never below 2026.8.1) and run `openclaw security audit`. Agents live in `agents.entries.<id>`; once you set `agents.ownership: "explicit"` there is no default agent, so an unbound channel routes nowhere. Tool policy is enforced *before* the model call — a denied tool's schema never reaches the model, and deny always wins — so the docs' hardened baseline (`tools.profile: "messaging"`, deny `group:runtime`/`group:fs`/`group:automation`, `exec.security: "deny"`, sandbox `non-main`) is a real capability removal rather than a polite request, and it is mandatory on anything a stranger can DM. Skills are `SKILL.md` files resolved across six precedence tiers where the frontmatter `name` beats the folder name, so shadowed skills fail silently. `gateway.bind` defaults to loopback on a host but flips to `auto` (0.0.0.0) inside a container — auth is refused-if-missing on non-loopback, which is the guardrail. For codeAmani the fit is sharp and bounded: it is the fastest way to put a Claude-backed brain behind a WhatsApp number for internal ops and for prototyping the Kenya builds, but the WhatsApp channel is QR pairing against a WhatsApp account, not the Meta Business Cloud API — customer-facing volume still ships on the official API with templates and the 24-hour window.

Six OpenClaw primitives

One daemon, one JSON5 config, one CLI — channels in, agents in the middle, tools on a leash.

Text
 ██████╗ ██████╗ ███████╗███╗   ██╗ ██████╗██╗      █████╗ ██╗    ██╗
██╔═══██╗██╔══██╗██╔════╝████╗  ██║██╔════╝██║     ██╔══██╗██║    ██║
██║   ██║██████╔╝█████╗  ██╔██╗ ██║██║     ██║     ███████║██║ █╗ ██║
██║   ██║██╔═══╝ ██╔══╝  ██║╚██╗██║██║     ██║     ██╔══██║██║███╗██║
╚██████╔╝██║     ███████╗██║ ╚████║╚██████╗███████╗██║  ██║╚███╔███╔╝
 ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═╝  ╚═╝ ╚══╝╚══╝

OpenClaw Integration Guide

Focus: Running a self-hosted OpenClaw Gateway as a personal or ops AI agent that lives inside WhatsApp, Telegram, Slack and friends. Covers install, config, agents, skills, MCP, and how to harden it before it leaves loopback.

Overview

OpenClaw is MIT-licensed (github.com/openclaw/openclaw). It is developed in the open by the OpenClaw Foundation (openclaw.org), an independent 501(c)(3). The docs describe it as "Your AI assistant, on your own hardware, in every chat app you already use. One Gateway. Any model. Any device. No hosted service in the middle." The project is active, not archived, renamed or forked: releases ship several times a week. The v2026.8.1 release was branded "OpenClaw 2.0" and rebuilt the web UI and onboarding.

It is not a library you import. There is no import { OpenClaw }. It is a daemon plus a CLI. You install the openclaw npm package globally (or use the installer or a desktop app) and run onboarding. You end up with a long-lived Gateway process on 127.0.0.1:18789. The Gateway owns your messaging connections, model providers, agent sessions and tool policy.

The design point that sets it apart from an agent framework: the messaging platform is the UI. There is no app to build. You DM a WhatsApp or Telegram number, and the Gateway routes the message to an agent. The agent runs tools in a workspace directory (on the host, in a sandbox, or on a cloud worker), and the reply comes back down the same channel. A browser Control UI (openclaw dashboard) handles chat, config and sessions. Native companions also exist: a Windows Hub, a macOS menu-bar app, a Linux desktop app, and iOS and Android nodes.

OpenClawAgent SDK / frameworkManaged bot platform
ShapeDaemon + CLI you self-hostLibrary you compile into an appHosted SaaS
UIExisting messaging apps + Control UIYou build itVendor's console
ModelBring your own key or Claude Code loginWhatever you wireVendor's models
SecretsYour disk (~/.openclaw/)Your envVendor holds them
Ops burdenYours (process, updates, advisories)Yours (deploy)None
Multi-userTrusted team inside one trust boundaryYes, if you build itYes
PriceFree (no paid tier); you pay model + hostFree SDK + modelSubscription

Official Documentation


Versions and release channels

Versions are date-based, not semver. As of 2026-10-20 (npm view openclaw dist-tags):

Dist-tag / update channelVersionUse
latest (stable)2026.10.5Default. Moves several times a week
extended-stable2026.9.33Trailing-month line. Pin this for long-lived Gateways
beta2026.10.10-beta.2Testing only
devgit main checkoutContributors

The alpha dist-tag no longer exists. There was no v2026.7.2 release: its betas shipped as v2026.8.1 ("OpenClaw 2.0"). Switch channels with openclaw update --channel extended-stable (or stable, beta, dev). extended-stable is package-only and does not accept --tag.

Anything older than 2026.8.1 is affected by a large batch of advisories published on 2026-09-11, including Gateway, WhatsApp-plugin and exec-approval bugs rated high. If a host is still on the 2026.7.x line, update it before doing anything else. See Security below.


Install

Requirements: Node 24.16+ or 26.1+ (Node 26 recommended). The engines range is >=24.16.0 <25 || >=26.1.0. Node 22 and 25 are no longer supported (dropped in v2026.9.3 over a node:sqlite truncation bug). You also need an API key, or a Claude Code login, for at least one model provider.

Installer script. It detects the OS, installs Node if missing, installs OpenClaw and starts onboarding:

Bash
# macOS / Linux / WSL2
curl -fsSL https://openclaw.ai/install.sh | bash
# add  -s -- --no-onboard  to skip onboarding
PowerShell
# Windows (PowerShell). The native Windows Hub app is the docs' recommended desktop path
iwr -useb https://openclaw.ai/install.ps1 | iex

If you manage Node yourself:

Bash
# npm 12 or npm 11.16+ (npm 11.15 and earlier: drop the flag)
npm install -g openclaw@latest --allow-scripts=openclaw
openclaw onboard --install-daemon

# pnpm
pnpm add -g --allow-build=openclaw openclaw@latest
openclaw onboard --install-daemon

# bun (Bun 1.4.3+ can also run the Gateway)
bun add -g --trust openclaw@latest
bun run --bun openclaw onboard --install-daemon --daemon-runtime bun

npm 12 blocks unapproved lifecycle scripts. Without --allow-scripts=openclaw the preinstall/postinstall steps are skipped. The docs now use the = form. The npm approve-scripts openclaw hint that npm 11.16 prints does not work for a global install (ENOMATCH).

Onboarding offers Quick start and Custom setup. Quick start reuses detected AI access, checks it with a real completion, and leaves the Gateway in the foreground. Then install the service:

Bash
openclaw gateway install   # LaunchAgent (macOS), systemd user unit (Linux/WSL2), Scheduled Task (Windows)
openclaw --version
openclaw doctor            # config + environment diagnostics
openclaw gateway status    # should report listening on 18789
openclaw dashboard         # opens the Control UI
openclaw security audit    # run this before you connect any channel

Containers: official images are ghcr.io/openclaw/openclaw (primary) and the Docker Hub mirror openclaw/openclaw. Tags include latest, extended-stable, version tags such as 2026.10.5, and -slim and -browser variants. Avoid unofficial mirrors.


Configuration

State lives in $HOME/.openclaw/. The config file is JSON5 at ~/.openclaw/openclaw.json; override the path with OPENCLAW_CONFIG_PATH. Keep it a real file, not a symlink: OpenClaw writes atomically, so a symlink gets its target replaced. The Gateway watches the file and hot-reloads it. An invalid config exits with code 78, and systemd units stop relaunching until it is fixed. Prefer the CLI, which validates edits before they land:

Bash
openclaw config file            # print the resolved config path
openclaw config get agents.defaults.model
openclaw config set agents.defaults.model.primary "anthropic/claude-opus-5-5"
openclaw config validate
openclaw config schema          # full JSON Schema (--json)

Model providers and Claude model IDs

Models are addressed as "provider/model". The Claude IDs match this repo's anthropic/ guide; OpenClaw's Anthropic provider page documents the same IDs:

UseOpenClaw refAnthropic API price (in / out per MTok)
Primary (house default)anthropic/claude-opus-5-5$4 / $20
Fallback / volumeanthropic/claude-sonnet-5-5$2 / $10
Utility (titles, recaps, routing)anthropic/claude-haiku-5-5$0.10 / $0.50 up to 100K-token prompts, $0.50 / $2.50 above
Frontier long-horizonanthropic/claude-fable-5-1$10 / $50

Notes from the provider page:

  • Fresh API and Claude CLI setups now default to Opus 5.5. The bare aliases opus, sonnet, haiku and fable resolve to Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1. Version-pinned refs (anthropic/claude-opus-5, anthropic/claude-fable-5) still work and are not rewritten. So an old config that pins anthropic/claude-opus-5 stays on Opus 5 until you change it.
  • Haiku 5.5 is Anthropic's default utility model in OpenClaw.
  • Opus 5.5 always uses adaptive thinking. OpenClaw defaults it to medium effort (/think low … max), drops sampling params and prefills, and turns forced tool choice into auto. State in the prompt when a specific tool must run.
  • With an API key configured, OpenClaw refreshes the Claude catalog from Anthropic's models endpoint, so new models show up without an OpenClaw release.
  • Two auth routes. You can use an API key (pay-as-you-go), or a Claude CLI route that reuses an existing Claude Code login (claude auth login) on the same host. The CLI route is selected per model with agentRuntime: { id: "claude-cli" }. The two are separate billing choices: a CLI-route selection never silently falls back to the API. For a long-lived shared Gateway, prefer a dedicated ANTHROPIC_API_KEY.
JSON5
{
  env: {
    vars: {
      ANTHROPIC_API_KEY: "sk-ant-...", // injected from Hazina at provisioning time; never committed
    },
  },
  agents: {
    defaults: {
      model: {
        primary: "anthropic/claude-opus-5-5",
        fallbacks: ["anthropic/claude-sonnet-5-5"],
      },
      utilityModel: "anthropic/claude-haiku-5-5", // short internal tasks: titles, recaps, narration
    },
  },
}
Bash
openclaw onboard --anthropic-api-key "$ANTHROPIC_API_KEY"
openclaw models list --provider anthropic
openclaw models set anthropic/claude-opus-5-5

The provider directory also covers OpenAI (including "Sign in with ChatGPT" and a Codex native harness), Google, Mistral, DeepSeek, Together, OpenRouter, Bedrock and Vertex, gateways (Cloudflare AI Gateway, Vercel AI Gateway), and local runtimes (Ollama, LM Studio, vLLM and others). Per codeAmani's AI routing policy, keep primary on Claude.

Agents

Agents are config objects, not code. agents.defaults sets the inherited baseline, agents.entries.<id> overrides it per agent, and bindings route channels to agents.

JSON5
{
  agents: {
    ownership: "explicit", // stamped automatically when you create a multi-agent fleet
    defaults: {
      workspace: "~/.openclaw/workspace",
      model: { primary: "anthropic/claude-opus-5-5" },
      skills: ["duka-inventory"],
      heartbeat: { every: "30m" },
    },
    entries: {
      ops: {
        name: "Ops Agent",
        workspace: "~/.openclaw/workspace-ops",
        model: "anthropic/claude-opus-5-5",
        identity: { name: "Amani", emoji: "🕊️" },
      },
      support: {
        workspace: "~/.openclaw/workspace-support",
        model: { primary: "anthropic/claude-sonnet-5-5", fallbacks: [] },
        skills: ["docs-search"],
      },
    },
  },
  bindings: [
    { agentId: "ops", match: { channel: "whatsapp", accountId: "internal" } },
    { agentId: "support", match: { channel: "telegram" } },
  ],
}

Binding resolution is deterministic: within each tier, the first matching bindings entry wins, and match specificity narrows peer → guild/team → account → channel-wide. With ownership: "explicit" there is no default agent, so an unbound channel has nowhere to route.

Bash
openclaw agents list --bindings
openclaw agents add ops --workspace ~/.openclaw/workspace-ops --bind whatsapp:internal --non-interactive
openclaw agents bind --agent ops --bind telegram:ops
openclaw agents unbind --agent ops --bind telegram:ops

Channels

The channel catalog is generated from the repo. Bundled channels are Telegram, Reef, A2A and X/Twitter, and WebChat is included in core. Official plugins install on demand: WhatsApp, Slack, Discord, Signal, iMessage, Matrix, Microsoft Teams, Google Chat, LINE, SMS (Twilio), Mattermost, IRC, Twitch, Nostr, Zalo, Feishu, Nextcloud Talk and more. External plugins include WeChat, WeCom and Yuanbao. A Voice Call plugin adds telephony over Plivo, Telnyx or Twilio.

Telegram is the fastest first channel (bot token, no plugin install). WhatsApp needs QR pairing and keeps more state on disk.

Bash
openclaw channels add --channel telegram --token <bot-token>
openclaw plugins install @openclaw/whatsapp       # ClawHub by default; npm:@openclaw/whatsapp forces npm
openclaw channels add --channel whatsapp          # interactive; offers the plugin install if missing
openclaw channels login --channel whatsapp        # QR pairing (add --account <id> for multi-account)
openclaw channels status --probe

Package specs, including @openclaw/*, install from ClawHub by default. Prefix with clawhub:, npm:, git: or npm-pack: to pick the source explicitly. Plugins that declare capabilities need consent. Non-interactive installs need --accept-capabilities, and arbitrary npm, git or local sources also need --force after you review them.

WhatsApp

Set the access policy before you log in. The defaults are DM pairing and group allowlist:

JSON5
{
  channels: {
    whatsapp: {
      dmPolicy: "allowlist",            // pairing | allowlist | open | disabled
      allowFrom: ["+254712345678"],
      groupPolicy: "allowlist",
      groupAllowFrom: ["+254712345678"],
      groups: { "*": { requireMention: true } },
      textChunkLimit: 2000,             // default 4000; lower it for 2G/3G users
      mediaMaxMb: 16,                   // default 50
      sendReadReceipts: true,
    },
  },
}
dmPolicyEffect
pairing (default)Unknown senders get a pairing code. Requests expire after 1 hour, max 3 pending per account
allowlistOnly numbers in allowFrom get through
openEveryone. Requires an explicit allowFrom: ["*"]
disabledNo DMs at all
Bash
openclaw pairing approve whatsapp <CODE>

Session credentials land in ~/.openclaw/credentials/whatsapp/<accountId>/creds.json (backup creds.json.bak). Treat that directory as a secret. Multi-account setups live under channels.whatsapp.accounts.<id>; named accounts inherit from accounts.default and then from the channel root.

Read this before shipping. The docs say: "production-ready via WhatsApp Web (Baileys). The gateway owns the linked session(s); there is no separate Twilio WhatsApp channel." Login is QR-only. This is not the Meta WhatsApp Business Cloud API. It suits an internal ops number or a prototype. It is the wrong tool for customer-facing volume on a business number. See codeAmani notes.


Skills

Skills are the extension unit for agent behaviour, and they are just files: a directory containing a SKILL.md with YAML frontmatter and a markdown body (AgentSkills-style).

Markdown
---
name: mpesa-reconcile
description: Reconcile M-Pesa C2B callbacks against open orders and flag mismatches.
---

# M-Pesa reconciliation

When asked to reconcile payments:
1. Read `orders.csv` from the workspace.
2. Match on `CheckoutRequestID`, never on amount alone.
3. Report unmatched rows as a table; never auto-refund.

Discovery walks up to 6 levels deep inside configured roots. The name in frontmatter wins over the directory name. When the same name appears twice, the highest-precedence source wins:

PrioritySource
1Workspace skills: <workspace>/skills
2Project agent skills: <workspace>/.agents/skills
3Personal agent skills: ~/.agents/skills (default state only)
4Managed/local skills: <state-dir>/skills
5Bundled skills
6Extra directories and plugin skills
Bash
openclaw skills install @owner/slug                    # from ClawHub
openclaw skills install skills-sh:owner/repo/slug      # skills.sh ref
openclaw skills install git:owner/repo@ref             # from a git ref
openclaw skills install ./path/to/skill --as mpesa-reconcile
openclaw skills install @owner/slug --global           # visible to every local agent
openclaw skills verify @owner/slug                     # trust envelope; --card prints the Skill Card
openclaw skills update --all

disable-model-invocation: true in frontmatter keeps a skill out of the model's $ picker (user-only). Third-party skills are prompt content plus possibly scripts. Run skills verify and read them before installing. ClawHub runs automated scans and can hold a release, but a scan is not a code review.


Tools, tool policy, sandbox and elevated

Three separate controls decide what an agent can do:

  1. Tool policy decides which tools exist. Keys: tools.profile, tools.allow / tools.deny, tools.byProvider, agents.entries.*.tools.*, and tools.sandbox.tools.*.
  2. Sandbox decides where tools run. agents.defaults.sandbox.mode is off (default), non-main or all. Backends are Docker (default), Podman, SSH, OpenShell or Crabbox. The Gateway process itself always stays on the host.
  3. Elevated (tools.elevated.*) is an exec-only escape hatch from the sandbox. Keep it enabled: false unless one trusted sender needs it.

Rules: deny always wins. A non-empty allow blocks everything else. Policy is enforced before the model call, so a denied tool's schema is never sent for that turn. Tool policy filters by tool name: if exec is allowed, denying write does not make shell commands read-only. Use groups instead of hand-listing tools:

GroupExpands to
group:runtimeexec, process, code_execution (bash aliases exec)
group:fsread, write, edit, apply_patch
group:automationheartbeat_respond, cron, gateway
group:uibrowser, screen, terminal, canvas, …
group:nodesnodes, computer
group:webweb_search, x_search, web_fetch
group:pluginsall plugin tools, including MCP servers

The docs' hardened baseline:

JSON5
{
  gateway: {
    mode: "local",
    bind: "loopback",
    auth: { mode: "token", token: "replace-with-long-random-token" }, // from Hazina, never literal
  },
  session: { dmScope: "per-channel-peer" }, // separate DM context per sender
  tools: {
    profile: "messaging",
    deny: ["group:automation", "group:runtime", "group:fs", "sessions_spawn", "sessions_send"],
    fs: { workspaceOnly: true },
    exec: { security: "deny", ask: "always" },
    elevated: { enabled: false },
    sessions: { visibility: "agent" },
    agentToAgent: { enabled: false },
  },
  channels: {
    whatsapp: { dmPolicy: "pairing", groups: { "*": { requireMention: true } } },
  },
}

Built in: non-owner senders can never use the cron or gateway tools in chat-driven turns. Inspect what is actually in force with:

Bash
openclaw sandbox explain --agent support
openclaw policy             # inspect and test tool policy
openclaw logs               # look for agents/tool-policy entries

MCP servers

MCP servers go under mcp.servers (stdio, streamable HTTP, or SSE). Their tools pass through the same profile and policy controls, and sandboxed turns need them on the sandbox allow-list (bundle-mcp, group:plugins, or server__*).

Bash
openclaw mcp add docs --url https://mcp.example.com/mcp --transport streamable-http --include 'search,read_*'
openclaw mcp doctor docs --probe     # saving a definition proves nothing; probe it
openclaw mcp login docs              # OAuth for protected servers
openclaw mcp status --verbose
openclaw mcp serve                   # the reverse: expose OpenClaw conversations to another MCP client
JSON5
{
  mcp: {
    servers: {
      docs: {
        url: "https://mcp.example.com/mcp",
        transport: "streamable-http",
        toolFilter: { include: ["search", "read_*"] },
      },
    },
  },
}

Keep credentials out of config literals. Store sensitive headers and env values through the supported secret mechanisms.


Gateway operations and network exposure

There is one Gateway per host and one multiplexed port for the WebSocket control API, the HTTP APIs and the Control UI. The node/device bridge uses 18790. Channel plugins that need an inbound webhook open their own port (Microsoft Teams uses 3978).

Bash
openclaw gateway start | stop | restart | status
openclaw logs
openclaw health
openclaw gateway probe --url ws://127.0.0.1:18789 --token "$OPENCLAW_GATEWAY_TOKEN"
  • Port: --port → OPENCLAW_GATEWAY_PORT → gateway.port → 18789.
  • Bind: CLI → gateway.bind → loopback. Inside a detected container the default becomes auto (0.0.0.0). Tailscale serve/funnel forces loopback.
  • Auth is required by default. The Gateway refuses a non-loopback bind without gateway.auth.token or .password (OPENCLAW_GATEWAY_TOKEN / OPENCLAW_GATEWAY_PASSWORD). Behind an identity-aware proxy, use gateway.auth.mode: "trusted-proxy" with strict gateway.trustedProxies.
  • Remote access, narrowest first: loopback + SSH tunnel → loopback + Tailscale Serve → tailnet/LAN bind with auth and firewall → trusted reverse proxy. Never port-forward 18789 to the public internet. An SSH tunnel does not bypass Gateway auth.
Bash
ssh -N -L 18789:127.0.0.1:18789 user@gateway-host

The shipped docker-compose.yml runs gateway --bind ${OPENCLAW_GATEWAY_BIND:-lan} and publishes 18789, 18790 and 3978 with no-new-privileges. A containerised deploy is therefore non-loopback by construction, and OPENCLAW_GATEWAY_TOKEN is mandatory.


Security

OpenClaw is an agent with real system access: shell, files, browser, cron, your messaging identities and your provider keys. Treat it like a privileged service.

Trust model. Each Gateway is one trust boundary: a single operator, or a team whose members trust each other. Multi-user mode (session ownership, presence, roles) and team deployments are supported inside that boundary. The docs are explicit that it is not a hostile multi-tenant boundary: "Everyone who can operate an agent can make it do anything that agent can do." Mutually untrusted users need separate Gateways and credentials, ideally on separate OS users or hosts.

Advisory volume. As of 2026-10-20 the repo has 722 published GitHub security advisories (14 critical, 249 high, 390 medium, 69 low), and 39 of them carry CVE IDs. The criticals (Feb–Apr 2026) include Gateway pairing and scope escalation to operator.admin with node RCE, sandbox escapes, plugin-install path traversal, and .env injection. A batch of 75 advisories published on 2026-09-11 is fixed in openclaw 2026.8.1 and @openclaw/whatsapp 2026.8.1. Examples from that batch: unauthenticated sockets held by "upgrade-like" requests, a WhatsApp login tool reachable from non-owner turns, exec-approval bypasses, and MCP config changes that skipped owner authorization. Practical rules:

  1. Stay on latest or extended-stable and update within days. openclaw update updates core, then synchronizes enabled plugins to the matching release cohort.
  2. Run openclaw security audit --deep after every config or exposure change. --fix tightens file permissions and open group policies; it never rotates keys or changes bind/auth.
  3. Subscribe to github.com/openclaw/openclaw/security/advisories.
  4. Follow the exposure runbook (loopback, pairing/allowlist, session.dmScope, sandbox non-main, exec denied, elevated off) before any channel goes live.
  5. Use a strong, latest-generation model. The docs note that modern models resist prompt injection substantially better, and the audit warns on small models (≤300B) running unsandboxed with web tools.

Telemetry. There is no telemetry by default beyond an update check to telemetry.openclaw.ai. openclaw telemetry show reports the state. It can be disabled, or pointed at your own endpoint with OPENCLAW_TELEMETRY_ENDPOINT.

Bash
openclaw security audit
openclaw security audit --deep --json | jq '.findings[] | select(.severity=="critical") | .checkId'
openclaw security audit --fix

examples/audit-gate.mts wraps this as a CI or cron gate.


Pricing

OpenClaw itself is free. The docs state "No paid tier": MIT license, Foundation-run, no hosted service in the middle. Your costs are:

  • Model tokens. At Anthropic list prices (table above), Opus 5.5 is $4 / $20 per MTok. Route utility work to Haiku 5.5. The Claude CLI route bills against a Claude subscription's usage limits instead of the API.
  • The host. A small VPS or an always-on Mac or PC. Docker image builds want 6 GB RAM; pre-built images avoid that.
  • Optional cloud workers / sandbox backends (Crabbox, AWS snapshots and similar) bill on your own cloud account.
  • ClawHub is a free registry; the docs list no paid listing or tier.

Environment Variables

Real secrets only (store them in Hazina; never commit them):

Bash
# Model provider (codeAmani primary; see AI routing policy)
ANTHROPIC_API_KEY=sk-ant-...

# Gateway auth: required for any non-loopback bind (use one of the two)
OPENCLAW_GATEWAY_TOKEN=replace-with-long-random-token
OPENCLAW_GATEWAY_PASSWORD=replace-with-long-random-password

Non-secret settings:

VariableDefaultPurpose
OPENCLAW_GATEWAY_PORT18789Gateway port (after --port, before gateway.port)
OPENCLAW_CONFIG_PATH~/.openclaw/openclaw.jsonConfig file location (keep it a real file)
OPENCLAW_STATE_DIR~/.openclawState directory (used by the container image)
OPENCLAW_GATEWAY_BINDlan (compose only)Bind passed by docker-compose.yml
OPENCLAW_IMAGEopenclaw:localImage used by the compose file, e.g. ghcr.io/openclaw/openclaw:extended-stable
OPENCLAW_SERVICE_REPAIR_POLICYunsetexternal hands service lifecycle to your own supervisor
OPENCLAW_TELEMETRY_ENDPOINTtelemetry.openclaw.aiSelf-host the update-check endpoint

Repository layout (grounding)

If you clone openclaw/openclaw to read the source:

In the treeIsNote
extensions/Channels, model providers, toolsWhat the docs and CLI call "plugins". WhatsApp is extensions/whatsapp (@openclaw/whatsapp, published separately to npm at the same version as core)
apps/Companion clientsandroid, ios, macos, linux, shared: the "nodes". The Windows Hub lives in a separate repo, openclaw/openclaw-windows-node
docs/Published docsSame paths as docs.openclaw.ai; every page is also served as .md
docker-compose.yml, Dockerfile, fly.toml, render.yamlDeploy fragmentsCompose binds lan and expects OPENCLAW_GATEWAY_TOKEN
AGENTS.mdContributor policyCLAUDE.md is a symlink to it

package.json (v2026.10.5): author: "OpenClaw Foundation (https://openclaw.org)", packageManager: pnpm@12.12.1.


codeAmani notes

  • Secrets stay on the host. Provider keys sit in ~/.openclaw/openclaw.json under env.vars, and channel credentials sit in ~/.openclaw/credentials/. Treat that whole directory as a secret store: never sync it, never bake it into an image, and pull values from Hazina at provisioning time. Run gitleaks before any repo that references an OpenClaw config goes near a push.
  • Patch cadence is a requirement. With 700+ advisories this year, an OpenClaw host is something we update weekly, not "set and forget". Pin extended-stable on ops boxes, enable openclaw update on a schedule, and run examples/audit-gate.mts nightly. Any host found on < 2026.8.1 is an incident.
  • Bind loopback, tunnel for the rest. loopback is the correct production posture. For remote reach, use Tailscale Serve or an SSH tunnel and set gateway.auth. The container default flips to 0.0.0.0, so a naive docker run is the one config that quietly exposes the port.
  • Deny runtime on anything customer-facing. Start from the hardened baseline: tools.profile: "messaging", deny group:runtime, group:fs and group:automation, exec.security: "deny", elevated.enabled: false, sandbox non-main, dmPolicy: "allowlist". Even then, treat every inbound message as untrusted input, the same prompt-injection boundary as any webhook payload.
  • AI routing. Set model.primary to anthropic/claude-opus-5-5 per house policy, use anthropic/claude-sonnet-5-5 as fallback, and anthropic/claude-haiku-5-5 as utilityModel. Configs written in August that pin anthropic/claude-opus-5 / claude-fable-5 are not auto-upgraded; change them deliberately. The Together and DeepSeek providers exist if a project has already chosen them.
  • Kenya-targeted projects: the honest fit. OpenClaw's messaging-first model maps cleanly onto the WhatsApp + M-Pesa builds (duka-order-bot, boda-dispatch, clinic-salon-booking). It gives a self-hosted agent brain behind a WhatsApp number, with M-Pesa reconciliation written as a SKILL.md instead of app code. But the WhatsApp channel is QR pairing over WhatsApp Web (Baileys), not the Meta WhatsApp Business Cloud API. Use it for the internal ops number, the merchant-side assistant, and fast prototyping of conversation flows. Do not use it for customer-facing volume, where a Cloud API number, template messages and the 24-hour service window are the compliance surface. Prototype in OpenClaw; ship the customer path on the official API. Payments stay Stripe by default, with M-Pesa only for Kenya-targeted projects.
  • Low bandwidth. The default textChunkLimit is 4,000 characters and mediaMaxMb is 50. Both are generous for a 2G/3G handset. Lower them, prompt for short replies, and keep image_generate / tts off the customer path unless the user asks. Every reply is billable data on the recipient's bundle.
  • Swahili needs no OpenClaw configuration; it is a model-level concern. Put the language instruction in the agent's identity or system prompt and pick the model on Swahili quality (see the R&D report in research-and-development/).
  • One trust boundary per Gateway. Multi-user and team mode exist now, but they are collaboration guardrails, not tenant isolation. Never let one Gateway serve several customers' numbers or data. Run one Gateway per merchant or tenant, or use OpenClaw as an ops tool beside a purpose-built Next.js app.
  • SLSA: we do not ship OpenClaw as an artifact, so no provenance target applies. When pulling images, use ghcr.io/openclaw/openclaw (the docs name GHCR as the registry for provenance checks) and pin a version tag.

Troubleshooting

IssueFix
npm install -g openclaw skips setup / CLI missingnpm 12+ blocks lifecycle scripts: reinstall with --allow-scripts=openclaw (pnpm --allow-build=openclaw, bun --trust)
npm approve-scripts openclaw fails with ENOMATCHExpected for global installs; use the flag above
Engine error on Node 22 or 25Unsupported since v2026.9.3; install Node 24.16+ or 26.1+
Refuses to start: "refusing to bind gateway … without auth"A non-loopback bind needs gateway.auth.token / .password or OPENCLAW_GATEWAY_TOKEN
Gateway exits with code 78 and systemd will not restart itInvalid config: run openclaw config validate, fix, then start
Control UI blocked in a remote browserAdd the origin to gateway.controlUi.allowedOrigins
Tunnel works but requests are rejectedSSH tunnels do not bypass Gateway auth; the client still sends the token
WhatsApp QR expires on a headless boxDeliver the live QR to the phone quickly. Behind a proxy, a 408 before the QR means a proxy/TLS issue (see WhatsApp troubleshooting)
Bot ignores an incoming DMdmPolicy: "pairing" is waiting: openclaw pairing approve whatsapp <CODE> (expires after 1h, max 3 pending)
Messages arrive but no agent repliesWith agents.ownership: "explicit" there is no default agent; add a binding (openclaw agents bind)
"Tool X blocked by sandbox tool policy"openclaw sandbox explain; add it to tools.sandbox.tools.allow or change sandbox mode
MCP tools missing in sandboxed turnsAdd bundle-mcp, group:plugins or server__* to tools.sandbox.tools.alsoAllow; openclaw mcp doctor <name> --probe
Skill installed but never usedCheck the frontmatter name (it overrides the directory), the precedence table, and disable-model-invocation
Plugin install fails non-interactivelyAdd --accept-capabilities (and --force for arbitrary npm/git/local sources after review)
Still on an old Opus after "upgrading"Pinned refs are not rewritten; set anthropic/claude-opus-5-5 explicitly