OpenClaw Automation Architecture
by @lsj210001
Design OpenClaw-native automation systems using cron, HEARTBEAT.md, spawned sessions, specialist-agent delegation, first-class tools, MCPs, and local scripts...
clawhub install openclaw-automation-architectureπ About This Skill
name: openclaw-automation-architecture description: Design OpenClaw-native automation systems using cron, HEARTBEAT.md, spawned sessions, specialist-agent delegation, first-class tools, MCPs, and local scripts. Use when the user wants to automate a workflow, set up reminders, schedule recurring reports, monitor topics, build alerting pipelines, design agent orchestration, choose between cron vs heartbeat vs spawned session vs script vs MCP vs Zapier/Make/n8n, or replace brittle no-code flows with an OpenClaw-first architecture. Trigger on requests like "automate this", "build a workflow", "set up a cron", "heartbeat task", "reminder", "scheduled report", "monitor this", "alert me when", "pipeline", "agent orchestration", "Zapier", "Make", "n8n", "save time", or "OpenClaw automation".
OpenClaw Automation Architecture
Overview
Design automations around OpenClaw's native primitives first. Reach for external workflow tools only when the job truly depends on third-party app glue, webhooks, or auth patterns that OpenClaw cannot cover cleanly.
Read references/decision-matrix.md when choosing the execution plane. Read references/patterns.md when the user needs a ready-made workflow pattern.
Core Doctrine
Quick Selection
Use this order:
1. Direct tool call now β when the user wants an immediate result, not automation.
2. cron β when timing matters or the task must run independently.
3. HEARTBEAT.md β when the task is periodic housekeeping, context-aware maintenance, or a drift-tolerant batch check.
4. Spawned session / specialist agent β when the run is heavy, multi-step, or belongs to a dedicated role.
5. Local script / MCP β when the same deterministic operation will repeat.
6. External workflow platforms β only if native OpenClaw building blocks are not enough.
Execution Plane Rules
Use cron when time is the product
Reach for cron when the user wants:
Rules:
payload.kind="systemEvent" only for sessionTarget="main".payload.kind="agentTurn" for isolated jobs.delivery.mode="announce" with channel / to instead of sending messages manually inside the run.Use HEARTBEAT.md when drift is fine and context helps
Reach for heartbeat when the task is:
Do not use heartbeat for:
Use spawned sessions when the work is a real job, not a callback
Spawn a session when the task is:
Rules:
Use a script or MCP when determinism matters
Create or reuse a local script / MCP when:
Examples:
Use Zapier / Make / n8n only as the edge adapter
Escalate to external workflow tools only when you need:
Treat them as adapters, not the brain.
Design Workflow
For every automation, define these five pieces in order.
1. Outcome
State the business result in one sentence.
Example:
2. Trigger
Pick one:
If the trigger is weak or noisy, add a cheap gate before expensive work.
3. Execution plane
Choose one primary plane:
Do not mix planes unless there is a clear handoff.
4. State and dedup
Always decide:
Typical state locations:
today-briefing.md5. Delivery and recovery
Define:
Prefer a single notification path. Split success and failure channels only when necessary.
Architecture Patterns
Pattern A: Monitor β Filter β Notify
Use for news, prices, releases, topic monitoring, and alerts.
Structure: 1. scheduled trigger 2. fetch candidates 3. deduplicate 4. score importance 5. announce only if threshold met 6. save medium-priority items for digest
Pattern B: Collect β Distill β Produce
Use for content factories and report generation.
Structure: 1. collector gathers raw material 2. artifact file stores shortlist or briefing 3. producer turns artifact into final output 4. optional review or delivery step
Pattern C: Ingest β Normalize β Index
Use for RAG and knowledge pipelines.
Structure: 1. detect source 2. extract text/content 3. normalize metadata 4. chunk/index 5. optionally summarize or tag
Pattern D: Scan β Decide β Act
Use for operations checks and maintenance.
Structure: 1. cheap gate 2. deeper scan only if needed 3. deterministic decision rule where possible 4. action or alert
Pattern E: Fan-out specialist work
Use when the user asks for one outcome that naturally decomposes.
Structure: 1. orchestrator defines subtasks 2. delegate by specialty 3. collect outputs into one artifact 4. synthesize once at the top
Guardrails
cron + tools + scripts already solve it.Output Expectations
When helping with an automation request, produce a concrete recommendation in this shape:
1. Best execution plane 2. Why this plane wins 3. State + dedup plan 4. Failure handling 5. Whether native OpenClaw is enough or an external workflow tool is justified
If the user asks to actually build it, implement the smallest end-to-end version first.
Example Requests
References
references/decision-matrix.md for primitive selection and anti-patterns.references/patterns.md for ready-made workflow templates in OpenClaw terms.