context-compression
Origin: This skill was extracted from Claude Code's internal implementation and rules. Claude Code openly exposes its safety mechanisms (hooks, system prompts, skill definitions) in the
~/.claude/directory. The tiered compression strategy, layer classification system, and memory file structure were reverse-engineered from Claude Code's PreCompact/PostCompact hooks and session memory handling, then adapted for OpenClaw's multi-channel environment.
Context Compression
Why Tiered Compression Is Needed
A one-size-fits-all approach to dropping context either leaves the agent without memory or burns through context too quickly. The core principle of tiered strategy is: different information has different lifecycles. A user's statement "I prefer concise responses" is worth remembering forever; but a resolved error message from three days ago has no value today.
Before Compression: Identify the Scenario
Before starting compression, determine which conversation scenario you're in, as retention strategies differ: