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:

FlagShortDescription
--config <path>-cUse a custom config file instead of the default
--verbose-vEnable verbose output
--quiet-qSuppress non-essential output
--json-jOutput in JSON format (useful for scripting)
--no-colorDisable colored terminal output
--version-VPrint the OpenClaw version and exit

# Example: get the version
openclaw --version

# Example: list skills in JSON format
openclaw skills list --json

Environment Variables

--help-hShow help for any command

OpenClaw respects several environment variables that override config file values:

VariableDescriptionDefault
OPENCLAW_HOMEBase directory for all OpenClaw data~/.openclaw
OPENCLAW_CONFIGPath to the config file$OPENCLAW_HOME/config.yaml
OPENCLAW_LOG_LEVELLog verbosity: debug, info, warn, errorinfo
OPENCLAW_MODELOverride the default modelConfig value
OPENCLAW_PROVIDEROverride the default providerConfig value
OPENCLAW_API_KEYAPI key for the active providerConfig value
OPENCLAW_PORTAPI server port3120

# Start with a custom home directory
OPENCLAW_HOME=/opt/openclaw openclaw start

# Override model for a single session
OPENCLAW_MODEL=anthropic/claude-3 openclaw chat
OPENCLAW_NO_TELEMETRYDisable anonymous usage telemetryfalse

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]
FlagDescription
--daemonRun as background process
--port <number>Override API port
--no-skillsStart without loading skills
--no-memoryStart without loading persistent memory

openclaw stop

--profile <name>Use a named configuration profile

Stops a running agent.


openclaw stop [flags]
FlagDescription
--forceKill immediately without graceful shutdown

openclaw restart

--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]
FlagDescription
--detailShow extended information (skills, memory, platforms)

openclaw config

--jsonOutput in JSON format

Manage configuration values.


openclaw config <subcommand> [args]
SubcommandDescription
listShow all configuration values
get <key>Get a specific value
set <key> <value>Set a value
reset <key>Reset a key to its default
validateCheck the config file for syntax errors
editOpen the config file in your default editor

# Validate your config after manual edits
openclaw config validate

# Open in editor
openclaw config edit

openclaw skills

exportExport the full config to stdout

Manage agent skills.


openclaw skills <subcommand> [args]
SubcommandDescription
listList 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

# Install and immediately enable
openclaw skills install calendar-sync

# Check what a skill does before installing
openclaw skills info calendar-sync

openclaw memory

create <name>Scaffold a new custom skill project

Manage the agent's persistent memory.


openclaw memory <subcommand> [args]
SubcommandDescription
statsShow memory usage statistics
search <query>Search memory entries
exportExport memory to JSON
import <file>Import memory from a JSON file
clearDelete all memory (requires --confirm)

openclaw logs

pruneRemove old or low-relevance entries

View agent logs.


openclaw logs [flags]
FlagDescription
--follow / -fStream 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)

# Stream errors only
openclaw logs --follow --level error

# Last hour of debug logs
openclaw logs --since 1h --level debug

openclaw ask

--grep <pattern>Filter log lines matching a regex pattern

Send a one-shot prompt.


openclaw ask "<prompt>" [flags]
FlagDescription
--model <name>Override the model for this request
--no-memoryDon't use or store memory for this query
--system <prompt>Set a custom system prompt

openclaw chat

--file <path>Attach a file for context

Start an interactive chat session.


openclaw chat [flags]
FlagDescription
--model <name>Override the model
--system <prompt>Set a system prompt

openclaw doctor

--no-memoryDisable memory for this session

Run diagnostic checks.


openclaw doctor [flags]
FlagDescription
--platformsTest platform connections
--keysValidate API keys
--modelTest model connectivity

openclaw update

--allRun all checks

Update OpenClaw itself.


openclaw update [flags]
FlagDescription
--checkCheck for updates without installing

Output Formats

--pre-releaseInclude 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

CodeMeaning
0Success
1General error
2Configuration error
3Connection error (platform or model)
4Authentication error (invalid API key)

Shell Completion

5Agent 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

Related Articles