Skip to content

OpenClaw Gateway Part 1: Configuration System and Hot Reload

Mar 28, 2026 1 min
TL;DR openclaw.json uses JSON5 format with strict schema validation, supporting hybrid hot reload — safe changes apply instantly while critical changes trigger automatic restarts.

🌏 中文版

All OpenClaw behavior is controlled by a single configuration file. This post covers the design and usage of the configuration system.

Configuration File

~/.openclaw/openclaw.json, in JSON5 format. Falls back to safe defaults when the file does not exist.

Four Configuration Methods

MethodDescription
openclaw onboardInteractive wizard, ideal for beginners
openclaw config setSingle-line CLI configuration
Control UIBrowser at http://127.0.0.1:18789
Edit file directlyChanges are auto-detected

Strict Validation

OpenClaw only accepts configurations that fully conform to the schema. Unknown keys, type errors, or invalid values cause the Gateway to refuse to start.

openclaw doctor      # Diagnose issues
openclaw doctor --fix  # Attempt auto-fix

Minimal Configuration Example

{
  agents: {
    defaults: {
      workspace: "~/openclaw-workspace"
    }
  },
  channels: {
    whatsapp: {
      dmPolicy: "allowlist",
      allowFrom: ["+15551234567"]
    }
  }
}

Main Configuration Sections

SectionCovers
ChannelsChannel connections, access control
ModelsModel selection, failover
AgentsWorkspace, sandbox, tools
SessionDM scope, lifecycle
AutomationCron, heartbeat, webhook
GatewayBinding, authentication, networking
SecretsSecretRef provider
SkillsLoading, overrides

Hot Reload

Configuration changes are applied automatically without manual restarts.

Hybrid Mode (Default)

TypeBehavior
Safe changesInstant hot apply (channel settings, models, tools, etc.)
Critical changesAutomatic restart (Gateway server settings)

Most settings update without downtime. Only gateway server-related settings require a restart.

Environment Variables

You can set environment variables in ~/.openclaw/.env, which are read when the daemon starts.

# ~/.openclaw/.env
ANTHROPIC_API_KEY=sk-...
OPENCLAW_GATEWAY_TOKEN=my-token

$OPENCLAW_STATE_DIR can override the state directory location.

Gateway Core Settings

Binding

{
  gateway: {
    bind: "loopback",    // loopback | lan | tailnet | auto | custom
    port: 18789,         // default
  }
}
BindDescription
loopbackOnly accessible from localhost (default, most secure)
lanAccessible from local network
tailnetTailscale IP
autoPrefers loopback

Authentication

Non-loopback bindings require authentication:

{
  gateway: {
    auth: {
      mode: "token",      // token | password | trusted-proxy
      token: "your-token"
    }
  }
}

Or use environment variables:

  • OPENCLAW_GATEWAY_TOKEN
  • OPENCLAW_GATEWAY_PASSWORD

Control UI

{
  gateway: {
    controlUi: {
      enabled: true,
      basePath: "/"
    }
  }
}

Configuration Tools

openclaw config get agents.defaults.workspace     # Read
openclaw config set channels.telegram.enabled true  # Set
openclaw config list                                # List all
openclaw config validate                            # Validate

Summary

OpenClaw’s configuration system has three key characteristics: JSON5 format makes configs readable and commentable, strict schema validation prevents misconfigurations, and Hybrid Hot Reload allows most changes to take effect without restarts.

References

This post is compiled from the following OpenClaw source documents: