# Conflicts: # apps/cli/README.i18n.yaml # docs/core-data-structures/core.i18n.yaml # docs/core-data-structures/llm-streaming.i18n.yaml # examples/acp-agent/tests/snapshots/cordis-inspect-jsdoc/session.jsonl # packages/client/connection/src/client/fixture.ts # packages/client/connection/src/client/index.ts # packages/client/runtime/README.i18n.yaml # packages/client/runtime/README.md # packages/client/runtime/README.zh.md # packages/client/ui-conversation/README.i18n.yaml # packages/client/ui-conversation/src/client/input/hub.ts # packages/client/ui-conversation/src/client/service.ts # packages/client/ui-conversation/src/client/skeleton/InputBar.tsx # packages/compact/compact-basic/src/summarizer.ts # packages/compact/compact-basic/tests/compact-basic.spec.ts # packages/host/apiproxy/src/api-proxy.ts # packages/host/apiproxy/src/api/rpc.schema.ts # packages/host/apiproxy/src/api/rpc.ts # packages/host/apiproxy/src/api/sessions.ts # packages/host/apiproxy/tests/rpc-schemas.spec.ts # packages/llm/llm-deepseek/tests/serialize.spec.ts # packages/llm/llm-pi-ai/tests/adapter.spec.ts # packages/llm/llm-pi-ai/tests/convert.spec.ts # packages/llm/llm-pi-ai/tests/provider-apis.e2e.ts # packages/llm/token-meter/tests/token-meter.spec.ts # packages/ui/tui/README.i18n.yaml
compact/ — compaction capability family
English | 中文
A compaction capability family (see capability seams): an abstract interface, a summarizing backend, a model-free tool-result pruning companion, and a deferred model-facing consumer. All product packages.
| Package | Role | ctx key |
|---|---|---|
compact/ |
Abstract compaction seam (interface + compact/* events + CompactionResult) |
ctx.compact |
compact-basic/ |
A backend: ctx.tokenMeter pressure + token-budget retention + llm.stream() summarization |
(registers ctx.compact) |
compact-tool-result-prune/ |
Optional model-free head/middle/tail rewriting before summary compaction | ctx.toolResultPrune |
tool-compact/ (deferred) |
Model-facing /compact tool over ctx.compact |
(registers on ctx.tools) |
The interface lives at compact/compact/, the backend at compact/compact-basic/, and deterministic pruning at compact/compact-tool-result-prune/. Unlike the bash seam, the interface depends on dsh-session and dsh-llm because its verbs are defined over a Session and its output uses ContentBlock. That deviation is recorded in the compaction capability-seam Agent Note. Token measurement remains a reusable LLM-family service; a template- or model-backed compactor can replace compact-basic without changing the meter, pruner, or callers.