跳到正文
🛠️ 使用技巧避坑指南 · 第 10 章 入门

避坑命令速查:诊断和修复常用的 openclaw 命令

专门针对排障场景整理的命令速查:doctor 诊断、日志查看、强制重启、配置验证。

⏱ 5 分钟 🔧 入门
🎖️ 任务奖励 — 学完你能做到

遇到问题第一时间知道该跑哪个命令来诊断

📖 所有常用命令一页搞定,随时查阅


基础与诊断

命令用途
openclaw --version查看版本
openclaw status --all全局状态总览
openclaw gateway statusGateway 状态
openclaw doctor自动诊断配置问题
openclaw doctor --fix自动修复可修复的问题
openclaw logs --follow实时跟踪日志
openclaw logs --level error只看错误日志

配置管理

命令用途
openclaw config get <key>查看某项配置
openclaw config set <key> <value>修改某项配置
openclaw config list列出所有配置
openclaw gateway restart重启 Gateway
openclaw auth refresh刷新鉴权 token

Skills 管理

命令用途
openclaw skills list列出已安装 Skills
openclaw skills list --builtin列出内置 Skills
openclaw skills list --eligible列出符合当前环境的 Skills
openclaw skills install <name>安装 Skill
openclaw skills disable <name>禁用 Skill(不删除)
openclaw skills uninstall <name>卸载 Skill
openclaw skills update --all更新所有 Skills
openclaw skills search <keyword>搜索 ClawHub 技能市场
openclaw skills info <name>查看 Skill 详细信息

频道与 Cron

命令用途
openclaw channels status --probe探测所有频道连通性
openclaw channels list列出已配置频道
openclaw channels add添加新渠道(交互式)
openclaw pairing approve <channel> <code>配对批准
openclaw cron list列出所有 Cron 任务
openclaw cron run <name>手动触发 Cron 任务
openclaw cron disable <name>禁用 Cron 任务

会话内快捷命令(聊天中输入)

命令用途
/new开启新 session(清除当前 context)
/compact压缩当前 session 历史(减少 token)
/context list查看当前已加载的工作区文件
/context detail查看 token 用量明细
/reload重新加载所有工作区文件(不重启)
/help显示所有可用快捷命令

常用配置一键命令

# 关闭 Thinking 模式(省 10-50x 成本)
openclaw config set agent.thinking false

# 限制最大上下文
openclaw config set agent.contextTokens 50000

# 改 dmScope 为 per-peer(多人场景必做)
openclaw config set gateway.dmScope per-peer

# Heartbeat 间隔改为 1 小时
openclaw config set agent.heartbeat.every 1h

Git 追踪工作区(推荐必做)

# 初始化(只做一次)
cd ~/.openclaw/workspace && git init && git add -A
git commit -m "初始配置存档"

# 每次修改后提交
git commit -am "SOUL.md: 移走决策分级到 AGENTS.md"

# agent 行为出错时,快速定位是哪次改动导致的
git log --oneline -20
git diff HEAD~3 SOUL.md

# 恢复到上一个稳定版本
git checkout HEAD~1 SOUL.md

五步诊断法(遇到问题先跑这个)

openclaw status --all              # Step 1:全局状态总览
openclaw gateway status            # Step 2:Gateway 状态
openclaw doctor                    # Step 3:配置问题诊断
openclaw channels status --probe   # Step 4:频道连通性探测
openclaw logs --follow             # Step 5:实时日志跟踪

← 附录A:15条坑与桥 | 返回目录 | 核心结论 →