Five opt-in capabilities that strengthen the core promise: measurable, query-aware, recoverable, structure-preserving compression. Every addition is backward-compatible. Default output is byte-identical to v0.11.1 unless a feature is explicitly enabled.
Added
- Session token-savings telemetry. The registry now derives savings from each tool's
originalTokens/optimizedTokensand feeds a process-scoped session accumulator, fixing the long-standingtokensSaved = 0hardcode. SetDISTILL_SAVINGS_STATS=1to append a compact savings line (per call + session total) to tool output. - JSON/YAML structural skeletons in
smart_file_read. Config files (package.json,tsconfig, k8s manifests, OpenAPI specs) now return a key-outline skeleton instead of a full-file dump: nativeJSON.parsefor a typed tree, an indent-based walk for YAML, no new dependency. Explicitmode: "full"still returns the raw file. - Query-aware semantic compression.
auto_optimizeaccepts an optionaltaskparam. When set, the semantic compressor lifts segments covering more task terms in its selection ranking, so task-relevant context survives compression. With notask, behavior is unchanged. - Opt-in reversibility (
ctx.restore). A bounded in-memory origin store (process-scoped, no disk state) keeps pre-compression originals keyed by a content-derived handle. WithDISTILL_RETRIEVE=1,auto_optimizeemits the handle andcode_executeexposesctx.restore(handle)to recover the original when a lossy pass dropped something the agent needs. - Constraint preservation in conversation compaction.
ctx.conversation.compressnow extracts binding constraints (must,never,do not,always,required) and pins them verbatim in a[Preserved constraints]block, so lossy summarization can no longer silently drop a rule the downstream model still has to obey.
Fixed
ToolResult.tokensSavedis now populated instead of always 0, re-enabling the verbosesaved:diagnostic line.
Full changelog: https://github.com/ArthurDEV44/distill/blob/main/CHANGELOG.md