乐于分享
好东西不私藏

OpenClaw 命令大全(收藏):从入门到精通的完整操作手册

OpenClaw 命令大全(收藏):从入门到精通的完整操作手册

一份真正实用的 OpenClaw CLI 速查手册,覆盖 30+ 命令、200+ 子命令,让你效率翻倍。


一、OpenClaw 是什么?为什么值得学?

OpenClaw 是一个开源的 AI Agent orchestration 平台。简单说,它让你能在本地运行多个 AI 助手,通过统一的网关管理消息、模型、技能和任务调度。

核心能力:

• 🤖 多 Agent 协作:每个 Agent 有独立工作区和记忆

• 💬 多通道消息:支持 Telegram、Discord、WhatsApp、飞书等 20+ 渠道

• 🧠 模型管理:自动切换、fallback、多提供商支持

• 🛠️ 技能系统:可插拔的 Skill 扩展能力

• 🔒 本地优先:数据留在本地,隐私可控

学习 OpenClaw 命令的价值:

• 不用每次翻文档,命令行直接搞定

• 批量操作、自动化脚本的基础

• 排查问题时的第一工具


二、命令速查总览

OpenClaw CLI 采用分层命令结构:openclaw <主命令> <子命令> [选项]

| 主命令 | 用途 | 常用程度 |

gateway | 网关服务管理 | ⭐⭐⭐⭐⭐ |

agents | Agent 管理 | ⭐⭐⭐⭐⭐ |

channels | 消息通道配置 | ⭐⭐⭐⭐⭐ |

message | 消息发送/管理 | ⭐⭐⭐⭐⭐ |

models | AI 模型配置 | ⭐⭐⭐⭐⭐ |

infer | 模型推理调用 | ⭐⭐⭐⭐ |

skills | 技能管理 | ⭐⭐⭐⭐ |

sessions | 会话管理 | ⭐⭐⭐⭐ |

acp | ACP 协议桥接 | ⭐⭐⭐ |

node | 节点主机服务 | ⭐⭐⭐ |

cron | 定时任务 | ⭐⭐⭐ |

backup | 备份管理 | ⭐⭐⭐ |

config | 配置管理 | ⭐⭐⭐ |

doctor | 健康诊断 | ⭐⭐⭐ |

memory | 记忆搜索 | ⭐⭐⭐ |

status | 状态查看 | ⭐⭐⭐ |

logs | 日志查看 | ⭐⭐⭐ |

update | 更新管理 | ⭐⭐ |

security | 安全审计 | ⭐⭐ |

webhooks | Webhook 集成 | ⭐⭐ |


三、核心命令详解

3.1 Gateway 网关服务(最核心的命令)

Gateway 是 OpenClaw 的心脏,所有 Agent、通道、模型都通过它通信。

# 启动网关(前台运行,开发调试用)openclaw gateway run# 安装为系统服务(推荐生产环境)openclaw gateway install# 启动/停止/重启服务openclaw gateway startopenclaw gateway stopopenclaw gateway restart# 查看网关状态openclaw gateway status# 健康检查openclaw gateway health# 网络探测(检查连通性和认证)openclaw gateway probe# 查看网关资源使用成本openclaw gateway usage-cost

常用选项:

• --port :指定端口(默认 18789)

• --token :设置访问令牌

• --verbose:详细日志


3.2 Agents 管理(多助手协作的核心)

# 列出所有 Agentopenclaw agents list# 添加新 Agentopenclaw agents add <agent-id># 删除 Agent(会清理工作区和状态)openclaw agents delete <agent-id># 设置 Agent 身份(名称/主题/表情/头像)openclaw agents set-identity <agent-id># 查看路由绑定openclaw agents bindings# 添加路由绑定(指定 Agent 处理哪些消息)openclaw agents bind <agent-id># 移除路由绑定openclaw agents unbind <agent-id>

实际场景:

• 为不同任务创建专门 Agent(写作、编程、数据分析)

• 通过绑定规则让特定 Agent 处理特定群聊/频道


3.3 Channels 通道管理(连接 20+ 消息平台)

