Skip to content

Claude Code

lcc cut one Claude Code session 49.5% without a summary

6 min read

Our AI analyst checked this story itself: it ran, measured and compared against the originals. What we checked

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: Claude Code versions and changes →
Image: github.com

lcc, an MIT-licensed compactor for Claude Code posted to Show HN on October 23, moves old tool outputs out of a session into a local store the agent can recall them from, and keeps every user and assistant message byte for byte, where /compact replaces the session with a model-written summary, according to the project’s README on GitHub. If your long sessions are heavy on tool output, its offline measure-session command shows what you would save before you install anything, and you should run it, because the headline 49.5% cut is one of the author’s best cases: across 299 of the author’s own long sessions, the median was 21.8%.

That best case was a real session of 193 messages and 75 tool calls. Tokens fell from 57,083 to 28,807, and 33 tool outputs left the context, each one recall away. The 299 sessions in the wider set had 100+ messages each and 36.3 million tokens in total. The middle half of the cuts fell between 15% and 31%, the best was 65%, and no messages were lost. “These are all my sessions: run it on yours and post the result,” the author writes.

Measure first, then install the plugin

On Python 3.11 or later, the measurement takes two lines: pip install "local-context-compiler[tiktoken]", then lcc measure-session "$(ls -t ~/.claude/projects/*/*.jsonl | head -1)" for your latest session. It runs every mode offline and prints counts only (messages, tool calls, tokens before and after, time). Nothing is changed and nothing leaves the machine. lcc never downloads anything itself, so for exact counts you cache the tokenizer once with python -c "import tiktoken; tiktoken.get_encoding('o200k_base')". Skip that and the report says its numbers are approximate. Point the command at a project directory and you get the median and p90 reduction per mode. It also detects Codex CLI rollout files on its own. The PyPI package named lcc is a different project.

The plugin takes over from the /compact summary. Install it with claude plugin marketplace add lucasmartins-ai/lcc and claude plugin install lcc@lcc --config provider=rules --config rulesMode=stashed, then allow mcp__plugin_lcc_lcc__recall so the agent can get removed outputs back. On Claude Code 2.1.287 or later, the mods surface it hooks into is on by default. If a pass fails or removes less than 25%, the plugin hands over to the built-in summary and says so in a toast. Outside Claude Code, the same compactor runs as an MCP server for Cursor, Claude Desktop or any stdio client, and as a CLI on a session file or any document.

What leaves the context

Anthropic describes compaction as summarizing the task into a smaller description, after which the model carries on in a new context window. The README’s complaint is that such summaries drop the exact error, path or line the agent needs two turns later.

The recommended setup uses the rules provider in stashed mode, and that path runs no model at all. Each removed output is replaced by a placeholder like [removed: 120 lines, 4.3 KB · lcc recall <id>] and stored under ~/.cache/lcc/stash. That store is content-addressed: each file is named after a hash of its bytes, and lcc recall checks the hash again before returning the output. Every pass writes a JSON report, and lcc explain gives the reason each block was kept or dropped.

The default ranker, specialist-v3, runs on your CPU in plain Python and needs no API key. It was trained on Claude Code transcripts, so other agents and plain documents are out of its distribution. Plain text goes to the mechanical ranker unless you opt in to Jev, a remote judge on the TypeSafe API that sends the objective and the context blocks off the machine, and having a TypeSafe key does not turn it on. On the author’s held-out test of 193 items from 36 sessions, v3 kept what the agent used next with a retention AUC of 0.899, against 0.818 for keeping the most recent blocks. The labels come from the maintainer’s own sessions, which the README says favours v3.

What the 73% compares

The accuracy claim rests on a pre-registered test of 172 real requests from 75 session groups, run on October 18. Claude Opus 5.5 graded it without knowing which arm produced each answer, and Gemini, as a second judge, agreed at κ = 0.91, a chance-corrected agreement score. An agent answering from the stashed context plus recall scored +0.006 against full context on file recall (95% CI −0.023 to +0.034), using 36.6% fewer tokens. The test was set up for non-inferiority with a margin of −0.05, so the result means the agent was not worse than full context by more than 5 points on file recall. The README’s “did as well as” claims more than that. The agent called recall for 90% of the questions about removed content. The raw data sits in a private repository.

The 73% comes from a separate arm, run on October 17 over the same 172 requests. A summary from the author’s clean-room reimplementation of Claude Code’s auto-compact, written by Claude Opus 5.5, got 73% of exact values right, against 98% for full verbatim context. That was not Claude Code’s own compaction. And per the project’s evaluation page, the summary arm left 0.98 million context tokens out of 9.41 million, while lcc’s arm kept 5.96 million. So the 73% belongs to a summary that kept only about a tenth of the tokens.

Our analysis

What we checked

On October 25 we read lcc’s library and plugin code, pulled the PyPI metadata for every release from 0.4.0 to 1.2.0, tried the install on Python 3.10.12, and compared the plugin docs with Claude Code’s mods documentation and npm release history.

How we check stories

The README’s stash and network safeguards are in the code as described. The install path is where it falls short: the Python floor is hard and goes unmentioned where you install, and the Claude Code flag the README tells you to export no longer does anything on current releases.

  • Every release requires Python 3.11 or later. On 3.10, pip fails with “from versions: none” and names no cause. The README gives 3.11+ only under Development.
  • The README and plugin guide still require CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 with Claude Code 2.1.274+. Claude Code’s docs say mods are on by default from v2.1.287, and that version and later ignore the flag, even when it is set to 0. 2.1.274 shipped on September 16, and the latest, 2.1.310, on October 23.
  • In the library, the 25% gate only marks a pass as not worth it and never changes the bytes. Exactly 25% passes. The handover to the built-in summary is the plugin’s own decision. We read this in the code and docs and did not measure it.
  • Recall hashes the file with SHA-256 and refuses to return it on a mismatch. Auto mode reaches Jev only when LCC_AUTO_REMOTE=1 is set and LCC_DISABLE_NETWORK=1 is not. Both come from reading the code; we ran no tamper or network test.
  • The plugin uses session.compact, an event documented in Claude Code’s mods reference. Its type declarations still read “EARLY ACCESS: this surface may change between releases without notice.”

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.