OpenClaw Gateway โ€” Config Cheat Sheet
๐Ÿฆž OpenClaw Gateway โ€” Config Cheat Sheet
~/.openclaw/openclaw.json ยท Models ยท Agents ยท Skills ยท Nodes ยท Workflows ยท Instances
Config: JSON5 Hot-reload: hybrid Strict schema โ€” unknown keys = crash Port 18789
Golden Rules Before Editing
๐Ÿ”’

Always Backup First

cp ~/.openclaw/openclaw.json \
   ~/.openclaw/openclaw.json.bak
โš Unknown keys or wrong types cause the gateway to refuse to start. Backup before every edit.
โœ…

Validate After Edit

openclaw doctor
openclaw doctor --fix   # auto-repair
โ„นRun after every config change. Shows field path + reason for any validation errors.
โšก

Prefer CLI over File Edit

openclaw config get agents.defaults.workspace
openclaw config set agents.defaults.heartbeat.every "2h"
openclaw config unset tools.web.search.apiKey
๐Ÿ”„

Hot Reload Modes

hybrid = default
ModeBehavior
hybridHot where possible, restart when needed
hotIn-place only, keeps connections alive
restartFull restart on any change
offNo auto reload
โœ“Model changes, channel policies, tool permissions hot-apply. Gateway port, auth mode require restart.
Filesystem Layout
๐Ÿ“

~/.openclaw/ Directory

~/.openclaw/ โ”œโ”€โ”€ openclaw.json # main config (JSON5) โ”œโ”€โ”€ credentials/ # API keys โ€” chmod 600 โ”‚ โ”œโ”€โ”€ openrouter โ”‚ โ”œโ”€โ”€ anthropic โ”‚ โ””โ”€โ”€ synthetic โ”œโ”€โ”€ skills/ # shared skills (all agents) โ”‚ โ””โ”€โ”€ your-skill/ โ”‚ โ””โ”€โ”€ SKILL.md โ”œโ”€โ”€ agents/ # per-agent state dirs โ”‚ โ””โ”€โ”€ <agentId>/ โ”‚ โ”œโ”€โ”€ auth-profiles.json โ”‚ โ””โ”€โ”€ sessions/ โ””โ”€โ”€ workspace/ # default agent workspace โ”œโ”€โ”€ AGENTS.md # agent persona/instructions โ”œโ”€โ”€ SOUL.md # agent identity/personality โ”œโ”€โ”€ USER.md # user-specific context โ”œโ”€โ”€ TOOLS.md # tool usage instructions โ”œโ”€โ”€ HEARTBEAT.md # scheduled tasks checklist โ”œโ”€โ”€ memory/ โ”‚ โ””โ”€โ”€ 2026-03-07.md โ””โ”€โ”€ skills/ # per-agent skills (override shared)
๐Ÿ“„

Modular Config with $include

RECOMMENDED
โ„นSplit a large config into focused files. Gateway deep-merges them. Arrays concatenate, later files win on primitives.
// openclaw.json โ€” root file
{
  gateway: { port: 18789 },
  agents: { $include: "./agents.json5" },
  channels: { $include: "./channels/telegram.json5" },
  broadcast: {
    $include: ["./clients/a.json5", "./clients/b.json5"]
  }
}
Max depth
10 levels of nested includes
Circular includes
Detected and rejected with a clear error
Sibling keys
Always override included values
Config path env
OPENCLAW_CONFIG_PATH overrides default location
Models โ€” Add / Change / Fallback
๐Ÿง 

Model Config

primary must not be empty
{
  agents: {
    defaults: {
      model: {
        // REQUIRED โ€” gateway won't start without it
        primary: "anthropic/claude-sonnet-4-5",

        // Fallback chain with exponential backoff
        fallbacks: ["openrouter/openrouter/auto", "openai/gpt-4o"],
      },
      // Model catalog = allowlist for /model command
      models: {
        "anthropic/claude-sonnet-4-5": { alias: "Sonnet" },
        "openrouter/openrouter/auto":    { alias: "OR-Auto" },
        "ollama/llama3.2":              { alias: "Local" },
      },
    },
  },
}
๐Ÿ’กUse openrouter/openrouter/auto as primary to auto-route simple tasks (heartbeats) to cheap models and complex ones to frontier models โ€” big cost savings.
๐Ÿ”Œ

