Skip to content

[FEATURE]: Extend "experimental.session.compacting" Output to Allow Skipping Internal Logic #27366

Closed as not planned

Description

@FullStackPlayer

Feature hasn't been suggested before.

  • 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.

experimental.session.compacting

Parameters:

  • input: { sessionID: string }
  • output: { context: string[]; prompt?: string; skip?: boolean; }

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.

Activity

  1. github-actions commented on May 13, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your use case is distinct from these, feel free to clarify how it differs.

  2. github-actions commented on Jul 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions