@oomkapwn/enquire-mcp 3.9.0-rc.2 → 3.9.0-rc.21

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 (68) hide show
  1. package/CHANGELOG.md +726 -0
  2. package/README.md +17 -17
  3. package/SECURITY.md +18 -12
  4. package/assets/social-preview.png +0 -0
  5. package/dist/bases.d.ts +23 -0
  6. package/dist/bases.d.ts.map +1 -1
  7. package/dist/bases.js +29 -4
  8. package/dist/bases.js.map +1 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +62 -4
  11. package/dist/cli.js.map +1 -1
  12. package/dist/communities.d.ts +7 -1
  13. package/dist/communities.d.ts.map +1 -1
  14. package/dist/communities.js +7 -3
  15. package/dist/communities.js.map +1 -1
  16. package/dist/doctor.d.ts +12 -0
  17. package/dist/doctor.d.ts.map +1 -1
  18. package/dist/doctor.js +35 -2
  19. package/dist/doctor.js.map +1 -1
  20. package/dist/dql.d.ts +10 -0
  21. package/dist/dql.d.ts.map +1 -1
  22. package/dist/dql.js +13 -1
  23. package/dist/dql.js.map +1 -1
  24. package/dist/embeddings.d.ts +1 -1
  25. package/dist/embeddings.js +1 -1
  26. package/dist/eval.d.ts +14 -0
  27. package/dist/eval.d.ts.map +1 -1
  28. package/dist/eval.js +12 -2
  29. package/dist/eval.js.map +1 -1
  30. package/dist/hnsw.d.ts.map +1 -1
  31. package/dist/hnsw.js +5 -1
  32. package/dist/hnsw.js.map +1 -1
  33. package/dist/http-transport.d.ts.map +1 -1
  34. package/dist/http-transport.js +19 -5
  35. package/dist/http-transport.js.map +1 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/ocr.d.ts +97 -19
  41. package/dist/ocr.d.ts.map +1 -1
  42. package/dist/ocr.js +145 -25
  43. package/dist/ocr.js.map +1 -1
  44. package/dist/pdf.js +1 -1
  45. package/dist/pdf.js.map +1 -1
  46. package/dist/server.d.ts.map +1 -1
  47. package/dist/server.js +18 -2
  48. package/dist/server.js.map +1 -1
  49. package/dist/tool-registry.d.ts.map +1 -1
  50. package/dist/tool-registry.js +5 -3
  51. package/dist/tool-registry.js.map +1 -1
  52. package/dist/tools/meta.d.ts +62 -0
  53. package/dist/tools/meta.d.ts.map +1 -1
  54. package/dist/tools/meta.js +278 -1
  55. package/dist/tools/meta.js.map +1 -1
  56. package/dist/tools/search.d.ts +44 -0
  57. package/dist/tools/search.d.ts.map +1 -1
  58. package/dist/tools/search.js +72 -13
  59. package/dist/tools/search.js.map +1 -1
  60. package/dist/watcher.d.ts +52 -1
  61. package/dist/watcher.d.ts.map +1 -1
  62. package/dist/watcher.js +138 -20
  63. package/dist/watcher.js.map +1 -1
  64. package/docs/COMPARISON.md +4 -4
  65. package/docs/QUICKSTART.md +2 -2
  66. package/docs/api.md +17 -4
  67. package/docs/benchmarks.md +51 -8
  68. package/package.json +5 -4
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../src/watcher.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC;CACpB;AA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const SKIP_DIRS = [".git", ".obsidian", ".trash", "node_modules", ".DS_Store"];
21
+ /**
22
+ * v3.9.0-rc.11 (audit) — zip embed-db rows with their freshly-assigned row ids
23
+ * for an HNSW add-diff. `EmbedDb.upsertNote` returns exactly one id per row in
24
+ * the same order, so a length mismatch is a bug. The pre-rc.11 code used
25
+ * `newIds[i] ?? -1`, which silently inserted a vector under SENTINEL label
26
+ * `-1` on any mismatch — corrupting the in-memory index, the shared
27
+ * `rowsByLabel` map, AND the persisted `.hnsw.bin` sidecar (a later
28
+ * `markDelete(-1)` or a real row colliding on `-1` then scrambles results).
29
+ * This throws (fail-closed) instead: the watcher's per-event try/catch logs it
30
+ * and skips the HNSW update for that file, and the signature guard rebuilds a
31
+ * correct index on the next serve. A corrupt sentinel label is never inserted.
32
+ *
33
+ * @param rows - The embed rows (vector + chunk metadata), in insertion order.
34
+ * @param newIds - The row ids `upsertNote` assigned, parallel to `rows`.
35
+ * @returns Add-points for `syncHnswForFile`, each id guaranteed defined.
36
+ * @throws {Error} If `newIds.length !== rows.length`.
37
+ */
38
+ export function zipHnswAddPoints(rows, newIds) {
39
+ if (newIds.length !== rows.length) {
40
+ throw new Error(`HNSW sync: embed-db returned ${newIds.length} ids for ${rows.length} rows — refusing to insert a sentinel label (would corrupt the index).`);
41
+ }
42
+ const points = [];
43
+ for (let i = 0; i < rows.length; i++) {
44
+ const r = rows[i];
45
+ const id = newIds[i];
46
+ if (r === undefined || id === undefined) {
47
+ throw new Error("HNSW sync: unexpected undefined row/id during zip.");
48
+ }
49
+ points.push({
50
+ id,
51
+ vector: r.vector,
52
+ chunkIndex: r.chunkIndex,
53
+ lineStart: r.lineStart,
54
+ lineEnd: r.lineEnd,
55
+ textPreview: r.textPreview
56
+ });
57
+ }
58
+ return points;
59
+ }
21
60
  export class VaultWatcher {
22
61
  watcher = null;
23
62
  vault;
@@ -47,7 +86,31 @@ export class VaultWatcher {
47
86
  // next serve restart rebuilt from the freshly-upserted embed-db).
48
87
  hnsw = null;
49
88
  hnswRowsByLabel = null;
89
+ // v3.9.0-rc.6 — HNSW disk persistence on live update. The in-memory
90
+ // HNSW index diverges from the persisted `.hnsw.bin` after every
91
+ // applyDiff. Correctness is already guaranteed by the signature guard
92
+ // (a stale `.hnsw.bin` is ignored on next serve because
93
+ // loadHnswFromDisk recomputes the embed-db signature and rebuilds on
94
+ // mismatch). The ONLY benefit of re-persisting is restart SPEED:
95
+ // keeping the sidecar current avoids the ~25s rebuild on next serve.
96
+ // We persist at watcher CLOSE time (not on a debounced during-serve
97
+ // timer): the close-time flush delivers the restart-speed benefit
98
+ // without timer-lifecycle complexity or mid-serve disk I/O. An
99
+ // ungraceful SIGKILL skips the flush, but the signature guard makes
100
+ // that safe (falls back to rebuild). `hnswPersistFile` is null when
101
+ // `--no-hnsw-persist` was passed (no sidecar to keep current).
102
+ hnswPersistFile = null;
103
+ hnswDirty = false;
50
104
  closed = false;
105
+ // v3.9.0-rc.11 (audit H1) — per-file serialization. chokidar dispatches file
106
+ // events concurrently; without this, two rapid saves to the SAME file
107
+ // interleave their embed-db upsert + HNSW applyDiff + shared-`rowsByLabel`
108
+ // mutation → silent index drift (ghost labels live in HNSW but absent from
109
+ // the embed-db → stale search hits). Each event chains on the file's prior
110
+ // handle so same-file events run strictly sequentially while different files
111
+ // keep independent chains and stay parallel. Keyed by absolute path; entries
112
+ // self-evict when a file's chain drains (bounded memory over a long serve).
113
+ fileQueues = new Map();
51
114
  constructor(opts) {
52
115
  this.vault = opts.vault;
53
116
  this.ftsIndex = opts.ftsIndex ?? null;
@@ -133,13 +196,52 @@ export class VaultWatcher {
133
196
  * @param rowsByLabel - the mutable label→row map shared with
134
197
  * `searchHybrid` (the live update writes into it so subsequent
135
198
  * searches see the new chunks).
199
+ * @param persistFile - v3.9.0-rc.6: optional sidecar base path
200
+ * (`<embed-db-without-suffix>.hnsw`). When provided AND HNSW live
201
+ * updates occurred, the watcher re-persists the index at close time
202
+ * so the next serve loads the up-to-date sidecar instead of
203
+ * rebuilding. Omit (or pass when `--no-hnsw-persist`) to skip
204
+ * persistence — correctness is unaffected (signature guard).
136
205
  */
137
- attachHnsw(hnsw, rowsByLabel) {
206
+ attachHnsw(hnsw, rowsByLabel, persistFile) {
138
207
  if (!this.embedDb) {
139
208
  throw new Error("VaultWatcher.attachHnsw: embedDb not attached — call attachEmbed first (HNSW live update requires it)");
140
209
  }
141
210
  this.hnsw = hnsw;
142
211
  this.hnswRowsByLabel = rowsByLabel;
212
+ this.hnswPersistFile = persistFile ?? null;
213
+ }
214
+ /**
215
+ * v3.9.0-rc.6 — flush the live-updated HNSW index to its disk sidecar.
216
+ * No-op unless ALL of: the index is dirty (had ≥1 applyDiff since the
217
+ * last flush), an index + rowsByLabel + persistFile + embedDb are all
218
+ * wired. Recomputes the embed-db signature so the persisted
219
+ * `.meta.json` matches what `loadHnswFromDisk` will expect on the next
220
+ * serve (any external embed-db change since then → signature mismatch
221
+ * → safe rebuild). Fail-soft: a save error is logged + swallowed (the
222
+ * signature guard means a stale/missing sidecar just triggers rebuild).
223
+ *
224
+ * @returns true if a flush was performed, false if it was a no-op.
225
+ */
226
+ async flushHnswToDisk() {
227
+ if (!this.hnswDirty || !this.hnsw || !this.hnswRowsByLabel || !this.hnswPersistFile || !this.embedDb) {
228
+ return false;
229
+ }
230
+ try {
231
+ const signature = this.embedDb.computeSignature();
232
+ await this.hnsw.saveTo(this.hnswPersistFile, this.hnswRowsByLabel, signature);
233
+ this.hnswDirty = false;
234
+ if (!this.silent) {
235
+ process.stderr.write(`enquire: watcher persisted live-updated HNSW index to ${this.hnswPersistFile}.bin (+ .meta.json)\n`);
236
+ }
237
+ return true;
238
+ }
239
+ catch (err) {
240
+ if (!this.silent) {
241
+ process.stderr.write(`enquire: watcher HNSW persist failed — ${err instanceof Error ? err.message : String(err)} (next serve will rebuild from embed-db; correctness unaffected)\n`);
242
+ }
243
+ return false;
244
+ }
143
245
  }
144
246
  /**
145
247
  * v3.9.0-rc.2 — internal helper. Apply an embed-db {oldIds, newIds}
@@ -155,6 +257,10 @@ export class VaultWatcher {
155
257
  return null;
156
258
  try {
157
259
  const result = this.hnsw.applyDiff(oldIds, newRows.map((r) => ({ label: r.id, vector: r.vector })));
260
+ // v3.9.0-rc.6 — mark the index dirty so close-time flushHnswToDisk
261
+ // re-persists it. Set only after applyDiff succeeds (a thrown diff
262
+ // leaves the on-disk sidecar as the last-known-good state).
263
+ this.hnswDirty = true;
158
264
  // Update the rowsByLabel map: drop old, add new. The map is shared
159
265
  // with searchHybrid via reference; mutations are visible immediately.
160
266
  for (const oldId of oldIds)
@@ -219,12 +325,25 @@ export class VaultWatcher {
219
325
  ignoreInitial: true
220
326
  });
221
327
  const onChange = (absPath, kind) => {
222
- // Fire-and-forget; failures are logged, not propagated.
223
- this.handle(absPath, kind).catch((err) => {
328
+ // v3.9.0-rc.11 (H1) serialize per file. Chain this event on the file's
329
+ // prior handle (which always resolves — it catches its own errors) so
330
+ // same-file events run sequentially and never interleave their embed-db
331
+ // + HNSW mutations; different files keep independent chains → parallel.
332
+ const prev = this.fileQueues.get(absPath) ?? Promise.resolve();
333
+ const tail = prev
334
+ .then(() => this.handle(absPath, kind))
335
+ .catch((err) => {
224
336
  if (!this.silent) {
225
337
  process.stderr.write(`enquire: watcher error on ${path.relative(root, absPath)} (${kind}) — ${err instanceof Error ? err.message : String(err)}\n`);
226
338
  }
227
339
  });
340
+ this.fileQueues.set(absPath, tail);
341
+ // Self-evict once this is the last queued event for the file so the map
342
+ // stays bounded. If a newer event chained after us it owns the entry.
343
+ void tail.finally(() => {
344
+ if (this.fileQueues.get(absPath) === tail)
345
+ this.fileQueues.delete(absPath);
346
+ });
228
347
  };
229
348
  this.watcher.on("add", (p) => onChange(p, "add"));
230
349
  this.watcher.on("change", (p) => onChange(p, "change"));
@@ -269,7 +388,11 @@ export class VaultWatcher {
269
388
  try {
270
389
  const deletedIds = this.embedDb.deleteNote(relPath);
271
390
  if (deletedIds.length > 0 && this.hnsw) {
272
- const result = this.syncHnswForFile(relPath, "md", deletedIds, []);
391
+ // v3.9.0-rc.11 (L2) pass the correct kind for PDF unlinks (was
392
+ // hardcoded "md"). Cosmetic on a pure-delete diff today since no
393
+ // new rows are set, but correct + future-proof if the delete path
394
+ // ever records kind.
395
+ const result = this.syncHnswForFile(relPath, isPdf ? "pdf" : "md", deletedIds, []);
273
396
  if (result)
274
397
  unlinkHnswNote = ` + hnsw -${result.removed}`;
275
398
  }
@@ -374,14 +497,7 @@ export class VaultWatcher {
374
497
  // The newIds array runs parallel to pdfResult.rows (same order)
375
498
  // so we can zip them into HNSW add-points by index.
376
499
  if (this.hnsw) {
377
- const hnswResult = this.syncHnswForFile(relPath, "pdf", oldIds, pdfResult.rows.map((r, i) => ({
378
- id: newIds[i] ?? -1,
379
- vector: r.vector,
380
- chunkIndex: r.chunkIndex,
381
- lineStart: r.lineStart,
382
- lineEnd: r.lineEnd,
383
- textPreview: r.textPreview
384
- })));
500
+ const hnswResult = this.syncHnswForFile(relPath, "pdf", oldIds, zipHnswAddPoints(pdfResult.rows, newIds));
385
501
  if (hnswResult)
386
502
  pdfEmbedNote += ` + hnsw -${hnswResult.removed}/+${hnswResult.added}`;
387
503
  }
@@ -427,14 +543,7 @@ export class VaultWatcher {
427
543
  // v3.9.0-rc.2 — keep HNSW in sync. newIds and result.rows run
428
544
  // parallel (same order), so we zip them into HNSW add-points.
429
545
  if (this.hnsw) {
430
- const hnswResult = this.syncHnswForFile(relPath, "md", oldIds, result.rows.map((r, i) => ({
431
- id: newIds[i] ?? -1,
432
- vector: r.vector,
433
- chunkIndex: r.chunkIndex,
434
- lineStart: r.lineStart,
435
- lineEnd: r.lineEnd,
436
- textPreview: r.textPreview
437
- })));
546
+ const hnswResult = this.syncHnswForFile(relPath, "md", oldIds, zipHnswAddPoints(result.rows, newIds));
438
547
  if (hnswResult)
439
548
  embedNote += ` + hnsw -${hnswResult.removed}/+${hnswResult.added}`;
440
549
  }
@@ -462,6 +571,15 @@ export class VaultWatcher {
462
571
  if (this.closed)
463
572
  return;
464
573
  this.closed = true;
574
+ // v3.9.0-rc.11 (H1) — drain in-flight per-file handlers first so a pending
575
+ // upsert + applyDiff completes and the flushed sidecar reflects it (rather
576
+ // than racing close vs. an in-progress live update). allSettled: a failed
577
+ // handler shouldn't block shutdown.
578
+ await Promise.allSettled([...this.fileQueues.values()]);
579
+ // v3.9.0-rc.6 — flush the live-updated HNSW index before shutting
580
+ // down so the next serve loads the up-to-date sidecar. No-op if no
581
+ // live updates occurred or persistence is disabled. Fail-soft.
582
+ await this.flushHnswToDisk();
465
583
  if (this.watcher) {
466
584
  await this.watcher.close();
467
585
  this.watcher = null;
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.js","sourceRoot":"","sources":["../src/watcher.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,mEAAmE;AACnE,2BAA2B;AAC3B,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,mEAAmE;AACnE,yEAAyE;AACzE,0EAA0E;AAC1E,0EAA0E;AAC1E,qEAAqE;AACrE,oEAAoE;AACpE,sEAAsE;AACtE,sCAAsC;AACtC,EAAE;AACF,uEAAuE;AACvE,oDAAoD;AAEpD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,QAA4B,MAAM,UAAU,CAAC;AAuBpD,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;AAoF/E,MAAM,OAAO,YAAY;IACf,OAAO,GAAqB,IAAI,CAAC;IACxB,KAAK,CAAQ;IACb,QAAQ,CAAkB;IAC1B,MAAM,CAAU;IAChB,WAAW,CAAU;IACtC,mEAAmE;IACnE,uEAAuE;IACvE,kEAAkE;IAClE,yDAAyD;IACjD,OAAO,CAAiB;IACxB,QAAQ,CAAkD;IAC1D,gBAAgB,CAAS;IACjC,oEAAoE;IACpE,sEAAsE;IACtE,kEAAkE;IAClE,sBAAsB;IACd,OAAO,CAAU;IAC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IAAI,CAAC,MAAM,EAAE,CAAC;gBACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,yBAAyB,OAAO,KAAK,IAAI,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,2EAA2E;QAC3E,2EAA2E;QAC3E,0EAA0E;QAC1E,oCAAoC;QACpC,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACxD,kEAAkE;QAClE,mEAAmE;QACnE,+DAA+D;QAC/D,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
@@ -42,8 +42,8 @@ The four axes the external audit (#3, 2026-05) called out as decisive — **REST
42
42
  | Invoke Obsidian palette commands / hotkeys | **No** | **Yes** | Limited | No | No |
43
43
  | Read open editor state, active note, etc. | **No** | **Yes** | Limited | No | No |
44
44
  | Zero outbound network calls in serve mode | **Yes** (default) | Local-only (REST)| Local-only (REST)| Yes | Yes |
45
- | SLSA-3 build provenance on releases | **Yes** | No | No | No | No |
46
- | Test count (public) | **911** | (varies) | (varies) | (varies) | (varies) |
45
+ | Signed build provenance on releases (SLSA L2) | **Yes** | No | No | No | No |
46
+ | Test count (public) | **995** | (varies) | (varies) | (varies) | (varies) |
47
47
  | Tool count | 44 | ~25 | ~8 | ~10 | 3–5 |
48
48
  | MCP prompt count | 19 | 0 | 0 | 0 | 0 |
49
49
  | License | MIT | Apache-2.0 | MIT | MIT | (varies) |
@@ -146,7 +146,7 @@ Conversely, the scenarios where the trade-offs land in enquire-mcp's favor:
146
146
 
147
147
  **Symptom:** you ask the agent a conceptual question, and it gets a note that happens to contain one of your keywords but isn't actually the right note.
148
148
 
149
- If you have 5k+ notes and you've already noticed that simple grep / BM25 search returns wrong-but-keyword-matching results, the **BM25 + TF-IDF + dense-embeddings → RRF → cross-encoder reranker** stack is exactly what closes that gap. Typical +5–10 NDCG@10 over single-ranker baselines (BGE reranker, v2.9+). None of the other four servers in the matrix does multi-signal fusion or reranking.
149
+ If you have 5k+ notes and you've already noticed that simple grep / BM25 search returns wrong-but-keyword-matching results, the **BM25 + TF-IDF + dense-embeddings → RRF → cross-encoder reranker** stack is exactly what closes that gap. Measured +15.5 NDCG@10 / +24.7 MRR over single-ranker baselines (BGE reranker, 60-query ablation). None of the other four servers in the matrix does multi-signal fusion or reranking.
150
150
 
151
151
  What enquire-mcp gives you, specifically:
152
152
 
@@ -193,7 +193,7 @@ The alternatives expose tools but not curated agent-facing prompts. If your clie
193
193
 
194
194
  ### 6. Supply-chain hygiene matters
195
195
 
196
- enquire-mcp publishes **SLSA-3 build provenance** with every release — npm artifacts are signed and verifiable against the GitHub Actions build. If your org's MCP install path requires verifying that the binary you got from npm was built from the commit it claims, that's available out of the box.
196
+ enquire-mcp publishes **signed build provenance** with every release — npm artifacts carry a Sigstore-signed provenance attestation (via `npm publish --provenance` + GitHub OIDC), verifiable with `npm audit signatures` against the GitHub Actions build. This is **SLSA Build Level 2** (hosted builder + signed, non-forgeable-by-author provenance). Isolated-builder **Level 3** (via the `slsa-github-generator` reusable workflow) is on the roadmap. If your org's MCP install path requires verifying that the binary you got from npm was built from the commit it claims, that's available out of the box.
197
197
 
198
198
  None of the four alternatives currently ships SLSA provenance. For some users this is a hard "no" on installing anything else; for most it's a "nice to have".
199
199
 
@@ -29,7 +29,7 @@ Verify the install:
29
29
  enquire-mcp --version
30
30
  ```
31
31
 
32
- Expected output: the current version string (e.g. `3.7.12`).
32
+ Expected output: the current version string (e.g. `3.9.0-rc.N` on `@rc` or `3.8.8` on `@latest`).
33
33
 
34
34
  ## Step 2 — Smoke test (30 seconds)
35
35
 
@@ -126,7 +126,7 @@ You now have working TF-IDF search. To unlock the full hybrid stack:
126
126
 
127
127
  - **One-command full setup** — `enquire-mcp setup --vault /absolute/path/to/your/vault` downloads the multilingual embedding model (~120 MB, one-time), builds the FTS5 BM25 index, and builds the embedding index. Idempotent.
128
128
  - **PDF search** — add `--include-pdfs` to your Claude Desktop args. PDFs get blended into `obsidian_search` results with `[page: N]` citation markers.
129
- - **Cross-encoder reranking** — add `--enable-reranker`. Typical +5-10 NDCG@10 retrieval-quality boost.
129
+ - **Cross-encoder reranking** — add `--enable-reranker`. Measured +15.5 NDCG@10 / +24.7 MRR (60-query ablation).
130
130
  - **Sub-10ms top-K at scale** — add `--use-hnsw`. HNSW vector index, persisted to disk so cold starts stay ~50ms.
131
131
  - **Harder questions** — try `obsidian_hyde_search` (HyDE retrieval, Gao et al 2023) when the literal query phrasing doesn't match how the notes are written.
132
132
  - **Full 44-tool surface** — see [`docs/api.md`](./api.md) for every read/write tool, MCP resource, and prompt.
package/docs/api.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # enquire — API
2
2
 
3
- **enquire is the most advanced Obsidian MCP — a long-term memory layer for AI agents, built on your Obsidian vault.** Open-source, MCP-native, vendor-neutral persistence: agents (Claude Code / Claude Desktop / Cursor / ChatGPT / Codex / OpenClaw / any MCP client) get durable, queryable recall across sessions, models, and providers — your knowledge lives in plain markdown you own, not a vendor cloud. 44 MCP tools (33 always-on read + 4 opt-in read + 7 opt-in write); the 4 opt-ins are: 1 via `--persistent-index` + `--diagnostic-search-tools` (`obsidian_full_text_search` — needs BOTH flags: persistent-index for the FTS5 index, diagnostic-search-tools to surface it as a single-ranker tool alongside the hybrid default `obsidian_search`) + 3 via `--diagnostic-search-tools` (the single-ranker `obsidian_search_text` / `obsidian_semantic_search` / `obsidian_embeddings_search` — gated by default in v2.0+ since `obsidian_search` auto-detects + fuses signals). 2 + 1 opt-in MCP resources, 19 MCP prompts. **v3.1.0+ adds `obsidian_hyde_search`** (HyDE-augmented retrieval, Gao et al 2023; agent supplies a synthetic answer, server embeds it for retrieval) plus the `vault_research` (sub-question decomposition) and `vault_synthesis_page` (Karpathy LLM-Wiki synthesis loop) prompts. v2.6.0+ also speaks Streamable HTTP via `serve-http` (bearer auth + rate-limit + CORS). v2.7.0+ indexes PDFs as a separate read tool surface; **v2.8.0+ blends PDF chunks into `obsidian_search` hybrid retrieval** with `--include-pdfs` — every hit carries a `kind: "md" | "pdf"` flag and PDF snippets include `[page: N]` markers for citation. **v2.9.0+ adds BGE cross-encoder reranking** on top of RRF with `--enable-reranker` — typical +5-10 NDCG@10 retrieval-quality boost. **v2.10.0+ adds Tesseract OCR for image-only / scanned PDFs** via `obsidian_ocr_pdf` — completes the PDF retrieval story.
3
+ **enquire is the most advanced Obsidian MCP — a long-term memory layer for AI agents, built on your Obsidian vault.** Open-source, MCP-native, vendor-neutral persistence: agents (Claude Code / Claude Desktop / Cursor / ChatGPT / Codex / OpenClaw / any MCP client) get durable, queryable recall across sessions, models, and providers — your knowledge lives in plain markdown you own, not a vendor cloud. 44 MCP tools (33 always-on read + 4 opt-in read + 7 opt-in write); the 4 opt-ins are: 1 via `--persistent-index` + `--diagnostic-search-tools` (`obsidian_full_text_search` — needs BOTH flags: persistent-index for the FTS5 index, diagnostic-search-tools to surface it as a single-ranker tool alongside the hybrid default `obsidian_search`) + 3 via `--diagnostic-search-tools` (the single-ranker `obsidian_search_text` / `obsidian_semantic_search` / `obsidian_embeddings_search` — gated by default in v2.0+ since `obsidian_search` auto-detects + fuses signals). 2 + 1 opt-in MCP resources, 19 MCP prompts. **v3.1.0+ adds `obsidian_hyde_search`** (HyDE-augmented retrieval, Gao et al 2023; agent supplies a synthetic answer, server embeds it for retrieval) plus the `vault_research` (sub-question decomposition) and `vault_synthesis_page` (Karpathy LLM-Wiki synthesis loop) prompts. v2.6.0+ also speaks Streamable HTTP via `serve-http` (bearer auth + rate-limit + CORS). v2.7.0+ indexes PDFs as a separate read tool surface; **v2.8.0+ blends PDF chunks into `obsidian_search` hybrid retrieval** with `--include-pdfs` — every hit carries a `kind: "md" | "pdf"` flag and PDF snippets include `[page: N]` markers for citation. **v2.9.0+ adds BGE cross-encoder reranking** on top of RRF with `--enable-reranker` — measured +15.5 NDCG@10 / +24.7 MRR (60-query ablation). **v2.10.0+ adds Tesseract OCR for image-only / scanned PDFs** via `obsidian_ocr_pdf` — completes the PDF retrieval story.
4
4
 
5
- > **Channels:** stable since v3.8.x (`@latest` on npm) ships 44 tools including `obsidian_search` (hybrid BM25 + TF-IDF + ML embeddings, RRF-fused) with optional BGE cross-encoder reranking, `obsidian_embeddings_search`, `obsidian_hyde_search`, plus the `install-model` / `build-embeddings` / `clear-embeddings` / `setup` / `doctor` / `eval` subcommands. The `@rc` dist-tag carries the most recent release candidate (currently v3.9.0-rc.1 — OCR'd PDF watcher embed-sync). Benchmarks live behind `npm run bench:retrieval` (not a CLI subcommand). This document covers the **stable v3.8.x** surface plus what the upcoming v3.9.0 will add — see [CHANGELOG.md](../CHANGELOG.md) for the v3.8.x release series and the in-flight v3.9.0-rc.1.
5
+ > **Channels:** stable since v3.8.x (`@latest` on npm) ships 44 tools including `obsidian_search` (hybrid BM25 + TF-IDF + ML embeddings, RRF-fused) with optional BGE cross-encoder reranking, `obsidian_embeddings_search`, `obsidian_hyde_search`, plus the `install-model` / `build-embeddings` / `clear-embeddings` / `setup` / `doctor` / `eval` subcommands. The `@rc` dist-tag carries the most recent release candidate (see [CHANGELOG.md](../CHANGELOG.md) for the current RC and its features recent RCs add OCR'd PDF watcher embed-sync, HNSW in-memory live update, adaptive HNSW refill, OCR offline enforcement, and watcher concurrency hardening). Benchmarks live behind `npm run bench:retrieval` (not a CLI subcommand). This document covers the **stable v3.8.x** surface plus the in-flight v3.9.0 RCs — see [CHANGELOG.md](../CHANGELOG.md) for full release history.
6
6
 
7
7
  > Versioned dynamically — see [`CHANGELOG.md`](../CHANGELOG.md) for the current release.
8
8
 
@@ -86,7 +86,19 @@ Canonical list of every registered MCP tool. The `Kind` column splits read/write
86
86
  | `--read-paths <pattern...>` | none | **Strict allowlist** — when set, ONLY paths matching one of these glob patterns are visible. Complement to `--exclude-glob`. If both are set: a path must match an allow-glob AND not match any exclude-glob. Same glob semantics. Repeatable. Example: `--read-paths '01_Projects/**' '99_Daily/**'`. |
87
87
  | `--disabled-tools <name...>` | none | Skip registration of specific tools by exact name (matches `tools/list`). Repeatable. Useful for narrow-surface agents. Example: `--disabled-tools obsidian_dataview_query obsidian_full_text_search`. |
88
88
  | `--enabled-tools <name...>` | none | **Strict allowlist** — when set, ONLY listed tools register. Complement to `--disabled-tools`. If both are set: a tool must be in allowlist AND not in denylist. Repeatable. Example: `--enabled-tools obsidian_search_text obsidian_read_note obsidian_get_recent_edits`. |
89
- | `--watch` | off | Watch the vault for `.md` add/change/unlink events (and `.pdf` if `--include-pdfs`). On change: invalidate the parsed-note cache for that file; if `--persistent-index` is also enabled, incrementally re-sync just that file's FTS5 chunks AND (since v3.8.0-rc.2 for `.md`, v3.8.0-rc.3 for `.pdf`) the embed-db rows when the embed-db file exists. Editor saves are debounced via chokidar's `awaitWriteFinish`. `--exclude-glob` patterns are honored — edits to excluded paths don't fire. Off by default; opt in for long-running servers. |
89
+ | `--watch` | off | Watch the vault for `.md` add/change/unlink events (and `.pdf` if `--include-pdfs`). On change: invalidate the parsed-note cache for that file; if `--persistent-index` is also enabled, incrementally re-sync just that file's FTS5 chunks AND (since v3.8.0-rc.2 for `.md`, v3.8.0-rc.3 for `.pdf`) the embed-db rows when the embed-db file exists. **Since v3.9.0-rc.2 with `--use-hnsw`:** the in-memory HNSW index is updated in lockstep so semantic search reflects edits within ~250ms (pre-3.9.0 needed serve restart). Editor saves are debounced via chokidar's `awaitWriteFinish`. `--exclude-glob` patterns are honored — edits to excluded paths don't fire. Off by default; opt in for long-running servers. |
90
+ | `--include-pdfs` | off | v2.8.0 — also index PDF files into FTS5 (and embeddings, if `build-embeddings --include-pdfs` ran). With `--persistent-index`, PDF chunks become first-class hits in `obsidian_search` results with `kind: "pdf"` flag. ~50–200ms per page on M1 cold. Requires the `pdfjs-dist` optionalDependency (default-installed). |
91
+ | `--ocr-pdfs` | off | **v3.9.0-rc.1** — when paired with `--watch` + `--include-pdfs`, runs Tesseract OCR on image-only / scanned PDFs that pdfjs can't read text from. OCR-derived text feeds the embed-db so scanned PDFs stay in sync during long sessions. Requires `tesseract.js` + `@napi-rs/canvas` optional deps + the language pack pre-installed via `enquire-mcp install-ocr-lang <code>` (serve makes no runtime CDN download — a missing pack throws fail-closed, v3.9.0-rc.10; see [SECURITY.md "OCR network posture"](../SECURITY.md#ocr-network-posture)). |
92
+ | `--ocr-langs <langs>` | `eng` | **v3.9.0-rc.1** — Tesseract language pack for `--ocr-pdfs`. Multi-lang via `+`, e.g. `eng+rus`. Each `<lang>.traineddata` (~10 MB) must be pre-installed. |
93
+ | `--ocr-max-pages <n>` | `200` | **v3.9.0-rc.1** — page cap per OCR run. Image-only PDFs exceeding this skip the OCR pass (FTS5 still reindexes from empty pages). Lift the cap for trusted PDF sets; lower for shared deployments to bound per-event CPU. |
94
+ | `--enable-reranker` | off | v2.9.0 — BGE cross-encoder reranking on top of RRF. ~30–50ms per query on M1; measured +15.5 NDCG@10 / +24.7 MRR (60-query ablation). Requires `@huggingface/transformers` optional dep. |
95
+ | `--reranker-model <alias>` | `rerank-bge` | v2.9.0 — reranker alias from `RERANKER_MODELS`. Default verified-working in v3.6.1 (Xenova/bge-reranker-base, ~110 MB, English). |
96
+ | `--reranker-top-n <n>` | `50` | v2.9.0 — how many top RRF-fused candidates to rerank. Only effective with `--enable-reranker`. |
97
+ | `--use-hnsw` | off | v2.13.0 — build an in-memory HNSW vector index on serve start (or reload from `.hnsw.bin` sidecar if `--hnsw-persist`). Sub-10ms top-K queries at any scale. Recall@10 ≥ 98% vs brute-force. **Since v3.9.0-rc.2 with `--watch`:** the index updates live on every md/pdf event (no serve restart needed). **Since v3.9.0-rc.3:** queries auto-refill when post-filter hits < limit (closes the >66% excluded under-return). Requires `hnswlib-node` optional dep. |
98
+ | `--hnsw-ef <n>` | `100` | v2.13.0 — HNSW search-time beam width (must be ≥ k). Higher = more accurate, slightly slower. |
99
+ | `--late-chunk-context <chars>` | `0` | v2.15.0 — late-chunking context windowing on embeddings. Typical +2–5 NDCG@10 boost. Only effective during `build-embeddings` or auto-rebuild. |
100
+ | `--no-hnsw-persist` | persist on | v2.16.0 — disable HNSW persistence sidecar. Default behavior: save `.hnsw.bin` + `.meta.json` next to `.embed.db`; reload on next serve when signature matches (~25s rebuild → ~50ms reload on 50K chunks). |
101
+ | `--quantize-embeddings <mode>` | `f32` | v2.17.0 — vector storage mode. `f32` (default) or `int8` (~4× storage reduction at ~1–2% recall@10 cost). Switching modes triggers a full rebuild. |
90
102
 
91
103
  ## Subcommands
92
104
 
@@ -114,6 +126,7 @@ Canonical list of every registered MCP tool. The `Kind` column splits read/write
114
126
  | `install-model` (v2.0+) | `[alias]` (default `multilingual`) | Pre-download an embedding model so the first MCP call doesn't block on a ~120MB HuggingFace download. Aliases: `multilingual` (Xenova/paraphrase-multilingual-MiniLM-L12-v2, 384-dim, 50+ languages, ~120MB) or `bge` (Xenova/bge-small-en-v1.5, 384-dim, English-only, ~33MB). Models cached under `~/.cache/huggingface/transformers.js/` and reused across vaults. Idempotent. |
115
127
  | `build-embeddings` (v2.0+) | `--vault <path>` `[--embedding-model <alias>]` `[--embed-file <path>]` `[--exclude-glob <pattern...>]` `[--read-paths <pattern...>]` `[--late-chunk-context <chars>]` `[--quantize-embeddings <mode>]` | Cold-build (or refresh) the persistent embedding index for a vault. Required before `obsidian_embeddings_search` and `obsidian_search` (in hybrid mode) are useful. Same paragraph-level chunking as the FTS5 index — chunk identity matches across BM25 and embeddings. Incremental rebuilds via `source_state` mtime tracking. Reports `added`/`updated`/`deleted`/`unchanged` chunk counts. v2.15.0 `--late-chunk-context <chars>` prepends doc title + breadcrumb + neighbor-chunk tails of N chars before embedding (typical 100-200 for +2-5 NDCG@10). v2.17.0 `--quantize-embeddings <mode>` (`f32` default, `int8` for ~4× smaller BLOBs at ≈1-2% recall cost; mode change triggers a full rebuild). |
116
128
  | `clear-embeddings` (v2.0+) | `--vault <path>` `[--embed-file <path>]` | Delete the embedding-index files (`.embed.db` + WAL/SHM sidecar). Idempotent. |
129
+ | `install-ocr-lang` (v3.9.0-rc.10) | `<code>` (e.g. `eng`, `rus`, `chi_sim`) | Download a Tesseract OCR language pack (`<code>.traineddata`, ~10 MB) into the local tessdata cache (`$ENQUIRE_TESSDATA_DIR` → `$XDG_CACHE_HOME/enquire-mcp/tessdata` → `~/.cache/enquire-mcp/tessdata`) so `--ocr-pdfs` works fully offline during serve. The ONLY OCR-related network call — explicit + opt-in, mirroring `install-model`. `serve` itself makes no runtime CDN fetch (a missing pack throws fail-closed). One code per invocation. Idempotent. |
117
130
 
118
131
  ## Read tools (always registered)
119
132
 
@@ -848,7 +861,7 @@ BM25-ranked full-text search over a SQLite FTS5 inverted index. Sub-100ms on mul
848
861
  }
849
862
  ```
850
863
 
851
- **Implementation note:** see [issue #10](https://github.com/oomkapwn/enquire-mcp/issues/10) for the full architecture (production-verified by an external contributor at 1771 chunks / 368 files, 9.8 MB index, 50–100ms BM25 top-10). Local bench against synthetic vault sees 37–103x speedup over the linear-scan path on 100–1000 notes — see [`scripts/bench-search.mjs`](../scripts/bench-search.mjs).
864
+ **Implementation note:** see [issue #10](https://github.com/oomkapwn/enquire-mcp/issues/10) for the full architecture (production-verified by an external contributor at 1771 chunks / 368 files, 9.8 MB index, 50–100ms BM25 top-10). Local bench against synthetic vault sees 37–103x speedup over the linear-scan path on 100–1000 notes — see [`scripts/bench-search.mjs`](https://github.com/oomkapwn/enquire-mcp/blob/main/scripts/bench-search.mjs).
852
865
 
853
866
  ## `obsidian://chunk/{chunkIndex}/{+notePath}` resource _(opt-in, requires `--persistent-index`)_
854
867
 
@@ -1,6 +1,6 @@
1
1
  # Benchmarks — enquire-mcp retrieval quality
2
2
 
3
- **Last updated:** 2026-05-15 (latency numbers re-measured under v3.7.10 against `bench/benchmarks.json`; methodology table updated v3.7.13 M11 to drop the duplicate latency column; ratio claim recomputed v3.7.18 B-3 against current TL;DR figures). Quality metrics (MRR / NDCG@10 / Recall@10) are deterministic and stable across the v3.7.x cascade. · **Generated by:** `npm run bench:retrieval`
3
+ **Last updated:** 2026-05-15 (latency numbers re-measured under v3.7.10 against `bench/benchmarks.json`; methodology table updated v3.7.13 M11 to drop the duplicate latency column; ratio claim recomputed v3.7.18 B-3 against current TL;DR figures). Quality metrics (MRR / NDCG@10 / Recall@10) are deterministic and stable across the v3.7.x → v3.9.0-rc cascade (still valid through the v3.9.0-rc cascade — retrieval pipeline unchanged; v3.8.x→v3.9.0 work was correctness/hardening + watcher live-update, not algorithmic). · **Generated by:** `npm run bench:retrieval`
4
4
 
5
5
  This page reports retrieval-quality numbers for every layer of the enquire-mcp
6
6
  hybrid stack against a deterministic synthetic vault. **Every metric below is
@@ -27,7 +27,7 @@ reproducible from this repository — there are no hand-edited numbers.** Run
27
27
  **Headline takeaways:**
28
28
 
29
29
  - The cross-encoder reranker is the single biggest top-K-precision win:
30
- **+25 MRR points** and **+16 NDCG@10 points** vs. plain hybrid RRF — at a
30
+ **+24.7 MRR points** and **+15.5 NDCG@10 points** vs. plain hybrid RRF — at a
31
31
  ~290 ms latency cost per query on M-series CPU.
32
32
  - Hybrid retrieval maximizes **recall** (every relevant note is somewhere
33
33
  in the top-10 96 % of the time) but base RRF without a reranker has weak
@@ -61,7 +61,7 @@ so the FTS5/embed-db source_state hashes are bit-identical across runs.
61
61
  ### Ground-truth queries
62
62
 
63
63
  The 60 queries live in
64
- [`tests/fixtures/benchmark-queries.jsonl`](../tests/fixtures/benchmark-queries.jsonl).
64
+ [`tests/fixtures/benchmark-queries.jsonl`](https://github.com/oomkapwn/enquire-mcp/blob/main/tests/fixtures/benchmark-queries.jsonl).
65
65
  Each line is one JSON object:
66
66
 
67
67
  ```jsonl
@@ -99,7 +99,7 @@ We report three standard IR metrics from Manning, Raghavan & Schütze,
99
99
  many of the relevant docs did we surface at all?"*
100
100
 
101
101
  All three are computed by the existing
102
- [`src/eval.ts`](../src/eval.ts) implementations — the same code that powers
102
+ [`src/eval.ts`](https://github.com/oomkapwn/enquire-mcp/blob/main/src/eval.ts) implementations — the same code that powers
103
103
  the `enquire-mcp eval` CLI subcommand.
104
104
 
105
105
  ### Stack configurations
@@ -443,6 +443,49 @@ which makes Recall@10 forgiving. On a 1,000-note vault Recall@10 captures
443
443
  reranker's Recall@10 cost (-5.2 points here) would likely be smaller in
444
444
  relative terms.
445
445
 
446
+ ## LongMemEval retrieval (external benchmark)
447
+
448
+ [LongMemEval](https://github.com/xiaowu0162/LongMemEval) (Wu et al. 2024,
449
+ [arXiv:2410.10813](https://arxiv.org/abs/2410.10813)) is the standard
450
+ long-term-memory benchmark the AI-memory leaders (Mem0, Zep) publish against.
451
+ No Obsidian-MCP has any LongMemEval-derived number — so a measured one is a
452
+ clear differentiator.
453
+
454
+ **What we measure — and what we don't.** enquire-mcp is a *retriever* over a
455
+ vault, not an answer-generating chat assistant. So this harness reports
456
+ **retrieval quality** — `recall@k` / `MRR` / `NDCG@k` of the *answer-bearing
457
+ session(s)* per question, using the **same `src/eval.ts` metrics** as the rest
458
+ of this document. It deliberately does **not** report LongMemEval's end-to-end
459
+ QA accuracy: that requires an LLM to generate an answer from the retrieved
460
+ context, which is the calling agent's job, not the memory layer's. Reporting a
461
+ QA-accuracy number for a retriever would be an overclaim.
462
+
463
+ **Harness.** [`scripts/bench-longmemeval.mjs`](https://github.com/oomkapwn/enquire-mcp/blob/main/scripts/bench-longmemeval.mjs)
464
+ (shipped v3.9.0-rc.19) materializes each question's haystack sessions into a
465
+ throwaway vault (one note per session), indexes it with FTS5, runs
466
+ `searchHybrid`, and scores `recall@k` / `MRR` / `NDCG@k` of the answer
467
+ session(s) — aggregated overall and per `question_type` (single-session,
468
+ multi-session, temporal-reasoning, knowledge-update, …). Abstention questions
469
+ (`*_abs`) are counted separately, not scored for recall.
470
+
471
+ **Running it** (the dataset is **not** committed — size + licensing):
472
+
473
+ ```bash
474
+ # 1. Download longmemeval_s / _m / _oracle from the LongMemEval repo
475
+ # 2. Then:
476
+ npm run bench:longmemeval -- --dataset path/to/longmemeval_s.json --k 10
477
+ # optional: --limit N (sample the first N questions) · --embeddings (add the
478
+ # dense arm — heavy: per-question embed-db build)
479
+ ```
480
+
481
+ **Status:** the harness + its pure-function tests ship in v3.9.0-rc.19; the
482
+ **headline numbers are intentionally not published here yet** — they will be
483
+ added once the maintainer runs the full set on reference hardware and reviews
484
+ the methodology (a published LongMemEval figure is the project's credibility
485
+ centerpiece, so it goes through the same "measured, reproducible, reviewed"
486
+ bar as every other number in this document — never a placeholder or an
487
+ estimate).
488
+
446
489
  ## Future work
447
490
 
448
491
  - Reproduce on **public BEIR / TREC subsets** so numbers can be compared
@@ -462,12 +505,12 @@ relative terms.
462
505
 
463
506
  - [`docs/COMPARISON.md`](./COMPARISON.md) — feature matrix vs. other
464
507
  Obsidian-MCP servers.
465
- - [`docs/api-reference/`](./api-reference/) — TypeDoc-generated API
508
+ - [`docs/api-reference/`](https://oomkapwn.github.io/enquire-mcp/) — TypeDoc-generated API
466
509
  reference (links into `searchHybrid`, `embeddingsSearch`,
467
510
  `semanticSearch`).
468
- - [`src/eval.ts`](../src/eval.ts) — the eval harness used by both this
511
+ - [`src/eval.ts`](https://github.com/oomkapwn/enquire-mcp/blob/main/src/eval.ts) — the eval harness used by both this
469
512
  bench script and the `enquire-mcp eval` CLI subcommand.
470
- - [`tests/fixtures/benchmark-queries.jsonl`](../tests/fixtures/benchmark-queries.jsonl)
513
+ - [`tests/fixtures/benchmark-queries.jsonl`](https://github.com/oomkapwn/enquire-mcp/blob/main/tests/fixtures/benchmark-queries.jsonl)
471
514
  — the ground-truth query set.
472
- - [`bench/benchmarks.json`](../bench/benchmarks.json) — machine-readable
515
+ - [`bench/benchmarks.json`](https://github.com/oomkapwn/enquire-mcp/blob/main/bench/benchmarks.json) — machine-readable
473
516
  output (includes per-query scores and per-category breakdowns).
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@oomkapwn/enquire-mcp",
4
- "version": "3.9.0-rc.2",
4
+ "version": "3.9.0-rc.21",
5
5
  "mcpName": "io.github.oomkapwn/enquire-mcp",
6
- "description": "MCP server giving AI agents (Claude Code, Claude Desktop, Cursor, ChatGPT, Codex, OpenClaw) persistent long-term memory backed by your local Obsidian markdown vault. Hybrid retrieval (BM25 + ML embeddings + BGE reranker, RRF-fused), HNSW + int8 quantization, agentic RAG (HyDE + sub-question decomposition), GraphRAG-light (Louvain), standalone Obsidian Bases, PDFs + Tesseract OCR. Vendor-neutral memory layer for any MCP-compatible agent. 44 tools, 19 MCP prompts, 911 tests, SLSA-3, semver-bound, MIT, zero cloud calls during serve.",
6
+ "description": "MCP server giving AI agents (Claude Code, Claude Desktop, Cursor, ChatGPT, Codex, OpenClaw) persistent long-term memory backed by your local Obsidian markdown vault. Hybrid retrieval (BM25 + ML embeddings + BGE reranker, RRF-fused), HNSW + int8 quantization, agentic RAG (HyDE + sub-question decomposition), GraphRAG-light (Louvain), standalone Obsidian Bases, PDFs + Tesseract OCR. Vendor-neutral memory layer for any MCP-compatible agent. 44 tools, 19 MCP prompts, 995 tests, signed npm build provenance (SLSA L2), semver-bound, MIT, zero cloud calls during serve.",
7
7
  "type": "module",
8
8
  "bin": {
9
9
  "enquire-mcp": "dist/index.js"
@@ -82,6 +82,7 @@
82
82
  "bench:quick": "npm run build && node scripts/bench.mjs --quick",
83
83
  "bench:retrieval": "npm run build && node scripts/run-benchmarks.mjs",
84
84
  "bench:peek-cache": "npm run build && node scripts/bench-peek-cache.mjs",
85
+ "bench:longmemeval": "npm run build && node scripts/bench-longmemeval.mjs",
85
86
  "docs:api": "typedoc",
86
87
  "prepare": "tsc && chmod +x dist/index.js && (husky 2>/dev/null || true)",
87
88
  "prepublishOnly": "npm run lint && npm run build && npm test && node scripts/check-version-consistency.mjs && npm audit --audit-level=high && npm run test:coverage --silent && node scripts/check-changelog-coverage.mjs && node scripts/check-per-file-coverage.mjs",
@@ -160,7 +161,7 @@
160
161
  "tesseract",
161
162
  "streamable-http",
162
163
  "remote-mcp",
163
- "slsa-3"
164
+ "build-provenance"
164
165
  ],
165
166
  "author": "Alex (@OomkaBear)",
166
167
  "license": "MIT",
@@ -183,7 +184,7 @@
183
184
  "zod": "^4.4.3"
184
185
  },
185
186
  "devDependencies": {
186
- "@biomejs/biome": "^2.4.15",
187
+ "@biomejs/biome": "^2.4.16",
187
188
  "@huggingface/transformers": "^4.2.0",
188
189
  "@types/better-sqlite3": "^7.6.13",
189
190
  "@types/node": "^25.6.2",