Custom / Local / Self-hosted Providers

{
  models: {
    mode: "merge",  // merge with built-ins, or "replace"
    providers: {

      // Ollama (local)
      ollama: {
        baseUrl: "http://localhost:11434",
        apiKey: "ollama-local",
        api: "openai-completions",
        models: [{
          id: "ollama/llama3.2",
          contextWindow: 131072,
          maxTokens: 8000,
          cost: { input:0, output:0, cacheRead:0, cacheWrite:0 }
        }]
      },

      // OpenRouter (cloud proxy)
      openrouter: {
        baseUrl: "https://openrouter.ai/api/v1",
        apiKey: "${OPENROUTER_API_KEY}"
      }
    }
  }
}
โ„นAny OpenAI-compatible endpoint works โ€” LM Studio, vLLM, Groq, etc. Set api: "openai-completions" and the right baseUrl.
โš™๏ธ

CLI Model Commands

# Switch primary model
openclaw config set \
  agents.defaults.model.primary \
  "anthropic/claude-opus-4"

# Add to catalog
openclaw config set \
  'agents.defaults.models["openai/gpt-4o"]' \
  '{"alias":"GPT4o"}' --json

# RPC patch (from any client)
openclaw gateway call config.patch \
  --params '{"raw":"{agents:{defaults:{model:{primary:\"openai/gpt-4o\"}}}}"}'
๐Ÿ’ณ

Auth Profiles (Keychain)

Secure
โœ“Stores API keys in system keychain โ€” NOT in openclaw.json file.
# Recommended: run onboard wizard
openclaw onboard

# Manual: add auth profile to config
// openclaw.json
{
  authProfiles: {
    openrouter: { provider: "openrouter" }
  }
}

# Then store key in keychain
openclaw auth set openrouter
๐Ÿ“‰

Context & Cost Control

{
  agents: { defaults: {
    contextPruning: {
      mode: "cache-ttl"  // prune old context
    },
    heartbeat: {
      every: "30m"  // "1h" with Anthropic OAuth
    }
  }}
}
โš No contextPruning = token usage spirals. Add it for any long-running agent.
๐Ÿ“Š

Model Quick Reference

Provider prefixExample ID
anthropic/anthropic/claude-sonnet-4-5
openai/openai/gpt-4o
openrouter/openrouter/openrouter/auto
ollama/ollama/llama3.2
google/google/gemini-2.0-flash
Agents โ€” Create, Configure, Bind
๐Ÿค–

Single Agent (Default)

{
  agents: {
    defaults: {
      workspace: "~/.openclaw/workspace",
      model: { primary: "anthropic/claude-sonnet-4-5" },
      identity: { name: "My Assistant" },
    }
  }
}
โ„นNo agents.list needed for a single agent. Defaults apply to the implicit main agent.
๐Ÿค–๐Ÿค–

Multi-Agent Setup

Multi-agent
{
  agents: {
    list: [
      {
        id: "main",
        default: true,
        workspace: "~/.openclaw/workspace-main",
        identity: { name: "Assistant" },
      },
      {
        id: "coder",
        workspace: "~/.openclaw/workspace-coder",
        model: { primary: "anthropic/claude-opus-4" },
        identity: { name: "Code Bot" },
        tools: {
          allow: ["exec", "read", "write", "browser"],
          deny: ["canvas"],
        },
      },
    ],
  },
  bindings: [
    { agentId: "main",  match: { channel: "telegram", accountId: "personal" } },
    { agentId: "coder", match: { channel: "discord", accountId: "dev-server" } },
  ]
}
๐Ÿ›ก

Per-Agent Tool Permissions

ToolWhat it does
execRun shell commands
readRead files
writeWrite/create files
browserWeb automation
canvasVisual workspace (port 18793)
nodesSpawn sub-agent nodes
cronSchedule jobs
sessions_spawnStart child sessions
โš Tool allow/deny lists control capability. Skills are separate โ€” a skill needing exec still requires it in the allow list.
๐Ÿ“ฆ

