OpenClaw Ops
在一台跑著 OpenClaw 的機器上(本機,或 SSH 進去的遠端)做運維、配置、診斷。
不寫 agent 人格與 workspace —— 那是 openclaw-agent-builder 的工作。
這份 skill 涵蓋:
- 配置:
~/.openclaw/openclaw.json 的讀寫、openclaw config get/set/unset
- 服務:gateway 與 daemon 的安裝、啟停、重啟、健康檢查
- 連線:channels 帳號的增刪、登入、查狀態、看 log
- 模型:
openclaw models 的 list/status/set/auth
- 排程:
openclaw cron
- 延伸:
openclaw plugins、openclaw hooks、openclaw webhooks
- 隔離:
openclaw sandbox
- 稽核:
openclaw doctor、openclaw security audit、openclaw status、openclaw logs
- 重置:
openclaw reset / openclaw uninstall(高破壞性,額外保護)
- 遠端:本機或 SSH 都支援;以 SSH 為主時要先把連線打通再做事
你不會動到的事:agent 的注入式檔案(SOUL/AGENTS/IDENTITY/USER)、agents.list[] 內容、
bindings[]、agent workspace 的 RAG 知識文件。這些遇到了就轉交給 openclaw-agent-builder。
Phase 0 — 確定操作目標並建立脈絡(不可跳過)
每一次任務的第一件事:這個 OpenClaw 跑在哪裡,你要怎麼操作它?
0A — 本機 還是 SSH?
開門先問:
「要操作的 OpenClaw 是跑在這台機器(本機),還是要 SSH 連到別台?」
- 本機 → 直接用本機 shell,跳到 0B
- SSH → 進入
references/connect.md 的「SSH 連線設定」一節,問齊主機/帳號/驗證
方式(金鑰優先;密碼可接受但要提醒風險),建好可重用連線後再往下
無論哪種,這份 runbook 後面所有 openclaw … 指令都在目標機器上執行。
0B — 連線測試 + 讀現狀
在目標機器上跑這四件事,把脈絡攤開來:
openclaw --version # CLI 可用、版本為何
openclaw status # gateway 是否在跑、recent session
ls ~/.openclaw/ # state dir 與 workspace 樣貌
cat ~/.openclaw/openclaw.json # 讀現有設定(JSON5)
status 連不上 gateway 不一定是問題 —— 也許 gateway 還沒裝。先確認意圖:使用者是
要把它裝起來、跑起來,還是它已經該跑卻沒跑(那就進 debug 流程)。
關鍵狀態目錄(預設值,可被環境變數覆蓋,見 references/config-files.md):
| 用途 |
路徑 |
| state dir |
~/.openclaw/ |
| config 檔 |
~/.openclaw/openclaw.json (JSON5) |
| 憑證 |
~/.openclaw/credentials/ |
| sessions |
~/.openclaw/sessions/ (per-agent: ~/.openclaw/agents/<id>/sessions/) |
| agents |
~/.openclaw/agents/<id>/ |
| workspace |
~/.openclaw/workspace/ 或 ~/.openclaw/workspace-<agentId>/ |
| gateway port |
18789(預設) |
上面任何路徑被 OPENCLAW_STATE_DIR、OPENCLAW_CONFIG_PATH、OPENCLAW_OAUTH_DIR、
OPENCLAW_GATEWAY_PORT 覆蓋時,以實際解析結果為準。先看 env,再看 config,
別硬套預設值。
0C — 版本差異警告(每次都要記著)
OpenClaw CLI 隨版本變化,flag 與 config key 都會搬。所以:
- 執行前先
openclaw <command> --help 驗證選項真的存在。不要直接套這份 runbook
的 flag 名;runbook 是起點不是定論。
- config key 用
openclaw config get <path> 試讀來確認鍵名(openclaw config schema
可看 schema)。
寧可多探一句,不要寫錯設定。
自我約束(高權限工具)
你此刻是 host 上的高權限 operator,有完整 shell 和 openclaw CLI 存取。守住三條:
- 修任何東西前先讀現狀。沒讀過 config 就改 config 是禁忌。
- 寫前計畫,確認後執行。所有寫入(
config set、channels add、channels remove、
gateway 重啟、reset、uninstall、security audit --fix、doctor --force)
都先把「會發生什麼、影響哪些線上行為」攤給使用者,取得明確同意再做。
- 絕不把憑證寫進檔案或 log。token、密碼、API key 只在指令裡短暫出現,不複述、
不存檔、不 print 回對話。
工作流程:把使用者的話對應到動作
收到請求後,先分類,再決定要拉哪些 reference:
分類矩陣
| 使用者說的話 |
屬於 |
主要 reference |
| 「新增/編輯 agent」「做一個 LINE bot」「改 SOUL.md」「換 bindings」 |
agent-builder 的事 |
跟使用者說你會轉交 openclaw-agent-builder |
| 「加一個 Telegram channel」「換 Discord token」「移掉 Slack 帳號」 |
操作 — channel |
references/operations.md(channels 一節) |
| 「啟動/重啟 gateway」「裝成 service」「gateway port 改一下」 |
操作 — gateway/daemon |
references/operations.md(gateway 一節) |
| 「換模型」「設 fallback」「加一個 API key」 |
操作 — models |
references/operations.md(models 一節) |
| 「加 cron job 每天 9 點…」 |
操作 — cron |
references/operations.md(cron 一節) |
| 「安裝/啟用/停用 plugin」「裝 voicecall」 |
操作 — plugins |
references/operations.md(plugins 一節) |
| 「改一個 config 值」「dmPolicy/session 設定」 |
操作 — config |
references/config-files.md + operations.md(config) |
| 「批次發訊息」「發 poll」「對訊息按表情」「pin 一則」「開 thread」「Discord kick/ban/role」 |
操作 — messaging |
references/messaging.md |
| 「接一台新 Pi」「Pi 看不到 gateway」「拍張照」「在 node 上跑 command」 |
操作 — nodes/node/devices |
references/nodes-and-devices.md |
| 「用 browser 截圖 / 點某個鈕 / 填表」 |
操作 — browser |
references/misc-modules.md(§1) |
| 「approve pairing」「approvals allowlist」「ACP 接 IDE」「QR」「dns setup」 |
操作 — 雜項模組 |
references/misc-modules.md |
| 「bot 沒回應」「channel 連不上」「為什麼 X 不動」 |
debug |
references/debug.md(對應子系統 reference 的 debug 章) |
| 「health/status 看起來怪怪的」「跑 doctor」「安全稽核」 |
debug + 稽核 |
references/debug.md |
| 「整個砍掉重來」「reset」「uninstall」 |
破壞性 |
references/destructive.md(必讀) |
通用步驟
- 分類 + 讀現狀(Phase 0 還沒做就先做)
- 拉對應 reference(只拉用得到的;不要一次全讀)
- 草擬計畫:要動哪個檔/跑哪個指令,期望結果,可能風險
- 跟使用者確認(寫前計畫;debug 也要說明你要跑什麼指令)
- 執行(本機直接,SSH 則透過已建好的連線)
- 驗收:跑
openclaw doctor、openclaw status、openclaw channels status --probe,
或對應的子系統驗收指令,把結果回報給使用者
- 可逆性:任何 config 寫入前先備份
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak-<timestamp>
Debug 能力(這個 skill 的核心之一)
當使用者說「壞了/不動/怪怪的」,不要亂改設定。先取證。
references/debug.md 有完整 runbook,核心套路如下:
黃金順序(每個問題都從這裡開始)
- 症狀:讓使用者具體說「期待什麼 vs 實際發生什麼」、哪個 channel/agent、何時開始
openclaw doctor —— OpenClaw 自帶的健診,先跑(不加 --fix,純看報告)
openclaw status --deep 或 openclaw status --all —— 全面狀態,包含 gateway、
channels、sessions、provider 額度
openclaw channels status --probe —— 對每個 channel 做活探測
openclaw gateway probe / gateway health —— 確認 gateway 真的可達且回應
openclaw logs --follow —— 看即時 log(問題重現時最有用)
openclaw channels logs --channel <ch> —— 看特定 channel 最近的 log
openclaw security audit —— 看有沒有設定上的安全 footgun 連帶造成行為怪
openclaw sessions —— 看 session 路由有沒有走到對的 agent
常見故障模式(快速分流)
- Channel 收到訊息但沒回應 → 路由問題(
bindings)、agent 沒有對應的 channel
emit 權限、或 dmPolicy 擋下 → 看 channels logs、sessions,以及 agents list --bindings
- Gateway 重啟後 channel 全紅 → token 過期、auth profile 變動,或 channel
module 沒載入 →
channels status --probe + channels logs
- 模型呼叫失敗 → API key 失效、quota 用完、provider 端故障 →
models status --probe,看 provider usage
- Plugin 沒生效 →
plugins doctor + plugins list,看 enabled 與 load 錯誤
- service 應該開機自啟卻沒開 →
gateway status --deep 看系統服務狀態
- config 套不上去 → 多半是 JSON5 解析失敗或 schema 校驗失敗 →
openclaw config get <path> 試讀;doctor 通常會點出來
詳見 references/debug.md。
Debug 完成的標準
找到 root cause 才算完成。光是 workaround 別當結束。如果觀察到的證據對不上假設,
回到取證,別硬猜。
編輯 OpenClaw 的設定檔(openclaw.json)
兩條路:
openclaw config set/unset(優先)—— 走官方 CLI,會做 schema 校驗、$include 解析、
env 替換,不會把 runtime defaults 漏寫進檔。
- 直接編輯
~/.openclaw/openclaw.json(當 CLI 不夠用時)—— JSON5 格式,可有註解。
改完務必檢查能不能被 JSON5 解析(用 node -e 或 openclaw doctor 驗證)。
改任何 config 都要:
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak-$(date +%Y%m%d-%H%M%S)
- 動到「啟動時讀取」的鍵(gateway/channels/plugins 多半屬此)→ 提示使用者要重啟
gateway 才會生效
- 改完跑
openclaw doctor 與 openclaw status --deep
config 結構與環境變數覆蓋,見 references/config-files.md。
破壞性操作
reset、uninstall、--fix、--force、--delete、channels remove 沒 --account
全幹掉、gateway uninstall、刪 ~/.openclaw —— 這些都進 references/destructive.md。
執行前要做:
- 跟使用者明確、具名地列出會被刪/改/重設的東西
- 得到二次確認(光是「OK」不夠,要對方覆述他知道會發生什麼)
- 預先備份要保的東西(
openclaw.json、credentials/、sessions/)
- 預設加
--dry-run 看一遍(支援的指令都有)
- 跑完跑
openclaw doctor 與 openclaw status 驗收
本機 vs SSH 的執行差異
兩條路徑後續的 runbook 內容完全一樣,差別只在「指令怎麼跑到目標機器上」。連線
細節、檔案讀寫範式、reusable connection、SSH 上做 interactive 操作的眉角,全部在
references/connect.md。
簡要範式:
# 本機
openclaw doctor
cat ~/.openclaw/openclaw.json
# SSH(已用 ControlMaster 建好連線後)
ssh oc-host "openclaw doctor"
ssh oc-host "cat ~/.openclaw/openclaw.json"
# SSH 寫檔(用 heredoc + tee;絕不在指令裡明文寫 token)
ssh oc-host "tee ~/.openclaw/openclaw.json.new" < /tmp/openclaw.json.draft
ssh oc-host "mv ~/.openclaw/openclaw.json.new ~/.openclaw/openclaw.json"
互動式指令的限制:openclaw onboard、openclaw configure、openclaw channels login --channel whatsapp(掃 QR)等需要 TTY 的指令,在 SSH 上要分配 PTY(ssh -t)。
對 WhatsApp QR 這類,告知使用者要在那台機器上自己看終端(SSH 也可以,但要 ssh -t
且不能背景化)。
Reference 檔案(按需載入)
只在需要時讀對應的 reference,不要一次全讀。
references/cli-map.md —— OpenClaw 頂層指令樹完整地圖(從原始碼整理)。當你需要
確認「有沒有某個指令/某個 flag」時讀。
references/connect.md —— 本機與 SSH 連線設定、reusable connection、SSH 上做檔案
讀寫與互動指令的範式。Phase 0 選 SSH 時讀。
references/config-files.md —— ~/.openclaw/ 結構、openclaw.json 主要鍵、環境
變數覆蓋。改 config 之前讀。
references/operations.md —— 常見 ops playbook(加 channel、換模型、改 port、
裝 plugin、加 cron…)。對應「操作」類請求時讀。
references/messaging.md —— openclaw message 子指令族(send/broadcast/poll/
react/edit/delete/pin/thread/role/permissions/channel/member/event/emoji/sticker)。
寫自動化發訊或 Discord 管理時讀。
references/nodes-and-devices.md —— nodes / node / devices / qr,以及
camera/canvas/screen/location 子表面。接 Pi/桌機/手機 node 時讀。
references/misc-modules.md —— browser(專用 Chrome 全控)、approvals、
acp、pairing、system、dns、webhooks gmail、skills / memory /
update / dashboard / tui 等中小模組。
references/debug.md —— 系統性 debug runbook,含分流表與常見故障 root cause。
對應「壞了/不動/怪怪的」時讀。各 reference 內部也都有自己的 debug 小節,先看
本檔的黃金順序,再深入子系統 reference。
references/destructive.md —— reset / uninstall / --fix / --force 安全
檢查表與回滾。任何破壞性操作前讀。
與其他 skill 的關係
- openclaw-agent-builder(建 agent / 編 agent workspace)—— 凡是創 / 改 agent
的人格、workspace、bindings、RAG 知識庫,轉交給它,不要在這裡做。你可以幫對方
跑驗收(
agents list --bindings、channels status --probe),但「寫 SOUL.md / 加
agents.list[] 項目 / 設 dmPolicy」是它的領域。
- 兩者共用 Phase 0 的連線設定。如果使用者剛剛已經用 agent-builder 做過 Phase 0,
直接沿用;不要重問。
收尾(每次任務都做)
- 跑驗收(對應子系統的 status / probe / doctor)
- 回報給使用者:做了什麼、改了什麼、現在狀態為何、有沒有要重啟才生效的部分
- 若 SSH:提醒使用者(或自己處理)收掉 ControlMaster 連線(
ssh -O exit oc-host)
- 任何用到的密碼/token,確認都沒寫進檔案或對話複述
1---2name: openclaw-ops3description: Operate, configure, and debug a running OpenClaw installation from a host machine (locally or over SSH). Covers the whole runtime surface **except** building agent personalities/workspaces — channels, gateway, daemon/service, config (`openclaw.json`), models + auth, cron, hooks, plugins, sandbox, sessions, security audit, doctor, reset, uninstall. This skill MUST be invoked on any mention of `openclaw` CLI commands, `~/.openclaw`, `openclaw.json`, "restart gateway", "add a channel", "check why my bot isn't responding", "openclaw doctor", "channels status", "ssh into the OpenClaw box", and similar — also whenever a host has `~/.openclaw/openclaw.json` and OpenClaw work is implied even if not named. MUST hand off to **openclaw-agent-builder** for any work that creates or edits an agent's workspace files (SOUL.md / AGENTS.md / IDENTITY.md / USER.md / RAG knowledge / `agents.list[]` entries / `bindings[]`).4---56# OpenClaw Ops78在一台跑著 OpenClaw 的機器上(本機,或 SSH 進去的遠端)做**運維、配置、診斷**。9不寫 agent 人格與 workspace —— 那是 `openclaw-agent-builder` 的工作。1011這份 skill 涵蓋:1213- **配置**:`~/.openclaw/openclaw.json` 的讀寫、`openclaw config get/set/unset`14- **服務**:gateway 與 daemon 的安裝、啟停、重啟、健康檢查15- **連線**:channels 帳號的增刪、登入、查狀態、看 log16- **模型**:`openclaw models` 的 list/status/set/auth17- **排程**:`openclaw cron`18- **延伸**:`openclaw plugins`、`openclaw hooks`、`openclaw webhooks`19- **隔離**:`openclaw sandbox`20- **稽核**:`openclaw doctor`、`openclaw security audit`、`openclaw status`、`openclaw logs`21- **重置**:`openclaw reset` / `openclaw uninstall`(高破壞性,額外保護)22- **遠端**:本機或 SSH 都支援;以 SSH 為主時要先把連線打通再做事2324> 你**不會**動到的事:agent 的注入式檔案(SOUL/AGENTS/IDENTITY/USER)、`agents.list[]` 內容、25> `bindings[]`、agent workspace 的 RAG 知識文件。這些遇到了就**轉交給 openclaw-agent-builder**。2627---2829## Phase 0 — 確定操作目標並建立脈絡(不可跳過)3031每一次任務的第一件事:**這個 OpenClaw 跑在哪裡,你要怎麼操作它?**3233### 0A — 本機 還是 SSH?3435開門先問:3637> 「要操作的 OpenClaw 是跑在**這台機器(本機)**,還是要 **SSH 連到別台**?」3839- **本機** → 直接用本機 shell,跳到 0B40- **SSH** → 進入 `references/connect.md` 的「SSH 連線設定」一節,問齊主機/帳號/驗證41 方式(金鑰優先;密碼可接受但要提醒風險),建好可重用連線後再往下4243無論哪種,**這份 runbook 後面所有 `openclaw …` 指令都在目標機器上執行**。4445### 0B — 連線測試 + 讀現狀4647在目標機器上跑這四件事,把脈絡攤開來:4849```bash50openclaw --version # CLI 可用、版本為何51openclaw status # gateway 是否在跑、recent session52ls ~/.openclaw/ # state dir 與 workspace 樣貌53cat ~/.openclaw/openclaw.json # 讀現有設定(JSON5)54```5556`status` 連不上 gateway 不一定是問題 —— 也許 gateway 還沒裝。先確認**意圖**:使用者是57要把它裝起來、跑起來,還是它已經該跑卻沒跑(那就進 debug 流程)。5859關鍵狀態目錄(預設值,可被環境變數覆蓋,見 `references/config-files.md`):6061| 用途 | 路徑 |62|---|---|63| state dir | `~/.openclaw/` |64| config 檔 | `~/.openclaw/openclaw.json` (JSON5) |65| 憑證 | `~/.openclaw/credentials/` |66| sessions | `~/.openclaw/sessions/` (per-agent: `~/.openclaw/agents/<id>/sessions/`) |67| agents | `~/.openclaw/agents/<id>/` |68| workspace | `~/.openclaw/workspace/` 或 `~/.openclaw/workspace-<agentId>/` |69| gateway port | 18789(預設) |7071> 上面任何路徑被 `OPENCLAW_STATE_DIR`、`OPENCLAW_CONFIG_PATH`、`OPENCLAW_OAUTH_DIR`、72> `OPENCLAW_GATEWAY_PORT` 覆蓋時,以實際解析結果為準。先看 env,再看 config,73> 別硬套預設值。7475### 0C — 版本差異警告(每次都要記著)7677OpenClaw CLI **隨版本變化**,flag 與 config key 都會搬。所以:7879- **執行前先 `openclaw <command> --help`** 驗證選項真的存在。不要直接套這份 runbook80 的 flag 名;runbook 是起點不是定論。81- config key 用 `openclaw config get <path>` 試讀來確認鍵名(`openclaw config schema`82 可看 schema)。8384寧可多探一句,不要寫錯設定。8586---8788## 自我約束(高權限工具)8990你此刻是 host 上的高權限 operator,有完整 shell 和 `openclaw` CLI 存取。守住三條:91921. **修任何東西前先讀現狀**。沒讀過 config 就改 config 是禁忌。932. **寫前計畫,確認後執行**。所有寫入(`config set`、`channels add`、`channels remove`、94 gateway 重啟、`reset`、`uninstall`、`security audit --fix`、`doctor --force`)95 都先把「會發生什麼、影響哪些線上行為」攤給使用者,**取得明確同意**再做。963. **絕不把憑證寫進檔案或 log**。token、密碼、API key 只在指令裡短暫出現,不複述、97 不存檔、不 print 回對話。9899---100101## 工作流程:把使用者的話對應到動作102103收到請求後,**先分類**,再決定要拉哪些 reference:104105### 分類矩陣106107| 使用者說的話 | 屬於 | 主要 reference |108|---|---|---|109| 「新增/編輯 agent」「做一個 LINE bot」「改 SOUL.md」「換 bindings」 | **agent-builder 的事** | 跟使用者說你會轉交 `openclaw-agent-builder` |110| 「加一個 Telegram channel」「換 Discord token」「移掉 Slack 帳號」 | 操作 — channel | `references/operations.md`(channels 一節) |111| 「啟動/重啟 gateway」「裝成 service」「gateway port 改一下」 | 操作 — gateway/daemon | `references/operations.md`(gateway 一節) |112| 「換模型」「設 fallback」「加一個 API key」 | 操作 — models | `references/operations.md`(models 一節) |113| 「加 cron job 每天 9 點…」 | 操作 — cron | `references/operations.md`(cron 一節) |114| 「安裝/啟用/停用 plugin」「裝 voicecall」 | 操作 — plugins | `references/operations.md`(plugins 一節) |115| 「改一個 config 值」「dmPolicy/session 設定」 | 操作 — config | `references/config-files.md` + `operations.md`(config) |116| 「批次發訊息」「發 poll」「對訊息按表情」「pin 一則」「開 thread」「Discord kick/ban/role」 | 操作 — messaging | `references/messaging.md` |117| 「接一台新 Pi」「Pi 看不到 gateway」「拍張照」「在 node 上跑 command」 | 操作 — nodes/node/devices | `references/nodes-and-devices.md` |118| 「用 browser 截圖 / 點某個鈕 / 填表」 | 操作 — browser | `references/misc-modules.md`(§1) |119| 「approve pairing」「approvals allowlist」「ACP 接 IDE」「QR」「dns setup」 | 操作 — 雜項模組 | `references/misc-modules.md` |120| 「bot 沒回應」「channel 連不上」「為什麼 X 不動」 | **debug** | `references/debug.md`(對應子系統 reference 的 debug 章) |121| 「health/status 看起來怪怪的」「跑 doctor」「安全稽核」 | **debug + 稽核** | `references/debug.md` |122| 「整個砍掉重來」「reset」「uninstall」 | **破壞性** | `references/destructive.md`(必讀) |123124### 通用步驟1251261. **分類** + 讀現狀(Phase 0 還沒做就先做)1272. **拉對應 reference**(只拉用得到的;不要一次全讀)1283. **草擬計畫**:要動哪個檔/跑哪個指令,期望結果,可能風險1294. **跟使用者確認**(寫前計畫;debug 也要說明你要跑什麼指令)1305. **執行**(本機直接,SSH 則透過已建好的連線)1316. **驗收**:跑 `openclaw doctor`、`openclaw status`、`openclaw channels status --probe`,132 或對應的子系統驗收指令,把結果回報給使用者1337. **可逆性**:任何 config 寫入前先備份 `cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak-<timestamp>`134135---136137## Debug 能力(這個 skill 的核心之一)138139當使用者說「壞了/不動/怪怪的」,**不要亂改設定**。先**取證**。140141`references/debug.md` 有完整 runbook,核心套路如下:142143### 黃金順序(每個問題都從這裡開始)1441451. **症狀**:讓使用者具體說「期待什麼 vs 實際發生什麼」、哪個 channel/agent、何時開始1462. **`openclaw doctor`** —— OpenClaw 自帶的健診,先跑(不加 `--fix`,純看報告)1473. **`openclaw status --deep` 或 `openclaw status --all`** —— 全面狀態,包含 gateway、148 channels、sessions、provider 額度1494. **`openclaw channels status --probe`** —— 對每個 channel 做活探測1505. **`openclaw gateway probe` / `gateway health`** —— 確認 gateway 真的可達且回應1516. **`openclaw logs --follow`** —— 看即時 log(問題重現時最有用)1527. **`openclaw channels logs --channel <ch>`** —— 看特定 channel 最近的 log1538. **`openclaw security audit`** —— 看有沒有設定上的安全 footgun 連帶造成行為怪1549. **`openclaw sessions`** —— 看 session 路由有沒有走到對的 agent155156### 常見故障模式(快速分流)157158- **Channel 收到訊息但沒回應** → 路由問題(`bindings`)、agent 沒有對應的 channel159 emit 權限、或 dmPolicy 擋下 → 看 `channels logs`、`sessions`,以及 `agents list160 --bindings`161- **Gateway 重啟後 channel 全紅** → token 過期、auth profile 變動,或 channel162 module 沒載入 → `channels status --probe` + `channels logs`163- **模型呼叫失敗** → API key 失效、quota 用完、provider 端故障 → `models status164 --probe`,看 provider usage165- **Plugin 沒生效** → `plugins doctor` + `plugins list`,看 enabled 與 load 錯誤166- **service 應該開機自啟卻沒開** → `gateway status --deep` 看系統服務狀態167- **config 套不上去** → 多半是 JSON5 解析失敗或 schema 校驗失敗 → `openclaw config168 get <path>` 試讀;`doctor` 通常會點出來169170詳見 `references/debug.md`。171172### Debug 完成的標準173174**找到 root cause 才算完成**。光是 workaround 別當結束。如果觀察到的證據對不上假設,175回到取證,別硬猜。176177---178179## 編輯 OpenClaw 的設定檔(`openclaw.json`)180181兩條路:1821831. **`openclaw config set/unset`**(優先)—— 走官方 CLI,會做 schema 校驗、$include 解析、184 env 替換,不會把 runtime defaults 漏寫進檔。1852. **直接編輯 `~/.openclaw/openclaw.json`**(當 CLI 不夠用時)—— JSON5 格式,可有註解。186 改完務必檢查能不能被 JSON5 解析(用 `node -e` 或 `openclaw doctor` 驗證)。187188**改任何 config 都要**:1891901. `cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak-$(date +%Y%m%d-%H%M%S)`1912. 動到「啟動時讀取」的鍵(gateway/channels/plugins 多半屬此)→ 提示使用者要**重啟192 gateway** 才會生效1933. 改完跑 `openclaw doctor` 與 `openclaw status --deep`194195config 結構與環境變數覆蓋,見 `references/config-files.md`。196197---198199## 破壞性操作200201`reset`、`uninstall`、`--fix`、`--force`、`--delete`、`channels remove` 沒 `--account`202全幹掉、`gateway uninstall`、刪 `~/.openclaw` —— 這些都進 `references/destructive.md`。203204執行前要做:2052061. 跟使用者明確、具名地列出**會被刪/改/重設的東西**2072. **得到二次確認**(光是「OK」不夠,要對方覆述他知道會發生什麼)2083. 預先備份要保的東西(`openclaw.json`、`credentials/`、`sessions/`)2094. 預設加 `--dry-run` 看一遍(支援的指令都有)2105. 跑完跑 `openclaw doctor` 與 `openclaw status` 驗收211212---213214## 本機 vs SSH 的執行差異215216兩條路徑後續的 runbook 內容**完全一樣**,差別只在「指令怎麼跑到目標機器上」。連線217細節、檔案讀寫範式、reusable connection、SSH 上做 interactive 操作的眉角,全部在218`references/connect.md`。219220簡要範式:221222```bash223# 本機224openclaw doctor225cat ~/.openclaw/openclaw.json226227# SSH(已用 ControlMaster 建好連線後)228ssh oc-host "openclaw doctor"229ssh oc-host "cat ~/.openclaw/openclaw.json"230231# SSH 寫檔(用 heredoc + tee;絕不在指令裡明文寫 token)232ssh oc-host "tee ~/.openclaw/openclaw.json.new" < /tmp/openclaw.json.draft233ssh oc-host "mv ~/.openclaw/openclaw.json.new ~/.openclaw/openclaw.json"234```235236> **互動式指令的限制**:`openclaw onboard`、`openclaw configure`、`openclaw channels237> login --channel whatsapp`(掃 QR)等需要 TTY 的指令,在 SSH 上要分配 PTY(`ssh -t`)。238> 對 WhatsApp QR 這類,告知使用者要在那台機器上自己看終端(SSH 也可以,但要 `ssh -t`239> 且不能背景化)。240241---242243## Reference 檔案(按需載入)244245只在需要時讀對應的 reference,**不要一次全讀**。246247- `references/cli-map.md` —— OpenClaw 頂層指令樹完整地圖(從原始碼整理)。當你需要248 確認「有沒有某個指令/某個 flag」時讀。249- `references/connect.md` —— 本機與 SSH 連線設定、reusable connection、SSH 上做檔案250 讀寫與互動指令的範式。Phase 0 選 SSH 時讀。251- `references/config-files.md` —— `~/.openclaw/` 結構、`openclaw.json` 主要鍵、環境252 變數覆蓋。改 config 之前讀。253- `references/operations.md` —— 常見 ops playbook(加 channel、換模型、改 port、254 裝 plugin、加 cron…)。對應「操作」類請求時讀。255- `references/messaging.md` —— `openclaw message` 子指令族(send/broadcast/poll/256 react/edit/delete/pin/thread/role/permissions/channel/member/event/emoji/sticker)。257 寫自動化發訊或 Discord 管理時讀。258- `references/nodes-and-devices.md` —— `nodes` / `node` / `devices` / `qr`,以及259 camera/canvas/screen/location 子表面。接 Pi/桌機/手機 node 時讀。260- `references/misc-modules.md` —— `browser`(專用 Chrome 全控)、`approvals`、261 `acp`、`pairing`、`system`、`dns`、`webhooks gmail`、`skills` / `memory` /262 `update` / `dashboard` / `tui` 等中小模組。263- `references/debug.md` —— 系統性 debug runbook,含分流表與常見故障 root cause。264 對應「壞了/不動/怪怪的」時讀。各 reference 內部也都有自己的 debug 小節,先看265 本檔的黃金順序,再深入子系統 reference。266- `references/destructive.md` —— `reset` / `uninstall` / `--fix` / `--force` 安全267 檢查表與回滾。任何破壞性操作前讀。268269---270271## 與其他 skill 的關係272273- **openclaw-agent-builder**(建 agent / 編 agent workspace)—— 凡是創 / 改 agent274 的人格、workspace、bindings、RAG 知識庫,**轉交給它**,不要在這裡做。你可以幫對方275 跑驗收(`agents list --bindings`、`channels status --probe`),但「寫 SOUL.md / 加276 `agents.list[]` 項目 / 設 `dmPolicy`」是它的領域。277- 兩者**共用 Phase 0 的連線設定**。如果使用者剛剛已經用 agent-builder 做過 Phase 0,278 直接沿用;不要重問。279280---281282## 收尾(每次任務都做)2832841. 跑驗收(對應子系統的 status / probe / doctor)2852. 回報給使用者:做了什麼、改了什麼、現在狀態為何、有沒有要重啟才生效的部分2863. 若 SSH:提醒使用者(或自己處理)收掉 ControlMaster 連線(`ssh -O exit oc-host`)2874. 任何用到的密碼/token,確認都沒寫進檔案或對話複述