You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Extend "experimental.session.compacting" Output to Allow Skipping Internal Logic #27366
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Version
Current version: 1.14.48
Environment
Pure code logic, environment-agnostic.
Problem Description
Exposing the context compaction hook in OpenCode is a brilliant design choice. It allows us to control the compaction behavior via plugins to ensure minimal information loss. The current state of this hook is as follows:
experimental.session.compacting
Parameters:
input: { sessionID: string }
output: { context: string[]; prompt?: string }
Caller:
There is only one caller at session/compaction.ts:404-408
The Issue
The current problem is that even after we intervene in the context compaction via a plugin, OpenCode still proceeds to execute its internal compaction logic. Ideally, if a plugin has already handled the compaction, the context should be considered optimized. But OpenCode internal logic will unconditionally compress our processed high-quality context again, it may cause the loss of useful information.
Improvement Suggestions
Enrich the Output data structure to allow skipping OpenCode's internal compaction logic.
Use the skip flag to indicate whether the internal compaction process should be bypassed.
Feasibility Assessment
Since this is an experimental hook, the impact of the change is minimal. The proposed change is backward compatible and requires very little code modification, making it highly feasible.
This issue might be a duplicate of existing issues. Please check:
[FEATURE]: experimental.session.pre-compact hook #24993: Requests an experimental.session.pre-compact hook for plugin-controlled context transitions — very similar goal of intercepting/bypassing internal compaction logic
Activity
github-actions commentedon May 13, 2026
This issue might be a duplicate of existing issues. Please check:
experimental.session.pre-compacthook for plugin-controlled context transitions — very similar goal of intercepting/bypassing internal compaction logicIf your use case is distinct from these, feel free to clarify how it differs.
github-actions commentedon Jul 13, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.