Agents
Context window
Long runs fill an agent's context. Kestrel compacts old turns into a summary instead of cutting them off, so the agent keeps working with room to spare.
What fills it
The task, the files the agent has read, every tool result and every reply. A run that reads a large repo can fill a million tokens in an hour.
Compaction
When the window reaches 80%, Kestrel compacts it. The oldest turns are rewritten as a summary a quarter of their size. Your task and the repo's memory are pinned: they are never compacted or dropped.
| Value | |
|---|---|
| Working context | 1M tokens |
| Compaction starts at | 80% full |
| Compaction ratio | About 4 to 1 |
| Always kept | The task, pinned memory, the last 20 turns |
Tune it
context:
compact_at: 0.7 # start earlier on repos with huge files
keep_turns: 30 # keep more recent turns word for wordTip
The trace marks each compaction, with the size before and after. If an agent repeats work after one, raise keep_turns.
Was this page helpful?