Install
openclaw skills install wal-memorySession crash and compaction recovery using a two-file WAL (Write-Ahead Log) system. Use when setting up persistent memory for an OpenClaw agent that needs to survive session rollovers, gateway disconnects, Anthropic outages, or context compaction. Installs state-log.js + GOALS.md structure + cold boot recovery hook. Eliminates agent amnesia between sessions.
openclaw skills install wal-memoryTwo-file system for session crash recovery. Survives gateway disconnects, provider outages, and context compaction. Co-designed with Gemini.
OpenClaw agents lose state in two ways:
memory/GOALS.md — The "why": current milestone, sprint tasks, architecture decisions. Updated manually at major milestones or end of session.STATE.log — The "what just happened": append-only WAL, auto-timestamped. Never edit manually. Written via state-log.js.Copy scripts/state-log.js to ~/clawd/scripts/state-log.js.
Test it:
node ~/clawd/scripts/state-log.js "STARTUP" "WAL memory system initialized"
# Should print: Logged: STARTUP
# STATE.log should appear in ~/clawd/
Copy assets/GOALS.template.md to ~/clawd/memory/GOALS.md. Fill in your current objective, sprint tasks, and key decisions. Keep it under 30 lines — this is the "why", not the "what".
Add this to your "Every Session" startup sequence:
## Every Session — Cold Boot Recovery Hook
1. Read `memory/GOALS.md` — current mission and what's in flight
2. Run `tail -n 20 ~/clawd/STATE.log` — last 20 actions, tells you where we left off
3. Read today's `memory/YYYY-MM-DD.md` for recent context
Add this as the first step of every heartbeat:
node ~/clawd/scripts/state-log.js "HEARTBEAT" "Interval reached $(date '+%Y-%m-%d %H:%M')"
This guarantees STATE.log has a timestamp even if the session crashes immediately after — you'll always know exactly when things flatlined.
After any meaningful action, run:
node ~/clawd/scripts/state-log.js "CATEGORY" "What you just did"
Categories:
ACTION — file created, code edited, config changedDEPLOY — pushed to production, service restartedAGENT — dispatched or agent task completedTASK — milestone completedFIX — bug or system fix appliedSTARTUP — cold boot (always log this first)HEARTBEAT — interval pingERROR — something failedExamples:
node ~/clawd/scripts/state-log.js "AGENT" "Dispatched Owsley to build auth system"
node ~/clawd/scripts/state-log.js "DEPLOY" "FF ElasticSearch secured, 6027 docs indexed"
node ~/clawd/scripts/state-log.js "FIX" "Cron syntax fixed — was using session spawn, now uses agent --deliver"
Do NOT log: reads, searches, minor tool calls. Signal only. Never log: passwords, API keys, tokens, or sensitive payloads — STATE.log is plaintext.
On cold boot or post-compaction, first action is always:
# 1. Read the why
cat ~/clawd/memory/GOALS.md
# 2. Read what just happened
tail -n 20 ~/clawd/STATE.log
# 3. Resume from last log entry
STATE.log lives at ~/clawd/STATE.logSTATE.log.old, starts fresh)[2026-03-03T09:00:00.000Z] [CATEGORY] MessageSTATE.log to .gitignore — it may contain sensitive action descriptions, credentials referenced in log messages, or private task details. Do not commit it to source control unless you have reviewed its contents and are certain it contains no sensitive data.