Automatic persistent memory for Codex CLI. Every conversation turn is summarized and indexed — your next session picks up where you left off.
- Codex CLI v0.116.0+
- Python 3.10+
# 1. Install memsearch
uv tool install "memsearch[onnx]"
# 2. Clone the repo and run the installer
git clone https://github.com/zilliztech/memsearch.git
cd memsearch
bash plugins/codex/scripts/install.shThe installer sets up everything automatically:
- Copies the memory-recall skill to
~/.agents/skills/ - Installs or updates memsearch hook entries in
~/.codex/hooks.json - Enables the
hooksfeature flag
Start Codex with a full-access mode so hooks can run and the ONNX model can download on first use:
codex --dangerously-bypass-approvals-and-sandboxWhy full access? The ONNX embedding model needs network on first run to download from HuggingFace (~100 MB). After that it's cached locally. Codex's default sandbox blocks network, which prevents model download and can interfere with hook-launched shell commands. On current Codex builds,
--dangerously-bypass-approvals-and-sandboxis the explicit full-access flag. Some builds may also accept the older--yoloalias.
Pre-cache the model (optional) — run once so subsequent sessions work even if you later tighten sandboxing:
memsearch search "test" --collection test_warmup 2>/dev/null; memsearch reset --collection test_warmup --yes 2>/dev/null| When | What |
|---|---|
| Session starts | Recent memory context is injected; you'll see [memsearch v...] in the status line |
| Each prompt | A [memsearch] Memory available hint reminds Codex that memory-recall is available |
| Each turn ends | The conversation is summarized and saved to a daily .md file |
Use the $memory-recall skill:
$memory-recall what did we discuss about batch size limits?
Codex will search your memory, expand relevant results, and return a curated summary. The skill uses three-layer progressive disclosure:
- Search —
memsearch searchfinds relevant chunks by semantic + keyword hybrid search - Expand —
memsearch expandretrieves the full markdown section around a match - Deep drill — when rollout anchors are available, optionally parses the original Codex rollout transcript for exact conversation context
Default is onnx (bge-m3) — runs locally, no API key needed.
# Switch to OpenAI embeddings (requires OPENAI_API_KEY)
memsearch config set embedding.provider openai
# Switch back to local ONNX
memsearch config set embedding.provider onnxDefault is Milvus Lite (local .db file). For larger memory stores or team sharing:
# Use a remote Milvus server
memsearch config set milvus.uri http://localhost:19530The Stop hook uses its built-in Codex summarize model by default. To override only this plugin's native capture model:
memsearch config set plugins.codex.summarize.model gpt-5.1-codex-miniTo use a memsearch-managed API provider instead:
memsearch config set llm.providers.openai.type openai
memsearch config set llm.providers.openai.model gpt-5-mini
memsearch config set llm.providers.openai.api_key env:OPENAI_API_KEY
memsearch config set plugins.codex.summarize.provider openaiLeave plugins.codex.summarize.provider empty or set it to native to keep the current default. This setting does not fall back to llm.model.
Each project stores memory under <project>/.memsearch/memory/:
.memsearch/memory/
├── 2026-03-20.md
├── 2026-03-21.md
└── 2026-03-24.md
These are plain markdown files — human-readable, editable, and version-controllable. Milvus is a derived index that can be rebuilt anytime from these files.
Remove only memsearch's hook entries from ~/.codex/hooks.json so unrelated Codex hooks stay intact. The safe uninstall steps are documented in docs/platforms/codex/installation.md.
cd memsearch
git pull
bash plugins/codex/scripts/install.sh