@vortex-os/memory-extended 0.5.1 → 0.5.2

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 (60) hide show
  1. package/README.md +17 -17
  2. package/dist/mcp/recall-tool.d.ts +13 -1
  3. package/dist/mcp/recall-tool.d.ts.map +1 -1
  4. package/dist/mcp/recall-tool.js +37 -8
  5. package/dist/mcp/recall-tool.js.map +1 -1
  6. package/dist/mcp/server.d.ts.map +1 -1
  7. package/dist/mcp/server.js +4 -1
  8. package/dist/mcp/server.js.map +1 -1
  9. package/dist/recall/engine.d.ts +20 -18
  10. package/dist/recall/engine.d.ts.map +1 -1
  11. package/dist/recall/engine.js +248 -56
  12. package/dist/recall/engine.js.map +1 -1
  13. package/dist/recall/ftsQuery.d.ts +29 -0
  14. package/dist/recall/ftsQuery.d.ts.map +1 -0
  15. package/dist/recall/ftsQuery.js +36 -0
  16. package/dist/recall/ftsQuery.js.map +1 -0
  17. package/dist/recall/fusion.d.ts +58 -0
  18. package/dist/recall/fusion.d.ts.map +1 -0
  19. package/dist/recall/fusion.js +115 -0
  20. package/dist/recall/fusion.js.map +1 -0
  21. package/dist/recall/index.d.ts +3 -1
  22. package/dist/recall/index.d.ts.map +1 -1
  23. package/dist/recall/index.js +1 -0
  24. package/dist/recall/index.js.map +1 -1
  25. package/dist/recall/types.d.ts +24 -2
  26. package/dist/recall/types.d.ts.map +1 -1
  27. package/dist/sessionArchive/adapters/claude-code.d.ts.map +1 -1
  28. package/dist/sessionArchive/adapters/claude-code.js +38 -4
  29. package/dist/sessionArchive/adapters/claude-code.js.map +1 -1
  30. package/dist/sessionArchive/index.d.ts +1 -1
  31. package/dist/sessionArchive/index.d.ts.map +1 -1
  32. package/dist/sessionArchive/index.js.map +1 -1
  33. package/dist/sessionArchive/store.d.ts +22 -1
  34. package/dist/sessionArchive/store.d.ts.map +1 -1
  35. package/dist/sessionArchive/store.js +143 -12
  36. package/dist/sessionArchive/store.js.map +1 -1
  37. package/dist/sqlite/fts.d.ts +38 -0
  38. package/dist/sqlite/fts.d.ts.map +1 -0
  39. package/dist/sqlite/fts.js +102 -0
  40. package/dist/sqlite/fts.js.map +1 -0
  41. package/dist/sqlite/index.d.ts +2 -0
  42. package/dist/sqlite/index.d.ts.map +1 -1
  43. package/dist/sqlite/index.js +1 -0
  44. package/dist/sqlite/index.js.map +1 -1
  45. package/dist/sqlite/store.d.ts +8 -1
  46. package/dist/sqlite/store.d.ts.map +1 -1
  47. package/dist/sqlite/store.js +29 -7
  48. package/dist/sqlite/store.js.map +1 -1
  49. package/dist/vector/embedder.d.ts +11 -0
  50. package/dist/vector/embedder.d.ts.map +1 -1
  51. package/dist/vector/embedder.js +4 -1
  52. package/dist/vector/embedder.js.map +1 -1
  53. package/dist/vector/segment.d.ts +1 -1
  54. package/dist/vector/store.d.ts +12 -2
  55. package/dist/vector/store.d.ts.map +1 -1
  56. package/dist/vector/store.js +17 -2
  57. package/dist/vector/store.js.map +1 -1
  58. package/dist/vector/types.d.ts +1 -1
  59. package/dist/vector/types.js +1 -1
  60. package/package.json +2 -2
