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.
| Layer | Location | Default | Who sees it |
|---|---|---|---|
| AGENTS.md | ~/.codex/AGENTS.md (or AGENTS.override.md), then one file per directory from the repo root down | Read 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 = true | You, 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 asadditionalContext, so Codex places them in front of the model before it reads what you typed. - When the turn ends, Stop runs
glen ingestagain to record it. For Codex that means your prompt and the final reply. - PostToolUse on Bash calls
glen pr-link, tying eachgit committo 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
| You want Codex to | Put it in |
|---|---|
Run pnpm test before every commit, no exceptions | AGENTS.md |
| Keep your personal shorthand on your own laptop | Codex memories |
| Know a teammate's session already ruled out the cache-first approach | Glen |
| Explain the conversation behind lines 40 to 80 of a file | glen code-search |
| Start a new hire with what the team settled last quarter | Glen |
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.