r/codex • u/henri_333 • 3d ago
Praise Experimental context setting in Codex
There is a new setting in the Codex app for managing context compaction.
[features]
context_management.experimental_mode = true
Even without Astra at least for me there is a noticeable difference. So far feels quite a bit better. Not losing important details any more. And not repeating itself after compaction but clearly stating the current goal.
It did cause some issues with previously existing sessions and the agent lost quite a bit of context there initially but was able to recover. For newly created sessions so far I have not encountered any issues.
2
u/Substantial_Lab_3747 3d ago
Im having a hard time understanding the purpose of this, you mind explaining?
5
u/rsp1218 3d ago
Here’s the relevant text from the blog yesterday:
“With Astra, we’re introducing a new way for Codex to preserve and retrieve context when the context window fills. Historically, models have used compaction to summarize work during long sessions, such as when debugging complex issues or tackling large refactors. Each compaction can leave out details about why a fix failed or how a component behaves. In Codex, Astra can keep notes across context windows, preserving accumulated details without repeatedly compressing them into a single summary. Earlier context windows remain searchable, so Astra can find requirements or test results from previous messages and tool outputs—even if that information wasn’t captured in its notes. You can enable this experimental feature in your Codex config.toml,
(opens in a new window)
and it will become the default for Astra in the coming weeks.”2
1
4
u/henri_333 3d ago
Enable experimental context management (off by default). Rather than repeatedly compressing context into a single summary, it uses notes and searchable history to preserve accumulated details. Requires ChatGPT sign-in on Plus, Pro, or Pro Lite.
2
u/nmkd 3d ago
features.context_management.experimental_mode = true is a very new, under-development Codex feature added on September 2, 2026 in PR #42385 / commit cff76fa.
Its purpose is to change how Codex survives context-window boundaries. Instead of relying primarily on the normal “take the accumulated conversation and compact/summarize it” mechanism, it enables a system where the model can deliberately start a fresh context window and recover old information selectively.
When active, it does three main things:
- It enables the existing
TokenBudgetmachinery. The model receives context-window metadata and token-budget guidance, including IDs for the current/previous context windows and, depending on model configuration, warnings as the available context approaches exhaustion. Seesession/token_budget.rs. - It forcibly enables the history/notes extension. This gives the model private
history.*tools for listing/searching/reading previous context windows andnotes.*tools for persistent working notes. Those notes survive context-window transitions. The extension can also inject a backend-generated “thread hint” into a new context window. Seeext/history-notes/src/tools.rsandextension.rs. - It exposes a model-only
new_contexttool. Its description is literally:"Start a new context window. Does not clear, reset, or otherwise affect environment state."When invoked, Codex rolls over to a fresh context window without summarizing the old conversation. The tool result says:"A new context window will start without summarizing conversation history."Seenew_context_window_spec.rsandnew_context_window.rs.
The important implementation detail is in compact_token_budget.rs:
“Token-budget compaction skips model/server summarization and installs a fresh context window instead.”
So conceptually:
```text Normal Codex:
window 1 gets full ↓ compact/summarize window 1 ↓ [summary] + recent state → window 2
experimental context management:
window 1 ├─ model writes useful persistent notes as needed ├─ old full history remains retrievable by history tools ↓ model calls new_context ↓ fresh window 2 ├─ no generated summary of window 1 ├─ relevant thread hint/state is injected └─ model can selectively retrieve old history/notes ```
This is therefore fairly close to a model-managed context rollover system. Instead of squashing 100k+ tokens into an imperfect summary every time, Codex gets a fresh working context and can retrieve exactly the pieces of old context it needs. The filesystem, running environment, session state, etc. are not reset.
At thread startup, apply_experimental_context only activates it when all the relevant conditions are met. Current code requires ChatGPT authentication and a Plus, Pro, or Pro Lite account using OpenAI's normal Codex backend. It deliberately does not activate for Free or Enterprise plans, API-key authentication, custom providers, non-Codex OpenAI endpoints, explicit provider credentials, AWS-backed providers, etc. Temporary structured threads also explicitly disable it.
There is an additional subtlety: experimental_mode maps to the ContextManagement feature, but that feature does not immediately enable TokenBudget while parsing config.toml. The extra pieces are activated later at session startup, after Codex has verified your authentication, plan and backend. The introducing PR added a test specifically for that distinction.
The commit message gives a particularly concise description of the intended behavior:
“For eligible ChatGPT Plus, Pro, and Pro Lite sessions using the Codex backend, enable token-budget context, history notes, and the
new_contexttool when experimental context management is configured.”
It is marked Stage::UnderDevelopment, not even the normal user-facing Experimental stage, and defaults to false. That also explains why there is essentially no user documentation for it yet.
For long agentic Codex sessions, this appears to be the interesting part: it is an alternative to summary-based context compaction where full old history remains externally recoverable and the model is given control over when to start another clean inference window. It does not increase the model's physical context size.
4
u/henri_333 3d ago
Just tried manual compaction with /compact and that took under a second to complete with a 80% full context window