← Table of Contents · Page 221 of 868
COMPACTION AND SUMMARIZATION
Part 5 of 10
ACTIVE AND AUTONOMOUS CONTEXT COMPRESSION
So far we described compaction as something the harness does to the agent.
A newer family of approaches lets the agent take part in managing its own context.
Active context compression means the agent deliberately decides when and what to compress, rather than waiting for an automatic trigger.
Autonomous context compression goes further, giving the agent tools to prune, summarize, or save its own working state during the task.
Think of a student taking notes during a lecture.
A passive student waits until the teacher stops and collects the notebooks.
An active student writes concise notes as they go, deciding what matters.
Several practical forms exist.
In one form, the agent periodically writes a running summary of its progress into a scratchpad file, for example every ten steps.
Later, if the harness must compact, high-quality summaries already exist to build on, and the agent itself can re-read its notes to recover its place.
In another form, the agent is given a tool that lets it clear old tool results it no longer needs, while keeping its reasoning and decisions.
In a third form, the agent works in short focused sessions, each of which ends by writing a handoff note for the next session, a pattern sometimes called context resets with handoffs.
Some model providers have also introduced built-in features in this direction, such as automatic server-side compaction and context-editing tools that clear stale tool results.
Because product features change quickly, treat any specific feature name you read as something to verify in the provider's current documentation before relying on it.
The general lesson is stable: the agent that writes good notes about its own work is more resilient than the agent that depends entirely on after-the-fact summaries.
A word of caution applies.
Letting an agent manage its own context adds a new thing that can go wrong.
An agent might delete something it later needs, or write a misleading note.
So autonomous compression should be combined with safeguards, such as keeping originals in storage, and measuring results with evaluations, which you will study in Part Eight.
Advertisement
Read Aloud:
0:00 / 0:00