The memory we recommend for Codex is Glen, shared memory for coding agents.Go to tryglen.com →
Guide3 min read

Glen, shared memory for coding agents

What OpenAI Codex remembers, and how a team can share it

OpenAI Codex carries knowledge between sessions in two ways: AGENTS.md files, which it reads before it starts work, and Codex memories, an opt-in feature stored under $CODEX_HOME/memories/ on one machine. Neither one reaches a teammate's Codex. Glen adds that shared layer: its Codex hooks record each turn into your organization's memory and hand the relevant past work back as context before the model reads your prompt.

Get Glen for Codex
On this page
  1. What Codex remembers without help
  2. The edge of built-in memory
  3. How Glen plugs into Codex
  4. Measured on Codex itself
  5. Which layer for which job
  6. Frequently asked questions

What Codex remembers without help

Every Codex run begins with no recollection of the last one. Whatever it knows about your repo before the first prompt comes from instruction files on disk, plus, if you turned it on, a local memory store. OpenAI's guidance is to keep the instructions a team relies on in AGENTS.md rather than in memories, since memories never leave the machine; the AGENTS.md guide covers what each file should hold.

OpenAI Codex's built-in memory, November 2026
LayerLocationDefaultWho sees it
AGENTS.md~/.codex/AGENTS.md (or AGENTS.override.md), then one file per directory from the repo root downRead every session, up to project_doc_max_bytes (32 KiB)Anyone who clones the repo, for the committed files
Codex memories$CODEX_HOME/memories/Off until you set memories = trueYou, on the machine that wrote it

The edge of built-in memory

  • A teammate's Codex spends an afternoon finding out why the migration has to run before the backfill. Unless someone edits AGENTS.md, your session tomorrow starts that search again.
  • Memories written on your work laptop are absent on your home machine and in any fresh environment.
  • Half the team runs Claude Code or Cursor. What those agents learn never shows up in Codex, and Codex's lessons never reach them.
  • AGENTS.md records conclusions. The reasoning, the failed attempts and the thread that settled it stay in transcripts nobody reads twice.

How Glen plugs into Codex

Glen is hosted memory for your organization plus a set of Codex hooks. glen install writes four entries into ~/.codex/hooks.json, and each one calls the glen CLI. Codex only runs hooks you have trusted, so approve them when Codex asks, or open /hooks and approve them there. Full steps are on the setup page.

  • UserPromptSubmit runs glen ingest, which sends your prompt, the previous assistant turn, the repo and the branch. The matching memories come back as additionalContext, so Codex places them in front of the model before it reads what you typed.
  • When the turn ends, Stop runs glen ingest again to record it. For Codex that means your prompt and the final reply.
  • PostToolUse on Bash calls glen pr-link, tying each git commit to the session behind it.
  • On launch, SessionStart calls glen session-start.

Measured on Codex itself

Glen's benchmark ran on Codex 5.5. It took the last 100 merged PRs of a workspace with two months of Glen history and had Codex re-implement each one from a one-shot prompt, five runs per PR with Glen and five without, with memory rolled back to the moment before each PR. The Glen runs used 29% fewer tokens, finished 21% faster and matched or beat the quality of the runs without it. Recall arrived through the same per-prompt injection Codex gets today. Method and results.

Which layer for which job

Where Codex knowledge should live
You want Codex toPut it in
Run pnpm test before every commit, no exceptionsAGENTS.md
Keep your personal shorthand on your own laptopCodex memories
Know a teammate's session already ruled out the cache-first approachGlen
Explain the conversation behind lines 40 to 80 of a fileglen code-search
Start a new hire with what the team settled last quarterGlen

Frequently asked questions

Does OpenAI Codex have memory?

Yes, two kinds. AGENTS.md files are read at the start of every session, and Codex memories, off by default, stores notes under $CODEX_HOME/memories/ on one machine.

How do I turn on Codex memories?

Set memories = true in your Codex configuration. The notes stay on that machine, so OpenAI suggests keeping anything the team depends on in AGENTS.md.

Can Codex remember previous sessions?

Only what made it into AGENTS.md or its local memories. With Glen installed, every turn is recorded, so a later Codex session, yours or a colleague's, gets the relevant part of earlier work with its prompt.

Does Glen work with Codex and Claude Code in the same team?

Yes. Both agents record into, and recall from, the same organization memory, so a fix found in one shows up in the other.

What does Glen cost for Codex users?

The same as for any agent: Free covers 15,000 memories and up to 3 people, Personal raises that to 250,000 memories with integrations, and Team removes the limits.

More in this guide

Related guides on agent memory

Fix your agents’ amnesia.

Glen gives Codex the memory of every session your team has run. Start on your own or with up to two teammates. Your first 15,000 memories are free, no credit card.

Start free at tryglen.com