Skip to main content

Configuration Reference

OpenClaw reads an optional JSON5 config from ~/.openclaw/openclaw.json. JSON5 supports comments and trailing commas. Override the path with the OPENCLAW_CONFIG_PATH environment variable.

tip

After editing the config, restart the gateway to apply changes: openclaw gateway restart


Full Example

~/.openclaw/openclaw.json
{
// LLM Configuration
"brain": {
"provider": "anthropic",
"model": "claude-opus-4-6",
"api_key": "${ANTHROPIC_API_KEY}",
"temperature": 0.7,
"max_tokens": 4096,
"fallback": {
"provider": "openrouter",
"model": "deepseek/deepseek-v3.2"
},
"heartbeat_override": {
"provider": "anthropic",
"model": "claude-haiku-4-5-20251001"
}
},

// Model Providers
"models": {
"mode": "merge",
"providers": {
"ollama": {
"baseUrl": "http://localhost:11434",
"models": {
"qwen3:32b": {
"contextWindow": 32768,
"maxTokens": 4096
}
}
}
}
},

// Gateway
"gateway": {
"host": "127.0.0.1",
"port": 18789,
"max_connections": 10,
"log_level": "info",
"auth": {
"mode": "token",
"token": "${OPENCLAW_AUTH_TOKEN}"
},
"trustedProxies": ["127.0.0.1"]
},

// Execution Environment
"hands": {
"shell": {
"enabled": true,
"timeout": 30000,
"blocked_commands": ["rm -rf /", "sudo rm"]
},
"browser": {
"enabled": true,
"headless": true,
"timeout": 60000,
"allowed_domains": []
},
"filesystem": {
"writable_paths": [],
"blocked_paths": ["~/.ssh", "~/.gnupg"]
}
},

// Sandbox
"sandbox": {
"mode": "non-main",
"backend": "docker",
"scope": "agent"
},

// Tools
"tools": {
"profile": "coding",
"alsoAllow": ["lobster"],
"exec": {
"security": "allowlist",
"ask": "on-miss"
}
},

// Agents
"agents": {
"defaults": {
"model": "claude-sonnet-4-6",
"sandbox": { "mode": "non-main" }
},
"list": [
{
"id": "researcher",
"model": "claude-opus-4-8",
"workspace": "~/research"
},
{
"id": "monitor",
"model": "ollama/qwen3:14b"
}
]
},

// Bindings (message routing)
"bindings": [
{
"match": { "channel": "telegram", "peer": "boss" },
"agentId": "researcher"
}
],

// Session
"session": {
"dmScope": "per-channel-peer"
},

// DM Access Control
"dm": {
"accessPolicy": "pairing",
"pairing": {
"maxPending": 3,
"expireMinutes": 60
}
},

// Heartbeat
"heartbeat": {
"enabled": true,
"interval": 1800,
"model": "claude-haiku-4-5-20251001",
"isolatedSession": true,
"lightContext": false,
"ackMaxChars": 300,
"showOk": false,
"showAlerts": true,
"quiet_hours": {
"start": "22:00",
"end": "07:00",
"timezone": "America/Los_Angeles"
},
"dreaming": {
"enabled": false,
"idle_threshold": 3
}
},

// Memory
"memory": {
"enabled": true,
"path": "~/.openclaw/memory",
"max_context_tokens": 2000,
"auto_save": true
},

// Skills
"skills": {
"path": "~/.openclaw/skills",
"allow_install": true,
"allow_clawhub": true,
"auto_install_deps": false
},

// Permissions
"permissions": {
"mode": "ask",
"auto_approve": ["git status", "git diff", "ls", "cat"],
"always_deny": ["rm -rf /", "sudo rm"]
},

// MCP Servers
"mcp": {
"servers": {
"filesystem": {
"command": "npx @anthropic/mcp-filesystem",
"args": ["/home/user"]
},
"github": {
"command": "npx @anthropic/mcp-github",
"env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" }
}
}
},

// Channels
"channels": {
"telegram": {
"enabled": true,
"allowedContacts": ["user123"]
}
},

// Logging
"logging": {
"level": "info",
"path": "~/.openclaw/logs",
"max_size": "10m",
"max_files": 5,
"redactSensitive": "tools",
"audit": { "enabled": false }
}
}

Section Reference

brain

Primary LLM configuration.