# 列出已配置的通道openclaw channels list# 添加通道账号openclaw channels add --channel <平台> --token <令牌># 登录通道(交互式,如 WhatsApp Web QR 码)openclaw channels login --channel <平台># 退出登录openclaw channels logout --channel <平台># 查看通道状态openclaw channels status# 查看通道能力(支持哪些功能)openclaw channels capabilities# 解析用户名/群组名到 IDopenclaw channels resolve# 查看通道日志openclaw channels logs

支持的平台: Telegram、Discord、WhatsApp、Slack、Signal、Matrix、飞书、微信等。


3.4 Message 消息操作(发送/读取/管理)

# 发送文本消息openclaw message send --target <目标> --message "内容"# 发送带媒体的消息openclaw message send --target <目标> --message "内容" --media photo.jpg# 读取最近消息openclaw message read --channel <平台> --target <目标># 删除消息openclaw message delete --message-id <ID># 编辑消息openclaw message edit --message-id <ID> --message "新内容"# 添加表情反应openclaw message react --message-id <ID> --emoji "✅"# 创建投票openclaw message poll --channel discord --target <频道> --poll-question "问题?" --poll-option "选项1" --poll-option "选项2"# 置顶/取消置顶openclaw message pin --message-id <ID>openclaw message unpin --message-id <ID># 禁言/踢人(Discord 等群组平台)openclaw message ban --target <用户>openclaw message kick --target <用户>openclaw message timeout --target <用户> --duration <分钟>

3.5 Models 模型管理(AI 大脑的配置)

# 列出可用模型openclaw models list# 扫描 OpenRouter 免费模型(带工具和图像支持)openclaw models scan# 设置默认模型openclaw models set <model-id># 设置图像生成模型openclaw models set-image <model-id># 查看模型状态openclaw models status# 管理模型别名openclaw models aliases# 管理认证配置openclaw models auth# 设置模型 fallback 列表(主模型不可用时的备用)openclaw models fallbacksopenclaw models image-fallbacks

3.6 Infer 推理调用(直接调用 AI 能力)

# 列出可用能力openclaw infer list# 文本推理openclaw infer model --prompt "你的问题"# 图像生成openclaw infer image --prompt "描述"# 语音转文字openclaw infer audio --file audio.mp3# 文字转语音openclaw infer tts --text "要朗读的内容"# 嵌入向量openclaw infer embedding --text "内容"# 视频生成openclaw infer video --prompt "描述"# 网页能力openclaw infer web --url "https://..."

3.7 Skills 技能管理(扩展 Agent 能力)

# 列出可用技能openclaw skills list# 检查技能就绪状态openclaw skills check# 查看技能详情openclaw skills info <skill-name># 从 ClawHub 安装技能openclaw skills install <skill-name># 搜索技能openclaw skills search <关键词># 更新已安装技能openclaw skills update

3.8 Sessions 会话管理

# 列出存储的会话openclaw sessions list# 查看会话历史openclaw sessions history <session-key>

3.9 ACP 协议桥接(连接 Claude Code 等工具)

# 运行交互式 ACP 客户端openclaw acp client# 指定会话openclaw acp client --session <key># 重置会话openclaw acp client --reset-session

3.10 Node 节点主机(远程执行环境)

# 运行节点主机服务openclaw node run# 查看节点状态openclaw node status

3.11 Cron 定时任务

# 列出定时任务openclaw cron list# 添加定时任务openclaw cron add# 删除定时任务openclaw cron delete <job-id>

3.12 Backup 备份管理

# 创建备份openclaw backup create# 验证备份openclaw backup verify# 列出备份openclaw backup list

3.13 Config 配置管理

# 查看配置openclaw config get <key># 设置配置openclaw config set <key> <value># 删除配置项openclaw config unset <key># 验证配置文件openclaw config validate

3.14 其他实用命令

# 健康诊断openclaw doctor# 搜索记忆文件openclaw memory# 查看整体状态openclaw status# 查看日志openclaw logs# 更新 OpenClawopenclaw update# 查看更新状态openclaw update status# 安全审计openclaw security audit# 生成配对二维码openclaw qr# 打开控制面板openclaw dashboard# 打开终端 UIopenclaw tui# 重置本地状态openclaw reset# 卸载服务openclaw uninstall

