Kenny.eth|Mar 17, 2026 06:04
AI Agent Context Never Lost: DAG Memory Architecture of LCM Plugin
Native OpenClaw (and almost all AI agents) simply truncate old messages when conversations exceed the model context window - information is lost.
The core proposition of Lossless Claw is that compression does not equal forgetting. It replaces the original sliding window truncation mechanism with a DAG (Directed Acyclic Graph) hierarchical summarization system, persistently storing each message. Through recursive summarization and re summarization, the agent can theoretically "remember" an infinite history while maintaining the token budget.
GitHub has obtained 2k Stars and 147 Forks, and has become a popular project shortly after its launch - a representative project in the OpenClaw ecosystem peripheral tools
The threshold for context triggered compression is 75% (contextThreshold=0.75), which means that when there are still 25% of the headroom, it will start to condense to avoid bursting windows
Protect the latest 32 messages from compression (freshTailCount=32) to ensure recent coherence
• Persist all original messages with SQLite at the bottom layer, link the digest node back to the source message, and can be expanded and restored to the original text at any time
Provide three Agent tools: lcm_grep (search), lcm_describe (describe nodes), and lcm_expand (expand details)
Each leaf node can hold up to 20000 tokens of source content, with a compression target of 1200 tokens; High level condensed node target 2000 tokens
1. Installation: One line command openclaw plugins install @ martin-engineering/lossless crack, no need to manually modify JSON
2. Configuration: In OpenClaw config, specify contextEngine: "loss clamp" and fine tune parameters through environment variables
3. Core design patterns:
Automatically compress after each conversation round (can be turned off)
Old messages → Leaf Summary → Condensed Node, layer by layer condensed to form DAG
When the Agent calls lcm_expand, it expands in reverse from the DAG to restore the original details
4. Session persistence: Combined with session. reset. idleMinute: 10080 (7 days), the same session can survive for one week, and LCM memory accumulates across sessions
5. Large file processing: Separate interception of abstracts for file blocks exceeding 25000 tokens, without contaminating the main context
Context window management is currently one of the biggest engineering pain points in Agent systems, and LCM provides a practical industrial solution - not RAG style retrieval, but active hierarchical summarization. This represents an important direction for the evolution of Agent infrastructure from 'disposable' to 'long-term memory'.
This plugin solves the real pain point of "Claw forgetting previous conversations after each restart". If you want Claw to truly achieve long-term memory accumulation across sessions, installing this plugin is the most direct technical solution, which is more systematic and reliable than handwritten Memoriy.md.
The "forgetfulness" of AI agents is an architectural flaw, not fate - using DAG hierarchical summarization to permanently store each message in SQLite, compression only condenses, not forgetfulness.
Share To
Timeline
HotFlash
APP
X
Telegram
CopyLink