~/.openclaw/openclaw.json is the single source of truth for an OpenClaw install. Onboarding writes a minimal version, but every non-trivial deployment ends up hand-editing it — adding a channel, pinning a model, tightening secrets, configuring memory backends, tuning timeouts. This page is the orientation map for that editing: the top-level blocks, the keys you are most likely to touch, the defaults, the env vars that override them, and the notable compatibility shifts.
Orientation
The config file lives at ~/.openclaw/openclaw.json and parses as JSON5 — comments and trailing commas are allowed (OpenClaw docs — configuration reference). Unknown keys are rejected at startup, which means a typo will fail loudly and visibly rather than silently. You override the path with the OPENCLAW_CONFIG_PATH env var if you need to host multiple installs side by side.
The file is split into top-level blocks. You do not need to populate every block — only the ones that drive behavior you care about — but the names matter, because the runtime walks them in a fixed order during startup.
Top-level blocks
| Block | Purpose |
|---|---|
agents | Agent definitions, default model and skills, workspace path, multi-agent routing |
channels | Per-provider channel config: Telegram, Slack, Discord, Signal, WhatsApp, iMessage, Matrix, more |
gateway | The Gateway daemon — port, bind, auth, health-check intervals, reload mode |
session | Session scope, thread bindings, reset behavior |
messages | Message visibility and group-chat rules |
cron | Scheduled jobs with retry, failure alerts, webhook delivery |
hooks | Inbound webhooks with template rendering and agent routing |
tools | Tool policies and toggles |
models | Model catalog and provider setup (Anthropic, OpenAI, Ollama, MiniMax, …) |
sandbox | Sandbox runtime configuration |
env | Environment variables and secrets references |
browser | Browser automation profile, CDP, SSRF policy, tab cleanup |
audio | Audio I/O configuration |
talk | Voice-call configuration |
ui | Control UI configuration |
logging | Log paths, redaction, log level |
identity | Persistent agent identity |
bindings | Session-to-channel bindings |
broadcast | Broadcast group definitions |
discovery | Bonjour and discovery configuration |
plugins | Plugin allowlist/denylist and config |
mcp | Model Context Protocol server definitions |
Source: OpenClaw docs — configuration reference.
gateway keys
| Key | Default | Purpose |
|---|---|---|
gateway.port | 18789 | The Gateway HTTP/WebSocket listener |
gateway.bind | 127.0.0.1 | Loopback by default; do not change unless you understand the auth implications |
gateway.auth | token (auto-generated) | Auth strategy: token, password, none |
gateway.handshakeTimeoutMs | 15000 | How long a client handshake may take before timeout |
gateway.channelHealthCheckMinutes | 5 | How often the Gateway pings channel workers |
gateway.channelStaleEventThresholdMinutes | 30 | When a channel is considered stale and restarted |
gateway.channelMaxRestartsPerHour | — | Cap on channel-worker restarts before a back-off |
gateway.reload.mode | "hybrid" | Reload behavior: "hybrid", "hot", "restart", "off" |
gateway.push.apns.relay.baseUrl | — | APNS push relay URL for iOS push notifications |
The defaults are the right answer for a personal install. The two keys you most likely override are gateway.handshakeTimeoutMs (raise on slow networks) and gateway.reload.mode (set to "restart" if hot reloads are causing inconsistent state).
agents keys
| Key | Default | Purpose |
|---|---|---|
agents.defaults.workspace | ~/.openclaw/workspace | Where the agent reads and writes files |
agents.defaults.model.primary | — | Required. The primary model string <provider>/<model-id> |
agents.defaults.model.fallback | — | Ordered list of fallback models on transient errors |
agents.defaults.skills | — | Extra skill directories beyond the bundled set |
agents.defaults.heartbeat.every | — | Heartbeat schedule for proactive behavior |
agents.defaults.sandbox.mode | — | Default sandboxing mode for tool execution |
agents.defaults.imageMaxDimensionPx | 1200 | Cap on image dimension before processing |
agents.list[].id | — | Identifier for an additional named agent |
agents.list[].workspace | — | Workspace path for that named agent |
The skill-loading precedence chain is fixed in the runtime and not in this block; what agents.defaults.skills adds is the bottom of the chain, the “extra folders” tier (OpenClaw docs — agent runtime).
channels.<provider> keys
Every channel block shares a common shape:
| Key | Default | Purpose |
|---|---|---|
channels.<provider>.enabled | false | Whether to start the channel worker on Gateway boot |
channels.<provider>.botToken | — | The per-provider bot token or equivalent credential |
channels.<provider>.dmPolicy | "pairing" | DM admission policy: "pairing", "allowlist", "open", "disabled" |
channels.<provider>.allowFrom | — | List of user IDs allowed when policy is "allowlist" |
channels.<provider>.groupPolicy | — | Group-chat admission policy |
channels.<provider>.groupAllowFrom | — | List of group IDs for group "allowlist" |
channels.<provider>.healthMonitor.enabled | — | Whether the health monitor watches this channel |
Provider-specific extensions live under the same block — for example, channels.telegram.groups is a map of group IDs to per-group routing rules (OpenClaw docs — Telegram channel).
dmPolicy defaults to "pairing" for every channel that supports DMs, which means unknown senders must complete a pairing handshake before they can interact. Never weaken this to "open" on a channel exposed to a public surface.
session keys
| Key | Default | Purpose |
|---|---|---|
session.dmScope | "per-channel-peer" | How sessions partition across channels and peers |
session.threadBindings.enabled | — | Whether thread replies bind to their parent session |
session.reset.mode | — | What /reset does and when sessions auto-reset |
session.dmScope is one of the most impactful keys in the file. The default "per-channel-peer" gives each peer their own session per channel; "main" collapses everything into one session; "per-account-channel-peer" is for multi-account installations.
models.providers.<name> keys
The shape varies per provider, but a typical entry:
{
models: {
providers: {
anthropic: { apiKey: "${ANTHROPIC_API_KEY}" },
openai: { apiKey: "${OPENAI_API_KEY}" },
ollama: {
baseUrl: "http://127.0.0.1:11434",
apiKey: "ollama-local",
timeoutSeconds: 120,
models: [
{ id: "llama3.1:70b", params: { keep_alive: "15m" } },
],
},
minimax: { apiKey: "${MINIMAX_API_KEY}", baseUrl: "https://api.minimax.io" },
},
},
}
Key things to remember:
- The Ollama base URL never includes
/v1— the/v1path is OpenAI-compatible and breaks tool calling (OpenClaw docs — Ollama provider). - Secrets should be
${ENV_VAR}references, not literals; the substitution syntax is uppercase only, matching[A-Z_][A-Z0-9_]*(OpenClaw docs — secrets). - Provider-level
timeoutSecondsmatters for local backends with high cold-load latency.
env, secret resolution, and overrides
OpenClaw reads environment variables from three sources in order, with the first match winning (OpenClaw docs — secrets):
- The parent process environment
.envin the current working directory~/.openclaw/.envas the fallback
Inline references in the JSON use "${VAR_NAME}". The placeholder must be the entire string value — you cannot mix references with literals in the same string.
Environment variables that override config
| Env var | Effect |
|---|---|
OPENCLAW_CONFIG_PATH | Override the config file path |
OPENCLAW_HANDSHAKE_TIMEOUT_MS | Override gateway.handshakeTimeoutMs |
OPENCLAW_APNS_RELAY_BASE_URL | Override gateway.push.apns.relay.baseUrl |
OPENCLAW_APNS_RELAY_TIMEOUT_MS | Override the APNS relay timeout |
OPENCLAW_LOAD_SHELL_ENV | Control shell-env injection on daemon start |
OPENCLAW_INCLUDE_ROOTS | Override the $include search roots |
The $include directive lets you split the config into modular files: { agents: { $include: "./agents.json5" } } reads agents.json5 relative to the include root.
Compatibility matrix
The config has moved in places between versions. The most consequential historical shifts to verify against the live docs:
| Concern | Where it lives now | Where it used to live (verify in docs) |
|---|---|---|
| Per-channel config | channels.<provider> block | Previously some channels were configured under provider-specific top-level keys |
| Memory backend selection | concepts/memory plus dedicated provider blocks (Honcho, QMD, LanceDB) | Earlier versions had a single memory.backend key |
| MCP servers | mcp top-level block | Earlier versions inlined MCP into tools |
This matrix is intentionally short — only fixed-canon shifts I am willing to write down. If you are migrating from an older install, treat every block as suspect and re-validate against the live reference at docs.openclaw.ai/gateway/configuration-reference before running.
Last verified
These keys and defaults are verified against the current OpenClaw documentation. The runtime is moving quickly, especially around the models, memory, and plugins blocks. Re-validate before standing up a production install, and always run openclaw config validate after editing the file by hand.
Related
- How OpenClaw is wired: the agent loop, memory, and skills
- Configuring local model backends in OpenClaw
Sources
- OpenClaw docs — configuration reference
- OpenClaw docs — configuration
- OpenClaw docs — secrets
- OpenClaw docs — Telegram channel
- OpenClaw docs — Ollama provider
- OpenClaw docs — agent runtime
- OpenClaw docs — providers
- GitHub: openclaw/openclaw
- Node.js docs
Last verified on OpenClaw current. Config keys do shift; treat anything written here older than a release cycle as suspect, and verify against the live reference.