Post

OpenClaw: Your Self-Hosted AI Gateway for Every Chat App

OpenClaw is a self-hosted AI gateway that turns your own machine into an always-on AI agent accessible from WhatsApp, Telegram, Discord, and more.

OpenClaw: Your Self-Hosted AI Gateway for Every Chat App

Most AI assistants live behind a company’s servers. You send a message, it goes to their cloud, their logs, their infrastructure. OpenClaw flips that model. It’s a self-hosted AI gateway that runs on your own machine — a laptop, a VPS, a Raspberry Pi — and turns it into an always-on AI agent accessible from WhatsApp, Telegram, Discord, iMessage, and more.

Think of it as your personal AI bridge: you pick the model, you own the data, you control the rules.

“EXFOLIATE! EXFOLIATE!” — A space lobster, probably (OpenClaw’s unofficial mascot is a lobster 🦞)

Key facts:

  • Open source (MIT license)
  • Self-hosted — runs on Node 22+, on any OS
  • Multi-channel — one Gateway process serves multiple chat apps simultaneously
  • Model-agnostic — plug in Anthropic, OpenAI, Google Gemini, Ollama, or any OpenRouter model
  • Agent-native — built for tool use, memory, multi-agent routing, and persistent sessions

🆚 Why Not Just Use ChatGPT or Claude.ai?

Great question. Those tools are excellent. But they have tradeoffs:

FeatureHosted AI (ChatGPT, Claude.ai)OpenClaw (Self-Hosted)
Data stays on your machine
Works in your existing chat apps
Multi-channel (WhatsApp + Telegram + Discord)
Persistent memory across sessionsLimited✅ (Markdown files)
Custom personas and agent rulesLimited
Multi-user, isolated agents
Your own API keys / billing
Mobile integration (camera, screen, location)✅ (iOS + Android nodes)

If you’re a developer, power user, or someone who just doesn’t want their life events logged in a stranger’s database — OpenClaw is worth a look.


⚙️ How It Works

At its core, OpenClaw runs a Gateway daemon — a persistent process that:

flowchart TD
    WA["📱 WhatsApp"]:::channel --> GW
    TG["✈️ Telegram"]:::channel --> GW
    DC["🎮 Discord"]:::channel --> GW

    GW["🦞 Gateway\n(routes messages)"]:::gateway --> A1["🤖 Agent Pi\n(your workspace)"]:::agent

    A1 --> T["🔧 Tools\n(exec, browser, files)"]:::tool
    A1 --> M["🧠 Memory\n(Markdown files)"]:::tool
    A1 --> S["💬 Sessions\n(per-user context)"]:::tool

    A1 --> GW
    GW --> WA
    GW --> TG
    GW --> DC

    classDef channel fill:#4A90D9,stroke:#2c5f8a,color:#fff
    classDef gateway fill:#9B6EBD,stroke:#6b4785,color:#fff
    classDef agent fill:#5BA85A,stroke:#3a6e39,color:#fff
    classDef tool fill:#D97B4A,stroke:#9e5430,color:#fff
  1. Listens to your configured chat channels (WhatsApp, Telegram, Discord, etc.)
  2. Routes incoming messages to the right AI agent
  3. Runs the agent turn (tool calls, model inference, memory lookup)
  4. Replies back to the chat

🚀 Getting Started in 5 Minutes

You need: Node 22+ and an API key (Anthropic, OpenAI, etc.).

1. Install OpenClaw

1
2
3
4
5
6
7
8
# macOS / Linux
curl -fsSL https://openclaw.ai/install.sh | bash

# Windows (PowerShell)
iwr -useb https://openclaw.ai/install.ps1 | iex

# Or via npm
npm install -g openclaw@latest

2. Run the Onboarding Wizard

1
openclaw onboard --install-daemon

This interactive wizard walks you through:

  • Configuring your AI provider and model
  • Setting up channels (Telegram, WhatsApp, Discord)
  • Installing OpenClaw as a background service

3. Start the Gateway

1
openclaw gateway --port 18789

4. Open the Control UI

1
openclaw dashboard

Opens a browser-based dashboard at http://127.0.0.1:18789/ — a full chat interface, session inspector, and config editor.

5. Connect a Channel (e.g., Telegram)

1
openclaw channels login --channel telegram

Follow the prompts to link your Telegram bot token (get one from @BotFather).


🧠 The Agent Workspace

One of OpenClaw’s most interesting design choices: the agent’s “brain” is just a folder of Markdown files.

By default this lives at ~/.openclaw/workspace/. The files inside define who the agent is:

FilePurpose
SOUL.mdPersonality, tone, core values
AGENTS.mdOperating instructions, memory workflow
USER.mdInfo about the person the agent serves
IDENTITY.mdAgent name, emoji, avatar
TOOLS.mdNotes on external tool setup (cameras, SSH hosts, etc.)
MEMORY.mdLong-term curated memory
memory/YYYY-MM-DD.mdDaily running notes
HEARTBEAT.mdPeriodic background task checklist

You edit these files directly. The agent reads them at the start of each session. The files are the memory. No black-box database, no proprietary format — just text you can version-control with Git.


💾 Memory: Smarter Than You’d Expect

OpenClaw’s memory system is deceptively powerful.

Layer 1 — Markdown files: The agent writes notes to memory/YYYY-MM-DD.md during conversation. These persist across sessions.

Layer 2 — Semantic search: OpenClaw builds a vector index over your memory files. When the agent calls memory_search, it runs hybrid BM25 + vector retrieval — finding relevant notes even when the wording is different.

Layer 3 — Auto-flush before compaction: When a session context is getting full, OpenClaw silently prompts the agent to write important things to disk before the context is summarized. Nothing important gets lost.

Advanced options include:

  • MMR re-ranking to reduce duplicate results
  • Temporal decay so recent memories rank higher than old ones
  • Local embeddings (no API key needed) via node-llama-cpp

🔀 Multi-Agent Routing

Run multiple isolated agents on a single Gateway — each with its own workspace, persona, auth credentials, and session store.

Real-world uses:

  • Personal vs. Work: Different WhatsApp numbers route to different agents with different system prompts and tool access.
  • Family group chat: A dedicated agent for a group chat, with restricted tools (no file writes, no exec).
  • Channel-based routing: WhatsApp messages go to a fast everyday agent; Telegram goes to a slower, more thoughtful one.
1
2
3
4
5
6
7
8
9
10
11
12
{
  agents: {
    list: [
      { id: "everyday", workspace: "~/.openclaw/workspace-everyday", model: "anthropic/claude-sonnet-4-5" },
      { id: "deep",     workspace: "~/.openclaw/workspace-deep",     model: "anthropic/claude-opus-4-6" }
    ]
  },
  bindings: [
    { agentId: "everyday", match: { channel: "whatsapp" } },
    { agentId: "deep",     match: { channel: "telegram" } }
  ]
}

🛠️ Skills: Extending What Your Agent Can Do

OpenClaw agents get their capabilities from skills — small packages of instructions and scripts that tell the agent how to use external tools.

Built-in and installable skills include:

SkillWhat it does
gogGmail, Calendar, Drive, Sheets, Docs via Google OAuth
githubIssue management, PRs, CI runs via gh CLI
obsidianRead/write notes in your Obsidian vault
weatherCurrent conditions and forecasts (no API key needed)
mapsDistance, routing, geocoding (free, no API key needed)
summarizeSummarize URLs, PDFs, YouTube videos, audio
safe-execHuman-approval workflow for dangerous shell commands
self-improving-agentCaptures errors and corrections to improve over time
1
2
openclaw skills install weather
openclaw skills install github

📱 Mobile Nodes: Your Phone as a Sensor

OpenClaw can pair with your iPhone or Android device as a node — giving the agent access to:

  • 📷 Camera (snap, record video clips)
  • 🖥️ Screen recording
  • 📍 Location
  • 🔔 Notifications (list, dismiss, reply)
  • 💬 SMS (Android)
1
openclaw nodes pair

🌐 Supported Channels

ChannelNotes
WhatsAppVia WhatsApp Web (Baileys); one or multiple accounts
TelegramVia grammY; multi-bot support
DiscordVia discord.js; per-guild/channel config
iMessagemacOS only, via local imsg CLI
SignalSupported
MattermostVia plugin
Web Control UIBrowser chat, always available on gateway host
macOS appMenu bar companion

🔒 Security Model

Key controls:

  • allowFrom — allowlist of phone numbers or user IDs allowed to DM the agent
  • dmPolicypairing (QR code handshake), allowlist, or open
  • Per-agent tool restrictions — deny exec, write, browser for untrusted agents
  • Sandboxing — run agents in isolated Docker containers
1
openclaw security audit

🏠 Real-World Setup: What I’m Running

  • Server: Ubuntu VPS (1 vCPU, 2 GB RAM) in Singapore
  • Channel: Telegram bot
  • Model: Claude Sonnet 4.6 via Anthropic API
  • Skills: gog (Gmail + Calendar), github, obsidian, weather, maps, summarize
  • Memory: Daily Markdown logs + semantic search via Gemini embeddings
  • Heartbeats: The agent periodically checks email, calendar, and weather — reaching out proactively if something needs attention

🧭 The Philosophy

  1. Your data should stay on your hardware. No logs shipped to someone else’s cloud.
  2. AI should live where you already communicate. You shouldn’t have to open a separate app.
  3. The agent’s “brain” should be human-readable. Markdown files you can edit, search, and version-control.
  4. Self-hosting shouldn’t require a PhD. Install script → wizard → running in minutes.

📚 Resources


Happy hacking! Next: building your first OpenClaw skill from scratch.

This post is licensed under CC BY 4.0 by the author.