← Back to PRs

#15927: feat: add compaction.model override config option

by Shuai-DaiDai open 2026-02-14 02:23 View on GitHub →
channel: discord channel: imessage channel: signal gateway agents stale size: M
## Problem Compaction currently uses the session's primary model. For users running an expensive primary model (e.g., Claude Opus) for conversation quality, compaction is a mechanical summarization task that doesn't need the same level of intelligence (#15826). ## Solution Allow configuring a separate model for conversation compaction via `agents.defaults.compaction.model` (and per-agent overrides). ## Changes - **Config**: Add `model?: string` to `AgentCompactionConfig` type - **Command**: Apply override in manual `/compact` command handler - **Auto-compaction**: Apply override in context overflow auto-compaction ## Usage ```json { "agents": { "defaults": { "compaction": { "model": "anthropic/claude-sonnet-4" } } } } ``` Supports full model refs (`provider/model`) or just model IDs. Same pattern as `heartbeat.model` and `subagents.model`. Fixes #15826 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Adds `agents.defaults.compaction.model` config option to allow using a cheaper model for compaction while keeping an expensive primary model for conversation quality. The implementation correctly: - Added the `model?: string` field to `AgentCompactionConfig` type - Implemented resolution logic that checks per-agent config before falling back to defaults - Applied the override in both manual `/compact` command and auto-compaction on context overflow - Followed the same pattern as existing `heartbeat.model` and `subagents.model` configs The changes are functionally correct and support both full model refs (`provider/model`) and bare model IDs. Two helper functions (`splitModelRef` and `resolveCompactionModelOverride`) are duplicated across files and could be consolidated into a shared utility module to reduce maintenance burden. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge with minimal risk - The implementation is straightforward, follows established patterns in the codebase (heartbeat.model and subagents.model), and correctly applies the override in both manual and auto-compaction scenarios. The only minor concern is code duplication of helper functions across two files, which is a style issue rather than a functional problem. - No files require special attention <sub>Last reviewed commit: 7fdad2e</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs