Skip to content

設定

最後更新:2026-01-01

重點摘要

  • 客製化內容放在 repo 外: ~/clawd(工作區)+ ~/.clawdbot/moltbot.json(設定)。
  • 穩定工作流程: 安裝 macOS 應用程式;讓它執行內建的 Gateway。
  • 前沿工作流程: 自己透過 pnpm gateway:watch 執行 Gateway,然後讓 macOS 應用程式以本機模式連接。

前置需求(從原始碼)

  • Node >=22
  • pnpm
  • Docker(選用;僅用於容器化設定/e2e — 參見 Docker

客製化策略(讓更新不會造成問題)

如果您想要「100% 符合個人需求」易於更新,請將客製化內容放在:

  • 設定: ~/.clawdbot/moltbot.json(JSON/JSON5-ish)
  • 工作區: ~/clawd(skills、prompts、memories;建議設為私有 git repo)

首次啟動:

bash
moltbot setup

在此 repo 內,使用本機 CLI 入口:

bash
moltbot setup

如果尚未全域安裝,透過 pnpm moltbot setup 執行。

穩定工作流程(macOS 應用程式優先)

  1. 安裝 + 啟動 Moltbot.app(選單列)。
  2. 完成引導/權限檢查清單(TCC 提示)。
  3. 確保 Gateway 為 Local 且執行中(應用程式會管理它)。
  4. 連接介面(範例:WhatsApp):
bash
moltbot channels login
  1. 健康檢查:
bash
moltbot health

如果您的版本沒有引導功能:

  • 執行 moltbot setup,然後 moltbot channels login,接著手動啟動 Gateway(moltbot gateway)。

前沿工作流程(Gateway 在終端機中)

目標:在 TypeScript Gateway 上工作,獲得熱重載,同時保持 macOS 應用程式 UI 連接。

0)(選用)從原始碼執行 macOS 應用程式

如果您也想讓 macOS 應用程式處於前沿狀態:

bash
./scripts/restart-mac.sh

1) 啟動開發 Gateway

bash
pnpm install
pnpm gateway:watch

gateway:watch 以監看模式執行 gateway,並在 TypeScript 變更時重新載入。

2) 將 macOS 應用程式指向執行中的 Gateway

Moltbot.app 中:

  • 連線模式:Local 應用程式會連接到設定的埠上執行中的 gateway。

3) 驗證

  • 應用程式內的 Gateway 狀態應顯示 "Using existing gateway …"
  • 或透過 CLI:
bash
moltbot health

常見陷阱

  • 錯誤的埠: Gateway WS 預設為 ws://127.0.0.1:18789;保持應用程式 + CLI 在相同埠。
  • 狀態存放位置:
    • 憑證:~/.clawdbot/credentials/
    • Sessions:~/.clawdbot/agents/<agentId>/sessions/
    • 日誌:/tmp/moltbot/

憑證存放對照表

在除錯驗證或決定要備份什麼時使用:

  • WhatsApp~/.clawdbot/credentials/whatsapp/<accountId>/creds.json
  • Telegram bot token:config/env 或 channels.telegram.tokenFile
  • Discord bot token:config/env(尚不支援 token file)
  • Slack tokens:config/env(channels.slack.*
  • 配對允許清單~/.clawdbot/credentials/<channel>-allowFrom.json
  • 模型驗證設定檔~/.clawdbot/agents/<agentId>/agent/auth-profiles.json
  • 舊版 OAuth 匯入~/.clawdbot/credentials/oauth.json

更多詳情:安全性

更新(不破壞設定)

  • ~/clawd~/.clawdbot/ 視為「您的東西」;不要將個人 prompts/config 放入 moltbot repo。
  • 更新原始碼:git pull + pnpm install(當 lockfile 變更時)+ 繼續使用 pnpm gateway:watch

Linux(systemd 使用者服務)

Linux 安裝使用 systemd 使用者服務。預設情況下,systemd 會在登出/閒置時停止使用者服務,這會終止 Gateway。引導會嘗試為您啟用 lingering(可能會提示 sudo)。如果仍然關閉,執行:

bash
sudo loginctl enable-linger $USER

對於永久線上或多使用者伺服器,考慮使用 system 服務而非使用者服務(不需要 lingering)。參見 Gateway runbook 的 systemd 說明。

相關文件

基於 MIT 授權發布