Files
deepseek-harness/packages/compaction
_KermanandTianyi Cui f4a32dbd0a refactor(llm): flatten tool results and validate native V4 sessions
Represent tool results as tool-role messages and migrate released wrappers
without losing outer own JSON fields, call identity, error state, or writer
field order. Refuse nested or wrapper-only information that has no lossless
current representation before successor publication.

Validate current event relationships directly instead of projecting V4 data
back into V3. Keep lifecycle, PTC, title/command, compaction, system-field and
retired-syntax checks on catalog restoration and ordinary JSONL opens. The
Worker JSON equality helper must inspect own keys so it cannot admit PTC
arguments that Node rejects.

Keep the source role change, required native admission and consumer fixture
updates in one complete review layer. Explain shared-type changes in the
persistence record and the native reader rationale in its existing note.
Use checked branded fixture identities and discriminant narrowing instead
of unknown double casts; fixture values and assertions remain intact.

This recomposes the original tool-role work by _Kerman with the independently
validated migration and admission repairs by Tianyi Cui. Frozen generations
and snapshot input version selection are retained.

Co-authored-by: Tianyi Cui <[email protected]>
2026-09-18 19:05:32 +08:00
..
2026-09-17 21:11:19 +08:00
2026-09-10 13:48:38 +08:00

description, kind
description kind
Package map for the conversation-condensing feature family: automatic compaction, the on-demand /compact command, and tool-output trimming. package-group

compaction/ — compaction capability family

English | 中文

Summary

The compaction/ group keeps long agent conversations working near the model's context limit: older history is condensed into a summary automatically as token pressure builds, on demand with /compact, oversized tool outputs can be trimmed first so there is less to condense, and images an image-capable route can no longer send are replaced with placeholders. The shipped dsh base enables the feature by default — mount the packages explicitly to tune when and how condensation happens. The token measurement that decides when to condense lives in a separate LLM-family service.

Table of Contents


Packages

Each package below provides one piece of the feature; open a package page for how to use it.

Package Role ctx key
compaction/ The shared condensation contract: the operations and summary format every backend and trigger use ctx.compaction
compaction-basic/ Automatic condensation of older history into a summary as token pressure builds registers ctx.compaction
compaction-tool-result-pruner/ Trims oversized tool outputs so less history needs condensing ctx.toolResultPruner
compaction-image-offload/ Replaces over-budget request images with placeholders when an image-capable route rejects a request listens to agent/request-error
command-compact/ The /compact command to condense history on demand registers on ctx.commands

Start with the subsystem reference for the shared vocabulary, then read the two Agent Notes for the design rationale.

Dev Note

Working context for maintainers — click to expand

None.