Skip to main content

Module dedup

Module dedup 

Source
Expand description

Request-local, lossless deduplication of repeated tool output.

Invariant (#1980): a tool output is only ever replaced by text from which the model can reconstruct it within the same request — a reference to an earlier tool result that is still present verbatim, plus, for a near duplicate, the changed lines verbatim. Nothing is remembered across requests: the model is stateless, so a reference to content it saw in an earlier request points at nothing. References use the earlier result’s tool-call id; outputs without one are never referenced.

Under protection (compress::protected()) only the exact reference is written: the identical block stays in place before it, so nothing is shortened. A line delta is a shortening without a recovery copy; the near duplicate stays whole and is counted with recovery.dedup_without_copy.

Structs§

DedupStats
Savings produced while deduplicating one request.

Functions§

dedup_tool_outputs
Replace repeated, non-recent tool outputs in messages with references to an earlier, verbatim tool result in the same slice.