Per-Agent Sandbox

{
  agents: { list: [{
    id: "untrusted",
    sandbox: {
      mode: "all",    // sandbox all tool calls
      scope: "agent"  // per-agent isolation
    },
    tools: {
      allow: ["read", "exec"],
      deny: ["write", "browser"],
    }
  }]}
}
๐Ÿ’กWorkspace path is default cwd, not a hard jail. Absolute paths can escape unless sandbox mode is set.
๐Ÿ”‘

Agent Identity Files

in workspace/
AGENTS.md
Instructions, rules, how to behave. Primary prompt shaping file.
SOUL.md
Personality, tone, identity. Who the agent is.
USER.md
Facts about the user โ€” preferences, context, background.
TOOLS.md
Tool-specific instructions bundled into each turn.
HEARTBEAT.md
Checklist read every 30min heartbeat. Autonomous task loop.
โ„นEach agent in agents.list has its own workspace with its own set of these files. They are plain Markdown โ€” edit in any text editor.
Skills โ€” Install, Create, Manage
๐Ÿ“š

What Are Skills

โœ“Skills are Markdown files (SKILL.md) with YAML frontmatter that inject instructions into the agent's prompt when relevant. They are NOT code โ€” they are instruction manuals for tools/workflows.
workspace/skills/ โ””โ”€โ”€ my-skill/ โ”œโ”€โ”€ SKILL.md # YAML frontmatter + instructions โ””โ”€โ”€ references/ # optional extra files ~/.openclaw/skills/ # shared skills (all agents) <workspace>/skills/ # per-agent skills (override shared)
Precedence
workspace > managed/local (~/.openclaw/skills) > bundled > extraDirs
Injection
Only relevant skills are injected per turn (not all). Selective to avoid prompt bloat.
Cost
~195 chars base + ~97 chars per skill when โ‰ฅ1 skill is eligible
โฌ‡๏ธ

Install Skills from ClawHub / Repos

# Install from ClawHub registry (interactive)
clawdhub install <skill-name>

# Install from GitHub URL
clawdhub install https://github.com/org/repo/skill-dir

# Installs into ./skills (current dir) by default
# Agent picks it up as <workspace>/skills on next session

# List installed skills
clawdhub list

# Configure skill with API key (env injection)
// openclaw.json
{
  skills: {
    entries: {
      my-skill: {
        apiKey: "${MY_SKILL_API_KEY}"  // from env var
      }
    }
  }
}
โš Treat third-party skills as trusted code. Read them before enabling. Never install blindly from unknown sources.
โœ๏ธ

Write a Skill (SKILL.md)

---
name: my-workflow
description: >
  Use this skill when the user asks to do X or Y.
  Triggers on keywords: "run X", "start Y workflow".
user-invocable: true
homepage: https://example.com
---

# My Workflow Skill

## Overview
Brief description of what this skill does.

## Steps
1. Step one: do this
2. Step two: call this tool with these params
3. Step three: return result

## Notes
- Use {baseDir} to reference this skill's folder
- Always confirm before destructive actions
โš™๏ธ

Skill Config Keys

{
  skills: {
    // Allowlist bundled skills (whitelist mode)
    allowBundled: ["git", "github", "web-search"],

    // Extra skill directories
    load: {
      extraDirs: ["/shared/team-skills"]
    },

    // Per-skill config
    entries: {
      my-skill: {
        apiKey: "${MY_KEY}",
        env: { TOOL_URL: "https://..." }
      }
    }
  }
}
๐Ÿ’กBundled skills auto-enable if their required CLI tool is present on the system. Use allowBundled whitelist to control which ones activate.
๐Ÿ”

Notable Skill Categories

