self-evolving-memory
by @hal-9909
Orchestrate the OpenClaw memory system so it actually runs reliably in practice. Use when the task involves capturing user preferences, current task state, c...
clawhub install self-evolving-memoryπ About This Skill
name: self-evolving-memory description: > Orchestrate the OpenClaw memory system so it actually runs reliably in practice. Use when the task involves capturing user preferences, current task state, corrections, decisions, recurring issues, memory cleanup, memory migration, or deciding where information should live across the workspace memory layers, including hot state, daily memory, structured long-term memory, root summary, and enforcement files such as SOUL.md, AGENTS.md, and TOOLS.md. Also use when the user asks to save memory, remember something, adapt old memories to the new system, or make the memory system actually stick and keep working over time.
Memory Orchestrator
This skill is the workflow layer for the memory system. It does not replace memory storage. It decides **what to capture, where to route it, when to promote it, and when to harden it**.
Source of truth
Use this order:
1. MEMORY.md + memory/ = formal memory ledger
2. SESSION-STATE.md = current task state only
3. .learnings/ = auxiliary scratch/noise layer only
4. vector recall = derived index, never source of truth
Never create a second formal ledger.
Memory layers
1) Hot state
UseSESSION-STATE.md for:
Do not store durable history here.
2) Daily working memory
Usememory/YYYY-MM-DD.md for:
3) Structured long-term memory
Route stable items to:memory/preferences.md β user preferences / communication style / stable likes-dislikesmemory/system.md β stable environment facts / endpoints / toolchain constraints / pathsmemory/projects.md β long-running project context / decisions / statusmemory/MEMORY.md β cross-cutting long-term stable conclusions4) Root summary
Use rootMEMORY.md only for the few high-value facts worth automatic injection every session.
Keep it short.5) Enforcement layer
If a recurring problem should change future behavior, also update one or more of:SOUL.mdAGENTS.mdTOOLS.mdSKILL.mdEmbedding / vector recall setup
This skill supports semantic memory search via memory_search. Multiple embedding
backends are supported. See references/embedding-setup.md for full configuration:
nomic-embed-text, mxbai-embed-large, etc.text-embedding-3-small / text-embedding-3-largeQuick config example (Ollama, local):
{
"memorySearch": {
"enabled": true,
"provider": "ollama",
"model": "nomic-embed-text"
}
}
Quick config example (OpenAI):
{
"memorySearch": {
"enabled": true,
"provider": "openai",
"model": "text-embedding-3-small",
"remote": {
"baseUrl": "https://api.openai.com/v1",
"apiKey": "YOUR_OPENAI_API_KEY"
}
}
}
First-run setup check
When this skill is triggered for the first time, or when the user asks to "set up" / "initialize" / "check" the memory system, run this setup check:
Auto-detect missing files
Check the current workspace for these files. If any are missing, create them from templates OR tell the user exactly which command to run:
Required files:
SESSION-STATE.md β templates/SESSION-STATE.md
MEMORY.md β templates/MEMORY.md
HEARTBEAT.md β templates/HEARTBEAT.md
memory/preferences.md β templates/memory/preferences.md
memory/system.md β templates/memory/system.md
memory/projects.md β templates/memory/projects.md
memory/MEMORY.md β templates/memory/MEMORY.md
Recommended agent files (prompt user to create if missing):
SOUL.md β add memory discipline section (see references/setup-checklist.md Step 3)
AGENTS.md β add memory closeout protocol
TOOLS.md β add memory-related tool discipline
Action:
references/setup-checklist.md.references/embedding-setup.md.One-command setup
Tell the user they can also run the setup script:
bash scripts/setup.sh [optional-workspace-path]
This will copy all templates and report what's missing.
Runtime protocol
For the concrete operating protocol, read:
references/runtime-protocol.mdUse that reference when the memory system needs to operate reliably over time, not just route one memory item.
For setup and initialization:
references/setup-checklist.md β step-by-step first-time setupscripts/setup.sh β automated setup scriptFor embedding setup options, read:
references/embedding-setup.mdRouting rules
A. User says "remember this" / gives a durable preference
memory/YYYY-MM-DD.mdmemory/preferences.md or other structured fileMEMORY.md or enforcement filesB. Current task state changes
Before or during longer work, updateSESSION-STATE.md with:
Use hot state for continuity, not archiving.
C. Error / correction / better approach discovered
memory/YYYY-MM-DD.md.learnings/D. Stable system fact discovered
memory/system.mdMEMORY.md if it is worth automatic injection every sessionE. Project decision / project context
memory/projects.mdmemory/MEMORY.mdPromotion / hardening state machine
Use this mental model:
observed β captured in SESSION-STATE.md or dailycurated β moved into structured long-term memoryhardened β promoted into SOUL / AGENTS / TOOLS / skill / scriptstable β repeatedly validated, remains in long-term memory until marked staleRule:
Hygiene workflow
When asked to clean memory, adapt old memory, or audit the system:
1. Check whether old daily files contain content that already lives in structured memory
2. Add "converged/migrated/stale" style notes when appropriate
3. Ensure root MEMORY.md remains summary-only
4. Check SESSION-STATE.md is not stale or pretending to be long-term memory
5. Check .learnings/ is not drifting into primary-ledger status
6. Check recall/reference docs still point to the new architecture
When NOT to over-store
Do not promote every temporary detail. Good memory systems are selective. If uncertain, prefer:SESSION-STATE.md for immediate continuitymemory/YYYY-MM-DD.md for tentative notesTrigger phrases / situations
Use this skill when the user asks or implies any of:Expected output style
Keep replies short. Actually perform the routing/editing work. Do not just say memory was saved β save it. Do not ask for permission again when the memory action is already clear.Reliability requirements
For non-trivial memory operations, do not stop at classification. Make sure the system actually advances:
SESSION-STATE.md when current continuity mattersmemory/YYYY-MM-DD.md for daily capturereferences/runtime-protocol.md when a task or phase endsIf any of these are skipped, the memory system is only partially operating.