OpenClaw 代理每日使用的 6 项核心工作流:回忆、生成、计划、研究、委托、监控更新。构建可靠性的模式参考。
The 6 workflows that power every effective OpenClaw agent. Master these and you can build any daily-driver setup.
Before anything else, search long-term memory. This is mandatory at session start.
javascript
// Tool: memory_search + memory_get
memory_search({ query: "recent decisions, context, preferences" })
// Then pull the relevant lines
memory_get({ path: "MEMORY.md", from: LINE, lines: 20 })
When to use: Session startup, before any important decision, when context is unclear.
Don't block. Spawn sub-agents for anything that takes more than a few seconds.
javascript
sessions_spawn({
task: "Your instruction here",
runtime: "subagent",
mode: "run", // "run" = one-shot, "session" = persistent
runTimeoutSeconds: 300,
cleanup: "delete"
})
When to use: Long-running commands, parallel work, anything that could timeout.
Use cron for anything that needs to happen repeatedly or later.
javascript
cron({
action: "add",
job: {
name: "Daily digest",
schedule: { kind: "cron", expr: "0 9 * * *", tz: "Africa/Johannesburg" },
sessionTarget: "isolated", // or "main" for direct chat
payload: {
kind: "agentTurn",
message: "Run the morning digest check — emails, calendar, news"
}
}
})
When to use: Morning briefings, periodic health checks, reminder follow-ups.
Web fetch for raw content, web search for discovery.
javascript
// Discover with search
web_search({ query: "latest on topic", count: 5 })
// Deep read a page
web_fetch({ url: "https://...", extractMode: "markdown", maxChars: 8000 })
When to use: Before answering unfamiliar topics, checking prices/news/status.
Send tasks to other sessions or agents.
javascript
// To a named session
sessions_send({ sessionKey: "alex", message: "Handle this please" })
// To a channel
message({ action: "send", channel: "discord", target: "channel-name", message: "Update" })
When to use: Handing off to specialized agents, sending alerts, cross-channel updates.
Keep track of long-running work and update records.
javascript
// Poll a background process
process({ action: "poll", sessionId: "session-id", timeout: 30000 })
// Write results to memory
write({ path: "memory/YYYY-MM-DD.md", content: "## What happened\n..." })
When to use: After spawning background jobs, at end of session to capture decisions.
Run this at the start of every session:
javascript
// 1. Recall (mandatory)
memory_search({ query: "today's context, recent decisions" })
memory_get({ path: "MEMORY.md", from: 1, lines: 50 })
// 2. Check cron status (optional)
cron({ action: "list" })
// 3. Check active sessions (optional)
sessions_list({ activeMinutes: 60 })
FrequencyToolsEvery sessionmemory_search, memory_get, read, writeSeveral times/dayweb_fetch, web_search, exec, processDailycron, sessions_list, sessions_historyAs neededsessions_spawn, message, gateway, subagents
memory_search — what was decided recently?memory_get — pull the relevant MEMORY.md linesHEARTBEAT.md — any pending tasks?DAILY_SKILLS.md or project trackerFilePurposeMEMORY.mdLong-term curated memory — update after significant decisionsmemory/YYYY-MM-DD.mdDaily session logsAGENTS.mdAgent personality and workspace rulesHEARTBEAT.mdPeriodic background tasks to runTOOLS.mdNotes on local environment (cameras, SSH hosts, etc.)
sessions_spawn with callback, not while loopsPattern framework inspired by the OpenClaw agent architecture — built for the 90-day skill challenge.