OpenClaw CLI 常用指令速查表
🚀 每日啟動
openclaw gateway --force # 強制重啟 Gateway(最常用)
openclaw status # 查看整體狀態
openclaw logs --follow # 即時追蹤日誌如果你萬不幸遇到 token misatch 問題,
gateway connect failed: GatewayClientRequestError: unauthorized: gateway token mismatch (provide gateway auth token)
可執行以下方式重啟 :
# 1. 停用 token 認證(token 不同步的根本解法)
openclaw config set gateway.auth.mode none
# 2. 用 systemctl 正確重啟(不要用 kill)
systemctl --user restart openclaw-gateway.service然後執行 :
openclaw health
應該就沒事了~
然後如果你是個 Web ui 重度患者,一定要前往 : http://127.0.0.1:18789/
你可以執行 :
cat ~/.openclaw/openclaw.json找到 gateway :
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"auth": {
"mode": "none",
"token": "b08e11828■■■■■■■■■ 馬賽克 ■■■■■■■■■f20ca1b0"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
},把
b08e11828■■■■■■■■■ 馬賽克 ■■■■■■■■■f20ca1b0貼到 Web ui 的 token 欄位,即可正常使用。(密碼可以空白)
🔍 診斷與除錯
openclaw doctor # 系統健康檢查
openclaw security audit # 安全稽核
openclaw gateway probe # 測試 Gateway 連線
openclaw health # 快速健康狀態🤖 模型管理
openclaw models list # 列出所有可用模型
openclaw models set <model> # 設定預設模型設定模型範例 :
# 把 Openclaw 模型設定成 claude-haiku-4-5-2025100
openclaw config set agents.defaults.model.primary "anthropic/claude-haiku-4-5-20251001"📱 Telegram 操作
openclaw status # 查看 Telegram 連線狀態
openclaw pairing approve telegram <code> # 配對新裝置
openclaw message send --channel telegram --target <ID> --message "訊息"
openclaw directory # 查詢用戶/群組 ID⚙️ 設定管理
openclaw config get <key> # 查看設定值
openclaw config set <key> <value> # 修改設定
openclaw config unset <key> # 刪除設定
openclaw config validate # 驗證設定檔
openclaw config file # 查看設定檔路徑常用的 <key> 整理:
模型設定
agents.defaults.model.primary # 預設模型
agents.defaults.maxConcurrent # 最大並發 Agent 數
agents.defaults.subagents.maxConcurrent # 最大子 Agent 數
agents.defaults.sandbox.mode # 沙箱模式 (off/all)
agents.defaults.compaction.mode # 壓縮模式Gateway 設定
gateway.port # Gateway 埠號
gateway.mode # 模式 (local/remote)
gateway.bind # 綁定方式 (loopback/all)
gateway.auth.mode # 認證模式
gateway.auth.token # 認證 Token
gateway.tailscale.mode # Tailscale 模式Telegram 設定
channels.telegram.enabled # 啟用/停用
channels.telegram.botToken # Bot Token
channels.telegram.dmPolicy # 私訊策略
channels.telegram.groupPolicy # 群組策略 (open/allowlist)
channels.telegram.allowFrom # 允許的用戶 ID 列表
channels.telegram.streaming # 串流模式工具設定
tools.profile # 工具配置 (coding/default)
tools.deny # 停用的工具列表
tools.exec.allow # 允許執行的指令訊息設定
messages.ackReactionScope # 訊息確認範圍
session.dmScope # Session 範圍指令設定
commands.native # 原生指令模式
commands.restart # 自動重啟
commands.ownerDisplay # 擁有者顯示方式範例:
openclaw config get agents.defaults.model.primary
openclaw config set gateway.port 18790
openclaw config set channels.telegram.allowFrom '["7297166122"]'🔒 安全設定
openclaw config set agents.defaults.sandbox.mode all # 開啟沙箱
openclaw config set channels.telegram.allowFrom '["你的ID"]' # 設定白名單
openclaw config set channels.telegram.groupPolicy allowlist # 群組白名單模式
chmod 700 ~/.openclaw/credentials # 修復憑證權限🧩 技能與插件
npx clawhub@latest install <skill> # 安裝技能
openclaw skills list # 列出已安裝技能
openclaw plugins list # 列出插件
openclaw hooks list # 列出 hooks📊 Session 管理
openclaw sessions list # 列出所有 session
openclaw memory search <keyword> # 搜尋記憶
openclaw memory reindex # 重建記憶索引🔄 更新與重置
openclaw update # 更新 OpenClaw
openclaw reset # 重置設定(保留 CLI)
openclaw uninstall # 完全解除安裝📋 CLI 語法
openclaw --help # 查看所有指令
openclaw <module> --help # 查看模組說明
openclaw --version # 查看版本💡 設定檔位置:
~/.openclaw/openclaw.json
💡 Dashboard:http://127.0.0.1:18789(需 SSH Tunnel)
💡 日誌位置:~/.openclaw/logs/
結語
OpenClaw CLI 提供完整的命令列工具,讓開發者可以直接在終端機管理 AI Agent 系統。透過熟悉 CLI 指令,你可以更有效率地部署模型、管理代理以及建立自動化工作流程。
很麻煩,所以讓我們來 — 英特艾



