Compaction trades detail for room. A good compaction keeps decisions, unresolved problems, and the current plan, and drops tool output that has already been acted on. Codex compacts automatically once a token threshold is crossed, and Claude Code uses the same technique to keep long sessions going.
Because a summary can lose something that matters ten steps later, careful harnesses pair compaction with durable notes and keep compression restorable, for example by dropping a document’s contents from context while keeping its file path so the agent can read it again.
