[BUG] Agent Teams teammates lose [1m] context window suffix — root cause: tmux spawn hardcodes model without variant
Preflight Checklist
- [x] I have searched existing issues and found related closed issues (#24429, #27038, #27261) but they were closed as NOT_PLANNED without addressing this specific root cause
- [x] I can reproduce this on the latest version of Claude Code
Bug Description
When spawning Agent Teams teammates, the [1m] context window variant suffix is stripped from the --model argument passed to the tmux pane process. This silently downgrades teammates from 1M to 200K context window.
Root Cause (verified via ps -eo pid,args)
The parent session runs as claude-opus-4-6[1m], but when spawning a teammate via tmux, the CLI constructs the command as:
/Users/.../.local/share/claude/versions/2.1.76 \
--agent-id inspect-me@test-team-9 \
--agent-name inspect-me \
--team-name test-team-9 \
--agent-color blue \
--parent-session-id 192a86de-... \
--model claude-opus-4-6 ← [1m] suffix stripped
The --model value is claude-opus-4-6 instead of claude-opus-4-6[1m]. The variant suffix is lost during model resolution before the tmux command is constructed.
Reproduction
# Parent session: claude-opus-4-6[1m]
# Test 1: Subagent (inherits [1m] correctly)
Agent(prompt="Report your model ID")
→ "claude-opus-4-6[1m]" ✅
# Test 2: Teammate (loses [1m])
TeamCreate(team_name="test")
Agent(team_name="test", name="t1", prompt="Report your model ID")
→ "claude-opus-4-6" ❌ (200K instead of 1M)
# Test 3: Subagent spawned FROM a teammate (inherits [1m])
# (teammate spawns Agent() without team_name)
→ "claude-opus-4-6[1m]" ✅
Test 3 is particularly interesting — subagents always inherit [1m] regardless of where they're spawned from, but the teammate itself never gets it.
Impact
- Silent 5x context reduction: Teammates intended for large codebase analysis (research, architecture review, module exploration) are silently limited to 200K instead of 1M
- No workaround: The
modelparameter enum only accepts"sonnet" | "opus" | "haiku"— cannot pass"opus[1m]". Settingmodel: "opus[1m]"in settings.json also does not propagate to teammates - Cost without benefit: Users paying for 1M context don't get it on teammates
Suggested Fix
In the teammate spawn path (tmux/iTerm2 backend), preserve the full model string including variant suffix when constructing the --model argument:
- --model claude-opus-4-6
+ --model claude-opus-4-6[1m]
Or better: if no explicit model override is specified for the teammate, don't pass --model at all and let it inherit from the session default (same as subagents do).
Environment
- Claude Code version: 2.1.76
- OS: macOS Darwin 24.6.0
- Model: claude-opus-4-6[1m]
- Teammate backend: tmux (pane-based)
Related Issues
- #24429 — Root issue for model parameter ignored (closed NOT_PLANNED)
- #27038 — Detailed source analysis of the bug
- #27261 — Duplicate focusing on [1m] inheritance
13 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
@Danie1Ka0 @lukaemon @mcande21 @mriffault
Feel free to use this patch (CC created) until the official fix is available. I have tested it on MacOS with CC version 2.1.76. it will make the teammates match the lead instead of using a hardcoded default.
https://gist.github.com/keyur2maru/0d2e4e728d7537aa7c36cbc936b2b6b4
thanks for sharing
Still present on v2.1.77 (Max plan)
Environment:
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-6[1m]CLAUDE_CODE_SUBAGENT_MODEL=claude-opus-4-6[1m]Observed: Teammates spawned via
Agenttool withteam_nameparameter still receive--model claude-opus-4-6(200K) instead ofclaude-opus-4-6[1m]. Confirmed by checking the spawned teammate's session — it does not show 1M context.Interestingly, subagents (Task/Agent tool without team_name, in-process) correctly inherit
[1m]from the parent session. Only out-of-process teammates lose it.Workaround:
CLAUDE_CODE_TEAMMATE_COMMANDwrapperCreated a wrapper script that intercepts the
--modelargument and appends[1m]:Then in
~/.claude/settings.json:This works — next spawned teammates correctly get 1M context. Sharing in case it helps others until the root cause is fixed.
This is related to cozempic's 1M context detection — we had to implement the same workaround.
[1m]gets treated as a variant suffix, not part of the model ID, and gets dropped in various string-manipulation paths.If you're using cozempic with affected sessions, the guard will still correctly detect the actual context window in use — it reads the model field from the JSONL usage data directly, so it sees whatever Claude Code actually ran with. The teammate side is a separate bug in how CC constructs the tmux spawn command.
Noting here in case it's useful for the root cause investigation.
Still experiencing this — teammates get 200k context while the leader runs opus[1m]. The tmux spawn path still hardcodes the model without the variant suffix.
🤖 Generated with Claude Code
Still broken on v2.1.87 (latest). Filed #40929 with detailed testing of all known workarounds — none work on the current version. The binary patch from the gist no longer applies due to minified name changes.
Standalone subagents inherit 1M correctly. Only teammates (tmux spawn path) are affected. The
--modelflag in the subprocess command always strips[1m].I found a workaround for the issue. Setting
"teammateDefaultModel": nullin the Claude Code settings(~/.claude.json) makes it use the same model as the orchestrator. Also, the orchestrator that spawns the teammate should not select a model explicitly when spawningWorkaround(Edited)
/model opus[1m](not default opus[1m]) // This is important"teammateDefaultModel": nullin~/.claude.json<img width="1919" height="603" alt="Image" src="https://github.com/user-attachments/assets/9a10502a-7a0e-4b3b-b1c4-0aee508bc084" />
Confirmed workaround on v2.1.92 (latest) — @Reasonably's approach works
Tested on Claude Code v2.1.92, Claude Max, macOS, iTerm2 with \
tmux -CC\:Steps
"teammateDefaultModel": null\to \~/.claude.json\/model opus[1m]\(must explicitly select this — NOT "Default (recommended)")model\parameterResult
Teammate banner shows "Opus 4.6 (1M context)" and \
/context\confirms \1000k\window. Without the workaround, same setup shows "Opus 4.6" with \200k\window.Additional finding: tmux-specific bug
Also confirmed through testing across three terminal configurations that this bug is specific to the tmux split-pane backend:
| Terminal | tmux? | Teammate context |
|----------|-------|-----------------|
| iTerm2 + \
tmux -CC\| Yes | 200K (without workaround) || iTerm2 (no tmux) | No | 1M (no workaround needed) |
| Ghostty | No | 1M (no workaround needed) |
The in-process backend correctly preserves \
[1m]\. Only the tmux pane spawn path strips it. The workaround above fixes it for tmux users.Why it works
"Default (recommended)" resolves the model ID to \
claude-opus-4-6\internally (without \[1m]\). Explicitly selecting \/model opus[1m]\keeps the \[1m]\suffix in the resolved ID. Setting \teammateDefaultModel: null\tells the teammate spawn path to inherit the lead's resolved model rather than computing its own default — so the \[1m]\propagates through.<img width="810" height="222" alt="Image" src="https://github.com/user-attachments/assets/afaa60a6-d919-4f3a-a06a-9b7700b83ffc" />
able to set teammate model in /config. v2.1.104
Not working at all. Still start teammate with Sonnet 4.6.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.