OpenClaw指令分类详解与使用指南

Written by

in

文章目录
  • OpenClaw的命令体系设计清晰,分为CLI命令和斜杠命令两大类别,覆盖了从系统管理到日常使用的所有场景。掌握这些命令,您就能充分发挥OpenClaw作为个人AI助手的强大能力。 核心要点: 配置修改后必须重启网关:openclaw gateway restart 出问题先跑诊断:openclaw doctor 实时查看日志:openclaw logs –follow 多环境隔离:使用–profile参数 技能扩展:通过ClawHub社区安装 这份命令大全基于2026年5月的最新资料整理,涵盖了OpenClaw的所有核心功能。建议收藏本文,使用时通过Ctrl+F快速查找所需命令。 以上就是OpenClaw指令分类详解与使用指南的详细内容,更多关于OpenClaw指令分类与使用的资料请关注风君子博客其它相关文章!
  • 目录
    • 一、基础与安装命令
      • 1.1 版本与环境
      • 1.2 安装与初始化
      • 1.3 全局选项
    • 二、配置管理命令
      • 2.1 配置读写
      • 2.2 常用配置路径
    • 三、网关服务命令
      • 3.1 生命周期管理
      • 3.2 服务安装
      • 3.3 调试与发现
      • 3.4 网关选项
    • 四、模型管理命令
      • 4.1 基本操作
      • 4.2 别名管理
      • 4.3 回退模型
      • 4.4 认证管理
    • 五、渠道管理命令
      • 5.1 渠道操作
      • 5.2 渠道添加示例
    • 六、技能与插件命令
      • 6.1 技能管理
      • 6.2 插件管理
      • 6.3 ClawHub社区技能
    • 七、消息与会话命令
      • 7.1 消息操作
      • 7.2 会话管理
      • 7.3 Agent管理
    • 八、诊断与维护命令
      • 8.1 健康检查
      • 8.2 日志管理
      • 8.3 系统管理
      • 8.4 安全与备份
    • 九、聊天斜杠命令(Slash Commands)
      • 9.1 会话管理
      • 9.2 模型控制
      • 9.3 技能与工具
      • 9.4 操作控制
      • 9.5 信息查询
    • 十、高级与扩展命令
      • 10.1 定时任务
      • 10.2 浏览器控制
      • 10.3 节点管理
      • 10.4 配对管理
    • 十一、故障排查流程
      • 11.1 标准排查步骤
      • 11.2 常见问题解决
    • 十二、命令使用频率统计
      • 高频命令(每日使用)
      • 中频命令(每周使用)
      • 低频命令(每月使用)
    • 十三、实用技巧与最佳实践
      • 13.1 多环境管理
      • 13.2 脚本自动化
      • 13.3 快捷键与别名
      • 13.4 配置文件位置
    • 十四、总结

      OpenClaw 提供了丰富的命令行工具,分为终端CLI命令聊天斜杠命令两大类。以下是基于2026年5月最新资料的完整分类介绍。

      命令 功能 示例
      openclaw --version / -V 查看当前版本 openclaw --version
      openclaw --help / -h 显示所有命令帮助 openclaw --help
      openclaw tui 启动终端交互界面 openclaw tui
      openclaw dashboard 打开网页管理控制台 openclaw dashboard

      命令 功能 说明
      openclaw setup 初始化配置和工作区 首次安装后必须执行
      openclaw onboard 交互式引导流程 依次配置Gateway、工作区、Skills
      openclaw configure 交互式配置向导 修改模型、频道、技能等核心配置
      openclaw update 更新CLI到最新版本 openclaw update --channel stable
      openclaw uninstall 卸载Gateway服务和相关数据 openclaw uninstall --all --yes

      选项 功能 说明
      --dev 开发模式 独立配置+端口18790
      --profile <name> 多配置文件隔离 工作/个人环境分开
      --log-level <level> 设置日志级别 silent/fatal/error/warn/info/debug/trace
      --no-color 禁用彩色输出 脚本中使用
      --json JSON格式输出 机器可读格式

      命令 功能 示例
      openclaw config get <path> 读取指定配置值 openclaw config get gateway.port
      openclaw config set <path> <value> 设置配置值 openclaw config set gateway.port 18789
      openclaw config unset <path> 删除配置项 openclaw config unset channels.telegram
      openclaw config file 显示配置文件路径 openclaw config file
      openclaw config validate 校验配置文件有效性 openclaw config validate

      # 设置网关模式
      openclaw config set gateway.mode local
      # 设置绑定模式
      openclaw config set gateway.bind loopback
      # 设置API密钥
      openclaw config set providers.anthropic.apiKey "sk-ant-xxxxx"
      # 禁用记忆搜索
      openclaw config set agents.defaults.memorySearch.enabled false

      命令 功能 说明
      openclaw gateway / openclaw gateway run 前台运行Gateway 常搭配screen或tmux使用
      openclaw gateway start 后台启动Gateway服务 系统服务方式运行
      openclaw gateway stop 停止Gateway服务 临时暂停或维护
      openclaw gateway restart 重启Gateway服务 修改配置后最常用
      openclaw gateway status 探测Gateway RPC状态 检查服务是否存活

      命令 功能 说明
      openclaw gateway install 安装为系统服务 systemd/launchd等
      openclaw gateway uninstall 卸载系统服务 彻底移除服务

      命令 功能 示例
      openclaw gateway call <method> 调用指定RPC方法 openclaw gateway call health
      openclaw gateway probe 探测Gateway 调试连接问题时使用
      openclaw gateway discover 发现局域网中的Gateway实例 多实例环境使用

      # 指定端口启动
      openclaw gateway --port 18789
      
      # 强制杀掉占用端口并启动
      openclaw gateway --force
      
      # 详细日志输出
      openclaw gateway --verbose
      
      # 设置命令超时时间
      openclaw gateway --timeout 30000
      
      # 绑定模式设置
      openclaw gateway --bind loopback  # 仅本地
      openclaw gateway --bind lan       # 局域网
      openclaw gateway --bind tailnet   # Tailscale网络
      

      命令 功能 示例
      openclaw models list 列出所有可用模型 openclaw models list
      openclaw models status 模型状态概览 openclaw models status
      openclaw models status --probe 带探测的模型状态检查 深度检查模型可用性
      openclaw models set <name> 设置默认模型 openclaw models set glm-4.7-flash
      openclaw models set-image <name> 设置图片生成模型 openclaw models set-image dalle-3

      命令 功能 示例
      openclaw models aliases list 列出模型别名 openclaw models aliases list
      openclaw models aliases add <alias> <model> 添加模型别名 openclaw models aliases add gpt gpt-4
      openclaw models aliases remove <alias> 移除模型别名 openclaw models aliases remove gpt

      命令 功能 说明
      openclaw models fallbacks list 列出回退模型列表 主模型不可用时使用
      openclaw models fallbacks add <model> 添加回退模型 openclaw models fallbacks add glm-4.7
      openclaw models fallbacks remove <model> 移除回退模型 清理不需要的回退模型
      openclaw models fallbacks clear 清空回退模型列表 重置回退配置

      命令 功能 说明
      openclaw models auth add 添加模型认证 配置API密钥
      openclaw models auth setup-token 交互式设置API token 推荐使用OAuth流程
      openclaw models auth paste-token 直接粘贴API token 快速配置
      openclaw models auth order get 查看认证提供商顺序 优先级排序
      openclaw models auth order set 设置认证提供商顺序 调整认证优先级

      命令 功能 示例
      openclaw channels list 显示所有已配置频道 openclaw channels list
      openclaw channels status 检查频道健康状态 openclaw channels status
      openclaw channels status --probe 带深度探测的频道状态检查 详细诊断
      openclaw channels add 向导式添加新频道 openclaw channels add
      openclaw channels login 交互式登录 WhatsApp扫码登录
      openclaw channels login --channel <name> 登录指定频道 openclaw channels login --channel whatsapp
      openclaw channels logout 登出频道 断开连接
      openclaw channels remove 禁用并移除频道 openclaw channels remove --channel telegram

      # Telegram
      openclaw channels add --channel telegram --token "BOT_TOKEN"
      
      # Discord
      openclaw channels add --channel discord --token "BOT_TOKEN"
      
      # WhatsApp(扫码登录)
      openclaw channels login --channel whatsapp
      
      # 飞书
      openclaw channels add --channel feishu --app-id "APP_ID" --app-secret "APP_SECRET"
      

      命令 功能 示例
      openclaw skills list 列出所有已加载技能 openclaw skills list
      openclaw skills info <name> 查看指定技能详细信息 openclaw skills info browser
      openclaw skills check 就绪/缺失状态摘要 检查技能依赖
      openclaw skills install <name> 安装新技能 openclaw skills install browser
      openclaw skills enable <name> 启用技能 openclaw skills enable browser
      openclaw skills disable <name> 禁用技能 openclaw skills disable browser

      命令 功能 示例
      openclaw plugins list 发现并列出所有插件 openclaw plugins list
      openclaw plugins info <name> 查看插件详细信息 openclaw plugins info feishu
      openclaw plugins install <name> 安装插件 支持本地路径、tgz或npm包名
      openclaw plugins enable <name> 启用插件 openclaw plugins enable feishu
      openclaw plugins disable <name> 禁用插件 openclaw plugins disable feishu
      openclaw plugins doctor 插件加载错误诊断报告 排查插件问题

      # 搜索技能
      clawhub search "weather"
      
      # 安装技能
      clawhub install weather
      
      # 同步所有技能
      clawhub sync --all
      
      # 列出已安装技能
      clawhub list
      

      命令 功能 示例
      openclaw message send 发送消息 openclaw message send --target +15555550123 --message "Hi"
      openclaw message edit 编辑已发送的消息 openclaw message edit --message-id 123 --message "Updated"
      openclaw message delete 删除消息 openclaw message delete --message-id 123
      openclaw message poll 创建投票 openclaw message poll --question "Snack?" --option Pizza --option Sushi
      openclaw message react 添加/移除反应 openclaw message react --emoji "✅"
      openclaw message broadcast 广播消息到多个目标 群发消息

      命令 功能 示例
      openclaw sessions list 列出所有会话 openclaw sessions list
      openclaw sessions history 查看会话历史 openclaw sessions history <session-key>
      openclaw memory 管理记忆 openclaw memory search "会议记录"
      openclaw memory index 重建向量索引 修复记忆索引错误

      命令 功能 示例
      openclaw agents list 列出所有已配置的agents openclaw agents list
      openclaw agents add [name] 通过向导添加新agent openclaw agents add assistant
      openclaw agents delete <name> 删除指定agent openclaw agents delete old-assistant
      openclaw agents bindings 列出所有路由绑定 查看agent与渠道的绑定关系
      openclaw agents bind 添加路由绑定 将agent绑定到频道/群组
      openclaw agents unbind 移除路由绑定 解除绑定关系

      命令 功能 说明
      openclaw doctor 最有用的单条命令 全面健康检查并提供快速修复建议
      openclaw doctor --fix 自动修复常见问题 自动修正配置文件权限等
      openclaw doctor --deep 深度诊断 复杂故障排查
      openclaw health 获取运行中Gateway的健康状态 快速确认核心组件状态
      openclaw status 显示会话健康状态和最近接收者 整体运行状态概览

      命令 功能 示例
      openclaw logs 查看Gateway日志 openclaw logs
      openclaw logs --follow 实时查看运行日志 类似 tail -f
      openclaw logs --filter error 仅查看错误日志 快速定位故障
      openclaw logs --start "2026-03-13" 指定开始时间 时间范围查询
      openclaw logs --search "error" 关键词过滤 搜索特定内容

      命令 功能 示例
      openclaw system event --text <msg> 向系统事件队列入队一条事件 测试事件系统
      openclaw system heartbeat last 查看上次心跳时间 检查定时任务
      openclaw system heartbeat enable 启用心跳 开启定时任务
      openclaw system heartbeat disable 禁用心跳 关闭定时任务
      openclaw system presence 列出系统在线状态 查看连接状态

      命令 功能 说明
      openclaw security audit 安全审计 检查安全配置
      openclaw security audit --deep 深度安全审计 全面安全检查
      openclaw secrets reload 刷新敏感密钥 重新加载密钥
      openclaw backup create 创建系统备份 备份配置和数据
      openclaw reset 重置系统状态 谨慎使用,保留CLI
      openclaw uninstall --all --yes 彻底卸载 清理所有数据

      命令 功能 说明
      /new 开启新会话线程 清空上下文,节省token
      /new <描述> 带目标启动新会话 指定会话目标
      /reset 重置当前会话 /new
      /status 查看当前会话状态 包括模型、上下文、队列等信息
      /compact 压缩上下文 释放上下文窗口空间
      /history 查看会话历史记录 浏览对话历史
      /pause 暂停当前任务 临时停止AI执行

      命令 功能 示例
      /model <名称> 切换模型 /model glm-4.7-flash
      /reasoning 开启/关闭深度推理模式 /reasoning on
      /reasoning <级别> 调整推理级别 /reasoning high
      /think <级别> 设置思考级别 /think medium
      /verbose on/off 开启/关闭详细输出 /verbose on

      命令 功能 示例
      /skills 查看已安装技能 列出所有可用技能
      /skill <name> [input] 直接运行技能 /skill weather 北京
      /agents 查看可用Agent 列出所有Agent
      /memory 查看或管理AI的记忆 查询AI记住的信息
      /forget 忘记特定信息 清除记忆

      命令 功能 说明
      /stop 中止当前正在运行的任务 紧急停止
      /approve 批准配对请求 允许新联系人
      /deny 拒绝配对请求 拒绝新联系人
      /cancel 取消当前操作 取消正在执行的任务
      /undo 撤销上一步操作 回退操作

      命令 功能 说明
      /help 显示帮助信息 列出可用命令列表
      /commands 查看所有命令 /help
      /cost 查看使用费用 查询API调用成本
      /version 查看版本信息 显示OpenClaw版本
      /ping 测试连接状态 检查服务是否正常
      /deliver 交付当前任务结果 完成并输出结果

      命令 功能 示例
      openclaw cron list 查看定时任务 openclaw cron list
      openclaw cron add 添加定时任务 openclaw cron add "0 9 * * *" "check_disk"
      openclaw cron edit <id> 编辑定时任务 修改任务配置
      openclaw cron rm <id> 删除定时任务 移除指定任务
      openclaw cron run <id> 立即执行定时任务 手动触发任务

      命令 功能 示例
      openclaw browser start 启动浏览器 开启浏览器实例
      openclaw browser open <url> 打开网页 openclaw browser open https://example.com
      openclaw browser click <selector> 点击元素 openclaw browser click "#login"
      openclaw browser type <selector> <text> 输入文本 openclaw browser type "#username" "admin"
      openclaw browser screenshot 截图 保存当前页面截图

      命令 功能 说明
      openclaw node run 前台运行headless node host 调试模式
      openclaw node start 启动node host服务 后台运行
      openclaw node stop 停止node host服务 关闭节点
      openclaw node restart 重启node host服务 重新启动
      openclaw node status 显示node host状态 检查节点状态
      openclaw nodes 管理移动节点 查看所有节点

      命令 功能 说明
      openclaw pairing list 查看待处理的配对请求 审批新联系人
      openclaw pairing approve 批准配对请求 允许新联系人
      openclaw pairing deny 拒绝配对请求 拒绝新联系人

      # 1. 检查状态
      openclaw gateway status
      
      # 2. 查看日志
      openclaw logs --follow
      
      # 3. 健康检查
      openclaw doctor
      
      # 4. 自动修复
      openclaw doctor --fix
      
      # 5. 重启服务
      openclaw gateway restart
      

      问题 解决方案
      配置修改不生效 openclaw gateway restart
      JSON语法错误 openclaw doctor --fix
      网关宕机 openclaw doctor --deep
      记忆索引错误 openclaw memory index
      授权过期 openclaw models auth setup-token
      不回复私聊 进入Pairing List手动批准
      群聊静默 检查MentionPatterns配置

      1. openclaw gateway restart – 修改配置后必用
      2. openclaw doctor – 出问题先跑这个
      3. openclaw status – 快速检查状态
      4. openclaw logs --follow – 实时查看日志
      5. /new – 开启新会话

      1. openclaw models set – 切换模型
      2. openclaw skills install – 安装新技能
      3. openclaw channels status – 检查渠道连接
      4. openclaw config set – 修改配置
      5. clawhub search – 搜索技能

      1. openclaw update – 更新版本
      2. openclaw backup create – 创建备份
      3. openclaw security audit – 安全审计
      4. openclaw reset – 重置配置
      5. openclaw uninstall – 卸载系统

      # 工作环境
      openclaw --profile work gateway start
      
      # 个人环境
      openclaw --profile personal gateway start
      
      # 开发环境
      openclaw --dev gateway start
      

      # 批量执行命令
      openclaw run --batch commands.txt
      
      # 管道输入
      echo "分析这段代码" | openclaw run
      
      # JSON输出处理
      openclaw models list --json | jq '.models[] | select(.provider=="openai")'
      

      # 创建别名(在~/.bashrc或~/.zshrc中)
      alias claw='openclaw'
      alias claw-status='openclaw gateway status'
      alias claw-restart='openclaw gateway restart'
      alias claw-logs='openclaw logs --follow'
      alias claw-doctor='openclaw doctor --fix'
      

      • 主配置~/.openclaw/openclaw.json
      • 工作区~/.openclaw/workspace/
      • 技能目录~/.openclaw/skills/
      • Agent数据~/.openclaw/agents/
      • 日志文件~/.openclaw/logs/

      OpenClaw的命令体系设计清晰,分为CLI命令斜杠命令两大类别,覆盖了从系统管理到日常使用的所有场景。掌握这些命令,您就能充分发挥OpenClaw作为个人AI助手的强大能力。

      核心要点

      1. 配置修改后必须重启网关openclaw gateway restart
      2. 出问题先跑诊断openclaw doctor
      3. 实时查看日志openclaw logs --follow
      4. 多环境隔离:使用--profile参数
      5. 技能扩展:通过ClawHub社区安装

      这份命令大全基于2026年5月的最新资料整理,涵盖了OpenClaw的所有核心功能。建议收藏本文,使用时通过Ctrl+F快速查找所需命令。

      以上就是OpenClaw指令分类详解与使用指南的详细内容,更多关于OpenClaw指令分类与使用的资料请关注风君子博客其它相关文章!

      站内搜索