Install
openclaw skills install @neroagent/memory-stack-coreCore memory resilience layer: WAL (Write-Ahead Log), Working Buffer, and three-layer memory integration. Prevents context loss during compaction and ensures critical state survives session restarts. Works with any OpenClaw agent.
openclaw skills install @neroagent/memory-stack-coreTransforms your agent's memory from fragile to antifragile. Implements proven patterns from the Claude Code leak and ClawHub's compaction-survival + session-persistence.
LLM context windows fill up. When compaction happens, older messages get summarized. Summaries lose precision:
Your agent wakes up after compaction dumber. Every session restarts from scratch.
┌────────────────────────────────────────┐
│ Long-term (MEMORY.md) │ ← Curated wisdom, never edit manually
├────────────────────────────────────────┤
│ Daily Logs (memory/YYYY-MM-DD.md) │ ← Conversation summaries
├────────────────────────────────────────┤
│ Working Buffer (memory/working-buffer.md) │ ← Danger zone captures (60%+ context)
├────────────────────────────────────────┤
│ WAL (memory/wal.jsonl) │ ← Write-Ahead Log: specifics as they appear
└────────────────────────────────────────┘
When: Immediately upon receiving a human message that contains any:
What: Write a structured JSON line to memory/wal.jsonl with:
{
"timestamp": "2026-04-01T16:20:00Z",
"category": "decision|preference|path|value|correction|draft",
"content": "the specific detail",
"context": "surrounding message snippet"
}
Why: WAL entries are tiny, numerous, and survive forever. They're the source of truth for specifics.
When: Token utilization reaches 60% (tracked via session_status).
What: Append every human + assistant exchange (full text) to memory/working-buffer.md:
## 2026-04-01 16:25:00 (turn 47)
**User:**
<message>
**Assistant:**
<response>
Why: The buffer is a file, so it doesn't count against context. It's your safety net for the danger zone. When compaction inevitably happens, you can recover from the buffer.
Already in OpenClaw. We integrate by:
/wrap_up to flush to daily logMEMORY.mdThe skill hooks into your agent's message processing:
/memory_health command to view statustool("memory-stack-core", "wal_write", {...}) — manually add WAL entrytool("memory-stack-core", "wal_read", {"limit": 50}) — view recent WALtool("memory-stack-core", "buffer_read", {"tail": 1000}) — view buffer tailtool("memory-stack-core", "memory_health", {}) — get health reportWhen context is lost (e.g., after compaction or new session):
memory/working-buffer.md last entriesmemory/YYYY-MM-DD.mdThe skill provides a recover() helper (used automatically by agent if configured).
Create memory-stack-config.json in workspace root (optional):
{
"wal": {
"enabled": true,
"auto_capture": true,
"max_entries": 10000
},
"buffer": {
"enabled": true,
"threshold_token_percent": 60,
"max_size_mb": 10
},
"integration": {
"auto_wrap_up_at_token_percent": 80,
"include_buffer_in_wrap_up": true
}
}
Negligible impact.
tool interface)compaction-survival patterns (this is an implementation)session-persistence by providing WAL + buffer layersQ: Do I need to change my agent?
A: Only to optionally call memory_health or recover if you want explicit control. Otherwise install and go.
Q: What if I already use session-persistence?
A: This skill implements the WAL + buffer layers that session-persistence mentions. They're complementary.
Q: Will WAL fill my disk?
A: WAL is capped at max_entries (default 10k). Old entries can be archived to memory/wal-archive.jsonl monthly.
Q: Can I use without ToolRegistry?
A: Yes, the skill provides standalone scripts too (scripts/wal.py, scripts/buffer.py).
Commercial. One-time purchase includes lifetime updates. Team licenses allow unlimited agents.
Built with insights from the Claude Code leak and ClawHub community.