Files
deepseek-harness/packages/compact
Tianyi Cui 8590ba00a4 Merge remote-tracking branch 'origin/master' into codex/trim-ai-prose
# Conflicts:
#	docs/AGENTS.md
#	docs/config-catalog.md
#	packages/bash/bash-sandbox/src/index.ts
#	packages/bash/bash/src/session-mode.ts
#	packages/bash/tool-bash/README.md
#	packages/code-runtime/code-runtime-worker/README.md
#	packages/compact/compact/src/index.ts
#	packages/core/agent-core/README.md
#	packages/hooks/hooks-claude/src/config.ts
#	packages/hooks/hooks-claude/src/index.ts
#	packages/hooks/hooks-codex/src/config.ts
#	packages/hooks/hooks-codex/src/index.ts
#	packages/llm/llm/README.md
#	packages/session-persistence/session-persistence-jsonl/README.md
#	packages/session-persistence/session-persistence/README.md
#	packages/skill/skill-local/README.md
#	packages/support/acp-snapshot/README.md
#	packages/support/invariants/src/index.ts
#	packages/ui/acp/README.md
#	packages/ui/jsonrpc-agent/README.md
#	packages/ui/jsonrpc/README.md
#	packages/ui/permission/README.md
#	packages/ui/user-approval/README.md
#	packages/ui/user-interaction/README.md
#	packages/web/web-search-deepseek/README.md
2026-07-14 14:37:16 +08:00
..

compact/ — compaction capability family

A three-package capability seam (see capability seams): an abstract compaction interface, a backend that summarizes, and the model-facing tool that consumes it. The interface and a first backend (compact-basic/) exist; the consumer tool is deferred. All product packages.

Package Role ctx key
compact/ Abstract compaction seam (interface + compact/* events + CompactionResult) ctx.compact
compact-basic/ A backend: chars-per-token estimation (charsPerToken, default 4) + token-budget retention + llm.stream() summarization (registers ctx.compact)
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/. Unlike the bash seam, it depends on dsh-session and dsh-llm — its verbs are defined over a Session and its output is the ContentBlock vocabulary, so the contract cannot be expressed without naming them. That deviation from the "interface depends only on cordis" guidance is intentional and recorded in the compaction capability-seam RFC. A tokenizer- or template-based backend would replace compact-basic without touching the interface or the tool.