GICT knowledge base
The Complete Openclaw CLI Cheatsheet: Manage Your Agents Like a Pro
Published
Bookmark this page. The OpenClaw CLI covers a lot of ground and most people only need a handful of commands day-to-day. This cheatsheet gives you the commands that actually matter with copy-paste examples you can run right now.
Gateway management
The gateway is the long-running daemon that keeps your agent alive. It listens on port 18789 by default and handles all channel connections, message routing, and tool execution. Most of your day-to-day work starts and stops with these commands.
openclaw gateway # Start gateway in foreground (Ctrl+C to stop)
openclaw gateway restart # Restart after any config change
openclaw gateway status # Check if it is running, port, PID
openclaw gateway status --deep # Includes WebSocket and channel health
Install the gateway as a system service so it survives reboots:
openclaw gateway install --force
On Linux, manage it like any other systemd service:
systemctl stop openclaw-gateway
systemctl start openclaw-gateway
systemctl status openclaw-gateway
Configuration
OpenClaw stores config in ~/.openclaw/openclaw.json. Three ways to edit it:
openclaw configure # Interactive config wizard
openclaw config get agents.defaults.workspace
openclaw config set agents.defaults.heartbeat.every "2h"
openclaw config unset gateway.auth.token
You can also edit the JSON file directly. The gateway watches it and hot-reloads most changes automatically. For structural changes or new channels, a restart is safer:
openclaw gateway restart
MCP tools
MCP servers extend what your agent can do. The openclaw mcp command family manages the registry of outbound MCP servers that OpenClaw connects to at runtime. Without MCP tools, your agent only generates text. With them, it can read files, run shell commands, search the web, and call external APIs.
openclaw mcp list # Show all configured MCP servers
openclaw mcp status --verbose # Full status including transport type and tool counts
openclaw mcp doctor # Static checks: config validity, paths, permissions
openclaw mcp doctor --probe # Live connection test to all servers
openclaw mcp probe <name> --json # Probe one specific server
Add and manage MCP servers:
openclaw mcp add memory
--command npx
--arg -y
--arg @modelcontextprotocol/server-memory
openclaw mcp set context7 '{"command":"uvx","args":["context7-mcp"]}'
openclaw mcp tools context7 --include 'resolve-library-id,get-library-docs'
openclaw mcp configure docs --timeout 20 --connect-timeout 5 --include 'search,read_*'
openclaw mcp login docs # OAuth flow for MCP servers that need it
openclaw mcp logout docs # Clear stored OAuth token
openclaw mcp unset context7 # Remove a server by name
For SSE or HTTP transport servers, set the URL directly:
openclaw mcp set docs '{"url":"https://mcp.example.com","transport":"streamable-http","timeout":20}'
Run OpenClaw as an MCP server
Expose OpenClaw conversations to external MCP clients like Claude Code:
openclaw mcp serve # Local gateway, stdio mode
openclaw mcp serve --url wss://host:18789 --token-file ~/.openclaw/gateway.token
openclaw mcp serve --claude-channel-mode off # Disable Claude-specific channel notifications
Filesystem scope
Scope the built-in filesystem tool to the smallest tree the agent needs. Edit ~/.openclaw/openclaw.json:
{
"tools": {
"filesystem": {
"allowedPaths": ["/home/user/openclaw-workspace", "/var/log/openclaw"]
}
}
}
Pairing and security
Pairing is how you control who can message your agent. Without it, anyone who finds your Telegram bot or webhook endpoint can use it and burn through your API credits. Pairing requires manual approval for new users.
openclaw pairing enable # Require approval for new users
openclaw pairing list # Show pending and approved pairings
openclaw pairing approve <channel> <code> # Approve a pending request
openclaw pairing deny <channel> <code> # Reject a pending request
openclaw pairing remove <channel> <peer-id> # Revoke an existing pairing
Pairing requests arrive as a code. When someone new DMs the bot, they get a code. You approve or deny it with the code and channel name.
Allowlists are a simpler alternative for known user IDs:
openclaw config set channels.telegram.allowFrom '["tg:123456789"]'
Find your Telegram user ID by messaging @userinfobot.
Channel management
Each messaging platform is a channel. Add them during onboarding or later:
openclaw channel list # Show all configured channels
openclaw channel status # Health check across all channels
openclaw channel restart telegram # Restart one channel after config change
Channel configuration lives in ~/.openclaw/openclaw.json. Telegram example:
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "123:abc",
"dmPolicy": "pairing"
}
}
}
Valid dmPolicy values: pairing (default, requires approval), allowlist (specific users only), open (anyone), disabled (ignore DMs).
Workspace files
OpenClaw keeps agent identity and memory in the workspace directory, default ~/.openclaw/workspace. These files define who the agent is, how it operates, and what it remembers.
cat ~/.openclaw/workspace/SOUL.md # Agent identity and tone
cat ~/.openclaw/workspace/AGENTS.md # Operational rules and heartbeat schedules
cat ~/.openclaw/workspace/MEMORY.md # Curated long-term memory
ls ~/.openclaw/workspace/memory/ # Daily session logs
Edit SOUL.md and AGENTS.md to change how the agent behaves. MEMORY.md is where you curate facts the agent should remember across sessions.
Skills
Skills are packaged capabilities installed from ClawHub or a URL. Browse the catalog at clawhub.ai.
openclaw skills list # Show installed skills
openclaw skills install <name> # Install from ClawHub
openclaw skills update <name> # Update to latest version
openclaw skills remove <name> # Uninstall a skill
After installing a skill, restart the gateway to activate it:
openclaw gateway restart
Onboarding and doctor
The first time you set up OpenClaw, run the onboarding wizard. It walks you through API keys, gateway port, channel setup, and service installation in one flow. For automation scripts, use non-interactive mode with explicit flags.
When something breaks, openclaw doctor is the first thing to run. It checks your config file validity, file permissions, and connectivity to external services.
openclaw onboard --install-daemon # Guided setup, all steps including service install
openclaw onboard --reset # Reset and start fresh
openclaw onboard --non-interactive --accept-risk
--mode local
--auth-choice apiKey
--anthropic-api-key "$ANTHROPIC_API_KEY"
--gateway-port 18789
--install-daemon # Non-interactive automation
Diagnose problems:
openclaw doctor # Auto-diagnose config, permissions, connectivity
openclaw doctor --generate-gateway-token # Regenerate a gateway auth token
openclaw logs --follow # Stream live gateway logs (Ctrl+C to stop)
Dashboard and health
The Control UI gives you a browser-based chat interface, live gateway inspection, and a visual config editor. The gateway must be running for the dashboard to load.
Open the browser-based Control UI:
openclaw dashboard # Opens http://127.0.0.1:18789 in your browser
Health checks:
openclaw health # Quick health endpoint check
openclaw status # Gateway, Node, and channel status at a glance
openclaw status --deep # Full diagnostics including channel probes
Quick reference
# Gateway
openclaw gateway # Start foreground
openclaw gateway restart # Restart after changes
openclaw gateway status # Running status
openclaw gateway install --force # Install as system service
# Config
openclaw configure # Interactive editor
openclaw config get <key> # Read a value
openclaw config set <key> <value> # Set a value
openclaw config unset <key> # Remove a key
# MCP
openclaw mcp list # Show servers
openclaw mcp status --verbose # Full details
openclaw mcp doctor --probe # Live connection test
openclaw mcp add <name> --command npx --arg -y --arg @modelcontextprotocol/server-memory
openclaw mcp unset <name> # Remove a server
openclaw mcp serve # Run OpenClaw as an MCP server
# Pairing
openclaw pairing enable # Require approval for new users
openclaw pairing list # Show pairings
openclaw pairing approve <ch> <code>
# Channels
openclaw channel list # Show channels
openclaw channel restart <name> # Restart one channel
# Skills
openclaw skills list # Show installed
openclaw skills install <name> # Install from ClawHub
# Onboarding and diagnostics
openclaw onboard # First-time setup
openclaw doctor # Diagnose issues
openclaw logs --follow # Stream logs
# Dashboard
openclaw dashboard # Open Control UI at http://127.0.0.1:18789
openclaw health # Quick health check
openclaw status # Full status overview
Ready to run OpenClaw on a VPS that stays online? InterServer VPS plans start at $6/month with full root access and a 99.9% uptime guarantee.
Related InterServer guide: If you want AI agents to connect directly to InterServer hosting tools, read InterServer MCP Server: Connect AI Agents to Your Hosting Account.
Related guides
How to Secure the Ollama API with Nginx
Protect a private Ollama API with Nginx authentication and restricted routes. Verify allowed requests, denied management calls and direct-port isolation.
AIHow to Set Up an LLM Gateway with LiteLLM
Configure a LiteLLM gateway with private administration, virtual keys and model restrictions. Test allowed requests and understand budget limitations.
AIHow to Self-Host Karakeep with AI Tagging on a VPS
Self-host Karakeep with local Ollama tagging. Restrict first-user setup, disable public registration and verify collection, search and suggested tags.
AIHow to Categorize Support Tickets with a Local AI Model
Suggest support-ticket categories from a CSV using a CPU-only AI model. Keep inference local, preserve ticket IDs, and review uncertain classifications.
