rag-memory-epf-mcp 3.5.2 → 3.6.0
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.
- package/README.md +10 -0
- package/dist/index.d.ts +50 -6
- package/dist/index.js +782 -188
- package/dist/src/backfillCoordinator.d.ts +59 -0
- package/dist/src/backfillCoordinator.js +552 -0
- package/dist/src/embeddingGate.d.ts +68 -0
- package/dist/src/embeddingGate.js +227 -0
- package/dist/src/migrations/migrations.js +71 -0
- package/dist/src/modelCache.d.ts +33 -0
- package/dist/src/modelCache.js +235 -0
- package/docs/UPDATING.md +121 -0
- package/package.json +8 -4
package/docs/UPDATING.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Updating rag-memory-epf-mcp
|
|
2
|
+
|
|
3
|
+
Runbook for version-update reliability (introduced in v3.6).
|
|
4
|
+
|
|
5
|
+
## Which version is actually running?
|
|
6
|
+
|
|
7
|
+
`@latest` in your MCP config does **not** guarantee the newest version. Three
|
|
8
|
+
independent reasons:
|
|
9
|
+
|
|
10
|
+
1. **Process lifetime** — MCP servers are spawned when the CLI starts. A new
|
|
11
|
+
version is only picked up after you restart the CLI (or reconnect via
|
|
12
|
+
`/mcp`). Editing config mid-session has no effect on the running server.
|
|
13
|
+
2. **npx cache fallback** — if the npm registry is unreachable, npx runs the
|
|
14
|
+
cached copy.
|
|
15
|
+
3. **dist-tag re-resolution caching** — npx may reuse a previously resolved
|
|
16
|
+
`@latest` for a while (known npm CLI behavior family).
|
|
17
|
+
|
|
18
|
+
**Check what is actually running** (v3.6+):
|
|
19
|
+
|
|
20
|
+
- Startup banner on stderr: `rag-memory-epf-mcp vX.Y.Z | node vN | model ... | cache ... | db ...`
|
|
21
|
+
- `getKnowledgeGraphStats` → `server.version`, plus `server.model_state`,
|
|
22
|
+
`server.reconciliation_state`, and provenance `coverage`.
|
|
23
|
+
|
|
24
|
+
**Deterministic updates**: `npm i -g rag-memory-epf-mcp` and point the config
|
|
25
|
+
launcher at the `rag-memory-mcp` bin directly (the framework bootstrap
|
|
26
|
+
preserves this customization).
|
|
27
|
+
|
|
28
|
+
## Runtime requirements
|
|
29
|
+
|
|
30
|
+
- Node **>= 24** (`engines` + a runtime check at boot). Limitation: on very old
|
|
31
|
+
Node the native imports (better-sqlite3 etc.) may fail before our version
|
|
32
|
+
check prints its message.
|
|
33
|
+
- Embedding dims are fixed at 1024 (bge-m3). Other dims fail fast by design.
|
|
34
|
+
|
|
35
|
+
## The model cache moved in v3.6 (and why that matters)
|
|
36
|
+
|
|
37
|
+
- **Pre-3.6**: the bge-m3 model (~1.2GB) was cached *inside the package
|
|
38
|
+
directory*, which lives inside the npx version slot → **every engine version
|
|
39
|
+
bump re-downloaded the model**.
|
|
40
|
+
- **v3.6+**: the model lives in a version-independent user cache:
|
|
41
|
+
`RAG_MEMORY_MODEL_CACHE_DIR` → `$XDG_CACHE_HOME/rag-memory-epf-mcp` →
|
|
42
|
+
macOS `~/Library/Caches/rag-memory-epf-mcp` / Linux `~/.cache/…` /
|
|
43
|
+
Windows `%LOCALAPPDATA%\rag-memory-epf-mcp`.
|
|
44
|
+
- First v3.6 boot downloads once into the new location (in the background —
|
|
45
|
+
the server is usable immediately in FTS mode). Old package-internal caches
|
|
46
|
+
are not migrated; they disappear with their npx slots.
|
|
47
|
+
- **Cleaning `~/.npm/_npx` no longer touches the model cache.** Do not delete
|
|
48
|
+
the cache directory above unless you intend to re-download.
|
|
49
|
+
|
|
50
|
+
## Boot modes (v3.6)
|
|
51
|
+
|
|
52
|
+
`RAG_MEMORY_EMBEDDINGS` = `lazy` (default) | `eager` | `off`
|
|
53
|
+
|
|
54
|
+
- `lazy` — MCP connects instantly; FTS5 search, graph and CRUD work from the
|
|
55
|
+
first second. The model loads/downloads in the background; hybrid search
|
|
56
|
+
turns on automatically (search responses carry `search_mode` /
|
|
57
|
+
`degradation_reason` so you can see why vector search is off).
|
|
58
|
+
- `eager` — pre-3.6 behavior: boot waits for the model (and provenance
|
|
59
|
+
reconciliation) before connecting.
|
|
60
|
+
- `off` — never loads the model. Zero download, FTS5-only, permanently.
|
|
61
|
+
Responses report `embedding_status: "disabled"` (not `"queued"` — nothing
|
|
62
|
+
will backfill in this mode).
|
|
63
|
+
|
|
64
|
+
`RAG_MEMORY_TRUST_LEGACY_VECTORS=1` — only relevant if you run a custom
|
|
65
|
+
`EMBEDDING_MODEL`: v3.6 refuses to grandfather pre-existing vectors under a
|
|
66
|
+
custom model config unless you opt in (they are re-embedded instead).
|
|
67
|
+
|
|
68
|
+
If you EVER ran a custom `EMBEDDING_MODEL` against a DB and later switched
|
|
69
|
+
back to the default, the stored vectors cannot be attributed reliably. Run
|
|
70
|
+
`embedAllEntities` and re-sync your documents to rebuild them.
|
|
71
|
+
|
|
72
|
+
## Rollback caveats
|
|
73
|
+
|
|
74
|
+
- v3.6 applies schema migration 12 (provenance columns/tables) to each project
|
|
75
|
+
DB on first boot. Older engine versions ignore the new columns — but they
|
|
76
|
+
also do not maintain them.
|
|
77
|
+
- **Never run a pre-3.6 and a v3.6 server against the same project DB at the
|
|
78
|
+
same time.** Restart per project, one at a time.
|
|
79
|
+
|
|
80
|
+
## Fleet rollout
|
|
81
|
+
|
|
82
|
+
- Roll out machine-by-machine, restarting CLIs sequentially (the shared model
|
|
83
|
+
cache uses a cross-process download lock; sequential restarts avoid lock
|
|
84
|
+
contention entirely).
|
|
85
|
+
- Concurrent servers: measured 2026-07-18 on the reference machine — 7 idle
|
|
86
|
+
MCP server processes coexist (idle servers swap out to a few MB RSS). Each
|
|
87
|
+
server that actually loads the model needs bge-m3 fp16 resident memory
|
|
88
|
+
(~1.5–2GB while active). Keep concurrently *model-active* servers to a
|
|
89
|
+
handful; sessions that don't need semantic search should run
|
|
90
|
+
`RAG_MEMORY_EMBEDDINGS=off`. Note that **lazy mode still starts the model
|
|
91
|
+
load in the background right after connect** (so hybrid search becomes
|
|
92
|
+
available without any tool call) — `off` is the only zero-load mode. When
|
|
93
|
+
restarting many CLIs at once, the shared cache download happens once (lock),
|
|
94
|
+
but each process that finishes loading holds its own model memory.
|
|
95
|
+
|
|
96
|
+
## Shutdown semantics
|
|
97
|
+
|
|
98
|
+
SIGTERM/SIGINT close the MCP transport, settle in-flight work (bounded, 5s),
|
|
99
|
+
close the database cleanly, and exit naturally. One documented exception: if a
|
|
100
|
+
model download/load is still pending after the settle deadline (the fetch
|
|
101
|
+
cannot be aborted through transformers.js), the process performs a bounded
|
|
102
|
+
exit **after** the database is closed — data is never at risk, but if the load
|
|
103
|
+
happened to be inside native session construction you may see an abrupt
|
|
104
|
+
runtime message on termination.
|
|
105
|
+
|
|
106
|
+
**Stuck download lock recovery**: if a waiter times out it reports the lock
|
|
107
|
+
path and holder pid (e.g. `.download-<key>.lock`). Verify the holder process
|
|
108
|
+
is genuinely gone or hung (`ps -p <pid>`), then remove the lock file manually;
|
|
109
|
+
the next start becomes a clean download owner.
|
|
110
|
+
|
|
111
|
+
## v3.6 breaking response changes
|
|
112
|
+
|
|
113
|
+
1. `hybridSearch` returns an envelope: `{results, search_mode, model_state,
|
|
114
|
+
coverage, degradation_reason?}` (per-item `search_mode` removed).
|
|
115
|
+
2. `deleteObservations` returns `{results: [{entityName, deleted,
|
|
116
|
+
embedding_status}], total_deleted}` instead of a success string.
|
|
117
|
+
|
|
118
|
+
All other tools are additive (`embedding_status`, `endpoint_embedding_status`,
|
|
119
|
+
stats `server` block). Error responses now set `isError: true`; embedding-gate
|
|
120
|
+
errors are structured: `{code: "MODEL_NOT_READY" | "EMBEDDINGS_DISABLED",
|
|
121
|
+
state, retry_after_ms?, message}`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rag-memory-epf-mcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=24"
|
|
6
|
+
},
|
|
4
7
|
"description": "Project-local RAG memory MCP server — knowledge graph + multilingual vector + FTS5 in a single SQLite file. Per-project isolation, 30 MCP tools, codepoint-safe chunking (Korean/CJK/emoji).",
|
|
5
8
|
"keywords": [
|
|
6
9
|
"mcp",
|
|
@@ -34,14 +37,15 @@
|
|
|
34
37
|
"rag-memory-mcp": "dist/index.js"
|
|
35
38
|
},
|
|
36
39
|
"files": [
|
|
37
|
-
"dist"
|
|
40
|
+
"dist",
|
|
41
|
+
"docs/UPDATING.md"
|
|
38
42
|
],
|
|
39
43
|
"scripts": {
|
|
40
44
|
"build": "tsc && shx chmod +x dist/*.js",
|
|
41
45
|
"prepare": "npm run build",
|
|
42
46
|
"watch": "tsc --watch",
|
|
43
47
|
"verify:invariants": "node test/chunk-invariants.test.mjs",
|
|
44
|
-
"verify:engine": "node test/engine-smoke.test.mjs && node test/launch-smoke.test.mjs && node test/sync-atomicity.test.mjs && node test/dedup.test.mjs && node test/search-degradation.test.mjs && node test/entity-embed-cap.test.mjs",
|
|
48
|
+
"verify:engine": "node test/engine-smoke.test.mjs && node test/launch-smoke.test.mjs && node test/sync-atomicity.test.mjs && node test/dedup.test.mjs && node test/search-degradation.test.mjs && node test/entity-embed-cap.test.mjs && node test/migration12.test.mjs && node test/model-cache.test.mjs && node test/embedding-gate.test.mjs && node test/lazy-boot.test.mjs && node test/reconciliation.test.mjs && node test/backfill.test.mjs && node test/fts-query.test.mjs && node test/search-contracts.test.mjs && node test/tool-contracts.test.mjs && node test/bounded-exit.test.mjs",
|
|
45
49
|
"test": "npm run build && npm run verify:invariants && npm run verify:engine",
|
|
46
50
|
"prepublishOnly": "npm run build && npm run verify:invariants && npm run verify:engine"
|
|
47
51
|
},
|
|
@@ -60,7 +64,7 @@
|
|
|
60
64
|
},
|
|
61
65
|
"devDependencies": {
|
|
62
66
|
"@types/better-sqlite3": "^7.6.12",
|
|
63
|
-
"@types/node": "^
|
|
67
|
+
"@types/node": "^24",
|
|
64
68
|
"shx": "^0.3.4",
|
|
65
69
|
"typescript": "^5.6.2"
|
|
66
70
|
}
|