This skill upgrades an OpenClaw agent's memory architecture from a single, bloated MEMORY.md to a Scope-Based Memory system with automated REM Sleep (memory consolidation and decay).
MEMORY.md): Kept extremely lean. Only contains core identity, active focus, and an index of domain-specific memory files.memory/topics/*.md): Stores hyper-specific rules, constraints, and knowledge (e.g., shopify.md, rails.md). Retrieved dynamically via memory_search and memory_get only when relevant.When the user asks to install or configure scoped memory / REM sleep, follow these steps:
Run the setup script to create the necessary directories:
bash
sh scripts/setup.sh
Use the cron tool to schedule the weekly consolidation job.
Call the cron tool with action: "add" and the following payload:
name: "Memory REM Sleep (Consolidation)"
schedule: { "kind": "cron", "expr": "0 3 * * 0" } (Sundays at 3:00 AM)
sessionTarget: "isolated"
delivery: { "mode": "announce" }
payload: json
{
"kind": "agentTurn",
"message": "It is time for your weekly REM sleep cycle. Please read the current `MEMORY.md` and the daily log files (`memory/YYYY-MM-DD.md`) from the past 7 days. Your task is to perform memory consolidation: \n1. Extract new patterns and important context from the logs.\n2. Review `MEMORY.md` and prune obsolete rules or constraints.\n3. Move domain-specific knowledge into the appropriate `memory/topics/*.md` files.\n4. Rewrite `MEMORY.md` to be a concise global router.\n5. Summarize what was added, moved, and forgotten."
}
If the agent already has a bloated MEMORY.md, proactively offer to read it and partition the content into memory/topics/*.md files right now.
MEMORY.md is NOT for storing everything.memory/topics/ instead of polluting the global MEMORY.md.