Repository navigation
Description
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.
Activity
Johnson-dev-1808 commentedon Aug 25, 2026
Reproduced again on 2026-08-25 after a built-in consolidation cycle.
Environment:
codex-cli 0.149.0-alpha.4.1Darwin 25.5.0 arm64 armopenai/codex@5ce04789fbbd4b12c80340a8246cfb00d0a330d5Observed active-memory result:
MEMORY.md: 1,958 wordsmemory_summary.md: 768 words## Task Nheadingsthread_id=annotationsrollout_path=annotationsFailures and how to do differentlysectionsThe current upstream consolidation prompt still explicitly requires
# Task Group, task entries, failure-history sections, and rollout provenance annotations. That makes the task-ledger shape the prescribed output rather than only a semantic-deduplication miss. A user ad-hoc memory note can reduce volume, but cannot reliably override this system-level schema.Root-cause correction at the prompt-owning boundary:
rollout_summaryas archival task evidence.raw_memoryto confirmed durable architecture, contracts, canonical commands, non-obvious constraints, stable repeated/permanent preferences, and current release gates.Because this repository does not accept external PRs, I prepared a tested reference implementation here:
Johnson-dev-1808@549b003
Verification on the current upstream base:
just fmt-checkjust test -p codex-memories-write: 45/45 passedcargo build -p codex-cli --bin codexgit diff --check origin/main...HEADCould this issue be reopened until the task-shaped consolidation schema is removed from the shipped runtime?