OpenClaw Configuration Reference
Config file: ~/.openclaw/openclaw.json (JSON5 — comments and trailing commas OK).
Validation is strict; gateway refuses to start on errors. Run openclaw doctor to diagnose.
Config Operations
config.apply— validate, write, restart gatewayconfig.patch— merge partial changes without overwriting other keys$includedirective — include other JSON5 files (nest up to 10 levels)
Environment Variables
Loading order:
- Parent process env
.envin current working directory~/.openclaw/.env(fallback)- Inline
envconfig (non-overriding)
Use ${VAR_NAME} substitution in config strings. Escape with $${VAR}.
Opt into shell env: env.shellEnv.enabled: true with timeoutMs.
Agent Configuration
Multi-Agent (agents.list[])
| Field | Purpose |
|---|---|
id |
Stable identifier (required) |
default |
Marks primary agent |
name |
Display name |
workspace |
File ops directory (default: ~/.openclaw/workspace-<agentId>) |
agentDir |
Auth/session storage (default: ~/.openclaw/agents/<agentId>/agent) |
model |
Per-agent model override ("provider/model" or {primary, fallbacks}) |
identity |
Name, theme, emoji, avatar URL/path |
groupChat.mentionPatterns |
Regex array for text mentions |
sandbox |
Per-agent isolation |
subagents |
Spawning permissions via allowAgents |
tools |
Per-agent tool restrictions |
Agent Defaults (agents.defaults)
Model:
model.primary— e.g.anthropic/claude-opus-4-6model.fallbacks— backup modelsimageModel— separate model for image tasksmodels.<provider/model>— catalog withaliasandparams(temperature, maxTokens)
Runtime:
timeoutSeconds— max execution (default: 600)maxConcurrent— parallel agent runs (default: 1)mediaMaxMb— inbound media cap (default: 5)thinkingDefault—low|high|off(default: off)verboseDefault—on|offelevatedDefault—on|offcontextTokens— estimated context window (default: 200000)
Workspace:
workspace— default:~/.openclaw/workspacerepoRoot— repo root for system prompt (auto-detected)skipBootstrap— disable auto-creation of AGENTS.md, SOUL.md, etc.bootstrapMaxChars— max file length before truncation (default: 20000)userTimezone— timezone for system prompttimeFormat—auto|12|24
Heartbeat:
every— interval (e.g.30m)target— delivery channel (last|whatsapp|telegram|discord|slack|none)to— recipient overridemodel— optional fallback modelackMaxChars— max output (default: 300)
Compaction:
mode—default|safeguardreserveTokensFloor— minimum reserve (default: 20000)memoryFlush.enabled— silent turn to store memories (default: true)memoryFlush.softThresholdTokens— trigger point (default: 4000)
Context Pruning:
mode—off|adaptive|aggressivekeepLastAssistants— protected messages (default: 3)softTrimRatio— oversized tool-result threshold (default: 0.3)hardClearRatio— full replacement threshold (default: 0.5)
Sandbox:
mode—off|non-main|allscope—session|agent|sharedworkspaceAccess—none|ro|rwdocker.image,docker.network,docker.user,docker.memory,docker.cpusdocker.setupCommand— initial install scriptbrowser.enabled— sandboxed Chromium
Sub-agents:
model— fallback modelmaxConcurrent— parallel limit (default: 1)archiveAfterMinutes— auto-cleanup (default: 60)
Streaming:
blockStreamingDefault—on|offhumanDelay— pause between block replies (mode: off|natural|custom)
Messages Configuration
responsePrefix— supports{model},{provider},{identity.name},{thinkingLevel}templatesackReaction— emoji (default:eyes)ackReactionScope—group-mentions|group-all|direct|allqueue.mode—steer|followup|collect|interrupt(default: collect)queue.debounceMs— batch delay (default: 1000)inbound.debounceMs— same-sender batch delay (default: 2000)
Session Configuration
scope—per-sender|per-channel(default: per-sender)dmScope—main|per-peer|per-channel-peer|per-account-channel-peer(default: main)reset.mode—daily|idlereset.atHour— reset time 0-23 (default: 4)reset.idleMinutes— sliding idle windowresetTriggers— command list (default:["/new", "/reset"])identityLinks— map canonical IDs to provider-prefixed peers (cross-channel identity)
Tool Configuration
tools.profile— base allowlist (minimal|coding|messaging|full)tools.allow/tools.deny— allowlist/denylist (deny wins)tools.elevated.enabled— allow elevated mode (default: true)tools.web.search.enabled,.apiKey,.maxResultstools.web.fetch.enabled,.maxChars,.readabilitytools.exec.backgroundMs,.timeoutSectools.agentToAgent.enabled— inter-agent messaging (default: false)
Gateway Settings
gateway.port— listen port (default: 18789)gateway.auth.token— API auth tokengateway.cors— CORS policy
Logging
logging.level— threshold (default: info)logging.file— path (default:/tmp/openclaw/openclaw-YYYY-MM-DD.log)logging.redactSensitive—off|tools
File Paths
| Component | Default Path |
|---|---|
| Config | ~/.openclaw/openclaw.json |
| Workspace | ~/.openclaw/workspace or ~/.openclaw/workspace-<agentId> |
| Agent dir | ~/.openclaw/agents/<agentId>/agent |
| Sessions | ~/.openclaw/agents/<agentId>/sessions/ |
| Auth | ~/.openclaw/agents/<agentId>/agent/auth-profiles.json |
| Logs | /tmp/openclaw/openclaw-YYYY-MM-DD.log |
| Cron | ~/.openclaw/cron/jobs.json |
| Skills | ~/.openclaw/skills |
| Sandboxes | ~/.openclaw/sandboxes |
Built-in Model Aliases
opus=anthropic/claude-opus-4-6sonnet=anthropic/claude-sonnet-4-5gpt=openai/gpt-5.2gpt-mini=openai/gpt-5-minigemini=google/gemini-3-pro-previewgemini-flash=google/gemini-3-flash-preview
Diagnostics
openclaw doctor— identify issuesopenclaw doctor --fix— auto-repairopenclaw health— health checkopenclaw status/openclaw status --all— service statusopenclaw logs— view logs