Install
openclaw skills install big-memoryStructured task snapshot and automatic post-compaction recovery. Captures exact code, decisions, file paths, and task state before context compaction and rec...
openclaw skills install big-memoryStructured task snapshots that survive context compaction. Three-phase protocol:
Uses only OpenClaw built-in tools (memory_search, memory_get, Read, Edit). No scripts, no external databases, no API keys.
Every snapshot MUST follow this exact structure. Do not omit fields -- write "none" if a field is empty. For the full template with field-by-field guidelines, read {baseDir}/references/TASK-SNAPSHOT.md.
<!-- BIG-MEMORY-SNAPSHOT v1 -->
<!-- timestamp: YYYY-MM-DDTHH:MM:SS -->
<!-- snapshot-id: YYYY-MM-DD-NN -->
### [SNAPSHOT] Active Goal
One sentence: what is the user trying to accomplish right now? Include the "why".
### [SNAPSHOT] Current State
- Phase: {planning|implementing|debugging|testing|reviewing|deploying}
- Branch: {git branch name or "n/a"}
- Blocked: {yes|no} -- {blocker description if yes}
- Progress: {rough percentage or milestone}
### [SNAPSHOT] Files In Play
- `/path/to/file.ts` -- What is happening in this file
- `/path/to/other.ts` -- Purpose of this file in current task
### [SNAPSHOT] Decisions Made
1. Decision description -- rationale for why this was chosen
2. Another decision -- its rationale
### [SNAPSHOT] Code Context
Key code that must survive compaction. Only include what cannot be reconstructed from reading files (function signatures being designed, error messages being debugged, exact patterns being replicated). Keep under 50 lines total.
### [SNAPSHOT] Key Names & Values
Exact identifiers that are easy to forget:
- API endpoint: `POST /api/v1/users`
- Table name: `user_sessions`
- Env var: `DATABASE_URL`
- Error: `ERR_DUPLICATE_KEY`
### [SNAPSHOT] Blockers & Open Questions
- Blocker: description with context
- Question: unresolved decision with options considered
### [SNAPSHOT] Next Steps
Ordered, specific, actionable:
1. Finish implementing X in `/path/to/file` covering edge cases A, B, C
2. Write tests for Y endpoint: success (201), duplicate (409), missing fields (400)
3. Update config to include Z
<!-- /BIG-MEMORY-SNAPSHOT -->
The HTML comment markers (<!-- BIG-MEMORY-SNAPSHOT v1 --> and <!-- /BIG-MEMORY-SNAPSHOT -->) are critical. They act as machine-parseable delimiters that memory_search matches via BM25 exact-term matching, enabling precise retrieval.
When you receive a system message related to compaction (containing "compact", "memory flush", "store durable memories", or "nearing compaction"), execute the CAPTURE protocol instead of writing generic notes. Create a full structured snapshot following the schema above.
After completing a significant unit of work -- implementing a feature, fixing a bug, making an architecture decision -- self-assess: "If compaction happened right now, would I lose critical context?" If yes, create a snapshot.
Good times to snapshot:
When the user says /big-memory save, "save snapshot", "checkpoint", or "big-memory save", create a snapshot immediately.
memory/{YYYY-MM-DD}.md using Read. If it does not exist, you will create it.Edit to append at the end. Alternatively, use Write with the full existing content plus the new snapshot.---
## Task Snapshot -- HH:MM
<!-- BIG-MEMORY-SNAPSHOT v1 -->
...
<!-- /BIG-MEMORY-SNAPSHOT -->
Suspect compaction when ANY of these are true:
Execute this search:
memory_search("BIG-MEMORY-SNAPSHOT")
This triggers hybrid vector + BM25 search across all memory files. The HTML comment markers ensure high BM25 relevance scoring.
If results are found, use memory_get or Read to retrieve the full file content at the matched path and line range.
If no results from the primary search, try broader queries:
memory_search("SNAPSHOT Active Goal Next Steps")
memory_search("{today's date} task snapshot")
After retrieving a snapshot:
<!-- BIG-MEMORY-SNAPSHOT v1 --> and <!-- /BIG-MEMORY-SNAPSHOT --> markersIf no snapshot exists in memory:
memory_search("{project name}"), memory_search("decided"), memory_search("working on")MEMORY.md for any relevant long-term notesIf multiple snapshots are found:
<!-- timestamp: --> comment)/big-memory saveCreate a snapshot now. Execute the full CAPTURE protocol:
{baseDir}/references/TASK-SNAPSHOT.md for the template (first time only)memory/YYYY-MM-DD.md)/big-memory recallSearch for and display the most recent snapshot:
memory_search("BIG-MEMORY-SNAPSHOT")memory_get or Read/big-memory statusShow current snapshot information:
/big-memory save if no recent snapshot exists, or /big-memory recall if context seems incomplete/big-memory (no arguments)Default to status. Show the current state and suggest the most useful action.
For optimal automatic capture, add these settings to your project's openclaw.json. See {baseDir}/references/openclaw-config.md for the full configuration.
The most impactful change is replacing the default generic flush prompt:
{
"agents": {
"defaults": {
"compaction": {
"memoryFlush": {
"enabled": true,
"softThresholdTokens": 40000,
"systemPrompt": "You are capturing structured task state for post-compaction recovery. Follow the BIG-MEMORY-SNAPSHOT schema exactly.",
"prompt": "Context compaction is imminent. Create a structured task snapshot following the BIG-MEMORY-SNAPSHOT schema and APPEND it to memory/YYYY-MM-DD.md. Include: active goal, current state, files in play, decisions made, code context (key snippets only), key names/values, blockers, and next steps. Read the existing file first -- never overwrite. Reply NO_FLUSH if nothing worth storing."
}
}
}
}
}
This replaces the default "store durable memories now" with instructions that trigger our structured capture protocol.
MEMORY.md for long-term knowledge (project architecture, conventions, preferences). Use snapshots only for transient task state that needs to survive the next compaction.