Codex + agimem
Give OpenAI Codex persistent memory across coding sessions.
Codex is OpenAI's coding agent. With agimem, it can remember your project's conventions, architecture decisions, and debugging notes between sessions — so you spend less time re-explaining context. Connect agimem as an MCP server and share the same memory with Codex and your other AI tools.
Setup in 4 steps
Create a Capsule on agimem
Sign up at agimem.dev and create a Capsule from the dashboard. Each Capsule is an isolated memory space — create one per project or one for all your work.
Generate an API key
Click your Capsule and generate an API key. It starts with agm_ — copy it now, you won't see it again.
Add the MCP server to Codex
Open ~/.codex/config.toml and paste the configuration below with your API key. Restart Codex if it's already running.
Start using memory
Run /mcp in the Codex CLI to confirm agimem is active. Then ask Codex to remember something and verify it persists in a new session.
Fastest way: paste a prompt
Give this prompt to your Codex agent and it will configure everything automatically:
Agent prompt
Set up agimem as my memory server: https://agimem.dev/setup
Manual configuration
Add this to your Codex configuration file. The Codex CLI, IDE extension, and ChatGPT desktop app share this config, so you only need to set it up once:
~/.codex/config.toml
[mcp_servers.agimem]
url = "https://agimem.dev/api/mcp"
http_headers = { "Authorization" = "Bearer agm_your_api_key" }What your agent can do with agimem
- Store and recall coding conventions
- Remember project architecture across sessions
- Share context between multiple agents
- Keep research notes and findings persistent
- Track preferences and writing style
- Maintain state for long-running automations
- Organize memories with tags
- Set time-to-live for temporary data
Frequently asked questions
Can I keep my API key out of config.toml?
Yes. Replace the http_headers line with bearer_token_env_var = "AGIMEM_API_KEY" and set that variable in your environment. Codex reads it and sends it as a bearer token.
Can I use a different Capsule per project?
Yes. Add the same block to .codex/config.toml in the project, using that Capsule's API key. Project config only applies to trusted projects, and you should keep any key out of version control.
Does this work in ChatGPT on the web?
No. ChatGPT on the web doesn't read local Codex config files. This setup covers the Codex CLI, IDE extension, and ChatGPT desktop app.
How is this different from AGENTS.md?
AGENTS.md holds instructions you maintain by hand. agimem gives Codex read-write memory that it can update as your project evolves, and that other MCP clients can use too.
Ready to get started?
Create a free Capsule and connect Codex.