Technique 03 / 07
Lossless context pruning
Replace stale transcript detail with an anchored work summary while retaining recent turns verbatim.
Interactive model
See the context change.
Compare a growing transcript with the context handed to the next turn.
State survives, repetition leaves
- 01
Objective and constraints
- 02
Decisions that still apply
- 03
Exact file and work state
- 04
Blockers and next move
- 05
Recent turns kept directly
Conceptual demonstration. Counts illustrate the flow, not measured production savings.
How it works
Less context. Same thread of work.
Long transcripts contain useful state mixed with repeated reasoning, superseded plans, and bulky tool output. DistilCode separates an older head from a recent tail, summarises the head into a fixed work-oriented structure, and keeps a configurable recent-token budget available for the newest turns.
Here, “lossless” means preserving the actionable facts needed to continue: the objective, constraints, decisions, completed and active work, blockers, exact identifiers, and relevant file state. It does not mean byte-for-byte preservation of every prior message. Recent context and protected operational tool results remain available while older tool text can be cleared after compaction.
In practice
The operating loop
- 01
Protect recent work
A bounded recent tail stays in context so the immediate exchange is not reduced to a summary.
- 02
Anchor the hand-off
The summary schema explicitly captures objectives, important details, work state, next moves, and relevant files.
- 03
Retire stale bulk
Old tool output is truncated during summarisation and can be cleared after a successful compaction.
