opencode
opencode copied to clipboard
feat: Support default variant configuration per agent
Summary
Allow users to configure a default variant for each agent, so models with thinking/reasoning variants automatically use the configured level without requiring --variant flag or ctrl+t cycling.
Motivation
Currently, users can only select variants via:
-
--variant highCLI flag -
ctrl+tkeybind to cycle variants in TUI
This means:
- Users must manually select variants every time
- Subagents cannot use variants at all (Task tool doesn't pass variant)
- Users cannot set different thinking levels for different agents (e.g., oracle with high thinking, explore with low)
Related: NoeFabris/opencode-antigravity-auth#125
Proposed Solution
Add a variant field to the agent configuration:
{
"agent": {
"build": {
"model": "google/antigravity-claude-sonnet-4-5-thinking",
"variant": "high"
},
"explore": {
"model": "google/antigravity-gemini-3-flash",
"variant": "low"
}
}
}
Variant Priority Order
- Explicit user selection (
--variantflag orctrl+t) - Agent's configured default variant
- None (model's base behavior)
Subagent Behavior
Subagents use their own configured agent.variant rather than inheriting the parent's --variant override. This respects explicit per-agent configuration.
Implementation
- [x] Add
variantfield toConfig.Agentschema - [x] Add
varianttoAgent.Infotype - [x] Parse variant from config in agent state initialization
- [x] Use
agent.variantas fallback inprompt.ts - [x] Pass
agent.variantto subagent sessions intask.ts - [x] Use fallback logic in
llm.tsvariant resolution
Testing
- Configure agent with
variant: "high" - Verify model uses high variant without
--variantflag - Verify
--variant lowoverrides agent config - Verify subagents use their own variant config