Martian-Engineering /lossless-claw

Lossless Claw — LCM (Lossless Context Management) plugin for OpenClaw

★ 4,919⑂ 462👁 24⑃ 763● 560▤ 49
TypeScriptMITCreated 2026-02-18
Download: v1.2.0v1.2.0 ↓1.2.02026-10-20
-3
Daily
4,919
stars
462
forks
24
watchers
763
prs
560
issues
49
releases

README

lossless-claw

Lossless Context Management plugin for OpenClaw, based on the LCM paper from Voltropy. Replaces OpenClaw's built-in sliding-window compaction with a DAG-based summarization system that preserves every message while keeping active context within model token limits.

Built and maintained by Martian Engineering. Need help with agents, memory, or AI in your own stack? Get in touch.

 Table of contents

- What it does
- Quick start
- Configuration
- Commands And Skill
- Session Migration CLI
- Documentation
- Development
  - Line endings
- Security
- License
- About Martian Engineering

 What it does

Two ways to learn: read the below, or check out this super cool animated visualization.

When a conversation grows beyond the model's context window, OpenClaw (just like all of the other agents) normally truncates older messages. LCM instead:

1. Persists every message in a SQLite database, organized by conversation
2. Summarizes chunks of older messages into summaries using your configured LLM
3. Condenses summaries into higher-level nodes as they accumulate, forming a DAG (directed acyclic graph)
4. Assembles context each turn by combining summaries + recent raw messages
5. Provides tools (lcm_grep, lcm_describe, lcm_expand) so agents can search and recall details from compacted history

Nothing is lost. Raw messages stay in the database. Summaries link back to their source messages. Agents can drill into any summary to recover the original detail.

It feels like talking to an agent that never forgets. Because it doesn't. In normal operation, you'll never need to think about compaction again.

 Commands And Skill

The package installs an agent-oriented lcm shell CLI and includes a bundled lossless-claw skill plus plugin commands for supported OpenClaw chat/native command providers.

The shell CLI reads lcm.db without modifying conversation data. Its only write command sets one validated Lossless config value in openclaw.json:

bash
lcm status
lcm conversations show --session-key 'agent:main:example'
lcm messages tail --conversation-id 42
lcm summaries list --conversation-id 42 --depth 0 --recency 7d
lcm config get freshTailCount
lcm config set freshTailCount 96


JSON is the default output. List commands use bounded keyset pagination. See Lossless Claw CLI for commands, filters, path precedence, output fields, config-write safety, and exit codes.

The native OpenClaw command surface provides in-session operations:

- /lossless shows version, enablement/selection state, DB path and size, summary counts, and summary-health status
- /lossless backup creates a timestamped backup of the current LCM SQLite database
- /lossless doctor scans for broken or truncated summaries
- /lossless doctor maintenance reports active actionable compaction debt separately from inactive historical debt, grouped by reason, without writing
- /lossless doctor apply maintenance  confirm-inactive administratively closes one eligible inactive debt row after creating 

Top issues

Latest release

v1.2.0 v1.2.0 2026-10-20
1.2.0



 Minor Changes

- 1238 99dfe43 Thanks @jalehman! - Ingest the OpenClaw transcript through a persisted per-conversation visible-delta cursor instead of re-reading and reconciling the whole transcript on every bootstrap and afterTurn. Steady-state turns now read only new transcript entries (about 2–5 ms with no main-thread SQLite work, down from 0.3–28.5 s on large sessions).

  - commitTurn, afterTurn, ingest and ingestBatch no longer persist runtime message arrays for transcript-backed sessions, so every new row carries its transcript entry id. commitTurn records its idempotency recei

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON