Long-term Memory
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.
11 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Not duplicates and I’ve already cited one of those issues as related.
I've faced similar issues and think this would be a great addition
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.
@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.
As an alternative,
AGENTS.mdcould be used instead of amemories.mdfile.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.
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.
@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).related discussion: https://github.com/openai/codex/discussions/12567
Codex is rolling out memory.
Probably time to close this 🥲. What do you think @etraut-openai?
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.