Cut context tokens by 99.84% and reach first memory context in ~60 ms (median local benchmark).
Codex-native persistent memory with progressive retrieval, local viewer UX, and MCP-ready integration.
Quick Start • Comparison • Release Notes • Docs
Benchmark source:
Most coding assistants lose operational memory between sessions.codex-mem makes new Codex sessions feel continuous by capturing lifecycle evidence, retrieving context progressively, and fusing memory with live repository facts.
North star:
- less repeated explanation
- less wasted context tokens
- more accurate follow-up reasoning from real prior work
This repository only keeps real product captures.
No placeholder GIFs or synthetic marketing screenshots are included.
- five hooks:
session-startuser-prompt-submitpost-tool-usestopsession-end
- automatic session summary observations at close
- Layer 1:
search/mem-search(compact shortlist) - Layer 2:
timeline(temporal neighborhood) - Layer 3:
get-observations(full details by selected IDs)
askcombines memory shortlist with code context fromrepo_knowledge.py
- built-in natural-language search (
nl-search/mem-search) - local web viewer (stream, summary, search, config)
- runtime channel config (
stable/beta) - endless-mode style auto-compaction in beta
- dual-tag privacy model (
--tag,--privacy-tag)
- MCP server with
mem_*tools - skill package for reusable retrieval workflow
- CLI wrapper for repeatable operations
| Capability | codex-mem | Basic session-only chat memory | Codex-Mem target parity with Claude-Mem-style workflow |
|---|---|---|---|
| Cross-session persistence | ✅ Local SQLite + FTS + vectors | ❌ | ✅ |
| 3-layer progressive retrieval | ✅ | ❌ | ✅ |
| Natural-language memory query | ✅ mem-search |
❌ | ✅ |
| Real-time local web viewer | ✅ | ❌ | ✅ |
| Stable/Beta runtime switch | ✅ | ❌ | ✅ |
| Endless-style compaction mode | ✅ (beta) | ❌ | ✅ |
| Dual-tag privacy controls | ✅ semantic + policy tags | ❌ | ✅ |
| MCP tool surface for Codex | ✅ | ❌ | ✅ |
| Smoke-testable install validation | ✅ | ❌ | ✅ |
See full history in RELEASE_NOTES.md.
Highlights in v0.3.0:
- launch asset production toolkit (
Assets/LaunchKit/) - CI asset gate (
.github/workflows/asset-gate.yml) - mem export surface (
export-session,mem_export_session) - web viewer upgrades (PRD caption copy + recording guide mode)
- launch automation scripts (
make_gifs,validate_assets,social_pack,snapshot_docs) - benchmark + roadmap + compatibility + security documentation set
Every release batch follows one fixed package:
- Release Notes update
- 3 GIFs (
gif_01,gif_02,gif_03) - 3 final screenshots
- 1 comparison table update in README
Reference:
bash Scripts/codex_mem.sh init --project demo
bash Scripts/codex_mem.sh session-start s1 --project demo --title "Streaming refactor"
bash Scripts/codex_mem.sh prompt s1 "Map end-to-end generation and persistence path" --project demo
bash Scripts/codex_mem.sh tool s1 shell "rg -n 'HomeStreamOrchestrator'" --project demo --title "Locate orchestrator" --compact
bash Scripts/codex_mem.sh stop s1 --project demo --content "checkpoint"
bash Scripts/codex_mem.sh session-end s1 --project demo
# Layer 1 compact search
bash Scripts/codex_mem.sh search "orchestrator streaming" --project demo --limit 20
# Layer 1 natural-language search
bash Scripts/codex_mem.sh mem-search "what bugs were fixed this week" --project demo --limit 20
# Layer 2 timeline
bash Scripts/codex_mem.sh timeline E12 --before 5 --after 5
# Layer 3 full details
bash Scripts/codex_mem.sh get E12 O3
bash Scripts/codex_mem.sh ask "What is the current generation chain from input to persisted output?" --project demo
Start:
bash Scripts/codex_mem.sh web --project-default demo --host 127.0.0.1 --port 37777
Open:
Viewer panels:
- real-time memory stream
- session summaries
- NL mem-search results
- runtime mode controls (
stable/beta, refresh interval, endless mode)
post-tool-use supports two tag lanes:
- semantic tags:
--tag - privacy policy tags:
--privacy-tag
Policy behavior:
- block write:
no_mem,block,skip,secret_block
- private visibility:
private,sensitive,secret
- redact sensitive values:
redact,mask,sensitive,secret
Example:
bash Scripts/codex_mem.sh tool s1 shell "credential=" --project demo \
--tag auth \
--privacy-tag private \
--privacy-tag redact
Default retrieval hides private records unless --include-private is passed.
Read:
bash Scripts/codex_mem.sh config-get
Set:
bash Scripts/codex_mem.sh config-set --channel beta --viewer-refresh-sec 2 --beta-endless-mode on
Mode behavior:
stable: compaction only when explicitly requested (--compact)beta+ endless modeon: auto-compaction for high-volume tool outputs
Run:
python3 Scripts/codex_mem_mcp.py --root . --project-default demo
Register with Codex:
codex mcp add codex-mem -- python3 /ABS/PATH/codex-mem/Scripts/codex_mem_mcp.py --root /ABS/PATH/codex-mem --project-default demo
Retrieval:
mem_searchmem_nl_searchmem_timelinemem_get_observationsmem_ask
Runtime config:
mem_config_getmem_config_set
Lifecycle:
mem_session_startmem_user_prompt_submitmem_post_tool_usemem_stopmem_session_endmem_summarize_sessionmem_export_session
Scripts/codex_mem.pycore engine and CLIScripts/codex_mem_mcp.pyMCP serverScripts/codex_mem_web.pylocal web appScripts/codex_mem_smoketest.pyend-to-end simulationScripts/repo_knowledge.pyrepository context retrievalScripts/make_gifs.shmedia pipeline (source -> webm/gif/poster)Scripts/validate_assets.pyasset + README gate checksScripts/load_demo_data.pyone-click demo dataset loaderScripts/redact_screenshot.pyOCR-based screenshot redactionScripts/generate_social_pack.pyX/Reddit/Product Hunt copy pack generatorScripts/compare_search_modes.pysearch vs mem-search comparison runnerScripts/snapshot_docs.shrelease snapshot utilitySkills/codex-mem/skill packageDocumentation/deep operational docs
Run one command:
python3 Scripts/codex_mem_smoketest.py --root .
Smoke test verifies:
- lifecycle capture
- NL mem-search
- privacy block/private/redact handling
- stable/beta config updates
- web APIs
- MCP tool registration and calls
# 1) load sanitized recording dataset
bash Scripts/load_demo_data.sh --reset
# 2) render GIF bundle from source clips
bash Scripts/make_gifs.sh --fps 12 --width 1200
# 3) validate media + README links
python Scripts/validate_assets.py --check-readme --strict
# 4) snapshot docs/media per release
bash Scripts/snapshot_docs.sh v0.3.0
# 5) generate social copy pack
python Scripts/generate_social_pack.py --version v0.3.0
Token reduction comes from retrieval discipline:
- compact shortlist first
- timeline around selected IDs only
- full payload fetch only for shortlisted IDs
- bounded repo context for fused ask
- optional/automatic output compaction for verbose tool logs
Primary channels:
- GitHub repo + releases
- MCP + Skills setup snippets in docs
Additional channels beyond GitHub/X:
- Product Hunt
- Hacker News (
Show HN) - Dev.to, Medium/Substack technical posts
- Reddit engineering communities
- Discord/Slack AI engineering communities
- Branch from
codex/init - Keep changes local-first and deterministic
- Update docs with runnable examples
- Run
python3 Scripts/codex_mem_smoketest.py --root . - Include smoke output summary in PR
No explicit open-source license file is included yet.
Add one before broad redistribution.