Documentation Index
Fetch the complete documentation index at: https://docs2.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
重點摘要
根據你想要多常更新,以及是否想自己執行 Gateway,選擇設定工作流程:- **客製化設定位於 repo 之外:**將你的設定與工作區保存在
~/.openclaw/openclaw.json和~/.openclaw/workspace/,這樣 repo 更新就不會影響它們。 - **穩定工作流程(多數情況建議):**安裝 macOS app,並讓它執行內建的 Gateway。
- **前沿工作流程(開發):**透過
pnpm gateway:watch自行執行 Gateway,然後讓 macOS app 以本機模式連接。
先決條件(從原始碼)
- 建議使用 Node 24(Node 22 LTS,目前為
22.16+,仍受支援) - 原始碼 checkout 需要
pnpm。OpenClaw 在開發模式中會從extensions/*pnpm workspace 套件載入內建 plugins,因此根目錄的npm install不會準備完整的原始碼樹。 - Docker(選用;僅用於容器化設定/e2e - 請參閱 Docker)
客製化策略(讓更新不造成傷害)
如果你想要「100% 為我量身打造」並且 容易更新,請將你的客製化內容保存在:- 設定:
~/.openclaw/openclaw.json(JSON/類 JSON5) - 工作區:
~/.openclaw/workspace(skills、prompts、memories;把它做成私人 git repo)
pnpm openclaw setup 執行。
從這個 repo 執行 Gateway
在pnpm build 之後,你可以直接執行打包後的 CLI:
穩定工作流程(先使用 macOS app)
- 安裝並啟動 OpenClaw.app(選單列)。
- 完成上手設定/權限檢查清單(TCC 提示)。
- 確認 Gateway 為本機且正在執行(由 app 管理)。
- 連結介面(範例:WhatsApp):
- 基本檢查:
- 執行
openclaw setup,接著執行openclaw channels login,然後手動啟動 Gateway(openclaw gateway)。
前沿工作流程(在終端機中執行 Gateway)
目標:開發 TypeScript Gateway、取得熱重新載入,並保持 macOS app UI 已連接。0)(選用)也從原始碼執行 macOS app
如果你也想使用前沿版 macOS app:1) 啟動開發版 Gateway
gateway:watch 會在具名 tmux
工作階段中啟動或重新啟動 Gateway 監看程序,並從互動式終端機自動 attach。非互動式 shell 會維持
detached 並印出 tmux attach -t openclaw-gateway-watch-main;使用
OPENCLAW_GATEWAY_WATCH_ATTACH=0 pnpm gateway:watch 讓互動式執行維持
detached,或使用 pnpm gateway:watch:raw 進行前景監看模式。監看器會在相關原始碼、設定與內建 plugin 中繼資料變更時
重新載入。如果受監看的 Gateway 在啟動期間結束,gateway:watch 會執行一次
openclaw doctor --fix --non-interactive 並重試;設定
OPENCLAW_GATEWAY_WATCH_AUTO_DOCTOR=0 可停用這個僅限開發的修復流程。
pnpm openclaw setup 是新 checkout 的一次性本機設定/工作區初始化步驟。
pnpm gateway:watch 不會重新建置 dist/control-ui,因此在 ui/ 變更後請重新執行 pnpm ui:build,或在開發 Control UI 時使用 pnpm ui:dev。
2) 將 macOS app 指向正在執行的 Gateway
在 OpenClaw.app 中:- 連線模式:本機 app 會連接到設定連接埠上正在執行的 gateway。
3) 驗證
- app 內 Gateway 狀態應顯示 「正在使用現有 gateway …」
- 或透過 CLI:
常見誤區
- **連接埠錯誤:**Gateway WS 預設為
ws://127.0.0.1:18789;請讓 app 和 CLI 使用相同連接埠。 - 狀態存放位置:
- Channel/provider 狀態:
~/.openclaw/credentials/ - Model auth profiles:
~/.openclaw/agents/<agentId>/agent/auth-profiles.json - Sessions:
~/.openclaw/agents/<agentId>/sessions/ - Logs:
/tmp/openclaw/
- Channel/provider 狀態:
認證儲存對照表
偵錯 auth 或決定要備份哪些內容時,請使用這份對照表:- WhatsApp:
~/.openclaw/credentials/whatsapp/<accountId>/creds.json - Telegram bot token:設定/env 或
channels.telegram.tokenFile(僅限一般檔案;symlinks 會被拒絕) - Discord bot token:設定/env 或 SecretRef(env/file/exec providers)
- Slack tokens:設定/env(
channels.slack.*) - 配對允許清單:
~/.openclaw/credentials/<channel>-allowFrom.json(預設帳號)~/.openclaw/credentials/<channel>-<accountId>-allowFrom.json(非預設帳號)
- Model auth profiles:
~/.openclaw/agents/<agentId>/agent/auth-profiles.json - 檔案支援的 secrets payload(選用):
~/.openclaw/secrets.json - 舊版 OAuth 匯入:
~/.openclaw/credentials/oauth.json更多詳細資料:安全性。
更新(不破壞你的設定)
- 將
~/.openclaw/workspace和~/.openclaw/視為「你的東西」;不要把個人 prompts/設定放進openclawrepo。 - 更新原始碼:
git pull+pnpm install+ 繼續使用pnpm gateway:watch。
Linux(systemd user service)
Linux 安裝會使用 systemd 使用者服務。預設情況下,systemd 會在登出/閒置時停止使用者 服務,這會終止 Gateway。上手設定會嘗試為你啟用 lingering(可能會提示 sudo)。如果它仍然關閉,請執行:相關文件
- Gateway runbook(flags、supervision、ports)
- Gateway 設定(設定 schema + 範例)
- Discord 和 Telegram(reply tags + replyToMode 設定)
- OpenClaw assistant 設定
- macOS app(gateway 生命週期)