MODULE 04 · LESSON 4.4
Bound context with the compaction ladder
Bound working context without corrupting the conversation.
Lesson 19 of 86 · FabrCore 2.0
Overview
Long tool results can exhaust the next model call before the conversation is long enough to summarize. Working-context reduction bounds those results while retained history can preserve originals. Durable compaction is a separate validated rewrite of history.
Why a short conversation can still exceed a model limit
A single tool can return thousands of lines. The next inference must fit the instructions, history, tool results and reserved response space into the model's input budget. Working-context reduction controls what is sent on that call. The retained original can still be useful for diagnostics even when only a bounded projection reaches the model.
Reduction and durable compaction have different effects
The compaction ladder can reduce verbose content before it resorts to a summary-based history rewrite. A projection bounds the current request; durable compaction changes the stored history representation after validation. Do not equate an older message disappearing from a model prompt with deletion from every store. Use the configuration table below to identify which layer a setting controls.
The table below lists the supported context/compaction controls. These are distinct from increasing the provider’s real token capacity. Retain the reference’s configuration scope and use a disposable instance when comparing behavior.
Inspect context reduction
- Set the model's context window and output reservation, then enable the documented context/compaction options. Tune one budget at a time.
- Generate a tool-heavy conversation and inspect context reduction versus stored history. Preserve tool-call/result groups and the latest interaction during summarization.
- Configure prompt/per-turn limits and stopping behavior. Surface remaining work if a budget is exhausted instead of reporting success.
| Setting | Purpose |
|---|---|
| ContextCompactionEnabled / _ContextCompactionEnabled | Enable working-context compaction |
| ContextWorkingSetTokens / _ContextWorkingSetTokens | Smaller input working set |
| ContextEvictThreshold / _ContextEvictThreshold | Initial tool excerpt threshold (0.5) |
| ContextTruncateThreshold / _ContextTruncateThreshold | Tighter tool excerpt threshold (0.8) |
| _ContextWindowTokens, _ContextMaxOutputTokens | Per-agent window/output overrides |
| CompactionEnabled / _CompactionEnabled | Durable history compaction |
| CompactionThreshold / _CompactionThreshold | Explicit durable threshold override |
| CompactionKeepLastN / _CompactionKeepLastN | Recent-message retention target |
| _CompactionModelConfigName | Separate summarization model alias |
| _PerTurnMaxInputTokens, _MaxPromptInputTokens | Cumulative/per-call safety budgets |
| _RunawayBudgetBehavior | Run-safety behavior |
Compare a large tool result with retained history
- Use a development tool that returns a large, recognizable fixture and ask the assistant to summarize it. Inspect context diagnostics to see which reduction stage was used and why.
- Compare the model-facing content size with the retained tool result, where capture permits. The request should stay within the configured budget; a shorter prompt does not by itself show data loss.
- For a durable compaction test, inspect the resulting summary and preserved facts before continuing the conversation. Ask about a fact that must survive and verify it remains supported.
You are checking both bounded inference and preservation of useful context. If the model still overflows, verify the configured budget, output reserve and the actual layer consuming the setting.
If the result is different
A higher limit does not repair broken tool-result pairs. Use the current compaction reference for defaults and exact override names; they can differ from earlier releases.
Go deeper
Explore the related documentation.