Skip to content

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

Description

@tobiastornros

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

Activity

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