codex - 💡(How to fix) Fix Scoped memory management for Codex (global, project, hybrid, and per-thread options) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#18343Fetched 2026-04-18 05:55:34
View on GitHub
Comments
2
Participants
2
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×5unlabeled ×3commented ×2
RAW_BUFFERClick to expand / collapse

What variant of Codex are you using?

CLI and IDE Extension

What feature would you like to see?

I would like Codex memories to support explicit scope management instead of relying only on a global memory store.

Today, memory appears to be effectively global under the current CODEX_HOME, which can cause cross-project contamination over time. In practice, many memories are highly specific to one repository, one codebase, or one workflow, and should not automatically influence unrelated projects.

I would like Codex to support configurable memory scopes such as:

  • Global: shared across all projects
  • Project: isolated to the current project/repo/worktree
  • Hybrid: use both global and project memory, with project memory taking priority
  • Thread-only / no carryover: keep memory local to a thread/session and do not reuse it elsewhere

It would also be useful to have basic memory management controls, for example:

  • view whether a memory is global or project-scoped
  • promote or move a memory between scopes
  • clear memory only for the current project
  • optionally disable project memory inheritance from global memory

This would make Codex much more reliable for users who work across multiple repositories with different standards, conventions, and domain-specific context.

Additional information

This becomes more important as memory grows over time. A pattern, preference, or instruction that is useful in one project may be undesirable or even harmful in another. The current behavior can also save very specific project details in a shared memory pool, which makes reuse less precise and increases the chance of irrelevant memory retrieval.

A good solution could be:

  • a configurable memory policy in settings/config
  • automatic project namespacing based on repo root or worktree
  • optional hybrid retrieval with clear precedence rules
  • commands or UI to inspect and manage memory by scope

This would improve long-term memory quality, reduce context bleed between projects, and make memory safer and more predictable for multi-project workflows.

extent analysis

TL;DR

Implementing configurable memory scopes, such as global, project, and hybrid, can help prevent cross-project contamination and improve memory quality in Codex.

Guidance

  • Introduce a configurable memory policy in settings/config to allow users to choose their preferred memory scope.
  • Develop automatic project namespacing based on repo root or worktree to isolate project-specific memories.
  • Create commands or UI to inspect and manage memory by scope, enabling users to view, promote, or clear memories as needed.
  • Establish clear precedence rules for hybrid retrieval to ensure predictable behavior.

Example

No code snippet is provided as the issue focuses on feature enhancement rather than debugging code.

Notes

The proposed solution requires significant changes to the existing Codex architecture, and its implementation may have implications on performance and compatibility.

Recommendation

Apply a workaround by using a separate Codex instance or configuration for each project to isolate memories until a built-in scope management feature is available. This approach can help mitigate cross-project contamination but may not be scalable for large numbers of projects.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING