Getting started for Pi
Pi: install `pi-lossless`, confirm the store is live, set the cut line, and prove a compacted detail is still readable.
You have a session that grows past the model window. LCM keeps every message in a local store and lets the model read what compaction removed.
The engine is shared. The package needs Node.js 22.19 or newer.
LCM mirrors the session into a sidecar; the harness’s session record stays untouched.
Install and run
Install the extension
pi install npm:pi-losslessNo service, daemon, or config file.
Confirm the store is live
/lcm statusSample output
LCM: 412 messages, 9 summaries, 2140 KB
projection: pinned at cut 3 (applied at 71%)
context: 68% of 400.0k
thresholds: swap 70% / recut 85%
window: 400.0k (Pi's belief, uncorrected)Set the cut line
/lcm settingsThe cockpit edits every threshold, the summarizer chain, the file-handle trigger, and two toggles in place. Changes apply to this session; save them to ~/.pi/agent/lcm.json to keep them. The configuration page documents every key. smartZone is a token count, not a ratio: swap at that count and re-cut at 1.18 times it. Explicit tokens win over ratios.
Read the cost
/lcm reportThe report shows what each swap moved, what the summarizer calls cost, which model answered, and whether a fallback ran.
Back up and remove
/lcm backup
/lcm export lcm-export.jsonl
/lcm gc/lcm backup writes a timestamped copy beside the store. /lcm export writes the full transcript at mode 0600. /lcm gc lists stores whose session file is gone; --apply exports then deletes each one. To remove everything, uninstall the extension and delete ~/.pi/agent/lcm/.
What starts on its own
On the first turn of a session, the adapter mirrors prompts, assistant text, and tool traffic into a SQLite store with a full-text index. Ingestion is idempotent: a resumed session, a replayed turn, or a restarted process does not duplicate a row.
Below the swap point nothing is summarized and the model sees the conversation itself. The defaults swap at 70% of the model window and keep the last 20,000 tokens verbatim. The adapter also mirrors compaction boundaries, so summary text stays searchable.
Prove a compacted detail is still readable
Ask the model to recall something no longer in its context, or run the recall path yourself after a swap:
lcm_grep({ query: "the retry policy we settled on" })
lcm_describe({ id: 12 })
lcm_expand_query({ query: "the retry policy we settled on", summary_id: 12 })
The first call returns hits with an entry id and the summary that covers them. The second prices that summary against its originals. The third reads the stored text and answers from it. Recall tools documents the parameters.
Where next
How it works
The three regimes, the recursive DAG, and what a pointer guarantees.
The engine and its adapters
Which part belongs to lossless-core, and which part each adapter supplies.
Configuration
The keys and the threshold vocabularies.
Troubleshooting
What to run when swaps do not happen, or the diagnostics disagree with the host.
Comparison
The audited peer pages for this adapter.
Recall tools
Every parameter and the bounds each path enforces.