Coding
git, github, codeberg, code-1-0-4, code-security-audit
Memory
chaos-mind, continuity, claw-progressive-memory, context-anchor
Multi-agent
agent-team-orchestration, agent-commons, multi-workplace
Productivity
alex-session-wrap-up, adhd-founder-planner, agentdo
Security
clawdstrike, agent-access-control, authensor-gateway
Data sync
claw-roam, bitwarden, cloudflare-r2
โ„น5,400+ skills in the ClawHub registry. Browse at clawdhub search <keyword> or github.com/VoltAgent/awesome-openclaw-skills
Nodes & Sub-Agent Instances
๐Ÿ”—

Nodes (Sub-Agent Spawning)

v2026.1+
โ„นNodes are child agent processes spawned by a parent agent to parallelize or delegate work. Enable the nodes tool to allow an agent to spawn them.
{
  agents: { defaults: {
    tools: {
      allow: [
        "nodes",          // spawn/manage sub-agent nodes
        "sessions_spawn", // start child sessions
        "sessions_list",  // list active sessions
        "sessions_send",  // send message to session
        "session_status", // check session status
      ]
    }
  }}
}
Spawn node
Agent calls nodes tool โ†’ new isolated process starts โ†’ reports back
Communication
Via sessions_send / sessions_history tools between parent & child
Isolation
Each node has its own session, workspace context, and tool scope
๐Ÿ’กCanvas runs as its own node too (port 18793). If Canvas crashes, the main Gateway keeps running.
๐Ÿ”„

Multi-Workplace (Project Instances)

skill required
โ„นThe multi-workplace skill adds project-switching. Each workplace = a Git repo with its own agents, memory, and deploy config in a .workplace/ directory.
# Install the skill first
npx playbooks add skill openclaw/skills --skill multi-workplace

# Then in chat with your agent:
workplace init [path]          # init current dir as workplace
workplace list                  # list all registered workplaces
workplace switch <name|uuid>   # switch active workplace
workplace scan [path]           # auto-detect .git repos
workplace agents                # list agents in current workplace
workplace agent start <name>   # start a sub-agent
workplace kernel start          # start persistent kernel agent
workplace export [zip|json]     # export for transfer
workplace import <file>        # import on another server
Colon syntax
workplace switch parent:child โ€” fast nested project switching
State location
~/.openclaw/workspace/.workplaces/ โ€” registry.json, current.json
Workflows โ€” Cron Jobs, Hooks, Automation
โฑ

Cron Jobs (Scheduled Workflows)

{
  cron: {
    jobs: [
      {
        id: "daily-brief",
        schedule: "0 8 * * *",   // 8am every day
        agentId: "main",
        prompt: "Run the daily brief: check emails, summarise news, list tasks",
        sessionKey: "cron:daily-brief",
      },
      {
        id: "ci-monitor",
        schedule: "*/10 * * * *",  // every 10 min
        agentId: "coder",
        prompt: "Check GitHub Actions for failures and notify me",
      }
    ],
    // Prune cron run logs
    runLog: { mode: "size", maxLines: 1000 }
  }
}
โ„นHEARTBEAT.md in the workspace is a simpler alternative โ€” the agent reads it every heartbeat and decides what to act on. Better for loose, self-directed tasks.
๐Ÿช

Webhooks / HTTP Hooks

{
  hooks: {
    enabled: true,
    token: "${HOOKS_SECRET}",   // shared secret
    path: "/hooks",            // endpoint prefix
    defaultSessionKey: "hook:ingress",

    mappings: [
      {
        match: { path: "github" },
        action: "agent",
        agentId: "coder",
        deliver: true,
      },
      {
        match: { path: "gmail" },
        action: "agent",
        agentId: "main",
        deliver: true,
      },
    ]
  }
}
โš Treat all hook payload content as untrusted. Keep allowUnsafeExternalContent disabled unless debugging.
๐Ÿ’กIncoming URL: http://gateway:18789/hooks/github โ€” POST with Authorization header bearing the token.
Config RPC โ€” Programmatic Changes
๐Ÿ”ง

RPC Methods

MethodUse
config.getRead current config or a path
config.applyReplace full config (requires baseHash)
config.patchMerge partial config โ€” rate limited: 3/60s
# Get current config + hash
openclaw gateway call config.get --params '{}'

