Skip to content

Make /compact summaries visible and support prompt-guided compaction in Codex CLI #21468

@VictorBenitoGR

Description

@VictorBenitoGR

What variant of Codex are you using?

CLI

What feature would you like to see?

I would like Codex CLI to make /compact more transparent and controllable.

At the moment, /compact compacts the conversation, but the user cannot see the generated summary that replaces earlier context. This makes it difficult to know what Codex still “remembers” after compaction, especially during long coding sessions where small implementation details, decisions, constraints, rejected approaches, and edge cases matter.

This is especially noticeable for users coming from Claude Code, where similar compaction-related behavior has existed for months. In Claude Code, the compaction flow is more transparent because users can see the generated summary, and /compact [message] can be used to guide the summary with the user’s intent in mind. Codex CLI currently feels more opaque by comparison.

I would like one or more of these options:

  1. Show the generated compacted summary after /compact.

  2. Store the compacted summary visibly in the transcript.

  3. Add a command such as /compact --preview to review the summary before applying it.

  4. Add a way to copy or export the compacted summary.

  5. Support prompt-guided compaction, for example:

    /compact Focus the summary on the current edge case, the files involved, recent code changes, debugging findings, rejected fixes, and the next steps.
    

This would let users guide compaction toward the context that matters most for the next part of the session.

Additional information

Currently, running /compact alone works, but running /compact [message] does not appear to trigger compaction. It seems to treat the text as a normal message instead. This is confusing because /compact [message] feels like the natural way to give compaction instructions, but it does not behave that way.

I have screenshots showing both cases:

  1. /compact [message] returns Ready. but does not compact the context. The context indicator still shows Context 36% left.

If prompt-guided compaction is not supported yet, Codex CLI should still treat /compact [message] as /compact and compact the context, even if it ignores the additional text. Treating it as a normal prompt is confusing because the command appears to succeed but no compaction happens.

Image
  1. Only /compact alone successfully runs and shows Context compacted (Context 100% left).
Image

The main motivation is trust and continuity. After compaction, users should be able to inspect what context was preserved, especially when working on complex tasks where a lost constraint or decision can cause wrong changes later.

This would also make it easier to debug cases where Codex behaves as if it forgot something after compaction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIcontextIssues related to context management (including compaction)enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions