Repository navigation
[Bug]: T3 Code makes Claude Code subagents cost about 15% more #22749
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Use the Claude provider signed in with a Claude subscription.
- Start a thread on Claude Opus 5.5 with a Reasoning level selected, for example Extra High.
orchestrator_capabilitiesthen reportsinheritedOptions: [{"id":"effort","value":"xhigh"}]. - Ask the agent for subagent work on the same model.
- The agent calls
delegate_taskinstead of Claude Code's own Agent tool, as T3 Code's injected instructions require (see below).
Expected behavior
Routing same-model child work through T3 should not make it more expensive than Claude Code's own subagent doing the same work.
Actual behavior
Two things combine:
- T3 Code's injected instructions make the agent choose
delegate_taskover Claude Code's own subagents. Since fix(server): preserve subagent reasoning effort and fast mode #16595, T3 Code adds this to the agent's system prompt: "When model options are requested or the child keeps the parent's provider instance and model with nonemptyinheritedOptionsfromorchestrator_capabilities, usedelegate_taskeven for native-supported models. Native subagents cannot reliably apply T3 model options." A selected Reasoning level is already an inherited option, so on Claude almost every same-model subagent now goes throughdelegate_task. - A
delegate_taskchild gets a 1-hour prompt cache; a native subagent gets 5 minutes. The child runs as its ownclaudeprocess in SDK mode. Claude Code picks the cache TTL by request source. For subscribers, sources on itstengu_prompt_cache_1h_configallowlist get 1h, and that list includessdk. Native subagent sources (agent:builtin:*,agent:custom) are not on it and get 5m. T3 Code does not set a TTL for children.
A 1h cache write costs 2x base input and a 5m write costs 1.25x. Reads and output cost the same, so a subagent costs about 15% more in total, depending on how much of its usage is cache writes. A child usually runs a continuous tool loop with requests seconds apart, so the longer TTL rarely pays off, and every delegated review round starts a new child anyway.
One possible fix: start Claude children for delegate_task with CLAUDE_CODE_PROMPT_CACHE_TTL=5m. They would match native subagents and keep the inherited options.
Impact
Major degradation or frequent failure
Version or commit
T3 Code (Nightly) 0.1.2-nightly.20261021.3457. Rule added in 9a05676 (#16595), still on main @ 28a8d2b
Environment
macOS 27.0.1, Claude Code 2.1.306, Claude Opus 5.5, Claude subscription (not in overage)
Logs or stack traces
# orchestrator_capabilities, Claude thread with Reasoning = Extra High
"inheritedProviderInstanceId":"claudeAgent","inheritedModel":"claude-opus-5-5","inheritedOptions":[{"id":"effort","value":"xhigh"}]
# Claude Code 2.1.306, cached remote config in ~/.claude.json
"tengu_prompt_cache_1h_config": {"allowlist":["repl_main_thread*","sdk","auto_mode","rolling_compact","memdir_relevance","agent_classifier","prompt_suggestion","away_summary","extract_memories"]}
# Claude Code 2.1.306 TTL order, read from the binary:
# FORCE_PROMPT_CACHING_5M
# -> CLAUDE_CODE_PROMPT_CACHE_TTL (main/SDK sources) or CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL (other sources)
# -> promptCacheTtl / subagentPromptCacheTtl settings
# -> agent frontmatter
# -> subscriber and source on the allowlist: 1h, otherwise 5mScreenshots, recordings, or supporting files
No response
Workaround
None that only affects delegated children. Claude Code's TTL can be set with CLAUDE_CODE_PROMPT_CACHE_TTL or the promptCacheTtl setting, but T3 Code's parent threads are SDK sessions too, and T3 Code passes environment variables only per provider instance. Setting 5m there moves every parent thread to 5m as well, so long-idle threads rewrite their whole context more often.
Activity
PrinceJunkie commentedon Oct 21, 2026
The Claude Code docs describe this split: Which TTL each request gets. Agent SDK turns fall in the "main conversation" bucket, which gets the 1-hour TTL on a subscription within plan usage. Subagents fall in the "everything else" bucket and get 5 minutes. The same page lists
CLAUDE_CODE_PROMPT_CACHE_TTLas the control for the main-conversation bucket (Claude Code v2.1.242+), so the proposed fix uses a documented setting.Measured from my own transcripts (Claude Code 2.1.306, subscription), one multi-agent task on Opus 5.5:
delegate_taskchildrenNative subagents over the same 14 days wrote 107.7M tokens at 5m and 4.3K at 1h.
At Opus 5.5 API rates, the children cost $110.52. With 5m writes the same requests would have cost $95.86, so the 1h TTL added about 15%. Only 2 of 1,336 gaps between consecutive responses were longer than 5 minutes. A 5m TTL would have rewritten about 17K tokens there ($0.08). In this workload the overhead was about 15% rather than 60%, because cache reads made up most of the input. The longer TTL saved almost nothing.
[-][Bug]: T3 Code makes Claude Code subagents cost up to 60% more[/-][+][Bug]: T3 Code makes Claude Code subagents cost about 15% more[/+]t3dotgg commentedon Oct 21, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
On our fleet, 1h pays off for delegated Claude children. A forced 5m TTL would raise their input cost by about 9.5%, so #22841 does not force 5m. Instead, children follow Claude Code's own
subagentPromptCacheTtlsetting. With the setting unset, nothing changes.Data: proxy capture logs, 2026-10-03 to 2026-10-21. I matched 353 child sessions (72.1k requests) to
delegate_taskcalls by cwd and start time. That match is a heuristic. Costs are in base-input-token units (1h write 2.0, 5m write 1.25, read 0.1). Output is left out.One long-running workload with 221 sessions causes almost all of the penalty (+290M net). In every other project, 5m costs about the same or slightly less. So the right TTL depends on the workload, much like the commenter above found for theirs. A single hardcoded value would be wrong for someone either way.
juliusmarminge commentedon Oct 22, 2026
Fresh triage on 8acbefefc5: the existing fix #22841, merged as 066c8fc0cd, is present on main. Ran the focused ClaudeAdapterV2 test “gives delegated children Claude’s subagent prompt cache TTL”: 1 passed. It covers children using 5m, parent/fork isolation, explicit override, and unset behavior. Subscriber billing was not re-measured. Leaving this already-closed issue closed; no additional change.