lcm

Reviewed at commit c3c78dd

Lossless context management: DAG-based summarization that keeps every message reachable.

Made by
Pedro Almeida
What we checked

Records every prompt, reply and tool call (with secrets scrubbed) in a local database under ~/.lossless-claude through a background daemon it starts, summarizes old turns with Haiku on your own Claude account, and adds remembered context to your prompts. It also cleans its own entries in ~/.claude/settings.json; its doctor and install commands add an lcm.md include to ~/.claude/CLAUDE.md. Data stays local unless you configure an external summarizer.

Review details

Static review of the source at the pinned commit; not run. Delta review of the changes since 0c17dbf; the rest carries over from the review at that commit. Carried over: the function-hook module hooks/lcm-hooks.ts registers session.start, classic.SessionStart/UserPromptSubmit/PostToolUse/PostToolUseFailure/Stop (to write a claim file in TMPDIR so the command hooks stand down), session.end, prompt.context (adds a restore block from the daemon), prompt.section memory (appends a learning instruction asking Claude to call lcm_store), prompt.submit (sends the prompt to the daemon's /prompt-search and adds hits as hidden context), turn.complete (POST /ingest and /promote-events at most once a minute) and tool.call (posts tool name, input and result to /tool-event; it never changes or blocks the call); session.append and session.compact only when the opt-in compactionShadow setting is on, which runs extra header summaries with substantial model spend. Runtime calls: $.process.run of sh -c to read ~/.lossless-claude/daemon.token, config.json and TMPDIR, and of lcm daemon start --detach --automatic (the lcm on PATH, not necessarily this bundle); $.http.fetch only to http://127.0.0.1:<port, default 3737> with the bearer token; $.fs.write of claim and hook-observation files in TMPDIR; $.model.complete (haiku, or haiku/sonnet in worker mode) and $.model.fork to answer summary jobs the daemon queues, capped by sessionSummarizerMaxOutputTokens (default 50000 output tokens per session, 0 disables); $.env.get for LCM_SUMMARIZE_WORKER settings; $.ui.log for diagnostics. Failures are swallowed and logged once. plugin.json also registers command hooks (PreCompact, SessionStart, SessionEnd, UserPromptSubmit, Stop, PostToolUse, PostToolUseFailure) running node bundle/lcm.js and an MCP server node bundle/mcp-server.js with tools lcm_search, lcm_grep, lcm_describe, lcm_expand, lcm_store, lcm_stats and lcm_doctor. The daemon listens on 127.0.0.1 with a bearer token, stores transcripts, tool events, summaries and memories in SQLite under ~/.lossless-claude after scrubbing with gitleaks-derived and built-in secret patterns, reads Claude transcripts in ~/.claude/projects and the CLAUDE.md files of home and project, runs read-only git commands (rev-parse, remote -v, show, log), and exits after 30 minutes idle. The default summarizer (auto) spawns claude --print with Haiku, no tools, no plugins, no MCP and no settings, on the user's own login; at session start it may compact up to two earlier uncompacted conversations of the project. Only if the user configures llm.provider does it call the Anthropic API, an OpenAI-compatible server of their choice, or the Codex, Copilot or Oh My Pi CLIs. On every non-tool command hook, mergeClaudeSettings rewrites ~/.claude/settings.json only when it holds lcm's own legacy hook commands or the legacy lossless-claude MCP entry (it removes them and dedupes identical hook commands). The lcm_doctor MCP tool and the user-run lcm install write ~/.claude/lcm.md, append a managed lcm block to ~/.claude/CLAUDE.md and add mcpServers.lcm to settings.json; lcm install also installs a /memory skill in ~/.claude/skills, clears older lcm plugin cache folders, and when codex or omp are on PATH installs global hooks for those tools. The /memory skill is user-invoked only (disable-model-invocation) and pre-approves Bash(lcm *) and Bash(node *bundle/lcm.js*) to run the lcm CLI with the arguments you type. Shipped runtime code contains no fixed non-local host; raw.githubusercontent.com appears only in the developer script scripts/update-gitleaks-patterns.ts. What changed: only CI workflow, docs (AGENTS.md, docs/ci-runner.md), one test and a comment in vitest.config.ts; no hook module, bundle, manifest or skill file is touched, so the shipped code is identical to the reviewed commit. The three minified bundles remain checked by targeted search only.

What it uses
  • Reads your prompts: yes
  • Sees tool calls: yes
  • Blocks or changes tool calls: no
  • Reads or writes files: yes
  • Runs programs on your machine: yes
  • Calls the model (uses tokens): yes
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: no
Hooked events

Lossless context management — DAG-based summarization that preserves every message

Made this mod? Add a badge to your README

modsforClaude badge for lcm

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/lcm.svg)](https://modsforclaude.com/mods/lcm/)

← All mods