Context Compaction
Context compaction replaces older conversation state with a smaller item so a long task can continue. The item may not be a readable summary, and details may be lost.
history → compact item → continuity checktrigger before the model limitA coding agent nears its context limit. The system compacts earlier turns but keeps goals, decisions, changed files, and open errors available.goal · files · errorsopaque item C7C7 + new inputhistory → preserved state + compact item → continuity checkOPSAnother example
A coding agent nears its context limit. The system compacts earlier turns but keeps goals, decisions, changed files, and open errors available.
Main parts
- 01Compaction trigger
- 02Source history
- 03State to preserve
- 04Compact item
- 05Continuation input
- 06Continuity check
Use it when
Use it when needed context is near the model limit. Check that the next turn can still finish the task.
Do not use it when
Do not treat the compact item as the full record. Keep permissions, exact values, unfinished work, and source evidence elsewhere.
Name used in code
history → preserved state + compact item → continuity check Before you ship
Check the model and prompt versions, source data, versioned evaluation set, and measures. Verify links to evidence, tool permissions, privacy, common failures, decline-to-answer and fallback behavior, human review, monitoring, cost, speed, and rollback.
Outcome: Use or evaluate Context Compaction to make AI behavior measurable and tied to evidence. User context: A coding agent nears its context limit. The system compacts earlier turns but keeps goals, decisions, changed files, and open errors available. AI method or concept: Context Compaction. Why it fits: Use it when needed context is near the model limit. Check that the next turn can still finish the task. Do not use it when: Do not treat the compact item as the full record. Keep permissions, exact values, unfinished work, and source evidence elsewhere. AI requirements: Define the input and source evidence. Set model and tool permissions. Use versioned evaluation data and measures. Define failure, decline-to-answer, privacy, speed, and cost limits. Operational safeguards: Keep a clear trace and hide sensitive log data. Show users a safe fallback. Mark steps that need human review. Define how to roll back the model or prompt. Acceptance criteria: Record baseline and target measures on a versioned evaluation set. Test edge cases and hostile inputs. Verify fallback, monitoring, permissions, and rollback. Evidence and limits (evidence boundary): It is official for that source. Other platforms or teams may use the term in another way. Unknowns to confirm: Target task, model and version, evaluation owner, source data, risk limit, tool permissions, and production fallback.
Check this request
Review the current use of Context Compaction. Definition: Context compaction replaces older conversation state with a smaller item so a long task can continue. The item may not be a readable summary, and details may be lost. Release checks: Check the model and prompt versions, source data, versioned evaluation set, and measures. Verify links to evidence, tool permissions, privacy, common failures, decline-to-answer and fallback behavior, human review, monitoring, cost, speed, and rollback. Before changing code, report the evidence you found, gaps, severity, and the smallest safe fix.