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
- Cost savings - Haiku is much cheaper than Opus for summarization
- Reliability - Smaller model with same context can handle the summary without hitting limits
- 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.
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.modelconfig option to specify a different model for compaction summarization.Example:
Benefits
Current Workarounds
reserveTokensFloorto trigger compaction earlier (more headroom)memoryFlushto 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.