Context & memory·terminal·MIT
lcm
Every message kept in SQLite, old context compacted into summaries Claude can expand.

lcm keeps every message of a Claude Code session instead of letting compaction drop it. Messages go into a SQLite database on your machine, older ones are compacted into a DAG of summaries that point back to their sources, and durable findings are promoted into a memory shared across sessions. Claude gets lcm_search, lcm_grep, lcm_expand, lcm_describe, lcm_store, lcm_stats and lcm_doctor as MCP tools to query that memory and expand any summary back to its source. The project is a fork of Martian Engineering’s lossless-claw, adapted for Claude Code by Pedro Almeida on the LCM model from the Voltropy paper.
Install
Needs Node.js 22 or later and Claude Code with function hooks enabled. The author declares no minimum Claude Code version. The plugin also ships classic command hooks, so memory works without the flag; with it on, the function-hooks module takes over most of their work.
npm install -g @lossless-claude/lcm
claude plugin marketplace add lossless-claude/lcm
claude plugin install lcm@lossless-claude
lcm install
lcm install writes the config, registers the MCP server, installs the /memory skill and checks the daemon; --dry-run changes nothing. lcm doctor checks daemon, hooks, MCP and summarizer.
How it works
Everything goes through a local daemon on http://127.0.0.1:3737 (the port lives in ~/.lossless-claude/config.json), authenticated with the bearer token in daemon.token next to it. Every network call the module makes goes to that address; nothing leaves the machine unless you point the summarizer at an external API. The module reads the token, the port and TMPDIR with one sh command when it loads, and runs lcm daemon start --detach when the daemon is not answering, at most once a minute. That is why the npm install comes first: a marketplace-only install has no lcm on PATH, cannot restart an idle daemon and loses events until a command hook does it.
At session.start the module writes a claim file, lcm-claim-<session id>.json, in the temp directory; while it exists the restore, prompt, tool and stop command hooks stay silent and the module does their work. PreCompact still runs as a command hook and writes a DAG summary before Claude Code’s own compaction; SessionEnd ingests the finished transcript. Every hook fails open: an unreachable daemon costs a lost event, never a blocked session.
What the module reads. On tool.call it forwards the name, input, response and error of every Agent, AskUserQuestion, Bash, EnterPlanMode, ExitPlanMode, Read, Edit, Write, Glob, Grep, TaskCreate, TaskUpdate, Skill and mcp__* call to the daemon, Bash commands and file edits included, and the daemon records decisions, plans, files, commands and errors from them. On prompt.submit it sends the prompt text to the daemon’s search. On turn.complete, at most once a minute, it asks the daemon to ingest the new part of the session transcript and to promote pending events.
What it injects. prompt.context fires at the start of a conversation and again after a compaction or /clear; the module appends one block named lcm with the restore text (project context, recent summaries, promoted memory) and recent learnings with confidence scores. prompt.section adds a standing instruction to the memory section of the system prompt once per session, telling Claude when to call lcm_store and to vote on surfaced memories. prompt.submit attaches the memory hits as hidden context under your prompt; you never see them. The module caps none of these blocks; the daemon decides what to return.
What it stores. Everything lives under ~/.lossless-claude/ (LCM_HOME moves it): the daemon, one SQLite database per project with the raw messages and the summary DAG, the promoted memory with FTS5 search, sidecar databases for events and hook errors, and logs. API keys, tokens and passwords are scrubbed before any write and before any summarization. lcm sensitive add "<pattern>" adds your own patterns and lcm sensitive purge --yes deletes everything stored for the current project.
What it costs. While the module is loaded it polls the daemon for summary jobs and answers them through the session’s own model access: leaf summaries with $.model.complete on haiku, condensed summaries with $.model.fork, falling back to haiku. Output tokens count against the plugin setting sessionSummarizerMaxOutputTokens, 50,000 per session by default; at the cap the poller stops, and 0 turns it off. The daemon also has its own summarizer, LCM_SUMMARY_PROVIDER, defaulting to auto, which resolves to claude-process; any provider other than disabled receives the messages to summarize after redaction. The restored block and the per-prompt hints are extra input tokens on every request, uncapped by the module.
The difference from /compact is what survives: after Claude Code’s compaction the model has only the summary, while with lcm the raw messages stay in SQLite, the summaries point at them, and Claude can call lcm_expand or lcm_grep to get the detail back.
All settings are optional and read when the daemon starts, so run lcm daemon restart after a change:
LCM_HOME: storage root, default~/.lossless-claude.LCM_ENABLED:falsemakes every command hook a no-op while the plugin stays installed.LCM_SUMMARY_PROVIDER:auto,claude-process,codex-process,copilot-process,anthropic,openaiordisabled.LCM_CONTEXT_THRESHOLD: context fill ratio that triggers compaction, default0.75.LCM_FRESH_TAIL_COUNT: most recent raw messages protected from compaction, default8.LCM_CONDENSED_TARGET_TOKENS: target size of a condensed summary, default900.
Limitations
- Transcript ingest runs at most once a minute, so the newest turns reach memory with a lag.
- The module shells out through
sh; the author says nothing about Windows. - Codex and GitHub Copilot share the daemon without function hooks; Copilot gets prompt hints only, with no automatic restore or turn capture.
More mods
The whole directory →commonplace
Your notes as a wiki Claude maintains: ingest papers, ask questions, keep it healthy.
claude --plugin-dir /path/to/commonplacecs-rotate
A rotate button above the prompt once context passes 40%. Needs the cs session manager.
bash -c "$(curl -fsSL https://raw.githubusercontent.com/hex/claude-sessions/main/install.sh)"kindex-modern
Task tools backed by a Kindex store in your repo, plus repo memory on every prompt.
kin setup-hooks --mode modernsegmem
Long-term memory by kind and scope in one SQLite file. Wake at start, recall per prompt.
claude plugin install segmem@segmem