Skip to content

Feature: Configurable model for compaction summarization #6571

Description

@USSU123

Problem

Compaction currently uses the current session model for summarization. When running Opus (200K context), sessions can grow very large. When compaction triggers, the summarizer itself can hit context limits trying to summarize the huge session, resulting in 'Summary unavailable due to context limits'.

This is expensive (Opus for summarization) and can fail with very large sessions.

Proposed Solution

Add agents.defaults.compaction.model config option to specify a different model for compaction summarization.

Example:

{
  agents: {
    defaults: {
      compaction: {
        mode: "safeguard",
        model: "anthropic/claude-haiku-4-5",  // NEW: cheaper, faster summarization
        reserveTokensFloor: 60000,
        memoryFlush: { ... }
      }
    }
  }
}

Benefits

  1. Cost savings - Haiku is much cheaper than Opus for summarization
  2. Reliability - Smaller model with same context can handle the summary without hitting limits
  3. Speed - Faster compaction cycles

Current Workarounds

  • Increased reserveTokensFloor to trigger compaction earlier (more headroom)
  • Improved memoryFlush to save state before compaction (recovery if summary fails)

These help but don't solve the root issue.

Additional Context

Discovered this while debugging repeated 'Summary unavailable' failures on long Opus sessions. The summarizer needs to process large transcripts and can itself hit model context limits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions