Skip to content

Context compaction

Long sessions never hit the wall. Empryo folds older work into a compact summary in about a second and keeps every file and decision.

How it works2 minutes to read
Copy & share
On this page4 sections

Every model can only read so much at once. When a long session gets close to that limit, Empryo compacts it: older turns fold into a compact summary of the work, your most recent turns stay word for word, and you keep going in the same session. No restart, no lost thread.

It kicks in automatically when the context reaches 95% of the model's window, and you can run it yourself at any time:

/compact

Why it feels instantLink to this section

  • Up to 76× smaller. A million characters of session history fits in a summary the size of a short file, bringing a full context window back down to single digits.
  • About a second. Most compactions finish before you notice, with zero extra model calls and nothing extra on your bill.
  • Nothing important left behind. Every file the agent edited or read, the commands it ran and how they turned out, the decisions it made and why, the errors it hit and how it fixed them.
  • No re-exploring. The agent picks up exactly where it left off instead of re-reading files or re-running tests it already ran.
  • It never gets stuck. If a model is slow, busy or out of quota, compaction still completes.

Tested on real coding sessions with Claude Opus, Sonnet and Haiku and with GPT models, with reasoning on and off.

SettingsLink to this section

json
{
  "compaction": {
    "triggerThreshold": 0.95,
    "keepRecent": 4
  }
}
KeyDefaultWhat it does
strategy"auto"Set to "disabled" to turn off automatic compaction
triggerThreshold0.95Compact automatically at this share of the context window
keepRecent4How many recent messages stay word for word. When the newest turn alone is bigger than that budget, its earlier steps go into the summary and only its newest steps stay
llmExtractiontrueLet a model add a short written recap when it helps

Toggle automatic compaction with /compact settings. /compact logs shows past compactions.

Which model helpsLink to this section

Most compactions need no model at all. When a short written recap helps, Empryo uses the model in the compact slot of the task router, so point it at something fast and inexpensive:

json
{
  "taskRouter": {
    "compact": "google/gemini-2.5-flash"
  }
}

A recap is a summary, not a reasoning task, so it runs at the model's lowest reasoning level, not your tab's. To change that, set an effort on the compact lane in the router.

What you'll seeLink to this section

  • A spinner while compaction runs.
  • A message showing how full the context was before and after, measured the way your provider counts tokens. When the newest turn was longer than the kept budget it also says how many of its earlier steps went into the summary.
  • If the context is still above the target after compaction, a note says what fills it: the system prompt and tools, the summary and the kept turn, each as a share of the window.