OpenClaw Integration Guide
Technology: openclaw · Category: ai · Last reviewed: 2026-10-20
Source: https://tech-stack.codeamanilabs.org/guide/openclaw
Insight:
OpenClaw is a self-hosted agent gateway, not an SDK. It is one long-lived daemon on your own box that fronts 30+ messaging channels, dozens of model providers, MCP servers and a file-based skill system, all driven by the
openclawCLI. It is free (MIT, Foundation-run, no paid tier); you pay for model tokens and the host. The trade is ownership for ops: you run the daemon, hold the keys, and inherit the blast radius of an agent that canexec. The project has published 700+ GitHub security advisories in 2026, so you must tracklatestorextended-stableand runopenclaw security audit. For codeAmani it is the fastest way to put a Claude-backed brain behind a WhatsApp number for internal ops and prototyping the Kenya builds. Customer-facing WhatsApp traffic still ships on the Meta Cloud API.
██████╗ ██████╗ ███████╗███╗ ██╗ ██████╗██╗ █████╗ ██╗ ██╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝██║ ██╔══██╗██║ ██║
██║ ██║██████╔╝█████╗ ██╔██╗ ██║██║ ██║ ███████║██║ █╗ ██║
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║██║ ██║ ██╔══██║██║███╗██║
╚██████╔╝██║ ███████╗██║ ╚████║╚██████╗███████╗██║ ██║╚███╔███╔╝
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝
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.
| OpenClaw | Agent SDK / framework | Managed bot platform | |
|---|---|---|---|
| Shape | Daemon + CLI you self-host | Library you compile into an app | Hosted SaaS |
| UI | Existing messaging apps + Control UI | You build it | Vendor's console |
| Model | Bring your own key or Claude Code login | Whatever you wire | Vendor's models |
| Secrets | Your disk (~/.openclaw/) |
Your env | Vendor holds them |
| Ops burden | Yours (process, updates, advisories) | Yours (deploy) | None |
| Multi-user | Trusted team inside one trust boundary | Yes, if you build it | Yes |
| Price | Free (no paid tier); you pay model + host | Free SDK + model | Subscription |
flowchart LR
subgraph CH["Channels"]
W["WhatsApp"]
T["Telegram"]
S["Slack / Discord / Signal / Teams"]
end
subgraph HOST["Your host: one Gateway daemon"]
G["Gateway<br/>127.0.0.1:18789<br/>WebSocket + HTTP + Control UI"]
A["Agents<br/>agents.entries.*<br/>workspace + skills"]
TP["Tool policy<br/>profile / allow / deny<br/>sandbox / elevated"]
end
subgraph CP["Control plane"]
C["openclaw CLI"]
U["Control UI"]
N["Nodes<br/>macOS / iOS / Android / Windows"]
end
P["Model providers<br/>anthropic/ · openai/ · ollama/"]
M["MCP servers<br/>stdio · HTTP · SSE"]
SB["Sandbox backend<br/>Docker · Podman · SSH · OpenShell"]
W --> G
T --> G
S --> G
C --> G
U --> G
N --> G
G --> A
A --> TP
TP --> M
TP --> SB
A --> P
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 channel | Version | Use |
|---|---|---|
latest (stable) |
2026.10.5 | Default. Moves several times a week |
extended-stable |
2026.9.33 | Trailing-month line. Pin this for long-lived Gateways |
beta |
2026.10.10-beta.2 | Testing only |
dev |
git main checkout |
Contributors |
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.1is 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 the2026.7.xline, 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:
# macOS / Linux / WSL2
curl -fsSL https://openclaw.ai/install.sh | bash
# add -s -- --no-onboard to skip onboarding
# 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:
# 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:
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:
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:
| Use | OpenClaw ref | Anthropic API price (in / out per MTok) |
|---|---|---|
| Primary (house default) | anthropic/claude-opus-5-5 |
$4 / $20 |
| Fallback / volume | anthropic/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-horizon | anthropic/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,haikuandfableresolve 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 pinsanthropic/claude-opus-5stays 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
mediumeffort (/think low…max), drops sampling params and prefills, and turns forced tool choice intoauto. 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 withagentRuntime: { 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 dedicatedANTHROPIC_API_KEY.
{
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
},
},
}
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.
{
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.
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.
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.
Set the access policy before you log in. The defaults are DM pairing and group allowlist:
{
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,
},
},
}
dmPolicy |
Effect |
|---|---|
pairing (default) |
Unknown senders get a pairing code. Requests expire after 1 hour, max 3 pending per account |
allowlist |
Only numbers in allowFrom get through |
open |
Everyone. Requires an explicit allowFrom: ["*"] |
disabled |
No DMs at all |
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).
---
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:
| Priority | Source |
|---|---|
| 1 | Workspace skills: <workspace>/skills |
| 2 | Project agent skills: <workspace>/.agents/skills |
| 3 | Personal agent skills: ~/.agents/skills (default state only) |
| 4 | Managed/local skills: <state-dir>/skills |
| 5 | Bundled skills |
| 6 | Extra directories and plugin skills |
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:
- Tool policy decides which tools exist. Keys:
tools.profile,tools.allow/tools.deny,tools.byProvider,agents.entries.*.tools.*, andtools.sandbox.tools.*. - Sandbox decides where tools run.
agents.defaults.sandbox.modeisoff(default),non-mainorall. Backends are Docker (default), Podman, SSH, OpenShell or Crabbox. The Gateway process itself always stays on the host. - Elevated (
tools.elevated.*) is an exec-only escape hatch from the sandbox. Keep itenabled: falseunless 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:
| Group | Expands to |
|---|---|
group:runtime |
exec, process, code_execution (bash aliases exec) |
group:fs |
read, write, edit, apply_patch |
group:automation |
heartbeat_respond, cron, gateway |
group:ui |
browser, screen, terminal, canvas, … |
group:nodes |
nodes, computer |
group:web |
web_search, x_search, web_fetch |
group:plugins |
all plugin tools, including MCP servers |
The docs' hardened baseline:
{
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:
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__*).
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
{
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).
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 becomesauto(0.0.0.0). Tailscale serve/funnel forcesloopback. - Auth is required by default. The Gateway refuses a non-loopback bind without
gateway.auth.tokenor.password(OPENCLAW_GATEWAY_TOKEN/OPENCLAW_GATEWAY_PASSWORD). Behind an identity-aware proxy, usegateway.auth.mode: "trusted-proxy"with strictgateway.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.
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:
- Stay on
latestorextended-stableand update within days.openclaw updateupdates core, then synchronizes enabled plugins to the matching release cohort. - Run
openclaw security audit --deepafter every config or exposure change.--fixtightens file permissions and open group policies; it never rotates keys or changes bind/auth. - Subscribe to
github.com/openclaw/openclaw/security/advisories. - Follow the exposure runbook (loopback, pairing/allowlist,
session.dmScope, sandboxnon-main, exec denied, elevated off) before any channel goes live. - 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.
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):
# 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:
| Variable | Default | Purpose |
|---|---|---|
OPENCLAW_GATEWAY_PORT |
18789 |
Gateway port (after --port, before gateway.port) |
OPENCLAW_CONFIG_PATH |
~/.openclaw/openclaw.json |
Config file location (keep it a real file) |
OPENCLAW_STATE_DIR |
~/.openclaw |
State directory (used by the container image) |
OPENCLAW_GATEWAY_BIND |
lan (compose only) |
Bind passed by docker-compose.yml |
OPENCLAW_IMAGE |
openclaw:local |
Image used by the compose file, e.g. ghcr.io/openclaw/openclaw:extended-stable |
OPENCLAW_SERVICE_REPAIR_POLICY |
unset | external hands service lifecycle to your own supervisor |
OPENCLAW_TELEMETRY_ENDPOINT |
telemetry.openclaw.ai |
Self-host the update-check endpoint |
Repository layout (grounding)
If you clone openclaw/openclaw to read the source:
| In the tree | Is | Note |
|---|---|---|
extensions/ |
Channels, model providers, tools | What the docs and CLI call "plugins". WhatsApp is extensions/whatsapp (@openclaw/whatsapp, published separately to npm at the same version as core) |
apps/ |
Companion clients | android, ios, macos, linux, shared: the "nodes". The Windows Hub lives in a separate repo, openclaw/openclaw-windows-node |
docs/ |
Published docs | Same paths as docs.openclaw.ai; every page is also served as .md |
docker-compose.yml, Dockerfile, fly.toml, render.yaml |
Deploy fragments | Compose binds lan and expects OPENCLAW_GATEWAY_TOKEN |
AGENTS.md |
Contributor policy | CLAUDE.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.jsonunderenv.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. Rungitleaksbefore 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-stableon ops boxes, enableopenclaw updateon a schedule, and runexamples/audit-gate.mtsnightly. Any host found on< 2026.8.1is an incident. - Bind loopback, tunnel for the rest.
loopbackis the correct production posture. For remote reach, use Tailscale Serve or an SSH tunnel and setgateway.auth. The container default flips to0.0.0.0, so a naivedocker runis the one config that quietly exposes the port. - Deny runtime on anything customer-facing. Start from the hardened baseline:
tools.profile: "messaging", denygroup:runtime,group:fsandgroup:automation,exec.security: "deny",elevated.enabled: false, sandboxnon-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.primarytoanthropic/claude-opus-5-5per house policy, useanthropic/claude-sonnet-5-5as fallback, andanthropic/claude-haiku-5-5asutilityModel. Configs written in August that pinanthropic/claude-opus-5/claude-fable-5are 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 aSKILL.mdinstead 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
textChunkLimitis 4,000 characters andmediaMaxMbis 50. Both are generous for a 2G/3G handset. Lower them, prompt for short replies, and keepimage_generate/ttsoff 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
| Issue | Fix |
|---|---|
npm install -g openclaw skips setup / CLI missing |
npm 12+ blocks lifecycle scripts: reinstall with --allow-scripts=openclaw (pnpm --allow-build=openclaw, bun --trust) |
npm approve-scripts openclaw fails with ENOMATCH |
Expected for global installs; use the flag above |
| Engine error on Node 22 or 25 | Unsupported 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 it | Invalid config: run openclaw config validate, fix, then start |
| Control UI blocked in a remote browser | Add the origin to gateway.controlUi.allowedOrigins |
| Tunnel works but requests are rejected | SSH tunnels do not bypass Gateway auth; the client still sends the token |
| WhatsApp QR expires on a headless box | Deliver 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 DM | dmPolicy: "pairing" is waiting: openclaw pairing approve whatsapp <CODE> (expires after 1h, max 3 pending) |
| Messages arrive but no agent replies | With 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 turns | Add bundle-mcp, group:plugins or server__* to tools.sandbox.tools.alsoAllow; openclaw mcp doctor <name> --probe |
| Skill installed but never used | Check the frontmatter name (it overrides the directory), the precedence table, and disable-model-invocation |
| Plugin install fails non-interactively | Add --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 |
Official docs:
- https://docs.openclaw.ai/start/getting-started
- https://docs.openclaw.ai/install
- https://docs.openclaw.ai/concepts/architecture
- https://docs.openclaw.ai/channels/whatsapp
- https://docs.openclaw.ai/gateway
- https://docs.openclaw.ai/gateway/security
- https://docs.openclaw.ai/providers/anthropic
- https://github.com/openclaw/openclaw