Codex Memory
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Codex Memory search for memories about the demo project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Codex Memory
Local Markdown-backed memory tools for Codex and other MCP-capable agents.
Codex Memory keeps durable agent knowledge in ordinary Markdown files, builds local indexes for retrieval, and exposes the result through both a CLI and an MCP server. It is designed for local-first use: your memory vault and session transcripts stay on your machine unless you share them yourself.
Features
Markdown memory vault with simple YAML front matter.
CLI commands for
doctor,write,read,search,reindex,hygiene, andweekly-hygiene.MCP tools:
search_memory,read_memory,write_memory,reindex_memory, andmemory_hygiene.Local keyword retrieval with SQLite and an optional Tantivy helper.
Optional semantic retrieval when
CODEX_MEMORY_ENABLE_SEMANTIC=1.Local browser tools for recent sessions, agent monitoring, and report-board drafting.
Codex hook entrypoints for session-start context and stop-time candidate capture.
Related MCP server: Jarvis Markdown MCP
Install
Use Python 3.12 or newer.
python3 -m venv .venv
. .venv/bin/activate
pip install -e .Build the optional Tantivy keyword helper:
cd rust/codex-memory-keyword
cargo build --releaseThe Python implementation still works without the helper, but keyword search is faster after it is built.
Quick Start
Copy the synthetic example vault to a writable location:
cp -R examples/memories /tmp/codex-memory-demoRun the basic workflow:
PYTHONPATH=src python3 -m codex_memory --memory-root /tmp/codex-memory-demo doctor
PYTHONPATH=src python3 -m codex_memory --memory-root /tmp/codex-memory-demo reindex --force
PYTHONPATH=src python3 -m codex_memory --memory-root /tmp/codex-memory-demo search "demo workflow" --status active,risk_pending
PYTHONPATH=src python3 -m codex_memory --memory-root /tmp/codex-memory-demo hygieneCreate a new candidate memory:
PYTHONPATH=src python3 -m codex_memory --memory-root /tmp/codex-memory-demo write \
--title "Demo candidate" \
--body "A short note for later review." \
--keyword CodexConfiguration
Defaults are intentionally home-relative and overrideable:
CODEX_MEMORY_ROOT: memory vault root. Defaults to~/.codex/memories.CODEX_MEMORY_SERVICE_ROOT: source checkout root used to find the optional Rust keyword helper. Defaults to the repository root in editable installs.CODEX_MEMORY_ENABLE_SEMANTIC=1: enables semantic indexing/search.CODEX_MEMORY_TRANSCRIPT_ROOTS: extra transcript roots for session and hook tests, separated by the platform path separator.CODEX_MEMORY_PROJECT_SPECIFIC_TERMS: comma-separated local lint terms used to flag records that should be filed under a concrete project instead of a shared knowledge-base project.
Every CLI command also accepts --memory-root.
MCP Server
Start the MCP server with:
codex-memory-mcpExample MCP client command configuration:
{
"command": "codex-memory-mcp",
"env": {
"CODEX_MEMORY_ROOT": "/absolute/path/to/your/memories"
}
}Available MCP tools:
search_memory(query, project?, type?, status?, limit=5, mode?, diagnostics=false)read_memory(id_or_path)write_memory(record, update_id?)reindex_memory(force=false)memory_hygiene(stale_days=30)
status accepts comma-separated values such as active,risk_pending.
read_memory and write_memory reject absolute paths or .. traversal outside
the configured vault.
Local Browser Tools
All browser tools bind to 127.0.0.1 by default.
PYTHONPATH=src python3 -m codex_memory --memory-root /tmp/codex-memory-demo sessions ui --no-open
PYTHONPATH=src python3 -m codex_memory --memory-root /tmp/codex-memory-demo agents ui --no-open
PYTHONPATH=src python3 -m codex_memory --memory-root /tmp/codex-memory-demo reports ui --no-opensessions uireads recent Codex JSONL transcripts from~/.codex/sessionsand any extraCODEX_MEMORY_TRANSCRIPT_ROOTS.agents uiderives parent/subagent status summaries from local transcripts.reports uisearches the memory vault, lets you select/edit candidate material, and exports Markdown underreport-board-output/.
These tools do not write transcripts, do not call external services, and do not publish a network-facing endpoint unless you explicitly bind them elsewhere.
Hooks
The package exposes two CLI hook commands:
codex-memory --memory-root /absolute/path/to/memories hook-session-start
codex-memory --memory-root /absolute/path/to/memories hook-stophook-session-start ensures the vault layout exists and returns compact startup
guidance. hook-stop reads an allowed local transcript and writes an inbox
candidate only when it sees reusable-experience signals such as blockers,
verified fixes, durable rules, or unresolved risks.
Memory Format
Records are Markdown files with front matter:
---
id: mem-demo-workflow
title: Demo workflow
project: demo-project
type: workflow
status: active
keywords:
- Codex
- demo
source: example
---
# Demo workflow
Use this record as searchable local context.Supported type values are candidate, project_profile, long_term_rule,
issue, build_flow, protocol, script, hardware_risk, and workflow.
Supported status values are candidate, active, risk_pending, and
archived.
Privacy
Do not publish your real memory vault or session transcripts. This repository
contains only code and synthetic examples. See docs/privacy.md for the full
local-data boundary.
Development
Run the Python tests:
PYTHONPATH=src python3 -m unittest discover -s testsRun the Rust helper tests:
cd rust/codex-memory-keyword
cargo testOptional live-vault retrieval checks are skipped unless explicitly enabled:
CODEX_MEMORY_LIVE_GOLDEN=1 CODEX_MEMORY_LIVE_ROOT=/path/to/memories \
PYTHONPATH=src python3 -m unittest \
tests.test_markdown_store.MarkdownStoreTests.test_live_vault_golden_queries_when_enabledLicense
MIT.
Available Tools
5 toolsmemory_hygieneB
Report local memory hygiene issues such as stale candidates and duplicates.
Inputs: stale_days. Returns: object
read_memoryA
Read a local memory record by id or path.
Inputs: id_or_path (required). Returns: object
reindex_memoryC
Rebuild local memory indexes.
Inputs: force. Returns: object
search_memoryA
Search local Codex memory with keyword, semantic, or hybrid retrieval.
Use comma-separated status values such as "active,risk_pending" to search more than one lifecycle state. Set diagnostics=true to return hits plus per-stage timing fields for retrieval performance troubleshooting.
Inputs: query (required), mode, type, limit, +3 more. Returns: result
write_memoryC
Create or update a Markdown memory record.
Inputs: record (required), update_id. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: hygiene, read, reindex, search, and write. No two tools overlap in functionality, ensuring an agent can easily differentiate them.
Four tools follow a consistent verb_noun pattern (read_memory, reindex_memory, search_memory, write_memory), while memory_hygiene uses a noun_noun pattern, causing a minor deviation.
With 5 tools, the server is well-scoped for memory operations. The count feels sufficient without being excessive or insufficient for the domain.
The server covers core read, write, search, and maintenance operations, but lacks a delete tool, which is a notable gap in lifecycle coverage.
Related MCP Connectors
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Hosted MCP memory for coding agents: persistent across sessions, editable markdown, team sharing.
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
Related MCP Servers
- AlicenseAqualityBmaintenanceLocal, searchable project memory for AI coding agents. Markdown source of truth, MCP interface, safe structured updates315Apache 2.0
- AlicenseBqualityDmaintenanceLocal-first memory server for AI coding agents that stores work sessions, tasks, and durable memories in Markdown files, exposed through MCP tools for session management and memory retrieval.101MIT
- AlicenseNot gradedqualityDmaintenanceLocal-first Knowledge Management System that exposes markdown-based durable memory as MCP tools for Codex and ChatGPT, enabling search, read, write, and promotion workflows with project and global scopes.MIT
- AlicenseNot gradedqualityDmaintenanceProvides persistent, local-first memory for coding agents with Markdown as the source of truth, exposed via CLI, loopback API, MCP, and Codex hooks for context retrieval and durable writes.MIT