Skip to specification

Context Management

Protecting the model's attention: retrieval and re-ranking, summaries, compaction, prompt caches. Deciding what enters the model at this instant.

The model has a finite context window, and even inside that window, attention degrades as noise grows. Context management is the harness taking responsibility for that scarcity: deciding, at every single turn, what enters the model right now.

Protecting the model's attention

You've seen this primitive under many names. Retrieval-augmented generation pulls relevant chunks instead of whole documents. Re-ranking decides which retrieved chunks actually make the cut. Session summaries condense a long conversation. Compaction triggers when the window approaches its limit, folding history into a compressed digest. Prompt caches keep stable prefixes cheap.

The names change; the job doesn't: protect the model's attention.

Try it yourself — this is what "the window is a budget" feels like:

Context window — a budget, not a bucket

FOCUSED

instructions · 12kskills · 8khistory · 20kretrieved · 17ktool results · 13k

The window holds what matters. Attention is cheap.

Every useful thing competes with every other useful thing. Drag the slider.

The harness manages attention on your behalf

Humans play a part in choosing context — but a good harness does a great deal of it silently:

  • It retrieves the files that look relevant to the current step, not the whole tree
  • It ranks competing material and drops what doesn't earn its tokens
  • It summarizes the stale middle of a long session while keeping the important parts verbatim
  • It compacts when the window fills, so work continues instead of falling off a cliff
In the wild

Watch for the moment your agent says something like "context low — compacting conversation…" and keeps working with a summary in place of raw history. That's this primitive firing. So are retrieval rankings, session summaries, and the prompt cache that makes your system prompt effectively free after the first request.

A well-fed model is still just a talker

With instructions, delivery, and management in place, the agent is genuinely smarter inside the conversation. It keeps the important parts, retrieves the right files at the right time, and doesn't spend half its window on noise.

But it's still only describing work. It can identify the file. It can propose the command. It can say "the next step is to run the failing test." Great — someone still has to run it. If the work requires action, the model needs a way to ask the outside world to do something.