Address the review bot's five genuinely-new findings on the current code: - disposal now discards any still-pending inbox items before the loop exits, so every enqueued id gets a terminal lifecycle event. - injection (next-step/no-wakeup) validates its payload up front, before opening the idle one-shot turn, honoring 'invalid input throws before any append'; and rejects attached contexts (which belong only to inbox messages) rather than silently dropping them. - agentMessage() freezes the agent/inbox/* payload so a listener cannot mutate the shared correlation object mid-dispatch. - refresh the package READMEs (compact, goal, guard, hook-protocol, plan-mode, time-context, workspace-context) that still referenced the removed context/message event, with the source-based user/message distinction. The up-front injection validation makes two finally branches unreachable (v8-ignored as the turn-enclosure backstop). Adds regression tests for disposal discard, context rejection, up-front validation, and the frozen payload; per-file coverage stays 100%.
compact/ — compaction capability family
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.