[PR #11467] feat: configurable context compaction threshold #13802

Closed
opened 2026-02-16 18:18:38 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11467

State: closed
Merged: No


Summary

Implements configurable context compaction threshold as requested in #11314.

Changes

  • Added compaction configuration schema to opencode.json with threshold, strategy, preserveRecentMessages, preserveSystemPrompt.
  • Added support for per-model compaction configuration overrides.
  • Updated SessionCompaction.isOverflow to respect the configured threshold (global or model-specific).
  • Added unit tests for threshold logic.

Configuration Example

{
  "compaction": {
    "threshold": 0.40
  },
  "provider": {
    "google": {
      "models": {
        "gemini-1.5-pro": {
          "compaction": {
            "threshold": 0.30
          }
        }
      }
    }
  }
}

Fixes #11314

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11467 **State:** closed **Merged:** No --- ## Summary Implements configurable context compaction threshold as requested in #11314. ### Changes - Added `compaction` configuration schema to `opencode.json` with `threshold`, `strategy`, `preserveRecentMessages`, `preserveSystemPrompt`. - Added support for per-model compaction configuration overrides. - Updated `SessionCompaction.isOverflow` to respect the configured threshold (global or model-specific). - Added unit tests for threshold logic. ### Configuration Example ```json { "compaction": { "threshold": 0.40 }, "provider": { "google": { "models": { "gemini-1.5-pro": { "compaction": { "threshold": 0.30 } } } } } } ``` Fixes #11314
yindo added the pull-request label 2026-02-16 18:18:38 -05:00
yindo closed this issue 2026-02-16 18:18:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13802