Context

Autocompact

Also called: auto-compaction

Autocompact is the agent compacting the context automatically when the window nears full. Convenient, but it can silently drop detail you cared about.

James Phoenix
Understanding Data Updated July 2, 2026

Autocompact is compaction that happens on its own. When the context window gets close to full, the agent notices, summarises the older history automatically, and carries on without stopping to ask you. The upside is obvious: you can keep working through a long task without babysitting the window or hitting a hard wall.

The catch

The convenience hides a real risk. Because it fires automatically, autocompact decides for you what to keep and what to throw away, and it usually does it mid-flow when you are not paying attention. A detail you mentioned an hour ago (a constraint, a file path, a decision) can quietly disappear into a summary that never mentions it. The agent then acts on the compressed version, and you may not notice until it does something that ignores what you thought was settled.

Two things to keep in mind:

  • It is triggered by size, not by importance. The window filling up is what sets it off, not whether now is a sensible moment to summarise.
  • It is silent by default. You often only learn it happened when the agent suddenly "forgets" something.

Working with it, not against it

The fix is not to fear autocompact but to stop depending on the raw history surviving. Keep anything load-bearing somewhere the summary cannot erase, and when a task is truly finished, prefer a deliberate handoff or a clean reset over letting the window drift into another auto-summary.

Watch out
If an agent starts contradicting an earlier instruction after a long session, suspect that an autocompact ate the detail. Restate the constraint explicitly rather than assuming it still has it.

Related terms

Building with AI agents?

This dictionary is part of how I think about agentic engineering. If you want the same thinking applied to your codebase, that is what I do.

See how I can help