Start
设置指南
Clawdbot 完整设置指南,包括安装、配置和开发工作流程。
存储位置
Clawdbot 将配置与安装分离:
| 位置 | 用途 |
|---|---|
~/.clawdbot/workspace | 你的工作区文件 |
~/.clawdbot/clawdbot.json | 主配置文件 |
~/.clawdbot/credentials/ | 认证令牌 |
这种分离允许轻松更新而不破坏个人配置。
前置要求
- Node.js >= 22
- pnpm(推荐)或 npm
- Docker(可选,用于容器化设置)
安装方法
快速安装(推荐)
curl -fsSL https://clawd.bot/install.sh | bash通过 npm
npm i -g clawdbot
clawdbot setup通过 pnpm
pnpm add -g clawdbot
clawdbot setup工作流程
稳定版工作流程(macOS 应用)
对于大多数用户,macOS 应用提供最简单的体验:
- 安装 - 下载并启动 Clawdbot.app
- 引导 - 完成设置向导
- 权限 - 授予所需的系统访问权限
- Gateway 模式 - 确保 Gateway 处于本地模式
- 频道 - 链接通信频道(WhatsApp、Telegram 等)
- 验证 - 运行
clawdbot health确认设置
开发工作流程
适用于贡献者和高级用户:
# 克隆仓库
git clone https://github.com/clawdbot/clawdbot.git
cd clawdbot
# 安装依赖
pnpm install
# 启动带热重载的开发 Gateway
pnpm gateway:watch将 macOS 应用配置为本地连接模式。应用会连接到配置端口上运行的 Gateway(默认:ws://127.0.0.1:18789)。
凭证存储
| 类型 | 位置 |
|---|---|
~/.clawdbot/credentials/whatsapp/<accountId>/creds.json | |
| Telegram | ~/.clawdbot/credentials/telegram/ |
| 会话 | ~/.clawdbot/agents/<agentId>/sessions/ |
| OAuth | ~/.clawdbot/credentials/oauth.json |
| 日志 | /tmp/clawdbot/ |
平台说明
macOS
应用通过 LaunchAgent 自动管理 Gateway。
Linux
使用 systemd 用户服务。启用 lingering 以防止注销时服务关闭:
sudo loginctl enable-linger $USERWindows (WSL2)
在 WSL2 中使用 Linux 发行版运行 Clawdbot。设置与 Linux 相同。
更新策略
将个人内容保存在 ~/.clawdbot/ 目录中,与安装分离:
# 通过 npm 更新
npm update -g clawdbot
# 或拉取最新源码
cd clawdbot
git pull
pnpm install你的工作区和配置在更新后保持不变。
健康检查
验证你的安装:
clawdbot health预期输出:
- Gateway 状态:运行中
- 端口:18789
- 频道:已连接
- 代理:就绪
故障排除
Gateway 无法启动
- 检查端口 18789 是否被占用:
lsof -i :18789 - 查看日志:
cat /tmp/clawdbot/gateway.log - 重置配置:
clawdbot configure --reset
频道连接问题
- 重新认证:
clawdbot channels login - 检查凭证:
ls ~/.clawdbot/credentials/ - 验证白名单:检查
clawdbot.json