Files
openclaw/docs/start/clawd.md

227 lines
6.8 KiB
Markdown
Raw Normal View History

---
2026-01-04 14:32:47 +00:00
summary: "End-to-end guide for running Clawdbot as a personal assistant with safety cautions"
read_when:
- Onboarding a new assistant instance
- Reviewing safety/permission implications
---
2026-01-04 14:32:47 +00:00
# Building a personal assistant with CLAWDBOT (Clawd-style)
2026-01-04 14:32:47 +00:00
CLAWDBOT is a WhatsApp + Telegram + Discord gateway for **Pi** agents. This guide is the “personal assistant” setup: one dedicated WhatsApp number that behaves like your always-on agent.
2025-12-13 13:25:49 +00:00
## ⚠️ Safety first
2025-12-13 13:25:49 +00:00
Youre putting an agent in a position to:
- run commands on your machine (depending on your Pi tool setup)
- read/write files in your workspace
2025-12-15 10:11:18 -06:00
- send messages back out via WhatsApp/Telegram/Discord
2025-12-13 13:25:49 +00:00
Start conservative:
- Always set `whatsapp.allowFrom` (never run open-to-the-world on your personal Mac).
2025-12-13 13:25:49 +00:00
- Use a dedicated WhatsApp number for the assistant.
2026-01-06 21:54:19 +00:00
- Heartbeats now default to every 30 minutes. Disable until you trust the setup by setting `agent.heartbeat.every: "0m"`.
2025-12-13 13:25:49 +00:00
## Prerequisites
2025-12-13 13:25:49 +00:00
- Node **22+**
- CLAWDBOT available on PATH (recommended: global install)
2025-12-13 13:25:49 +00:00
- A second phone number (SIM/eSIM/prepaid) for the assistant
```bash
2026-01-08 10:07:13 +01:00
npm install -g clawdbot@latest
# or: pnpm add -g clawdbot@latest
```
From source (development):
```bash
git clone https://github.com/clawdbot/clawdbot.git
cd clawdbot
pnpm install
pnpm ui:install
pnpm ui:build
pnpm build
pnpm link --global
```
2025-12-13 13:25:49 +00:00
## The two-phone setup (recommended)
2025-12-13 13:25:49 +00:00
You want this:
```
2025-12-13 13:25:49 +00:00
Your Phone (personal) Second Phone (assistant)
┌─────────────────┐ ┌─────────────────┐
2025-12-13 13:25:49 +00:00
│ Your WhatsApp │ ──────▶ │ Assistant WA │
│ +1-555-YOU │ message │ +1-555-CLAWD │
└─────────────────┘ └────────┬────────┘
│ linked via QR
┌─────────────────┐
│ Your Mac │
2026-01-04 14:32:47 +00:00
│ (clawdbot) │
2025-12-13 13:25:49 +00:00
│ Pi agent │
└─────────────────┘
```
2026-01-04 14:32:47 +00:00
If you link your personal WhatsApp to CLAWDBOT, every message to you becomes “agent input”. Thats rarely what you want.
2025-12-13 13:25:49 +00:00
## 5-minute quick start
2025-12-13 13:25:49 +00:00
1) Pair WhatsApp Web (shows QR; scan with the assistant phone):
2025-12-13 13:25:49 +00:00
```bash
2026-01-08 07:40:08 +01:00
clawdbot providers login
```
2025-12-13 13:25:49 +00:00
2) Start the Gateway (leave it running):
2025-12-13 13:25:49 +00:00
```bash
2026-01-04 14:32:47 +00:00
clawdbot gateway --port 18789
```
2026-01-04 14:32:47 +00:00
3) Put a minimal config in `~/.clawdbot/clawdbot.json`:
```json5
{
whatsapp: {
2025-12-13 13:25:49 +00:00
allowFrom: ["+15555550123"]
}
}
```
2025-12-13 13:25:49 +00:00
Now message the assistant number from your allowlisted phone.
## Give the agent a workspace (AGENTS)
2025-12-17 11:29:12 +01:00
Clawd reads operating instructions and “memory” from its workspace directory.
By default, Clawdbot uses `~/clawd` as the agent workspace, and will create it (plus starter `AGENTS.md`, `SOUL.md`, `TOOLS.md`, `IDENTITY.md`, `USER.md`) automatically on setup/first agent run. `BOOTSTRAP.md` is only created when the workspace is brand new (it should not come back after you delete it).
Tip: treat this folder like Clawds “memory” and make it a git repo (ideally private) so your `AGENTS.md` + memory files are backed up.
```bash
2026-01-04 14:32:47 +00:00
clawdbot setup
```
2026-01-07 02:04:02 +01:00
Full workspace layout + backup guide: [`docs/agent-workspace.md`](/concepts/agent-workspace)
2026-01-07 00:04:03 +01:00
2025-12-23 23:45:20 +00:00
Optional: choose a different workspace with `agent.workspace` (supports `~`).
```json5
{
agent: {
workspace: "~/clawd"
}
}
```
If you already ship your own workspace files from a repo, you can disable bootstrap file creation entirely:
```json5
{
agent: {
skipBootstrap: true
}
}
```
2025-12-13 13:25:49 +00:00
## The config that turns it into “an assistant”
2026-01-04 14:32:47 +00:00
CLAWDBOT defaults to a good assistant setup, but youll usually want to tune:
2025-12-17 11:29:12 +01:00
- persona/instructions in `SOUL.md`
2025-12-13 13:25:49 +00:00
- thinking defaults (if desired)
- heartbeats (once you trust it)
2025-12-13 13:25:49 +00:00
Example:
```json5
{
2025-12-13 13:25:49 +00:00
logging: { level: "info" },
agent: {
2025-12-26 00:43:44 +01:00
model: "anthropic/claude-opus-4-5",
2025-12-17 11:29:12 +01:00
workspace: "~/clawd",
thinkingDefault: "high",
timeoutSeconds: 1800,
// Start with 0; enable later.
heartbeat: { every: "0m" }
},
whatsapp: {
allowFrom: ["+15555550123"],
groups: {
"*": { requireMention: true }
}
},
routing: {
2025-12-13 13:25:49 +00:00
groupChat: {
mentionPatterns: ["@clawd", "clawd"]
}
},
session: {
scope: "per-sender",
resetTriggers: ["/new", "/reset"],
2026-01-03 23:57:17 +00:00
idleMinutes: 10080
}
}
```
2025-12-13 13:25:49 +00:00
## Sessions and memory
2026-01-06 18:25:52 +00:00
- Session files: `~/.clawdbot/agents/<agentId>/sessions/{{SessionId}}.jsonl`
- Session metadata (token usage, last route, etc): `~/.clawdbot/agents/<agentId>/sessions/sessions.json` (legacy: `~/.clawdbot/sessions/sessions.json`)
2025-12-22 20:36:34 +01:00
- `/new` or `/reset` starts a fresh session for that chat (configurable via `resetTriggers`). If sent alone, the agent replies with a short hello to confirm the reset.
- `/compact [instructions]` compacts the session context and reports the remaining context budget.
2025-12-13 13:25:49 +00:00
## Heartbeats (proactive mode)
2026-01-06 21:54:19 +00:00
By default, CLAWDBOT runs a heartbeat every 30 minutes with the prompt:
`Read HEARTBEAT.md if exists. Consider outstanding tasks. Checkup sometimes on your human during (user local) day time.`
Set `agent.heartbeat.every: "0m"` to disable.
- If the agent replies with `HEARTBEAT_OK` (optionally with short padding; see `agent.heartbeat.ackMaxChars`), CLAWDBOT suppresses outbound delivery for that heartbeat.
- Heartbeats run full agent turns — shorter intervals burn more tokens.
```json5
{
agent: {
heartbeat: { every: "30m" }
}
}
```
2025-12-13 13:25:49 +00:00
## Media in and out
2025-12-13 13:25:49 +00:00
Inbound attachments (images/audio/docs) can be surfaced to your command via templates:
- `{{MediaPath}}` (local temp file path)
- `{{MediaUrl}}` (pseudo-URL)
- `{{Transcript}}` (if audio transcription is enabled)
2025-12-13 13:25:49 +00:00
Outbound attachments from the agent: include `MEDIA:<path-or-url>` on its own line (no spaces). Example:
```
2025-12-13 13:25:49 +00:00
Heres the screenshot.
MEDIA:/tmp/screenshot.png
```
2026-01-04 14:32:47 +00:00
CLAWDBOT extracts these and sends them as media alongside the text.
2025-12-13 13:25:49 +00:00
## Operations checklist
```bash
2026-01-04 14:32:47 +00:00
clawdbot status # local status (creds, sessions, queued events)
clawdbot status --deep # also probes the running Gateway (WA connect + Telegram)
clawdbot health --json # gateway health snapshot (WS)
```
2026-01-04 14:32:47 +00:00
Logs live under `/tmp/clawdbot/` (default: `clawdbot-YYYY-MM-DD.log`).
2025-12-13 13:25:49 +00:00
## Next steps
2026-01-07 02:04:02 +01:00
- WebChat: [WebChat](/web/webchat)
2026-01-06 23:32:12 +00:00
- Gateway ops: [Gateway runbook](/gateway)
2026-01-07 02:04:02 +01:00
- Cron + wakeups: [Cron jobs](/automation/cron-jobs)
- macOS menu bar companion: [Clawdbot macOS app](/platforms/macos)
- iOS node app: [iOS app](/platforms/ios)
- Android node app: [Android app](/platforms/android)
- Windows status: [Windows (WSL2)](/platforms/windows)
- Linux status: [Linux app](/platforms/linux)
- Security: [Security](/gateway/security)