Memories should semantically deduplicate repeated task learnings during consolidation
What feature would you like to see?
Codex memories should consolidate repeated task-level learnings into higher-level reusable principles instead of repeatedly appending near-identical conclusions under separate tasks.
In a long-running Codex setup, ~/.codex/memories/MEMORY.md can gradually become a verbose task ledger. The detailed task history is useful, but many of the durable conclusions are semantically the same across different issues, repositories, and workflows.
For example, repeated tasks often produce principles like:
- verify current code/logs/database state instead of relying on memory
- do not treat an old PR/comment as proof that a bug is handled
- separate symptom, root cause, fix, verification, and handoff state
- keep detailed evidence in rollout summaries and keep the main memory as an index
Those are valuable learnings, but once they appear across many task groups, the memory file becomes harder to search and less useful as a retrieval source.
Current behavior
Memory consolidation appears to preserve many task-level summaries independently.
In one local setup, the main memory index had grown to roughly:
- 2,450 lines
- 325 KB
- 24 task groups
- 133 task entries
- 166 rollout summary references
The detailed evidence is not the issue. The problem is that repeated reusable conclusions are stored many times at the task level instead of being promoted into a smaller shared principle.
This creates:
- repeated reusable knowledge across many task groups
- a verbose
MEMORY.md - lower signal-to-noise during memory lookup
- larger tool/search outputs when inspecting memory
- more chances that old task-specific details distract from the current task
Expected behavior
Codex should distinguish between:
- durable principles/preferences
- project or workflow-specific rules
- task-level historical evidence
- detailed rollout/session artifacts
A better memory structure would:
- keep high-frequency reusable principles once
- merge near-duplicate conclusions across tasks
- keep
MEMORY.mdas a compact index - keep detailed per-task evidence in
rollout_summaries/ - optionally mark task learnings as superseded by a generalized principle
Suggested implementation direction
During memory consolidation, Codex could add a semantic deduplication step:
- cluster candidate memories by meaning, not just exact text
- promote repeated conclusions into a shared principle
- retain links to representative rollout summaries
- avoid re-adding the same principle under every new task
- expose a memory compaction/report command so users can inspect what was merged or dropped
Related issues
This is related to memory quality and consolidation, but distinct from concurrency or memory-loss bugs such as #26684. This request is about long-term semantic memory hygiene: the memory is preserved, but over time it becomes too repetitive and task-ledger-like.
Environment
- Codex CLI: 0.142.0
- Platform: macOS
- Memory files involved:
~/.codex/memories/MEMORY.md~/.codex/memories/memory_summary.md~/.codex/memories/rollout_summaries/
Why this matters
The current behavior preserves too much task-local narrative and not enough abstracted reusable knowledge. The result is that memory technically works, but it becomes noisy over time.
A memory system should behave more like a curated knowledge index than an append-only task diary.