# openclawOS — full corpus > openclawOS is a self-hosted, multi-channel gateway that connects AI agents like Claude, GPT, and Gemini to WhatsApp, Telegram, Discord, iMessage, Signal, Slack and 30+ more — without giving up your data. This file concatenates the use-case walkthroughs and every published article on openclawos.neullabs.com, intended for LLM and AI-search ingestion. openclawOS is a Neul Labs project (https://www.neullabs.com). ## Use cases --- # PR review and code triage from a chat app URL: https://openclawos.neullabs.com/use-cases/code-review-from-chat > Point Pi at your repository and let it review open pull requests from wherever you are. It reads the diff with real tools, writes a summary, and replies in your messenger. Who it's for: Engineers and small teams who want to keep reviews moving without being at a desk. The problem: - Reviews stall when the only reviewer is away from their editor. - Hosted code-review bots want repo-wide access on someone else's servers. - Context switching into a laptop for a two-line diff is friction that kills momentum. With openclawOS: - Pi runs on your own hardware with shell and file-system tools, so it clones and reads the actual diff — not a summary of a summary. - Ask for a review from Telegram or Slack; the answer comes back in the same thread. - Per-sender session isolation means each reviewer's context stays separate. How to set it up: 1. Install openclawOS — Run the installer and start the gateway on a machine that can reach your repositories. 2. Pair a channel — Pair Telegram or Slack so you can message Pi from your phone. 3. Give Pi the repo — Point Pi at the checkout (or a clone command) so its shell tool can read the diff. 4. Ask for a review — Message 'review PR #142' and Pi replies with a summary and flagged regressions. --- # Conversational home and IoT automation URL: https://openclawos.neullabs.com/use-cases/home-automation-from-a-message > Wire Pi's tools to the scripts and APIs that already run your home, then drive them in plain language from the messenger you already have open. Who it's for: Homelab owners and tinkerers who want a conversational front-end to their own stack. The problem: - Home-automation front-ends are either rigid dashboards or fragile if-this-then-that rules. - Cloud assistants send everything about your home to a third party. - Voice assistants can't run an arbitrary script or read a Grafana panel. With openclawOS: - Pi has a shell and browser tool, so it can run your existing scripts and read your existing dashboards. - Everything runs on hardware you control — nothing about your home leaves your network. - Message from WhatsApp or iMessage; the same agent, wherever you are. How to set it up: 1. Install openclawOS — Start the gateway on a homelab box or a spare Mac mini. 2. Pair a personal channel — Pair WhatsApp or iMessage so you can message Pi privately. 3. Expose your scripts — Let Pi's shell tool call the scripts and CLIs that already control your devices. 4. Talk to your home — Message 'start the robot vacuum' or 'what's the CPU on the NAS?' and Pi does it. --- # A private AI agent inside a group chat URL: https://openclawos.neullabs.com/use-cases/private-group-agent > Drop Pi into a group conversation so it can summarise the thread, capture action items, and answer questions — without any of it leaving your infrastructure. Who it's for: Small teams and private groups who want an assistant without handing chat history to a SaaS. The problem: - Team-assistant SaaS reads your whole chat history in their cloud. - Bolting a bot onto an encrypted group usually breaks the encryption guarantee. - Standup and summary tools rarely respect who is allowed to talk to the agent. With openclawOS: - Signal keeps the group end-to-end encrypted; openclawOS runs the agent on your side of that boundary. - Allowlist-based access controls who in the group can invoke Pi. - Sessions are isolated per sender, so the agent doesn't leak one person's context into another's. How to set it up: 1. Install openclawOS — Run the gateway on a server or a machine in your control. 2. Pair the group channel — Pair Signal or Discord and add Pi to the group. 3. Set an allowlist — Configure who may address the agent so it stays scoped. 4. Use it in-thread — Ask for a summary or capture action items right in the conversation. --- # Long-running research with persistent memory URL: https://openclawos.neullabs.com/use-cases/long-running-research > Send documents to Pi over email or chat and build up a durable, searchable body of context. Vector memory means the agent remembers across sessions, not just within one. Who it's for: Researchers and analysts who need continuity across many documents and days. The problem: - Chat assistants forget everything the moment the window closes. - Uploading sensitive documents to a hosted assistant is often a non-starter. - Re-establishing context every session wastes tokens and time. With openclawOS: - openclawOS stores session memory in SQLite with sqlite-vec for semantic recall, so context persists across reboots. - Forward a paper by email or drop a link in chat; Pi reads it with its tools and returns a structured summary. - Everything is on your hardware and your LLM account, so sensitive material stays put. How to set it up: 1. Install openclawOS — Start the gateway where your documents and tools live. 2. Pair email or chat — Pair the email channel or a messenger to feed documents to Pi. 3. Send material — Forward papers or links; Pi ingests them and remembers the context. 4. Ask across sessions — Come back days later and query the accumulated memory. --- # Customer and team ops without another SaaS URL: https://openclawos.neullabs.com/use-cases/ops-without-saas > Wire Pi to the tools your ops already use so it can triage inbound messages, escalate when needed, and file follow-ups — all from a single self-hosted agent. Who it's for: Ops and support teams who want automation without shipping conversations to a vendor. The problem: - Every ops tool is another SaaS with its own data-retention policy. - Routing a message, escalating, and filing an issue usually spans three products. - Customer conversations are exactly the data you least want in someone else's cloud. With openclawOS: - Pi's tools let one binding read a message, escalate to a human, and file an issue in your tracker. - Self-hosting keeps the whole conversation on your infrastructure. - Bridge the messengers your customers already use instead of forcing a new channel. How to set it up: 1. Install openclawOS — Run the gateway on your ops infrastructure. 2. Pair your channels — Bridge the messengers your customers and team use. 3. Wire the tools — Give Pi access to your tracker and escalation paths. 4. Let it triage — Pi routes, answers, escalates, and files follow-ups in one flow. --- # A personal life-OS in your messenger URL: https://openclawos.neullabs.com/use-cases/personal-life-os > Give Pi read access to the feeds that make up your day and let it assemble a single brief, delivered to the messenger you check first. Who it's for: Individuals who want one assistant across every app instead of ten disconnected ones. The problem: - Your day is scattered across a dozen apps that never talk to each other. - Cloud life-assistants want all of that data centralised on their servers. - One identity should follow you across messengers, not fragment per app. With openclawOS: - Pi's tools pull from your calendar, notes and dashboards, then compose one brief. - openclawOS routes one identity across channels, so it's the same agent on iMessage and Telegram. - It's self-hosted, so the personal data stays yours. How to set it up: 1. Install openclawOS — Start the gateway on a machine that's always on. 2. Pair your daily channel — Pair iMessage or Telegram — wherever you look first. 3. Connect your feeds — Give Pi read access to calendar, notes and any dashboards. 4. Get a brief — Ask for a morning brief and Pi assembles it into one message. --- # The complete guide to self-hosted AI gateways in 2026 URL: https://openclawos.neullabs.com/blog/self-hosted-ai-gateway-guide Published: 2026-05-22 Tags: self-hosted, ai gateway, guide, architecture > What a self-hosted AI gateway is, why it matters, how openclawOS implements one, and a practical setup walkthrough — from zero to multi-channel agent in an afternoon. In 2026, the question is no longer "should I use AI?" — it's "where does the AI live?". And for a growing tribe of developers, power users and privacy-curious normies, the answer is: on hardware I control. This is the case for self-hosted AI gateways. This guide walks through what a gateway is, why it matters, what the trade-offs look like, and how to set one up using openclawOS — the Neul Labs distribution of openclaw, the open-source multi-channel AI agent gateway. ## What problem does a gateway solve? You have a favourite messenger. Maybe several. You also want to talk to an AI assistant. Today, your options are roughly: 1. **Use a vendor app** (ChatGPT, Claude, Gemini). You're locked into their UI; your conversation lives on their servers; switching providers means starting over. 2. **Build a one-off bot** (e.g. a Telegram bot wired to the OpenAI API). Works, but it's per-platform and the context dies when you switch apps. 3. **Use a hosted "AI everywhere" SaaS**. Convenient, but you've added a third-party vendor who sees every message between you and the model. A self-hosted AI gateway is option 4. It runs on your hardware, it understands many messengers natively, and it gives one agent (with one identity and one memory) the ability to follow you wherever you message. ## The architecture in a paragraph A gateway is a microkernel for AI conversations. It owns: - The **channels** (per-messenger adapters: WhatsApp, Telegram, Discord, iMessage, Signal, Slack, etc.). - The **bindings** (routing rules: who's asking, where it came from, which agent answers). - The **sessions** (per-sender state, branching, compaction). - The **memory** (vector store for long-term recall). - The **credentials** (encrypted at rest, keyed to your OS keychain). The gateway does not run the LLM itself — it dispatches to whichever provider you've configured (Anthropic, OpenAI, Google, a local Ollama, whatever). It's the bridge, not the brain. ## Why this design wins **Privacy.** Your conversations never visit a third-party vendor's servers. The only outbound traffic is your prompt to your chosen LLM, the same as if you had used that LLM's app directly. **Identity portability.** Sessions are scoped to your sender identity, not the channel. Start a thread in Telegram, finish it on WhatsApp, the agent remembers. **Model agnosticism.** Provider lock-in is replaced with a YAML setting. Tomorrow's better model is one config change away. **Cost transparency.** You see exactly how many tokens you consumed. You pay for what you use, not a SaaS markup. **Long-term durability.** A self-hosted setup keeps working when the vendor sunsets a feature, raises prices, or gets bought. ## What it actually looks like to run one Here's the openclawOS install loop in three commands: ```sh npm install -g openclawos@latest openclawos onboard --install-daemon openclaw apps install telegram ``` The first command installs the binary. The second registers a launchd (macOS) or systemd (Linux) service for the Gateway and opens the Control UI in your browser. The third walks you through pairing your first messenger — Telegram, because @BotFather is the easiest first pairing of any channel. From here, you'll add an LLM provider (paste an Anthropic or OpenAI API key into the Providers tab), and that's it. Open Telegram. Message your bot. Pi replies. ## The first thirty minutes after install Spend it on the Control UI. There are four tabs that matter: - **Channels.** Pair more messengers. The pairing wizard is different per channel but all of them are under five minutes. - **Sessions.** Watch your conversations appear in real time. Drill into one to see the model's tool calls, reasoning, and token usage. - **Bindings.** This is where you define routing rules. By default, Pi listens for DMs and ignores groups. You can flip that, add per-sender filters, or route different prompts to different agents. - **Providers.** Mix and match. Run Claude Opus for hard questions, Sonnet for everything else, with a fallback to a local Ollama if both vendors are down. ## Scaling up: from personal to family/team A single Gateway handles tens of users comfortably on modest hardware. Things to know: - Sessions are isolated per sender by default. A family member's chat with Pi does not leak into yours. - Identity linking lets one human's sessions follow them across devices — you bind, say, your iMessage handle to your Telegram username and Pi sees them as the same person. - For a team Pi, scope a binding to a Slack workspace or a Discord guild and Pi becomes the team's shared assistant — with shared memory, scoped to that team. ## What about voice, vision, files? Yes to all three. Voice notes are transcribed (Whisper, local or remote). Images are sent multi-modally to the LLM (Claude, GPT-4o, Gemini all support it). Files are forwarded as URLs or chunked text depending on the binding. ## Compliance and audit For regulated use cases (finance, healthcare, legal), openclawOS exposes a JSONL audit log per binding. It records every inbound message, every tool call, every outbound LLM request, with timestamps and identities. Drop the log into your SIEM. Done. ## Where this is going The next year of self-hosted AI is about *agents that act* — not just respond. openclawOS's binding language already supports cron triggers, webhook triggers, and tool execution; the next milestones are nested sub-agents (shipping), persistent background tasks, and end-to-end encrypted cross-channel identity linking. We push releases every week. The roadmap lives in the open on GitHub. ## Where to start If you have a messenger you'd like an AI in and a $5/month VPS or a Mac mini, you have everything you need. Install openclawOS, pair a channel, drop in an API key, say hi to Pi. Tomorrow morning you'll wake up and not want to go back. --- # How multi-channel AI agents actually work under the hood URL: https://openclawos.neullabs.com/blog/multi-channel-ai-agents-architecture Published: 2026-05-15 Tags: architecture, deep dive, kernel, sessions > A deep dive into the openclawOS kernel: routing, sessions, identity, memory and the tricky parts of making one agent feel coherent across WhatsApp, Telegram, Discord and the rest. A multi-channel AI agent looks simple from the outside: you message it in Telegram, it replies with the same personality and memory it had when you talked to it in WhatsApp last night. Under the hood, that simplicity is the result of half a dozen design decisions that each could have been done differently. This is a tour of openclawOS's architecture — specifically the parts that make "the agent feels coherent across messengers" actually true. ## The kernel metaphor isn't decoration The Gateway is a long-running daemon. It owns: - A SQLite database (sessions, memory, bindings, credentials). - A WebSocket fan-out (Control UI, mobile nodes, debug clients). - A supervisor for channel apps (separate Node processes). - A supervisor for agents (in-process by default, sub-process when isolation matters). This shape comes from a microkernel OS: small core, isolated workers, well-defined IPC. A crash in the Discord adapter does not take down WhatsApp. An infinite loop in a custom agent does not freeze the Gateway. You get to ship `unstable code in a stable container`. ## Channels: the messy edge Every messenger has its own personality. WhatsApp's Baileys protocol is a careful reverse-engineering of WhatsApp Web. Telegram is a clean REST + websocket API. Discord is a half-REST, half-WebSocket gateway. Signal is signal-cli wrapping Java internals. iMessage is AppleScript and SQLite. The Gateway hides all of this behind a tiny internal protocol: ``` inbound: Channel → Gateway: { senderId, body, attachments?, replyContext? } outbound: Gateway → Channel: { recipientId, body, attachments?, reactions? } ``` A channel app is responsible for translating between its native protocol and this normalised form. The Gateway never sees a Discord button or a WhatsApp QR code — it sees `senderId` and `body`. The wins: 1. Adding a channel is a self-contained project. The Mattermost adapter doesn't have to understand sessions or routing — that's the Gateway's job. 2. The Gateway is a single mental model regardless of how many channels are paired. 3. You can ship a custom binary that includes only the channels you use, for minimal attack surface. ## Bindings: the routing layer A binding is the answer to "when a message arrives at *this* place, what should happen?". Bindings are a small declarative language: ```yaml trigger: channel: telegram scope: { groupId: "-1001234..." } match: mentions: ["@pi_bot"] agent: pi session: scope: user isolation: strict hooks: beforeSend: - call: censor_pii afterReceive: - call: log_to_jsonl ``` A binding can match on channel, sender, group, message body, or any combination. The matched message is routed to an `agent` running with a specified `session` strategy. Hooks let you intercept before/after the agent runs. This is where the platform's flexibility lives. You can have a coding Pi listening in your Discord while a research Pi listens in your iMessage — same Gateway, different bindings. ## Sessions: identity, memory, branching A session is one continuous conversation between a sender and an agent. Sessions belong to *sender identity*, not channel. This is the magic that makes multi-channel feel like one agent. ### How identity gets resolved Every message arrives with a channel-native sender ID — a phone number, a Discord user ID, an email. The Gateway maps these into a single openclawOS *identity* via a small table you can edit: ``` identity "dipankar": whatsapp: +49 1577 1234567 imessage: me@example.com telegram: @dipankarsarkar discord: 1234567890 ``` When a message from any of those arrives, the session attaches to "dipankar". One Pi, one memory, four messengers. For unbound senders (people not in your identity table), the Gateway creates a per-channel anonymous identity. This is what gives a Discord stranger their own session without polluting yours. ### Compaction When a session's context approaches the model's window, the Gateway calls the LLM with a summarisation prompt and replaces the oldest turns with a tight summary block. The replaced turns stay on disk for audit; only the summary appears in subsequent prompts. Compaction is opportunistic — when the next message arrives, the Gateway checks whether the prompt will fit and runs compaction inline if it won't. The user sees a slight latency on that one message. The agent keeps the gist. ### Branching Sometimes you want to explore an idea without polluting the main thread. `openclaw fork` (or `/fork` in any channel that supports commands) duplicates the current session and lets you wander. Branches can be merged back, abandoned, or kept as their own threads forever. ## Memory: vector + structured Long-term memory is two layers: 1. **Vector store** backed by `sqlite-vec`. Pi can write semantically searchable notes ("user prefers Postgres over MySQL") and recall them in future sessions. 2. **Structured facts** in normal SQLite tables. Pi can record arbitrary key-value facts about an identity ("dipankar's wife: Sara", "dipankar's location: Berlin"). Memory writes happen via explicit tool calls — Pi has to decide to remember. This is intentional: it avoids the failure mode where every conversation pollutes the long-term store. ## Agents: in-process and bring-your-own Pi is the default agent. It speaks to the configured LLM provider and runs its tool loop in-process. For most users, this is what they want. For custom agents, openclawOS exposes a tiny interface: ```ts export interface Agent { name: string; respond(input: AgentInput): AsyncIterable; } ``` You implement it, drop the file under `~/.openclaw/agents/`, hot-reload picks it up. The Gateway treats your agent the same as Pi — it gets a session, can call tools, can read memory. For agents that need isolation (e.g. running untrusted user-submitted code), the Gateway supports running an agent in a worker subprocess with restricted file system and network access. ## What this all gives you The end result, for the user, is a chatbot that feels like a single coherent assistant across every messenger they use. The architecture exists to make that possible without inheriting half a dozen messenger-specific complications. Most of the magic is, as usual, in the boring parts: a clean protocol, isolated processes, explicit identity, write-on-demand memory. None of these are novel ideas — they're just the right ideas, applied carefully, in one place. --- # How to build a self-hosted WhatsApp AI bot in 2026 URL: https://openclawos.neullabs.com/blog/whatsapp-ai-bot-self-hosted Published: 2026-05-08 Tags: whatsapp, tutorial, claude, gpt > A practical walkthrough of pairing WhatsApp to a self-hosted AI agent powered by Claude or GPT — using openclawOS, no Meta Business API, no cloud SaaS in the middle. WhatsApp is the world's biggest messenger. Self-hosting a WhatsApp AI bot used to require a small army: the Business API, a verified Meta account, a webhook URL, a "messaging conversation" pricing model, and a bunch of paperwork. In 2026, you don't need any of that. Here's how to wire a self-hosted AI agent into your own WhatsApp number using openclawOS — install to first message in about five minutes. ## What you'll end up with A WhatsApp number that, when messaged, replies with an AI agent of your choice (Claude, GPT, Gemini, anything OpenAI-compatible). The agent has memory, can use tools (file system, browser, vector recall), and stays consistent across sessions. The Gateway runs on a machine you own. WhatsApp messages decrypt only inside your network. The LLM call is the only outbound traffic. ## What you need - A computer to run the Gateway. A $5 VPS, a Raspberry Pi 4, a Mac mini — anything with Node 22+. - A spare phone number for the bot. A second SIM is cleanest; a Twilio number works too. - An API key for your LLM of choice. Anthropic's Claude Opus 4.6 is what we recommend; GPT-4o or Gemini also work. ## Step 1: Install openclawOS ```sh npm install -g openclawos@latest openclawos onboard --install-daemon ``` This installs the binary, registers a service, and opens the Control UI on `http://localhost:7777`. For Docker: ```sh docker run -d --name openclawos \ -p 7777:7777 \ -v openclawos-data:/data \ ghcr.io/neullabs/openclawos:latest ``` ## Step 2: Add your LLM provider In the Control UI, open the **Providers** tab. Paste your API key. Claude Opus 4.6 is the default; pick whichever you like. This key never leaves your Gateway — it's encrypted at rest using your OS keychain. ## Step 3: Pair WhatsApp ```sh openclaw apps install whatsapp ``` A QR code appears in your terminal. On the phone you're pairing: 1. Open WhatsApp. 2. Settings → Linked Devices → Link a Device. 3. Scan the QR. That's it. The Gateway is now a "linked device" on your WhatsApp account — the same way your laptop or web client would be. If you want to keep your personal number personal, pair a second number on a different phone (or use a dual-SIM phone), and link that one instead. ## Step 4: Open a binding By default, the WhatsApp binding routes 1:1 DMs to Pi and ignores groups. To adjust, edit `~/.openclaw/bindings/whatsapp.yaml`: ```yaml trigger: channel: whatsapp scope: any match: not: isGroup: true agent: pi session: scope: user isolation: strict ``` Want Pi in a specific group? Add `groupId` to scope. Want it to listen only when @-mentioned? Add `mentions: ["@yourbot"]`. Bindings hot-reload — save the file and changes apply immediately, no restart. ## Step 5: Message it From any other WhatsApp account, message the paired number. Pi responds within a second or two depending on the LLM you picked. Try: - "What's the weather in Berlin?" (Pi uses its web tool) - "Remember that I prefer Postgres over MySQL." (Pi writes to vector memory) - Send a photo of a receipt. (Pi sees it via vision and itemises) ## Common adjustments **Voice notes** are transcribed by default via Whisper. If you want a local Whisper, point `~/.openclaw/config.yaml` at a local endpoint: ```yaml transcription: provider: local endpoint: http://localhost:8080/transcribe ``` **Reactions** — Pi can react instead of reply (useful for "acked" UX). Toggle in the binding: ```yaml behavior: reactBeforeReply: "👀" ``` **Multiple bots** — pair more numbers, give each its own binding. One can be a "coding Pi", another a "personal Pi". ## Cost reality Heavy use: ~$30/month in Claude tokens for a chatty user. Light use: ~$5. Server: $5/month VPS or zero if you're on hardware you already own. The economics are dramatically better than any hosted "WhatsApp AI" SaaS — they all markup LLM tokens 3-10×. ## Privacy reality Your messages decrypt only inside your Gateway. There is no openclawOS telemetry. The only outbound traffic is the LLM call. If you trust WhatsApp's E2E and trust your LLM vendor, you have full privacy. ## What's next Pair Telegram, Discord and iMessage with the same Gateway. Move identity-link to a single profile so when you write to Pi in WhatsApp the conversation continues on iMessage when you're at your Mac. Add a cron binding so Pi sends you a morning brief. The whole stack composes — that's the point. --- # Telegram AI bot with Claude — a 5-minute self-hosted setup URL: https://openclawos.neullabs.com/blog/telegram-ai-bot-with-claude Published: 2026-05-01 Tags: telegram, claude, tutorial, bot > Build a Telegram bot powered by Claude (or any LLM) without a SaaS in the middle. Step-by-step setup with openclawOS, @BotFather, and Pi. Telegram is the cleanest bot platform on the consumer internet. You don't need to verify a business, pay for a Cloud API, or expose a webhook URL. Five minutes from "I want a Telegram AI bot" to "it works". This is how to do it with openclawOS — self-hosted, your model of choice, full Pi agent capabilities. ## Step 1: Install openclawOS ```sh npm install -g openclawos@latest openclawos onboard --install-daemon ``` The Control UI opens on `localhost:7777`. ## Step 2: Create a bot Message [@BotFather](https://t.me/BotFather) on Telegram. Send `/newbot`. Pick a display name and a username ending in `bot`. BotFather hands you a token that looks like `123456789:ABCdefGhIJKlmnopqRstuv`. Copy it. ## Step 3: Pair Telegram ```sh openclaw apps install telegram ``` The CLI prompts for the token. Paste, hit enter. Or do it from the Control UI's Channels tab. ## Step 4: Drop in your LLM key In the Control UI's Providers tab, paste your Anthropic API key. We recommend Claude Opus 4.6 for Pi's full tool-use behaviour; Sonnet 4.6 also works and is cheaper. If you'd rather use OpenAI, Gemini, or a local Ollama, those work too — pick in the dropdown. ## Step 5: Say hi Open your bot in Telegram. Send `/start`. Pi responds. Try: - "What's on the front page of Hacker News?" - "Summarise this PDF" (attach a file) - "Remember that I'm vegetarian and based in Berlin" You're done. Total time: under 5 minutes assuming you didn't refill your coffee. ## What you can do from here ### Commands Pi auto-registers - `/new` — start a fresh session (forget current memory) - `/fork` — branch the current session - `/summary` — compact the current session - `/agents` — list available agents (if more than one) - `/help` — Pi explains what it can do These all show up in BotFather's command list if you choose to publish them. ### Bind to a group By default Pi only listens to DMs. To make it active in a group: ```yaml # ~/.openclaw/bindings/telegram-team.yaml trigger: channel: telegram scope: { groupId: "-1001234..." } match: mentions: ["@your_bot"] agent: pi session: scope: group ``` Now `@your_bot what did we discuss yesterday?` triggers Pi in that group. ### Inline mode In your bot's settings on @BotFather, enable inline mode. Now in any chat, type `@your_bot something` — Pi will offer inline results you can tap to send. Inline is great for summaries, code snippets, structured replies you want to drop into another conversation. ### Multiple bots Pair as many bots as you like. Each one is its own binding. Common setups: - `@dipankar_dev_bot` → coding Pi, listens in your engineering Discord too - `@dipankar_personal_bot` → personal Pi, also handles your iMessage - `@dipankar_research_bot` → a research Pi with a different system prompt and different tools enabled ## Cost expectations A Telegram-Pi chatting with you a few dozen times a day costs $3-10/month in Claude Sonnet tokens. Opus is 5-10× more. Local models are free per token but the round-trip is slower and tool-use reliability is lower. ## Privacy and rate limits Telegram bot DMs are server-side; Telegram does see them as a vendor (they always have for any bot). The openclawOS Gateway sits between Telegram and your LLM — Pi processes only the latest turns, not your full history. Rate limits: Telegram caps bots at 30 messages/second per chat, 20 messages/minute per group. Pi's tool use never approaches this in normal use. ## Beyond the basic loop The fun starts when you wire bindings together. A common second move is connecting Pi to a vector store of your own notes, so you can ask Telegram-Pi about your Obsidian vault. Or wire a cron trigger to send you a morning brief on Telegram every day at 7am. Or expose Pi as a webhook so your CI can ping it when a build fails. The Gateway handles all of this. Telegram is just the surface. --- # A Discord AI bot without giving your data to OpenAI URL: https://openclawos.neullabs.com/blog/discord-ai-bot-without-openai-api-key Published: 2026-04-24 Tags: discord, tutorial, bot, open source > Self-host a Discord AI bot that talks to Claude, Gemini, or a local model — never sees OpenAI's servers, runs on your own machine, supports Components v2. The default story for "Discord AI bot" in 2026 looks like this: sign up for some SaaS, hand them your Discord token, watch them route every message through OpenAI, pay $20/month plus token markup. There's a better path. Here's how to host a Discord bot that uses whichever LLM you want — Claude, Gemini, a local Llama, anything — with all the conversation data living on your machine. ## What you get A Discord bot that responds to mentions and DMs in your server. The bot can: - Use Pi's full tool set (browser, code, files, memory, vector recall). - Have per-guild and per-channel bindings (different Pi behaviour in different places). - Send Components v2 buttons and selects when its reply benefits from interactive UI. - React with ACK emoji so users know it's working before the full reply lands. ## Setup ### 1. Create a Discord app Go to https://discord.com/developers/applications → New Application. Name it. Add a Bot. Copy the bot token. Under Bot → Privileged Gateway Intents, enable **Message Content Intent**. (Required to read message bodies.) Under OAuth2 → URL Generator, pick scopes `bot` and `applications.commands`. Pick permissions: Send Messages, Read Message History, Add Reactions, Manage Messages (for thread creation). Copy the URL. Open that URL in a browser to invite the bot to your server. ### 2. Pair openclawOS ```sh openclaw apps install discord ``` Paste the bot token when prompted. Or do it from the Control UI. ### 3. Choose a provider In the Providers tab, drop in your Anthropic, Google, or local API endpoint. Anthropic Claude Opus 4.6 is what Pi is tuned for. Don't have a key? OpenRouter is a single account that proxies most providers; openclawOS treats it as OpenAI-compatible. ### 4. Test DM the bot. Or mention it in a channel: `@yourbot, what is the binding system?`. Pi responds within a few seconds. ## Channel-scoped behaviour Bindings scope by channel: ```yaml # Coding Pi in #engineering trigger: channel: discord scope: { guildId: "111", channelId: "222" } match: { mentions: ["@pi"] } agent: pi system: "You are a senior engineer reviewer. Be concise." session: { scope: thread } ``` ```yaml # Moderation Pi everywhere else trigger: channel: discord scope: { guildId: "111" } agent: mod_pi session: { scope: channel } hooks: afterReceive: - call: classify_toxicity ``` Both live on the same Gateway, same bot identity, separate behaviour. ## Thread auto-scoping Discord threads make excellent session boundaries. The default openclawOS Discord binding creates a new session per thread, so a long conversation in a thread doesn't bleed into other channels' contexts. ## ACK reactions When Pi starts processing, it can immediately react with a `👀` (or whatever you pick). Replies follow when ready. This solves the "is the bot working or stuck?" UX problem without spamming a "typing..." indicator. ## Components v2 Pi can emit interactive UI when responses benefit from structure. Examples: - Multi-option poll: "I see three approaches; pick one" with buttons. - Confirmation flow: "Run this command?" with Yes/No. - Code-block + button: "Here's a fix" with an Apply button that triggers a follow-up tool. You don't have to enable any of this — it's automatic when Pi decides UI helps. ## Privacy reality The Discord platform sees your messages (it always has — you're on their servers). The openclawOS Gateway is between Discord and your LLM. Pi sends only relevant turns to the LLM. There is no third-party SaaS in the path. ## Why this beats hosted SaaS You pick the model. You pick the system prompt. You don't pay anyone's markup. You can fork Pi, patch a skill, and run the patched version next minute. The whole stack is yours. --- # A self-hosted iMessage AI assistant on a Mac mini URL: https://openclawos.neullabs.com/blog/imessage-ai-assistant-mac-mini Published: 2026-04-17 Tags: imessage, mac mini, tutorial, apple > How to turn a Mac mini into a 24/7 iMessage AI assistant — blue bubbles, group chats, vision, voice, all self-hosted with openclawOS. iMessage is a status symbol on the consumer internet. Blue bubbles, tapbacks, end-to-end encryption (within Apple's stack), the lot. Self-hosting an AI assistant inside iMessage used to be more pain than fun. Mac mini + openclawOS makes it surprisingly clean. ## The hardware play Pick a base-model Mac mini. The M4 at $599 is the sweet spot. 16GB RAM, 256GB SSD, fanless, draws ~5W at idle. Plug it in behind your TV. Sign into iCloud with your Apple ID. Enable Continuity so SMS forwarding works too. Done. ## Install openclawOS ```sh npm install -g openclawos@latest openclawos onboard --install-daemon ``` The first run prompts you to grant Full Disk Access (so it can read `~/Library/Messages/chat.db`) and Automation permission (so it can send via Messages.app via AppleScript). Both are normal macOS privacy grants. ## Pair iMessage ```sh openclaw apps install imessage ``` The CLI walks you through. There is no QR code — your Mac is already signed into iMessage; openclawOS just plugs in. ## Choose Pi's "handle" You have three options: 1. **Your own number** with a sentinel. Pi only responds when a message starts with `^^` (or whatever you pick). Good if you don't want a separate identity. 2. **A second Apple ID email** added to Messages.app. Pi gets its own handle; people message that. 3. **A FaceTime number** if you have one available. Same idea. Option 2 is what most people end up doing. It separates "you texting" from "Pi's identity" cleanly. ## Bindings The default iMessage binding listens to DMs: ```yaml trigger: channel: imessage match: not: isGroup: true agent: pi session: scope: user ``` Group chats: by default Pi ignores them unless @-mentioned. Customize by editing `~/.openclaw/bindings/imessage.yaml`. ## Voice notes Voice notes are transcribed via Whisper. Pi treats them as text. If you want Pi to reply with voice, configure a TTS provider in `~/.openclaw/config.yaml`: ```yaml tts: provider: openai voice: nova triggerFor: imessage ``` ## Tapbacks as quick commands Apple's tapback reactions (heart, thumbs-up, etc.) can trigger Pi actions. Common use: react with `👍` to a Pi reply and Pi remembers "this answer was good"; react with `👎` and Pi notes "this approach didn't work". ## The morning brief setup A favourite openclawOS recipe: a cron binding that fires at 7am, asks Pi to gather your calendar + weather + GitHub activity + Hacker News, and ships the result as an iMessage to your phone. You wake up, glance at iMessage, you're caught up. ```yaml trigger: cron: "0 7 * * *" agent: pi prompt: | Pull my Google Calendar for today. Weather in Berlin. Top three Hacker News stories. Any open PRs needing review at neullabs/openclawos. Reply as a single iMessage, no preamble. output: channel: imessage to: "+49 ..." ``` ## Privacy reality Messages stay on the Mac. The chat.db is encrypted-at-rest if you have FileVault on (you do, right?). Pi's outbound LLM call carries only the active turn. No cloud middleman. ## The compound effect The Mac mini quickly stops being "the iMessage server" and becomes "the household AI server". You'll add a WhatsApp pairing, a Telegram bot, an iOS node. One little box, one consistent agent, every messenger. --- # A private AI assistant on Signal — fully self-hosted URL: https://openclawos.neullabs.com/blog/signal-private-ai-assistant Published: 2026-04-10 Tags: signal, privacy, tutorial, self-hosted > Signal is the most privacy-respecting mass-market messenger. Pair it with openclawOS for an AI agent that respects the same privacy posture, end to end. If you've chosen Signal, you've chosen privacy on purpose. Adding an AI assistant to it shouldn't compromise that choice. openclawOS pairs Signal cleanly — the bot's keys live on your hardware, decrypted messages stay there, and only the relevant prompt goes to your chosen LLM. ## What you need - A computer to run openclawOS (Mac, Linux box, Raspberry Pi 4, a $5 VPS, anything). - A phone number for the bot. Second SIM, Twilio, or Numero. - An LLM key. We recommend Anthropic Claude Opus 4.6 if your threat model can include sending prompts to Anthropic. For full local: point at an Ollama endpoint. ## Setup ```sh openclaw apps install signal ``` openclawOS bundles signal-cli. The wizard: 1. Asks for the phone number. 2. Sends a verification SMS or voice call. 3. Prompts for the six-digit code. 4. Registers a Signal device under that number. You can also link as a secondary device to an existing Signal account by scanning a QR (matches the "Linked Devices" flow on a Signal client). ## How conversations flow A message from a Signal contact arrives at the Gateway already decrypted (signal-cli handles that). It hits a binding, routes to Pi, and Pi generates a reply. The reply gets sent via signal-cli, encrypted to the recipient. The decrypted content lives in the Gateway's SQLite database (which you should encrypt with FileVault/LUKS). The LLM provider sees the active turn of the conversation; not the full thread, not the cryptographic identities. ## Group chats Pi works in Signal groups. Default: listens for an @-mention of its name. Sessions can scope per-user (each member's questions stay isolated) or per-group (one shared session for the whole group). ## Disappearing messages Signal's disappearing message timers are respected. If a chat has a 24-hour timer, Pi's memory of that chat expires the same way. This matters for privacy hygiene — you don't want a "forgetting" messenger paired with a "remembering" agent. ## Why this is special Signal users typically have a sharp privacy threat model. Pairing an AI assistant has historically meant compromising that — every "Signal AI bot" SaaS routes messages through an external server. openclawOS doesn't. Your Signal stays Signal, your AI stays yours. ## The "activist" stack A common openclawOS-on-Signal setup: - Raspberry Pi 4 at home, on Tailscale only (no public ports). - Signal account on a Twilio number. - Local Ollama running Llama 3.1 70B for full air-gapped inference. - vector memory for long-term notes. Nothing leaves the local network. The AI is helpful within a fully self-hosted privacy boundary. It's a small win for a specific audience but a meaningful one. --- # Self-hosted Slack AI assistant — bring Pi to your workspace URL: https://openclawos.neullabs.com/blog/slack-ai-assistant-self-hosted Published: 2026-04-03 Tags: slack, tutorial, workspace, self-hosted > Add a Pi-powered AI assistant to your Slack workspace, self-hosted, no SaaS in the middle. Per-channel bindings, ACK reactions, thread summaries. Slack is where work happens. Adding an AI co-pilot inside Slack used to mean handing your messages to a SaaS vendor. openclawOS gives you a self-hosted alternative that takes about 10 minutes to set up. ## What you'll end up with A Slack bot that answers DMs, joins channels you invite it to, summarises threads on demand, and runs Pi's full tool set (browser, code, file system, memory). Conversations decrypt and process inside your Gateway; only the prompt + tool calls go to your LLM provider. ## Setup ### 1. Create a Slack app Go to api.slack.com/apps → Create New App → From an app manifest. The openclawOS CLI prints the exact manifest YAML to paste in. It requests the minimal scopes Pi needs: - `app_mentions:read`, `im:history`, `im:read`, `chat:write`, `channels:history`, `groups:history`, `reactions:write`, `commands`. Install to your workspace. Copy the Bot User OAuth Token. ### 2. Expose your Gateway Slack needs to reach your Gateway via HTTPS. Easy paths: - **Cloudflare Tunnel** (free, no config). `cloudflared tunnel --url http://localhost:7777`. - **Tailscale Funnel**. If you already use Tailscale. - **A real domain** behind a reverse proxy. The CLI shows you exactly what URL to give Slack as the Events Subscription endpoint and Slash Command URL. ### 3. Wire up openclawOS ```sh openclaw apps install slack ``` Paste the token, paste the tunnel URL. The Gateway registers Pi as a channel adapter. ### 4. Invite Pi to channels ``` /invite @pi ``` Pi now listens on that channel for @-mentions. ## Default behaviour - **DMs** → every message goes to Pi. - **Channels** → only when @-mentioned. - **Threads** → each thread is its own session, so a long thread doesn't pollute the main DM. Bindings let you change any of this per-channel. ## ACK reactions Pi reacts with a configurable emoji (default `👀`) within milliseconds of seeing a message. The full reply lands when ready. Users get a "yes I heard you" signal even on long-running tasks. ## Thread summaries `/summary` in any thread asks Pi to compact the thread into a tight summary. Useful for catching up on a thread you missed without scrolling. ## Auto-summarisation If a thread crosses a configurable length, Pi can auto-emit a summary as the first reply in the thread, with a fold-up button to read the original. Off by default — flip on in the binding. ## Reaction-triggered actions You can configure reaction emoji to trigger Pi actions. Common setups: - `:ai:` reaction → Pi summarises that message - `:translate:` reaction → Pi translates to a target language - `:file:` reaction → Pi creates a Linear issue from the message ## Per-channel personas Run a "coding Pi" in #engineering with a different system prompt and different tools than a "support Pi" in #customer-help. Bindings scope by channel ID. ## Why self-host this The dominant alternatives are SaaS — they see every message you send Pi, retain conversation logs, and price-per-seat. Self-hosting means your Slack stays Slack, your AI stays in-network, and you pay for what you consume on the LLM side. For any org with even mild data sensitivity, it's the saner path. --- # A federated AI agent on Matrix with openclawOS URL: https://openclawos.neullabs.com/blog/matrix-federated-ai-agent Published: 2026-03-27 Tags: matrix, federation, tutorial, e2ee > Add Pi to your Matrix homeserver — end-to-end encrypted rooms, federated identity, sessions per room, all on your hardware. Matrix is the federated chat protocol the internet keeps wanting. If you self-host a homeserver (Synapse, Dendrite, Conduit), adding an AI agent that respects the federated, end-to-end encrypted model is the natural next step. openclawOS pairs Matrix cleanly. Here's the setup. ## Setup 1. Provision a Matrix account for the bot on your homeserver (e.g., `@pi:matrix.example.com`). 2. Get an access token from your client (Element → settings → Advanced → Access Token). 3. `openclaw apps install matrix`, paste the homeserver URL + access token. 4. Invite `@pi:your.server` to a room. ## E2EE handshake On the bot's first appearance in an E2EE room, you'll be prompted to verify Pi's device — same flow as verifying any new Element device. openclawOS uses matrix-rust-sdk and speaks Olm/Megolm; verified sessions persist. ## Sessions Each Matrix room is its own session by default. Identity linking can bridge sessions across rooms if you want a single Pi memory across your federated identity. ## Federation Pi appears as a federated user. A Matrix user on another homeserver can interact with `@pi:your.server` and Pi responds, end-to-end encrypted. This is the closest thing to a true peer-to-peer AI assistant — federated identity, federated state, locally-decrypted execution. ## Why bother For self-hosted Matrix admins, openclawOS finishes the stack. You've already chosen "my data stays in my domain"; adding an AI that respects the same posture is just the next checkbox. --- # openclawOS vs Zapier AI — which is right for a self-hosted AI agent? URL: https://openclawos.neullabs.com/blog/openclawos-vs-zapier-ai Published: 2026-03-20 Tags: comparison, zapier, evaluation > Zapier and openclawOS look similar from far away — both connect AI to other tools. Here's how they actually differ and when each one wins. If you've shopped for "AI that connects to other tools", you've seen Zapier (and Zapier's AI features) and openclawOS in roughly the same web search. Here's an honest comparison. ## TL;DR - **Zapier** is a workflow builder with AI features bolted on. Think "no-code automation with LLM steps". - **openclawOS** is a chat-native AI agent gateway. Think "your AI assistant follows you across every messenger you use". They overlap a little. They don't compete much. ## Shape of the product Zapier's primitive is the **Zap** — a trigger plus a chain of actions, configured in a visual builder. AI shows up as an action you can drop in the chain. openclawOS's primitive is the **binding** — when a message arrives on a channel, route it to an agent. The agent decides what to do, possibly using tools, possibly nothing at all. This shapes everything. Zapier is great when you can articulate the workflow upfront. openclawOS is great when the right action depends on what the human said. ## Channels Zapier supports thousands of apps, but its "chat" support is shallow: webhooks, basic Slack, basic Teams. It does not natively pair WhatsApp, iMessage, Signal, Discord, or Matrix. openclawOS supports 30+ channels, all chat-native, including E2EE platforms. If your problem is "AI in a chat app", openclawOS wins. If your problem is "AI inside a webhook chain that ends up in Salesforce", Zapier wins. ## Hosting Zapier is SaaS. Your messages flow through Zapier's servers, are logged, and are governed by their TOS. openclawOS is self-hosted. Your messages decrypt and live on your hardware. For regulated industries, the hosting model is often decisive. ## Cost Zapier prices per task. AI tasks have a premium. A chatty AI use case can hit $50+/month quickly. openclawOS is free. You pay your LLM provider for tokens, the same as you would directly. A heavy user costs $5-30/month in LLM tokens, plus self-hosting (free if you have hardware, $5/month VPS otherwise). ## Tool use Zapier's AI is a step in a workflow. Tool use means picking from the Zapier action catalog and arranging it. openclawOS's Pi has its own tool loop: browser, file system, code editor, shell, vector memory, MCP servers, plus any custom skills you drop in. The agent decides which tool to use, in what order, with no pre-wired chain. For exploratory or open-ended use cases, Pi's loop is more flexible. For deterministic, repeatable workflows, Zapier's chain is simpler to reason about. ## When to pick which **Pick Zapier when:** - Your task is a repeatable workflow with clear steps. - You need to integrate with hundreds of SaaS tools (Notion, Airtable, HubSpot, Salesforce). - You don't care about hosting model or chat-native UX. **Pick openclawOS when:** - Your task is chat-native — you want to text your AI from your favourite app. - You care about privacy or compliance — messages stay on your hardware. - You want one consistent agent identity across WhatsApp, Telegram, iMessage, etc. - You want tool use without arranging a Zap by hand. **Use both when:** Zaps fire side-effects in your stack, and you call openclawOS via webhook to add reasoning steps. The openclawOS Webhook channel is built for this. ## Verdict Different tools, mostly different problems. The marketing taglines overlap; the day-to-day usage barely does. --- # openclawOS vs n8n for AI agents — when each one wins URL: https://openclawos.neullabs.com/blog/openclawos-vs-n8n-for-ai-agents Published: 2026-03-13 Tags: comparison, n8n, evaluation > n8n is the open-source workflow automator. openclawOS is the open-source AI agent gateway. They overlap on the surface and differ a lot in shape. n8n is the open-source workflow automation tool that people pick when they want Zapier without SaaS lock-in. openclawOS is the open-source AI agent gateway that people pick when they want chat-native AI without SaaS lock-in. They overlap on "self-hosted + LLM" and diverge on shape. ## TL;DR - **n8n** is a visual workflow builder. Triggers, nodes, branches. LLM is a node you drop in. - **openclawOS** is a chat-native agent gateway. Channels, bindings, sessions. LLM is the agent's brain. Different problems, both solved well. ## Where n8n is great - Building a deterministic pipeline of operations across SaaS tools. - Visual-builder UX for people who don't write code. - Hundreds of node integrations out of the box. - Mature versioning and execution history. If your problem is "when an order arrives in Shopify, classify it with GPT, file an issue in Linear, post to Slack" — that's an n8n workflow. The shape is clear, the steps are stable. ## Where openclawOS is great - Hosting an AI agent that responds in your chat apps with one identity. - Pi's tool loop — the agent decides which tool to use, in what order. - Session and memory persistence per sender across channels. - Native multi-channel: WhatsApp, Telegram, iMessage, Signal, Slack, Discord, etc. If your problem is "I want to text my AI from WhatsApp and have it answer with code, web search and my notes" — openclawOS is the right shape. ## Stacking them A common pattern: a chat message in WhatsApp triggers openclawOS Pi to gather context, then calls an n8n workflow via webhook to execute the deterministic part (file an issue, update a record), and Pi reports the result back to the user. You get Pi's flexibility on the front-end and n8n's clarity on the back-end. Both are open source. Both self-host. Both speak webhooks fluently. ## Hosting footprint - **n8n**: typically Postgres + Redis + n8n process. ~1GB RAM minimum, comfortable. - **openclawOS**: SQLite (with sqlite-vec for vectors) + a single Node daemon. ~256MB RAM minimum, comfortable on a Raspberry Pi. For tiny boxes, openclawOS wins. For complex deployments, n8n's separation of concerns scales better. ## Cost - **n8n**: free OSS. Cloud option exists. - **openclawOS**: free OSS. Managed hosting in the works. Both pay LLM providers for tokens — same line item. ## Pick which - **AI in your messengers** → openclawOS. - **Deterministic SaaS workflows** → n8n. - **Both** → stack them via webhook. These tools are friends, not competitors. --- # Self-hosted openclawOS vs Claude.ai: the real cost difference URL: https://openclawos.neullabs.com/blog/self-hosted-vs-hosted-claude-cost Published: 2026-03-06 Tags: cost, comparison, claude, hosted > Honest math on what a self-hosted multi-channel AI agent costs vs Claude.ai or ChatGPT Plus — for personal, family, and small-team use cases. Claude.ai costs $20/month. ChatGPT Plus costs $20/month. If you use both, that's $40/month. Self-hosting an AI agent via openclawOS is "free software + tokens". Here's the honest math. ## The hosted plan Claude.ai Pro at $20/month gets you: - Claude 3.5 Sonnet and Opus in the Claude.ai UI - Maybe 5× the usage of free, depending on the model - File uploads, code interpreter, projects ChatGPT Plus at $20/month gets you: - GPT-4o, o1-mini, DALL·E in the ChatGPT UI - ~80 messages per 3 hours on GPT-4o - Image generation, voice mode Both of these are *one UI* — you talk to the AI in their app, on their servers. ## The self-hosted plan openclawOS is free. You pay Anthropic (or OpenAI, Google, etc.) per-token at API rates. Typical personal-use math: - Light user (a dozen messages a day on Claude Sonnet): **$2-5/month** in tokens. - Heavy user (chatty across multiple channels, Opus for hard questions): **$15-40/month** in tokens. - Token-thrifty (Sonnet by default, Opus only on demand): **$5-15/month** for most. So for *just usage*, hosted often comes out about equal for chatty users; cheaper for light users. ## Where self-hosted starts to win 1. **Multi-channel.** Your $20/month Claude.ai is just the Claude.ai web app. openclawOS Pi appears in WhatsApp, iMessage, Telegram, Slack — one identity, one memory. 2. **Provider freedom.** Tomorrow's $5 model can replace today's $20 model with a config change. Hosted plans rarely let you swap. 3. **No usage cliffs.** Hosted plans have rate caps. With self-hosted, you scale with your wallet. 4. **Multiple users.** Family of four on hosted = $80/month. On openclawOS, the same Gateway serves all four; their LLM cost is shared and proportional. 5. **No per-app middleman.** A Telegram-AI-bot SaaS marks up tokens 5-10×. Self-hosting bypasses that markup. ## Where hosted wins 1. **Convenience.** Sign up, click, type. You're done. 2. **Voice and image generation.** ChatGPT's voice mode and DALL·E are well-tuned for their UI. Self-hosting voice is doable but more setup. 3. **Image generation prepaid.** Plus includes DALL·E generations; self-hosting means paying per-image. ## Cost of the box You also need hardware to run the Gateway: - Raspberry Pi 4 (4GB): $55 once, $1/year in electricity. - $5/month VPS (Hetzner, Vultr, OVH). - A Mac mini you already own: $0 marginal. For most users this is rounding. ## Five-person household, one year **Hosted:** $20 × 5 × 12 = **$1,200**, plus everyone is locked into one vendor's UI. **openclawOS:** Mac mini you have + ~$50/month shared LLM cost = **$600/year**, plus everyone messages their AI in whatever app they prefer. Saving $600 a year matters less than the fact that the AI now lives in *your* messengers, *your* hardware, with one memory of who everyone is. ## Decision rule If you mostly use the official Claude.ai or ChatGPT web UI and don't care about chat-app integration, hosted is fine. If you want AI inside the messenger you already use, self-hosting is the more sane shape — and the math, for most users, lands in the same neighbourhood or cheaper. It's not really about money. It's about whose servers your conversations live on. --- # How Pi's tool use works (and how to add your own tools) URL: https://openclawos.neullabs.com/blog/pi-agent-tool-use-explained Published: 2026-02-27 Tags: pi, tool use, skills, deep dive > Pi, the agent bundled with openclawOS, has a tool loop with browser, shell, file system, vector memory, and more. Here's how it works and how to extend it. Pi is the agent that ships with openclawOS. Its job is "respond usefully to messages". The interesting part is that it can do more than just write text — it has tools. This is how Pi's tool loop works under the hood, and how you'd add your own. ## The loop in five sentences 1. A message arrives, binding routes it to Pi. 2. Pi calls the LLM with the conversation context, the available tools, and a system prompt. 3. The LLM either emits a final reply (Pi sends it) or emits a tool call. 4. Pi executes the tool call, sends the result back to the LLM, loops. 5. Loops bound at some configurable max-iterations (default 20) to prevent runaways. Every modern tool-using agent works roughly this way. The fun is in the details. ## What ships in the box Pi's stock toolset: - **shell** — execute a command, capture stdout/stderr. Sandboxed by default. - **fs** — read/write/list files in a configurable workspace. - **browser** — Playwright-backed headless browser; navigate, click, scrape. - **search** — pluggable web search (Brave, Perplexity, Tavily). - **memory** — read/write the vector store and structured facts. - **canvas** — emit structured UI for iOS/Android nodes. - **mcp** — call any Model Context Protocol server you've registered. - **subagent** — delegate to a nested agent loop. Each is a JSON schema + a TypeScript handler. The LLM sees the schema; Pi runs the handler. ## How tools are picked per binding Tools are scoped per binding. A coding Pi binding might enable `shell`, `fs`, `browser`. A research Pi binding might enable `search`, `browser`, `memory`. A child-friendly Pi binding might disable `shell` and `fs` entirely. ```yaml agent: pi tools: enable: [search, browser, memory, subagent] disable: [shell, fs] ``` ## Custom tools — the minimal version Add `~/.openclaw/skills/weather.ts`: ```ts import { defineSkill } from "openclawos/skills"; export default defineSkill({ name: "weather", description: "Get current weather for a city.", input: { type: "object", properties: { city: { type: "string" } }, required: ["city"], }, async run({ city }) { const res = await fetch(`https://wttr.in/${encodeURIComponent(city)}?format=j1`); const data = await res.json(); const current = data.current_condition[0]; return `${current.temp_C}°C, ${current.weatherDesc[0].value} in ${city}`; }, }); ``` The Gateway hot-reloads the file. Pi sees `weather` in its tools list on the next call. The model can now invoke it. ## Sandboxing For tools that touch the file system or shell, openclawOS provides a sandboxing layer. Run the tool in a worker subprocess with restricted permissions: ```ts export default defineSkill({ name: "untrusted_shell", runtime: { isolation: "worker", capabilities: { fs: "readonly", net: false } }, // ... }); ``` This matters when Pi's loop is exposed to untrusted users (e.g., a public Discord bot). ## MCP servers Anthropic's Model Context Protocol gives a standard way for external processes to expose tools. openclawOS speaks MCP — register a server, its tools appear in Pi's toolset: ```yaml mcp: servers: - name: filesystem command: npx args: ["@modelcontextprotocol/server-filesystem", "/Users/dipankar/notes"] ``` Anything the MCP community ships is now usable by Pi. ## Sub-agents Pi can delegate to nested agents — a "researcher" sub-agent with its own toolset, called from Pi's main loop with a focused prompt, returning a summary. Useful for keeping the main loop's context clean while doing deep exploration in a side loop. ## Streaming and ACK Tool calls can take seconds. Pi streams partial results to the channel: - For channels that support "typing…" (Telegram, WhatsApp, Discord), Pi indicates active. - For channels with reactions (Discord, Slack), Pi adds an ACK reaction immediately. - Final reply lands when the loop finishes. ## Cost control Each tool call burns tokens (the tool call goes back as part of the context). For high-volume use, two heuristics: 1. Cap iterations on cheap models, escalate to expensive models for long loops. 2. Use a `summarise` tool that compresses a tool's output before re-injecting into context. Pi has both knobs. ## What this gives you Tool use is the difference between a chatbot ("I think the answer might be...") and an agent ("I checked, the answer is..."). Pi's loop is conventional but the integration with channels, sessions and memory is what makes it useful day-to-day. The Skill API is small enough that any TypeScript developer can write a useful tool in 20 minutes. The lobster tank is full of community skills — weather, smart home, journaling, calendar, ticketing — most of them under 30 lines. --- # How openclawOS uses sqlite-vec for agent memory URL: https://openclawos.neullabs.com/blog/session-memory-vector-search-sqlite-vec Published: 2026-02-20 Tags: memory, sqlite-vec, vectors, deep dive > An honest look at how openclawOS stores Pi's memory: sessions in normal SQLite tables, vector recall via sqlite-vec, no Pinecone or Weaviate required. Long-term memory is what separates "a chatbot" from "an agent that remembers you". openclawOS stores it in two places: structured facts in SQLite tables, and semantic chunks in a vector index. Both live in the same SQLite database, thanks to `sqlite-vec`. This is how it works and the trade-offs we picked. ## Why SQLite openclawOS's choice of "everything in one SQLite file" is intentional. It means: - Zero ops. Backup is `cp openclaw.db openclaw.db.bak`. - Atomic transactions across structured + vector data. - No external service to monitor, restart, version-pin. - Runs everywhere. Pi 4? Yes. Mac mini? Yes. $5 VPS? Yes. For personal/small-team scale (low millions of vectors max), this is plenty. If you ever outgrow it, the storage layer is abstracted — swap for Postgres + pgvector with one config change. ## What gets stored ### Structured facts A simple key-value table per identity: ```sql CREATE TABLE identity_facts ( identity_id TEXT, key TEXT, value JSON, source TEXT, -- which session emitted it created_at INTEGER, PRIMARY KEY (identity_id, key) ); ``` Pi writes via a `memory.set_fact` tool. Common entries: "user's spouse name", "user's city", "user's vegetarian preference", "user's GitHub handle". The model decides what's worth remembering — it's not implicit on every message. ### Semantic chunks The harder, more powerful store. Pi writes via a `memory.note` tool: ``` memory.note({ identity: "dipankar", text: "User prefers Postgres over MySQL for new projects. Reason: better JSON support, less foot-gun-y." }) ``` That call: 1. Embeds the text using the configured embedding model (default: OpenAI text-embedding-3-small, cheap). 2. Stores the chunk + embedding + metadata in the `memory_chunks` table via sqlite-vec. 3. Returns a chunk ID for later reference. At recall time: 1. Pi calls `memory.recall(query: string, k: int)`. 2. openclawOS embeds the query, does a vector ANN search in sqlite-vec. 3. Top-k chunks come back, with their relevance scores and metadata. ## The sqlite-vec setup sqlite-vec is a SQLite extension that adds vector columns and ANN queries. It's loaded once at Gateway start: ```ts db.loadExtension("sqlite-vec"); db.exec(` CREATE VIRTUAL TABLE memory_chunks USING vec0( embedding float[1536], identity TEXT, text TEXT, created_at INTEGER ); `); ``` Queries are SQL — sqlite-vec adds a `MATCH` operator: ```ts db.prepare(` SELECT text, distance FROM memory_chunks WHERE embedding MATCH ? AND identity = ? ORDER BY distance ASC LIMIT ? `).all(queryEmbedding, identityId, k); ``` It's fast (sub-10ms for 100k chunks on a laptop). It's atomic with the rest of your data. It's one file. ## Identity scoping Memory is namespaced by identity. A query from identity A cannot recall chunks written by identity B unless an explicit cross-identity rule is configured (e.g., a household "shared memory" identity). This prevents the worst-case privacy failure: your bot accidentally recalling someone else's preferences in your conversation. ## Compaction interaction Long sessions get compacted (older turns summarised to save tokens). Compacted summaries can optionally be written to long-term memory as chunks, so the agent retains gist beyond the session window. This is opt-in per binding. Default is on for personal use, off for high-traffic public bots (where the noise-to-signal ratio of compacted summaries is poor). ## Embedding model The default is OpenAI's text-embedding-3-small. It's cheap (~$0.02 per million tokens) and good enough for personal-scale recall. For full-air-gapped setups, openclawOS supports local embedding via an Ollama endpoint or sentence-transformers. Quality is slightly lower; latency is much lower. ## Backup and migration The whole database is one file. To backup: copy it. To migrate to a new machine: rsync the file. To start fresh: delete it. For automated backups, run `litestream` against the SQLite file — point-in-time recovery, continuous backup to S3 or a remote SQLite. We recommend it for any non-toy deployment. ## When you outgrow this If you ever need to scale past a few million vectors or want shared multi-region memory, swap the storage layer for Postgres + pgvector. The interface is the same; the config changes one line: ```yaml memory: driver: postgres url: postgres://... ``` Most people never need this. ## The point Vector search is often presented as something that requires a whole separate service. For agent memory at personal/team scale, it doesn't. A single SQLite file with sqlite-vec gives you everything you need, with zero ops and atomic transactions across all your data. It's one of those choices that looked unfashionable two years ago and now looks obvious. --- # Home automation via WhatsApp — Pi, Grafana, Roborock and a Bambu printer URL: https://openclawos.neullabs.com/blog/home-automation-grafana-roborock-via-whatsapp Published: 2026-02-13 Tags: home automation, use case, whatsapp, story > A real-world setup: openclawOS Pi running on a Mac mini, taking commands via WhatsApp to control a Roborock, monitor a Bambu print, and query Grafana. The set-up has gradually become invisible, which is the point. I message my WhatsApp number. Pi responds. The Roborock starts. The Bambu print finishes. The Grafana panel I asked about lands as a screenshot. Here's what's actually under the hood. ## The hardware - Base-model M4 Mac mini ($599), tucked behind the TV. Pulls about 5W idle. - A spare Pixel running a WhatsApp account on a dedicated number. - The usual smart-home pile: a Roborock S8, a Bambu Lab P1S, an Aqara hub, a Hue bridge. - A Synology NAS running a Grafana + Prometheus stack. ## The software - openclawOS on the Mac mini. - WhatsApp paired via the QR-code flow. - Pi running with a custom set of skills. The skills: - `roborock.start(room)` — Xiaomi cloud API, python-miio fork. - `roborock.status()` — same. - `bambu.print_status()` — local Bambu Studio API (the printer exposes it on LAN). - `bambu.pause()` / `bambu.resume()`. - `grafana.panel(dashboard, panel)` — screenshot via the Grafana API. - `homeassistant.call(service, args)` — wraps the Home Assistant REST API for anything else. Each skill is about 30 lines of TypeScript, written over a long Sunday. ## What it feels like > Me (in WhatsApp): "Vacuum the kitchen please." > Pi: 👀 > Pi: "Started the kitchen + dining area. ETA 14 min." The "ETA 14 min" is Pi reading the room map's surface area and using a rough rate from past runs. It's not magic — it's just having a context-aware tool. > Me: "How's the print going?" > Pi: "76% on the bracket. 23 minutes left. Bed at 60°C, nozzle 220°C. No errors." > Me: "Show me last hour's CPU on the NAS." > Pi: [screenshot of the Grafana panel] The Grafana skill grabs a PNG via Grafana's `/render` endpoint, uploads it as an inline WhatsApp image. Same as if I'd taken a screenshot myself. ## Why this beats Siri / Alexa Siri doesn't know what a Bambu print bed temperature looks like. Alexa doesn't speak Grafana. Pi can be taught anything — the tool API is the contract; if there's an HTTP endpoint, Pi can hit it. Also: Siri and Alexa exfiltrate your queries to their cloud. Pi doesn't. The Mac mini handles inference dispatch; Anthropic sees the prompt and the tool calls Pi made. Nothing more. ## The setup that started it This stack didn't appear at once. The progression: 1. Pair WhatsApp to openclawOS. Basic Pi works. 2. Pi summarises my morning calendar at 7am via a cron binding. 3. Add Roborock skill. "Vacuum the kitchen" actually works. 4. Add Bambu skill because I kept asking from afar. 5. Add Grafana skill because the NAS is annoying to log into. 6. Add Home Assistant fallback for anything else. Each addition was a weekend (or a long evening). The compounding effect is the thing — by month three, the Mac mini was the household AI server, and I'd stopped opening half the device-specific apps. ## What I'd change - Voice replies from Pi back to my AirPods would be nice. The macOS app supports it; I haven't wired the AirPods path. - Pi sometimes forgets which Bambu I'm asking about (I have two). Identity-linking a "printer-id" key would fix it; I haven't bothered. - I want Pi to proactively notify on failed prints. That's a webhook from Bambu → openclawOS, queued for v4. ## Cost Mac mini: $599 once. Power: ~$1/month at $0.30/kWh. LLM (Claude Sonnet): ~$8/month. Heavy days hit $1.50/day; quiet ones are pennies. Total: ~$10/month + the one-time mini. For comparison, three different "AI home automation" startups I've tried wanted $20-50/month each, sent every query to their server, and didn't have half the skills I wrote in a weekend. ## The takeaway The point of openclawOS isn't "an AI in WhatsApp". The point is that *the AI can be wired to anything*, and the messenger is just the surface. Once the wiring's in, you stop opening apps. --- # PR code review from Telegram, by way of Pi URL: https://openclawos.neullabs.com/blog/pr-code-review-from-telegram-with-pi Published: 2026-02-06 Tags: telegram, github, code review, narrative > How I review pull requests from the sofa: a Telegram binding that pipes GitHub PRs to Pi, who summarises diffs and surfaces likely regressions. I've been off-engineering for a while — running Neul Labs is more product and ops than code. But our small contributor base ships pull requests at all hours, and "approve this PR" is still mostly on me. So I built a small openclawOS binding that does the first half of the review work and sends the result to my Telegram. Here's the shape. ## The binding ```yaml trigger: channel: github match: event: pull_request action: [opened, synchronize] agent: pi session: { scope: pr } prompt: | Review the diff. Surface: - Likely regressions or broken assumptions - Tests missing for the changed behaviour - Style nits I should call out, briefly - One-sentence summary, then bullets output: channel: telegram to: "@dipankar_dev_bot" ``` ## What I get A Telegram message within ~30 seconds of any PR opening or being pushed to: > **PR #142: feat: add identity linking across channels** > Summary: Adds a new `identities` table and a `linkIdentity()` API. Migrates existing per-channel session lookups to go through the new table. > > ⚠ The migration is not idempotent — re-running it on an already-migrated DB will throw a uniqueness constraint. Wrap in a check. > ⚠ No test for the cross-channel session lookup case. (Existing tests are channel-scoped.) > ✓ Backwards compatible at the binding API level. > nit: `linkIdentity` and `linkIdentityChain` differ subtly; consider naming the latter for clarity. It's not always right but it's almost always *useful* — a starting point. I read it. If it's flagging something real, I open the PR and engage. If it's all benign, I approve from the GitHub mobile app. ## Why Telegram, not Slack Telegram is what I check on the sofa. Slack feels like work. The choice of channel is purely about which app I have less guilt opening at 9pm. The binding doesn't care — the same setup with `output.channel: slack` would post into a #pr-reviews channel for a team setup. Several openclawOS users do exactly that. ## What Pi can't do This setup is fine for diffs under 500 lines. Above that, the model loses track of where assumptions live. I keep large refactors as human-only territory. It's also not great at security review. The model occasionally over-flags things (a string concatenation it suspects of being SQL injection that isn't) and under-flags real issues (subtle race conditions). I never use it as a sole security signal. ## What Pi is great at - One-paragraph summaries of "what this PR does". - Catching missing tests for behaviour change. - Style consistency. - Catching off-by-one and edge-case omissions in clearly-scoped functions. These are the boring categories of review feedback. Pi catches them; I get to spend my attention on the interesting categories. ## Setup, end-to-end If you want this for your repo: 1. Install openclawOS. 2. Create a Telegram bot (BotFather). 3. Register a GitHub App pointed at your Gateway's `/github` webhook. 4. Drop the binding YAML above. 5. Open a PR. Watch Telegram light up. Total time: about 45 minutes if it's your first openclawOS setup, 10 if you already have a Gateway running. ## The bigger pattern This isn't really about code review. It's about *triage layer between an event stream and your attention*. Pi is good at first-pass triage: "is this worth your time, and if so, what should you look at first?". openclawOS is the wiring that lets that triage live in whichever app you're most likely to glance at. Substitute "PR" with "support ticket", "Linear issue", "incoming email", "Sentry alert", and the same shape works. The Telegram-Pi-GitHub triangle is just one slice of it.