# Patch a single value
openclaw gateway call config.patch \
  --params '{
    "raw": "{agents:{defaults:{model:{primary:\"openai/gpt-4o\"}}}}"
  }'
๐Ÿ”

Gateway Auth Config

{
  gateway: {
    port: 18789,
    bind: "loopback",  // "loopback" | "0.0.0.0"
    reload: "hybrid",

    auth: {
      mode: "token",     // "local" for dev only
      token: "${OPENCLAW_GATEWAY_TOKEN}",
      allowTailscale: true,  // if using Tailscale
    },

    trustedProxies: ["10.0.0.0/8"],  // Docker subnet
  }
}
โš If bind: "0.0.0.0" your gateway is exposed to the network. Fix immediately โ€” use "loopback" in prod with a reverse proxy.
๐Ÿฉบ

Doctor & Security Audit

# Detect + repair config issues
openclaw doctor
openclaw doctor --fix

# Full security audit
openclaw security audit --deep

# Lock down permissions
chmod 700 ~/.openclaw
chmod 600 ~/.openclaw/openclaw.json
chmod 700 ~/.openclaw/credentials

# Verify gateway port binding
netstat -an | grep 18789 | grep LISTEN

# Check for leaked secrets in config
grep -r "sk-" ~/.openclaw/  # should find nothing
Channels โ€” Quick Reference
โœˆ๏ธ

Telegram

{
  channels: {
    telegram: {
      enabled: true,
      botToken: "${TELEGRAM_BOT_TOKEN}",
      dmPolicy: "pairing",
      // pairing|allowlist|open|disabled
      allowFrom: ["tg:123456789"],
    }
  }
}
๐ŸŽฎ

Discord

{
  channels: {
    discord: {
      groupPolicy: "allowlist",
      accounts: {
        default: {
          token: "${DISCORD_BOT_TOKEN}",
          guilds: { "GUILD_ID": {
            channels: { "CHAN_ID": { allow: true } }
          }}
        }
      }
    }
  }
}
๐Ÿ’ฌ

WhatsApp

{
  channels: {
    whatsapp: {
      dmPolicy: "allowlist",
      allowFrom: ["+15555550123"],
      // Multi-account:
      accounts: {
        personal: { ... },
        biz: { ... }
      }
    }
  }
}
๐Ÿ”‘

DM Policy Modes

pairing
Default. Unknown senders get a one-time pairing code.
allowlist
Only senders in allowFrom list.
open
Allow all inbound. Requires allowFrom: ["*"]
disabled
Ignore all DMs on this channel.
Quick Fix Reference
๐Ÿ”ด

Common Errors โ†’ Fix

Gateway won't start
Unknown key in config. Run openclaw doctor โ†’ remove the offending key (top-level memory is a common culprit).
model.primary empty error
Set agents.defaults.model.primary to a real model ID. Cannot be blank.
Skill not activating
SKILL.md frontmatter description doesn't match your query keywords. Or allowBundled whitelist is blocking it.
Costs too high
No contextPruning. Expensive primary model. Switch primary to openrouter/auto, add contextPruning: {mode:"cache-ttl"}.
config.patch rejected
Rate limited (3 calls/60s). Wait and retry. Or edit file directly + doctor.
Multi-agent session bleed
Never reuse agentDir across agents. Each agent must have its own dedicated agentDir.
Node can't spawn
nodes tool not in tools.allow list for that agent.
๐Ÿ’ก

Useful One-liners

# Full setup wizard
openclaw onboard

# Interactive config editor
openclaw configure

# View gateway status
openclaw gateway status

# Validate JSON5 manually
python3 -m json.tool ~/.openclaw/openclaw.json

# Restore from backup after bad edit
cp ~/.openclaw/openclaw.json.bak \
   ~/.openclaw/openclaw.json && openclaw doctor

# Open config in Control UI (browser)
# http://127.0.0.1:18789 โ†’ Config tab

# See all available agents
openclaw agents list

# Restart gateway after critical config change
openclaw gateway restart
openclaw/openclaw ยท gateway config cheat sheet ยท march 2026
docs.openclaw.ai ~/.openclaw/openclaw.json openclaw doctor openclaw configure