四、实用场景与命令组合

场景 1:快速启动开发环境

# 1. 启动网关(开发模式,隔离状态)openclaw --dev gateway run# 2. 添加 Telegram 通道openclaw channels add --channel telegram --token <bot-token># 3. 添加 Agentopenclaw agents add my-assistant# 4. 绑定 Agent 到通道openclaw agents bind my-assistant# 5. 设置默认模型openclaw models set google/gemini-1.5-pro

场景 2:排查消息收发问题

# 1. 检查网关状态openclaw gateway status# 2. 检查通道状态openclaw channels status --probe# 3. 查看通道日志openclaw channels logs# 4. 查看网关日志openclaw logs# 5. 运行健康诊断openclaw doctor

场景 3:批量发送消息

# 广播消息到多个目标openclaw message broadcast --targets "+1234567890,+0987654321" --message "通知内容"

场景 4:自动化工作流

# 创建定时任务,每天扫描模型openclaw cron add --name "model-scan" --schedule "0 9 * * *" --command "openclaw models scan"

五、全局选项与技巧

5.1 全局选项(所有命令可用)

| 选项 | 作用 |

|——|——|

--dev | 开发模式(隔离状态到 ~/.openclaw-dev) |

--profile  | 使用指定配置文件 |

--log-level  | 设置日志级别(silent/fatal/error/warn/info/debug/trace) |

--no-color | 禁用颜色输出 |

--container  | 在指定容器内运行 |

5.2 实用技巧

# 开发模式测试(不影响生产配置)openclaw --dev gateway run# 使用指定配置文件openclaw --profile work gateway status# 详细日志排查问题openclaw --log-level debug gateway run# 查看命令帮助openclaw <command> --helpopenclaw <command> <subcommand> --help

六、常见问题速查

| 问题 | 解决命令 |

|——|———-|

| 网关无法启动 | openclaw doctor → openclaw gateway status |

| 消息发送失败 | openclaw channels status --probe |

| 模型无响应 | openclaw models status → openclaw models fallbacks |

| Agent 不回复 | openclaw agents bindings → openclaw gateway health |

| 忘记配置 | openclaw config get 或查看 ~/.openclaw/config.yaml |

| 需要备份 | openclaw backup create |

| 完全重置 | openclaw reset(保留 CLI) |


七、进阶:自定义与扩展

7.1 创建自定义 Skill

# 查看 Skill 模板openclaw skills info skill-creator# 使用 Skill 创建新 Skillopenclaw agent --to <your-agent> --message "create skill my-skill"

7.2 配置多模型 Fallback

# 设置主模型和备用模型openclaw models set google/gemini-1.5-proopenclaw models fallbacks add openai/gpt-4oopenclaw models fallbacks add anthropic/claude-3-5-sonnet

7.3 使用 ACP 连接外部工具

# 连接 Claude Codeopenclaw acp client --session agent:main:main# 连接其他 ACP 兼容工具openclaw acp client --url <gateway-url> --token <token>

八、总结与建议

新手路径:

1. openclaw gateway run — 启动网关

2. openclaw channels add — 连接消息平台

3. openclaw agents add — 创建 Agent

4. openclaw models set — 配置模型

日常维护:

• openclaw status — 每日检查

• openclaw gateway usage-cost — 监控成本

• openclaw skills update — 保持技能最新

排查问题:

• openclaw doctor — 自动诊断

• openclaw logs — 查看日志

• openclaw --log-level debug — 详细模式


📌 收藏本文,命令忘了随时查。OpenClaw 的命令设计很一致,掌握规律后举一反三。

💡 建议:把常用命令做成 shell alias 或脚本,效率更高。


本文基于 OpenClaw 2026.4.21 版本整理,命令可能随版本更新略有变化,建议以 openclaw  --help 为准。

hermes与oepn claw是不同的命令逻辑。请关注作者,下节分享hermes的操作命令大全,