Skip to content

Use native OpenCode compaction lifecycle - #70

Open
ishaanxgupta wants to merge 4 commits into
mainfrom
codex/fix-native-compaction
Open

Use native OpenCode compaction lifecycle#70
ishaanxgupta wants to merge 4 commits into
mainfrom
codex/fix-native-compaction

Conversation

@ishaanxgupta

@ishaanxgupta ishaanxgupta commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace Supermemory's independent token-threshold → session.summarize → synthetic Continue flow with OpenCode's experimental.session.compacting hook
  • keep project-memory injection and post-compaction summary capture while bounding injected memory context
  • add compactionEnabled and preserve compactionThreshold: 0 / false as legacy disable values
  • stop the installer from disabling Oh My OpenCode's recovery hook now that Supermemory no longer owns the compaction trigger
  • add focused coverage for stale summaries, transient failures, failed compactions, bounded context, and disable semantics

Root cause

The plugin independently calculated context usage from the session model, invoked summarization, and sent a delayed continuation resolved from the newest stored message. OpenCode can run summarization with a separately configured compaction agent/model, so the plugin could trigger against the wrong context limit, select the compaction agent for the continuation, and race OpenCode's own auto-compaction.

User impact

OpenCode now owns the trigger, compaction-model selection, and continuation. This prevents Supermemory from double-triggering compaction or leaving a session on the compaction agent. Supermemory only contributes bounded context to the native summary and captures the completed summary afterward.

Memory lookup or storage failures do not fail native compaction. Failed/overflowed compaction output is not saved as durable memory, and transient summary-storage failures retry on the next compacted/idle event.

@ishaanxgupta ishaanxgupta changed the title [codex] Use native OpenCode compaction lifecycle Use native OpenCode compaction lifecycle Aug 12, 2026
@ishaanxgupta
ishaanxgupta marked this pull request as ready for review August 12, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant