Skip to content

Consider "Auto-Compacting" as a Memory Checkpoint for Agent Self-Iteration #14702

@LeGamerDc

Description

@LeGamerDc

What variant of Codex are you using?

codex app

What feature would you like to see?

The Problem:
As AI coding agents evolve, maintaining an actionable "memory" for self-iteration and workflow improvement is becoming increasingly critical. Currently, the auto-compacting mechanism acts purely as a token-saving measure—it aggressively discards execution history and intermediate context. In doing so, it wastes a perfect, natural checkpoint that could be used to generate long-term memory logs for agent evolution.
The Proposed Solution:
Instead of merely summarizing context internally to save space, the compact event should serve as a trigger to generate and export a structured Memory Log to a user-specified local directory (e.g., ./.codex_memory/).
Rather than strictly categorizing outputs into "positive" or "negative" paths, the model should output an objective snapshot of the recent execution window. The exported log should include:

  1. Objective: What was recently attempted.
  2. Approach: The specific method, tools, or logic used.
  3. Outcome: What was obtained or discovered.
  4. Status [Optional]: Marked simply as Success, Failure, or Partial.
    Why It Matters:
    By exporting these objective logs during every compacting phase, you hand the power of "Long-Term Memory" back to the developers. Users can autonomously decide how to process these logs—whether it’s building scripts to reflect on the data, merging them into an embedded vector database, or using them to fine-tune the agent's overarching workflow and system prompts. This shifts the compacting feature from a mere "context limit workaround" into a foundational tool for continuous agent self-improvement.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    contextIssues 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