开启左侧

OpenClaw 指令大全

[复制链接]
AI小编 发表于 5 天前 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
作者:范桂飓
目录

文章目录

    目录一、快速入门二、初始化与配置管理三、运维指令四、Gateway 管理五、Channel 管理六、Model 管理七、Multi-Agent 管理八、Session 管理九、Node 管理十、Cron 管理十一、Heartbeat 管理十二、Memory 管理十三、Message 管理十四、浏览器管理十五、安全管理十六、Skills 管理十七、Plugins 管理十八、Hooks 管理十九、Sandbox 管理二十、其他命令
      Approvals 管理docs 搜索TUI 界面二维码ClawHub
    二十一、斜杠命令

一、快速入门
  1. # 查看系统状态
  2. openclaw status
  3. # 诊断问题
  4. openclaw doctor
  5. # 查看日志
  6. openclaw logs --follow# 打开 Web 控制面板
  7. openclaw dashboard
  8. # 启动/重启 Gateway
  9. openclaw gateway restart
  10. # 更新版本
  11. openclaw update
复制代码
二、初始化与配置管理

首次使用时的配置向导。
  1. # 基础初始化
  2. openclaw setup
  3. # 运行向导
  4. openclaw setup --wizard# 引导式配置
  5. openclaw onboard
  6. # 配置向导
  7. openclaw configure
  8. # 配置特定部分
  9. openclaw configure --section models
  10. openclaw configure --section channels
  11. openclaw configure --section web
  12. # 查看配置文件路径
  13. openclaw config file# 获取配置值
  14. openclaw config get gateway.port
  15. openclaw config get agents.defaults.model.primary
  16. # 设置配置值
  17. openclaw config set gateway.port 19001
  18. openclaw config set agents.defaults.model.primary "anthropic/claude-opus-4-6"# 删除配置值
  19. openclaw config unset tools.web.search.apiKey
  20. # 验证配置
  21. openclaw config validate
  22. openclaw config validate --json
复制代码
路径语法:
  1. # 点号语法
  2. openclaw config get agents.defaults.workspace
  3. # 数组索引
  4. openclaw config get agents.list[0].id
  5. openclaw config set agents.list[1].tools.exec.node "node-1"
复制代码
三、运维指令
  1. # 快速状态概览
  2. openclaw status
  3. # 完整诊断(包括深度检查)
  4. openclaw status --all--verbose# 深度检测(探测所有渠道)
  5. openclaw status --deep# 显示用量信息
  6. openclaw status --usage# JSON 输出
  7. openclaw status --json# 基础健康检查
  8. openclaw health
  9. # JSON 格式
  10. openclaw health --json# 指定超时
  11. openclaw health --timeout5000# 基础检查
  12. openclaw doctor
  13. # 自动修复
  14. openclaw doctor --fix
  15. openclaw doctor --repair# 深度检查
  16. openclaw doctor --deep# 非交互模式
  17. openclaw doctor --non-interactive
  18. # 实时查看日志
  19. openclaw logs --follow# 查看最近 200 行
  20. openclaw logs --limit200# JSON 格式输出
  21. openclaw logs --json# 禁用颜色
  22. openclaw logs --plain# 创建备份
  23. openclaw backup create
  24. # 验证备份
  25. openclaw backup verify
  26. # 重置配置
  27. openclaw reset --scope config
  28. # 重置配置和凭证
  29. openclaw reset --scope config+creds+sessions
  30. # 完全重置
  31. openclaw reset --scope full
  32. # 非交互模式
  33. openclaw reset --scope config --yes --non-interactive
  34. # 卸载服务
  35. openclaw uninstall --service# 卸载状态数据
  36. openclaw uninstall --state# 卸载工作空间
  37. openclaw uninstall --workspace# 完全卸载
  38. openclaw uninstall --all# 非交互模式
  39. openclaw uninstall --all--yes --non-interactive
复制代码
四、Gateway 管理
  1. # 启动 Gateway(前台)
  2. openclaw gateway
  3. # 查看状态
  4. openclaw gateway status
  5. # 网关状态(含 RPC 探测)
  6. openclaw gateway status --probe# 网关健康检查
  7. openclaw gateway health
  8. # 安装为系统服务
  9. openclaw gateway install# 启动服务
  10. openclaw gateway start
  11. # 停止服务
  12. openclaw gateway stop
  13. # 重启服务
  14. openclaw gateway restart
  15. # 卸载服务
  16. openclaw gateway uninstall
复制代码
启动参数:
参数说明
--port <port>WebSocket 端口
--bind <loopback|lan|tailnet|auto>网络绑定模式
--token <token>访问令牌
--password <password>访问密码
--tailscale <off|serve|funnel>Tailscale 暴露模式
--dev开发模式
--verbose详细日志
--force强制启动(关闭占用端口的进程)
示例:
  1. # 指定端口和令牌启动
  2. openclaw gateway --port19001--token my-secret-token
  3. # 绑定到局域网
  4. openclaw gateway --bind lan
  5. # 通过 Tailscale 暴露
  6. openclaw gateway --tailscale serve
复制代码
五、Channel 管理
  1. # 查看已配置的渠道
  2. openclaw channels list
  3. # 查看渠道状态
  4. openclaw channels status
  5. # 健康检查(探测渠道)
  6. openclaw channels status --probe# 探测渠道能力
  7. openclaw channels capabilities
  8. # 添加渠道账号
  9. openclaw channels add--channel telegram --token<bot-token>
  10. openclaw channels add--channel discord --token<bot-token>
  11. openclaw channels add--channel feishu --app-id <id> --app-secret <secret># 删除渠道账号
  12. openclaw channels remove --channel telegram --delete# 查看渠道日志
  13. openclaw channels logs --channel all
  14. openclaw channels logs --channel telegram --lines50# 登录/登出(WhatsApp)
  15. openclaw channels login --channel whatsapp
  16. openclaw channels logout--channel whatsapp
复制代码
支持的渠道:
渠道说明
feishu飞书 / Lark
telegramTelegram
discordDiscord
whatsappWhatsApp
slackSlack
signalSignal
imessageiMessage
msteamsMicrosoft Teams
googlechatGoogle Chat
管理 DM(私聊)配对请求:
  1. # 查看待配对请求
  2. openclaw pairing list feishu
  3. # 批准配对
  4. openclaw pairing approve feishu <CODE># 批准并通知
  5. openclaw pairing approve feishu <CODE>--notify
复制代码
六、Model 管理
  1. # 查看模型状态
  2. openclaw models status
  3. # 测试模型认证
  4. openclaw models status --probe# 列出可用模型
  5. openclaw models list
  6. openclaw models list --all# 设置默认模型
  7. openclaw models set anthropic/claude-opus-4-6
  8. # 设置图像模型
  9. openclaw models set-image openai/gpt-4.1
  10. # 扫描可用模型
  11. openclaw models scan
  12. # 列出别名
  13. openclaw models aliases list
  14. # 添加别名
  15. openclaw models aliases add opus anthropic/claude-opus-4-6
  16. # 删除别名
  17. openclaw models aliases remove opus
  18. # 列出 fallback
  19. openclaw models fallbacks list
  20. # 添加 fallback
  21. openclaw models fallbacks add openai/gpt-4.1
  22. # 删除 fallback
  23. openclaw models fallbacks remove openai/gpt-4.1
  24. # 清空 fallback
  25. openclaw models fallbacks clear# 添加认证
  26. openclaw models auth add# Setup-token
  27. openclaw models auth setup-token --provider anthropic
  28. # 粘贴 token
  29. openclaw models auth paste-token --provider anthropic
复制代码
七、Multi-Agent 管理
  1. # 列出所有 Agent
  2. openclaw agents list
  3. openclaw agents list --bindings# 同时显示路由绑定# 创建 Agent(进入向导流程)
  4. openclaw agents add work
  5. # 创建 Agent(指定参数)
  6. openclaw agents add personal --workspace ~/.openclaw/workspace-personal
  7. # 添加一个专门处理前端开发的代理
  8. openclaw agents add\--workspace ~/.openclaw/workspace/fe-dev \--model claude-sonnet-4-2 \--bind telegram:work
  9. # 添加一个专门处理后端开发的代理
  10. openclaw agents add\--workspace ~/.openclaw/workspace/be-dev \--model claude-sonnet-4-2 \--bind slack:backend
  11. # 删除 Agent(操作不可恢复)
  12. openclaw agents delete work --force# 查看绑定
  13. openclaw agents bindings
  14. # 添加绑定
  15. openclaw agents bind--agent work --bind feishu:work-bot
  16. # 移除绑定
  17. openclaw agents unbind --agent work --bind feishu:work-bot
  18. openclaw agents unbind --agent work --all# 基础对话
  19. openclaw agent --message"你好"# 指定目标
  20. openclaw agent --message"提醒我开会"--to"+15555550123"# 指定渠道
  21. openclaw agent --message"你好"--channel telegram
  22. # 本地运行
  23. openclaw agent --message"你好"--local# 设置思考级别
  24. openclaw agent --message"分析这个问题"--thinking high
复制代码
八、Session 管理
  1. # 列出会话
  2. openclaw sessions
  3. # 列出特定 Agent 的会话
  4. openclaw sessions --agent work
  5. # 列出所有 Agent 的会话
  6. openclaw sessions --all-agents
  7. # 查看最近活跃的会话(最近 120 分钟)
  8. openclaw sessions --active120# 清理会话(预览)
  9. openclaw sessions cleanup --dry-run
  10. # 执行清理
  11. openclaw sessions cleanup --enforce
复制代码
九、Node 管理
  1. # 添加节点
  2. openclaw nodeadd${name}
  3. openclaw nodeadd macos-app
  4. # 运行 Node Host(前台)
  5. openclaw node run --host<gateway-ip>--port18789# 安装为系统服务
  6. openclaw nodeinstall--host<gateway-ip>--port18789 --display-name "Build Node"# 查看状态
  7. openclaw node status
  8. # 启动服务
  9. openclaw node start
  10. # 停止服务
  11. openclaw node stop
  12. # 重启服务
  13. openclaw node restart
  14. # 卸载服务
  15. openclaw node uninstall
  16. # 查看所有节点状态
  17. openclaw nodes status
  18. # 列出节点
  19. openclaw nodes list
  20. # 查看待批准请求
  21. openclaw nodes pending
  22. # 批准节点
  23. openclaw nodes approve <requestId># 拒绝节点
  24. openclaw nodes reject <requestId># 重命名节点
  25. openclaw nodes rename--node<id>--name"New Name"# 查看节点详情
  26. openclaw nodes describe --node<id># 在节点上执行命令
  27. openclaw nodes run --node<id> -- echo"hello"# 发送通知(macOS)
  28. openclaw nodes notify --node<id>--title"提醒"--body"会议开始了"# 列出设备
  29. openclaw devices list
  30. # 批准设备
  31. openclaw devices approve <requestId>
  32. openclaw devices approve --latest# 拒绝设备
  33. openclaw devices reject <requestId># 移除设备
  34. openclaw devices remove <deviceId># 清除所有设备
  35. openclaw devices clear--yes
复制代码
十、Cron 管理

OpenClaw 内置了强大的定时任务系统,支持 3 种任务类型:
类型说明
system-event在主会话中触发系统事件
agent-turn在隔离会话中运行 AI 代理任务
message直接发送消息到指定频道
  1. # 查看状态
  2. openclaw cron status
  3. # 列出任务
  4. openclaw cron list
  5. # 添加任务(每天早上 9 点)
  6. openclaw cronadd\--name"daily-report"\--cron"0 9 * * *"\
  7.   --system-event "生成日报"# 添加每周一早上的周报提醒
  8. openclaw cronadd\--name"周报提醒"\--cron"0 9 * * 1"\
  9.   --system-event "提交周报的日子到了!"# 添加每天早上 9 点的提醒
  10. openclaw cronadd\--name"晨间提醒"\--cron"0 9 * * *"\
  11.   --system-event "记得喝咖啡 ☕️"# 编辑任务
  12. openclaw cron edit <id># 删除任务
  13. openclaw cronrm<id># 启用/禁用任务
  14. openclaw cronenable<id>
  15. openclaw cron disable <id># 查看运行记录
  16. openclaw cron runs --id<id># 立即运行
  17. openclaw cron run <id>
复制代码
十一、Heartbeat 管理

创建 ~/.openclaw/workspace/HEARTBEAT.md 文件:
  1. # 心跳检查清单
  2. 每次心跳时执行:
  3. - [] 检查邮件
  4. - [] 检查日历
  5. - [] 检查待办事项
  6. - [] 更新记忆文件
复制代码
控制心跳:
  1. # 查看最后一次心跳
  2. openclaw system heartbeat last
  3. # 启用心跳系统
  4. openclaw system heartbeat enable# 禁用心跳系统
  5. openclaw system heartbeat disable
复制代码
十二、Memory 管理

OpenClaw 支持通过 CLI 来索引和搜索你的 MEMORY.md 文件,让它记住重要信息。
  1. # 查看记忆状态
  2. openclaw memory status
  3. # 重新索引记忆文件
  4. openclaw memory index
  5. # 搜索记忆内容
  6. openclaw memory search "项目进度"# 搜索需要密码的内容
  7. openclaw memory search "SSH 凭证"
复制代码
十三、Message 管理

[code]# 发送文本消息
openclaw message send --target"+15555550123"--message"你好"# 发送到 Telegram
openclaw message send \--channel telegram \--target"@your_bot"\--message"Hello from OpenClaw!"# 发送到 WhatsApp
openclaw message send \--channel whatsapp \--target"+8613800138000"\--message"测试消息"# 发送到 Discord 频道
openclaw message send \--channel discord \--target"channel:1234567890"\--message"@here 重要通知"# 发送图片
openclaw message send --target"+15555550123"--media /path/to/image.jpg

# 创建投票
openclaw message poll \--channel discord \--target"channel:123"\
  --poll-question "这周五聚餐吃什么?"\
  --poll-option "火锅"\
  --poll-option "烧烤"\
  --poll-option "西餐"# 发送表情回应
openclaw message react \--channel discord \--target"channel:123"\
  --message-id "456"\--emoji"
OpenClaw 指令大全-1.png
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

发布主题
阅读排行更多+

Powered by Discuz! X3.4© 2001-2013 Discuz Team.( 京ICP备17022993号-3 )