memex
Provides a local-first persistent memory layer for OpenAI's Codex CLI, enabling conversation archiving/search, durable fact extraction and reconciliation, knowledge graph traversal, and relevance-gated context injection into Codex sessions.
Click on "Install 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., "@memexSearch my past Codex sessions for the API design discussion from last week"
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.
Memex
A local-first long-term memory layer for Codex: collect conversations, distill durable facts, connect them, and bring the right context back when it matters.
Memex turns local Codex session history into a searchable conversation archive, durable facts, a scoped knowledge graph, and bounded context that can be recalled in later work.
It is designed as a memory system, not a second agent. Codex remains the working agent; Memex provides the persistent layer around it.
한국어 README · Documentation · Operations guide · Architecture · Verification
What Memex does
Memex builds several layers from your local Codex history:
Conversation archive — preserves searchable snapshots of Codex rollouts without modifying the originals.
Hybrid retrieval — semantic vector search plus FTS5/BM25 text search.
Durable facts — extracts reusable decisions, preferences, patterns, knowledge, and constraints.
Fact evolution — tracks duplicate consolidation, contradictions, revisions, deactivation, restoration, and provenance.
Knowledge graph — classifies facts into domains/categories and creates typed relations.
Context recall — injects small, relevance-gated memory blocks into later Codex prompts.
MCP tools and skills — exposes conversations, facts, graph traversal, provenance, and analysis to Codex.
Local Web UI — provides conversation browsing, fact management, pipeline health, and a 3D Knowledge Galaxy.
Multi-device durable sync — reconciles fact state across devices without syncing local derived overlays.
Memex is intentionally local-first. Source Codex rollouts remain read-only, and the primary database, indexes, derived graph, and operational logs live under the local Memex data root.
Related MCP server: codex-memory-mcp
Architecture
flowchart TB
subgraph Codex[Codex]
Rollouts[Session rollouts]
Hooks[Lifecycle hooks]
MCP[MCP + skills]
end
subgraph Core[Memex core]
Archive[Archive / index]
Extract[Fact extraction]
Reconcile[Fact reconciliation]
Retrieve[Retrieval / injection]
Graph[Ontology / relations]
end
subgraph Durable[Durable state]
Facts[(Facts)]
Revisions[(Fact revisions)]
Tombstones[(Fact tombstones)]
Recall[(Recall receipts)]
end
subgraph Local[Local derived state]
Exchanges[(Conversation index)]
Vectors[(FTS / vectors)]
KR[(KR translations)]
Ontology[(Ontology / relations)]
end
Rollouts --> Archive
Archive --> Exchanges
Exchanges --> Extract
Extract --> Facts
Facts --> Reconcile
Reconcile --> Revisions
Reconcile --> Tombstones
Facts --> Graph
Graph --> Ontology
Facts --> Vectors
Facts --> KR
Exchanges --> Retrieve
Facts --> Retrieve
Ontology --> Retrieve
Retrieve --> Hooks
Retrieve --> MCP
Hooks --> RecallFact state model
Sync protocol v4 separates fact state into independent axes:
Axis | Examples | Merge rule |
Semantic | fact text, category, scope | semantic event clock + deterministic tie-break |
Lifecycle | active / inactive | lifecycle event clock; inactive wins exact ties |
Lineage | source exchange IDs, consolidated count | monotonic union / max |
Derived overlay | KR text, ontology, relations, vectors | local-only, rebuildable |
This separation matters because editing a fact and deactivating it are different events. A newer semantic edit must not accidentally undo a newer deactivation, and provenance must never disappear just because another device has an older snapshot.
Multi-device sync therefore carries only durable state:
facts
fact revisions
fact tombstones
recall eventsKR translations, ontology categories, relations, and vector indexes are rebuilt locally.
See Architecture, Fact lifecycle, and Conversation lifecycle for the full contracts.
Requirements
Node.js 22.15+
An authenticated Codex CLI
macOS or Linux for the current hook / Unix-socket runtime
Memex uses native SQLite, vector, and embedding dependencies. The installed plugin launches the runtime through an isolated npm cache; it does not install dependencies into your project or require a source checkout for normal use.
Install
Recommended public installation:
codex plugin marketplace add BongSuCHOI/memex
codex plugin add memex@memexRestart Codex after installation so new hooks, skills, and the MCP server are loaded.
If you also want the memex command available directly in your terminal, install the lightweight CLI shim once:
npx --yes --package=github:BongSuCHOI/memex#main memex setup --install-cliThis creates ~/.local/bin/memex; it is not a global npm install.
For local marketplace development and source-based validation, see the operations guide.
First-time setup
Prepare the existing Codex history:
memex setup
memex sync
memex backfill all
memex statusWhat these commands do:
memex setupchecks for conflicts with Codex built-in Memory. Memex never disables it without explicit approval.memex syncreads$CODEX_HOME/sessions, archives eligible rollouts, and builds the conversation corpus.memex backfill allruns durable fact extraction, ontology classification, and missing semantic embedding work.memex statusreports readiness and remaining backlog.
All backfill stages are designed to be idempotent.
Optional Korean fact translations
fact_kr is local derived state and is intentionally not synced or automatically generated on every session. This avoids paying translation-model cost during normal lifecycle hooks.
For a source checkout, translations can be filled manually:
node scripts/translate-facts.mjsThe script records translations only if the fact meaning is unchanged since the translation request began. KR vectors are then created by the normal re-embedding maintenance path.
Daily use
memex search "why did we choose SQLite?"
memex search --both "authentication migration"
memex facts list
memex stats
memex analyze --top 30 --out ~/memex-report.md
memex statusCommon commands:
Command | Purpose |
| Archive and index new Codex rollouts |
| Semantic, text, or hybrid conversation search |
| Read one archived conversation |
| Inspect corpus/index statistics |
| Generate a deterministic history report |
| Inspect and manage durable facts |
| Run extraction / ontology / embedding backlog work |
| Inspect pipeline readiness |
| Diagnose runtime, plugin, MCP, and lifecycle state |
| Refresh the marketplace/plugin while preserving data |
Fact management includes edit, deactivate, restore, history, and guarded hard-delete operations. Semantic edits keep fact identity and revision history while invalidating stale derived state.
See GUIDE.md for the complete CLI and lifecycle reference.
Automatic lifecycle
Memex integrates with three Codex lifecycle events:
Event | Memex behavior |
SessionStart | version drift check, background sync, durable sync import, bounded maintenance |
UserPromptSubmit | scoped retrieval, relevance gate, deduplication, bounded context injection |
SessionEnd | rollout stabilization, incremental fact extraction, durable sync export |
SessionStart jobs are intentionally asynchronous and eventually consistent. Each writer is responsible for its own transaction/CAS safety; Memex does not depend on one fixed completion order.
MCP tools and skills
Memex exposes nine MCP tools:
search
read
search_facts
search_ontology
ask_avatar
trace_fact
explore_graph
cross_project_insights
graph_statsProject-sensitive tools require either:
a canonical absolute project path,
scope: global, orscope: all.
The MCP server never infers project identity from its own process cwd.
Three bundled Codex skills cover:
remembering conversations,
analyzing all conversations,
opening the Memex dashboard.
See MCP and skills.
Web UI and Knowledge Galaxy
Start the local UI:
npx --yes --package=github:BongSuCHOI/memex#main memex-uiThen open:
http://localhost:3847Main routes:
/— projects, conversations, search, exchange details/facts— facts, revisions, provenance, mutations/graph— scoped 3D knowledge graph/pipeline— indexing/backfill readiness
The server binds to loopback only. Fact mutations use the same transactional service as the CLI.
See Visualization.
Scope and provenance
Memex treats the canonical absolute session_meta.cwd as project identity.
Supported fact/query scopes are:
project — the selected project plus global facts where appropriate
global — global facts only
all — explicit cross-project access
Cross-project leakage is prevented at query, import, traversal, and relation-write boundaries.
Fact provenance is built from exact source exchange IDs. Lineage is monotonic across sync: source IDs are unioned and consolidated counts take the maximum rather than allowing an older peer to erase evidence.
Recall without self-training loops
Recalled memory must not become fresh evidence merely because Codex repeated it.
Memex therefore distinguishes:
human assertions,
trusted local repository / Git / test observations,
external or unverifiable tool output,
Memex recall,
assistant-generated synthesis.
Memex recall and assistant synthesis remain searchable but are not treated as new durable fact evidence. This prevents a feedback loop such as:
old fact
→ recalled into prompt
→ assistant repeats it
→ repeated text extracted as a "new" factRecall events are recorded as durable provenance receipts before context is emitted.
See Retrieval and context and Fact lifecycle.
Privacy and exclusion
A user-role DO NOT INDEX marker excludes the whole conversation from the Memex knowledge corpus.
The privacy purge removes or invalidates:
exchanges and tool-call index state,
FTS/vector rows,
extraction/recall processing state,
facts that used the excluded conversation as evidence,
fact-derived revisions/relations/vectors,
local taxonomy derived from the previous corpus.
Facts removed for conversation exclusion receive a terminal privacy tombstone so an older device snapshot cannot resurrect them.
Taxonomy is local derived state. After a privacy purge it is invalidated and surviving public facts are reclassified from the remaining evidence.
Data location
Default data root:
~/.config/memex/Resolution order:
MEMEX_HOME$XDG_CONFIG_HOME/memex~/.config/memex
Typical layout:
~/.config/memex/
├── conversation-archive/
├── conversation-index/
│ ├── db.sqlite
│ ├── sync/
│ └── logs/
└── logs/The original $CODEX_HOME/sessions rollouts are always treated as read-only input.
Use:
memex home
memex home --jsonbefore deleting or moving Memex data.
Multi-device sync
Protocol v4 exports one committed generation per local device.
Each generation contains:
facts.jsonl
fact-revisions.jsonl
fact-tombstones.jsonl
recall-events.jsonl
meta.jsonmeta.json records the protocol version, device/generation identity, row counts, and SHA-256 integrity for each payload file.
Imports pin and validate an entire generation before mutating SQLite. Missing files, hash mismatches, invalid JSON, or schema-invalid rows reject that device generation as a whole.
Local exporters are serialized with SQLite's process-owned BEGIN IMMEDIATE transaction, so a slower export cannot move CURRENT back to an older snapshot and no cloud-synced lockfile is required.
Verification
The repository keeps the release gate separate from implementation commits.
The current verified code baseline is recorded in:
docs/verification/merge-gate.jsonThe latest audit-remediation gate was run from the clean committed code SHA:
70f2ea4998941d8c185b53891f33e10e55728ccaObserved gate results:
Typecheck PASS
Build PASS
Vitest 68 files / 598 tests PASS
Codex slice 23 / 23 PASS
All Node slices 91 / 91 PASS
Install E2E PASS
Marketplace E2E PASS
Package runtime E2E PASS
Lifecycle E2E PASSThe receipt itself lives in the following receipt-only commit, so runtime code is unchanged after the verified SHA.
For the full acceptance model, version boundaries, and retained machine receipts, see Verification.
Documentation
The documentation set is organized by ownership rather than as one large manual:
Document | Covers |
installation, onboarding, CLI, lifecycle, uninstall | |
system boundaries and end-to-end flow | |
rollout parsing, archive/index, sync protocol | |
extraction, consolidation, semantic/lifecycle state | |
ontology, relations, traversal | |
search, RAG, context injection | |
SQLite schema and transaction invariants | |
MCP tools and bundled skills | |
Web UI and Knowledge Galaxy | |
tests, E2E gates, release evidence | |
upstream attribution and project lineage |
Start with docs/README.md for the documentation map.
Contributing
For development:
git clone https://github.com/BongSuCHOI/memex.git
cd memex
npm ci
npm run build
npm testRead AGENTS.md before changing behavior. It defines repository invariants, verification rules, and documentation ownership.
When a public command, persisted field, lifecycle rule, MCP schema, or release contract changes, update its owner document in the same change.
Project lineage
Memex is an independent Codex-native project derived from the MIT-licensed:
It preserves the knowledge-system ideas while replacing the previous host adapter with Codex-native rollout, hook, plugin, MCP, and model-execution contracts.
See LINEAGE.md and THIRD_PARTY_NOTICES.md.
License
MIT. See LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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.
Personal wiki and memory layer for AI assistants. Persistent, structured memory across sessions.
Persistent knowledge graph for AI-augmented teams. Store decisions, findings, and standing rules across agent sessions with semantic search and typed connections. Includes cross-session memory, audit trail, workspace isolation, and secret detection. Built for teams running agents that need to remember.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceLocal memory search for Codex and Claude Code conversations. It keeps history on your machine, builds a local graph index, and returns compact evidence from past sessions.5MIT
- FlicenseNot gradedqualityCmaintenanceLocal-first, durable knowledge-card RAG for Codex, enabling search, retrieval, and maintenance of reusable experience cards.
- AlicenseNot gradedqualityBmaintenanceProvides a local long-term memory layer for AI coding tools like Cursor and Claude Code, enabling cross-session, cross-tool sharing of project facts, user preferences, decisions, and workflows.252MIT
- AlicenseNot gradedqualityBmaintenanceEnables local-first knowledge management for Codex, providing tools for guided discussions, contextual recall, review, and daily topics.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BongSuCHOI/memex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server