my-ex
Provides search over local OpenAI Codex session history, allowing coding agents to retrieve relevant past sessions and detailed turns (commands, fixes, and outcomes) for context.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
my-ex
English | 简体中文
Turn your local Codex session history into a searchable memory that a new coding agent can retrieve from — so past work (how a bug was actually fixed, decisions made, project-specific gotchas) isn't lost when you stop using Codex.
Fully local: your session transcripts never leave your machine. This repo only contains the pipeline code; your extracted data and embeddings stay in data/, which is gitignored.
How it works
Two retrieval tiers, built from the same raw source but at different granularity:
Session-level (coarse, cheap to scan)
extract_sessions.py— parse Codex's local rollout files (~/.codex/{sessions,archived_sessions}/**/*.jsonl) into one record per session: first real user request, final agent reply, tool-call names used, project path. Boilerplate (injected environment context, AGENTS.md instructions, plugin suggestions) is stripped so this reflects the actual ask.summarize_sessions.py— compress each session into a short note (task / approach / outcome / gotchas) via a local LLM (qwen2.5:7b-instruct).build_index.py— embed each summary (plus its collapsed tool-call sequence, e.g.exec_command → apply_patch → exec_command) with a local embedding model (bge-m3) intodata/index/{vectors.npy,meta.jsonl}.
Turn-level (detailed, close to verbatim)
extract_turns.py— walk every raw response item and split each session into turns (one user message + everything the agent did in response: its replies, and every tool call with its actual command/input and the output that came back). Internal Codex sub-conversations (its own approval/risk-assessment loop) are filtered out.build_turn_index.py— embed each turn directly (no LLM compression) intodata/index/{turn_vectors.npy,turn_meta.jsonl}.
Retrieve — scripts/search.py (CLI, --detailed flag) or scripts/mcp_server.py (MCP server, detailed param) queries either tier. Any MCP-compatible coding agent (Codex CLI, OpenCode, Goose, Claude Code, ...) can call this to pull relevant past sessions — or the exact commands/fixes from a past turn — into context for a new task.
Neither tier holds the full raw transcript verbatim (that stays in the original ~/.codex rollout files, one file pointer away in every result) — the session tier is an LLM paraphrase, the turn tier is capped-but-largely-verbatim (tool call input/output capped at a few thousand characters each so a handful of huge outputs don't blow up storage).
Related MCP server: vshulcz/deja-vu
Status
Early / personal project, in active use. Both tiers verified end-to-end on ~500 real sessions / ~7,500 turns.
Prerequisites
Python 3.10+ (the MCP SDK needs it; a venv is recommended — see below)
Ollama, running locally, with two models pulled:
ollama pull qwen2.5:7b-instruct # summarization ollama pull bge-m3 # embeddings
Setup
python3.1x -m venv .venv
./.venv/bin/pip install -r requirements.txtUsage
# session-level (coarse)
./.venv/bin/python scripts/extract_sessions.py # ~/.codex -> data/sessions_extracted.jsonl
./.venv/bin/python scripts/summarize_sessions.py # -> data/sessions_summarized.jsonl (resumable)
./.venv/bin/python scripts/build_index.py # -> data/index/{vectors.npy,meta.jsonl}
# turn-level (detailed)
./.venv/bin/python scripts/extract_turns.py # ~/.codex -> data/turns_extracted.jsonl
./.venv/bin/python scripts/build_turn_index.py # -> data/index/{turn_vectors.npy,turn_meta.jsonl}
# query either tier
./.venv/bin/python scripts/search.py "your task description here"
./.venv/bin/python scripts/search.py --detailed "the exact command I used for X"As an MCP server
./.venv/bin/python scripts/mcp_server.pyExposes one tool, search_codex_memory(query, top_k, detailed). Point any MCP-compatible
harness at this command (stdio transport) to give it retrieval access to your
Codex history. Example (Claude Code .mcp.json / similar config shape used by
most MCP clients):
{
"mcpServers": {
"my-ex": {
"command": "/absolute/path/to/my-ex/.venv/bin/python",
"args": ["/absolute/path/to/my-ex/scripts/mcp_server.py"]
}
}
}Or, using the Claude Code CLI directly:
claude mcp add --scope user my-ex -- /absolute/path/to/my-ex/.venv/bin/python /absolute/path/to/my-ex/scripts/mcp_server.pyPrivacy
Nothing in data/ is committed (see .gitignore). Session transcripts can contain private code and business content — do not commit extracted data, summaries, or embedding indexes to this repo.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared memory for coding agents. Stop re-explaining your codebase every session.
Persistent cross-session memory shared by Codex, Claude Code, ChatGPT, and other AI agents.
Your coding agents' past sessions as memory: search them, open the turn, see where agents failed, rules, git blame for session
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
Related MCP Servers
- AlicenseBqualityCmaintenanceProvides local, agentic semantic recall over Claude Code session history, enabling the agent to search past discussions semantically, expand turns, and grep transcripts.513MIT
- AlicenseAqualityAmaintenanceIndexes the session histories Claude Code, Codex CLI and opencode already write into a local searchable memory. MCP recall tools, session-start auto-recall, secret redaction at index time, cross-machine sync over SSH.11,658MIT
- AlicenseNot gradedqualityBmaintenanceEnables searching and reading local Cursor, Claude Code, and Codex session transcripts from any MCP client, with fuzzy, regex, and full-text search, plus optional semantic search.14MIT
- AlicenseAqualityBmaintenanceEnables MCP-capable coding agents to semantically search, store, and inspect a single local, cross-tool index of session histories and project docs. Agents can retrieve what other tools and prior sessions already discovered.31MIT