- Archived full text: Full archived text, with credits
- Link: https://www.truefoundry.com/blog/trueforge-context-compaction-explained
What it says
The TrueForge article explains context compaction as the state transition that replaces older working history with a structured, lossy summary so a long-running agent can continue within a finite token budget. It distinguishes the persisted event history from the compacted working representation, warns that the summary is not archival truth, and treats the compaction boundary as a testable checkpoint: summaries should carry stable pointers and typed invariants rather than every fact, critical state must live in authoritative systems, corrections must survive the boundary as explicit state transitions, external side effects must be reconciled rather than trusted from the summary, and repeated compaction can compound loss across generations.
Claims drawn from this source
- Compaction is a lossy state transition, not deletion or proof. Compaction is not deletion, archival, or proof; it is a state transition in the agent’s working representation. A detail can remain present in persisted events while no longer being salient, or even present, in the summary the model uses.
- Compaction triggers at 80% of the context window, with a 50k fallback. TrueForge documents compaction as enabled by default, running when input context reaches 80% of the model’s context length; if that length is unavailable, the harness uses a 50,000-input-token fallback, and agents can configure an explicit input-token threshold.
- The boundary is a testable checkpoint with typed invariants. The application can compare the generated summary with typed invariants: active objective, required approvals, open operations, artifact digests, security constraints, and the next allowed transition. If an invariant is missing or contradicted, do not continue silently.
- Repeated compaction compound loss across generations. If a later summary is produced from an earlier summary rather than the full relevant record, omissions can become permanent in the working context; a small ambiguity may be compressed into a confident statement then carried forward as if it were original evidence.
- Compaction is not a retention or privacy control. Removing detail from the model’s working context does not mean the underlying event history was deleted; data-retention, deletion, legal hold, access, and export policies must operate on the persisted stores. A compacted summary can preserve sensitive information even when the original detail is no longer needed.
- Human corrections must survive the boundary as explicit state transitions. If a user corrects an earlier fact, the compacted state should preserve the correction and retire the superseded value; represent corrections as explicit state transitions rather than relying on later text winning.
- Do not infer exactly-once continuation from a summary. Persisted state and a compacted summary do not make external side effects deterministic. If a tool call timed out around a database mutation, the summary may accurately say status unknown, but the application must still query the authoritative system before retrying.
- Monitor compression, errors, and invariant failures. Monitor compaction frequency, compression ratio, post-compaction error rate, invariant failures, reopened questions, and repeated tool calls; a session that compacts repeatedly may need better tool-result offloading, narrower task scope, or a deliberate new session.