KeyTypeDefaultDescription
providerstring"anthropic"LLM provider: anthropic, openai, openrouter, google, xai, deepseek, local
modelstring"claude-opus-4-6"Model identifier
api_keystringAPI key (supports ${ENV_VAR} syntax)
temperaturefloat0.7Response randomness (0.0-1.0)
max_tokensint4096Max response tokens
fallbackobjectFallback provider config (same fields as brain)
heartbeat_overrideobjectOverride model for heartbeat only

models

Advanced model provider configuration. See Local Models and Model Selection for usage examples.

KeyTypeDefaultDescription
modestring"replace""merge" adds providers to defaults; "replace" overrides entirely
providersobjectProvider-specific config (see below)

models.providers.<name>

KeyTypeDescription
baseUrlstringProvider API endpoint
apiKeystringProvider API key
apistringAPI format: openai-completions, ollama, etc.
modelsobjectPer-model overrides (see below)

models.providers.<name>.models.<model>

KeyTypeDescription
contextWindowintModel context window size
maxTokensintMax output tokens
compat.thinkingFormatstringThinking format compatibility
compat.supportsDeveloperRoleboolModel supports developer role
compat.supportsReasoningEffortboolModel supports reasoning effort parameter
compat.maxTokensFieldstringField name for max tokens

gateway

Gateway server configuration.

KeyTypeDefaultDescription
hoststring"127.0.0.1"Bind address
portint18789WebSocket port
max_connectionsint10Max concurrent connections
log_levelstring"info"Log verbosity: debug, info, warn, error
pid_filestring"~/.openclaw/gateway.pid"PID file path
auth.modestring"token"Auth mode: token or password
auth.tokenstringAuth token (auto-generated on first run)
trustedProxiesarray[]Trusted reverse proxy IPs for header forwarding
caution

Without trustedProxies, attackers can spoof X-Forwarded-For headers to bypass authentication. JFrog found 93.4% of exposed instances were vulnerable to this. See Security Hardening.


hands

Execution environment settings.

hands.shell

KeyTypeDefaultDescription
enabledbooltrueEnable shell command execution
timeoutint30000Command timeout in milliseconds
blocked_commandsarray[]Commands that are always rejected

hands.browser

KeyTypeDefaultDescription
enabledbooltrueEnable browser automation
headlessbooltrueRun browser without GUI
timeoutint60000Browser operation timeout (ms)
allowed_domainsarray[]Restrict browsing to these domains (empty = all)

hands.filesystem

KeyTypeDefaultDescription
writable_pathsarray[]Restrict writes to these paths (empty = all)
blocked_pathsarray["~/.ssh", "~/.gnupg"]Always block access to these paths

sandbox

Agent sandboxing configuration. Controls how agents are isolated.

KeyTypeDefaultDescription
modestring"non-main""off", "non-main" (sandbox sub-agents only), or "all"
backendstring"docker""docker", "ssh", or "openshell"
scopestring"agent""session" (per-session), "agent" (per-agent), or "shared"
info

The default "non-main" mode sandboxes sub-agents while leaving your primary agent unsandboxed. Use "all" for maximum isolation, at the cost of some functionality (e.g., direct file access).


tools

Tool execution configuration. Two independent axes control tool permissions.

KeyTypeDefaultDescription
profilestring"coding"Tool profile preset: "coding", "research", "admin"
alsoAllowarray[]Additional tools to enable (e.g., ["lobster"])
exec.securitystring"allowlist""deny" (block all), "allowlist" (approved list only), "full" (allow all)
exec.askstring"on-miss""off" (never ask), "on-miss" (ask for unlisted commands), "always"

Both axes must be set together for the desired effect:

Desired Behaviorexec.securityexec.ask
Block all exec"deny"any
Ask for everything"allowlist""always"
Ask for unknown commands"allowlist""on-miss"
Allow everything silently"full""off"

agents

Multi-agent configuration. See Multi-Agent Guide for patterns.

agents.defaults

KeyTypeDefaultDescription
modelstringDefault model for all agents
sandbox.modestring"non-main"Default sandbox mode for sub-agents

agents.list[]

KeyTypeDescription
idstringUnique agent identifier
modelstringModel override for this agent
workspacestringAgent's working directory
heartbeat.tasksarrayHeartbeat task names assigned to this agent

bindings

Message routing rules. Routes incoming messages to specific agents based on channel, peer, or account.

"bindings": [
{
"match": {
"channel": "telegram",
"peer": "boss-user-id",
"accountId": "work-account"
},
"agentId": "researcher"
}
]
KeyTypeDescription
match.channelstringChannel name filter
match.peerstringPeer/sender ID filter
match.accountIdstringAccount ID filter (multi-account setups)
agentIdstringTarget agent ID

session

Session isolation settings.

KeyTypeDefaultDescription
dmScopestring"main"Session isolation level (see table)
dmScope ValueBehavior
"main"All DMs share one session
"per-peer"Separate session per sender
"per-channel-peer"Separate per channel + sender (recommended)
"per-account-channel-peer"Full isolation for multi-account setups

dm

DM (direct message) access control. Controls who can message the agent.

KeyTypeDefaultDescription
accessPolicystring"pairing"Access policy (see table)
pairing.maxPendingint3Max pending pairing codes
pairing.expireMinutesint60Pairing code expiration
accessPolicy ValueBehavior
"pairing"Require 1-hour expiring pairing codes (default)
"allowlist"Only pre-approved contacts can message
"open"Anyone can message (requires explicit "*" opt-in)
"disabled"Ignore all inbound DMs

heartbeat

Heartbeat configuration. See Heartbeat Guide for recipes and cost optimization.

KeyTypeDefaultDescription
enabledbooltrueEnable heartbeat loop
intervalint1800Seconds between heartbeats (default: 30 min)
modelstringOverride model for heartbeat (cost optimization)
isolatedSessionboolfalseRun heartbeat in minimal context (2-5K tokens)
lightContextboolfalseSkip memory/history loading
ackMaxCharsint300Suppress responses shorter than this
showOkboolfalseShow routine "all clear" messages
showAlertsbooltrueShow alert/warning messages
useIndicatorbooltrueShow status indicator in clients
quiet_hours.startstringQuiet hours start (HH:MM)
quiet_hours.endstringQuiet hours end (HH:MM)
quiet_hours.timezonestring"UTC"Timezone for quiet hours
dreaming.enabledboolfalseEnable dreaming mode during idle heartbeats
dreaming.idle_thresholdint3Consecutive OK cycles before dreaming activates

memory

Persistent memory configuration.

KeyTypeDefaultDescription
enabledbooltrueEnable persistent memory
pathstring"~/.openclaw/memory"Memory storage directory
max_context_tokensint2000Max tokens loaded per conversation
auto_savebooltrueAuto-save after each conversation

skills

Skill installation and management.

KeyTypeDefaultDescription
pathstring"~/.openclaw/skills"Skills storage directory
allow_installbooltrueAllow installing new skills
allow_clawhubbooltrueAllow installing from ClawHub marketplace
auto_install_depsboolfalseAuto-install skill dependencies

permissions

Execution approval configuration. See Basic Usage.

KeyTypeDefaultDescription
modestring"ask""ask", "auto", or "deny"
auto_approvearray[]Commands that skip the approval prompt
always_denyarray[]Commands that are always blocked

mcp

Model Context Protocol server configuration. See MCP Servers Guide.

mcp.servers.<name>

KeyTypeDescription
commandstringExecutable to run
argsarrayCommand arguments
envobjectEnvironment variables (supports ${VAR} expansion)

channels

Channel configuration varies by platform. Each channel is configured under channels.<name>. Multi-account setups use channels.<name>.accounts.<accountId>.

KeyTypeDescription
enabledboolEnable/disable the channel
allowedContactsarrayRestrict to specific contacts/IDs
accountsobjectMulti-account configuration

See Channels Guide for per-channel setup instructions.


logging

Log configuration.

KeyTypeDefaultDescription
levelstring"info"Log level: debug, info, warn, error
pathstring"~/.openclaw/logs"Log directory
max_sizestring"10m"Max size per log file
max_filesint5Max rotated log files to keep
redactSensitivestringRedact sensitive data: "tools", "all"
audit.enabledboolfalseEnable audit logging

Environment Variable Substitution

Any config value can reference environment variables with ${VAR_NAME}:

{
"brain": {
"api_key": "${ANTHROPIC_API_KEY}"
},
"mcp": {
"servers": {
"github": {
"env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" }
}
}
}
}

Backup and Recovery

Always back up your config before updating OpenClaw:

cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.backup
cp -r ~/.openclaw/credentials ~/.openclaw/credentials.backup
warning

The v2026.5.7 auto-update contained a bug that wiped user configuration. The built-in .bak backup captured the already-corrupted state. Always maintain external backups. Fixed in v2026.5.8.


See Also