lcm
Shared memory infrastructure for coding agents
DAG-based summarization, SQLite-backed message persistence, promoted long-term memory, MCP retrieval tools
Website •
Runtime Model •
Installation •
MCP Tools •
Development
lcm replaces sliding-window forgetfulness with a persistent memory runtime for both humans and agents.
- Every message is stored in a project SQLite database.
- Older context is compacted into a DAG of summaries instead of being dropped.
- Durable decisions and findings are promoted into cross-session memory.
- Claude Code already has end-to-end hook integration, while VS Code, Codex, and Oh My Pi use connector-based workflows on the same backend today.
Humans and agents use the same backend. The integration surface differs by client, but the memory model is shared.
This repo started as a fork of lossless-claw by Martian Engineering, adapted for Claude Code. The LCM model and DAG architecture originate from the Voltropy paper.
Runtime Model
flowchart LR
subgraph Clients["Clients"]
CC["Claude Code<br/>hooks + MCP"]
end
CC --> D["lcm daemon"]
D --> DB[("project SQLite DAG")]
D --> PM[("promoted memory FTS5")]
D --> TOOLS["MCP tools<br/>search / grep / expand / describe / store / stats / doctor"]
Capabilities by integration path
| Path | Restore | Prompt hints | Turn writeback | Automatic compaction | Notes |
|---|
| Claude Code | Yes | Yes | Yes, via transcript/hooks | Yes | Primary hook-based integration |
| GitHub Copilot (VS Code) | No | Yes, via skill/rules | No | No | Repo-local skill can teach Copilot to call lcm, but there is no automatic restore or turn capture yet |
| Codex | Yes | Yes | Yes, via native lifecycle hooks | LCM memory compacts on PreCompact; native compaction continues | lcm connectors install codex installs the hooks; see docs/vscode-codex.md. MCP config in .codex/config.toml is still manual |
| Oh My Pi | Yes | Yes | Yes, via native lifecycle hooks | Yes | lcm connectors install omp installs the hooks and --type mcp registers the MCP server; see docs/omp.md. |
LCM Model
| Phase | What happens |
|---|
| Persist | Raw messages are stored in SQLite per conversation |
| Summarize | Older messages are grouped into leaf summaries |
| Condense | Summaries roll up into higher-level DAG nodes |
| Promote | Durable insights are copied into cross-session memory |
| Restore | New sessions recover context from summaries and promoted memory |
| Recall | Agents query, expand, and inspect memory on demand |
Nothing is dropped. Raw messages remain in the database. Summaries point back to their sources. Promoted memory remains searchable across sessions.
flowchart TD
A["conversation / tool output"] --> B["persist raw messages"]
B --> C["compact into leaf summaries"]
C --> D["condense into deeper DAG nodes"]
C --> E["promote durable insights"]
D --> F["restore future context"]
E --> F
F --> G["search / grep / describe / expand / store"]
Installation
Prerequisites
- Node.js 22+
- Claude Code if you want hook-based automation
- GitHub Copilot in VS Code if you want VS Code integration
- Codex CLI if you want Codex connector installation, summarization, or transcript import
- Oh My Pi if you want Oh My Pi connector installation or transcript import
Claude Code
Install the lcm binary first:
npm install -g @lossless-claude/lcm # provides the `lcm` command
claude plugin marketplace add lossless-claude/lcm
claude plugin install lcm@lossless-claude
lcm install