Memory for OpenAI Codex: checked in your repository, or hosted for your team

Give OpenAI Codex a memory it queries when relevant: a local MCP server that checks every note against your code and shares team notes through git, or hosted team memory connected with OAuth.

Updated 2026-12-02

AGENTS.md is the file Codex reads for every task. It is the right place for rules every task needs and the wrong place for every fix and gotcha found along the way: it is read in full each time, and nothing checks it against the code. threadctx gives Codex a memory it asks for when it needs it. Codex gets memory_query to recall what is relevant before a task and memory_write to save a fix or decision.

Two ways to connect

Local, checkedHosted team memory
Set upcodex mcp add threadctx -- npx -y threadctx mcpAdd https://threadctx.dev/mcp, then sign in
Where notes livePersonal: ~/.threadctx/local.json. Team: .threadctx/memory.json in the repositorythreadctx.dev, scoped to your team
Checked against the codeOn every recallNo; the hosted server never sees your repository
SharedThrough git, reviewed in pull requestsWith everyone in your team, on any machine
AccountNone; runs offlineEmail sign-in. Free for 2 seats, 500 notes and 1,000 queries a month

Local memory, checked against your code

codex mcp add threadctx -- npx -y threadctx mcp

Or add it to ~/.codex/config.toml, or to .codex/config.toml in a trusted project. The Codex CLI, the IDE extension and the ChatGPT desktop app share this configuration.

[mcp_servers.threadctx]
command = "npx"
args = ["-y", "threadctx", "mcp"]

threadctx works on the folder its server starts in. If your notes end up in the wrong repository, add cwd = "/path/to/your/repo" to the [mcp_servers.threadctx] table.

Each note is checked against the repository before Codex reads it: notes naming files or scripts that no longer exist are flagged, notes that contradict the lockfile or the instructions are marked as conflicts, and secrets and download-and-run instructions are refused. Ask Codex to save a note for the team and it goes to .threadctx/memory.json, the same file Claude Code, Cursor and Copilot agents read. Fail CI when team notes drift from the code:

npx threadctx memory check --team

Hosted team memory

In the Codex app, open Plugins, choose Add, and connect a custom MCP: name threadctx, type Streamable HTTP, URL https://threadctx.dev/mcp, no bearer token. Save, then choose Authenticate on the threadctx row. From the CLI:

codex mcp add threadctx --url https://threadctx.dev/mcp
codex mcp login threadctx

Sign in with the link threadctx emails you. If your email has no team yet, a free one is created. Codex receives a token you can revoke, never a key. Notes are kept per repository when the agent names one, and in a team-wide space otherwise, so memory also works in chats that are not about a repository.

Hosted memory is recalled by meaning (semantic search) but is not checked against your code. For notes that name files, scripts and commands, the local server is the safer choice. You can use both.

Make it routine

The tool descriptions already tell Codex to query before non-trivial work and save after a non-obvious fix. To make it a rule, add one line to AGENTS.md:

Before non-trivial work, call memory_query; after a non-obvious fix or decision, call memory_write.

Questions

Should I use local or hosted memory with Codex?

Local if you work in repositories and want each note checked against the code and reviewed in pull requests. Hosted if you want the same memory across machines, in chats without a repository, or for teammates who do not share a checkout. They can run side by side under different names.

Does the hosted memory see my code?

No. It stores the notes your agent writes and returns them when asked. It never reads your repository, which is also why it cannot check notes against the code.

What does hosted memory cost?

The free team covers 2 seats, 500 notes and 1,000 queries a month. The Team plan is $9 per seat per month, billed annually. The local server is free and Apache-2.0.

Does it work in Claude Code, Cursor and VS Code too?

Yes. The local server is the same for every agent, and team notes in .threadctx/memory.json are shared between them. Claude Code users can run npx threadctx setup for the plugin.

Set it up now.

Free, local, nothing uploaded.

codex mcp add threadctx -- npx -y threadctx mcp