Pi extension · SQLite + FTS5 · MIT
Nothing is lost.The model sees less.
Aged turns become summary pointers the model can navigate. Every message behind them stays in a local store, searchable and readable in full.
pi install npm:pi-lossless- default swap point
- 70%
- default recent budget
- 20k
- recall tools
- 3
- tool call to read an original
- 1
THE PROJECTION
What the model sees, and what it can still read.
Two layers, one session. The window is what the model pays for on every turn; the store is what it can still reach.
context · what the model receives
20k tokens recent · 3 pointers
summary 07 · 8 children
expand
summary 08 · 4 children
expand
summary 09 · 2 children
expand
swap point · 70%
every line below the swap point is byte for byte what was typed
on disk · the store
every message · FTS5 indexed
oldest
now
HOW IT WORKS
Four moves, one store.
The first three steps run without the model asking. The fourth is a tool call the model makes.
01
Log
Every turn is written to SQLite behind a full-text index. Below the swap point the model still sees the conversation itself.
02
Swap
Past the swap point the aged head becomes one summary pointer. Nothing else in the context moves.
03
Condense
Deeper passes fold the frontier into a DAG, up to 8 children per node. Every node expands back to the messages under it.
04
Recall
The model greps, describes, and reads the originals by address, and only the read leaves the main loop.
depth 2 · frontier
depth 1
depth 0 · leaves
ZONES
A soft point, not the hard limit.
Model quality falls off before the context window is full. LCM swaps on a token budget you set, and stays quiet below it.
0 to 70%
Quiet
The projection is the conversation itself, so a provider's cached prefix stays valid turn after turn.
70 to 85%
Swapped
Swaps append a pointer and leave the rest of the context byte for byte.
85% to the window
Recut
One re-cut replaces the previous shape, and the frontier folds a depth at a time.
WHEN IT RUNS
RECALL
Reading an original costs one tool call.
Searching and inspecting run in the main loop. The read goes to a bounded reader, so a 200,000-character message can be read without the text entering the conversation.
lcm_grep
Search the archive
Keyword or pattern search across every stored message and summary. The model asks a question and gets the message addresses that match.
lcm_grep({ query: "swap point" })lcm_describe
Inspect a summary
Kind, depth, covered span, and the cost of expanding it. The model gets this without pulling the original text into the loop.
lcm_describe({ id: 12 })lcm_expand_query
Read the originals
Expands the stored messages and answers from them, so the history is available without being replayed in full.
lcm_expand_query({ prompt, id })INSTALL
One extension, or one engine.
The extension is what a Pi user installs. The engine is what another harness drives, behind two ports and no agent SDK.
pi-lossless
The Pi extension
The recall tools, the cockpit and the commands, with the engine inlined so the installed package stays a single artifact.
- lcm_grep · lcm_describe · lcm_expand_query
- Cockpit and slash commands
- Escalated compaction at the limit
pi install npm:pi-losslesslossless-core
The engine
Ingest, compaction and retrieval behind a two-port host contract. A harness implements ModelHost and Reader, and names no agent SDK.
- Verbatim ingest with FTS5
- Summary pointers and a DAG frontier
- Escalated summaries that converge
npm install lossless-coreInstall it, then leave it alone.
Every session after that one is logged, searchable, and rebuildable from the session file.
pi install npm:pi-lossless