claude-code - 💡(How to fix) Fix Subagent model resolution strips [1m] context window suffix [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45169Fetched 2026-04-09 08:11:41
View on GitHub
Comments
3
Participants
2
Timeline
8
Reactions
0
Author
Timeline (top)
labeled ×5commented ×3

When spawning subagents (via the Agent tool or agent teams), the [1m] context window suffix is stripped during model alias resolution. Subagents always get the default ~200k context window, even when the parent session runs with 1M context.

Root Cause

When spawning subagents (via the Agent tool or agent teams), the [1m] context window suffix is stripped during model alias resolution. Subagents always get the default ~200k context window, even when the parent session runs with 1M context.

Code Example

--model claude-opus-4-6

---

--model claude-opus-4-6[1m]

---

opus[1m] → claude-opus-4-6[1m]   (expected)
opus[1m] → claude-opus-4-6        (actual)
RAW_BUFFERClick to expand / collapse

Summary

When spawning subagents (via the Agent tool or agent teams), the [1m] context window suffix is stripped during model alias resolution. Subagents always get the default ~200k context window, even when the parent session runs with 1M context.

Reproduction

  1. Set "model": "opus[1m]" in ~/.claude/settings.json
  2. Parent session correctly runs as claude-opus-4-6[1m] with 1M context
  3. Spawn a subagent via the Agent tool (any type — custom agent, general-purpose, etc.)
  4. The subagent's system prompt shows claude-opus-4-6 (no [1m]) and no context window size is mentioned

Evidence

The subprocess command that spawns the subagent passes:

--model claude-opus-4-6

instead of:

--model claude-opus-4-6[1m]

What we tested

ConfigurationResult
Parent opus[1m], no agent overrideSubagent gets claude-opus-4-6 (no 1M)
Agent frontmatter model: opus[1m]Subagent gets claude-opus-4-6 (no 1M)
Agent tool model: "opus"Subagent gets claude-opus-4-6 (no 1M)

All three approaches produce the same result — the [1m] suffix is dropped.

Expected behavior

The model alias resolution should preserve the [1m] suffix:

opus[1m] → claude-opus-4-6[1m]   (expected)
opus[1m] → claude-opus-4-6        (actual)

Subagents should be able to inherit or be explicitly configured to use the 1M context window, through any of:

  • Inheriting from parent session's model setting
  • model: opus[1m] in agent definition frontmatter
  • model parameter on the Agent tool

Environment

  • Claude Code v2.1.96
  • macOS (Darwin 23.1.0)
  • Model: opus[1m] (parent), claude-opus-4-6 (subagents)

extent analysis

TL;DR

The model alias resolution is stripping the [1m] context window suffix, causing subagents to default to a 200k context window instead of inheriting the 1M context from the parent session.

Guidance

  • Verify that the --model parameter in the subprocess command that spawns the subagent includes the [1m] suffix, as this is where the issue seems to be occurring.
  • Check the model alias resolution logic to ensure it correctly handles the [1m] suffix and preserves it when resolving the model alias.
  • Consider modifying the agent tool or agent teams to explicitly pass the --model parameter with the [1m] suffix to the subagent.
  • Test the agent definition frontmatter and Agent tool model parameter with the [1m] suffix to see if it makes a difference in the subagent's context window size.

Example

No code snippet is provided as the issue seems to be related to the model alias resolution logic, which is not explicitly shown in the issue body.

Notes

The issue seems to be specific to the Claude Code v2.1.96 and the opus[1m] model. The solution may need to be adapted for other versions or models.

Recommendation

Apply a workaround by modifying the agent tool or agent teams to explicitly pass the --model parameter with the [1m] suffix to the subagent, as this seems to be the most direct way to address the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The model alias resolution should preserve the [1m] suffix:

opus[1m] → claude-opus-4-6[1m]   (expected)
opus[1m] → claude-opus-4-6        (actual)

Subagents should be able to inherit or be explicitly configured to use the 1M context window, through any of:

  • Inheriting from parent session's model setting
  • model: opus[1m] in agent definition frontmatter
  • model parameter on the Agent tool

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING