2025-12-08 12:43:13 +01:00
# 🦞 CLAWDIS — WhatsApp & Telegram Gateway for AI Agents
2025-11-25 04:44:10 +01:00
2025-11-25 14:29:21 +01:00
< p align = "center" >
2025-12-03 15:45:32 +00:00
< img src = "docs/whatsapp-clawd.jpg" alt = "CLAWDIS" width = "400" >
< / p >
< p align = "center" >
< strong > EXFOLIATE! EXFOLIATE!< / strong >
2025-11-25 14:29:21 +01:00
< / p >
2025-11-25 14:42:12 +01:00
< p align = "center" >
2025-12-09 18:00:01 +00:00
< a href = "https://github.com/steipete/clawdis/actions/workflows/ci.yml?branch=main" > < img src = "https://img.shields.io/github/actions/workflow/status/steipete/clawdis/ci.yml?branch=main&style=for-the-badge" alt = "CI status" > < / a >
2025-12-14 00:34:26 +00:00
< a href = "https://github.com/steipete/clawdis/releases" > < img src = "https://img.shields.io/github/v/release/steipete/clawdis?include_prereleases&style=for-the-badge" alt = "GitHub release" > < / a >
2025-11-25 14:42:12 +01:00
< a href = "LICENSE" > < img src = "https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt = "MIT License" > < / a >
< / p >
2025-12-14 00:34:26 +00:00
**CLAWDIS** is a TypeScript/Node gateway that bridges WhatsApp (Web/Baileys) and Telegram (Bot API/grammY) to a local coding agent (**Pi**).
It’ s like having a genius lobster in your pocket 24/7 — but with a real control plane, companion apps, and a network model that won’ t corrupt sessions.
2025-11-25 23:06:54 +01:00
2025-12-03 15:45:32 +00:00
```
2025-12-14 00:34:26 +00:00
WhatsApp / Telegram
│
▼
┌──────────────────────────┐
│ Gateway │ ws://127.0.0.1:18789 (loopback-only)
│ (single source) │ tcp://0.0.0.0:18790 (optional Bridge)
└───────────┬───────────────┘
│
├─ Pi agent (RPC)
├─ CLI (clawdis …)
├─ WebChat (loopback UI)
├─ macOS app (Clawdis.app)
2025-12-18 13:18:33 +01:00
└─ iOS node via Bridge + pairing
2025-12-03 15:45:32 +00:00
```
2025-11-25 04:44:10 +01:00
2025-12-03 15:45:32 +00:00
## Why "CLAWDIS"?
2025-11-25 04:46:14 +01:00
2025-12-03 15:45:32 +00:00
**CLAWDIS** = CLAW + TARDIS
2025-11-29 04:50:56 +00:00
2025-12-03 15:45:32 +00:00
Because every space lobster needs a time-and-space machine. The Doctor has a TARDIS. [Clawd ](https://clawd.me ) has a CLAWDIS. Both are blue. Both are chaotic. Both are loved.
2025-11-29 04:50:56 +00:00
2025-12-03 15:45:32 +00:00
## Features
2025-12-05 19:04:09 +00:00
- 📱 **WhatsApp Integration** — Personal WhatsApp Web (Baileys)
2025-12-08 12:43:13 +01:00
- ✈️ **Telegram (Bot API)** — DMs and groups via grammY
2025-12-14 00:34:26 +00:00
- 🛰️ **Gateway control plane** — One long-lived gateway owns provider state; clients connect over WebSocket
- 🤖 **Agent runtime** — Pi only (Pi CLI in RPC mode), with tool streaming
- 💬 **Sessions** — Direct chats collapse into `main` by default; groups are isolated
2025-12-03 15:45:32 +00:00
- 🔔 **Heartbeats** — Periodic check-ins for proactive AI
2025-12-13 15:15:09 +00:00
- 🧭 **Clawd Browser** — Dedicated Chrome/Chromium profile with tabs + screenshot control (no interference with your daily browser)
2025-12-03 15:45:32 +00:00
- 👥 **Group Chat Support** — Mention-based triggering
- 📎 **Media Support** — Images, audio, documents, voice notes
2025-12-14 00:34:26 +00:00
- 🎤 **Voice & transcription hooks** — Voice Wake (macOS/iOS) + optional transcription pipeline
2025-12-03 15:45:32 +00:00
- 🔧 **Tool Streaming** — Real-time display (💻📄✍️📝)
2025-12-14 00:34:26 +00:00
- 🖥️ **macOS Companion (Clawdis.app)** — Menu bar controls, Voice Wake, WebChat, onboarding, remote gateway control
2025-12-18 13:18:33 +01:00
- 📱 **iOS node** — Pairs as a node, exposes a Canvas surface, forwards voice wake transcripts
2025-11-25 04:44:10 +01:00
2025-12-13 13:26:33 +00:00
Only the Pi CLI is supported now; legacy Claude/Codex/Gemini paths have been removed.
2025-12-05 17:50:02 +00:00
2025-12-14 00:34:26 +00:00
## Network model (the “new reality”)
- **One Gateway per host**. The Gateway is the only process allowed to own the WhatsApp Web session.
- **Loopback-first**: the Gateway WebSocket listens on `ws://127.0.0.1:18789` and is not exposed on the LAN.
2025-12-17 17:01:10 +01:00
- **Bridge for nodes**: when enabled, the Gateway also exposes a bridge on `tcp://0.0.0.0:18790` for paired nodes (Bonjour-discoverable). For tailnet-only setups, set `bridge.bind: "tailnet"` in `~/.clawdis/clawdis.json` .
2025-12-14 00:34:26 +00:00
- **Remote control**: use a VPN/tailnet or an SSH tunnel (`ssh -N -L 18789:127.0.0.1:18789 user@host` ). The macOS app can drive this flow.
2025-12-17 17:01:10 +01:00
- **Wide-Area Bonjour (optional)**: for auto-discovery across networks (Vienna ⇄ London) over Tailscale, use unicast DNS-SD on `clawdis.internal.` ; see `docs/bonjour.md` .
2025-12-14 00:34:26 +00:00
## Codebase
- **TypeScript (ESM)**: CLI + Gateway live in `src/` and run on Node ≥ 22.
- **macOS app (Swift)**: menu bar companion lives in `apps/macos/` .
2025-12-18 13:18:33 +01:00
- **iOS app (Swift)**: iOS node prototype lives in `apps/ios/` .
2025-12-14 00:34:26 +00:00
2025-12-03 15:45:32 +00:00
## Quick Start
2025-11-25 04:44:10 +01:00
2025-12-09 04:13:46 +00:00
Runtime requirement: **Node ≥22.0.0** (not bundled). The macOS app and CLI both use the host runtime; install via Homebrew or official installers before running `clawdis` .
2025-12-09 00:59:09 +01:00
2025-12-03 15:45:32 +00:00
```bash
2025-12-14 00:34:26 +00:00
# From source (recommended while the npm package is still settling)
pnpm install
pnpm build
2025-11-25 04:44:10 +01:00
2025-12-14 00:34:26 +00:00
# Link your WhatsApp (stores creds under ~/.clawdis/credentials)
pnpm clawdis login
2025-12-03 15:45:32 +00:00
2025-12-14 00:34:26 +00:00
# Start the gateway (WebSocket control plane)
pnpm clawdis gateway --port 18789 --verbose
2025-12-03 15:45:32 +00:00
2025-12-14 00:34:26 +00:00
# Send a WhatsApp message (WhatsApp sends go through the Gateway)
pnpm clawdis send --to +1234567890 --message "Hello from the CLAWDIS!"
2025-12-04 17:53:37 +00:00
2025-12-14 00:34:26 +00:00
# Talk to the agent (optionally deliver back to WhatsApp/Telegram)
pnpm clawdis agent --message "Ship checklist" --thinking high
2025-12-09 16:28:26 +00:00
# If the port is busy, force-kill listeners then start
2025-12-14 00:34:26 +00:00
pnpm clawdis gateway --force
2025-12-03 15:45:32 +00:00
```
2025-12-13 23:50:23 +00:00
## Companion Apps
### macOS Companion (Clawdis.app)
2025-12-06 05:24:27 +01:00
2025-12-14 00:34:26 +00:00
- A menu bar app that can start/stop the Gateway, show health/presence, and provide a local ops UI.
2025-12-17 22:55:50 +01:00
- Instances UI shows friendly hardware model names (from the vendored MIT dataset under `apps/macos/Sources/Clawdis/Resources/DeviceModels/` ).
2025-12-14 00:34:26 +00:00
- **Voice Wake** (on-device speech recognition) and Push-to-talk overlay.
- **WebChat** embed + debug tooling (logs, status, heartbeats, sessions).
- Hosts **PeekabooBridge** for UI automation brokering (for clawd workflows).
2025-12-06 05:24:27 +01:00
2025-12-12 16:42:05 +00:00
### Voice Wake reply routing
Voice Wake sends messages into the `main` session and replies on the **last used surface** :
- WhatsApp: last direct message you sent/received.
- Telegram: last DM chat id (bot mode).
- WebChat: last WebChat thread you used.
If delivery fails (e.g. WhatsApp disconnected / Telegram token missing), Clawdis logs the error and you can still inspect the run via WebChat/session logs.
2025-12-06 05:24:27 +01:00
Build/run the mac app with `./scripts/restart-mac.sh` (packages, installs, and launches), or `swift build --package-path apps/macos && open dist/Clawdis.app` .
2025-12-18 13:18:33 +01:00
### iOS node (internal)
2025-12-13 23:50:23 +00:00
2025-12-18 13:18:33 +01:00
The iOS node app is an internal/prototype app that connects as a **remote node** :
2025-12-13 23:50:23 +00:00
2025-12-14 00:34:26 +00:00
- **Voice trigger:** forwards transcripts into the Gateway (agent runs + wakeups).
2025-12-18 01:17:27 +00:00
- **Canvas screen:** a WKWebView + `<canvas>` surface the agent can control (via `canvas.eval` / `canvas.snapshot` over `node.invoke` ).
2025-12-18 00:37:40 +00:00
- **Discovery + pairing:** finds the bridge via Bonjour (`_clawdis-bridge._tcp` ) and uses Gateway-owned pairing (`clawdis nodes pending|approve` ); `clawdis nodes status` shows paired nodes + capabilities.
2025-12-13 23:50:23 +00:00
Runbook: `docs/ios/connect.md`
2025-12-03 15:45:32 +00:00
## Configuration
Create `~/.clawdis/clawdis.json` :
2025-11-24 11:23:15 +01:00
2025-11-24 16:02:39 +01:00
```json5
{
inbound: {
2025-12-14 00:34:26 +00:00
allowFrom: ["+1234567890"]
2025-11-24 16:02:39 +01:00
}
}
```
2025-12-13 15:15:09 +00:00
Optional: enable/configure clawd’ s dedicated browser control (defaults are already on):
```json5
{
browser: {
enabled: true,
2025-12-13 15:29:39 +00:00
controlUrl: "http://127.0.0.1:18791",
2025-12-13 15:15:09 +00:00
color: "#FF4500 "
}
}
```
2025-12-03 15:45:32 +00:00
## Documentation
2025-11-25 16:53:30 +01:00
2025-12-03 15:45:32 +00:00
- [Configuration Guide ](./docs/configuration.md )
2025-12-14 00:34:26 +00:00
- [Gateway runbook ](./docs/gateway.md )
- [Discovery + transports ](./docs/discovery.md )
2025-12-17 17:01:10 +01:00
- [Bonjour / mDNS + Wide-Area Bonjour ](./docs/bonjour.md )
2025-12-17 11:29:12 +01:00
- [Agent Runtime ](./docs/agent.md )
2025-12-03 15:45:32 +00:00
- [Group Chats ](./docs/group-messages.md )
- [Security ](./docs/security.md )
- [Troubleshooting ](./docs/troubleshooting.md )
- [The Lore ](./docs/lore.md ) 🦞
2025-12-07 22:52:57 +01:00
- [Telegram (Bot API) ](./docs/telegram.md )
2025-12-18 13:18:33 +01:00
- [iOS node runbook ](./docs/ios/connect.md )
2025-12-14 00:34:26 +00:00
- [macOS app spec ](./docs/clawdis-mac.md )
2025-12-03 15:45:32 +00:00
## Clawd
CLAWDIS was built for **Clawd** , a space lobster AI assistant. See the full setup in [`docs/clawd.md` ](./docs/clawd.md ).
2025-12-03 15:46:29 +00:00
- 🦞 **Clawd's Home:** [clawd.me ](https://clawd.me )
- 📜 **Clawd's Soul:** [soul.md ](https://soul.md )
- 👨💻 **Peter's Blog:** [steipete.me ](https://steipete.me )
- 🐦 **Twitter:** [@steipete ](https://twitter.com/steipete )
2025-12-03 15:45:32 +00:00
2025-12-05 19:04:09 +00:00
## Provider
2025-12-03 15:45:32 +00:00
2025-12-14 00:34:26 +00:00
If you’ re running from source, use `pnpm clawdis …` instead of `clawdis …` .
2025-12-05 19:04:09 +00:00
### WhatsApp Web
2025-12-03 15:45:32 +00:00
```bash
2025-12-14 00:34:26 +00:00
clawdis login # scan QR, store creds
clawdis gateway # run Gateway (WS on 127.0.0.1:18789)
2025-11-25 16:53:30 +01:00
```
2025-12-07 22:52:57 +01:00
### Telegram (Bot API)
2025-12-14 00:34:26 +00:00
Bot-mode support (grammY only) shares the same `main` session as WhatsApp/WebChat, with groups kept isolated. Text/media sends work via `clawdis send --provider telegram` (reads `TELEGRAM_BOT_TOKEN` or `telegram.botToken` ). Webhook mode is supported; see `docs/telegram.md` for setup and limits.
2025-12-07 18:49:55 +01:00
2025-12-03 15:45:32 +00:00
## Commands
| Command | Description |
|---------|-------------|
| `clawdis login` | Link WhatsApp Web via QR |
2025-12-14 00:34:26 +00:00
| `clawdis send` | Send a message (WhatsApp default; `--provider telegram` for bot mode). WhatsApp sends go via the Gateway WS; Telegram sends are direct. |
2025-12-04 17:53:37 +00:00
| `clawdis agent` | Talk directly to the agent (no WhatsApp send) |
2025-12-13 15:15:09 +00:00
| `clawdis browser ...` | Manage clawd’ s dedicated browser (status/tabs/open/screenshot). |
2025-12-09 20:28:10 +00:00
| `clawdis gateway` | Start the Gateway server (WS control plane). Params: `--port` , `--token` , `--force` , `--verbose` . |
2025-12-10 16:27:54 +00:00
| `clawdis gateway health|status|send|agent|call` | Gateway WS clients; assume a running gateway. |
2025-12-13 13:26:33 +00:00
| `clawdis wake` | Enqueue a system event and optionally trigger a heartbeat via the Gateway. |
| `clawdis cron ...` | Manage scheduled jobs (via Gateway). |
2025-12-18 00:37:40 +00:00
| `clawdis nodes ...` | Manage nodes (pairing + status) via the Gateway. |
2025-12-07 16:53:19 +00:00
| `clawdis status` | Web session health + session store summary |
2025-12-10 16:27:54 +00:00
| `clawdis health` | Reports cached provider state from the running gateway. |
2025-12-13 13:26:33 +00:00
| `clawdis webchat` | Start the loopback-only WebChat HTTP server |
2025-12-03 15:45:32 +00:00
2025-12-09 20:28:10 +00:00
#### Gateway client params (WS only)
- `--url` (default `ws://127.0.0.1:18789` )
- `--token` (shared secret if set on the gateway)
- `--timeout <ms>` (WS call timeout)
#### Send
- `--provider whatsapp|telegram` (default whatsapp)
- `--media <path-or-url>`
- `--json` for machine-readable output
#### Health
2025-12-10 16:27:54 +00:00
- Reads gateway/provider state (no direct Baileys socket from the CLI).
2025-12-09 20:28:10 +00:00
2025-12-07 16:53:19 +00:00
In chat, send `/status` to see if the agent is reachable, how much context the session has used, and the current thinking/verbose toggles—no agent call required.
`/status` also shows whether your WhatsApp web session is linked and how long ago the creds were refreshed so you know when to re-scan the QR.
2025-12-06 23:16:23 +01:00
### Sessions, surfaces, and WebChat
2025-12-17 11:29:12 +01:00
- Direct chats now share a canonical session key `main` by default (configurable via `inbound.session.mainKey` ). Groups stay isolated as `group:<jid>` .
2025-12-14 00:34:26 +00:00
- WebChat attaches to `main` and hydrates history from `~/.clawdis/sessions/<SessionId>.jsonl` , so desktop view mirrors WhatsApp/Telegram turns.
2025-12-06 23:16:23 +01:00
- Inbound contexts carry a `Surface` hint (e.g., `whatsapp` , `webchat` , `telegram` ) for logging; replies still go back to the originating surface deterministically.
2025-12-09 18:43:21 +00:00
- Every inbound message is wrapped for the agent as `[Surface FROM HOST/IP TIMESTAMP] body` :
- WhatsApp: `[WhatsApp +15551234567 2025-12-09 12:34] …`
2025-12-09 19:56:18 +00:00
- Telegram: `[Telegram Ada Lovelace (@ada_bot) id:123456789 2025-12-09 12:34] …`
2025-12-09 18:43:21 +00:00
- WebChat: `[WebChat my-mac.local 10.0.0.5 2025-12-09 12:34] …`
This keeps the model aware of the transport, sender, host, and time without relying on implicit context.
2025-12-06 23:16:23 +01:00
2025-12-03 15:45:32 +00:00
## Credits
- **Peter Steinberger** ([@steipete ](https://twitter.com/steipete )) — Creator
2025-12-13 13:26:33 +00:00
- **Mario Zechner** ([@badlogicgames ](https://twitter.com/badlogicgames )) — Pi, security testing
2025-12-03 15:45:32 +00:00
- **Clawd** 🦞 — The space lobster who demanded a better name
## License
MIT — Free as a lobster in the ocean.
---
*"We're all just playing with our own prompts."*
🦞💙