Skip to main content
🎓 Claude Code Masterclass Learn AI-assisted development on Udemy — plus the companion book on Leanpub & Amazon. Start Learning
OpenClaw CLI command reference and power tips
AI

OpenClaw CLI Command Reference and Power Tips

Complete OpenClaw CLI reference: gateway management, agent control, memory search, cron jobs, security audits, and power-user tips with working command.

LB
Luca Berton
· 3 min read

CLI Overview

The OpenClaw CLI (openclaw-cli) is the primary tool for configuring, managing, and troubleshooting your gateway. When running via Docker Compose, every CLI command follows this pattern:

docker compose run --rm openclaw-cli <command> [options]

Running --help shows the full command tree:

docker compose run --rm openclaw-cli --help

Command Categories

OpenClaw v2026.2.25 ships with 40+ top-level commands organized into logical groups:

Gateway & Infrastructure

CommandDescription
gateway *Run, inspect, and query the WebSocket Gateway
healthFetch health from the running gateway
statusShow channel health and recent session recipients
doctorHealth checks + quick fixes for the gateway and channels
logsTail gateway file logs via RPC
dashboardOpen the Control UI with your current token

openclaw gateway run and its subcommands

The gateway command group controls the WebSocket Gateway — the long-running process behind every channel and the Control UI. The usual entry point is openclaw gateway run, which starts the gateway in the foreground:

# Start the gateway in the foreground (Ctrl+C to stop)
openclaw gateway run

# Bind to a specific address/port (see bind modes)
openclaw gateway run --bind 0.0.0.0:18789

# Run detached, then check health and tail logs
openclaw gateway run --detach
openclaw gateway health
openclaw gateway logs --follow
SubcommandDescription
gateway runStart the gateway process (foreground, or --detach to background it)
gateway restartRestart a running gateway to apply config changes
gateway statusShow whether the gateway is up and which address it bound to
gateway healthFetch the gateway’s health endpoint
gateway logsTail the gateway’s file logs over RPC

Seeing non-loopback control ui requires gateway.controlui.allowedorigins when you run the gateway? That is the origin-allowlist requirement — see Fix OpenClaw ‘Non-Loopback Control UI’ Startup Error.

Configuration

CommandDescription
config *Non-interactive config helpers (get/set/unset)
configureInteractive setup wizard for credentials, channels, gateway, and agent defaults
setupInitialize local config and agent workspace
onboardInteractive onboarding wizard for gateway, workspace, and skills
resetReset local config/state (keeps the CLI installed)

Agent & Conversations

CommandDescription
agentRun one agent turn via the Gateway
agents *Manage isolated agents (workspaces, auth, routing)
sessions *List stored conversation sessions
message *Send, read, and manage messages
memory *Search and reindex memory files

Channels & Communication

CommandDescription
channels *Manage connected chat channels (Telegram, Discord, etc.)
directory *Lookup contact and group IDs (self, peers, groups)
pairing *Secure DM pairing (approve inbound requests)
webhooks *Webhook helpers and integrations

Security & Administration

CommandDescription
security *Security tools and local config audits
approvals *Manage exec approvals (gateway or node host)
devices *Device pairing + token management
update *Update OpenClaw and inspect update channel status
uninstallUninstall the gateway service + local data

Advanced

CommandDescription
cron *Manage cron jobs via the Gateway scheduler
hooks *Manage internal agent hooks
models *Discover, scan, and configure models
skills *List and inspect available skills
plugins *Manage OpenClaw plugins and extensions
sandbox *Manage sandbox containers for agent isolation
browser *Manage OpenClaw’s dedicated browser (Chrome/Chromium)
dns *DNS helpers for wide-area discovery (Tailscale + CoreDNS)
nodes *Manage gateway-owned node pairing and node commands
node *Run and manage the headless node host service
acp *Agent Control Protocol tools
tuiOpen a terminal UI connected to the Gateway

Essential Config Commands

Get a Config Value

docker compose run --rm openclaw-cli config get agents.defaults.memorySearch.provider

Set a Config Value

docker compose run --rm openclaw-cli config set \
  agents.defaults.compaction.memoryFlush.enabled true

Unset a Config Value

docker compose run --rm openclaw-cli config unset \
  agents.defaults.compaction.memoryFlush.systemPrompt

