feat: Switch compaction model from session model#15525
Open
ryanwyler wants to merge 1 commit intoanomalyco:devfrom
Open
feat: Switch compaction model from session model#15525ryanwyler wants to merge 1 commit intoanomalyco:devfrom
ryanwyler wants to merge 1 commit intoanomalyco:devfrom
Conversation
Adds a dedicated compaction model selector so users can run one model
for chat and a different model for summarization (e.g. Claude Sonnet for
interactive coding, Zen Big Pickle free tier for zero-cost compaction).
Model resolution priority: TUI selection > agent.compaction.model config
> session model. When no TUI selection is set, behavior is identical to
upstream.
Changes:
- DialogModel gains target="compaction" prop — no duplicate component
- SessionCompaction.process() accepts optional compactionModel override
- CompactionPart schema extended with optional compactionModel field
- compaction_model_list keybind added (default: none)
- /compaction-models slash command and command menu entry
- local.model.compaction context backed by kv.signal('compaction_model')
- Prompt footer shows active compaction model when set
- SDK regenerated via ./script/generate.ts
00b3b7d to
80b6e35
Compare
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #13946
Closes #12135
Related: #14368, #14259, #14233
Type of change
What does this PR do?
Adds a dedicated compaction model selector so users can run one model for chat and a different model for summarization. Run Claude Sonnet or Opus 4.6 for interactive coding while compacting with Zen Big Pickle (free) to eliminate compaction cost entirely, or GPT-5.3 Codex (400k context) for detail-oriented summaries that capture nuance your session model would lose — with headroom to compact sessions that have already exceeded their primary model's context limit.
For best results use this enhanced compaction prompt: #14662
Why not just use
agent.compaction.modelin config?The existing
agent.compaction.modelconfig option is static — it requires editingopencode.jsonand is fixed for the lifetime of the config. This PR adds runtime switching without touching config files, matching how the primary model switcher works:Both approaches coexist. Model resolution priority: TUI selection > config file (
agent.compaction.model) > session model. When no TUI selection is made, the config-based approach works exactly as before. Nothing is broken.Features:
/compaction-modelsslash command and "Switch compaction model" in the command menukv.signalinkv.json, matching how all other TUI settings are persistedChanges:
DialogModelacceptstarget="compaction"prop — no duplicate componentSessionCompaction.process()accepts and resolves the override modelCompactionPartschema extended with optionalcompactionModelfieldcompaction_model_listkeybind added (default: none)./script/generate.tsHow did you verify your code works?
Tested with Claude Sonnet 4.5 (chat) + GPT-5.3 Codex (compaction). Confirmed correct model at each pipeline stage via log entries. Compaction completed successfully, session resumed on the original model. Also tested auto-compaction with no override set to verify identical upstream behavior. Verified that existing
agent.compaction.modelconfig continues to work when no TUI override is set.Checklist