Chapter 7 · 6 lessons
OpenClaw & Always-On Agents
The self-hosted gateway pattern: channels, sessions, skills precedence, ClawHub, plugin bundles, migration from Claude Code, and delegating coding to CLI agents.
OpenClaw · Claude Code · OpenAI Codex
Show all 6 lessonsHide list
Lesson 1 of 6
The Gateway Model
OpenClaw is an open-source (MIT), self-hosted gateway that connects chat apps — WhatsApp, Telegram, Slack, Discord, Signal, iMessage, and more — to model-agnostic AI agents. One long-running Gateway process owns sessions, routing, channel connections, and tools. You talk to your agent from your phone; it runs on your machine or server.
WhatsApp Telegram Slack Discord Web UI iOS/Android nodes
\ | | | / |
└───────┴────────┴───────┴───────┘ │
▼ ▼
┌──────────────────────────────┐ camera/screen/exec
│ Gateway ws://127.0.0.1:18789 │◀────────────┘
│ sessions · memory · routing │
│ skills · plugins · cron │
└──────────────┬───────────────┘
▼
model providers + coding-agent CLIs (Claude Code, Codex)- Multi-agent routing: isolated sessions per agent, workspace, or sender
- Durable memory and scheduled work (cron, webhooks) — things an IDE session does not provide
- Nodes: paired devices expose camera, screen recording, location, and command execution
- Control UI dashboard for chat, config, sessions, and nodes
Lesson 2 of 6
When to Use OpenClaw vs a Coding Agent
| Need | Better fit |
|---|---|
| Tight edit → test → review loop on code | Claude Code, Codex, Cursor |
| Ask your agent something from your phone | OpenClaw |
| Scheduled jobs (daily triage, reports, monitors) | OpenClaw cron + skills |
| Kick off a coding task while away from the laptop | OpenClaw delegating to a coding-agent CLI |
| Shared team assistant in Slack/Discord with memory | OpenClaw with per-channel routing |
OpenClaw's own guidance is clear: keep Claude Code or Codex for the direct coding loop, and use OpenClaw for durable memory, cross-device access, and orchestration. The bundled coding-agent skill is opt-in and delegates work to installed CLIs such as Claude Code, Codex, or OpenCode.
Signal
Frame OpenClaw as a coordination layer. Candidates who pitch it as 'Cursor on WhatsApp' have not thought about review, sandboxing, or where the diff gets read.
Lesson 3 of 6
Skills Precedence, Gating, and ClawHub
| Precedence | Source | Visibility |
|---|---|---|
| 1 (highest) | <workspace>/skills | That agent only |
| 2 | <workspace>/.agents/skills | That workspace's agent |
| 3 | ~/.agents/skills | All agents on the machine |
| 4 | ~/.openclaw/skills (managed) | All agents |
| 5 | Bundled skills | All agents |
| 6 | skills.load.extraDirs and plugin skills | Configured agents |
Same-name skills resolve to the highest-precedence copy, so a workspace can override a shared skill. Skills can declare load-time gates in frontmatter under metadata.openclaw.requires — required binaries, environment variables, config flags, and OS — so a skill that needs uv and GEMINI_API_KEY simply does not appear where those are missing.
- Install from the ClawHub registry: openclaw skills install @owner/skill
- Verify the trust envelope: openclaw skills verify @owner/skill
- Inject secrets through skills.entries.<name>.env or apiKey, never in SKILL.md
- Treat third-party skills as untrusted code; read them and prefer sandboxed runs for risky tools
Lesson 4 of 6
Plugin Bundles: Reusing Claude, Codex, and Cursor Plugins
OpenClaw can install plugins built for other ecosystems. It detects the layout (.claude-plugin/, .codex-plugin/, .cursor-plugin/, a root Agent Plugins plugin.json, or a manifest-less Claude layout) and maps supported pieces into its own model.
| Bundle content | Maps to |
|---|---|
| skills/ | OpenClaw skill roots |
| commands/ (Claude, Cursor) | Treated as skill content |
| hooks/ | OpenClaw hook packs where compatible |
| .mcp.json / mcp config | Bundle-provided MCP servers |
| Runtime code | Not executed as native OpenClaw plugin code |
Why it matters
Build your team's skills and MCP servers in the portable formats, and OpenClaw becomes one more consumer — not a separate codebase to maintain.
Lesson 5 of 6
Migrating and Running Safely
- Preview a migration: openclaw migrate claude --dry-run (imports CLAUDE.md, skills, commands, MCP definitions)
- Apply it: openclaw migrate apply claude --yes
- Keep the Gateway bound to localhost; expose remotely only through an authenticated tunnel
- Scope each agent's tools and channels; do not give a public Discord channel exec access
- Log and review what cron jobs and delegated coding runs actually changed
Blast radius
An always-on agent reachable from chat is a remote-control surface for your machine. Allowlists, sandboxing, and least-privilege tokens are not optional.
Lesson 6 of 6
Worked Example: A Morning Triage From Your Phone
You want a daily summary of new issues and failing builds, and the ability to kick off a fix while commuting.
Plan: expose Claude Code on a server, message it through a bot,
give it full access so it can do anything.
Result: a public Discord user asks it to cat ~/.ssh/id_rsa.OpenClaw gateway on localhost, reached through an authenticated tunnel. Agent "triage" (private Telegram DM only): skills: github-triage (gated: requires env GITHUB_TOKEN) cron: 07:30 daily → summarize new issues + red builds You (Telegram): "open a fix PR for the flaky auth test" triage → coding-agent skill → Codex in a sandboxed worktree → PR link Public Discord routed to a separate agent with no exec tools.
- OpenClaw handled reach, memory, and scheduling; the coding CLI did the code
- Channels were routed to agents with different privileges
- Skills were gated on the credentials they need
Takeaway
Always-on agents are remote controls. Decide who holds which button.