Batch Configuration

Run multiple config set commands in sequence. Each change generates a SHA-256 hash trail:

docker compose run --rm openclaw-cli config set key1 value1
docker compose run --rm openclaw-cli config set key2 value2
docker compose run --rm openclaw-cli config set key3 value3
docker compose restart openclaw-gateway

The config file tracks changes with hash chains:

sha256 d6d04328... -> dd9c4954...  (first change)
sha256 dd9c4954... -> 00585ebf...  (second change)
sha256 00585ebf... -> 77d13c91...  (third change)

Global Options

OptionDescription
--devDev profile: isolate state under ~/.openclaw-dev
--profile <name>Named profile under ~/.openclaw-<name>
--log-level <level>Override log level (silent|fatal|error|warn|info|debug|trace)
--no-colorDisable ANSI colors
-V, --versionPrint version number

Profile Isolation

Profiles let you run multiple OpenClaw instances with separate state:

# Production
docker compose run --rm openclaw-cli config set gateway.port 18789

# Development (isolated state)
docker compose run --rm openclaw-cli --dev gateway
# Uses port 19001, state in ~/.openclaw-dev/

Power Tips

Tip 1: Suppress Warning Noise

When environment variables like CLAUDE_WEB_COOKIE aren’t set, Docker Compose emits warnings:

WARN[0000] The "CLAUDE_WEB_COOKIE" variable is not set.
Defaulting to a blank string.

Suppress these by adding empty defaults to your .env file:

cat >> ~/openclaw/.env <<'EOF'
CLAUDE_WEB_COOKIE=
CLAUDE_AI_SESSION_KEY=
CLAUDE_WEB_SESSION_KEY=
EOF

Tip 2: Use Shell History Wisely

OpenClaw CLI commands can be long. Create aliases:

# Add to ~/.bashrc
alias oc='docker compose run --rm openclaw-cli'
alias oc-config='docker compose run --rm openclaw-cli config'
alias oc-restart='docker compose restart openclaw-gateway'

Then:

oc config set agents.defaults.memorySearch.provider local
oc-restart

Tip 3: Inspect Config as JSON

View the current full config:

docker exec -it openclaw-openclaw-gateway-1 sh -lc \
  'cat /home/node/.openclaw/openclaw.json' | python3 -m json.tool

Tip 4: Diff Config Changes

Compare current config with the last backup:

docker exec -it openclaw-openclaw-gateway-1 sh -lc \
  'diff /home/node/.openclaw/openclaw.json.bak /home/node/.openclaw/openclaw.json'

Tip 5: Use the Doctor Command

When things aren’t working, doctor runs automated health checks:

docker compose run --rm openclaw-cli doctor

Tip 6: Generate Shell Completions

docker compose run --rm openclaw-cli completion > /tmp/openclaw-completion.sh
source /tmp/openclaw-completion.sh

The Lobster Taglines

You may notice the CLI prints a random tagline on every run:

🦞 OpenClaw 2026.2.25 (unknown)
   curl for conversations.

🦞 OpenClaw 2026.2.25 (unknown)
   I'm the reason your shell history looks like a hacker-movie montage.

🦞 OpenClaw 2026.2.25 (unknown)
   Your .env is showing; don't worry, I'll pretend I didn't see it.

These are built into the CLI binary — a nice touch of personality in an otherwise serious tool. Each invocation shows a different one.

Memory CLI Commands

# Search agent memory
docker compose run --rm openclaw-cli memory search "deployment configuration"

# Reindex memory files (after manual edits)
docker compose run --rm openclaw-cli memory reindex

# List memory contents
docker compose run --rm openclaw-cli memory list

Security Commands

# Run security audit
docker compose run --rm openclaw-cli security audit

# Check for dangerous config flags
docker compose run --rm openclaw-cli security check

Helpful Debugging Pattern

When troubleshooting, follow this sequence:

# 1. Check health
docker compose run --rm openclaw-cli health

# 2. Check channel status
docker compose run --rm openclaw-cli status

# 3. Run doctor
docker compose run --rm openclaw-cli doctor

# 4. Check logs
docker compose run --rm openclaw-cli logs

# 5. Verify config
docker compose run --rm openclaw-cli config get gateway

Series Navigation

Free 30-min AI & Cloud consultation

Book Now