Codex context
Codex Context Window and Compaction: Why Sessions Get Heavier
The context window is not your plan allowance. It is the active workbench holding instructions, files, logs, and history. Compaction organizes that workbench; it cannot redefine a confused task for you.
- Observed
- Late in long sessions, rereads, missed local constraints, and slower progress become more common.
- Verified
- OpenAI describes compaction as reducing context size while carrying forward state needed to continue.
- Limit
- Compaction is not a lossless archive, and no single trigger point fits every repository.
Key takeaways
- Context capacity and plan allowance are different constraints.
- Compaction preserves relevant state while reducing size, but clear task boundaries improve what remains useful.
- A new topic, separate project, or history dominated by noise often deserves a new session.
Four layers of context
- 01Repo rules
- 02Current goal
- 03Read material
- 04Tool output
What occupies the workbench
System and repository instructions, your task, code reads, tool responses, test logs, image descriptions, and earlier conclusions all enter the active context. A short prompt can still lead to a heavy task because later reads and outputs dominate.
Context capacity limits the material the model can work with at once. Plan allowance governs resources over time. Mixing them sends optimization in the wrong direction.
What compaction actually does
As context grows, the system can compress earlier interaction into a smaller state representation. Ideally it retains goals, completed work, remaining steps, and important constraints while folding verbose detail.
It is not a full transcript backup. Multiple projects, changing objectives, or dependence on one exact log make useful compression harder. Clear delivery boundaries improve continuity after compaction.
Continue or start fresh?
Continue when the feature, acceptance criteria, and remaining steps are still one coherent unit. Start fresh for a new project, a different objective, history dominated by old logs, or work that needs a new factual baseline.
Before a new session, leave a compact handoff: starting commit, completed and remaining work, key files, protected boundaries, and verification commands. You are selecting valuable context, not simply losing history.
Four ways to reduce context noise
Search before reading, cap log output, batch work by topic, and keep durable repository rules in AGENTS.md or a skill. Do not paste completed discussions repeatedly.
The goal is information density, not the shortest possible prompt. A necessary specification may be long; repeated passing logs are low value at any length.
- Read relevant files instead of scanning without bounds.
- Keep failure-adjacent logs rather than full successful output.
- Maintain one primary objective per task.
- Restate critical acceptance boundaries after compaction.
My workbench metaphor
A crowded desk is manageable when the current job is obvious. Compaction organizes the desk; a new session gives you a clean one.