Repository navigation
Replies: 44 comments 19 replies
|
Thanks for the hard work jif! |
|
|
|
I'd love memories to take into account the git remote of the project folders, while I know I should be using worktrees, I sometimes end up making an additional checkout and don't want it thinking, say |
|
|
I am also developing an external memory system for Codex. Just a story:
https://github.com/hack-ink/elf
What are your thoughts on this? |
|
Hi, I've been using this. But I noticed that it doesn't save memories from exec sessions, only interactive. This is inverse of what I prefer for my own workflow needs. So I added the option to change sources: #13147 Let me know what you think. Would be great to have this added to the main release. |
|
Hi @jif-oai, I’ve been experimenting with persistent conversational memory systems for a while, so this direction in Codex is really interesting to see. Here are my thoughts on your questions. 1. Should Codex cite previous threads when using memories? I’d rate this 4/5. Citing memories can be very helpful when debugging or understanding why the system behaves in a certain way. However, for normal interaction it might become noisy if every response references older threads. A good default might be: • silent retrieval by default 2. Autonomy vs manual triggering A hybrid approach seems best. Automatic memory creation works well for long-running workflows, but users should still have some control to prevent noise or unnecessary storage. For example: • automatic summarisation of important interactions 3. Project memory vs global memory Both seem important. I would structure memory in layers: • project memory – codebase structure, architecture decisions, conventions 4. Sanitising credentials Sanitising credentials is absolutely necessary. However it might also be useful if Codex can remember that credentials exist for a service without storing the secret itself. Example: • “project uses AWS credentials” This preserves workflow awareness while keeping secrets safe. I’ve also been experimenting with a memory-first conversational architecture in my own system. The idea is to separate reasoning from memory handling. Originally I started building this system around 2023 with smaller ~2B models and external memory. Over time the central model grew to ~27B parameters, but interestingly the conversational style and personality remained consistent because they are largely shaped by the memory layer rather than the raw model weights. The architecture roughly looks like this: user request In practice this means: • the model focuses on reasoning and dialogue One interesting observation from these experiments is that increasing model size improved the model’s ability to interpret retrieved memories, but the overall conversational behaviour remained stable because the memory layer carried the long-term context. That’s why I find the direction of durable memories in Codex particularly exciting. If implemented well, it could significantly improve long-horizon coding workflows. Thanks for working on this feature — I’m very curious to see where it goes. After the model generates the final answer, this agent processes the interaction and converts it into structured memory. Instead of storing the full conversation, it creates a semantic summary of the exchange: • what the user asked This summary is then stored in the memory layer. The idea is to avoid memory inflation while still preserving useful knowledge. The system remembers the meaning of the interaction, not the entire dialogue. Over time this creates a compact but semantically rich memory graph that improves retrieval for future queries. In practice the loop looks like this: user request This approach keeps the memory layer small and focused while continuously improving retrieval quality for future interactions. |
|
One final observation from these experiments. A similar architectural pattern is already starting to appear in at least one large cloud AI system. I won’t name the platform here to avoid turning this into promotion, but it shows that this direction can work at scale. What seems to matter most is the separation of roles inside the system. Users are often not just looking for a task assistant — they want a consistent conversational partner that remembers context over time. That does not necessarily require running a massive flagship model constantly. A more efficient structure could look like this: • a lightweight conversational model (for everyday dialogue) In that setup the conversational layer can remain stable while the underlying models evolve. The memory layer preserves continuity, so the system does not “start from zero” each time the model is updated or replaced. This also makes the system more resource-efficient, since large models are only used when necessary. From my perspective this kind of memory-first architecture with agent orchestration could be a natural direction for future conversational systems. |
|
One more practical observation from these experiments. Another advantage of this architecture is computational efficiency. If the system grows through memory rather than only through larger model weights, much smaller models can handle most everyday interactions. This reduces server cost significantly. In my experiments the structure looks like: • lightweight conversational model for dialogue In this setup the system “learns” through memory accumulation rather than constantly requiring larger models. I’ve also been experimenting with development workflows where the memory layer tracks: • previous code versions This helps the system reason about code evolution and reduces hallucinations when modifying existing code. Another area where persistent memory seems promising is educational systems. I’m currently experimenting with a tutoring system for children where the model can remember a student’s progress, mistakes, and learning patterns over time. Early results suggest this can both improve learning continuity and reduce computational cost. If this direction is interesting to others working on Codex or long-horizon coding systems, I’d be very curious to hear your thoughts. |
|
Thanks @talshebek, will read and review this Another global question for everyone. Would you like memories to be enabled by default everywhere or not in |
|
Memory in coding agents is more nuanced than in conversational agents because code-level context has stronger dependencies than natural language. Key differences for coding agent memory: Symbol-level memory, not just session-level: A coding agent should remember: which functions were called, which variables were declared, which interfaces were implemented. This is more structured than "the user mentioned X." Symbol tables are a natural format for coding agent memory — they're already how compilers think about code. Cross-file dependency tracking: When Agent A modifies function Ephemeral vs. persistent memory for code: Some code knowledge should persist long-term (the architecture of this codebase, the team's style conventions). Some should be ephemeral (the current state of a feature branch, in-progress refactoring). Coding agents need to distinguish between "stable knowledge about the codebase" and "volatile state of the current task." Memory consolidation after task completion: When a coding session ends successfully, the agent should consolidate what it learned: new patterns discovered, bugs found and fixed, conventions understood. This "post-task reflection" is how the agent builds up codebase expertise over time rather than starting cold each session. More on the persistent memory architecture: https://blog.kinthai.ai/why-character-ai-forgets-you-persistent-memory-architecture |
|
Quick takes on your questions:
One related note for design surface: I just filed #20138 proposing a session-scoped notes panel — explicitly not a substitute for memories, but a different slot in the context-surface space. Memories as you're framing them are cross-thread, model-curated, and (currently) read-only per #19195. The notes proposal is single-session, user-curated (with an agent-shared sub-region), and writable from both sides. If both ship, they'd be complementary: memories carry forward across sessions, notes pin intent within one. Worth thinking about whether the two interact (e.g. should something written to notes during a session be promotable to a memory at session close?). |
|
Responses to your questions, based on extensive use of Claude Code (which uses CLAUDE.md as its "memory" mechanism) and building rule sets for many projects: 1. Citation visibility: 4/5. Knowing which memory contributed to a decision matters when debugging incorrect behavior. If memory fires incorrectly, you need to know which one to edit or delete. 2. Autonomy vs control: Hybrid, project-level explicit. Auto-generation of global memories makes sense for user preferences. For project-level memories, I would prefer manual confirmation — the cost of a wrong project rule persisting silently is high. 3. Per-project is far more valuable than global for coding. The reason: the most important "memories" for coding are project conventions — which patterns are allowed, which are banned, what testing setup is used, which API versions are in use. These are different per project and do NOT generalize across projects. A memory saying "use This is exactly what AGENTS.md solves as a persistent per-project context file. The "memory" is explicit and editable by the developer rather than learned from session history. 4. On sanitising: Version-pinning is the most important sanitisation. Memories about API patterns go stale as libraries upgrade. Memories should include the version they were written against. One practical observation from CLAUDE.md experience: explicit rule memories outperform inferred ones. A rule written as "NEVER use X because Y" (with reason) has higher compliance than a memory inferred from correction history, because the reason lets the model apply it correctly to edge cases. We have been publishing free per-stack rule files that represent what "ideal project memories" look like in practice: https://gist.github.com/oliviacraft |
|
I've been working on a similar problem for Claude Code and Google Antigravity with OmniMemory. It keeps coding-agent memory local and Git/branch-aware, and retrieves relevant context across sessions while checking for potentially stale memories when the code changes. I'm curious about the idea of bringing a similar approach to Codex. Do you think having an external, project-aware memory layer like this would be useful for Codex as well? If anyone here uses Codex and is interested, I'd also really appreciate it if you could try OmniMemory and let me know what you think: |
|
A question about the architecture of Codex Memory: Do you see the memory layer remaining entirely native to Codex, or could there eventually be a supported interface for an external/self-hosted memory or project-state provider? I’m asking because for coding workflows there seems to be a useful separation between:
I’ve been experimenting with the second part in Tenrec, where the project state lives locally/self-hosted outside the individual worker and only relevant validated state is routed into the next worker. So an architecture I’m curious about would look roughly like: Codex rather than trying to make one memory system own both long-term knowledge and current operational state. Would Codex Memory eventually expose a supported extension point for something like this — for example a custom retrieval/provider interface — or is the intention that external systems should stay separate and integrate only through MCP/tools? Tenrec is the project-state experiment I’m referring to: |
Follow-up after the Computer History launchThe Computer History release on August 13 improves several controls I asked for earlier: it is opt-in, supports app and website inclusion/exclusion, can be paused, exposes a reviewable timeline, and lets users reveal or delete generated local Markdown memory files. Suggested skills and automations also require user review. Those are meaningful improvements. However, it still does not provide the core contract I need: automatic retrieval with user-authorized durable writes. Once Computer History is enabled, it periodically converts interaction events into persistent memory files. The initial opt-in is therefore blanket authorization for future memory creation, rather than approval of each durable write. Inspecting or deleting an entry afterward is useful, but it is not equivalent to deciding before the system turns observed activity into durable memory. Repeated activity can still be exploratory, accidental, or part of comparing alternatives; it should not automatically become an adopted preference or fact. I would like the controls to be separated into independent capabilities:
For Computer History specifically, a review before saving to memories mode would help. Timeline summaries could remain temporary until the user selects an action such as “Save as memory,” reviews the proposed text, chooses global or project scope, and confirms the source evidence. The same interface should support editing, superseding, and deleting individual memories. A one-shot “remember/update/forget this” command should also work when I currently use Windows, where Computer History is not yet available, so this follow-up is based on the documented product behavior rather than hands-on testing. |
|
@jif-oai I use coding agents heavily, so my preferred defaults would be: 1. Citations: 5 out of 5If a memory influenced an important answer or decision, I want to see its source. I already ask agents to cite web research, files, and memories used in important answers. LLMs can be confidently wrong. Without sources, it is difficult to tell whether an answer came from current evidence, an outdated memory, or a hallucination. Long term, citations could become less prominent if the system becomes consistently good at selecting relevant memories and user behavior shows that people rarely correct them. But I would start with visibility and earn the right to make it quieter later. 2. Generation: automatic by default, with conversational controlMost users should not have to manage a memory system manually. The agent should generate memories in the background, but users should be able to tell it to store, update, promote, demote, or forget something. I would also separate small memories from larger durable knowledge. A preference can stay as a short memory. If something grows into a larger body of knowledge, the agent could ask whether the user wants to turn it into a durable file or skill and keep only a pointer in memory. That avoids repeatedly filling the context window with information that should live somewhere more structured. The ideal system learns from user corrections over time, so users need to manage it less and less. 3. Scope: both project and globalMost of my coding memories are project scoped. Architecture decisions, repository conventions, previous bugs, and local workflows should not leak into unrelated projects. Global memory still has a place for preferences that genuinely apply everywhere. Examples include always citing important claims, verifying changes before calling them complete, or using a particular communication style. The agent should usually choose the initial scope, then periodically review its memories and suggest moving them when the scope looks wrong. A background consolidation process could merge duplicates, identify stale memories, and suggest moving knowledge between global memory, project memory, durable files, and skills. 4. Sanitization: yes by defaultDo not store API keys or credential values in memory. The system can remember that a credential exists and where it is stored safely, such as Apple Keychain or a password manager, without remembering the secret itself. One additional needI would like to manage memory by talking to the agent. A dashboard can help, but the primary interface should let me inspect, correct, promote, demote, or remove memories conversationally. I also explored this through small controlled experiments in Cortex, a project I originally built for the Built with Opus 4.6 Claude Code Hackathon, run in partnership with Anthropic. One experiment improved with memory enabled. Another became worse, and lesson activation was very low. I do not treat that as proof that memory generally helps or hurts. The interesting question is whether the system can distinguish:
The positive and negative results, including the exact reports and limitations, are indexed here: Selected Technical Evidence. |
|
Follow-up since my earlier reply: I looked at a concrete reliability failure in Codex memory extraction and built a local reference design around issue #38860. The design processes oversized conversations as complete-turn chunks, checkpoints each successful chunk, splits only the chunk that exceeds the context window, and prevents incomplete coverage from entering Phase 2 consolidation. All 418 targeted tests passed. One synthetic test used a 200,000 byte conversation with a correction in the middle. The correction survived two bounded Stage 1 requests and reached the existing Phase 2 input path. This is independent work with mocked model responses, not a production benchmark. Two design questions came out of it:
Full design, test evidence, and limitations: |
|
Answering the four directly, from having shipped this across twenty agents and then measured what people actually did with it. Citations: 5. Not for the user's benefit first — for the model's. An uncited memory is an assertion the model has to either trust or ignore, and it does not have a good way to choose. A cited one is evidence it can weigh, and it can go read the original when the summary is not enough. The cheap version is session id, date and which agent it came from on every recalled item; that alone changes how the model treats it. Background, but silent. The autonomy-versus-cost framing has a third option that removes most of the cost: recall automatically, and inject nothing when the history has no answer. In ours the common case at any injection point is that nothing is added at all. The expensive design is not "automatic", it is "automatic and always says something" — that is what trains people to ignore the block. Manual triggering solves cost by making the feature depend on the user remembering it exists, which is the same failure as no feature. Worth adding: the moment matters more than the volume. Session start is the obvious one, but the two that earn their tokens are before a command runs (what invocation does this project actually use) and after one fails (what was run after this same error last time, in the sessions where it did not come back). Those are narrow, answerable questions with an obvious wrong answer if you get them wrong. Both, and project identity is subtler than it looks. Environment facts are per project; "how does this machine run X" and "what fixed this error" are per machine and travel across projects — the error you hit here is one you already solved somewhere else on the same laptop. One trap on the project side: a git worktree has a different path from its checkout, so path-keyed project identity splits one repository into several. On sanitising, since you plan it. Patterns catch the named shapes — AWS keys, Context: https://github.com/vshulcz/deja-vu, |
|
Answering from the side that bit me: the failure mode I'd design against first isn't a A run that couldn't be judged — result unreadable, agent exited having only asked a So, concretely on your four: 1. Citations: 5. Not mainly for trust — for falsifiability. A cited memory can be 2. Autonomy vs manual: background extraction, but gated on outcome. The gate I'd use: 3. Scope: per-project by default. Almost everything I wanted to remember was a rule 4. What to store: the filter that cut mine down hardest was requiring each memory to Two things I'd avoid storing at all: anything already derivable from the repository (the Rule shapes that survived, MIT: https://github.com/soul-sol/claude-md-patterns |
|
someone remember the robots need feet and right and left |
|
Answering the four questions from daily use of file-based memory with Codex and Claude (plain Markdown rules, a profile and a one-line-per-turn journal that every session reads at start):
On the external provider question above: since Codex can talk to MCP servers, a memory layer does not have to be native. I built Alter Ego for this: a remote MCP connector that keeps rules, profile, per-project journals and playbooks as plain files in your own storage (OneDrive, Google Drive, Dropbox, GitHub or Azure DevOps), so the memory is the same in every assistant and you can read or edit it yourself. Docs: https://cloudalterego.cafeboon.com/docs.html. Whether a given client accepts remote OAuth connectors differs per client and plan, so check that for Codex first. There is also an open source template with Codex notify hooks that write the journal line per turn: https://github.com/SebastiaanBoon/cloud-alter-ego |
|
For coding workflows, I would separate memory into three scopes: session state, project memory, and user preferences. Project memory should be the default source for codebase conventions, architecture decisions, and known test commands. Cross-project memory should be opt-in and limited to preferences such as output style or review habits. I would rate citations 4/5 when a memory changes the answer. The useful citation is not only the previous thread; it should identify the memory record, its scope, timestamp, and what superseded it. That makes stale rules editable instead of silently authoritative. A hybrid write policy seems safest: deterministic session facts can be captured automatically, while LLM-generated summaries or cross-project promotion require an explicit review or a clear command. This keeps background capture cheap without allowing an unfinished experiment to become a durable rule. Credential sanitisation should happen before any persistent derivative is written, including summaries, embeddings, and search indexes. It is still useful to remember that a project needs a credential or service; the secret itself should remain session-only and be replaced by a reference such as “deployment requires the configured AWS credential”. I would also expose inspect, edit, disable, and forget controls per project. A memory system becomes useful when users can see why it was used and remove it without having to understand the retrieval implementation. |
|
Building on the comments about verified outcomes and current project state, I would add two examples from using Codex for Android testing and reporting. They illustrate details I would want native memory to preserve across sessions. As an ongoing workflow experiment, I ask Codex to use lessons from our work and my corrections to refine how it maintains and uses memory and project notes. What was actually verified. In one Android 16 emulator test, a volume-setting command returned exit code 0, but a separate readback confirmed that the volume had not changed. A future memory saying “the command succeeded” would lose the essential finding. In accessibility work, a similar distinction matters between speech logs and what a human listener actually heard. A citation is useful, but the recalled summary also needs to preserve what the evidence establishes and what remains unverified. The status of a follow-up. After one completed test and publication, the case stayed open while the agreed next step was to wait for developer feedback. A summary retaining only “open follow-up” could lose that waiting decision. Conversely, a still-valid approval should remain discoverable when continuing the same work. Memory would help recover the decision and its scope; current instructions and project records would remain authoritative. The suggestions above about correcting and superseding memories matter here too. If the user corrects an interpretation, later recall should make clear which explanation was superseded and where the correction applies. Keeping both statements without that relationship leaves the user to resolve the same misunderstanding again. These are workflow examples of what I would want memory to retain, rather than diagnosed failures of Codex’s memory implementation. Would they be useful cases for evaluating whether extraction and later recall preserve the meaning of the source? For context, our app-testing notes describe how we retain working instructions, project records and evidence. Disclosure: Codex helped to draft this comment from our work records and performed the tool-based checks. I approved the work and provided human listening observations and corrections. |
|
Answers in order:
One more need: separate durable facts (decisions, conventions) from session chatter, so retrieval doesn't fill the context with noise. |
|
5/5 when memory changes a recommendation. I’d want it to link to the original decision and tell me whether there’s a newer one. A citation to the chat that summarized it still leaves me opening a second tab to find the source. For defaults, I’d capture in the background within the project, require approval before turning a note into a cross-project rule, and keep credentials out before anything gets indexed. I build Zortex, which searches existing sources like notes and email. One test I’d use for either approach: pick a decision you know was reversed, ask a fresh chat what the current decision is, and see whether the link goes to the reversal. If anyone here wants to try that with a real note or email in Codex, I’d like to hear where retrieval breaks. Try Zortex |
|
Citations: 5/5 mandatory. If Codex uses a previous thread or memory, I need to see exactly where it came from. A model-generated summary is not enough. The citation should point to the original conversation or stored source, ideally the exact relevant passage. Memory generation: background discovery is fine, but durable memory must not be silently controlled by the model. The system should preserve the original text first, then separately classify or summarize it. The model should not decide whether my statement is “valid enough” to exist. Scope: project memory and global memory are both necessary. Project memory should be isolated by default. Global memories should be explicitly selected by the user. Retrieval should show what was used and why. Sanitization: credentials must never be stored in memory. API keys, tokens, passwords, cookies, and private keys should be blocked or replaced with references to a secret manager. Sanitization must not destroy the surrounding technical context. The essential requirement: keep the original source separate from the model’s interpretation. Store the source verbatim, expose an index, retrieve the full source only when needed, and let the user control what is active. Memory, permissions, evidence, and validation should remain outside the model. The default should be: Automatic capture of candidate information, explicit user control over durable memory, visible provenance when memory is used, project isolation by default, and no model authority to rewrite, downgrade, or reject the user’s own records. THE FIRST SYSTEM THAT MAKES AN LLM REMEMBER PERFECTLY https://github.com/ryanjordan11/the-rock-benchmark
|
|
Thanks for working on this! Persistent memory is particularly relevant to my workflow, as I use Codex extensively across multiple long-running projects, including software development, infrastructure management, open-source contributions, and technical investigations. I currently maintain my own external context management system using global and project-level Many of these mechanisms were introduced to address context loss, repeated investigations, inconsistent behavior across sessions, and the difficulty of continuing long-running projects after context exhaustion. Answers to the four questions1. Memory citations: 5/5 When a memory materially influences a technical conclusion or decision, I consider its provenance essential. I would prefer concise, expandable references rather than intrusive citations throughout every response. Ideally, they could include the original thread, project scope, timestamp, and associated Git revision or evidence file where applicable. It is important to distinguish historical information from facts verified in the current session. 2. Automatic vs. manual generation My preferred default would be automatic, selective memory generation with a bounded resource budget. Important corrections, completed milestones, architectural decisions, verified findings, and session handoffs are worth remembering. Routine commands and ordinary interactions generally are not. Memory generation should reduce repetitive work rather than introduce another significant source of token consumption. Visibility into its resource usage would be valuable. 3. Project-specific vs. cross-project memories I would prefer three scopes:
Project-specific facts should remain isolated by default. Related projects may benefit from shared knowledge, but one project's implementation state should never be assumed to apply to another. Repository identity should also be considered so that moving a directory, creating a worktree, or cloning a repository again does not unnecessarily fragment its memory. 4. Credential sanitization I fully support mandatory credential sanitization. Codex should be able to remember that a project requires a particular environment variable or authentication mechanism without remembering the actual secret. I would prefer sanitization to occur as early as possible in the memory pipeline, not only when the final memory is persisted. Additional requirements from my workflowMemory should not be treated as current truth. A remembered clean Git working tree, successful test run, completed migration, or deployment approval may no longer be valid. Historical memories should guide investigation, not replace current verification. In particular, previous authorization for an operation should not automatically authorize the same operation in a new session. Memory should complement AGENTS.md, not compete with it. Explicit engineering instructions should remain authoritative within their applicable scope. Learned memories should help the agent follow those instructions rather than silently override them. Memory lifecycle and correction mechanisms I would like memories to support provenance, timestamps, scope, invalidation, and supersession. When a user corrects an incorrect assumption, the correction should take precedence over outdated memories. Compatibility with existing workflows Some users already maintain persistent project context through Markdown files, task histories, technical reports, and handoff documents. Import/export, source references, and deduplication would help integrate native memories with these workflows rather than create another isolated source of context. Inspection and reproducibility A memory management interface showing which memories were retrieved, used, created, or updated would be extremely useful. For Overall, I see the greatest value in memory as a way to reduce repeated context reconstruction while preserving project isolation, engineering discipline, and evidence-based verification. The goal should not simply be to remember more, but to remember the right things, within the right scope, and with clear provenance and lifecycle management. Thanks again for working on this feature! |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hey folks,
I'm working on adding memories into Codex and I would love you opinion on:
Of course I know everyone wants A and control to do B for everything but here I would like to understand what would you prefer by default?
Any other needs?
Disclaimer: Do not try to use the memories for now as the rate limits would consume all your tokens
All reactions