hippo-memory 1.24.1 → 1.26.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.
Files changed (125) hide show
  1. package/bin/hippo.js +2 -2
  2. package/dist/api.d.ts +12 -17
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +46 -61
  5. package/dist/api.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +109 -15
  8. package/dist/cli.js.map +1 -1
  9. package/dist/compare.d.ts +78 -0
  10. package/dist/compare.d.ts.map +1 -0
  11. package/dist/compare.js +92 -0
  12. package/dist/compare.js.map +1 -0
  13. package/dist/connectors/github/backfill.js +4 -4
  14. package/dist/connectors/github/cli-impl.js +6 -6
  15. package/dist/connectors/github/dlq.js +14 -14
  16. package/dist/connectors/slack/backfill.js +1 -1
  17. package/dist/connectors/slack/dlq.js +10 -10
  18. package/dist/connectors/slack/workspaces.js +4 -4
  19. package/dist/dag.js +6 -6
  20. package/dist/dashboard.js +7 -7
  21. package/dist/embedding-provider.d.ts +7 -3
  22. package/dist/embedding-provider.d.ts.map +1 -1
  23. package/dist/embedding-provider.js +7 -3
  24. package/dist/embedding-provider.js.map +1 -1
  25. package/dist/embeddings.d.ts +58 -0
  26. package/dist/embeddings.d.ts.map +1 -1
  27. package/dist/embeddings.js +66 -8
  28. package/dist/embeddings.js.map +1 -1
  29. package/dist/goals.d.ts.map +1 -1
  30. package/dist/goals.js +4 -0
  31. package/dist/goals.js.map +1 -1
  32. package/dist/graph-recall.d.ts.map +1 -1
  33. package/dist/graph-recall.js +15 -1
  34. package/dist/graph-recall.js.map +1 -1
  35. package/dist/graph.d.ts.map +1 -1
  36. package/dist/graph.js +3 -0
  37. package/dist/graph.js.map +1 -1
  38. package/dist/hooks.js +24 -24
  39. package/dist/multihop.d.ts.map +1 -1
  40. package/dist/multihop.js +3 -0
  41. package/dist/multihop.js.map +1 -1
  42. package/dist/physics.d.ts +6 -1
  43. package/dist/physics.d.ts.map +1 -1
  44. package/dist/physics.js +15 -5
  45. package/dist/physics.js.map +1 -1
  46. package/dist/predictions.js +67 -67
  47. package/dist/recall-scope.d.ts +60 -0
  48. package/dist/recall-scope.d.ts.map +1 -0
  49. package/dist/recall-scope.js +84 -0
  50. package/dist/recall-scope.js.map +1 -0
  51. package/dist/refine-llm.js +13 -13
  52. package/dist/rerankers/cross-encoder.d.ts.map +1 -1
  53. package/dist/rerankers/cross-encoder.js +6 -0
  54. package/dist/rerankers/cross-encoder.js.map +1 -1
  55. package/dist/search.d.ts +5 -0
  56. package/dist/search.d.ts.map +1 -1
  57. package/dist/search.js +30 -11
  58. package/dist/search.js.map +1 -1
  59. package/dist/shared.d.ts +30 -0
  60. package/dist/shared.d.ts.map +1 -1
  61. package/dist/shared.js +48 -11
  62. package/dist/shared.js.map +1 -1
  63. package/dist/sleep-redact.d.ts +3 -0
  64. package/dist/sleep-redact.d.ts.map +1 -1
  65. package/dist/sleep-redact.js +3 -0
  66. package/dist/sleep-redact.js.map +1 -1
  67. package/dist/src/api.js +46 -61
  68. package/dist/src/api.js.map +1 -1
  69. package/dist/src/cli.js +109 -15
  70. package/dist/src/cli.js.map +1 -1
  71. package/dist/src/compare.js +92 -0
  72. package/dist/src/compare.js.map +1 -0
  73. package/dist/src/connectors/github/backfill.js +4 -4
  74. package/dist/src/connectors/github/cli-impl.js +6 -6
  75. package/dist/src/connectors/github/dlq.js +14 -14
  76. package/dist/src/connectors/slack/backfill.js +1 -1
  77. package/dist/src/connectors/slack/dlq.js +10 -10
  78. package/dist/src/connectors/slack/workspaces.js +4 -4
  79. package/dist/src/dag.js +6 -6
  80. package/dist/src/dashboard.js +7 -7
  81. package/dist/src/embedding-provider.js +7 -3
  82. package/dist/src/embedding-provider.js.map +1 -1
  83. package/dist/src/embeddings.js +66 -8
  84. package/dist/src/embeddings.js.map +1 -1
  85. package/dist/src/goals.js +4 -0
  86. package/dist/src/goals.js.map +1 -1
  87. package/dist/src/graph-recall.js +15 -1
  88. package/dist/src/graph-recall.js.map +1 -1
  89. package/dist/src/graph.js +3 -0
  90. package/dist/src/graph.js.map +1 -1
  91. package/dist/src/hooks.js +24 -24
  92. package/dist/src/multihop.js +3 -0
  93. package/dist/src/multihop.js.map +1 -1
  94. package/dist/src/physics.js +15 -5
  95. package/dist/src/physics.js.map +1 -1
  96. package/dist/src/predictions.js +67 -67
  97. package/dist/src/recall-scope.js +84 -0
  98. package/dist/src/recall-scope.js.map +1 -0
  99. package/dist/src/refine-llm.js +13 -13
  100. package/dist/src/rerankers/cross-encoder.js +6 -0
  101. package/dist/src/rerankers/cross-encoder.js.map +1 -1
  102. package/dist/src/search.js +30 -11
  103. package/dist/src/search.js.map +1 -1
  104. package/dist/src/shared.js +48 -11
  105. package/dist/src/shared.js.map +1 -1
  106. package/dist/src/sleep-redact.js +3 -0
  107. package/dist/src/sleep-redact.js.map +1 -1
  108. package/dist/src/store.js +70 -22
  109. package/dist/src/store.js.map +1 -1
  110. package/dist/src/version.js +1 -1
  111. package/dist/src/working-memory.js +19 -19
  112. package/dist/store.d.ts +30 -9
  113. package/dist/store.d.ts.map +1 -1
  114. package/dist/store.js +70 -22
  115. package/dist/store.js.map +1 -1
  116. package/dist/version.d.ts +1 -1
  117. package/dist/version.js +1 -1
  118. package/dist/working-memory.js +19 -19
  119. package/dist-ui/index.html +12 -12
  120. package/extensions/openclaw-plugin/index.ts +650 -650
  121. package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
  122. package/extensions/openclaw-plugin/package.json +1 -1
  123. package/openclaw.plugin.json +1 -1
  124. package/package.json +1 -1
  125. package/dist/benchmarks/e1.3/scenarios.json +0 -2587
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Deterministic tie-break comparators for recall ranking.
3
+ *
4
+ * A true LEAF module: imports NOTHING from any sort-site module (search.ts,
5
+ * physics.ts, api.ts, cli.ts, shared.ts, goals.ts, graph-recall.ts,
6
+ * multihop.ts, rerankers/*). Every comparator here takes a structural param
7
+ * type instead of an imported one, on purpose — a type-only import back to
8
+ * search.ts would still create the search.ts <-> physics.ts ESM import
9
+ * cycle this module exists to avoid (r2 critic HIGH,
10
+ * docs/plans/2026-07-09-recall-determinism.md T2).
11
+ *
12
+ * Mirrors the deliberate-determinism comment style already established in
13
+ * graph-stream.ts:88, :165-168, :233-236 — a sort with a documented,
14
+ * reproducible tiebreak instead of leaving ties to array/scan order.
15
+ */
16
+ /** Minimal shape needed to break a tie deterministically across fresh
17
+ * ingests of the same content into different stores. */
18
+ export interface EntryIdentity {
19
+ content: string;
20
+ id: string;
21
+ }
22
+ /**
23
+ * content ascending (UTF-16 code-unit compare) -> id ascending.
24
+ *
25
+ * `content` is the cross-ingest-stable key: identical text ingested into two
26
+ * independently-created stores (different directory name, different insert
27
+ * order of everything else on disk) sorts identically. `id`
28
+ * (`crypto.randomUUID()`) is per-instance only — two stores ingesting the
29
+ * same content never produce the same id, so it is a last-resort tiebreak
30
+ * for genuine duplicate-content rows within one comparison, not a
31
+ * cross-ingest-stable key on its own.
32
+ *
33
+ * Plain `<`/`>` (UTF-16 code-unit order), NOT `localeCompare`:
34
+ * `localeCompare` is locale- and ICU-version-dependent (a determinism leak
35
+ * in its own right) and is needlessly slow for a tiebreak that only needs a
36
+ * total order, not a linguistically "correct" one. Full-content compare is O(len) worst case;
37
+ * fine because ties are rare post-T1 (path-tag embedding fix) — no hashing
38
+ * needed.
39
+ */
40
+ export declare function compareEntryIdentity(a: EntryIdentity, b: EntryIdentity): number;
41
+ /** Minimal shape for score-primary sort sites (SearchResult and friends
42
+ * that carry `{ score, entry: { content, id } }`). */
43
+ export interface ScoredEntryLike {
44
+ score: number;
45
+ entry: EntryIdentity;
46
+ }
47
+ /**
48
+ * score descending -> `compareEntryIdentity`. The shared ordering rule for
49
+ * every score-primary recall sort site (search.ts, shared.ts, goals.ts,
50
+ * api.ts, cli.ts, graph-recall.ts, multihop.ts, rerankers/cross-encoder.ts).
51
+ * Sites delegate wholesale to this (via a thin arrow where the element
52
+ * shape's score field is named something other than `score`, e.g.
53
+ * `rerankScore`) rather than reimplementing `b.score - a.score` locally, so
54
+ * the tiebreak can't silently drift between call sites.
55
+ */
56
+ export declare function compareScoredResults(a: ScoredEntryLike, b: ScoredEntryLike): number;
57
+ /**
58
+ * Build a score-desc -> tie-key comparator for the physics layer.
59
+ *
60
+ * `ScoredPhysicsResult` (physics.ts) carries `{ memoryId, baseScore,
61
+ * clusterAmplification, finalScore }` -- NO `entry`/`content` in scope at
62
+ * that layer, so `compareEntryIdentity` cannot apply directly (plan T2
63
+ * shape (c)). With only the default memoryId key this is PER-INSTANCE-ONLY
64
+ * determinism; callers that need CROSS-INGEST stability supply `tieKeyOf`
65
+ * mapping the result to its memory CONTENT (codex review finding: the
66
+ * baseScore tie order selects the cluster_top_k amplification set, which
67
+ * MUTATES scores before the downstream content-aware merge sort runs -- so
68
+ * the tie key must be content-stable at THIS layer, not just downstream).
69
+ *
70
+ * A factory (not a fixed-field comparator) because physics.ts re-sorts the
71
+ * same result array by two different score fields in sequence (`baseScore`
72
+ * for top-K selection, then `finalScore` after cluster amplification) — one
73
+ * shared tiebreak rule, parameterised by which field is primary this pass.
74
+ */
75
+ export declare function comparePhysicsResultsBy<T extends {
76
+ memoryId: string;
77
+ }>(scoreOf: (r: T) => number, tieKeyOf?: (r: T) => string): (a: T, b: T) => number;
78
+ //# sourceMappingURL=compare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../src/compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;yDACyD;AACzD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,MAAM,CAM/E;AAED;uDACuD;AACvD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,aAAa,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,CAGnF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EACpE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,EACzB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,GAC1B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAYxB"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Deterministic tie-break comparators for recall ranking.
3
+ *
4
+ * A true LEAF module: imports NOTHING from any sort-site module (search.ts,
5
+ * physics.ts, api.ts, cli.ts, shared.ts, goals.ts, graph-recall.ts,
6
+ * multihop.ts, rerankers/*). Every comparator here takes a structural param
7
+ * type instead of an imported one, on purpose — a type-only import back to
8
+ * search.ts would still create the search.ts <-> physics.ts ESM import
9
+ * cycle this module exists to avoid (r2 critic HIGH,
10
+ * docs/plans/2026-07-09-recall-determinism.md T2).
11
+ *
12
+ * Mirrors the deliberate-determinism comment style already established in
13
+ * graph-stream.ts:88, :165-168, :233-236 — a sort with a documented,
14
+ * reproducible tiebreak instead of leaving ties to array/scan order.
15
+ */
16
+ /**
17
+ * content ascending (UTF-16 code-unit compare) -> id ascending.
18
+ *
19
+ * `content` is the cross-ingest-stable key: identical text ingested into two
20
+ * independently-created stores (different directory name, different insert
21
+ * order of everything else on disk) sorts identically. `id`
22
+ * (`crypto.randomUUID()`) is per-instance only — two stores ingesting the
23
+ * same content never produce the same id, so it is a last-resort tiebreak
24
+ * for genuine duplicate-content rows within one comparison, not a
25
+ * cross-ingest-stable key on its own.
26
+ *
27
+ * Plain `<`/`>` (UTF-16 code-unit order), NOT `localeCompare`:
28
+ * `localeCompare` is locale- and ICU-version-dependent (a determinism leak
29
+ * in its own right) and is needlessly slow for a tiebreak that only needs a
30
+ * total order, not a linguistically "correct" one. Full-content compare is O(len) worst case;
31
+ * fine because ties are rare post-T1 (path-tag embedding fix) — no hashing
32
+ * needed.
33
+ */
34
+ export function compareEntryIdentity(a, b) {
35
+ if (a.content < b.content)
36
+ return -1;
37
+ if (a.content > b.content)
38
+ return 1;
39
+ if (a.id < b.id)
40
+ return -1;
41
+ if (a.id > b.id)
42
+ return 1;
43
+ return 0;
44
+ }
45
+ /**
46
+ * score descending -> `compareEntryIdentity`. The shared ordering rule for
47
+ * every score-primary recall sort site (search.ts, shared.ts, goals.ts,
48
+ * api.ts, cli.ts, graph-recall.ts, multihop.ts, rerankers/cross-encoder.ts).
49
+ * Sites delegate wholesale to this (via a thin arrow where the element
50
+ * shape's score field is named something other than `score`, e.g.
51
+ * `rerankScore`) rather than reimplementing `b.score - a.score` locally, so
52
+ * the tiebreak can't silently drift between call sites.
53
+ */
54
+ export function compareScoredResults(a, b) {
55
+ const d = b.score - a.score;
56
+ return d !== 0 ? d : compareEntryIdentity(a.entry, b.entry);
57
+ }
58
+ /**
59
+ * Build a score-desc -> tie-key comparator for the physics layer.
60
+ *
61
+ * `ScoredPhysicsResult` (physics.ts) carries `{ memoryId, baseScore,
62
+ * clusterAmplification, finalScore }` -- NO `entry`/`content` in scope at
63
+ * that layer, so `compareEntryIdentity` cannot apply directly (plan T2
64
+ * shape (c)). With only the default memoryId key this is PER-INSTANCE-ONLY
65
+ * determinism; callers that need CROSS-INGEST stability supply `tieKeyOf`
66
+ * mapping the result to its memory CONTENT (codex review finding: the
67
+ * baseScore tie order selects the cluster_top_k amplification set, which
68
+ * MUTATES scores before the downstream content-aware merge sort runs -- so
69
+ * the tie key must be content-stable at THIS layer, not just downstream).
70
+ *
71
+ * A factory (not a fixed-field comparator) because physics.ts re-sorts the
72
+ * same result array by two different score fields in sequence (`baseScore`
73
+ * for top-K selection, then `finalScore` after cluster amplification) — one
74
+ * shared tiebreak rule, parameterised by which field is primary this pass.
75
+ */
76
+ export function comparePhysicsResultsBy(scoreOf, tieKeyOf) {
77
+ return (a, b) => {
78
+ const d = scoreOf(b) - scoreOf(a);
79
+ if (d !== 0)
80
+ return d;
81
+ const ai = tieKeyOf ? tieKeyOf(a) : a.memoryId;
82
+ const bi = tieKeyOf ? tieKeyOf(b) : b.memoryId;
83
+ if (ai < bi)
84
+ return -1;
85
+ if (ai > bi)
86
+ return 1;
87
+ // Tie-key collision (e.g. duplicate content): fall through to memoryId
88
+ // so the comparator still yields a total order within one store.
89
+ return a.memoryId < b.memoryId ? -1 : a.memoryId > b.memoryId ? 1 : 0;
90
+ };
91
+ }
92
+ //# sourceMappingURL=compare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.js","sourceRoot":"","sources":["../src/compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAgB,EAAE,CAAgB;IACrE,IAAI,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO;QAAE,OAAO,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO;QAAE,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE;QAAE,OAAO,CAAC,CAAC,CAAC;IAC3B,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE;QAAE,OAAO,CAAC,CAAC;IAC1B,OAAO,CAAC,CAAC;AACX,CAAC;AASD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAkB,EAAE,CAAkB;IACzE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAyB,EACzB,QAA2B;IAE3B,OAAO,CAAC,CAAI,EAAE,CAAI,EAAU,EAAE;QAC5B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QACtB,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/C,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/C,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,CAAC,CAAC;QACtB,uEAAuE;QACvE,iEAAiE;QACjE,OAAO,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC;AACJ,CAAC"}
@@ -30,7 +30,7 @@ function readCursor(root, tenantId, repo) {
30
30
  const db = openHippoDb(root);
31
31
  try {
32
32
  const row = db
33
- .prepare(`SELECT issues_hwm, issue_comments_hwm, pr_review_comments_hwm
33
+ .prepare(`SELECT issues_hwm, issue_comments_hwm, pr_review_comments_hwm
34
34
  FROM github_cursors WHERE tenant_id = ? AND repo_full_name = ?`)
35
35
  .get(tenantId, repo);
36
36
  return {
@@ -46,9 +46,9 @@ function readCursor(root, tenantId, repo) {
46
46
  function writeOneHwm(root, tenantId, repo, column, value) {
47
47
  const db = openHippoDb(root);
48
48
  try {
49
- db.prepare(`INSERT INTO github_cursors (tenant_id, repo_full_name, ${column}, updated_at)
50
- VALUES (?, ?, ?, ?)
51
- ON CONFLICT(tenant_id, repo_full_name)
49
+ db.prepare(`INSERT INTO github_cursors (tenant_id, repo_full_name, ${column}, updated_at)
50
+ VALUES (?, ?, ?, ?)
51
+ ON CONFLICT(tenant_id, repo_full_name)
52
52
  DO UPDATE SET ${column} = excluded.${column}, updated_at = excluded.updated_at`).run(tenantId, repo, value, new Date().toISOString());
53
53
  }
54
54
  finally {
@@ -83,12 +83,12 @@ export async function cmdGithubBackfill(hippoRoot, flags, fetcher = realGitHubFe
83
83
  if (sinceIso) {
84
84
  const db = openHippoDb(hippoRoot);
85
85
  try {
86
- db.prepare(`INSERT INTO github_cursors (tenant_id, repo_full_name, issues_hwm, issue_comments_hwm, pr_review_comments_hwm, updated_at)
87
- VALUES (?, ?, ?, ?, ?, ?)
88
- ON CONFLICT(tenant_id, repo_full_name) DO UPDATE SET
89
- issues_hwm = COALESCE(github_cursors.issues_hwm, excluded.issues_hwm),
90
- issue_comments_hwm = COALESCE(github_cursors.issue_comments_hwm, excluded.issue_comments_hwm),
91
- pr_review_comments_hwm = COALESCE(github_cursors.pr_review_comments_hwm, excluded.pr_review_comments_hwm),
86
+ db.prepare(`INSERT INTO github_cursors (tenant_id, repo_full_name, issues_hwm, issue_comments_hwm, pr_review_comments_hwm, updated_at)
87
+ VALUES (?, ?, ?, ?, ?, ?)
88
+ ON CONFLICT(tenant_id, repo_full_name) DO UPDATE SET
89
+ issues_hwm = COALESCE(github_cursors.issues_hwm, excluded.issues_hwm),
90
+ issue_comments_hwm = COALESCE(github_cursors.issue_comments_hwm, excluded.issue_comments_hwm),
91
+ pr_review_comments_hwm = COALESCE(github_cursors.pr_review_comments_hwm, excluded.pr_review_comments_hwm),
92
92
  updated_at = excluded.updated_at`).run(tenantId, repo, sinceIso, sinceIso, sinceIso, new Date().toISOString());
93
93
  }
94
94
  finally {
@@ -3,30 +3,30 @@ import { verifyGitHubSignature } from './signature.js';
3
3
  import { isGitHubWebhookEnvelope } from './types.js';
4
4
  export function writeToDlq(db, opts) {
5
5
  const result = db
6
- .prepare(`INSERT INTO github_dlq
7
- (tenant_id, raw_payload, error, event_name, delivery_id, signature,
8
- installation_id, repo_full_name, received_at, bucket)
6
+ .prepare(`INSERT INTO github_dlq
7
+ (tenant_id, raw_payload, error, event_name, delivery_id, signature,
8
+ installation_id, repo_full_name, received_at, bucket)
9
9
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
10
10
  .run(opts.tenantId ?? '__unroutable__', opts.rawPayload, opts.error, opts.eventName ?? null, opts.deliveryId ?? null, opts.signature ?? null, opts.installationId ?? null, opts.repoFullName ?? null, new Date().toISOString(), opts.bucket ?? 'parse_error');
11
11
  return Number(result.lastInsertRowid);
12
12
  }
13
- const SELECT_COLUMNS = `id, tenant_id, raw_payload, error, event_name, delivery_id,
14
- signature, installation_id, repo_full_name, retry_count,
13
+ const SELECT_COLUMNS = `id, tenant_id, raw_payload, error, event_name, delivery_id,
14
+ signature, installation_id, repo_full_name, retry_count,
15
15
  received_at, retried_at, bucket`;
16
16
  export function listDlq(db, opts) {
17
17
  const rows = db
18
- .prepare(`SELECT ${SELECT_COLUMNS}
19
- FROM github_dlq
20
- WHERE tenant_id = ?
21
- ORDER BY received_at ASC
18
+ .prepare(`SELECT ${SELECT_COLUMNS}
19
+ FROM github_dlq
20
+ WHERE tenant_id = ?
21
+ ORDER BY received_at ASC
22
22
  LIMIT ?`)
23
23
  .all(opts.tenantId, opts.limit ?? 100);
24
24
  return rows.map(rowToItem);
25
25
  }
26
26
  export function getDlqEntry(db, id) {
27
27
  const row = db
28
- .prepare(`SELECT ${SELECT_COLUMNS}
29
- FROM github_dlq
28
+ .prepare(`SELECT ${SELECT_COLUMNS}
29
+ FROM github_dlq
30
30
  WHERE id = ?`)
31
31
  .get(id);
32
32
  if (!row)
@@ -53,9 +53,9 @@ function rowToItem(r) {
53
53
  function bumpRetryCount(hippoRoot, id) {
54
54
  const db = openHippoDb(hippoRoot);
55
55
  try {
56
- db.prepare(`UPDATE github_dlq
57
- SET retry_count = retry_count + 1,
58
- retried_at = ?
56
+ db.prepare(`UPDATE github_dlq
57
+ SET retry_count = retry_count + 1,
58
+ retried_at = ?
59
59
  WHERE id = ?`).run(new Date().toISOString(), id);
60
60
  }
61
61
  finally {
@@ -15,7 +15,7 @@ function readCursor(root, tenantId, channelId) {
15
15
  function writeCursor(root, tenantId, channelId, latestTs) {
16
16
  const db = openHippoDb(root);
17
17
  try {
18
- db.prepare(`INSERT INTO slack_cursors (tenant_id, channel_id, latest_ts, updated_at) VALUES (?,?,?,?)
18
+ db.prepare(`INSERT INTO slack_cursors (tenant_id, channel_id, latest_ts, updated_at) VALUES (?,?,?,?)
19
19
  ON CONFLICT(tenant_id, channel_id) DO UPDATE SET latest_ts = excluded.latest_ts, updated_at = excluded.updated_at`).run(tenantId, channelId, latestTs, new Date().toISOString());
20
20
  }
21
21
  finally {
@@ -7,28 +7,28 @@ import { isSlackEventEnvelope, isSlackMessageEvent } from './types.js';
7
7
  import { handleMessageDeleted } from './deletion.js';
8
8
  export function writeToDlq(db, opts) {
9
9
  const result = db
10
- .prepare(`INSERT INTO slack_dlq
11
- (tenant_id, team_id, raw_payload, error, received_at, bucket, signature, slack_timestamp)
10
+ .prepare(`INSERT INTO slack_dlq
11
+ (tenant_id, team_id, raw_payload, error, received_at, bucket, signature, slack_timestamp)
12
12
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)`)
13
13
  .run(opts.tenantId ?? '__unroutable__', opts.teamId ?? null, opts.rawPayload, opts.error, new Date().toISOString(), opts.bucket ?? 'parse_error', opts.signature ?? null, opts.slackTimestamp ?? null);
14
14
  return Number(result.lastInsertRowid);
15
15
  }
16
16
  export function listDlq(db, opts) {
17
17
  const rows = db
18
- .prepare(`SELECT id, tenant_id, team_id, raw_payload, error, received_at, retried_at,
19
- bucket, retry_count, signature, slack_timestamp
20
- FROM slack_dlq
21
- WHERE tenant_id = ?
22
- ORDER BY received_at ASC
18
+ .prepare(`SELECT id, tenant_id, team_id, raw_payload, error, received_at, retried_at,
19
+ bucket, retry_count, signature, slack_timestamp
20
+ FROM slack_dlq
21
+ WHERE tenant_id = ?
22
+ ORDER BY received_at ASC
23
23
  LIMIT ?`)
24
24
  .all(opts.tenantId, opts.limit ?? 100);
25
25
  return rows.map(rowToItem);
26
26
  }
27
27
  export function getDlqEntry(db, id) {
28
28
  const row = db
29
- .prepare(`SELECT id, tenant_id, team_id, raw_payload, error, received_at, retried_at,
30
- bucket, retry_count, signature, slack_timestamp
31
- FROM slack_dlq
29
+ .prepare(`SELECT id, tenant_id, team_id, raw_payload, error, received_at, retried_at,
30
+ bucket, retry_count, signature, slack_timestamp
31
+ FROM slack_dlq
32
32
  WHERE id = ?`)
33
33
  .get(id);
34
34
  if (!row)
@@ -26,10 +26,10 @@
26
26
  */
27
27
  export function addWorkspace(db, opts) {
28
28
  const addedAt = new Date().toISOString();
29
- db.prepare(`INSERT INTO slack_workspaces (team_id, tenant_id, added_at)
30
- VALUES (?, ?, ?)
31
- ON CONFLICT(team_id) DO UPDATE SET
32
- tenant_id = excluded.tenant_id,
29
+ db.prepare(`INSERT INTO slack_workspaces (team_id, tenant_id, added_at)
30
+ VALUES (?, ?, ?)
31
+ ON CONFLICT(team_id) DO UPDATE SET
32
+ tenant_id = excluded.tenant_id,
33
33
  added_at = excluded.added_at`).run(opts.teamId, opts.tenantId, addedAt);
34
34
  return { teamId: opts.teamId, tenantId: opts.tenantId, addedAt };
35
35
  }
package/dist/dag.js CHANGED
@@ -31,12 +31,12 @@ export function clusterFacts(facts) {
31
31
  }
32
32
  return clusters;
33
33
  }
34
- const DAG_SUMMARY_PROMPT = `You are summarizing a cluster of facts about a specific topic/entity for a memory system.
35
-
36
- Topic: {label}
37
- Facts:
38
- {facts}
39
-
34
+ const DAG_SUMMARY_PROMPT = `You are summarizing a cluster of facts about a specific topic/entity for a memory system.
35
+
36
+ Topic: {label}
37
+ Facts:
38
+ {facts}
39
+
40
40
  Write a single concise paragraph (2-4 sentences) that captures all the key information from these facts. This summary will be used to quickly determine if this cluster is relevant to a future query, so include specific names, dates, numbers, and key details. Output ONLY the summary paragraph, no preamble.`;
41
41
  export async function generateDagSummary(label, factContents, opts) {
42
42
  const model = opts.model ?? 'claude-sonnet-4-6';
package/dist/dashboard.js CHANGED
@@ -202,13 +202,13 @@ export function serveDashboard(hippoRoot, port = 3333) {
202
202
  // was removed in the hybrid-v4 revamp E1 since dist-ui/ is now the
203
203
  // sole UI surface). ---
204
204
  res.writeHead(404, { 'Content-Type': 'text/html; charset=utf-8' });
205
- res.end(`<!doctype html>
206
- <html lang="en"><head><title>Hippo Dashboard</title><meta charset="utf-8"></head>
207
- <body style="font-family:Georgia,'Palatino Linotype',serif;max-width:640px;margin:60px auto;padding:24px;line-height:1.6;background:#f4efe6;color:#3a3228">
208
- <h1 style="color:#c45c3c">Hippo Dashboard</h1>
209
- <p>The React UI bundle is not built yet. Run:</p>
210
- <pre style="background:#faf7f2;padding:16px;border:1px solid #c4b9a8;border-radius:3px;font-family:Consolas,monospace">cd ui && npm install && npm run build</pre>
211
- <p>Then refresh this page. The dashboard server will serve <code>dist-ui/index.html</code> automatically once present.</p>
205
+ res.end(`<!doctype html>
206
+ <html lang="en"><head><title>Hippo Dashboard</title><meta charset="utf-8"></head>
207
+ <body style="font-family:Georgia,'Palatino Linotype',serif;max-width:640px;margin:60px auto;padding:24px;line-height:1.6;background:#f4efe6;color:#3a3228">
208
+ <h1 style="color:#c45c3c">Hippo Dashboard</h1>
209
+ <p>The React UI bundle is not built yet. Run:</p>
210
+ <pre style="background:#faf7f2;padding:16px;border:1px solid #c4b9a8;border-radius:3px;font-family:Consolas,monospace">cd ui && npm install && npm run build</pre>
211
+ <p>Then refresh this page. The dashboard server will serve <code>dist-ui/index.html</code> automatically once present.</p>
212
212
  </body></html>`);
213
213
  });
214
214
  server.listen(port, '127.0.0.1', () => {
@@ -9,9 +9,13 @@
9
9
  * `config.embeddings.provider` (default `'local'`).
10
10
  *
11
11
  * Design contract (see docs/plans/2026-06-08-b-pluggable-embedding-provider.md):
12
- * - Local provider `id` is the BARE model string, so existing stores whose DB
13
- * meta `embedding_model` is `Xenova/all-MiniLM-L6-v2` see NO identity change
14
- * and are NOT force-reindexed on upgrade.
12
+ * - Local provider `id` is the BARE model string. (Historical note: this
13
+ * originally guaranteed NO identity change on upgrade; since the
14
+ * embed-text-format versioning in embeddings.ts (`embeddingIndexIdentity`,
15
+ * `${id}#t2`, docs/plans/2026-07-09-recall-determinism.md T1), the STORED
16
+ * identity carries a `#t<N>` suffix and pre-#t2 stores get exactly one
17
+ * forced reindex on their next embed-touching operation — deliberate,
18
+ * because their vectors were computed over path-contaminated text.)
15
19
  * - API provider `id` is `${kind}:${model}`; switching to/from an API embedder
16
20
  * (or a dimension change) flips the identity and triggers the existing
17
21
  * reindex-on-change path.
@@ -1 +1 @@
1
- {"version":3,"file":"embedding-provider.d.ts","sourceRoot":"","sources":["../src/embedding-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7E,eAAO,MAAM,kBAAkB,EAAE,SAAS,qBAAqB,EAAmC,CAAC;AAOnG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAA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GG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,kFAAkF;IAClF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,WAAW,IAAI,OAAO,CAAC;IACvB;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;CACnE;AAiPD,MAAM,WAAW,sBAAsB;IACrC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,sBAA2B,GAChC,iBAAiB,CA+BnB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,sBAA2B,GAAG,MAAM,CAErG;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAQhE"}
@@ -9,9 +9,13 @@
9
9
  * `config.embeddings.provider` (default `'local'`).
10
10
  *
11
11
  * Design contract (see docs/plans/2026-06-08-b-pluggable-embedding-provider.md):
12
- * - Local provider `id` is the BARE model string, so existing stores whose DB
13
- * meta `embedding_model` is `Xenova/all-MiniLM-L6-v2` see NO identity change
14
- * and are NOT force-reindexed on upgrade.
12
+ * - Local provider `id` is the BARE model string. (Historical note: this
13
+ * originally guaranteed NO identity change on upgrade; since the
14
+ * embed-text-format versioning in embeddings.ts (`embeddingIndexIdentity`,
15
+ * `${id}#t2`, docs/plans/2026-07-09-recall-determinism.md T1), the STORED
16
+ * identity carries a `#t<N>` suffix and pre-#t2 stores get exactly one
17
+ * forced reindex on their next embed-touching operation — deliberate,
18
+ * because their vectors were computed over path-contaminated text.)
15
19
  * - API provider `id` is `${kind}:${model}`; switching to/from an API embedder
16
20
  * (or a dimension change) flips the identity and triggers the existing
17
21
  * reindex-on-change path.
@@ -1 +1 @@
1
- {"version":3,"file":"embedding-provider.js","sourceRoot":"","sources":["../src/embedding-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAEL,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,MAAM,CAAC,MAAM,kBAAkB,GAAqC,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEnG,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC;iFACiF;AACjF,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAwBlC,8EAA8E;AAC9E,qEAAqE;AACrE,8EAA8E;AAE9E,MAAM,sBAAsB;IAEL;IAAgC;IAD5C,IAAI,GAAG,OAAgB,CAAC;IACjC,YAAqB,KAAa,EAAmB,UAAmB,IAAI;QAAvD,UAAK,GAAL,KAAK,CAAQ;QAAmB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAChF,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,WAAW;QACT,OAAO,IAAI,CAAC,OAAO,IAAI,oBAAoB,EAAE,CAAC;IAChD,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,KAAe,EAAE,IAAoB;QAC/C,4EAA4E;QAC5E,uEAAuE;QACvE,MAAM,GAAG,GAAe,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,IAAI,CAAC,MAAM,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAA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 @@
5
5
  */
6
6
  import { MemoryEntry } from './memory.js';
7
7
  export declare const DEFAULT_EMBEDDING_MODEL = "Xenova/all-MiniLM-L6-v2";
8
+ export declare const EMBEDDING_MODEL_META_KEY = "embedding_model";
9
+ /**
10
+ * Bump whenever `embeddingInputText`'s composition changes in a way that
11
+ * changes the resulting vectors for existing entries. Folded into the stored
12
+ * index identity (see `embeddingIndexIdentity`) so a text-format change is
13
+ * treated exactly like an embedding-model change: the next embed-touching
14
+ * operation detects the mismatch and reindexes automatically. Format 2 =
15
+ * `path:*` tags excluded (see `embeddingInputText`); format 1 (implicit, no
16
+ * suffix) = `${content} ${tags.join(' ')}` including path tags.
17
+ */
18
+ export declare const EMBED_TEXT_FORMAT = 2;
19
+ /**
20
+ * The stored-index identity for a given embedding provider id: folds
21
+ * `EMBED_TEXT_FORMAT` into the provider id so index-identity comparisons
22
+ * automatically invalidate on either a model change OR a text-format change.
23
+ * This is the ONE choke point both `embeddingModelRequiresReindex` (compare
24
+ * side) and `saveStoredEmbeddingModel` (save side) go through — they MUST
25
+ * version identically, or every call reindexes in a loop (or none ever do).
26
+ */
27
+ export declare function embeddingIndexIdentity(providerId: string): string;
28
+ /**
29
+ * Build the text embedded for a memory entry: content plus its tags, joined
30
+ * by a space and trimmed — the same shape as the legacy
31
+ * `` `${e.content} ${e.tags.join(' ')}`.trim() `` composition, minus `path:*`
32
+ * tags.
33
+ *
34
+ * `path:*` tags are excluded because they are auto-derived from
35
+ * `process.cwd()` (see `extractPathTags` in cli.ts) and carry every path
36
+ * component of the store's location, INCLUDING the store directory name
37
+ * itself. That means identical content embeds to a DIFFERENT vector
38
+ * depending on WHERE the store happens to live — e.g. a fresh benchmark run
39
+ * under `tempfile.mkdtemp()` gets a new directory name (hence new path
40
+ * tokens, hence a new vector) every single run, even with byte-identical
41
+ * content ingested in byte-identical order. This was diagnosed as the
42
+ * DOMINANT root cause of cross-fresh-ingest recall-rank variance measured on
43
+ * LoCoMo (mean evidence-recall@5 stdev 0.0175 across 4 fresh re-ingests of
44
+ * identical data; see `benchmarks/LOCOMO_INVESTIGATION.md`, "Determinism
45
+ * characterization"). It is a real product defect beyond benchmarks too:
46
+ * retrieval semantics should not depend on a project directory's name.
47
+ *
48
+ * Only `path:*` is excluded. Other tags (`conv:`, `session:`, `speaker:`,
49
+ * `dia:`, `error`, `scope:`, etc.) remain embedded — they carry semantic
50
+ * meaning. Path relevance at recall time is already handled explicitly by
51
+ * the v39 scope-isolation layer (`origin_project`, `pathOverlapScore`), so
52
+ * embedding-level path tokens are redundant with a dedicated mechanism
53
+ * rather than a feature.
54
+ */
55
+ export declare function embeddingInputText(entry: {
56
+ content: string;
57
+ tags: string[];
58
+ }): string;
8
59
  /**
9
60
  * Per-model pooling dispatch for `@xenova/transformers`'s feature-extraction
10
61
  * pipeline. BGE family models were trained with CLS pooling (per BAAI's
@@ -38,6 +89,13 @@ export declare function prefixFor(model: string, role?: EmbeddingRole): string;
38
89
  */
39
90
  export declare function isEmbeddingAvailable(): boolean;
40
91
  export declare function resolveEmbeddingModel(hippoRoot: string, explicitModel?: string): string;
92
+ /**
93
+ * Persist the stored-index identity for `model` (see `embeddingIndexIdentity`).
94
+ * Versioning happens INSIDE this function, not at call sites, so every caller
95
+ * — current and future — gets the identity format for free. Must stay
96
+ * consistent with the compare side in `embeddingModelRequiresReindex`.
97
+ */
98
+ export declare function saveStoredEmbeddingModel(hippoRoot: string, model: string): void;
41
99
  export declare function resolveIndexedEmbeddingModel(hippoRoot: string, index?: Record<string, number[]>): string | null;
42
100
  export declare function embeddingModelRequiresReindex(hippoRoot: string, model: string, index?: Record<string, number[]>): boolean;
43
101
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"embeddings.d.ts","sourceRoot":"","sources":["../src/embeddings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiB1C,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAGjE;;;;;;;;GAQG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