Skip to content

OpenClaw config file reference

A reference for `~/.openclaw/openclaw.json` — the top-level blocks, the keys you will actually touch, the default values, the environment variables that override them, and a compatibility matrix for the config keys that have moved between versions.

~/.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

BlockPurpose
agentsAgent definitions, default model and skills, workspace path, multi-agent routing
channelsPer-provider channel config: Telegram, Slack, Discord, Signal, WhatsApp, iMessage, Matrix, more
gatewayThe Gateway daemon — port, bind, auth, health-check intervals, reload mode
sessionSession scope, thread bindings, reset behavior
messagesMessage visibility and group-chat rules
cronScheduled jobs with retry, failure alerts, webhook delivery
hooksInbound webhooks with template rendering and agent routing
toolsTool policies and toggles
modelsModel catalog and provider setup (Anthropic, OpenAI, Ollama, MiniMax, …)
sandboxSandbox runtime configuration
envEnvironment variables and secrets references
browserBrowser automation profile, CDP, SSRF policy, tab cleanup
audioAudio I/O configuration
talkVoice-call configuration
uiControl UI configuration
loggingLog paths, redaction, log level
identityPersistent agent identity
bindingsSession-to-channel bindings
broadcastBroadcast group definitions
discoveryBonjour and discovery configuration
pluginsPlugin allowlist/denylist and config
mcpModel Context Protocol server definitions

Source: OpenClaw docs — configuration reference.

gateway keys

KeyDefaultPurpose
gateway.port18789The Gateway HTTP/WebSocket listener
gateway.bind127.0.0.1Loopback by default; do not change unless you understand the auth implications
gateway.authtoken (auto-generated)Auth strategy: token, password, none
gateway.handshakeTimeoutMs15000How long a client handshake may take before timeout
gateway.channelHealthCheckMinutes5How often the Gateway pings channel workers
gateway.channelStaleEventThresholdMinutes30When 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

KeyDefaultPurpose
agents.defaults.workspace~/.openclaw/workspaceWhere 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.imageMaxDimensionPx1200Cap 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:

KeyDefaultPurpose
channels.<provider>.enabledfalseWhether 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

KeyDefaultPurpose
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 /v1 path 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 timeoutSeconds matters 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):

  1. The parent process environment
  2. .env in the current working directory
  3. ~/.openclaw/.env as 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 varEffect
OPENCLAW_CONFIG_PATHOverride the config file path
OPENCLAW_HANDSHAKE_TIMEOUT_MSOverride gateway.handshakeTimeoutMs
OPENCLAW_APNS_RELAY_BASE_URLOverride gateway.push.apns.relay.baseUrl
OPENCLAW_APNS_RELAY_TIMEOUT_MSOverride the APNS relay timeout
OPENCLAW_LOAD_SHELL_ENVControl shell-env injection on daemon start
OPENCLAW_INCLUDE_ROOTSOverride 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:

ConcernWhere it lives nowWhere it used to live (verify in docs)
Per-channel configchannels.<provider> blockPreviously some channels were configured under provider-specific top-level keys
Memory backend selectionconcepts/memory plus dedicated provider blocks (Honcho, QMD, LanceDB)Earlier versions had a single memory.backend key
MCP serversmcp top-level blockEarlier 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.

Sources


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.

Talk to a senior operator about your OpenClaw deployment.