---
title: "The Long Thread Was Not the Expensive Part"
canonical: https://dxdev.com/blog/subagents-cost-seven-times-the-thread/
datePublished: 2026-10-04
---
The long thread was the smaller cost: the main thread processed 37.5M input tokens and the 26 subagents behind it about 280M.

## The fix for the smaller pile

A ticket claimed thread length was the dominant cost. The main thread did grow from 77k at the first call to 320k at the last. So a topic governor was implemented. Each prompt is bound to a topic where the rules allow, and a topic becomes a unit. When a new topic opens in a very long thread, the prompt hook tells the agent to run it in a seeded child.

The change added a topics module, a `topic_from_prompt` hook riding the already-registered prompt hook, and tests. Running the topic replay command against the hub transcript gave 9 topics on the main thread. The binding was strict: walkthrough answers bound to the ticket asked about, the backup and key-storage threads became keyless topics, and a few answers stayed unbound rather than wrongly bound.

The main-thread cost was the smaller one. The 26 children had a first-call context median of 44k (range 23k to 46k). The top eight, which were burn-down passes, the goals lane and organize units, each reached 220k to 308k by walking many tickets inside a single context.

## A boundary proxy that fired on everything

The child-splitting analysis looked at a similar handoff for the children. The idea was for a child to hand off to a fresh child at each ticket boundary. That needs a definition of "boundary". An earlier proxy was any new key appearing in any tool input. Run against the hub's subagent transcripts, it estimated about 75M saved.

That number over-fired. The proxy triggered on surveys and on code edits, because Write and Edit carry test-fixture ticket keys.

The rule was then defined around focus instead:

- A focus call is a non-edit tool call naming exactly one ticket key. Write, Edit and TodoWrite never count. Bookkeeping such as `commit`, `status` and `lane-board` never counts either.
- A boundary is a focus call on a key the child has not focused on before, excluding keys in its own dispatch description (its home ticket).
- Past 120k at a boundary, the hook asks once per key, never twice within 8 calls. It never denies.

On single-ticket builds (the envelope build, the test-leak fix, the backup plan, the scraper hardening) the focus rule gives 0 boundaries, and 4 to 11 on the burn-down managers.

The cost model for each split: the boundary call is already paid at the old context. Then there are three more calls at that context (handoff Write, status emit, final report) and one hub call at the hub's median context, 221,918 tokens, measured. The child base is measured. The seed (3k) and relay (1.5k) constants are assumed.

## What the savings really are

- Upper bound, every ask taken: saves 66.4M (21%), 14 splits.
- Hand-labelled, only real ticket starts taken: saves 31.4M (10%), 7 splits.

Of the 15 asks the upper-bound run made before the home-key exclusion, 7 were real starts. One example is a manager writing a fresh executor job for the next ticket. The realistic figure is the 31M floor, not the 66M ceiling. The floor treats every unlabelled later ask as declined, so the true value sits somewhat above it. That part is unverified.

The goals lane (36.4M, the most expensive child) and organize units (24.5M) are single long tasks. No ticket rule touches them.

## What is not verified

- Whether an agent actually takes the split when the ask fires. The hook asks and never denies, so the saving depends on the agent complying. The first real burn-down past 120k is the test.
- "Processed tokens" counts cache reads at full weight. How Max quota weighs cache reads against fresh input is unverified.
- The hand labels are one reader's judgment from the calls around each boundary.

A cross-model review of the split hook returned 1 blocker, 5 high, 5 medium and 1 low finding, all fixed before commit. The blocker was an unquoted Windows path in the continue command that bash mangles.

The long thread was real, and it was still the smaller pile: 37.5M against 280M.

## Takeaway

The main thread cost 37.5M processed tokens, against about 280M for the 26 subagents. The topic governor acts on the main thread. The focus-based split rule saves an estimated 31.4M (10%) on hand-labelled real ticket starts, with 66.4M (21%) as the upper bound. Whether agents take the split when the hook asks is still unverified.
