Lossless-claw Gives OpenClaw Agents a Memory That Never Forgets
Martian Engineering open-sources lossless-claw, bringing Voltropy's DAG-based context management to OpenClaw's 346k-star personal AI agent ecosystem
ProTakeaways
- What: Lossless-claw is an open-source OpenClaw plugin that replaces sliding-window context truncation with a persistent DAG-based memory system.
- How it works: Every message is stored verbatim in SQLite; older messages are summarized into a hierarchy of nodes the agent can search and expand on demand.
- Install: One command —
openclaw plugins install @martian-engineering/lossless-claw@latest— no manual config needed in most cases. - Performance: The underlying LCM architecture, benchmarked in Voltropy's Volt agent, outperforms Claude Code at every context length from 32K to 1M tokens on the OOLONG eval.
- Cost control: Summarization can be routed to a cheap model (e.g. gpt-5.4-mini) independently of the main agent model, keeping compaction costs low.
- Ecosystem: The LCM pattern is spreading — a similar plugin (hermes-lcm) has appeared for the Hermes Agent framework, inspired by lossless-claw.
Lossless-claw is a new open-source plugin for OpenClaw that replaces the agent's built-in context truncation with a persistent, database-backed memory system. The plugin is a direct implementation of the LCM (Lossless Context Management) paper from Voltropy, ported into OpenClaw's plugin architecture. The result: an OpenClaw agent that never forgets a message, no matter how long the session runs.
The problem every long-running agent hits
The effective context window of LLMs remains the primary bottleneck for complex, long-horizon agentic tasks. Even models with 1M+ token windows are insufficient for multi-day agentic sessions, where the volume of tool calls, file contents, and intermediate reasoning can exceed the context limit of any production LLM. OpenClaw handles this the same way every other agent does by default: it slides a window over the conversation and drops older messages. Once they're gone, they're gone.
This is fine for short tasks. For the kind of persistent, always-on personal agents that OpenClaw users are actually running, it's a real limitation. A week-long coding session, an ongoing research task, a background agent that monitors your inbox , these all accumulate context faster than any window can hold.
What lossless-claw actually does
LCM addresses this by shifting the burden of memory architecture from the model back to the engine. Rather than asking the model to invent a memory strategy, LCM provides a deterministic, database-backed infrastructure. It maintains a high-fanout DAG of summaries in a persistent, transactional store, allowing the system to compress context aggressively while retaining lossless pointers to the original data. This ensures that any message from earlier in a session can always be retrieved, regardless of how many rounds of compaction have occurred.
In practice, the plugin intercepts OpenClaw's context assembly step and replaces it with a five-stage pipeline:
- Persist every message verbatim to a local SQLite database
- Summarize older message chunks using your configured LLM
- Condense those summaries into higher-level nodes, forming a DAG (a tree-like structure where each node points to its sources)
- Assemble each turn's context from recent raw messages + the relevant summary nodes
- Expose recall tools (
lcm_grep,lcm_describe,lcm_expand) so the agent can search and drill into compacted history on demand
The DAG structure, explained
A DAG (Directed Acyclic Graph) here means a hierarchy of summaries where each summary knows what it summarizes. Leaf nodes cover a raw span of messages. Condensed nodes cover multiple leaf summaries. When the agent needs to recall something, it can traverse this tree: start from a high-level summary, identify the relevant branch, and expand it all the way back to the original messages.
LCM departs from prior recursive approaches by decomposing symbolic recursion into two deterministic, engine-managed mechanisms: recursive context compression, in which a hierarchical summary DAG automatically compacts older messages while retaining lossless pointers to every original; and recursive task partitioning, in which engine-managed parallel primitives replace model-written loops.
One important design detail: compaction happens asynchronously between turns. The user never waits for it. Below the soft token threshold, the store acts as a passive logger with zero overhead. Above it, compaction runs in the background and atomically swaps the result into context before the next turn.
Guaranteed not to get stuck
A subtle but important engineering choice is the three-level summarization escalation. If the LLM produces a summary longer than its input (which does happen), the system escalates automatically:
- Normal summarization , preserve details
- Aggressive summarization , bullet points, half the target tokens
- Deterministic truncation , no LLM involved, guaranteed to converge
This means compaction can never stall or loop. The system always makes forward progress, even if the model misbehaves.
Installing it is one command
openclaw plugins install @martian-engineering/lossless-claw@latestThe plugin requires OpenClaw with plugin context engine support and Node.js 22+. No manual config edits are needed in most cases , the install command registers the plugin, enables it, and slots it into the contextEngine position automatically. A recommended starting config:
LCM_FRESH_TAIL_COUNT=64
LCM_LEAF_CHUNK_TOKENS=20000
LCM_INCREMENTAL_MAX_DEPTH=1
LCM_CONTEXT_THRESHOLD=0.75
LCM_SUMMARY_MODEL=openai/gpt-5.4-mini
LCM_EXPANSION_MODEL=openai/gpt-5.4-miniThe LCM_CONTEXT_THRESHOLD=0.75 setting triggers compaction when context reaches 75% of the model's window, leaving headroom for responses. LCM_FRESH_TAIL_COUNT=64 protects the 64 most recent messages from being compacted, keeping recent context sharp. You can point the summarization at a cheap, fast model like gpt-5.4-mini to keep costs low , the main agent model is only used for actual reasoning, not for housekeeping.
What the agent can do with it
The plugin exposes three recall tools to the agent:
lcm_grep, regex search across the full message history, returning results grouped by which summary node covers themlcm_describe, inspect any summary or file reference: what it covers, token count, parent pointers, full textlcm_expand, reverse a compaction, recovering the original messages from a summary node (restricted to sub-agents to prevent context flooding)
There's also a shell CLI for inspecting the database without modifying it, and an interactive TUI written in Go for deeper operations like rewriting summaries, repairing corrupted nodes, or transplanting DAG branches across conversations.
Where it fits and where it doesn't
In benchmarks, the LCM-based agent (Volt, on Opus 4.6) beats Claude Code at every context length from 32K to 1M tokens on the OOLONG benchmark, with a +29.2 point average improvement versus Claude Code's +24.7. The gap widens at longer contexts. But those results are from Volt, Voltropy's own agent built on LCM from the ground up. Lossless-claw brings the same memory architecture to OpenClaw, which is a different host with a different tool surface.
The plugin is strongest for:
- Long-running personal agents that accumulate days or weeks of context
- Coding sessions that repeatedly read large files into context
- Research or data-processing tasks where earlier decisions matter later
- Any workflow where you've hit the "agent forgot what we discussed" wall
It's less relevant for short, stateless tasks where context never approaches the window limit , the overhead is genuinely zero in that regime, but you're also not getting anything from it.
A growing ecosystem signal
OpenClaw is a viral open-source personal AI agent with 68,000+ GitHub stars, created by PSPDFKit founder Peter Steinberger. The project has since grown substantially, and Fast Company noted it went from a weekend project to the most-starred software repo on GitHub in under 5 months, with 346k+ stars. Lossless-claw isn't the only LCM port appearing , a similar plugin called hermes-lcm has appeared for the Hermes Agent framework, also based on the LCM paper by Ehrlich and Blackman, and explicitly inspired by lossless-claw for OpenClaw. The pattern is spreading.
The implication is one the field keeps relearning from software engineering history: how you manage what the model sees may matter more than giving the model tools to manage it itself. Every agent framework shipping with "let the model figure it out" memory strategies may be building on the wrong abstraction entirely. Lossless-claw is a concrete, installable answer to that critique , available now, under MIT license, for the largest open-source agent ecosystem in existence.