Advanced Recipes
These recipes go beyond the basics. Each is a production-grade setup with full configuration, skill files, and step-by-step instructions.
Prerequisites: You should be comfortable with multi-agent configuration, the Workboard, and skill development.
Multi-Agent DevOps Pipelineโ
Three agents coordinate code review, testing, and deployment through the Workboard.
Architectureโ
PR opened โ reviewer agent claims card โ reviews code
โ tester agent claims card โ runs test suite
โ deployer agent claims card โ deploys to staging
โ human approves โ deployer promotes to production
Agent Configurationโ
{
"agents": {
"list": [
{
"id": "reviewer",
"workspace": "~/.openclaw/workspace-reviewer",
"model": "claude-sonnet-4-6"
},
{
"id": "tester",
"workspace": "~/.openclaw/workspace-tester",
"model": "claude-haiku-4-5-20251001"
},
{
"id": "deployer",
"workspace": "~/.openclaw/workspace-deployer",
"model": "claude-sonnet-4-6"
}
]
},
"bindings": [
{ "agentId": "reviewer", "match": { "channel": "discord", "space": "code-review" } },
{ "agentId": "tester", "match": { "channel": "discord", "space": "testing" } },
{ "agentId": "deployer", "match": { "channel": "slack", "space": "deploys" } }
],
"plugins": {
"entries": {
"workboard": { "enabled": true }
}
}
}
Reviewer Skillโ
---
name: pr-review-pipeline
version: 1.0.0
description: Review PRs and create Workboard cards for next steps
trigger: "review pr|new pr|pull request"
tools: [shell, github, workboard]
---
# PR Review Pipeline
## When a PR is assigned to you
1. Fetch the diff: `gh pr diff <number> --repo <org/repo>`
2. Analyze for:
- Logic errors and potential bugs
- Security vulnerabilities (OWASP top 10)
- Performance regressions
- Missing or inadequate tests
- Breaking API changes
3. Post a structured review comment via `gh pr review`
4. If approved, create a Workboard card for the tester agent:
- Title: "Test PR #<number>: <title>"
- Priority: based on change size (high for >500 lines)
- Labels: test, pr-<number>
- Agent: tester
5. If changes requested, post review and wait for updates
Heartbeat for Auto-Detectionโ
## Every heartbeat
- Check github.com/myorg/myapp for new PRs without reviews
- For each unreviewed PR, claim it and start a review
- Check for PRs with updated commits that need re-review
- Alert on Slack if any PR has been open >48 hours without review
Deployer Skillโ
---
name: deploy-pipeline
version: 1.0.0
description: Deploy to staging and production with safety checks
trigger: "deploy|ship|release"
tools: [shell, github, workboard]
---
# Deployment Pipeline
## Pre-Deploy Checklist
1. Verify all tests passed (check Workboard card status)
2. Check for pending database migrations
3. Verify no active incidents in PagerDuty/OpsGenie
4. Confirm deployment window (no quiet hours, no freeze)
## Deploy to Staging
1. `gh workflow run deploy-staging.yml --ref <branch>`
2. Wait for workflow completion
3. Run smoke tests against staging URL
4. Report status to Slack
## Promote to Production
- Requires explicit human approval ("approve production deploy")
- `gh workflow run deploy-production.yml --ref <tag>`
- Monitor error rates for 15 minutes post-deploy
- If error rate spikes >2x baseline, auto-rollback and alert
Always require human approval for production deployments. Autonomous production deploys are a recipe for 3 AM incidents.
RAG Pipeline (Chat with Your Docs)โ
Set up document ingestion, embedding, and retrieval so your agent can answer questions from your own knowledge base.
Architectureโ
Documents โ Chunking โ Embeddings โ SQLite + sqlite-vec
โ
User question โ Hybrid search (vector + BM25) โ Context โ LLM โ Answer
Option 1: Built-In Memory (Simplest)โ
OpenClaw's built-in memory already supports hybrid search. For a small knowledge base (under 1,000 documents), just drop files into memory:
# Copy your docs into the memory directory
cp -r ~/my-docs/*.md ~/.openclaw/memory/knowledge/
# Or create a skill that ingests documents
openclaw chat "Read all markdown files in ~/project/docs/ and save key facts to memory"
The built-in hybrid search (70% vector + 30% BM25) handles retrieval automatically.
Option 2: MCP Knowledge Base Serverโ
For larger knowledge bases, run a dedicated MCP server:
# Install an MCP-based RAG server (example: using Cognee)
pip install cognee
# Or use Supermemory's MCP server
npx @supermemory/mcp-server
Configure OpenClaw to connect:
{
"mcp": {
"servers": {
"knowledge": {
"command": "npx",
"args": ["@supermemory/mcp-server", "--port", "3100"],
"env": {
"SUPERMEMORY_PATH": "~/.openclaw/knowledge-base"
}
}
}
}
}
Ingestion Skillโ
---
name: knowledge-ingest
version: 1.0.0
description: Ingest documents into the knowledge base
trigger: "ingest|index|add to knowledge"
tools: [shell, filesystem, mcp]
---
# Document Ingestion
## Process
1. Accept a file path or directory
2. For each document:
- Detect format (Markdown, PDF, HTML, plain text)
- Split into chunks (max 500 tokens each, 50-token overlap)
- Preserve headings and section structure as metadata
- Store chunks with source file path and section title
3. Report: number of documents processed, chunks created, any errors
## Chunking Strategy
- Split on heading boundaries first (## and ###)
- If a section exceeds 500 tokens, split on paragraph boundaries
- Keep code blocks intact (never split mid-block)
- Preserve front matter as metadata
Query Skillโ
---
name: knowledge-query
version: 1.0.0
description: Answer questions from the knowledge base
trigger: "search knowledge|ask docs|find in docs"
tools: [mcp, chat]
---
# Knowledge Base Query
## Process
1. Rephrase the user's question for optimal retrieval
2. Search the knowledge base using hybrid search (semantic + keyword)
3. Retrieve top 5 relevant chunks
4. Synthesize an answer citing specific sources
5. Include source file paths so the user can verify
## Response Format
Always include:
- A direct answer to the question
- Source references: [filename.md, section name]
- Confidence level (high/medium/low based on source relevance)
- "I couldn't find information about X" when sources don't cover the question
Practical Examplesโ
You: "What's our API rate limit policy?"
OpenClaw: Based on docs/api/rate-limits.md, the rate limit is 1000
requests per minute per API key, with a burst allowance of 50
additional requests. Enterprise keys have a 5000 RPM limit.
[Source: docs/api/rate-limits.md, "Rate Limiting" section]
You: "Ingest all the markdown files in ~/project/docs"
OpenClaw: Ingested 47 documents, created 312 chunks.
Largest: architecture-overview.md (23 chunks).
3 files skipped (binary/unsupported format).
Start with Option 1 (built-in memory) and upgrade to an MCP server only when you outgrow it. Most personal knowledge bases work fine with built-in search.
Home Assistant Controlโ
Control your smart home through natural language on any channel.
Prerequisitesโ
- Home Assistant running on your network
- A long-lived access token (Settings โ Security โ Long-lived access tokens)
- The
ha-mcpskill or direct API access
Configurationโ
{
"mcp": {
"servers": {
"home-assistant": {
"command": "npx",
"args": ["ha-mcp-server"],
"env": {
"HA_URL": "http://homeassistant.local:8123",
"HA_TOKEN": "${HA_ACCESS_TOKEN}"
}
}
}
}
}
export HA_ACCESS_TOKEN="eyJ0eXAi..."
openclaw gateway restart
Smart Home Skillโ
---
name: home-control
version: 2.0.0
description: Natural language smart home control via Home Assistant
trigger: "lights|temperature|thermostat|home|scene|lock|garage|alarm"
tools: [mcp, http, chat]
---
# Home Control
## Available Commands
- **Lights**: on/off, brightness (0-100%), color, color temperature
- **Climate**: set temperature, mode (heat/cool/auto), fan speed
- **Locks**: lock/unlock (require confirmation for unlock)
- **Scenes**: activate named scenes
- **Sensors**: read temperature, humidity, motion, door/window status
- **Media**: play/pause, volume, source selection
## Safety Rules
- Always confirm before unlocking doors or disabling alarms
- Never expose exact sensor values to group chats
- Log all lock/alarm state changes
## Scene Examples
- "Movie night" โ dim living room to 20%, set warm white, pause music
- "Good morning" โ raise blinds, set kitchen lights to 80% daylight, start coffee
- "Away mode" โ all lights off, lock doors, set thermostat to eco, arm alarm
- "Bedtime" โ gradual dim over 10 minutes, lock all doors, set night temperature
## Automations
- "Turn on porch light at sunset" โ Create HA automation via API
- "Alert me if the garage is open after 10pm" โ Create HA automation + notify via Telegram
Heartbeat for Home Monitoringโ
## Home Monitoring (every heartbeat)
- Check if any doors or windows have been open for more than 30 minutes
- Check if garage door is open after 10pm โ if so, alert via Telegram
- Check indoor temperature โ alert if outside 18-26ยฐC range
- Check smoke/CO detectors for any triggered alarms (immediate alert)
Usageโ
From Telegram, WhatsApp, or any connected channel:
You: "What's the temperature in the house?"
OpenClaw: Living room: 22.3ยฐC, Bedroom: 20.8ยฐC, Office: 23.1ยฐC.
Thermostat is set to 22ยฐC in auto mode.
You: "It's movie night"
OpenClaw: Movie night activated.
- Living room lights dimmed to 20% warm white
- TV backlight set to ambient blue
- Thermostat set to 21ยฐC
Enjoy the show.
You: "Lock up for the night"
OpenClaw: Confirm: lock front door, back door, and garage, arm alarm?
You: "Yes"
OpenClaw: Done. All doors locked, alarm armed in home mode.
Always require confirmation for security-critical actions (unlocking doors, disabling alarms). Never let the agent auto-execute these from the heartbeat.
Server Monitoring and Auto-Remediationโ
An always-on agent that watches your infrastructure and fixes common issues autonomously.
Monitoring Skillโ
---
name: server-monitor
version: 1.0.0
description: Monitor servers and auto-remediate common issues
trigger: "server status|check servers|infra health"
tools: [shell, http, chat]
---
# Server Monitor
## Health Checks
Run these checks on each configured server:
1. **Disk space**: Alert if any partition >85% full
2. **Memory**: Alert if available RAM <10%
3. **CPU**: Alert if load average >4.0 for 5+ minutes
4. **Services**: Check that nginx, postgresql, redis are running
5. **SSL certificates**: Alert if any cert expires within 14 days
6. **HTTP endpoints**: Check response codes and latency
## Auto-Remediation (safe actions only)
- Disk >90%: Clear apt cache, rotate old logs, delete tmp files older than 7 days
- Service crashed: Restart with `systemctl restart <service>` (max 2 retries)
- High memory: Identify top consumer, report but do NOT kill processes
## Escalation
- If auto-fix fails, send Telegram/Slack alert with diagnostics
- If critical service down for >5 minutes, send urgent alert with ssh command to connect
- Never reboot servers autonomously
Heartbeat Configurationโ
## Infrastructure (every heartbeat)
- SSH to each server in ~/.openclaw/workspace/servers.md
- Run health checks (disk, memory, CPU, services, SSL, HTTP)
- Auto-remediate safe issues (log rotation, cache clearing, service restart)
- Post summary to Slack #infrastructure channel
- Urgent alerts go to Telegram
Server Inventoryโ
# Server Inventory
| Name | Host | SSH | Role |
|------|------|-----|------|
| web-1 | 10.0.1.10 | ssh deploy@10.0.1.10 | Web server (nginx + app) |
| web-2 | 10.0.1.11 | ssh deploy@10.0.1.11 | Web server (nginx + app) |
| db-1 | 10.0.1.20 | ssh deploy@10.0.1.20 | PostgreSQL primary |
| cache-1 | 10.0.1.30 | ssh deploy@10.0.1.30 | Redis |
Example Alert Flowโ
[Heartbeat fires at 3:15 AM]
OpenClaw โ checks web-1 โ disk at 92%
OpenClaw โ clears apt cache, rotates logs โ disk drops to 78%
OpenClaw โ posts to Slack: "web-1: disk was at 92%, cleaned to 78% (cleared apt cache, rotated 4 log files)"
[Heartbeat fires at 3:45 AM]
OpenClaw โ checks db-1 โ PostgreSQL not responding
OpenClaw โ restarts PostgreSQL โ service recovers in 8 seconds
OpenClaw โ posts to Slack: "db-1: PostgreSQL crashed, auto-restarted, recovered in 8s"
OpenClaw โ sends Telegram: "โ ๏ธ db-1 PostgreSQL crashed and was restarted. Investigate when available."
Use a cheap model for monitoring heartbeats. This runs every 30 minutes โ even Haiku adds up. See Model Selection for heartbeat model recommendations.
Content Distribution Pipelineโ
Automate multi-platform content publishing from a single source.
Pipeline Skillโ
---
name: content-pipeline
version: 1.0.0
description: Transform and distribute content across platforms
trigger: "publish|distribute|post to|share on"
tools: [shell, http, filesystem, chat]
---
# Content Distribution
## Input
Accept content in any format: blog post, newsletter, video transcript, meeting notes.
## Platform Adaptation
For each target platform, transform the content:
| Platform | Format | Constraints |
|----------|--------|-------------|
| Twitter/X | Thread | 280 chars per tweet, 10 tweets max |
| LinkedIn | Article | Professional tone, 1300 chars for posts |
| Discord | Embed | Markdown, 2000 chars |
| Telegram | Message | Markdown, 4096 chars |
| Newsletter | Email | HTML, include unsubscribe |
| Blog | Markdown | Full-length, with SEO meta |
## Process
1. Analyze the source content
2. Extract key points, quotes, and data
3. Generate platform-specific versions
4. Present all versions for review before posting
5. Post to approved platforms via API/channel
## Scheduling
- "Post this Tuesday at 9am EST" โ Create a cron job
- "Drip this thread over 3 days" โ Schedule individual posts
Usageโ
You: "Turn my blog post at ~/writing/ai-agents-2026.md into a Twitter thread and LinkedIn post"
OpenClaw: Here's what I've prepared:
**Twitter Thread (7 tweets):**
1/ AI agents went from novelty to necessity in 2026. Here's what changed...
2/ The big shift: agents stopped being chatbots...
[...]
**LinkedIn Post:**
AI Agents in 2026: From Novelty to Necessity
[...]
Ready to post? Say "post twitter" or "post linkedin" or "post both".
Voice-Controlled Agentโ
Add speech-to-text and text-to-speech for hands-free control.
Architectureโ
Voice message (Telegram/WhatsApp) โ OpenClaw receives audio
โ Whisper transcription โ Text prompt โ Agent processes
โ Response text โ ElevenLabs/Edge TTS โ Voice reply
Voice Skillโ
---
name: voice-agent
version: 1.0.0
description: Process voice messages and optionally reply with audio
trigger: "voice|audio|transcribe"
tools: [shell, http, chat]
---
# Voice Agent
## Incoming Voice Messages
1. When a voice message arrives, transcribe using Whisper:
`whisper --model base --output_format txt <audio_file>`
2. Process the transcribed text as a normal message
3. If the user prefers voice replies, generate TTS audio
## Text-to-Speech (optional)
Generate voice replies using Edge TTS (free) or ElevenLabs (premium):
### Edge TTS (free)
```bash
edge-tts --text "Your response here" --voice en-US-AriaNeural --write-media reply.mp3
ElevenLabs (premium)โ
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/<voice-id>" \
-H "xi-api-key: $ELEVENLABS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Your response here"}' \
--output reply.mp3
User Preferenceโ
- Ask the user if they want voice replies on first use
- Remember the preference in USER.md
- Default to text replies (cheaper and faster)
### Setup
```bash
# Install Whisper for transcription
pip install openai-whisper
# Install Edge TTS for free voice replies
pip install edge-tts
# Or set up ElevenLabs for premium voices
export ELEVENLABS_API_KEY="your-key-here"
Configurationโ
{
"voice": {
"transcription": {
"engine": "whisper",
"model": "base" // "tiny" for speed, "medium" for accuracy
},
"tts": {
"engine": "edge-tts", // "edge-tts" (free) or "elevenlabs" (premium)
"voice": "en-US-AriaNeural"
}
}
}
Tips for All Recipesโ
Start simple. Get one recipe working end-to-end before combining them. A monitoring agent that works reliably is worth more than a half-built multi-agent pipeline.
Use cheap models for automation. Heartbeat tasks, monitoring, and content formatting don't need Opus. Use Haiku, Gemini Flash, or a local model. Reserve Opus/Sonnet for code review and complex reasoning. See Model Selection.
Set quiet hours. Autonomous agents don't need to run at 3 AM unless they're monitoring infrastructure. Set quiet hours to save tokens and avoid surprise Telegram messages.
{
"security": {
"quiet_hours": {
"enabled": true,
"start": "23:00",
"end": "07:00"
}
}
}
Require confirmation for destructive actions. Deploying to production, unlocking doors, deleting files โ always require human approval. Set confirm_dangerous_actions: true.
Monitor costs. Multi-agent setups with frequent heartbeats can get expensive. Check openclaw stats tokens regularly. See Cost Management.
See Alsoโ
- Workboard โ Coordinate multi-agent work
- Multi-Agent Workflows โ Agent configuration and routing
- Plugin System โ Extending the gateway
- Memory Systems โ Choosing a memory backend
- Automation & Integrations โ Cron, webhooks, CI/CD
- Model Selection โ Picking models by task and budget
- Cost Management โ Keeping costs under control
- Skill Development โ Building skills from scratch
- Existing recipes: Code Reviewer ยท Email Assistant ยท Research Agent ยท Smart Home