/install compaction-survival
Compaction Survival System
Compaction destroys specifics: file paths, exact values, config details, reasoning chains. This skill ensures critical state survives.
The problem: When your context window fills up, OpenClaw compacts older messages into a summary. Summaries lose precision — exact numbers become "approximately," file paths vanish, decisions lose their rationale. Your agent wakes up dumber after every compaction.
The fix: Three mechanisms that capture critical state before compaction hits, and recover it after.
Three Mechanisms
1. WAL Protocol (Write-Ahead Logging)
On EVERY incoming message, scan for:
- ✏️ Corrections — "It's X, not Y" / "Actually..."
- 📍 Proper nouns — names, places, companies, products
- 🎨 Preferences — styles, approaches, "I like/don't like"
- 📋 Decisions — "Let's do X" / "Go with Y"
- 📝 Draft changes — edits to active work
- 🔢 Specific values — numbers, dates, IDs, URLs, paths
If ANY appear:
- STOP — do not compose response yet
- WRITE — update
SESSION-STATE.mdwith the detail - THEN — respond to the human
The trigger fires on the human's INPUT, not your memory. Write what they said, not what you think.
2. Working Buffer (Danger Zone)
At 60% context utilization (check via session_status):
- Create/clear
memory/working-buffer.md, write header:# Working Buffer (Danger Zone) **Status:** ACTIVE **Started:** [timestamp] - Every exchange after 60%: append human's message + your response summary
- Buffer is a file — it survives compaction
- Leave buffer as-is until next 60% threshold in a new session
Location: memory/working-buffer.md
3. Compaction Recovery
Auto-trigger when:
- Session starts with
\x3Csummary>tag in context - You should know something but don't
- Human says "where were we?" / "continue" / "what were we doing?"
Recovery steps (in order):
- Read
memory/working-buffer.md— raw danger-zone exchanges - Read
SESSION-STATE.md— active task state - Read today's + yesterday's
memory/YYYY-MM-DD.md - Run
memory_searchif still missing context - Extract important context from buffer → update SESSION-STATE.md
- Report: "Recovered context. Last task was X. Continuing."
NEVER ask "what were we discussing?" — the buffer has the answer.
SESSION-STATE.md Format
# Session State — Active Working Memory
## Current Task
[What we're actively working on]
## Key Details
- [Specific values, paths, configs captured via WAL]
## Decisions Made
- [Decisions with rationale]
## Pending
- [What's waiting/blocked]
## Last Updated
[timestamp]
Update this file frequently. It's your RAM — the only place specifics survive between compaction events.
How It Works Together
┌──────────────────────────┐
│ Human sends message │
└────────────┬─────────────┘
│
┌────────────▼─────────────┐
│ WAL: Scan for specifics │
│ Found? Write first. │
└────────────┬─────────────┘
│
┌─────────────────▼─────────────────┐
│ Context > 60%? Buffer everything │
└─────────────────┬─────────────────┘
│
┌────────────▼─────────────┐
│ Respond to human │
└────────────┬─────────────┘
│
┌────────▼────────┐
│ COMPACTION HIT │
└────────┬────────┘
│
┌────────────▼─────────────┐
│ Recovery: Read buffer, │
│ SESSION-STATE, daily log │
│ → Full context restored │
└──────────────────────────┘
Integration
- Works alongside MEMORY.md (long-term) and memory/YYYY-MM-DD.md (daily logs)
- SESSION-STATE.md = working memory for current task
- Working buffer = emergency capture for the danger zone
- All three layers stack: WAL → Buffer → Recovery
- No dependencies. No API keys. Pure behavioral patterns.
Why This Works
Most "memory" solutions try to store everything forever. That's the wrong problem. The real problem is precision loss during compaction. You don't need to remember everything — you need to remember the RIGHT things at the RIGHT time.
WAL catches specifics the moment they appear. The buffer captures the danger zone. Recovery restores context after the reset. Three layers, zero dependencies, zero data leakage.
Built by @rustyorb + S1nthetta ⚡ — Battle-tested across 30+ compaction events.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install compaction-survival - 安装完成后,直接呼叫该 Skill 的名称或使用
/compaction-survival触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Compaction Survival System 是什么?
Prevent context loss during LLM compaction via Write-Ahead Logging (WAL), Working Buffer, and automatic recovery. Three mechanisms that ensure critical state... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 894 次。
如何安装 Compaction Survival System?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install compaction-survival」即可一键安装,无需额外配置。
Compaction Survival System 是免费的吗?
是的,Compaction Survival System 完全免费(开源免费),可自由下载、安装和使用。
Compaction Survival System 支持哪些平台?
Compaction Survival System 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Compaction Survival System?
由 rustyorb(@rustyorb)开发并维护,当前版本 v1.0.0。