lcc on the Claude Code marketplace)lcc ships a Claude Code plugin that replaces the built-in compaction summary with
verbatim compaction: the session transcript goes to the plugin’s own lcc mcp server, the
local specialist-v3 ranker says which tool calls and results are spent, and those pairs are
dropped or trimmed. Kept messages carry
their original bytes; user and assistant text is never scored, trimmed or rewritten. The
decision logic, the report schema and the fallback rules are the ones documented in
docs/TOOL_CALLS.md for lcc compact --mode tool-calls.
export CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 # required while function hooks are early access
pip install "local-context-compiler[tiktoken]" # the `lcc` CLI and its MCP server
claude plugin marketplace add lucasmartins-ai/lcc
claude plugin install lcc@lcc
The hook reaches its server through $.mcp.call, which goes through tool permissions: allow
mcp__plugin_lcc_lcc__compact_transcript (in permissions.allow, or answer the prompt), or the
call is refused and the built-in summary runs.
Requirements: Claude Code 2.1.274 or newer and lcc on PATH. The default judge
(provider: auto, i.e. specialist-v3) runs locally with no key and no network
(details). provider: rules is the offline deterministic policy. Jev is
opt-in (provider: jev, needs TYPESAFE_API_KEY); Laya is deprecated and runs only when named.
Against a checkout, without installing:
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir plugins/claude-code
lcc setupInstalled like that, the plugin waits for Claude Code’s own threshold, drops what its ranker
marks spent, and gives no hint. lcc setup writes the settings that make it run on its own.
A plugin cannot set any of them for itself, so they go in ~/.claude/settings.json (under
CLAUDE_CONFIG_DIR when that is set; --settings names another file):
lcc setup # lists what it would change, writes nothing
lcc setup --apply # writes; the original stays at settings.json.before-lcc-setup
| It sets | Effect |
|---|---|
env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE, only with --compact-at N |
Claude Code compacts on its own at N % of the auto-compact window. Without the option nothing is written. See the 150k floor |
env.CLAUDE_CODE_ENABLE_FUNCTION_HOOKS = 1 |
the plugin answers Claude Code’s compactions verbatim |
plugin options provider: rules, rulesMode: stashed |
every output a pass removes goes to the local stash, one recall away |
permissions.allow |
mcp__plugin_lcc_lcc__compact_transcript and mcp__plugin_lcc_lcc__recall |
UserPromptSubmit hook lcc hint --hook |
recall hints on each prompt |
SessionStart hook lcc handoff --hook (matcher startup) |
a new session is told in one line that an earlier session of the directory exists (HANDOFF.md) |
already set up. To undo, restore settings.json.before-lcc-setup.CLAUDE_CODE_AUTO_COMPACT_WINDOW (the settings file’s env, then the
environment), else 200k. A session’s fixed load (memory files, tools, MCP and skill listings)
can reach ~110k tokens per request. A threshold near it makes Claude Code compact again right
after each compaction: 40 % of a 300k window (120k) compacted 8 times in 10 minutes and
Claude Code reported Autocompact is thrashing. So --compact-at is refused when N % of the
window is under 150k (on a 200k window, anything under 75; on 300k, under 50; on 1M, under
15), and an override already in the file that is under 150k is removed (listed first, written
only with --apply). An override that is not a number is left alone. setup cannot see the
model, so on a 1M-token model set CLAUDE_CODE_AUTO_COMPACT_WINDOW (for example to
1000000) first, or it judges against 200k.minReductionRatio (25 %) still falls back to Claude
Code’s summary; the early-compaction guard blocks that
summary while the window has room.pluginConfigs["lcc@lcc"].options). The statusline, the ledger and the idle stash are not
touched: set those yourself.| Path | What it is |
|---|---|
.claude-plugin/marketplace.json |
the marketplace this repository hosts (name lcc) |
plugins/claude-code/.claude-plugin/plugin.json |
the plugin manifest and its configurable options |
plugins/claude-code/.codex-plugin/plugin.json |
Codex’s manifest: same name and version, "hooks": {} so Codex skips hooks/hooks.json (see the hooks README) |
plugins/claude-code/.mcp.json |
starts the plugin’s own lcc mcp server |
plugins/claude-code/hooks/hooks.json |
registers the hook module and the classic hooks |
plugins/claude-code/hooks/lcc-compact.mjs |
the adapter: session.compact → compact_transcript → messages |
plugins/claude-code/hooks/map.mjs |
the pure mapping helpers, unit-tested on their own |
plugins/claude-code/scripts/lcc-pin.mjs |
the classic hooks: PreCompact instructions, SessionStart (compact) re-pin and the SessionStart (startup) server check |
plugins/claude-code/hooks/README.md |
operator guide: what runs, what falls back, what is limited |
The hook is plain ESM with no build step and no dependencies: the Python package does the work, the plugin translates.
Set through /plugin → lcc, or claude plugin install lcc@lcc --config key=value
(defaults in parentheses):
| Option | Meaning |
|---|---|
question ("") |
the objective; empty uses the text after /compact, or the newest user prompts |
threshold (0.5) |
below this keep-probability a call or result becomes a candidate for removal |
preserveRecentMessages (6) |
newest messages never scored, never mutated |
trimHeadChars (300) |
characters kept from a spent result whose call still matters |
maxStateTokens (25000) |
token ceiling for the conversation shown to the judge |
maxRequestTokens (30000) |
ceiling for state plus one batch of questions per request |
minReductionRatio (0.25) |
below this share removed, the plugin keeps the built-in summary |
server (plugin:lcc:lcc) |
MCP server name to call, as Claude Code names the plugin’s own |
idleStash (false) |
opt-in idle stash, see below |
idleTtlSeconds (7200) |
idle seconds after the last turn before a resumed session’s cache counts as cold |
idleMinRemovableTokens (10000) |
below this many removable tool-output tokens the idle stash does nothing |
idleMaxPassesPerSession (8) |
cap on idle stashes per session |
ledger (false) |
opt-in local ledger for the statusline, see below |
Receipt. Every compaction this plugin applies toasts one line built by the server
(lcc.receipt.receipt_line): tokens before and after, what was removed, and how to get it back.
lcc: verbatim compaction via rules, no summary (48,210 -> 31,004 tokens (-17,206, -35.7%) · 2 stashed, 1 deduped · recall: lcc recall aaaaaaaaaaaa (+1 more))
The CLI prints the same line last after lcc compact --mode tool-calls; --receipt prints the
full one (the five largest stashed outputs with their recall ids, and the cache effect).
Dropped or trimmed outputs (a judge, or rulesMode: lossy) are not recallable, and the line
says so.
Ledger (opt-in, off by default). With ledger: true (or LCC_LEDGER=1 in the MCP
server’s environment) the server appends one JSON line per compaction the hook applies to
~/.cache/lcc/ledger.jsonl (LCC_LEDGER_PATH; directory 0700, file 0600):
{"v":1,"ts":"2026-10-21T09:12:03Z","session":"e279159a3ffc189d","provider":"rules","tokens_before":148210,"tokens_after":121004,"stashed":14,"deduped":3,"replaced":16,"dropped":0,"trimmed":0}
Counts and fixed labels only: no transcript text, no paths, no tool names or inputs, and the
session id only as a truncated SHA-256. Nothing reads it but the statusline, and nothing is
sent anywhere. The server writes it (hook modules have no file system) only for a pass that
meets the hook’s own replacement rule (not degraded, over minReductionRatio, removed
something). Idle-stash passes are not recorded: the server cannot see whether Claude Code
accepts that compaction. The HTTP server (lcc mcp --http) refuses ledger, as it refuses
the stash, and never writes the ledger even when it inherits LCC_LEDGER=1. Delete the file to reset it.
Recall records. With the ledger on, each recall (CLI or MCP) also appends one line,
failures included:
{"recall_v":1,"ts":"2026-10-21T11:02:00Z","session":"e279159a3ffc189d","outcome":"ok","bytes":5120,"partial":false,"age_s":420,"repeat":false}
outcome is one of ok, missing, hash_mismatch or invalid (a bad id or line range).age_s is the seconds since the blob was last stashed.partial means a --lines range was asked for.repeat means the blob was recalled before.session is the hash of the session that stashed the blob, so it joins with that session’s
pass records. It is null when several sessions stashed the same bytes.The record never holds the id, the text or any path. It has recall_v instead of v, so the
statusline does not count it as a pass. Each record marks a stashed output that was needed
again, which is the data a stash policy needs
(research).
The plugin’s ledger option reaches only the compaction calls the hook makes. The model’s
recall calls go to the lcc mcp server, so record them by setting LCC_LEDGER=1 in that
server’s environment. A ledger: false argument still wins over the variable.
Statusline. scripts/statusline.mjs reads the ledger and Claude Code’s statusline JSON
on stdin. Add it to ~/.claude/settings.json with the plugin’s path on your machine:
{ "statusLine": { "type": "command", "command": "node /path/to/plugins/claude-code/scripts/statusline.mjs" } }
It prints the tokens this session’s passes removed, the outputs stashed, the cache-read
share of the last request (from Claude Code’s context_window.current_usage, when present),
and how full the context window is (context_window.used_percentage, floored, with the window
size):
lcc: -40.6k tokens (2 passes) · 23 stashed · cache read 92% · ctx 41% of 200k · /compact suggested
lcc: no pass this session before the first applied pass; lcc: ledger off when there is no
ledger file. The ctx part needs no ledger. Claude Code sends no percentage early in a session
and right after /compact, and then the part is left out. Generated from the fixture ledger
in test/fixtures/ledger.jsonl (node test/statusline.test.mjs).
Compacting earlier. /compact suggested appears once the context is 30 % full. Set
LCC_SUGGEST_COMPACT_AT to another percentage, or to 0 to turn the hint off. The
statusline only suggests: nothing it runs compacts the session. To have Claude Code compact
on its own earlier, run lcc setup --apply --compact-at N or add
this to ~/.claude/settings.json (a plugin cannot set it for you), here for a 1M window:
{ "env": { "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "40", "LCC_SUGGEST_COMPACT_AT": "30" } }
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE is a Claude Code setting. It takes 1–100, applies to
subagents too, and can only lower the default threshold. Its percentage is of the
auto-compact window, so on a 1M-token model 40 % is roughly 400k tokens. Keep it at 150k
tokens or more. On a 200k window that means 75 or more (40 % is 80k), and on a 300k
CLAUDE_CODE_AUTO_COMPACT_WINDOW, 50 or more. Under that, a session whose fixed load is
~110k compacts again right after each compaction (the floor).
The replay below assumed a 200k window and did not model a fixed load, so its 30–40 % does
not carry over to small windows. That compaction goes
through this plugin like any other: verbatim when the pass clears minReductionRatio,
Claude Code’s own summary (with the PreCompact pin) otherwise. Earlier compaction is not
free. On a warm cache, the first request after a compaction writes the new prefix at the
cache-write price. A replay of 196 of the maintainer’s long Claude Code sessions estimated the
input cost with a model. That is one corpus and one run, not a measured bill, and output
tokens are not counted. Compared with Claude Code’s summary at its own threshold, the estimates
at 40 % were:
At 40 % and above, verbatim compaction keeps more context than a summary, so it costs more input at the same threshold. What it buys is the exact text. Details: Threshold replay. The same rule for Codex, Gemini CLI, Aider, OpenCode, Cline and Cursor: Compacting earlier.
Early compaction is guarded. An early compaction that reaches PreCompact is about to be
Claude Code’s own summary. When less than 25 % of the context is tool output that lcc could
stash verbatim (a chat-heavy session), that summary would lose detail while the window still
has room. So PreCompact blocks it, and Claude Code tries again on the next turn. The guard
blocks only when all of these hold:
trigger is auto and CLAUDE_AUTOCOMPACT_PCT_OVERRIDE is below 75. A manual /compact
always runs.CLAUDE_CODE_AUTO_COMPACT_WINDOW and the most it can prove: 200k (every Claude model), or
the largest request that succeeded. Until a session has a request over 200k, the guard
blocks only under 150k.Claude Code compacts on its own about 33k tokens under the window, and a block during overflow
recovery fails the request. The 75 % ceiling keeps the guard well under both. Measured on
Claude Code 2.1.309: a blocking PreCompact ran on each of 4 turns at a forced 1 % threshold,
and every turn succeeded, with cache reads unchanged. Turn the guard off by unsetting
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE.
The guard does not prevent a threshold that is too low. It defers a compaction only while
little tool output is removable, and Claude Code asks again every turn, so at a threshold under
a session’s fixed load it either blocks every turn up to the 75 % ceiling or lets the summary
through and the context refills at once. On 2026-11-11 (Claude Code 2.1.321, 40 % of a 300k
window, cc-plugin-sec-default skipping the plugin’s session.compact hook) a session
compacted 8 times in 10 minutes. Replaying its transcript, the guard stood down at 9 of 12
auto-compactions: it counted prompt_snapshot records (fixed since) as context. At the other
3 it would have blocked. Claude Code records no PreCompact output for an auto-compaction, so
whether it ran there is not known. The fix is the threshold: see
the floor.
A stashed output is only useful if the agent asks for it back, and agents often don’t: in the
LongHealth v1 pilot, stashed lost 0.40 of accuracy on questions whose answer had been
stashed, because the model rarely called recall. lcc hint is a deterministic nudge. When
your new prompt names something that sits in a stashed output (an identifier, a path, a test
id, a date, a name), the agent gets one line before it answers:
lcc hint: your prompt names a stashed output (test_refund_77): "pytest output: FAILED tests/test_api.py::test_refund_77" · lcc recall 3ba2ab04a8dc
lcc setup --apply turns it on, or add the UserPromptSubmit hook to ~/.claude/settings.json
yourself:
{ "hooks": { "UserPromptSubmit": [ { "hooks": [ { "type": "command", "command": "lcc hint --hook", "timeout": 5 } ] } ] } }
lcc recall <id> pointers in the last 16 MB of the session transcript,
plus the stashed outputs whose sidecar names this session (the plugin sends its session id
on every pass).hints/<session hash>.json next to the stash, and they are ids and counts only.--hook, any error prints nothing and exits 0, so the prompt
always goes through. On one Mac the hook takes about 90 ms per prompt (median of 30
fresh-process runs on a real stash with a 72-blob session and a 21 MB transcript), of which
about 23 ms is Python start-up. It took about 340 ms when it loaded the whole CLI.Any other agent tool that can run a command per prompt can use the same matcher:
lcc hint "<prompt>" --transcript <session file> --session <id> prints one line per hint. On
50 real stashed outputs, with a synthetic prompt naming an identifier unique to each, the top
hint was the right output 50 times out of 50, and 4 generic prompts got no hint. That is a
check that the matcher works, not a measure of how much hints help: that needs a study.
Off by default. With idleStash: true, when a session is resumed after idleTtlSeconds
of idle, the plugin stashes spent tool outputs (provider: rules, rulesMode: stashed)
before the first request, so that request re-writes a smaller prefix on a prompt cache that
has already expired. Removed outputs become [removed: N lines, S KB · lcc recall <id>]; allow
mcp__plugin_lcc_lcc__recall so the agent can get them back.
An owner-only study of 767 of the maintainer’s Claude Code sessions (usage metadata only, private receipts) found:
recall, which is why this is opt-in and not a default.One user, one machine, subscription traffic; the prices are relative multipliers. The study
simulated a trigger on every idle return; this plugin can only act on a resumed session (see
below), so it covers a subset of those returns. Measure your own recall calls per pass and
the next request’s cache read vs write before relying on it.
| Moment | What happens |
|---|---|
each main-loop turn.complete |
stores the time in the plugin’s own store ($.store, keyed by session id, newest 64 sessions kept) |
session.start of a resumed session |
if the gap is past idleTtlSeconds, under idleMaxPassesPerSession, with at least idleMinRemovableTokens of tool output outside the pinned messages (chars/4), it runs the stash through compact_transcript, then calls $.session.compact({ instructions: "lcc:idle" }); the plugin’s session.compact hook hands in the prepared pass |
Guards:
{ skip }. If Claude Code compacts
without asking the plugin’s hook (it does when the call comes from the plugin’s own code
outside a hook, see below), the plugin’s classic PreCompact hook sees
custom_instructions: "lcc:idle" and blocks it. On a cold 300k-token cache the built-in
summary is the most expensive outcome there is.compact_transcript for ref_unchanged and ref_blocks, like /compact
(see the MCP result cap): a 12-message session with four 10 KB reads
already crossed the cap.workspace_root, so stashed can take file reads the
disk still holds. Reads under a system temp directory are never stashed (a rules rule).idleTtlSeconds counts as cold; a negative gap (clock skew) or a missing timestamp never
does. The pass sends cache_state: "cold" (unknown for a manual /compact lcc:idle), and
the report’s cache_effect prices it. Existing [removed: … · lcc recall <id>] placeholders
are never stashed again, so a second idle stash over stashed history removes nothing new
from them and keeps their bytes. UI calls are best effort: a headless engine without toasts
never makes a hook throw.Toasts: lcc: idle stash (removed N tokens, S output(s) stashed, idle 2h-8h; recall brings any
back) or lcc: idle stash skipped (reason). With LCC_REQUEST_LOG=1 the MCP server’s request
log gets trigger: "idle", gap_bucket and removed_tokens on each idle pass.
| Trigger tried | What Claude Code did |
|---|---|
prompt.submit hook (the returning prompt) |
refused: “it would compact under the turn this hook is holding; call it from a later event” |
headless session (claude -p, SDK) |
refused: “not available in a headless (-p / SDK) session yet” |
$.clock.after timer armed at turn.complete (session left open) |
the call is the plugin’s own code, so Claude Code skipped all of the plugin’s hooks (“re-entry … origin lcc”), including the .catch handler, and ran its own summary. The PreCompact backstop now blocks that. |
session.start hook of a resumed session |
works: the plugin’s session.compact hook ran nested, “a hook’s 26 messages stand … core never ran” |
So a session left open while you are away gets no idle stash; one you close and resume
(claude --continue / --resume) does. If a later Claude Code runs a plugin’s own hook for a
compaction the plugin raised from a timer, the timer path can come back.
Everything depends on the cache really being cold when the pass runs. A pass on a warm cache throws away a cached prefix and costs money.
[cache-keepalive] touch ok in --debug, MEDIDO in the runs below). Its
defaults, read from the binary (INFERIDO): touchIntervalSeconds 30,
activityWindowMinutes 60. With a 1-hour TTL the cache of a session that stayed open is
cold only about two hours after its last turn, which is why idleTtlSeconds defaults
to 7200 rather than 3600. The plugin measures the gap from the last turn, not from when you
closed the session, so 7200 stays on the safe side whenever the session was closed within
the 60-minute keepalive window.recoverable and stashed verify a file read against the disk before replacing it. Claude
Code 2.1.296’s Read numbers the empty line after a file’s final newline (480\t for a 479-line
file), so every whole-file read of a newline-terminated file failed that check and was never
stashed. That empty trailing row is now ignored (a non-empty one still fails).
Throwaway project (four 8.5 KB Python files read with the Read tool), plugin from this branch
via --plugin-dir, the installed lcc@lcc disabled for the run through --settings,
idleTtlSeconds: 60 and idleMinRemovableTokens: 1000 for the run only, model Haiku,
subscription login, interactive sessions driven through a pty. Counts from --debug logs and
the session JSONL; n=1 per path, a smoke test.
| Run | Path | Result | Fix it led to |
|---|---|---|---|
| 1 | prompt.submit |
refused by Claude Code (above); the prompt went through | moved off prompt.submit |
| 2 | -p --resume |
session.start decided to fire; $.session.compact refused in headless |
documented: interactive only |
| 3 | timer, interactive | plugin hooks skipped (re-entry); Claude Code’s own summary ran (manual boundary, 83,137 tokens, 9.9 s) | pass computed before the call; .catch to hand it in on re-entry |
| 4 | timer | the 49 KB compact_transcript answer was replaced by an error text (MCP size cap) |
ref_unchanged |
| 5 | timer, proof folder moved out of the temp dir (temp reads are never stashed) | 0 outputs stashed: the prompt named the files, so the rules kept them (named_in_goal_or_recent_turns) |
proof prompt reworded |
| 6 | timer | 0 outputs stashed: every whole-file read failed the disk check | disk-check fix (below) |
| 7 | timer | 2 outputs prepared (5,446 tokens), but the hooks were skipped again and Claude Code’s summary ran; the plugin’s toast wrongly said the stash stood | outcome check: a pass counts only if the plugin’s hook handed it in |
| 8 | timer, with backstop | plugin hooks skipped again; Compaction blocked by PreCompact hook ..., “core never ran”, toast idle stash skipped; no summarizer request |
timer path dropped |
| 9 | resume (claude --resume, interactive, 61 s idle) |
idle stash starting (resume), own MCP server connected in 426 ms, pass 218 ms, “a hook’s 26 messages stand … core never ran”; toast lcc: idle stash (removed 10892 tokens, 4 output(s) stashed ...); the JSONL holds four [removed: ~2734 tokens · lcc recall <id>] results |
$.mcp.connect at session.start (the first resume found the server not yet connected) |
After run 9 the agent called recall and got the exact bytes back (sha256 included), though it
first picked the wrong id. The first request after the stash read 31,306 and wrote 32,714
cache tokens: in this proof the cache was still warm (60 s idle, keepalive on), so the stash
re-wrote a warm prefix, which is exactly the cost a real idleTtlSeconds avoids.
Not verified: the saving on a real bill, the recall rate in real use, a real >2 h gap, and
Claude Code builds other than 2.1.296.
Two classic hooks ship in the same hooks/hooks.json and run on any Claude Code with plugin
hooks, with no CLAUDE_CODE_ENABLE_FUNCTION_HOOKS, no judge key and no network:
| Hook | What it adds |
|---|---|
PreCompact |
stdout becomes extra instructions for the built-in summary: the session objective (the two newest user prompts), the files edited and read, and the last tool error, with the order to copy file paths, identifiers and error text verbatim. It blocks an early auto-compaction with too little tool output to stash (Compacting earlier) |
SessionStart, matcher compact |
the same facts, injected into the fresh context after the summary |
Both read the facts from the hook’s transcript_path (the session JSONL, which compaction
appends to and does not rewrite), so they agree and nothing is stored between them. Lists are
capped at 20 files and the error at 400 characters. Anything unreadable prints nothing and exits
0, so compaction runs exactly as before. Covered by node test/hook-pin.test.mjs.
A third classic hook (SessionStart, matcher startup) checks the server the plugin starts.
.mcp.json runs a bare lcc, so the hook runs lcc --version and shows the user one line when
the command does not run (not on the PATH Claude Code was launched with, or a virtualenv that
moved) or when its major.minor differs from the plugin’s. It prints nothing when both agree, and
nothing when the server option names another server. It runs in the hook’s environment, so a
PATH that differs between hooks and MCP servers is not caught.
No key, a degraded pass, a conversation that cannot fit the state budget, a pass below
minReductionRatio, content the hook cannot rebuild (image or attachment blocks), or any MCP
failure — each of those calls next(event), so Claude Code compacts exactly as it did before.
The plugin never requests a compaction of its own unless the opt-in idle stash is on; otherwise
it only decides what a compaction produces. Every outcome is one log line plus one toast, e.g.:
lcc: verbatim compaction, no summary (kept 18 messages, dropped 7 tool call(s), trimmed 2)
lcc: built-in summary (below the 25% minimum (4.2%))
lcc: built-in summary (judge unavailable (jev_unavailable_fail_safe))
Claude Code caps an MCP tool result at MAX_MCP_OUTPUT_TOKENS: 25,000 tokens by default on
2.1.296 (the binary’s default; a server-side flag can change it, the environment variable wins).
A larger result is not truncated JSON: the plugin’s $.mcp.call gets a pointer text to a saved
file. Through 1.1.0 the hook asked for the whole compacted conversation, so on any session long
enough to be worth compacting the answer was over the cap, the hook could not parse it and
Claude Code’s own summary ran.
The hook now asks for ref_unchanged: true, ref_blocks: true. The server answers with refs into
the transcript the hook sent: { "ref": i } for an unchanged message, and for a changed one the
indices of the kept tool calls and results plus, for each replaced result, only its new text
between the original’s first head and last tail characters (UTF-16 units). Placeholders and
trim notes travel; file contents do not. The hook rebuilds the messages from the session’s own
copy and throws on any ref that does not fit, which falls back to the built-in summary. An
answer that is still over the cap toasts lcc: built-in summary (tool result is not JSON (N
chars; over Claude Code's MCP output cap?)).
Evidence. In the owner’s session logs from 2026-10-07 to 2026-10-19 (plugin installed, function
hooks on, provider: rules, rulesMode: stashed), every /compact of a real session (209k to
860k tokens, 27 boundaries) wrote Claude Code’s summary (50 to 115 s each); the plugin’s
verbatim pass stood only on disposable test sessions of about 58k to 84k tokens. Those logs hold
no toasts, so the cap is the likely cause, not a measured one (INFERIDO). A disposable session
then reproduced it (Claude Code 2.1.296, Haiku, subscription login, plugin from --plugin-dir,
the installed lcc@lcc off for the run, same options; twelve 30 KB files read, then /compact;
n=1 per row):
| Hook | compact_transcript answer |
Outcome |
|---|---|---|
| before (whole messages) | 157.8 KB, saved to a file by Claude Code; the hook got a 1,365-char text | lcc: built-in summary (JSON Parse error: Unexpected identifier "Error"), summary ran |
after (ref_blocks), twice |
3,002 / 3,003 chars | lcc: verbatim compaction via rules, no summary (kept 26 messages, ... replaced 8); “a hook’s 26 messages stand … core never ran” |
After the fix the agent quoted a placeholder ([removed: 8354 tokens · lcc recall <id>]),
called recall and named the first function of the recalled file correctly.
Verified: claude plugin validate plugins/claude-code passes and reports the registered
surface (session.compact; calls $.mcp.call, $.ui.log, $.ui.toast); the plugin installs
from this repository’s marketplace with the documented commands (`claude plugin marketplace add