[BUG] opusplan mode overrides subagent model frontmatter, ignoring agent config
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
opusplan mode overrides custom subagent model value in frontmatter — so a custom Explore agent always runs on Opus regardless of the custom agent config. Also confirmed it was actually using the custom agent definition, so only the model was changed. (It did not use the standard Explore agent that defaults to main session model)
What Should Happen?
Custom agents (Explore) should run on the model defined in frontmatter regardless of main-conversation model/mode
Error Messages/Logs
Steps to Reproduce
- Define ~/.claude/agents/Explore.md (override) with model: haiku.
- Set main model to opusplan, invoke a task that spawns Explore.
- Compare the Explore task's own JSONL transcript (referenced task output under /tmp/claude-/.../tasks/.output) — all turns show claude-opus-5, not haiku.
- Repeat with main model set to plain opus (manual plan-mode toggle) — Explore correctly runs on Haiku.
Custom subagent frontmatter:
---
name: Explore
description: Read-only search & exploration agent
model: haiku
tools: Bash, Read
---
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.266
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- With main model set to plain opus (plan mode toggled manually via Shift+Tab//plan instead of the opusplan alias): Explore runs on Haiku as expected. ✅ (task transcripts all show claude-haiku-4-5-20251001)
- With main model set to opusplan: the identical Explore frontmatter override is silently ignored — Explore runs on claude-opus-5 every time. ❌ (task transcripts both 100% claude-opus-5, zero haiku turns)
- /tasks UI is also misleading in this failure mode: it reported "Haiku" for the Explore row even though the subagent's own transcript proves every API call went to Opus.
Impact: No way to pin subagent models when using opusplan, since it appears to force Opus onto all subagents regardless of their own frontmatter.
Additional context: A PreToolUse hook on the Agent tool that rewrites updatedInput.model for subagent_type == "Explore" was also attempted but logging indicated the main session was not passing in a model override. According to the docs if the invocation doesn't specify, it should use the subagent's model frontmatter.
{
"tool_name": "Agent",
"tool_input": {
"subagent_type": "Explore",
"model": null
}
}
Related to https://github.com/anthropics/claude-code/issues/67942 - but that one appears to have closed when the Explore agent default changed, it was not fixed.