Model-callable context management tools for active, selective compaction
What variant of Codex are you using?
App
What feature would you like to see?
Codex currently supports automatic compaction, manual compaction, and PreCompact/PostCompact hooks. However, none of these allow the active model to decide when and what to compact.
Please expose model-callable context-management capabilities such as:
- inspect current context usage and composition;
- compact selected message or tool-output ranges;
- provide preservation instructions or a structured summary;
- search or restore previously compacted ranges;
- allow Codex plugins to implement alternative context-management strategies.
This differs from existing requests for manual /compact or a lower automatic-compaction threshold. The goal is model-driven active context pruning: the model should be able to remove completed work, verbose tool output, failed exploration, and redundant context before reaching a fixed threshold, while preserving decisions, constraints, file paths, and unresolved work.
A reference implementation of this approach exists in opencode-acp:
https://github.com/ranxianglei/opencode-acp
Related issues:
- #11325
- #15301
- #21468
- #10336
Additional information
_No response_
2 Comments
Hi @Yi-frank-phy, regarding the missing tool output / unfinished call state in the transcript, Codex Rescue Alpha5 has bounded tool-correlation diagnostics to detect persisted correlation anomalies and incomplete turn boundaries without assuming non-execution.
To inspect the rollout locally and safely in read-only mode:
No private files need to be uploaded; please sanitize any repository details before sharing diagnostic output.
I'm also intrested in this feature, 1M context is great for long debug session, but I have to compact manually in regular small developments, otherwise later cache read can be very expansive (not because of the pricing it self, the amount is too large, 800k cache read becomes $0.4).