memex
The memex server provides AI coding agents with persistent, bitemporal graph-based memory of a codebase, enabling context-aware assistance across sessions and agents.
Read & Discovery
get_project_context/get_context_briefing— Get a compressed, token-budgeted briefing of active modules, recent decisions, and open problemsget_symbol_context— Look up detailed info about a specific function or class, including callers, callees, and linked decisionsget_recent_decisions— Retrieve architectural/technical decisions from the past N days, optionally filtered by moduleget_open_problems— List active bugs and tech debt sorted by severity, optionally scoped to a modulesearch_context— Run hybrid semantic + keyword + graph traversal search across all node typesget_stale_context— Surface relationships whose confidence has decayed and may be outdated
Analysis & Impact
explain_change— Cross-reference a git commit diff with linked Decision/Problem nodes to generate a grounded explanationpredict_impact— Get a ranked list of modules likely affected by changes to a given file, based on graph coupling (no LLM call)
Write & Governance
record_decision— Create a Decision node for an architectural choice; supports corroboration, supersession, and duplicate-bypassrecord_problem— Log a bug or tech debt as a Problem node with a severity level (critical/high/medium/low)resolve_problem— Mark a tracked problem as closed with a resolution explanationinvalidate_edge— Explicitly expire a graph edge when a stored fact is no longer true
Serves as the storage backend for the temporal knowledge graph, enabling bitemporal fact management with confidence decay and hierarchical clustering of repository modules.
memex — temporal knowledge graph memory for AI coding agents
Persistent memory and codebase context for AI coding agents, served over MCP. A bitemporal knowledge graph of your repository — modules, symbols, decisions, problems — for Claude Code, Cursor, Codex, Gemini CLI, and any MCP-compatible agent.
A daemon and MCP server that turns every commit and every file change into structured graph state: modules, symbols, decisions, problems, lockfile facts. Sessions stop starting blind. Agents stop re-discovering the same refactor every time you /clear.

flowchart LR
A[Your repository<br/>files + git] --> B[memex watcher<br/>tree-sitter + Gemini]
B --> C[Neo4j graph<br/>bitemporal facts]
C --> D[MCP server<br/>stdio / HTTP]
D --> E[AI agent<br/>Claude · Cursor · Codex · Gemini CLI]
E -.->|writes decisions back| C
style B fill:#cfe8ff,stroke:#0066cc,color:#000
style C fill:#fff4cf,stroke:#cc9900,color:#000
style E fill:#d4f5d4,stroke:#2d8f2d,color:#000Install
Via Claude Code marketplace
/plugin marketplace add STiFLeR7/claude-plugins
/plugin install memex-mcp@stifler-marketplaceRestart your Claude Code session.
Manual
docker compose -f docker/docker-compose.yml up -d
cat > .env <<EOF
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=memex-local
GEMINI_API_KEY=your-key-here
EOF
npx stifler-memex-mcp init --repo .
npx stifler-memex-mcp watch --repo .
npx stifler-memex-mcp serve --repo .Channel | Command |
Claude Code marketplace |
|
npx (no install) |
|
uv |
|
pip |
|
source |
|
Self-hosted team deployment
For a shared team setup (one Neo4j + one memex-server, auth on by default, Neo4j's ports never exposed to the host):
bash docker/bootstrap-team-env.sh
docker compose -f docker/docker-compose.team.yml up -dSee docker/TEAM-DEPLOY.md for the full flow, capturing the
initial admin key, and the down -v footgun to avoid.
Related MCP server: m1nd
At a glance
Property | Value |
Output | A Neo4j graph populated continuously from your repo |
Storage | Neo4j via Graphiti. Bitemporal — every edge has |
Survives |
|
Hands off to | Claude Code, Cursor, Codex, Gemini CLI, any MCP client |
Granularity | Scales from 50 to 5000+ modules via hierarchical Leiden clusters |
Synthesis | Gemini Flash distills commits into |
Confidence | Computed at query time. Two-regime decay (validated half-life ~139d, unvalidated stale at 30d) |
Write governance | Per-node-type ACL, intent-confirmation on agent writes, explicit |
Tests | 333 passing, ~93% coverage |
The lifecycle
flowchart TD
Init[memex init<br/>extract baseline] --> Watch[memex watch<br/>daemon + git hooks]
Watch -->|commit| Extract[tree-sitter extract<br/>symbols, imports, lockfile]
Extract --> Synth[Gemini Flash<br/>diff → Decision nodes]
Synth --> Write[Graphiti add_episode<br/>+ post-hoc bitemporal SET]
Write --> Decay[Scheduler<br/>nightly confidence decay]
Decay -->|stale edges| Archive[expired_at = now]
Serve[memex serve<br/>MCP stdio/HTTP] -.->|reads| Write
Agent[AI agent] -->|14 MCP tools| Serve
Serve -->|record_decision / record_problem| Write
Cluster[memex cluster<br/>Leiden over hybrid edges] -.->|every N commits| Write
style Init fill:#e8f4ff,color:#000
style Watch fill:#fff4cf,color:#000
style Synth fill:#ffe0cc,color:#000
style Serve fill:#d4f5d4,color:#000MCP tools
14 tools — eight read, four write, two analytic.
Read
Tool | When |
| Session start. Returns a cluster-level briefing under 1500 tokens regardless of repo size |
| Before editing a function or class. Returns callers, callees, linked decisions |
| Last N days of architectural decisions, optionally module-scoped |
| Active bugs and tech debt, sorted by severity |
| Hybrid search: semantic × keyword × graph traversal × RRF merge |
| Edges whose composite confidence dropped below threshold |
| Given a commit SHA, cross-references the diff with linked Decision/Problem nodes and asks Gemini Pro for a grounded explanation |
| Given a file path, returns a ranked list of modules likely affected based on graph coupling (no LLM call) |
Write
Tool | When |
| After making a technical choice. Supports |
| When discovering a bug or piece of tech debt |
| When a tracked problem is fixed |
| When a stored fact is no longer true |
Bitemporal confidence
Confidence is not a stored number that mutates. It is computed at query time from base_confidence, validation status, time since last reinforcement, and access count.
flowchart LR
Edge[Edge created<br/>base_confidence] --> Q{Validated by<br/>a human?}
Q -->|yes| Slow[Slow regime<br/>half-life ~139d]
Q -->|no| Fast[Fast regime<br/>stale at exactly 30d]
Slow --> Score[Composite score<br/>conf × recency × rehearsal]
Fast --> Score
Score -->|below floor| Stale[get_stale_context surfaces it]
Score -->|access| Bump[last_reinforced_at updated]
Bump --> Score
style Slow fill:#d4f5d4,color:#000
style Fast fill:#ffd4d4,color:#000Property | Value |
Validated half-life | ~139 days |
Unvalidated stale threshold | 30 days (composite < 0.3) |
Recency τ | 90 days (exponential decay) |
Composite formula |
|
Conflict similarity threshold | 0.4 (below this + overlapping validity = conflict) |
Intent-confirmation threshold | 0.85 (MCP write similarity check) |
Hierarchical clusters
memex cluster runs hierarchical Leiden over a hybrid edge graph:
Edge type | Weight |
Directory co-location | 1.0 |
Module imports | 2.0 |
Symbol calls |
|
Property | Value |
Algorithm |
|
Naming | TF-IDF top-3 over module docstrings + symbol names, parent-dir fallback |
ID pinning | Jaccard ≥ 0.5 across reruns (cluster names stay stable through renames) |
User overrides |
|
Context budget |
|
Measure Your Savings
memex tracks token reduction metrics and human review actions locally in a SQLite database (~/.config/memex/telemetry.db).
You can query your savings at any time using the CLI:
memex statsOr view the raw JSON payload:
memex stats --jsonOr target a specific repository scope:
memex stats --repo /path/to/repoThis returns an aggregation of:
Period Summaries: Calls, tokens returned, naive tokens (size of files requested), tokens saved, and token reduction percentage across
today,last 7 days,last 30 days, andlifetime.Top Tools: The most valuable tools sorted by total tokens saved.
Agent Clients: Active agents (Claude Code, Gemini CLI, Cursor, Codex) and their token saving distribution.
Validation Health: Total validated, unvalidated, and corroborated nodes, along with the elapsed days since the last review.
The same statistics are exposed via the HTTP MCP transport:
GET /stats?repo=/path/to/repo
Authorization: Bearer <your-key>Connect your agent
Marketplace install above does this for you. Manual wiring in .claude/settings.json:
{
"mcpServers": {
"memex": {
"type": "stdio",
"command": "npx",
"args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
}
}
}Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"memex": {
"command": "npx",
"args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
}
}
}Add to ~/.gemini/settings.json:
{
"mcpServers": {
"memex": {
"command": "npx",
"args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
}
}
}Add to ~/.codex/config.toml:
[mcp_servers.memex]
command = "npx"
args = ["-y", "stifler-memex-mcp", "serve", "--repo", "."]memex can back Claude's native memory tool — agents read from a per-session graph projection plus a writable scratch zone.
memex memory-tool serve --repo . # in-process
memex memory-tool serve --repo . --transport http # FastAPI on :7464from memex.memory_tool import MemexAsyncMemoryTool
memory_tool = MemexAsyncMemoryTool(repo_root=".")
client.beta.messages.run_tools(..., tools=[memory_tool])Operating principles
# | Principle | The bet |
1 | Bitemporal, never destructive | Edges are expired, not deleted. |
2 | Confidence is computed, not stored | Mutating a number invites silent drift. Recompute every read |
3 | Two regimes for decay | Validated facts decay slowly; unvalidated facts must earn their place by being accessed |
4 | Human in the loop |
|
5 | Write governance | Per-node-type ACL. |
6 | Tokens are budgeted |
|
7 | Synthesis only on commits | The watcher batches by debounce window. Gemini Flash is not in the hot path of a tool call |
8 | Pro for synthesis, Flash for extraction |
|
9 | Multi-repo aware | One watcher + one MCP server can manage hundreds of repos. |
10 | Local-first | Neo4j runs in your Docker. Gemini is the only outbound call, and only on commits |
When to use memex
Use it when | Skip it when |
Multi-week or multi-month project | One-shot script, throwaway prototype |
You work across multiple agents (Claude, Cursor, Codex) and want shared context | You only ever pair with one agent on one task |
Architectural decisions are made over time and need to be remembered | The whole project fits in a single 200k-token context window |
You want to query "what did we decide about X" from any session | Your repo is already small enough to paste into the prompt |
Multiple developers using AI agents on the same codebase | Solo work where you never |
Project structure
memex/
├── memex/
│ ├── extractor/ tree-sitter + lockfile parsers
│ ├── graph/ Neo4j writes, confidence, archive, cluster engine
│ ├── synthesizer/ Gemini Flash → Decision nodes
│ ├── mcp_server/ 14 MCP tools (read + write + analytic)
│ ├── memory_tool/ Anthropic memory_20250818 adapter
│ ├── watcher/ daemon + git hooks
│ └── cli.py init / watch / serve / review / graph / cluster
├── tests/ 333 passing, ~93% coverage
├── docker/ Neo4j compose
├── npm/ npx wrapper (publishes as stifler-memex-mcp)
└── Dockerfile introspection-only image for MCP directory sandboxesCommands
Command | What it does |
| Extract baseline graph state, run first cluster pass |
| Daemon that listens for file + git events and writes to Neo4j |
| Run the MCP server (stdio, HTTP, or both) |
| TUI that walks lowest-confidence decisions for human validation |
| Self-contained D3 force layout with cluster overlays |
| Run Leiden over the hybrid edge graph; pin cluster IDs by Jaccard ≥ 0.5 |
| Back Anthropic's |
| Show context token savings and telemetry stats |
License
MIT. See LICENSE.
Author
Hill Patel (@STiFLeR7)
Core Contributors & Maintainers
Hill Patel (@STiFLeR7) — architect, maintainer
Nirvaan Lagishetty (@Nirvaan05) — lead contributor, maintainer
Contributing
Open an issue or PR. uv sync --all-extras && uv run pytest tests/ is all the setup you need to run the suite. Version bumps must update both pyproject.toml and npm/package.json and they must agree.
Vannevar Bush, 1945: "Consider a future device for individual use, which is a sort of mechanized private file and library. It needs a name, and to coin one at random, memex will do."
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 Servers
Alicense-qualityAmaintenancePersistent graph-based memory for AI agents, stored as plain markdown — no vector DB. Typed nodes and 11 relation types via 5 MCP tools (search, get, create, link, related), stdio and HTTP/SSE transports.Last updated3MIT- Alicense-qualityCmaintenancem1nd is a local MCP runtime that gives coding agents graph-native memory of a codebase: structure, docs, decisions, change impact, recovery state, and investigation continuity.Last updated21821MIT
- Alicense-qualityAmaintenanceGraph-based MCP memory server for AI coding agents to store patterns, track relationships, and retrieve knowledge across sessions.Last updated228MIT
- Alicense-qualityBmaintenanceLocal-first code intelligence and safety layer for AI coding agents. MCP server exposes dependency graph, impact analysis, and AST-compressed repo context, backed by typed local memory, patch-scope safety gates, and git-independent transaction rollback.Last updatedMIT
Related MCP Connectors
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
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/STiFLeR7/memex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server