Add official CLI commands to inspect, prune, delete, and scope Codex memories
Problem
Codex CLI has an experimental memories feature, but I could not find an official CLI surface to inspect, prune, delete, or re-scope accumulated memory entries.
In a real Windows setup, the global memory file has already grown to thousands of lines and hundreds of KB:
- Codex CLI:
codex-cli 0.142.2 - Platform: Windows / PowerShell
codex features list:memoriesisexperimental true~/.codex/config.toml:[features] memories = true~/.codex/memories/MEMORY.md: 4,896 lines, ~601 KB~/.codex/memories/raw_memories.md: ~759 KB
The practical issue is not just file size. Project-specific memories can accumulate in the global memory registry, and there is no obvious official way for the user to remove or move those entries without manually editing internal files.
Why this matters
Without memory management commands, the memory feature can become unbounded over time:
- global
MEMORY.mdcan grow indefinitely across many repositories and sessions - project-specific context can leak into global memory and influence unrelated workspaces
- users have to manually edit generated/internal memory files to clean up stale or misplaced entries
- there is no safe dry-run, backup, or audit trail for memory deletion
- large global memory increases context noise and makes memory behavior harder to trust
Current CLI surface checked
I checked the visible CLI commands and did not find a memory-management command:
codex --helpcodex debug --helpcodex features list
codex delete appears to delete saved sessions, not memory entries.
Requested feature
Please add an official Codex CLI memory management surface, for example:
codex memory list
codex memory search <query>
codex memory show <id>
codex memory delete <id> --dry-run
codex memory delete --query <query> --dry-run
codex memory prune --older-than 90d --dry-run
codex memory prune --scope project --dry-run
codex memory move <id> --to-project <path>
codex memory compact --scope global
Useful requirements:
- stable memory entry IDs
- scope metadata: global, project, workspace path, skill, rollout/session source
- dry-run by default for destructive operations
- automatic backup before deletion/compaction
- ability to delete or move project-specific entries out of global memory
- clear distinction between deleting a saved session and deleting memory
- documentation for
~/.codex/memories/MEMORY.md,raw_memories.md,memory_summary.md, androllout_summaries/
Related issues
This is related to memory UX and explicit memory behavior, but specifically about cleanup/deletion/pruning and scoping:
- #19195
- #19758
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