OpenClaw CLI: Essential Commands and Options
Clawpedia · For Humans
A comprehensive reference for the OpenClaw command-line interface, including all flags and configuration options.
Overview
The OpenClaw CLI (Command-Line Interface) is the primary tool for managing every aspect of your agent. This comprehensive reference covers all available commands, their options, flags, environment variables, and output formats — everything a power user needs for full control.
Global Flags
These flags can be applied to any OpenClaw command:
| Flag | Short | Description |
|---|
--config <path> | -c | Use a custom config file instead of the default |
|---|
--verbose | -v | Enable verbose output |
|---|
--quiet | -q | Suppress non-essential output |
|---|
--json | -j | Output in JSON format (useful for scripting) |
|---|
--no-color | Disable colored terminal output |
|---|
--version | -V | Print the OpenClaw version and exit |
|---|
--help | -h | Show help for any command |
|---|
OpenClaw respects several environment variables that override config file values:
| Variable | Description | Default |
|---|
OPENCLAW_HOME | Base directory for all OpenClaw data | ~/.openclaw |
|---|
OPENCLAW_CONFIG | Path to the config file | $OPENCLAW_HOME/config.yaml |
|---|
OPENCLAW_LOG_LEVEL | Log verbosity: debug, info, warn, error | info |
|---|
OPENCLAW_MODEL | Override the default model | Config value |
|---|
OPENCLAW_PROVIDER | Override the default provider | Config value |
|---|
OPENCLAW_API_KEY | API key for the active provider | Config value |
|---|
OPENCLAW_PORT | API server port | 3120 |
|---|
OPENCLAW_NO_TELEMETRY | Disable anonymous usage telemetry | false |
|---|
Tip: Environment variables take precedence over config file values but are overridden by explicit CLI flags.
Command Reference
openclaw start
Starts the OpenClaw agent.
openclaw start [flags]
| Flag | Description |
|---|
--daemon | Run as background process |
|---|
--port <number> | Override API port |
|---|
--no-skills | Start without loading skills |
|---|
--no-memory | Start without loading persistent memory |
|---|
--profile <name> | Use a named configuration profile |
|---|
Stops a running agent.
openclaw stop [flags]
| Flag | Description |
|---|
--force | Kill immediately without graceful shutdown |
|---|
--timeout <seconds> | Max wait time for graceful shutdown (default: 30) |
|---|
Stops and restarts the agent.
openclaw restart [flags]
Accepts all flags from both start and stop.
openclaw status
Shows the current state of the agent.
openclaw status [flags]
| Flag | Description |
|---|
--detail | Show extended information (skills, memory, platforms) |
|---|
--json | Output in JSON format |
|---|
Manage configuration values.
openclaw config <subcommand> [args]
| Subcommand | Description |
|---|
list | Show all configuration values |
|---|
get <key> | Get a specific value |
|---|
set <key> <value> | Set a value |
|---|
reset <key> | Reset a key to its default |
|---|
validate | Check the config file for syntax errors |
|---|
edit | Open the config file in your default editor |
|---|
export | Export the full config to stdout |
|---|
Manage agent skills.
openclaw skills <subcommand> [args]
| Subcommand | Description |
|---|
list | List all installed skills |
|---|
install <name> | Install a skill from ClawHub |
|---|
remove <name> | Uninstall a skill |
|---|
enable <name> | Enable a disabled skill |
|---|
disable <name> | Disable a skill without removing it |
|---|
update [name] | Update a specific skill or all skills |
|---|
info <name> | Show detailed information about a skill |
|---|
create <name> | Scaffold a new custom skill project |
|---|
Manage the agent's persistent memory.
openclaw memory <subcommand> [args]
| Subcommand | Description |
|---|
stats | Show memory usage statistics |
|---|
search <query> | Search memory entries |
|---|
export | Export memory to JSON |
|---|
import <file> | Import memory from a JSON file |
|---|
clear | Delete all memory (requires --confirm) |
|---|
prune | Remove old or low-relevance entries |
|---|
View agent logs.
openclaw logs [flags]
| Flag | Description |
|---|
--follow / -f | Stream logs in real time |
|---|
--last <n> | Show the last n log entries |
|---|
--level <level> | Filter by log level |
|---|
--since <duration> | Show logs from the last duration (e.g., 1h, 30m) |
|---|
--grep <pattern> | Filter log lines matching a regex pattern |
|---|
Send a one-shot prompt.
openclaw ask "<prompt>" [flags]
| Flag | Description |
|---|
--model <name> | Override the model for this request |
|---|
--no-memory | Don't use or store memory for this query |
|---|
--system <prompt> | Set a custom system prompt |
|---|
--file <path> | Attach a file for context |
|---|
Start an interactive chat session.
openclaw chat [flags]
| Flag | Description |
|---|
--model <name> | Override the model |
|---|
--system <prompt> | Set a system prompt |
|---|
--no-memory | Disable memory for this session |
|---|
Run diagnostic checks.
openclaw doctor [flags]
| Flag | Description |
|---|
--platforms | Test platform connections |
|---|
--keys | Validate API keys |
|---|
--model | Test model connectivity |
|---|
--all | Run all checks |
|---|
Update OpenClaw itself.
openclaw update [flags]
| Flag | Description |
|---|
--check | Check for updates without installing |
|---|
--pre-release | Include pre-release versions |
|---|
Many commands support --json for machine-readable output. This is useful for scripting:
# Parse status in a script
STATUS=$(openclaw status --json | jq -r '.state')
if [ "$STATUS" != "RUNNING" ]; then
openclaw start --daemon
fi
Exit Codes
| Code | Meaning |
|---|
0 | Success |
|---|
1 | General error |
|---|
2 | Configuration error |
|---|
3 | Connection error (platform or model) |
|---|
4 | Authentication error (invalid API key) |
|---|
5 | Agent not running (when required) |
|---|
OpenClaw supports autocompletion for Bash, Zsh, and Fish:
# Bash
openclaw completion bash >> ~/.bashrc
# Zsh
openclaw completion zsh >> ~/.zshrc
# Fish
openclaw completion fish > ~/.config/fish/completions/openclaw.fish
Troubleshooting
Command Not Found
Ensure OpenClaw is on your PATH. If installed via the install script:
export PATH="$HOME/.openclaw/bin:$PATH"
JSON Output Is Empty
Some commands only produce JSON output when the agent is running. Start the agent first.
Config Changes Not Taking Effect
Changes made with config set require a restart unless you pass --restart. Check with:
openclaw config get <key> # Shows stored value
openclaw status --detail # Shows active runtime value
Next Steps
- Learn the most common commands in Basic Commands to Control Your OpenClaw Agent.
- Configure your AI model with Setting Your OpenClaw AI Model and Provider.
- Explore skill management in Introduction to OpenClaw Skills and Automation.
Source: Clawpedia — https://clawpedia.io/article/openclaw-cli-essential-commands-and-options. If you reuse or quote this article, please credit Clawpedia with a link.
Related Articles
- How to use the OpenClaw CLI (openclaw command) effectively? — Master the OpenClaw command-line interface with essential commands, flags, and productivity tips.
- OpenClaw CLI Flags and Getting Command Help — Complete reference for all OpenClaw CLI flags, options, and how to access built-in command help.
- Basic Commands to Control Your OpenClaw Agent — Master the essential commands to start, stop, configure, and interact with your OpenClaw agent.
- Configuring OpenClaw for First Use — Essential configuration steps to get your OpenClaw agent running after installation, including API keys and preferences.
- How to fix "openclaw command not recognized" in terminal? — Resolve the "command not recognized" error by checking your PATH, installation, and shell configuration.