Custom Context Compaction

Open 💬 5 comments Opened Feb 28, 2026 by saulrichardson
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What variant of Codex are you using?

Codex App

What feature would you like to see?

You should allow for customizable compaction routines. This could help solve the context window issues people run into when using MCPs. I want my agent to read and have access to all that information but only for while I'm using the MCP. When I'm done it doesn't need to be in the window at all. People should have more control of what gets compacted and how, not to mention when. Context compaction is important for better controllability when it comes to agents. I should be able to see everything that is in the window, specify what parts should be more compacted versus others or make sure that certain tool calls remain the in window, etc.

Additional information

_No response_

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 6 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #11912
  • #11716
  • #11805
  • #12208

Powered by Codex Action

saulrichardson · 6 months ago

duplicate

saulrichardson · 6 months ago

reopening as this request is specific to codex app while other issues are for cli

joshua-bone · 5 months ago

+1 PLEASE give us better compaction options

I routinely run into compaction error loops where I have to discard my whole thread.

mahdikayvan · 3 months ago

@saulrichardson Hey — I felt this issue immediately, and it is very close to the exact pain I’m trying to solve.

I’m building AgaveCore, and I’d like to let a few early people use it for free while I shape it into something stronger.

It helps when a coding agent starts to drift, loses important context, or gives you an output you do not fully trust.

In practice, it works through two habits:

  • tell the agent to remember-progress or remember-this when something important should not be lost
  • use consult-brain when the current task needs more grounded feedback on what to do next

Over time, as useful journals, decisions, and failures pile up, the product should help the agent make sharper decisions and take better actions with less drift.

If this sounds relevant, reply here and I’ll send the exact steps. You can also use the email or Telegram on my profile.

Cheers,
Mads.