Experimental Context Management / Compaction in Codex

A new tool for long-running tasks was added in Codex 0.153.4.

It improves on the old compaction system, which simply summarized the conversation when the context limit was reached.

The new context management has three parts:

  1. Token budget — Codex keeps the active context within a controlled size.
  2. History and notes — important information is saved, while older context can still be retrieved when needed.
  3. “new_context” — Codex can start a fresh context window and continue using the saved notes and history.

The main improvement is that Codex no longer has to rely only on repeated summaries, which can lose details over time.

The experimental context management mode is disabled by default and can be enabled in the config.toml

[features.context_management]
experimental_mode = true

I take it this is the documentation?

I was looking through the release and the commit.

It’s good to have several enthusiasts following all the developments together!

wish compaction itself was exposed as tool to the agent too