Long-term Memory

Resolved 💬 11 comments Opened Dec 20, 2025 by jgh0sh Closed Apr 16, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

Already shared this with @tibo-openai, but I think adaptive, long-term memory in Codex would make the UX better.

Context<br>I've been really annoyed with correcting Codex multiple times about a certain way to do a very niche thing (like setting a specific timeout to run tests). I also don’t like how Codex often self corrects its approach in its COT but never actually preserves the lessons. AGENTS.md is not good enough for these cases because it requires manual updates - and, typically, developers can’t precisely describe their preferences. It’s also pretty expensive for the developer to context switch and update AGENTS.md every time something interesting happens.

Related Issues<br>[https://github.com/openai/codex/issues/6532](<https://github.com/openai/codex/issues/6532>) (explains the same issue described here).

Proof of Concept<br>I implemented a basic POC of memories in a [fork](<https://github.com/jgh0sh/codex/tree/feature/memories>).

I considered memories as simple notes stored in memories.md. After a normal user turn completes, Codex gathers the user’s text plus recent tool outputs from the tail of history, sends that combined text to a small “extract memories” prompt, and expects short bullet memories back. It filters out empty memories, dedupes, and appends the new items. Codex also skips this flow for exec/sub-agent sessions and caps sizes so it doesn’t grow without limits.

Happy to discuss alternatives.

Additional information

I understand the roadmap is predefined but Claude Code is getting [long-term memory](<https://decodeclaude.com/session-memory/>) very soon.

I also should acknowledge other efforts in the past to add memory, like [https://github.com/openai/codex/issues/4655](<https://github.com/openai/codex/issues/4655>), were closed. Perhaps the timing wasn't right.

View original on GitHub ↗

11 Comments

github-actions[bot] contributor · 7 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #6532
  • #4779

Powered by Codex Action

jgh0sh · 7 months ago

Not duplicates and I’ve already cited one of those issues as related.

alexander-azizi-martin · 7 months ago

I've faced similar issues and think this would be a great addition

styler-ai · 6 months ago

HI Team. I let codex cli create a cline memory skill and from now on always have a project specific cline memory bank in the project folder under .codex/memory/... I more or less copied the cline way of doing it. codex 5.2 xhigh is updating it constantly after each run, works like a charm.

jgh0sh · 6 months ago

@styler-ai I’ve also been playing around with a memory skill. See repo..

I think it’s a temporary solution. Memory should be baked into the structure of the agent.

Can you share the repo for the cline skill? I’d be open to trying it out.

COWI-MI · 5 months ago

As an alternative, AGENTS.md could be used instead of a memories.md file.
If so, I would prefer that Codex asks the user if it should add a learned preference to the file, so the user stays in control.

jgh0sh · 4 months ago

Claude Code officially supports memory following the spec I defined (a memory markdown file).

I'm sure the team here is hard at work building something similar to support continual learning, but let this comment serve as a nudge.

jgh0sh · 4 months ago
As an alternative, AGENTS.md could be used instead of a memories.md file. If so, I would prefer that Codex asks the user if it should add a learned preference to the file, so the user stays in control.

@COWI-MI You are able to edit the memory values in memories.md. I think it's important to separate explicit instructions (AGENTS.md) from learned instructions (memory).

COWI-MI · 4 months ago
jgh0sh · 3 months ago

Codex is rolling out memory.

Probably time to close this 🥲. What do you think @etraut-openai?

etraut-openai contributor · 3 months ago

Yes, it's time to close this. We announced today that memory support is now available in preview. Please give it a try! Open bug reports if you run into issues.