Repository navigation
Replies: 4 comments
|
+1 from a plugin that has to live with the blind spot this proposes to close. One clarification though: a pre/post hook alone does not make compaction observable, and those two needs pull in different places. What I measured locally (runtime 0.1.5-rc.2, master tip 0010283, 2026-09-22T15:25Z):
Two asks, one of which is not a hook:
If both land they answer different questions: the hook says "let me react before the checkpoint mutates the surface", the counter says "was there anything to react to at all". Today the first is missing a seam; the second is missing entirely. Criterion anyone can re-check before assuming the counter already exists: No match at tip 0010283, while the same file already folds turns and steps. A hook would not change that reading; a counter on that projection would. |
|
Disclosure: I maintain dsh-memory-plus. Two of its choices may be useful concrete examples for this proposal. For standing facts, For summary provenance, Neither mechanism supplies the generic pre-reduction / remeasure / deterministic reducer-composition seam you request, or the failure-outcome contract raised above. The locator's subclass hook is a narrower integration point. The implementation may nevertheless be useful as a real consumer example when separating stable standing state, conversational history and source-recovery metadata in the proposed API. |
|
+1, with a concrete use case from a fleet running four DSH instances (0.1.7-alpha.2) with our own plugin suite. What we need the seam for
What we patch today (both would retire with this seam):
Shape that would cover us: |
|
Another use case from Aurabot's memory integration. A memory provider manages the context of bot-owned sessions. A regular DSH session, including a manually created session in the same workspace, should continue to use the normal request and compaction flow. The provider needs a replayable way to replace its previous recall and condense complete older turns before a request, while preserving the current input and tool call/result pairs. It also needs to correlate terminal usage with the request and invalidate its registration when a session is retired, including during retries. For input admission we found the A small acceptance test would replay two synthetic sessions in one workspace. Only the registered session should replace its older turns, with no orphaned tool results. A cancelled or retired registration should leave the next request untouched. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
It would be useful to expose an explicit integration point before summary compaction mutates the session surface, and possibly a corresponding post-compaction hook.
The main use case is plugins that inject or otherwise own model-visible context: memory systems, workspace instructions, retrieved context, long-lived reminders, or similar components. Such plugins often know more about the semantics of their own artifacts than the generic summarizer does, and may want to deterministically reduce, replace, remove, or re-materialize those artifacts around compaction.
Motivation
Today
compaction-basicalready performs one specialized model-free reduction before summarization:toolResultPruner.pruneSession()runs before the compactable range is selected and the surface is summarized.Other plugins can have the same need.
For example, consider a memory plugin that has injected several progressively superseded memory snapshots into the conversation. Before generic summarization, it may be preferable to:
The same applies to workspace instructions and other context-injection-producing plugins.
The important point is that the plugin that produced an artifact often knows whether that artifact is:
A generic summarizer cannot reliably infer those semantics from message text.
Why
compaction/start/compaction/endare not sufficientThe durable
compaction/*events are useful for observation and replay, but they are not currently suitable as mutation hooks for this purpose.session/eventis post-commit, and compaction has already entered its transaction by the timecompaction/startis observed. Mutating the surface asynchronously from such a listener can also invalidate the stability assumptions of the in-progress compaction.Conversely,
compaction/endis too late to affect the input that was already sent to the summarizer.What is missing is an integration point owned by the compaction pipeline itself.
Possible direction
One option would be a generic pre-compaction reduction seam, conceptually something like:
The exact API could be a service registry, waterfall hook, reducer collection, or another Cordis-native mechanism. The important properties seem to be:
toolResultPrunercould eventually become one consumer of such a mechanism rather than a special case hard-coded intocompaction-basic.A post-compaction integration point could also be useful for plugins that intentionally remove derived context before summarization and want to re-materialize the current canonical state afterward.
Broader rationale
Compaction is not only about making arbitrary conversation text shorter. In an extensible agent harness, part of the model-visible context is often generated by plugins and represents structured state.
Memory systems in particular are likely to accumulate context whose lifecycle is different from ordinary conversation history. The same is true for retrieved context, workspace instructions, plans, runtime context, and other injected artifacts.
Giving their owning plugins a controlled place in the compaction pipeline would allow them to preserve their own semantics while leaving generic summarization responsible for actual conversational history.
All reactions