Context engineering

Why your AI thread rots — and how we stop it

without slower · pricier Doric fast · lean · cheap
the window stays small on purpose

Every long AI session has the same arc: it starts sharp and ends as sludge — slower to respond, vaguer in its answers, and quietly more expensive. That's not the model getting tired. It's the context getting fat. Doric treats that as an engineering problem with a real fix.

Why threads rot

As a conversation grows, the naïve thing to do is keep stuffing more into the model's window — old turns, whole files, every past decision. The bigger that window gets, the more the model's attention is spread across noise, and the more each turn costs (you pay for input tokens every time). Quality drifts and the bill climbs together. The industry has a name for it now: context rot.

Carry the least-sufficient context

Doric's first move is to send the model only what the turn actually needs. The project is modelled in layers — intent → architecture → component → code — and a turn reads the one component or spec that matters, not the whole codebase. Smaller input means sharper reasoning and a smaller bill, every single turn. The window stays small on purpose.

The warm cache is most of the cost

Here's the part most setups miss. Providers cache your prompt, and on a steady thread that warm cache dominates input cost — the repeated context is billed at a fraction once it's cached. The catch: switching models breaks the cache, so the next turn re-bills the entire prompt at full price. A model switch is only "free" at a cache boundary.

Check the bill: on a long thread it's the warm cache, not the model, that decides what you pay. So we only switch models where the cache would reset anyway.

So Doric verifies the cache hit/miss on each turn and only changes models at a boundary where it costs nothing to do so — never mid-thread on a whim.

The right model, every turn

Most of a build is structural work — wiring, scaffolding, routine edits — that doesn't need a frontier model. So each turn is classified by its work and routed to the model with the best value for that work: a cheap model for structure, a strong one for judgment and architecture. Because most turns are structural, most turns are cheap.

Threads that distil themselves

Left alone, even a well-managed thread eventually fills up. So when a thread runs long or wraps up, Doric distils it — the how-to-work lessons fold into the agent's skills, the project truths fold into the durable context — and the raw transcript is trimmed. Nothing important is lost; the window just stays lean. It's why a thread can be as fast and clear on day 90 as it was on day 1.

Why it matters

Put together, these are why building in Doric gets better as it grows, not worse: faster responses, sharper answers, and a thread that costs less the longer you stay in it. Thread health and cost aren't afterthoughts bolted on at the end — they're part of the loop on every turn.


← Back to all engineering notes

Build in a thread that stays fast.

Start building