Feature: Configurable compaction threshold and model (global + per-model) #8411

Open
opened 2026-02-16 18:09:54 -05:00 by yindo · 1 comment
Owner

Originally created by @tobiastornros on GitHub (Feb 3, 2026).

Originally assigned to: @thdxr on GitHub.

Add configurable compaction settings at both global and per-model levels:

  • Threshold: Trigger compaction at a percentage of context usage (not just at 100%)
  • Model: Use a different (cheaper/faster) model for compaction

Motivation

  1. Different models degrade at different context levels - Claude Opus quality drops around 50-60% context, while other models may handle more. Users should be able to tune this per-model.

  2. Compaction can use cheaper models - The compaction summary doesn't need the most expensive model. Users (especially Copilot users) want to use a cheaper model for compaction to save quota/costs.

Proposed Solution

Global config

{
  "compaction": {
    "auto": true,
    "prune": true,
    "threshold": 80,
    "model": "anthropic/claude-haiku-3-5-20241022"
  }
}

Per-model config

{
  "provider": {
    "anthropic": {
      "models": {
        "claude-opus-4-20250514": {
          "compaction_threshold": 50,
          "compaction_model": "zhipu/glm-4-plus"
        }
      }
    }
  }
}

Priority hierarchy

  1. Per-model compaction_threshold / compaction_model (highest)
  2. Global compaction.threshold / compaction.model
  3. Default: 100% threshold, same model as session

Related Issues

  • #11314 - Configurable Context Compaction Threshold
  • #8140 - Configurable context limit and auto-compaction threshold
  • #10017 - Custom compaction threshold to trigger earlier
  • #8629 - Model settings for automatic compaction (use cheaper model)
Originally created by @tobiastornros on GitHub (Feb 3, 2026). Originally assigned to: @thdxr on GitHub. Add configurable compaction settings at both global and per-model levels: - **Threshold**: Trigger compaction at a percentage of context usage (not just at 100%) - **Model**: Use a different (cheaper/faster) model for compaction ## Motivation 1. **Different models degrade at different context levels** - Claude Opus quality drops around 50-60% context, while other models may handle more. Users should be able to tune this per-model. 2. **Compaction can use cheaper models** - The compaction summary doesn't need the most expensive model. Users (especially Copilot users) want to use a cheaper model for compaction to save quota/costs. ## Proposed Solution ### Global config ```json { "compaction": { "auto": true, "prune": true, "threshold": 80, "model": "anthropic/claude-haiku-3-5-20241022" } } ``` ### Per-model config ```json { "provider": { "anthropic": { "models": { "claude-opus-4-20250514": { "compaction_threshold": 50, "compaction_model": "zhipu/glm-4-plus" } } } } } ``` ### Priority hierarchy 1. Per-model `compaction_threshold` / `compaction_model` (highest) 2. Global `compaction.threshold` / `compaction.model` 3. Default: 100% threshold, same model as session ## Related Issues - #11314 - Configurable Context Compaction Threshold - #8140 - Configurable context limit and auto-compaction threshold - #10017 - Custom compaction threshold to trigger earlier - #8629 - Model settings for automatic compaction (use cheaper model)
Author
Owner

@github-actions[bot] commented on GitHub (Feb 3, 2026):

This issue consolidates several related feature requests about compaction configuration. The issues listed are highly relevant and should be reviewed:

  • #11314: Configurable Context Compaction Threshold - Requests exposing threshold as user-configurable setting (currently hardcoded at 75%)
  • #8140: Configurable context limit and auto-compaction threshold - Proposes both threshold percentage and maxContext options
  • #10017: Custom compaction threshold to trigger earlier - Focuses on absolute token threshold (e.g., 50K tokens) to trigger compaction
  • #8629: Model settings for automatic compaction - Requests ability to use a cheaper model for compaction

This current issue (#11930) appears to be a comprehensive feature proposal that builds upon and consolidates these requests. It may be worth reviewing whether to close the older issues as duplicates of this one once it's implemented, or keeping them open for discussion if they represent specific use cases.

@github-actions[bot] commented on GitHub (Feb 3, 2026): This issue consolidates several related feature requests about compaction configuration. The issues listed are highly relevant and should be reviewed: - #11314: Configurable Context Compaction Threshold - Requests exposing threshold as user-configurable setting (currently hardcoded at 75%) - #8140: Configurable context limit and auto-compaction threshold - Proposes both threshold percentage and maxContext options - #10017: Custom compaction threshold to trigger earlier - Focuses on absolute token threshold (e.g., 50K tokens) to trigger compaction - #8629: Model settings for automatic compaction - Requests ability to use a cheaper model for compaction This current issue (#11930) appears to be a comprehensive feature proposal that builds upon and consolidates these requests. It may be worth reviewing whether to close the older issues as duplicates of this one once it's implemented, or keeping them open for discussion if they represent specific use cases.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8411