Codex Agent Memory
Local-first Model Context Protocol (MCP) memory layer for Codex CLI/Desktop, Claude Code, Gemini CLI, Qwen/DeepSeek/Ollama and agent workflows. SQLite + FTS5 compact context packs, token savings, read-only mode, no external memory server.
What is Codex Agent Memory?
Codex Agent Memory is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to local-first model context protocol (mcp) memory layer for codex cli/desktop, claude code, gemini cli, qwen/deepseek/ollama and agent workflows. sqlite + fts5 compact context packs, token savings, read...
Local-first Model Context Protocol (MCP) memory layer for Codex CLI/Desktop, Claude Code, Gemini CLI, Qwen/DeepSeek/Ollama and agent workflows. SQLite + FTS5 compact context packs, token savings, read-only mode, no external memory server.
This server falls under the Knowledge & Memory category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Local-first Model Context Protocol (MCP) memory layer for Co
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx codex-agent-memConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Codex Agent Memory
Codex Agent Memory is a local-first MCP memory layer that gives AI coding agents — including Codex CLI, Claude Code, Gemini CLI, and Ollama-based agents — a persistent SQLite + FTS5 memory store without requiring any external server or cloud service. It exposes 34 MCP tools for storing and retrieving past decisions, tracking open work items, creating snapshots, validating memory governance policies, and bootstrapping compact context packs that dramatically reduce token usage on agent startup. The server runs entirely on your machine and supports a read-only audit mode for reviewing stored memory safely.
Prerequisites
- Python 3.9 or later with pipx installed
- Git to clone the repository (or pipx install from the GitHub URL directly)
- An MCP-compatible client: Claude Code, Codex CLI, Gemini CLI, or Claude Desktop
- ~50MB of disk space for the SQLite database (path is configurable)
Install via pipx from GitHub
pipx installs the package in an isolated environment and makes the codex-agent-mem-mcp command available globally without polluting your system Python.
pipx install "git+https://github.com/MarceloCaporale/codex-agent-mem.git"Verify the install and check available commands
Confirm the MCP server entry point and supporting utilities are available on PATH.
codex-agent-mem-mcp --help
codex-agent-mem-smoke --db-path "$HOME/.codex_agent_mem/codex_agent_mem.db"Add to Claude Desktop or Claude Code config
Register the MCP server in your client configuration. The --db-path flag tells the server where to persist the SQLite database. Use --idle-timeout-seconds 1800 for Desktop clients to avoid premature disconnects.
{
"mcpServers": {
"codex-agent-mem": {
"command": "codex-agent-mem-mcp",
"args": [
"--db-path", "/Users/yourname/.codex_agent_mem/codex_agent_mem.db",
"--idle-timeout-seconds", "1800",
"--profile", "standard"
]
}
}
}Optional: enable AGENTS.md sync
Pass --sync-project-doc to have the server automatically reinject an AGENTS.md file from your project root into the context on each session. This is useful for persisting project-level conventions.
codex-agent-mem-mcp \
--db-path "$HOME/.codex_agent_mem/codex_agent_mem.db" \
--sync-project-doc \
--profile fullBootstrap context at the start of each session
At the beginning of a new agent session, call mem_bootstrap_context to load a compact summary of relevant past decisions and open work items. This is the primary token-saving workflow.
Codex Agent Memory Examples
Client configuration
Claude Desktop config entry for codex-agent-mem with standard profile and 30-minute idle timeout.
{
"mcpServers": {
"codex-agent-mem": {
"command": "codex-agent-mem-mcp",
"args": [
"--db-path", "/Users/yourname/.codex_agent_mem/codex_agent_mem.db",
"--idle-timeout-seconds", "1800",
"--profile", "standard"
]
}
}
}Prompts to try
Example prompts for using codex-agent-mem tools in a Claude Code session.
- "Bootstrap context for the payment service project and summarise what you know"
- "Search memory for any past decisions about the database schema"
- "Create a snapshot of the current session state before we refactor the auth module"
- "List all open work items and check which ones are completed"
- "What does the memory health check say about the current database state?"Troubleshooting Codex Agent Memory
pipx install fails with 'could not find a version that satisfies the requirement'
The package is installed directly from GitHub, not PyPI. Make sure you include the full git+ prefix in the URL: pipx install "git+https://github.com/MarceloCaporale/codex-agent-mem.git". If you have SSH set up for GitHub you can also use the SSH URL.
MCP client disconnects after a period of inactivity
Increase the idle timeout by passing --idle-timeout-seconds 1800 (30 minutes) or higher. The default is tuned for CLI usage; Desktop clients need a longer timeout.
mem_search returns no results even though context was stored in a previous session
Confirm --db-path points to the same file in every client config entry. If you have multiple configs using different paths, the databases are separate. Run codex-agent-mem-smoke with the correct db-path to confirm the database contains records.
Frequently Asked Questions about Codex Agent Memory
What is Codex Agent Memory?
Codex Agent Memory is a Model Context Protocol (MCP) server that local-first model context protocol (mcp) memory layer for codex cli/desktop, claude code, gemini cli, qwen/deepseek/ollama and agent workflows. sqlite + fts5 compact context packs, token savings, read-only mode, no external memory server. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Codex Agent Memory?
Follow the installation instructions on the Codex Agent Memory GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Codex Agent Memory?
Codex Agent Memory works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Codex Agent Memory free to use?
Yes, Codex Agent Memory is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.
Codex Agent Memory Alternatives — Similar Knowledge & Memory Servers
Looking for alternatives to Codex Agent Memory? Here are other popular knowledge & memory servers you can use with Claude, Cursor, and VS Code.
MemPalace
★ 52.6kA local AI memory system that stores all conversations verbatim and organizes them into navigable structures. It provides 19 MCP tools for AI assistants to search and retrieve past decisions, debugging sessions, and architecture debates automatically
Kratos
★ 25.7k🏛️ Memory System for AI Coding Tools - Never explain your codebase again. MCP server with perfect project isolation, 95.8% context accuracy, and the Four Pillars Framework.
Context Mode
★ 15.4kAn MCP server that preserves LLM context by intercepting large data outputs and returning only concise summaries or relevant sections. It enables efficient sandboxed code execution, file processing, and documentation indexing across multiple programm
Memu
★ 13.7kMemory for 24/7 proactive agents like OpenClaw.
MemOS
★ 9.3kMemOS (Memory Operating System) is a memory management operating system designed for AI applications. Its goal is: to enable your AI system to have long-term memory like a human, not only remembering what users have said but also actively invoking, u
Everos
★ 5.4kBuild, evaluate, and integrate long-term memory for self-evolving agents.
Browse More Knowledge & Memory MCP Servers
Explore all knowledge & memory servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Codex Agent Memory in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Codex Agent Memory?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.