package/README.md CHANGED
@@ -8,20 +8,20 @@ Extended memory layer for VortEX — an **opt-in add-on** that lives on top of `
8
8
 
9
9
  | Namespace | Purpose | Status |
10
10
  |---|---|---|
11
- | `sessionArchive` | Append-only JSONL log of agent sessions + SQLite metadata. Four first-party host adapters (Claude Code CLI, Codex CLI, Gemini CLI, Claude Desktop). | Phase 11b — **shipped (0.1.0)** |
12
- | `consolidate` | Post-session fact-extraction proposer — read past `sessionArchive` events, propose memory candidates, operator confirms. | Phase 11d — **shipped (0.1.0)** |
13
- | `sqlite` | Structured store derived from markdown memories — hard-filter queries (`byType` / `byTag` / `byPrivacy` / `updatedSince`), drift detection (log + skip, non-destructive). | Phase 11a — **shipped (0.2.0)**. Five operator decisions recorded in `docs/memory-extended-design.md`. |
14
- | `vector` | Dense retrieval over memories **and conversation sessions**. Default backend: **in-process brute-force cosine**; vectors in the shared `memory.sqlite`. Host-injected `EmbedFn` (multilingual local default). Sessions are vectorized at topic-chunk granularity via embedding-similarity segmentation. | Phase 11c — **shipped (0.3.0+)** |
15
- | `recall` | Two-stage hybrid retrieval **engine** (SQLite loose hard-filter → cosine rerank). Returns data, not a report. Hits carry `source` = `memory` \| `session-archive`. `/recall <query>` command lives in `session-rituals`. | Phase 11c — **shipped (0.3.0+)** |
16
- | `mcp` | MCP server for any MCP host (Claude Desktop, chatbots) over stdio: read tools (`recall`, `list_memories`, `get_memory`) + document tools (`suggest_document` → `write_document` / `decline_document`, a propose-then-write pair), plus a one-line `install` into the host config. Writes are gated behind an explicit second tool call. SDK is an optional dependency. Bin: `vortex-mcp-recall`. | **shipped (0.5.0+)** |
11
+ | `sessionArchive` | Append-only JSONL log of agent sessions + SQLite metadata. Four first-party host adapters (Claude Code CLI, Codex CLI, Gemini CLI, Claude Desktop). | Shipped |
12
+ | `consolidate` | Post-session fact-extraction proposer — read past `sessionArchive` events, propose memory candidates, operator confirms. | Shipped |
13
+ | `sqlite` | Structured store derived from markdown memories — hard-filter queries (`byType` / `byTag` / `byPrivacy` / `updatedSince`), drift detection (log + skip, non-destructive). | Shipped |
14
+ | `vector` | Dense retrieval over memories **and conversation sessions**. Default backend: **in-process brute-force cosine**; vectors in the shared `memory.sqlite`. Host-injected `EmbedFn` (multilingual local default). Sessions are vectorized at topic-chunk granularity via embedding-similarity segmentation. | Shipped |
15
+ | `recall` | Two-stage hybrid retrieval **engine** (SQLite loose hard-filter → cosine rerank). Returns data, not a report. Hits carry `source` = `memory` \| `session-archive`. `/recall <query>` command lives in `session-rituals`. | Shipped |
16
+ | `mcp` | MCP server for any MCP host (Claude Desktop, chatbots) over stdio: read tools (`recall`, `list_memories`, `get_memory`) + document tools (`suggest_document` → `write_document` / `decline_document`, a propose-then-write pair), plus a one-line `install` into the host config. Writes are gated behind an explicit second tool call. SDK is an optional dependency. Bin: `vortex-mcp-recall`. | Shipped |
17
17
 
18
- The companion module **`proactive-curator`** (shipped inside `@vortex-os/base`) handles the *in-session* counterpart to `consolidate` — live "this looks worth capturing" prompts during an ongoing conversation. `memory-extended/consolidate` reuses its `Proposal` / `LLMJudge` types via the base aggregate, so a single host UX renders both surfaces.
18
+ The companion module **`proactive-curator`** (shipped inside `@vortex-os/base`) handles the *in-session* counterpart to `consolidate` — live "this looks worth capturing" prompts during an ongoing conversation. `memory-extended/consolidate` emits proposals shaped identically to `proactive-curator`'s `Proposal` / `LLMJudge` types (that small surface is **inlined** under `src/internal/`, not imported), so a single host UX renders both surfaces.
19
19
 
20
20
  ## What it is not
21
21
 
22
22
  - It does **not** replace `@vortex-os/base`'s `memorySystem`. The markdown layer remains the source of truth; this package adds *derived* indexes that can be deleted and regenerated at any time.
23
23
  - It does **not** write to `_memory/` directly. The `consolidate` namespace proposes; the operator confirms; writes go through `base`'s `memorySystem`.
24
- - It does **not** require all five namespaces to be present. Use what you need; drop the rest.
24
+ - It does **not** require all of its namespaces to be present. Use what you need; drop the rest.
25
25
 
26
26
  ## Installation
27
27
 
@@ -31,7 +31,7 @@ npm install @vortex-os/memory-extended @vortex-os/base better-sqlite3
31
31
  npm install classic-level
32
32
  ```
33
33
 
34
- `@vortex-os/base` is a required peer dependency`consolidate` reuses the `proactiveCurator` namespace it exposes for `Proposal` / `LLMJudge` types. `better-sqlite3` is required for the SQLite metadata layer. `classic-level` is optional — required only when the Claude Desktop adapter is registered.
34
+ `@vortex-os/base` is a required peer because this package is an **add-on layered onto a base instance** it expects a base-scaffolded `data/` layout alongside it, not because its code imports base. (memory-extended is self-contained: its only runtime dependency is `yaml`; the `proactive-curator` types `consolidate` mirrors are inlined under `src/internal/`.) `better-sqlite3` is required for the SQLite metadata layer. `classic-level` is optional — required only when the Claude Desktop adapter is registered.
35
35
 
36
36
  The local embedder (`@huggingface/transformers`) is an **optional dependency** — it installs automatically with this package; nothing to fetch by hand. The default model is **`Xenova/multilingual-e5-small`** (384-dim, 50+ languages incl. Korean, 512-token input, ~470 MB) — a retrieval-tuned multilingual model that downloads once on first `vector`/`recall` use and is cached. It is *asymmetric*: a `"query: "` prefix is applied to search text and `"passage: "` to indexed text automatically (the store passes the right `kind`). To use a *symmetric* model instead (e.g. `Xenova/all-MiniLM-L6-v2`, ~90 MB) pass `{ model: "...", prefixes: null }`. To skip the local model entirely, pass your own `EmbedFn` (e.g. an OpenAI/Voyage adapter).
37
37
 
@@ -70,7 +70,7 @@ await rebuildFromMemoryDir(store, "./data/_memory");
70
70
 
71
71
  // Four hard-filter helpers.
72
72
  const rules = store.byType("feedback");
73
- const koreanRules = store.byTag("korean");
73
+ const taggedRules = store.byTag("onboarding");
74
74
  const visiblePublic = store.byPrivacy("public");
75
75
  const fresh = store.updatedSince("2026-05-01");
76
76
 
@@ -89,7 +89,7 @@ console.log(`drifted ${report.drifted.length}/${report.rowsScanned}`);
89
89
  store.close();
90
90
  ```
91
91
 
92
- The sqlite file lives under `data/_indexes/` (gitignored). Markdown remains the source of truth — the sqlite index is derived and rebuildable. See the operator decision table in [`docs/memory-extended-design.md`](../../docs/memory-extended-design.md#sqlite-namespace) for the rationale.
92
+ The sqlite file lives under `data/_indexes/` (gitignored). Markdown remains the source of truth — the sqlite index is derived and rebuildable. See the operator decision table in [`docs/memory-extended-design.md`](https://github.com/vortex-os-project/vortex/blob/main/docs/memory-extended-design.md#sqlite-namespace) for the rationale.
93
93
 
94
94
  ## Quick usage — `vector` + `recall`
95
95
 
@@ -108,7 +108,7 @@ await vector.rebuild(sqlite, embed); // → { indexed, skipped,
108
108
 
109
109
  // The engine returns DATA — list it, or phrase one hit in conversation.
110
110
  const result = await recall(
111
- { query: "tone feedback from 5월", k: 5 }, // intent: type/tag/Korean-month parsed loosely
111
+ { query: "tone feedback from last May", k: 5 }, // intent: type/tag/month parsed loosely
112
112
  { sqlite, vector, embed },
113
113
  );
114
114
  console.log(renderRecallHits(result)); // optional compact list render
@@ -117,7 +117,7 @@ vector.close();
117
117
  sqlite.close();
118
118
  ```
119
119
 
120
- The vector index shares the same `memory.sqlite` (a `memory_vectors` table) — one file, one rebuild path. The `/recall <query>` slash command wraps this engine; register it via `createRitualRegistry({ recall: { embed } })` in `@vortex-os/session-rituals`. The engine returns structured hits rather than a report so the host can either render a list or weave a hit into conversation (operator decision 5). See [`docs/memory-extended-design.md`](../../docs/memory-extended-design.md#vector-namespace) for the backend/embedder rationale.
120
+ The vector index shares the same `memory.sqlite` (a `memory_vectors` table) — one file, one rebuild path. The `/recall <query>` slash command wraps this engine; register it via `createRitualRegistry({ recall: { embed } })` in `@vortex-os/session-rituals`. The engine returns structured hits rather than a report so the host can either render a list or weave a hit into conversation (operator decision 5). See [`docs/memory-extended-design.md`](https://github.com/vortex-os-project/vortex/blob/main/docs/memory-extended-design.md#vector-namespace) for the backend/embedder rationale.
121
121
 
122
122
  **Conversation sessions** are searchable too. `vector.rebuildSessions(sessionArchiveStore, embed)` vectorizes each archived session and stores chunks under `source: "session-archive"` plus a `session_chunks` metadata row for hydration. Run `npx rebuild-memory-vector --sessions`. `recall` then returns session hits alongside memory hits (pass a `SessionChunkStore` as `sessionChunks` to hydrate them; without it session hits are skipped). Filter to one corpus with `/recall <q> --source session-archive`.
123
123
 
@@ -238,7 +238,7 @@ The consolidator queries recently-ingested sessions from `sessionArchive`, asks
238
238
 
239
239
  ## Design documents
240
240
 
241
- - [`docs/memory-extended-design.md`](../../docs/memory-extended-design.md) — cluster overview, sub-phase breakdown, industry pattern alignment
242
- - [`docs/transcript-adapter-design.md`](../../docs/transcript-adapter-design.md) — `sessionArchive` adapter interface, per-host schema mapping, on-disk storage, SQLite schema, lock-handling UX
243
- - [`docs/proactive-curator-design.md`](../../docs/proactive-curator-design.md) — in-session counterpart (separate module)
244
- - [`docs/architecture.md`](../../docs/architecture.md#multi-layer-memory-architecture) — multi-layer memory architecture, source-of-truth policy
241
+ - [`docs/memory-extended-design.md`](https://github.com/vortex-os-project/vortex/blob/main/docs/memory-extended-design.md) — cluster overview, sub-phase breakdown, industry pattern alignment
242
+ - [`docs/transcript-adapter-design.md`](https://github.com/vortex-os-project/vortex/blob/main/docs/transcript-adapter-design.md) — `sessionArchive` adapter interface, per-host schema mapping, on-disk storage, SQLite schema, lock-handling UX
243
+ - [`docs/proactive-curator-design.md`](https://github.com/vortex-os-project/vortex/blob/main/docs/proactive-curator-design.md) — in-session counterpart (separate module)
244
+ - [`docs/architecture.md`](https://github.com/vortex-os-project/vortex/blob/main/docs/architecture.md#multi-layer-memory-architecture) — multi-layer memory architecture, source-of-truth policy
@@ -1,4 +1,4 @@
1
- import type { RecallResult } from "../recall/types.js";
1
+ import type { RecallResult, RecallMode } from "../recall/types.js";
2
2
  import type { EmbedFn, VectorSource } from "../vector/types.js";
3
3
  export declare const RECALL_TOOL_NAME = "recall";
4
4
  /**
@@ -21,6 +21,11 @@ export declare const recallToolDefinition: {
21
21
  type: string;
22
22
  description: string;
23
23
  };
24
+ mode: {
25
+ type: string;
26
+ enum: string[];
27
+ description: string;
28
+ };
24
29
  source: {
25
30
  type: string;
26
31
  enum: string[];
@@ -33,6 +38,7 @@ export declare const recallToolDefinition: {
33
38
  export interface RunRecallArgs {
34
39
  readonly query: string;
35
40
  readonly k?: number;
41
+ readonly mode?: RecallMode;
36
42
  readonly source?: VectorSource;
37
43
  readonly noHardFilter?: boolean;
38
44
  }
@@ -41,6 +47,12 @@ export interface RunRecallDeps {
41
47
  readonly embed: EmbedFn;
42
48
  /** Absolute path to the memory SQLite index (e.g. <dataDir>/_indexes/memory.sqlite). */
43
49
  readonly dbPath: string;
50
+ /**
51
+ * Instance data dir, for locating the session archive (keyword session lane).
52
+ * If omitted, it is inferred as the grandparent of `dbPath` (the
53
+ * `<dataDir>/_indexes/memory.sqlite` convention); pass it when `dbPath` is custom.
54
+ */
55
+ readonly dataDir?: string;
44
56
  readonly defaultK?: number;
45
57
  }
46
58
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"recall-tool.d.ts","sourceRoot":"","sources":["../../src/mcp/recall-tool.ts"],"names":[],"mappings":"AACA,OA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AE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AASD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAyC/F"}
@@ -1,7 +1,9 @@
1
+ import { dirname } from "node:path";
1
2
  import { recall as recallEngine } from "../recall/engine.js";
2
3
  import { MemorySqliteStore } from "../sqlite/store.js";
3
4
  import { MemoryVectorStore } from "../vector/store.js";
4
5
  import { SessionChunkStore } from "../vector/session.js";
6
+ import { SessionArchiveStore } from "../sessionArchive/index.js";
5
7
  export const RECALL_TOOL_NAME = "recall";
6
8
  /**
7
9
  * MCP tool descriptor for `recall`, as plain JSON (no MCP SDK types at build
@@ -11,7 +13,7 @@ export const RECALL_TOOL_NAME = "recall";
11
13
  */
12
14
  export const recallToolDefinition = {
13
15
  name: RECALL_TOOL_NAME,
14
- description: "Semantic search over the user's VortEX memory (markdown frontmatter memories + session archive). " +
16
+ description: "Hybrid keyword + semantic search over the user's VortEX memory (markdown frontmatter memories + session archive). " +
15
17
  "Returns structured hits: score, name, description, type, tags, and a short excerpt. " +
16
18
  "Use it to recall prior context, decisions, preferences, or facts the user has stored.",
17
19
  inputSchema: {
@@ -19,6 +21,11 @@ export const recallToolDefinition = {
19
21
  properties: {
20
22
  query: { type: "string", description: "Natural-language search query." },
21
23
  k: { type: "number", description: "Maximum number of hits to return (default 5)." },
24
+ mode: {
25
+ type: "string",
26
+ enum: ["keyword", "semantic", "hybrid"],
27
+ description: "Search mode. 'keyword' for exact terms / error codes / file names / identifiers; 'semantic' for concepts / topics; 'hybrid' (default) runs both and fuses.",
28
+ },
22
29
  source: {
23
30
  type: "string",
24
31
  enum: ["memory", "session-archive"],
@@ -45,16 +52,38 @@ export async function runRecall(args, deps) {
45
52
  return EMPTY_RESULT;
46
53
  }
47
54
  const k = args.k && args.k > 0 ? args.k : deps.defaultK ?? 5;
48
- const sqlStore = new MemorySqliteStore(deps.dbPath);
49
- const vecStore = new MemoryVectorStore({ db: deps.dbPath });
50
- const chunkStore = new SessionChunkStore(deps.dbPath);
55
+ // Construct stores INSIDE the try so a later constructor throwing still lets the
56
+ // finally close whichever handles were already opened (Codex F5).
57
+ let sqlStore;
58
+ let vecStore;
59
+ let chunkStore;
60
+ let archive;
51
61
  try {
52
- return await recallEngine({ query, k, source: args.source, noHardFilter: args.noHardFilter }, { sqlite: sqlStore, vector: vecStore, embed: deps.embed, sessionChunks: chunkStore });
62
+ sqlStore = new MemorySqliteStore(deps.dbPath);
63
+ vecStore = new MemoryVectorStore({ db: deps.dbPath });
64
+ chunkStore = new SessionChunkStore(deps.dbPath);
65
+ // The keyword session lane reads the archive's events_fts. dbPath is
66
+ // <dataDir>/_indexes/memory.sqlite, so the dataDir is two levels up.
67
+ // Best-effort: without it, the session keyword lane is silently skipped.
68
+ try {
69
+ archive = new SessionArchiveStore(deps.dataDir ?? dirname(dirname(deps.dbPath)));
70
+ }
71
+ catch {
72
+ archive = undefined;
73
+ }
74
+ return await recallEngine({ query, k, mode: args.mode, source: args.source, noHardFilter: args.noHardFilter }, {
75
+ sqlite: sqlStore,
76
+ vector: vecStore,
77
+ embed: deps.embed,
78
+ sessionChunks: chunkStore,
79
+ sessionArchive: archive,
80
+ });
53
81
  }
54
82
  finally {
55
- chunkStore.close();
56
- vecStore.close();
57
- sqlStore.close();
83
+ archive?.close();
84
+ chunkStore?.close();
85
+ vecStore?.close();
86
+ sqlStore?.close();
58
87
  }
59
88
  }
60
89
  //# sourceMappingURL=recall-tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recall-tool.js","sourceRoot":"","sources":["../../src/mcp/recall-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,mGAAmG;QACnG,sFAAsF;QACtF,uFAAuF;IACzF,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gCAAgC,EAAE;YACxE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;YACnF,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC;gBACnC,WAAW,EAAE,wDAAwD;aACtE;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB;CACF,CAAC;AAiBF,MAAM,YAAY,GAAiB;IACjC,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,aAAa,CAAC,EAAE;IACjE,KAAK,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,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AI,CAAC,CAAC;IAC/C,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC,CA6FD"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAsBlD,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAC9E,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC,CAiGD"}
@@ -33,7 +33,10 @@ export async function createRecallServer(options) {
33
33
  try {
34
34
  if (name === RECALL_TOOL_NAME) {
35
35
  const source = raw.source === "memory" || raw.source === "session-archive" ? raw.source : undefined;
36
- const result = await runRecall({ query: str(raw.query) ?? "", k: num(raw.k), source }, { embed: options.embed, dbPath: options.dbPath, defaultK: options.defaultK });
36
+ const mode = raw.mode === "keyword" || raw.mode === "semantic" || raw.mode === "hybrid"
37
+ ? raw.mode
38
+ : undefined;
39
+ const result = await runRecall({ query: str(raw.query) ?? "", k: num(raw.k), mode, source }, { embed: options.embed, dbPath: options.dbPath, dataDir: options.dataDir, defaultK: options.defaultK });
37
40
  return jsonResult({ query: result.query, count: result.hits.length, hits: result.hits });
38
41
  }
39
42
  if (name === LIST_MEMORIES_TOOL_NAME) {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,EAC7B,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAkB7B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA4B;IAInE,MAAM,GAAG,GAAG,MAAM,UAAU,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAC3B,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,mBAAmB,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO,EAAE,EAClF,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAChC,CAAC;IAEF,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QAChE,KAAK,EAAE;YACL,oBAAoB;YACpB,0BAA0B;YAC1B,uBAAuB;YACvB,6BAA6B;YAC7B,2BAA2B;YAC3B,6BAA6B;SAC9B;KACF,CAAC,CAAC,CAAC;IAEJ,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,EAAE,OAA2B,EAAE,EAAE;QACxF,MAAM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G,2CAA2C,CAAC;IACpE,MAAM,cAAc,GAAG,oCAAoC,CAAC;IAC5D,IAAI,CAAC;QACH,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC9C,MAAM,CAAC,eAAe,CAAC;YACvB,MAAM,CAAC,cAAc,CAAC;SACvB,CAAC,CAAC;QACH,OAAO;YACL,MAAM,EAAG,SAA0C,CAAC,MAAM;YAC1D,sBAAsB,EAAG,QAAgD;iBACtE,sBAAsB;YACzB,qBAAqB,EAAG,QAA+C;iBACpE,qBAAqB;SACzB,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,kEAAkE;YAChE,sFAAsF;YACtF,kEAAmE,CAAW,CAAC,OAAO,EAAE,CAC3F,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -2,6 +2,7 @@ import type { MemorySqliteStore } from "../sqlite/store.js";
2
2
  import type { MemoryVectorStore } from "../vector/store.js";
3
3
  import type { EmbedFn } from "../vector/types.js";
4
4
  import type { SessionChunkStore } from "../vector/session.js";
5
+ import type { SessionArchiveStore } from "../sessionArchive/index.js";
5
6
  import type { RecallParams, RecallResult } from "./types.js";
6
7
  /** Dependencies the recall engine needs the host to supply. */
7
8
  export interface RecallDeps {
@@ -9,30 +10,31 @@ export interface RecallDeps {
9
10
  readonly vector: MemoryVectorStore;
10
11
  readonly embed: EmbedFn;
11
12
  /**
12
- * Optional — hydrates `session-archive` hits with timestamp + excerpt.
13
- * Without it, session hits are dropped (graceful degradation), so a host
13
+ * Hydrates session-archive SEMANTIC hits (vector chunk metadata). Without
14
+ * it the session semantic lane is skipped (graceful degradation), so a host
14
15
  * that has not vectorized sessions still gets memory recall.
15
16
  */
16
17
  readonly sessionChunks?: SessionChunkStore;
18
+ /**
19
+ * Enables the session KEYWORD lane (`searchEvents`). Without it the session
20
+ * keyword lane is skipped — the same graceful-degradation precedent.
21
+ */
22
+ readonly sessionArchive?: SessionArchiveStore;
17
23
  }
18
24
  /**
19
- * Two-stage hybrid recall (operator decision 5 / 2026-05-29). Returns
20
- * structured {@link RecallResult} data never a pre-rendered report. The
21
- * caller decides whether to list the hits (explicit `/recall`) or phrase
22
- * one in conversation (ambient use).
25
+ * Hybrid recall (P3). Branches on `mode`:
26
+ * - `semantic` the original cosine pipeline (memory hard-filter vector
27
+ * rerank), unchanged in behavior.
28
+ * - `keyword` — FTS5 over memories + session events.
29
+ * - `hybrid` (default) — both lanes, fused by Reciprocal Rank Fusion.
23
30
  *
24
- * Pipeline:
25
- * 1. **Parse intent** pull obvious filters (type / tag / date) out of the
26
- * query (regex, no LLM).
27
- * 2. **Hard filter (loose)**if filters were found, restrict candidates
28
- * via SQLite. *But* if that leaves fewer than `k` candidates, the
29
- * filter is dropped and the semantic stage runs over the whole corpus.
30
- * This is the safeguard against the over-narrowing risk: a guessed
31
- * filter never costs you a relevant-but-unfiltered memory.
32
- * 3. **Semantic rerank** — embed the (filter-stripped) query text and ask
33
- * the vector store for the closest candidates.
34
- * 4. **Hydrate** — join vector hits back to their memory rows for name,
35
- * description, tags, and a body excerpt.
31
+ * Returns structured {@link RecallResult} data — never a pre-rendered report.
32
+ * The memory hard-filter (parsed type/tag/date) constrains the MEMORY lanes
33
+ * only; session lanes filter by their own semantics (§12 R8). Session hits fuse
34
+ * at the SESSION level the semantic lane is de-duped to one best chunk per
35
+ * session before ranking (§13). The tool_result keyword downweight applies in
36
+ * `hybrid` only (§12 R6). `score` stays cosine for any semantically-matched
37
+ * hit; a keyword-only hit gets `1/(1+rank)` (§12 R7).
36
38
  */
37
39
  export declare function recall(params: RecallParams, deps: RecallDeps): Promise<RecallResult>;
38
40
  //# sourceMappingURL=engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/recall/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;A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