CSE Roadmap

Common tier · about 4 hours · 11 parts

Part 2 of 11 · 2 min read

Re-reading the whole context every step is what makes length expensive

One long errand costs more than four short ones, because every step re-reads everything before it.

Think of an assistant who, before writing anything new on a notepad, reads the entire notepad from the top every single time. The longer the notepad gets, the longer every new line takes to add. This happens even though the line itself is short.

In plain words: context isolation runs a sub-task in its own context window, separate from the parent's, so neither sees the other's intermediate messages -- and because a call's cost is roughly its system prompt plus everything said so far, one long run costs about the square of its step count while several short runs add up to much less.

A worked example. One agent doing 60 steps (four sub-tasks end to end) costs 355,654 total input tokens in the example's simulation. Splitting the same work into four isolated sub-agents of 15 steps each, then handing a result back to the parent, costs 178,517 tokens with a typed handoff -- almost exactly half, for the same four findings. The saving grows as tasks get longer: the ratio of sub-agent cost to single-agent cost falls from 0.58 at 10 steps per sub-task to 0.37 at 40.

The key lines. From code/mini-subagents/agents.py:

# from code/mini-subagents/agents.py
def cost_of_run(sizes: list[int]) -> int:
    return sum(SYSTEM + s for s in sizes)

Read it as: sizes is the context size before each call, and that size keeps growing across the run. So the same SYSTEM overhead gets paid at every step, against a context that is larger each time. That is exactly what makes a 60-step run cost far more than four 15-step runs added together.

Context isolation, sub-agent, orchestrator

Context isolation is running a sub-task in a context window separate from the parent's. A sub-agent is an agent invoked by another agent to do one sub-task. An orchestrator (or parent) is the agent that decides what to delegate and uses the results.

Example: the orchestrator in this example delegates four research sub-tasks (pricing, latency, adoption, compliance) and only reads back what each one returns.