Direct answer
Compact the conversation. Preserve the task somewhere durable.
The Codex context window is the active model's finite working set—not the complete saved transcript and not your account usage limit. Use /status to inspect the live session. Codex can compact a long chat automatically; /compact requests a concise replacement for earlier turns so the same job can continue with more room.
Before that boundary, record the objective, completed work, decisions, changed files, proof, blockers, and exact next action. Compact when the objective is unchanged, fork when the approach branches, and start new when the job changes. If you want guided durable artifacts and cleaner tool output around that native workflow, install Supercode for Codex.
Name the surfaces
The context window is one of four different kinds of state
“Context” is often used for the working set, the saved chat, the usage meter, and repository knowledge. They have different lifetimes. Compaction changes only one of them directly.
Active context
Instructions, conversation, selected files, tool results, and generated text in the current working set.
Saved transcript
The stored chat can be resumed or inspected even when every old item is no longer active verbatim.
Account usage
Plan and rate-limit consumption across work. Compacting or starting new does not reset this meter.
Durable state
Plans, specs, ADRs, task notes, code, tests, and evidence that another session can read again.
OpenAI defines model_context_window as the context-window tokens available to the active model. The stable answer is therefore not one permanent number for “Codex.” Inspect the model and working session you are actually using.
The inputs
What fills the Codex working set
A repository task consumes context before any code is written. Durable instructions, the conversation, file contents, search results, build logs, screenshots, tool schemas, and the agent's own output all compete for the active surface.
The expensive pattern is not a large repository by itself. It is repeatedly importing broad material without narrowing the next decision. A 20,000-line log with one useful stack frame creates pressure. Re-reading five architecture documents before every small edit does too.
Durable rules and the active task prompt
File excerpts, search results, and documentation
Commands, logs, test output, screenshots, and schemas
Decisions, rejected alternatives, and generated text
One command can return megabytes; many concise decisions can remain manageable.
The boundary
What Codex compaction actually does
OpenAI documents /compact as replacing earlier turns with a concise summary that frees context while retaining critical details. Its best-practices guide says Codex also compacts long chats automatically.
The full active history approaches the current model's working limit.
The same chat continues, but earlier model-visible material has changed form.
That makes compaction a continuity mechanism—not a cache clear, quota reset, or new objective. Operationally, treat the boundary as lossy. A summary must choose what to retain; an obscure constraint, failed command, rejected alternative, or exact next file may receive less detail.
This is an inference from summarization, not a claim that Codex always forgets those facts. Manual compaction is easiest to recover at a phase boundary: after diagnosis, after an accepted plan, or after implementation and before validation.
The first diagnostic
Inspect pressure with /status before changing anything
/statusRead the live result in order. Confirm the model first, because the working capacity and catalog defaults can differ. Then verify actual token pressure, the repository, and the execution boundary. A permissions interruption can look like lost state when the real blocker is access.
Next inspect the pattern: repeated large-file reads, duplicated logs, several objectives in one chat, or an interrupted turn whose durable repository state is unclear. Do not tune the automatic threshold first. Moving the boundary cannot fix an undefined objective or noisy input.
The recovery artifact
Write this checkpoint before /compact
The record should be short enough to scan and concrete enough to resume. Save it in the repository when the work must survive another chat, another executor, or another day.
## Task checkpoint
Objective:
Done:
Decisions and constraints:
Changed files:
Validation evidence:
Open blockers:
Next action:“Continue the refactor.”
Update SessionStore.resume() to use the validated cursor, then run SessionStore.spec.ts.
A useful checkpoint records why alternatives were rejected and names the proof already collected. After saving it, ask Codex to read the file and confirm the next action before compacting. The artifact does not eliminate summarization risk; it gives recovery an authoritative source.
The command router
Compact, fork, new, or resume?
Choose the command from the relationship between the old work and the next objective. They are continuity tools, not interchangeable ways to “clear context.”
/compactContinue the coherent task with summarized earlier history.
/forkExplore an alternative in a new chat ID while preserving the original.
/newStart with a clean working set instead of carrying irrelevant decisions.
/resumeReload the saved transcript and continue from its existing history.
OpenAI recommends one chat per coherent unit of work—not one chat per repository or one per day. A bug investigation and its fix can be one unit. An unrelated feature should not inherit that debugging trail merely because it touches the same codebase. Resuming restores a saved chat; it does not imply that every historical item becomes active verbatim at once.
The failure path
Recover when Codex starts repeating itself
Some users have reported version- and environment-specific loops around compaction, reconnects, and repeated file reads. Those reports expose useful failure shapes; they do not prove that the current client normally behaves that way.
Repeated reads are the signal. The cause could be a regression, an interrupted stream, broad instructions, missing phase state, or a tool that floods the transcript. The next proof should separate those possibilities rather than assume one.
- 01Stop adding work
Do not queue another objective into an ambiguous session.
- 02Inspect the session
Record the model, workspace, current pressure, and execution policy.
- 03Check durable state
Use Git status and focused tests to separate narration from actual changes.
- 04Write the checkpoint
State what is proved, what is unknown, and the smallest next action.
- 05Route continuity
Compact, fork, or start new according to the objective—not frustration.
- 06Reproduce before tuning
Capture the current client and minimal inputs before changing thresholds.
The control plane
Advanced controls are not the first fix
Codex exposes real context controls, but arbitrary numbers copied from another model or release can create a second problem. Keep the current catalog defaults unless you have a reproducible reason, a measured change, and a rollback.
model_context_windowAvailable context tokens for the active modelUsually catalog-drivenmodel_auto_compact_token_limitThreshold that triggers automatic history compactionUnset uses model defaultsmodel_auto_compact_token_limit_scopeCount total active context or growth after a carried prefixAdvanced tuningcontext management experimental modeUse notes and searchable history instead of one repeated summaryOff by default · gatedPreCompact / PostCompactRun lifecycle hooks around manual or automatic compactionAutomation onlyExperimental context management
The current reference describes notes plus searchable history instead of repeatedly compressing everything into one summary. It is explicitly experimental, off by default, and currently account-gated. Evaluate it; do not describe it as the universal default.
Compaction hooks
PreCompact and PostCompact can distinguish manual from automatic triggers. Teams can record telemetry or enforce a local process, but hooks add operational complexity and can stop the transition. They are not required for normal continuity.
The product boundary
Where Supercode fits—and where it does not
Native Codex owns the model window, /status, /compact, automatic compaction, forks, saved chats, and experimental context management. Supercode does not expand that window or guarantee perfect recall.
Specs & Docs
Guided specs, plans, ADRs, and repository documentation can carry accepted decisions across a compaction boundary or into another chat.
Input hygieneToken Optimization
Basic reduces noisy or repetitive command output before it enters the conversation; Max also targets redundant exploration and avoidable work. Actual savings vary.
Bounded orientationContext Boosting
It can add a size-limited project layout or relevant repository context to a turn. It may return no boost and is not durable task memory.
If those adjacent layers match your workflow, install Supercode for Codex and keep the native continuity decision explicit. The useful outcome is less avoidable input and more recoverable project knowledge—not a larger advertised window.
The preflight
Codex context continuity checklist
- I used /status to inspect the live session instead of assuming a universal limit.
- I can name the one coherent objective this chat owns.
- Large files and tool output are narrowed to the evidence needed for the next decision.
- The objective, completed work, constraints, files, proof, blockers, and next action are recorded.
- I chose /compact, /fork, /new, or /resume for the actual continuity problem.
- I verified repository state before trusting a resumed narrative.
- I left advanced thresholds at their defaults unless I can reproduce and measure a reason to change them.
- I marked experimental context management as experimental.
- I did not confuse context capacity with account usage.
The goal is not to avoid compaction forever. It is to keep the task recoverable when the active window changes.
Primary evidence and dated reports
Sources and freshness
Codex commands, configuration, hooks, and experimental availability can change. Primary mechanics were reviewed on September 16, 2026. GitHub reports are directional examples from specific environments, not prevalence evidence.
The next useful action
Make the project state easier to recover
Add guided repository artifacts, bounded project context, and tool-output hygiene around the native Codex continuity workflow. The model window and compaction mechanism remain under Codex control.

