Problem Summary
DCP performs context compression independently of OpenCode's native compaction system. While this is generally a good thing, it breaks the workflow for users who rely on other plugins that hook into experimental.session.compacting — specifically, memory/persistence plugins like Engram that need to save a checkpoint when the context is compressed.
Currently, DCP:
- Does not fire OpenCode's
experimental.session.compacting hook
- Does not expose any event/hook that other plugins can listen to
- Injects system messages about pruning, but these are not a reliable API for other plugins
Impact
When DCP compresses the conversation, memory plugins have no reliable way to know that a compression occurred. This means:
- Session summaries are not persisted to long-term memory
- The model loses track of what was accomplished before compression
- After compression, the model may hallucinate old tasks or forget the current active task
Reproduction Steps
- Install DCP and a memory plugin (e.g., Engram) that uses
experimental.session.compacting to persist session checkpoints.
- Have a long conversation that triggers DCP compression.
- Observe that the memory plugin never fires — no checkpoint is saved.
- After compression, the model loses context of prior work.
Expected Behavior
DCP should provide a mechanism for other plugins to be notified when compression occurs, so they can persist state or inject recovery context.
Possible Solutions
Option A: Fire OpenCode's experimental.session.compacting hook
When DCP compresses, trigger the same hook that OpenCode's native compaction uses. This would be the most compatible approach.
Option B: Expose a DCP-specific event/hook
Add a new hook like experimental.dcp.compressing or similar that plugins can register. Pass metadata like:
beforeTokens, afterTokens
summaryText
compressedRange
Option C: Standardized system message format
If hooks are not possible, document a stable system message format that DCP injects when compressing, so other plugins can parse it reliably.
Additional Context
Protected tools mismatch
The Engram tools are named mem_save, mem_search, mem_update, mem_session_summary, etc. .
Environment
- OpenCode version: (1.17.9)
- DCP version: 2.x
- Model context: 256K tokens
- Memory plugin: Engram (custom plugin using
experimental.session.compacting)
Would love to hear if this is on the roadmap or if there's a recommended workaround. Happy to test any PR or beta version.
Problem Summary
DCP performs context compression independently of OpenCode's native compaction system. While this is generally a good thing, it breaks the workflow for users who rely on other plugins that hook into
experimental.session.compacting— specifically, memory/persistence plugins like Engram that need to save a checkpoint when the context is compressed.Currently, DCP:
experimental.session.compactinghookImpact
When DCP compresses the conversation, memory plugins have no reliable way to know that a compression occurred. This means:
Reproduction Steps
experimental.session.compactingto persist session checkpoints.Expected Behavior
DCP should provide a mechanism for other plugins to be notified when compression occurs, so they can persist state or inject recovery context.
Possible Solutions
Option A: Fire OpenCode's
experimental.session.compactinghookWhen DCP compresses, trigger the same hook that OpenCode's native compaction uses. This would be the most compatible approach.
Option B: Expose a DCP-specific event/hook
Add a new hook like
experimental.dcp.compressingor similar that plugins can register. Pass metadata like:beforeTokens,afterTokenssummaryTextcompressedRangeOption C: Standardized system message format
If hooks are not possible, document a stable system message format that DCP injects when compressing, so other plugins can parse it reliably.
Additional Context
Protected tools mismatch
The Engram tools are named
mem_save,mem_search,mem_update,mem_session_summary, etc. .Environment
experimental.session.compacting)Would love to hear if this is on the roadmap or if there's a recommended workaround. Happy to test any PR or beta version.