Skip to content

Model-callable context management tools for active, selective compaction #36669

Open

Description

@Yi-frank-phy

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:

Additional information

No response

Activity

  1. added
    appIssues related to the Codex desktop app
    contextIssues related to context management (including compaction)
    on Aug 3, 2026
  2. boombx403-byte commented on Aug 18, 2026

    @boombx403-byte

    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:

    pip install codex-rescue==0.1.0a5
    codex-rescue doctor <path-to-rollout.jsonl>

    No private files need to be uploaded; please sanitize any repository details before sharing diagnostic output.

  3. iBobbyTS commented on Aug 21, 2026

    @iBobbyTS

    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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appcontextIssues related to context management (including compaction)enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions