stifler-memex-mcp 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +331 -287
  2. package/package.json +17 -1
package/README.md CHANGED
@@ -1,287 +1,331 @@
1
- <div align="center">
2
-
3
- # memex
4
-
5
- ### Persistent memory for your AI coding agents.
6
-
7
- memex builds a temporal knowledge graph of your codebase and serves it to any MCP-compatible agent — so every session starts knowing your architecture, your decisions, and your open problems. No more cold starts. No more context pasting.
8
-
9
- [![PyPI](https://img.shields.io/pypi/v/memex-mcp?v=0.3.2)](https://pypi.org/project/memex-mcp/)
10
- [![PyPI downloads](https://img.shields.io/pypi/dm/memex-mcp)](https://pypistats.org/packages/memex-mcp)
11
- [![npm](https://img.shields.io/npm/v/stifler-memex-mcp?v=0.3.2)](https://www.npmjs.com/package/stifler-memex-mcp)
12
- [![npm downloads](https://img.shields.io/npm/dm/stifler-memex-mcp)](https://www.npmjs.com/package/stifler-memex-mcp)
13
- [![Claude Code marketplace](https://img.shields.io/badge/Claude%20Code-marketplace-7c3aed)](https://github.com/STiFLeR7/claude-plugins)
14
- [![GitHub stars](https://img.shields.io/github/stars/STiFLeR7/memex?style=flat)](https://github.com/STiFLeR7/memex/stargazers)
15
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
16
- [![Tests](https://img.shields.io/github/actions/workflow/status/STiFLeR7/memex/publish.yml?branch=master&label=tests)](https://github.com/STiFLeR7/memex/actions)
17
- [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
18
-
19
- ![memex banner](https://raw.githubusercontent.com/STiFLeR7/memex/master/assets/memex.png)
20
-
21
- </div>
22
-
23
- ---
24
-
25
- ## Why memex?
26
-
27
- Every AI agent session starts blind. You re-paste files, re-explain architecture, watch the agent rediscover a refactor you finished last month. **memex fixes that.**
28
-
29
- It runs quietly in the background, learning your codebase from every commit. When an agent connects, it already knows what's there.
30
-
31
- ```text
32
- Without memex With memex
33
- ───────────── ──────────
34
- You: "We use Postgres, not MySQL" Agent: I see you're using Postgres
35
- You: "Auth lives in services/auth" Agent: Editing services/auth/jwt.py...
36
- You: "We decided on JWT last week" Agent: Continuing the JWT decision
37
- You: "Don't touch the migrations" Agent: Skipping migrations/ (locked)
38
- ```
39
-
40
- ---
41
-
42
- ## How it works
43
-
44
- ```text
45
- ┌──────────────────┐ ┌───────────────┐ ┌─────────────┐
46
- │ Your Repository │ ──► │ memex Watcher │ ──► │ Neo4j │
47
- │ files + git │ │ tree-sitter │ │ knowledge │
48
- │ │ │ + Gemini │ │ graph │
49
- └──────────────────┘ └───────────────┘ └──────┬──────┘
50
- │
51
- ┌──────────────────┐ ┌───────────────┐ │
52
- │ AI Agent │ ◄── │ MCP Server │ ◄──────────┘
53
- │ Claude · Gemini │ │ stdio / HTTP │
54
- │ Codex · others │ │ │
55
- └──────────────────┘ └───────────────┘
56
- ```
57
-
58
- 1. **Watcher** uses tree-sitter to extract symbols and Gemini Flash to synthesize architectural decisions from your commits.
59
- 2. **Graph** stores everything in Neo4j via [Graphiti](https://github.com/getzep/graphiti) — bitemporally, so every fact has a "true from" and "true until."
60
- 3. **MCP server** exposes 14 tools any agent can call to read context or write back its own observations.
61
-
62
- ---
63
-
64
- ## Quickstart
65
-
66
- ### The fastest path — Claude Code marketplace
67
-
68
- ```text
69
- /plugin marketplace add STiFLeR7/claude-plugins
70
- /plugin install memex-mcp@stifler-marketplace
71
- ```
72
-
73
- That's it. The plugin wires up the MCP server so every Claude Code session has memex's 14 tools. You still need Neo4j + a Gemini key locally (see below); the plugin only handles the agent-side wiring.
74
-
75
- ### Manual install
76
-
77
- > **Prerequisites:** Python 3.11+, [uv](https://github.com/astral-sh/uv), Docker, a Gemini API key.
78
-
79
- ```bash
80
- # 1. Start Neo4j
81
- docker compose -f docker/docker-compose.yml up -d
82
-
83
- # 2. Create .env in your project root
84
- cat > .env <<EOF
85
- NEO4J_URI=bolt://localhost:7687
86
- NEO4J_USER=neo4j
87
- NEO4J_PASSWORD=memex-local
88
- GEMINI_API_KEY=your-key-here
89
- EOF
90
-
91
- # 3. Initialize and start watching
92
- npx stifler-memex-mcp init --repo .
93
- npx stifler-memex-mcp watch --repo .
94
-
95
- # 4. In a new terminal, serve the context
96
- npx stifler-memex-mcp serve --repo .
97
- ```
98
-
99
- That's it. Your agent now has memory.
100
-
101
- **Install options:**
102
-
103
- | via | command |
104
- |----|---------|
105
- | Claude Code marketplace | `/plugin marketplace add STiFLeR7/claude-plugins` then `/plugin install memex-mcp@stifler-marketplace` |
106
- | npx (no install) | `npx stifler-memex-mcp ...` |
107
- | uv | `uv add memex-mcp` |
108
- | pip | `pip install memex-mcp` |
109
- | source | `git clone github.com/STiFLeR7/memex && uv sync` |
110
-
111
- ---
112
-
113
- ## Connect your agent
114
-
115
- <details>
116
- <summary><b>Claude Code</b> (one-liner via marketplace)</summary>
117
-
118
- Easiest — install the plugin and you're done:
119
-
120
- ```text
121
- /plugin marketplace add STiFLeR7/claude-plugins
122
- /plugin install memex-mcp@stifler-marketplace
123
- ```
124
-
125
- Or wire it manually in `.claude/settings.json`:
126
- ```json
127
- {
128
- "mcpServers": {
129
- "memex": {
130
- "type": "stdio",
131
- "command": "npx",
132
- "args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
133
- }
134
- }
135
- }
136
- ```
137
- </details>
138
-
139
- <details>
140
- <summary><b>Gemini CLI</b></summary>
141
-
142
- Add to `~/.gemini/settings.json`:
143
- ```json
144
- {
145
- "mcpServers": {
146
- "memex": {
147
- "command": "npx",
148
- "args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
149
- }
150
- }
151
- }
152
- ```
153
- </details>
154
-
155
- <details>
156
- <summary><b>Codex</b></summary>
157
-
158
- Add to `~/.codex/config.toml`:
159
- ```toml
160
- [mcp_servers.memex]
161
- command = "npx"
162
- args = ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
163
- ```
164
- </details>
165
-
166
- <details>
167
- <summary><b>Claude's built-in memory tool</b> (v0.3.0+)</summary>
168
-
169
- memex can back Anthropic's native `memory_20250818` tool — Claude reads from a per-session graph projection plus a writable scratch zone.
170
-
171
- ```bash
172
- memex memory-tool serve --repo . # in-process (Python)
173
- memex memory-tool serve --repo . --transport http # FastAPI on :7464
174
- ```
175
-
176
- ```python
177
- from memex.memory_tool import MemexAsyncMemoryTool
178
- memory_tool = MemexAsyncMemoryTool(repo_root=".")
179
- client.beta.messages.run_tools(..., tools=[memory_tool])
180
- ```
181
-
182
- Run alongside the MCP server for full coverage.
183
- </details>
184
-
185
- ---
186
-
187
- ## What agents can do with memex
188
-
189
- memex exposes **14 MCP tools** — eight for reading context, four for writing observations back, and two for analysis.
190
-
191
- ### Reading context
192
-
193
- | Tool | When |
194
- |------|------|
195
- | `get_project_context` | At session start — get the lay of the land |
196
- | `get_symbol_context` | Before editing a function or class |
197
- | `get_recent_decisions` | To see what's changed architecturally |
198
- | `get_open_problems` | To find active bugs and tech debt |
199
- | `search_context` | Hybrid search across the whole graph |
200
- | `get_stale_context` | Spot outdated documentation |
201
- | `explain_change` 🆕 | After a commit — *why* did this happen? |
202
- | `predict_impact` 🆕 | Before a refactor — *what* might break? |
203
-
204
- ### Writing observations
205
-
206
- | Tool | When |
207
- |------|------|
208
- | `record_decision` | After making a technical choice |
209
- | `record_problem` | When you discover a bug or piece of debt |
210
- | `resolve_problem` | When a tracked problem is fixed |
211
- | `invalidate_edge` | When a fact is no longer true |
212
-
213
- Agents write back into the graph as they work. Next session, that knowledge is there.
214
-
215
- ---
216
-
217
- ## Highlights
218
-
219
- - **🧠 Bitemporal memory.** Every fact has a creation time and an optional invalidation time. The graph never forgets — but it knows what's still current.
220
- - **📉 Two-regime confidence decay.** Validated facts decay slowly; unvalidated ones cross the staleness threshold at exactly 30 days. Old hallucinations lose their grip naturally.
221
- - **🤝 Human-in-the-loop.** `memex review` opens a TUI to validate machine-synthesized decisions, lowest-confidence first.
222
- - **🔒 Write governance.** Per-node-type ACL, intent-confirmation on agent writes, and explicit `corroborates` / `supersedes` semantics — no silent duplicates.
223
- - **🔍 Composite retrieval.** Hybrid search × recency × confidence × rehearsal, with the score breakdown surfaced so agents see *why* a result ranked where it did.
224
- - **🌐 Multi-repo aware.** Single watcher and MCP server can manage hundreds of repos with zero-config switching.
225
- - **🖥️ Visual graph.** `memex graph --output graph.html` produces a self-contained D3 force layout with cluster overlays.
226
- - **🧩 Hierarchical clusters** *(v0.3.1)*. `memex cluster` runs Leiden over a hybrid edge graph (directory co-location + module imports + symbol calls) and groups your codebase into named clusters. `get_project_context()` now returns a cluster-level briefing by default — stays under 1500 tokens whether your repo has 50 modules or 5000. Cluster IDs pin across re-runs via Jaccard ≥ 0.5 so renames are stable; `.memex/clusters.yaml` lets you override any assignment.
227
-
228
- ---
229
-
230
- ## How the graph works
231
-
232
- The knowledge graph is **bitemporal**: every relationship knows when it was created and when (if ever) it became invalid. Agents can ask *what was true on day X* and get a real answer.
233
-
234
- Confidence isn't a stored number that mutates — it's **computed at query time** from a node's `base_confidence`, validation status, and time since last reinforcement. Two regimes:
235
-
236
- - **Validated** (a human said "yes, this is real"): half-life ~139 days.
237
- - **Unvalidated** (the watcher synthesized it from a commit): crosses the staleness threshold (0.3) at **exactly 30 days**.
238
-
239
- When an agent records a decision in one session, the next session — yours or someone else's — starts with that knowledge. The graph compounds.
240
-
241
- ---
242
-
243
- ## Project structure
244
-
245
- ```
246
- memex/
247
- ├── memex/
248
- │ ├── extractor/ # tree-sitter + lockfile parsers
249
- │ ├── graph/ # Neo4j writes, confidence, archive
250
- │ ├── synthesizer/ # Gemini Flash → Decision nodes
251
- │ ├── mcp_server/ # 14 MCP tools (read + write + analytic)
252
- │ ├── memory_tool/ # Anthropic memory_20250818 adapter
253
- │ ├── watcher/ # daemon + git hooks
254
- │ └── cli.py # init / watch / serve / review / graph / cluster
255
- ├── tests/ # 332 tests, ~93% coverage
256
- ├── docker/ # Neo4j compose
257
- └── npm/ # npx wrapper
258
- ```
259
-
260
- ---
261
-
262
- ## Contributors
263
-
264
- <table>
265
- <tr>
266
- <td align="center">
267
- <a href="https://github.com/STiFLeR7"><b>Hill Patel</b></a><br/>
268
- <sub>Architect &amp; Project Lead</sub>
269
- </td>
270
- <td align="center">
271
- <a href="https://github.com/Nirvaan05"><b>Nirvaan Lagishetty</b></a><br/>
272
- <sub>Lead Contributor</sub>
273
- </td>
274
- </tr>
275
- </table>
276
-
277
- Want to contribute? Open an issue or a PR. The codebase is well-tested and welcoming — `uv sync` and `uv run pytest tests/` is all the setup you need.
278
-
279
- ---
280
-
281
- ## License & inspiration
282
-
283
- MIT — free to use, modify, and ship.
284
-
285
- > *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."
286
-
287
- This is a small step toward that idea, applied to the context an AI agent needs to work effectively inside a codebase.
1
+ # memex — temporal knowledge graph memory for AI coding agents
2
+
3
+ <!-- mcp-name: io.github.stifler7/memex -->
4
+
5
+ > 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.
6
+
7
+ 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`.
8
+
9
+ [![PyPI](https://img.shields.io/pypi/v/memex-mcp?v=0.3.3)](https://pypi.org/project/memex-mcp/)
10
+ [![PyPI downloads](https://img.shields.io/pypi/dm/memex-mcp)](https://pypistats.org/packages/memex-mcp)
11
+ [![npm](https://img.shields.io/npm/v/stifler-memex-mcp?v=0.3.3)](https://www.npmjs.com/package/stifler-memex-mcp)
12
+ [![npm downloads](https://img.shields.io/npm/dm/stifler-memex-mcp)](https://www.npmjs.com/package/stifler-memex-mcp)
13
+ [![Claude Code marketplace](https://img.shields.io/badge/Claude%20Code-marketplace-7c3aed)](https://github.com/STiFLeR7/claude-plugins)
14
+ [![GitHub stars](https://img.shields.io/github/stars/STiFLeR7/memex?style=flat)](https://github.com/STiFLeR7/memex/stargazers)
15
+ [![Tests](https://img.shields.io/github/actions/workflow/status/STiFLeR7/memex/publish.yml?branch=master&label=tests)](https://github.com/STiFLeR7/memex/actions)
16
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
17
+
18
+ ![memex — temporal knowledge graph MCP server for AI coding agents, built on Graphiti and Neo4j](https://raw.githubusercontent.com/STiFLeR7/memex/master/assets/memex.png)
19
+
20
+ ```mermaid
21
+ flowchart LR
22
+ A[Your repository<br/>files + git] --> B[memex watcher<br/>tree-sitter + Gemini]
23
+ B --> C[Neo4j graph<br/>bitemporal facts]
24
+ C --> D[MCP server<br/>stdio / HTTP]
25
+ D --> E[AI agent<br/>Claude · Cursor · Codex · Gemini CLI]
26
+ E -.->|writes decisions back| C
27
+
28
+ style B fill:#cfe8ff,stroke:#0066cc,color:#000
29
+ style C fill:#fff4cf,stroke:#cc9900,color:#000
30
+ style E fill:#d4f5d4,stroke:#2d8f2d,color:#000
31
+ ```
32
+
33
+ ## Install
34
+
35
+ ### Via Claude Code marketplace
36
+
37
+ ```
38
+ /plugin marketplace add STiFLeR7/claude-plugins
39
+ /plugin install memex-mcp@stifler-marketplace
40
+ ```
41
+
42
+ Restart your Claude Code session.
43
+
44
+ ### Manual
45
+
46
+ ```bash
47
+ docker compose -f docker/docker-compose.yml up -d
48
+ cat > .env <<EOF
49
+ NEO4J_URI=bolt://localhost:7687
50
+ NEO4J_USER=neo4j
51
+ NEO4J_PASSWORD=memex-local
52
+ GEMINI_API_KEY=your-key-here
53
+ EOF
54
+ npx stifler-memex-mcp init --repo .
55
+ npx stifler-memex-mcp watch --repo .
56
+ npx stifler-memex-mcp serve --repo .
57
+ ```
58
+
59
+ | Channel | Command |
60
+ |---|---|
61
+ | Claude Code marketplace | `/plugin install memex-mcp@stifler-marketplace` |
62
+ | npx (no install) | `npx stifler-memex-mcp <cmd>` |
63
+ | uv | `uv add memex-mcp` |
64
+ | pip | `pip install memex-mcp` |
65
+ | source | `git clone github.com/STiFLeR7/memex && uv sync` |
66
+
67
+ ## At a glance
68
+
69
+ | Property | Value |
70
+ |---|---|
71
+ | Output | A Neo4j graph populated continuously from your repo |
72
+ | Storage | Neo4j via [Graphiti](https://github.com/getzep/graphiti). Bitemporal — every edge has `created_at` and optional `expired_at` |
73
+ | Survives | `/clear`, terminal crashes, machine restarts, teammate handoffs |
74
+ | Hands off to | Claude Code, Cursor, Codex, Gemini CLI, any MCP client |
75
+ | Granularity | Scales from 50 to 5000+ modules via hierarchical Leiden clusters |
76
+ | Synthesis | Gemini Flash distills commits into `Decision` nodes; Pro for grounded synthesis |
77
+ | Confidence | Computed at query time. Two-regime decay (validated half-life ~139d, unvalidated stale at 30d) |
78
+ | Write governance | Per-node-type ACL, intent-confirmation on agent writes, explicit `corroborates` / `supersedes` semantics |
79
+ | Tests | 333 passing, ~93% coverage |
80
+
81
+ ## The lifecycle
82
+
83
+ ```mermaid
84
+ flowchart TD
85
+ Init[memex init<br/>extract baseline] --> Watch[memex watch<br/>daemon + git hooks]
86
+ Watch -->|commit| Extract[tree-sitter extract<br/>symbols, imports, lockfile]
87
+ Extract --> Synth[Gemini Flash<br/>diff → Decision nodes]
88
+ Synth --> Write[Graphiti add_episode<br/>+ post-hoc bitemporal SET]
89
+ Write --> Decay[Scheduler<br/>nightly confidence decay]
90
+ Decay -->|stale edges| Archive[expired_at = now]
91
+
92
+ Serve[memex serve<br/>MCP stdio/HTTP] -.->|reads| Write
93
+ Agent[AI agent] -->|14 MCP tools| Serve
94
+ Serve -->|record_decision / record_problem| Write
95
+
96
+ Cluster[memex cluster<br/>Leiden over hybrid edges] -.->|every N commits| Write
97
+
98
+ style Init fill:#e8f4ff,color:#000
99
+ style Watch fill:#fff4cf,color:#000
100
+ style Synth fill:#ffe0cc,color:#000
101
+ style Serve fill:#d4f5d4,color:#000
102
+ ```
103
+
104
+ ## MCP tools
105
+
106
+ 14 tools — eight read, four write, two analytic.
107
+
108
+ ### Read
109
+
110
+ | Tool | When |
111
+ |---|---|
112
+ | `get_project_context` | Session start. Returns a cluster-level briefing under 1500 tokens regardless of repo size |
113
+ | `get_symbol_context` | Before editing a function or class. Returns callers, callees, linked decisions |
114
+ | `get_recent_decisions` | Last N days of architectural decisions, optionally module-scoped |
115
+ | `get_open_problems` | Active bugs and tech debt, sorted by severity |
116
+ | `search_context` | Hybrid search: semantic × keyword × graph traversal × RRF merge |
117
+ | `get_stale_context` | Edges whose composite confidence dropped below threshold |
118
+ | `explain_change` | Given a commit SHA, cross-references the diff with linked Decision/Problem nodes and asks Gemini Pro for a grounded explanation |
119
+ | `predict_impact` | Given a file path, returns a ranked list of modules likely affected based on graph coupling (no LLM call) |
120
+
121
+ ### Write
122
+
123
+ | Tool | When |
124
+ |---|---|
125
+ | `record_decision` | After making a technical choice. Supports `corroborates` (reinforce) and `supersedes` (replace) |
126
+ | `record_problem` | When discovering a bug or piece of tech debt |
127
+ | `resolve_problem` | When a tracked problem is fixed |
128
+ | `invalidate_edge` | When a stored fact is no longer true |
129
+
130
+ ## Bitemporal confidence
131
+
132
+ 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.
133
+
134
+ ```mermaid
135
+ flowchart LR
136
+ Edge[Edge created<br/>base_confidence] --> Q{Validated by<br/>a human?}
137
+ Q -->|yes| Slow[Slow regime<br/>half-life ~139d]
138
+ Q -->|no| Fast[Fast regime<br/>stale at exactly 30d]
139
+ Slow --> Score[Composite score<br/>conf × recency × rehearsal]
140
+ Fast --> Score
141
+ Score -->|below floor| Stale[get_stale_context surfaces it]
142
+ Score -->|access| Bump[last_reinforced_at updated]
143
+ Bump --> Score
144
+
145
+ style Slow fill:#d4f5d4,color:#000
146
+ style Fast fill:#ffd4d4,color:#000
147
+ ```
148
+
149
+ | Property | Value |
150
+ |---|---|
151
+ | Validated half-life | ~139 days |
152
+ | Unvalidated stale threshold | 30 days (composite < 0.3) |
153
+ | Recency τ | 90 days (exponential decay) |
154
+ | Composite formula | `conf × recency × (1 + rehearsal_w × log(1 + access_count))` |
155
+ | Conflict similarity threshold | 0.4 (below this + overlapping validity = conflict) |
156
+ | Intent-confirmation threshold | 0.85 (MCP write similarity check) |
157
+
158
+ ## Hierarchical clusters
159
+
160
+ `memex cluster` runs hierarchical Leiden over a hybrid edge graph:
161
+
162
+ | Edge type | Weight |
163
+ |---|---|
164
+ | Directory co-location | 1.0 |
165
+ | Module imports | 2.0 |
166
+ | Symbol calls | `log(1 + calls)` |
167
+
168
+ | Property | Value |
169
+ |---|---|
170
+ | Algorithm | `graspologic.partition.hierarchical_leiden` with fixed seed |
171
+ | Naming | TF-IDF top-3 over module docstrings + symbol names, parent-dir fallback |
172
+ | ID pinning | Jaccard ≥ 0.5 across reruns (cluster names stay stable through renames) |
173
+ | User overrides | `.memex/clusters.yaml` — any assignment can be locked |
174
+ | Context budget | `get_project_context` stays under 1500 tokens whether your repo has 50 or 5000 modules |
175
+
176
+ ## Connect your agent
177
+
178
+ <details>
179
+ <summary><b>Claude Code</b></summary>
180
+
181
+ Marketplace install above does this for you. Manual wiring in `.claude/settings.json`:
182
+
183
+ ```json
184
+ {
185
+ "mcpServers": {
186
+ "memex": {
187
+ "type": "stdio",
188
+ "command": "npx",
189
+ "args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
190
+ }
191
+ }
192
+ }
193
+ ```
194
+ </details>
195
+
196
+ <details>
197
+ <summary><b>Cursor</b></summary>
198
+
199
+ Add to `~/.cursor/mcp.json`:
200
+
201
+ ```json
202
+ {
203
+ "mcpServers": {
204
+ "memex": {
205
+ "command": "npx",
206
+ "args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
207
+ }
208
+ }
209
+ }
210
+ ```
211
+ </details>
212
+
213
+ <details>
214
+ <summary><b>Gemini CLI</b></summary>
215
+
216
+ Add to `~/.gemini/settings.json`:
217
+
218
+ ```json
219
+ {
220
+ "mcpServers": {
221
+ "memex": {
222
+ "command": "npx",
223
+ "args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
224
+ }
225
+ }
226
+ }
227
+ ```
228
+ </details>
229
+
230
+ <details>
231
+ <summary><b>Codex</b></summary>
232
+
233
+ Add to `~/.codex/config.toml`:
234
+
235
+ ```toml
236
+ [mcp_servers.memex]
237
+ command = "npx"
238
+ args = ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
239
+ ```
240
+ </details>
241
+
242
+ <details>
243
+ <summary><b>Anthropic memory tool (memory_20250818)</b></summary>
244
+
245
+ memex can back Claude's native memory tool — agents read from a per-session graph projection plus a writable scratch zone.
246
+
247
+ ```bash
248
+ memex memory-tool serve --repo . # in-process
249
+ memex memory-tool serve --repo . --transport http # FastAPI on :7464
250
+ ```
251
+
252
+ ```python
253
+ from memex.memory_tool import MemexAsyncMemoryTool
254
+ memory_tool = MemexAsyncMemoryTool(repo_root=".")
255
+ client.beta.messages.run_tools(..., tools=[memory_tool])
256
+ ```
257
+ </details>
258
+
259
+ ## Operating principles
260
+
261
+ | # | Principle | The bet |
262
+ |---|---|---|
263
+ | 1 | Bitemporal, never destructive | Edges are expired, not deleted. `WHERE r.expired_at IS NULL` filters live state |
264
+ | 2 | Confidence is computed, not stored | Mutating a number invites silent drift. Recompute every read |
265
+ | 3 | Two regimes for decay | Validated facts decay slowly; unvalidated facts must earn their place by being accessed |
266
+ | 4 | Human in the loop | `memex review` queues lowest-confidence Decision nodes for explicit validation |
267
+ | 5 | Write governance | Per-node-type ACL. `Decision.policy = open`, `Module.policy = locked`. Intent-confirmation on similar-content writes |
268
+ | 6 | Tokens are budgeted | `get_project_context` stays under 1500 tokens at any repo size via Leiden clusters |
269
+ | 7 | Synthesis only on commits | The watcher batches by debounce window. Gemini Flash is not in the hot path of a tool call |
270
+ | 8 | Pro for synthesis, Flash for extraction | `explain_change` uses Pro because grounding matters. Everything else uses Flash |
271
+ | 9 | Multi-repo aware | One watcher + one MCP server can manage hundreds of repos. `--repo` switches scope |
272
+ | 10 | Local-first | Neo4j runs in your Docker. Gemini is the only outbound call, and only on commits |
273
+
274
+ ## When to use memex
275
+
276
+ | Use it when | Skip it when |
277
+ |---|---|
278
+ | Multi-week or multi-month project | One-shot script, throwaway prototype |
279
+ | You work across multiple agents (Claude, Cursor, Codex) and want shared context | You only ever pair with one agent on one task |
280
+ | Architectural decisions are made over time and need to be remembered | The whole project fits in a single 200k-token context window |
281
+ | You want to query "what did we decide about X" from any session | Your repo is already small enough to paste into the prompt |
282
+ | Multiple developers using AI agents on the same codebase | Solo work where you never `/clear` |
283
+
284
+ ## Project structure
285
+
286
+ ```
287
+ memex/
288
+ ├── memex/
289
+ │ ├── extractor/ tree-sitter + lockfile parsers
290
+ │ ├── graph/ Neo4j writes, confidence, archive, cluster engine
291
+ │ ├── synthesizer/ Gemini Flash → Decision nodes
292
+ │ ├── mcp_server/ 14 MCP tools (read + write + analytic)
293
+ │ ├── memory_tool/ Anthropic memory_20250818 adapter
294
+ │ ├── watcher/ daemon + git hooks
295
+ │ └── cli.py init / watch / serve / review / graph / cluster
296
+ ├── tests/ 333 passing, ~93% coverage
297
+ ├── docker/ Neo4j compose
298
+ ├── npm/ npx wrapper (publishes as stifler-memex-mcp)
299
+ └── Dockerfile introspection-only image for MCP directory sandboxes
300
+ ```
301
+
302
+ ## Commands
303
+
304
+ | Command | What it does |
305
+ |---|---|
306
+ | `memex init` | Extract baseline graph state, run first cluster pass |
307
+ | `memex watch` | Daemon that listens for file + git events and writes to Neo4j |
308
+ | `memex serve` | Run the MCP server (stdio, HTTP, or both) |
309
+ | `memex review` | TUI that walks lowest-confidence decisions for human validation |
310
+ | `memex graph --output graph.html` | Self-contained D3 force layout with cluster overlays |
311
+ | `memex cluster [--rerun] [--dry-run]` | Run Leiden over the hybrid edge graph; pin cluster IDs by Jaccard ≥ 0.5 |
312
+ | `memex memory-tool serve` | Back Anthropic's `memory_20250818` tool with a graph projection |
313
+
314
+ ## License
315
+
316
+ MIT. See [LICENSE](./LICENSE).
317
+
318
+ ## Author
319
+
320
+ Hill Patel ([@STiFLeR7](https://github.com/STiFLeR7))
321
+
322
+ ## Core Contributors & Maintainers
323
+
324
+ - Hill Patel ([@STiFLeR7](https://github.com/STiFLeR7)) — architect, maintainer
325
+ - Nirvaan Lagishetty ([@Nirvaan05](https://github.com/Nirvaan05)) — lead contributor, maintainer
326
+
327
+ ## Contributing
328
+
329
+ 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.
330
+
331
+ > *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."
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "stifler-memex-mcp",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
+ "mcpName": "io.github.stifler7/memex",
4
5
  "description": "Developer context continuity system — temporal knowledge graph for AI coding agents via MCP. Inspired by Vannevar Bush's 1945 concept of a machine that remembers everything.",
5
6
  "bin": {
6
7
  "stifler-memex-mcp": "./bin/memex-mcp.js",
@@ -9,12 +10,27 @@
9
10
  },
10
11
  "keywords": [
11
12
  "mcp",
13
+ "mcp-server",
14
+ "model-context-protocol",
12
15
  "ai-agents",
16
+ "ai-coding-assistant",
13
17
  "context",
18
+ "context-engineering",
14
19
  "knowledge-graph",
20
+ "agent-memory",
21
+ "persistent-memory",
22
+ "code-intelligence",
23
+ "rag",
15
24
  "gemini",
25
+ "gemini-cli",
16
26
  "claude-code",
27
+ "codex",
28
+ "cursor",
29
+ "anthropic",
30
+ "tree-sitter",
31
+ "temporal-graph",
17
32
  "neo4j",
33
+ "graphiti",
18
34
  "developer-tools"
19
35
  ],
20
36
  "author": {