@remnic/core 1.1.12 → 1.1.14

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 (1324) hide show
  1. package/dist/access-cli.d.ts +2 -1
  2. package/dist/access-cli.js +263 -82
  3. package/dist/access-cli.js.map +1 -1
  4. package/dist/access-http.d.ts +26 -60
  5. package/dist/access-http.js +43 -29
  6. package/dist/access-mcp.d.ts +24 -6
  7. package/dist/access-mcp.js +35 -28
  8. package/dist/access-schema.d.ts +9 -6
  9. package/dist/access-schema.js +7 -5
  10. package/dist/access-service-DcCDmNYC.d.ts +1542 -0
  11. package/dist/access-service.d.ts +25 -7
  12. package/dist/access-service.js +33 -26
  13. package/dist/active-memory-bridge.js +2 -2
  14. package/dist/active-recall.js +11 -3
  15. package/dist/active-recall.js.map +1 -1
  16. package/dist/adapters/claude-code.d.ts +24 -0
  17. package/dist/adapters/claude-code.js +9 -0
  18. package/dist/adapters/codex.d.ts +25 -0
  19. package/dist/adapters/codex.js +9 -0
  20. package/dist/adapters/hermes.d.ts +35 -0
  21. package/dist/adapters/hermes.js +9 -0
  22. package/dist/adapters/index.d.ts +6 -0
  23. package/dist/adapters/index.js +26 -0
  24. package/dist/adapters/registry.d.ts +20 -0
  25. package/dist/adapters/registry.js +13 -0
  26. package/dist/adapters/replit.d.ts +28 -0
  27. package/dist/adapters/replit.js +9 -0
  28. package/dist/adapters/types.d.ts +43 -0
  29. package/dist/adapters/types.js +8 -0
  30. package/dist/bootstrap.d.ts +20 -5
  31. package/dist/boxes.d.ts +7 -0
  32. package/dist/boxes.js +1 -1
  33. package/dist/briefing.d.ts +5 -3
  34. package/dist/briefing.js +9 -6
  35. package/dist/buffer-surprise-report.js +1 -1
  36. package/dist/buffer.d.ts +18 -4
  37. package/dist/buffer.js +1 -1
  38. package/dist/calibration.js +4 -4
  39. package/dist/capsule-cli.d.ts +4 -4
  40. package/dist/capsule-cli.js +1 -1
  41. package/dist/capsule-crypto-5CYAGVC5.js +18 -0
  42. package/dist/capsule-merge-4MGKE7C5.js +189 -0
  43. package/dist/causal-behavior.d.ts +8 -28
  44. package/dist/causal-behavior.js +6 -3
  45. package/dist/causal-behavior.js.map +1 -1
  46. package/dist/causal-chain.js +3 -2
  47. package/dist/causal-consolidation.d.ts +1 -1
  48. package/dist/causal-consolidation.js +24 -13
  49. package/dist/causal-consolidation.js.map +1 -1
  50. package/dist/causal-retrieval.js +3 -3
  51. package/dist/causal-trajectory.js +1 -1
  52. package/dist/chunk-25MQ7IHJ.js +427 -0
  53. package/dist/chunk-25MQ7IHJ.js.map +1 -0
  54. package/dist/chunk-2F2W355T.js +256 -0
  55. package/dist/chunk-2F2W355T.js.map +1 -0
  56. package/dist/chunk-2KI4QFHU.js +228 -0
  57. package/dist/chunk-2KI4QFHU.js.map +1 -0
  58. package/dist/chunk-2PRQG7PV.js +86 -0
  59. package/dist/chunk-2PRQG7PV.js.map +1 -0
  60. package/dist/chunk-2QR3XXIC.js +2272 -0
  61. package/dist/chunk-2QR3XXIC.js.map +1 -0
  62. package/dist/chunk-2WWLHTZY.js +121 -0
  63. package/dist/chunk-326G7DJK.js +2185 -0
  64. package/dist/chunk-326G7DJK.js.map +1 -0
  65. package/dist/chunk-34DQE4KF.js +174 -0
  66. package/dist/chunk-34DQE4KF.js.map +1 -0
  67. package/dist/chunk-3APJ5EVB.js +601 -0
  68. package/dist/chunk-3APJ5EVB.js.map +1 -0
  69. package/dist/chunk-3HPAPHUK.js +51 -0
  70. package/dist/chunk-3HPAPHUK.js.map +1 -0
  71. package/dist/chunk-3JXBXXM2.js +69 -0
  72. package/dist/chunk-3JXBXXM2.js.map +1 -0
  73. package/dist/chunk-3KW65B36.js +681 -0
  74. package/dist/chunk-3KW65B36.js.map +1 -0
  75. package/dist/chunk-3UXOZBHV.js +20 -0
  76. package/dist/chunk-3UXOZBHV.js.map +1 -0
  77. package/dist/chunk-3VAL7ZL2.js +266 -0
  78. package/dist/chunk-3VAL7ZL2.js.map +1 -0
  79. package/dist/chunk-3Y4P7RXM.js +31 -0
  80. package/dist/chunk-3Y4P7RXM.js.map +1 -0
  81. package/dist/chunk-47VWKCAF.js +273 -0
  82. package/dist/chunk-47VWKCAF.js.map +1 -0
  83. package/dist/chunk-4CRG46BG.js +271 -0
  84. package/dist/chunk-5375UYTQ.js +914 -0
  85. package/dist/chunk-5375UYTQ.js.map +1 -0
  86. package/dist/chunk-56K5QLHX.js +506 -0
  87. package/dist/chunk-56K5QLHX.js.map +1 -0
  88. package/dist/chunk-5RGLBDQF.js +596 -0
  89. package/dist/chunk-5RGLBDQF.js.map +1 -0
  90. package/dist/chunk-5UZXUTVO.js +9 -0
  91. package/dist/chunk-5UZXUTVO.js.map +1 -0
  92. package/dist/chunk-65PG43EQ.js +105 -0
  93. package/dist/chunk-65PG43EQ.js.map +1 -0
  94. package/dist/chunk-66DHUKLO.js +57 -0
  95. package/dist/chunk-66DHUKLO.js.map +1 -0
  96. package/dist/chunk-6FC5EGNV.js +46 -0
  97. package/dist/chunk-6FC5EGNV.js.map +1 -0
  98. package/dist/chunk-6H2TESSP.js +62 -0
  99. package/dist/chunk-6H2TESSP.js.map +1 -0
  100. package/dist/chunk-6LVVDPJ4.js +32 -0
  101. package/dist/chunk-6LVVDPJ4.js.map +1 -0
  102. package/dist/chunk-6RVI47ZR.js +159 -0
  103. package/dist/chunk-6RVI47ZR.js.map +1 -0
  104. package/dist/chunk-7AAT6G4Q.js +5117 -0
  105. package/dist/chunk-7AAT6G4Q.js.map +1 -0
  106. package/dist/chunk-7DTASS5T.js +29 -0
  107. package/dist/chunk-7DTASS5T.js.map +1 -0
  108. package/dist/chunk-7IASACLB.js +596 -0
  109. package/dist/chunk-7MNMYOFP.js +32 -0
  110. package/dist/chunk-7MNMYOFP.js.map +1 -0
  111. package/dist/chunk-7N4KAIGN.js +133 -0
  112. package/dist/chunk-7N4KAIGN.js.map +1 -0
  113. package/dist/chunk-7OZ53EXP.js +101 -0
  114. package/dist/chunk-7OZ53EXP.js.map +1 -0
  115. package/dist/chunk-7XYTQGCC.js +134 -0
  116. package/dist/chunk-7XYTQGCC.js.map +1 -0
  117. package/dist/chunk-A2XUIMJ3.js +341 -0
  118. package/dist/chunk-A2XUIMJ3.js.map +1 -0
  119. package/dist/chunk-AGZQD76C.js +201 -0
  120. package/dist/chunk-AGZQD76C.js.map +1 -0
  121. package/dist/chunk-APO3DCMU.js +361 -0
  122. package/dist/chunk-APO3DCMU.js.map +1 -0
  123. package/dist/chunk-BFBF3XEF.js +283 -0
  124. package/dist/chunk-BFBF3XEF.js.map +1 -0
  125. package/dist/chunk-BJ3KMYTB.js +1974 -0
  126. package/dist/chunk-BJ3KMYTB.js.map +1 -0
  127. package/dist/chunk-CHEL3SKB.js +6758 -0
  128. package/dist/chunk-CHEL3SKB.js.map +1 -0
  129. package/dist/chunk-CQZRLNMV.js +1491 -0
  130. package/dist/chunk-CQZRLNMV.js.map +1 -0
  131. package/dist/chunk-D46YSIYX.js +892 -0
  132. package/dist/chunk-D46YSIYX.js.map +1 -0
  133. package/dist/chunk-DINWEURR.js +648 -0
  134. package/dist/chunk-DINWEURR.js.map +1 -0
  135. package/dist/chunk-DK5LDEQM.js +530 -0
  136. package/dist/chunk-DK5LDEQM.js.map +1 -0
  137. package/dist/chunk-DOM4GKSW.js +34 -0
  138. package/dist/chunk-DOM4GKSW.js.map +1 -0
  139. package/dist/chunk-EDTHC6UD.js +1075 -0
  140. package/dist/chunk-EFJ3MQ4V.js +721 -0
  141. package/dist/chunk-EHRTFRWW.js +89 -0
  142. package/dist/chunk-EHRTFRWW.js.map +1 -0
  143. package/dist/chunk-FAJ7FZYM.js +11 -0
  144. package/dist/chunk-FAJ7FZYM.js.map +1 -0
  145. package/dist/chunk-FBYESMQ2.js +570 -0
  146. package/dist/chunk-FDU6HUUL.js +147 -0
  147. package/dist/chunk-FF4KLI5W.js +99 -0
  148. package/dist/chunk-FF4KLI5W.js.map +1 -0
  149. package/dist/chunk-FIT6DMX6.js +310 -0
  150. package/dist/chunk-FIT6DMX6.js.map +1 -0
  151. package/dist/chunk-FJ43PRLT.js +272 -0
  152. package/dist/chunk-FJ43PRLT.js.map +1 -0
  153. package/dist/chunk-FKFMOY3N.js +32 -0
  154. package/dist/chunk-FKFMOY3N.js.map +1 -0
  155. package/dist/chunk-FLTNHQK6.js +262 -0
  156. package/dist/chunk-FLTNHQK6.js.map +1 -0
  157. package/dist/chunk-GA454ALV.js +12436 -0
  158. package/dist/chunk-GA454ALV.js.map +1 -0
  159. package/dist/chunk-GGKRUQOO.js +228 -0
  160. package/dist/chunk-GIF42EW3.js +63 -0
  161. package/dist/chunk-GIF42EW3.js.map +1 -0
  162. package/dist/chunk-GL6I6MEQ.js +647 -0
  163. package/dist/chunk-H3ME6L6D.js +709 -0
  164. package/dist/chunk-H3ME6L6D.js.map +1 -0
  165. package/dist/chunk-HHLLAQGZ.js +1 -0
  166. package/dist/chunk-HXXBL2KD.js +2040 -0
  167. package/dist/chunk-I5V2VDIW.js +219 -0
  168. package/dist/chunk-I5V2VDIW.js.map +1 -0
  169. package/dist/chunk-I6K5FBRQ.js +35 -0
  170. package/dist/chunk-I6K5FBRQ.js.map +1 -0
  171. package/dist/chunk-ICRIXAP2.js +121 -0
  172. package/dist/chunk-ICRIXAP2.js.map +1 -0
  173. package/dist/chunk-J4EB7DNW.js +11 -0
  174. package/dist/chunk-J4EB7DNW.js.map +1 -0
  175. package/dist/chunk-JLFA7DQG.js +62 -0
  176. package/dist/chunk-JLFA7DQG.js.map +1 -0
  177. package/dist/chunk-KJTKLXTH.js +9 -0
  178. package/dist/chunk-KJTKLXTH.js.map +1 -0
  179. package/dist/chunk-KLAO5DGL.js +917 -0
  180. package/dist/chunk-KLAO5DGL.js.map +1 -0
  181. package/dist/chunk-KNKUID7G.js +183 -0
  182. package/dist/chunk-KOSORCJG.js +624 -0
  183. package/dist/chunk-KOSORCJG.js.map +1 -0
  184. package/dist/chunk-KUJVMMZQ.js +1262 -0
  185. package/dist/chunk-KUJVMMZQ.js.map +1 -0
  186. package/dist/chunk-LCR46JY5.js +123 -0
  187. package/dist/chunk-LCR46JY5.js.map +1 -0
  188. package/dist/chunk-LLQ2LLWF.js +148 -0
  189. package/dist/chunk-LLQ2LLWF.js.map +1 -0
  190. package/dist/chunk-LPMVBPA3.js +236 -0
  191. package/dist/chunk-LT3NLYSI.js +50 -0
  192. package/dist/chunk-LT3NLYSI.js.map +1 -0
  193. package/dist/chunk-LUDTDZLK.js +287 -0
  194. package/dist/chunk-LUDTDZLK.js.map +1 -0
  195. package/dist/chunk-M23FSH32.js +3963 -0
  196. package/dist/chunk-M23FSH32.js.map +1 -0
  197. package/dist/chunk-MC26UJIM.js +118 -0
  198. package/dist/chunk-ME6ESPZU.js +119 -0
  199. package/dist/chunk-ME6ESPZU.js.map +1 -0
  200. package/dist/chunk-MGKYQQYF.js +272 -0
  201. package/dist/chunk-MJFNCJXV.js +66 -0
  202. package/dist/chunk-MJFNCJXV.js.map +1 -0
  203. package/dist/chunk-MSWG7JI6.js +237 -0
  204. package/dist/chunk-MSWG7JI6.js.map +1 -0
  205. package/dist/chunk-MT25YHYH.js +141 -0
  206. package/dist/chunk-MT25YHYH.js.map +1 -0
  207. package/dist/chunk-MT4HVDUZ.js +53 -0
  208. package/dist/chunk-MY6TPVXW.js +219 -0
  209. package/dist/chunk-N2D6GXBM.js +267 -0
  210. package/dist/chunk-N2D6GXBM.js.map +1 -0
  211. package/dist/chunk-NJ3MJQZX.js +46 -0
  212. package/dist/chunk-NJ3MJQZX.js.map +1 -0
  213. package/dist/chunk-NMZY542O.js +335 -0
  214. package/dist/chunk-NMZY542O.js.map +1 -0
  215. package/dist/chunk-NNVTUXEB.js +23 -0
  216. package/dist/chunk-NZL6GGQE.js +375 -0
  217. package/dist/chunk-NZL6GGQE.js.map +1 -0
  218. package/dist/chunk-P4NEIHUT.js +108 -0
  219. package/dist/chunk-P7FMDTKL.js +103 -0
  220. package/dist/chunk-P7FMDTKL.js.map +1 -0
  221. package/dist/chunk-PHK3HARR.js +32 -0
  222. package/dist/chunk-PHK3HARR.js.map +1 -0
  223. package/dist/chunk-PIRJPV5T.js +98 -0
  224. package/dist/chunk-PIRJPV5T.js.map +1 -0
  225. package/dist/chunk-PK7H5L6Y.js +159 -0
  226. package/dist/chunk-PK7H5L6Y.js.map +1 -0
  227. package/dist/chunk-PR5FBTFU.js +233 -0
  228. package/dist/chunk-PR5FBTFU.js.map +1 -0
  229. package/dist/chunk-PU63GXWS.js +174 -0
  230. package/dist/chunk-PU63GXWS.js.map +1 -0
  231. package/dist/chunk-PZIAX57I.js +124 -0
  232. package/dist/chunk-PZIAX57I.js.map +1 -0
  233. package/dist/chunk-Q7P4WJDP.js +26 -0
  234. package/dist/chunk-Q7P4WJDP.js.map +1 -0
  235. package/dist/chunk-QQUAB63I.js +63 -0
  236. package/dist/chunk-QQUAB63I.js.map +1 -0
  237. package/dist/chunk-QRNI5JBH.js +18 -0
  238. package/dist/chunk-RHY3HH7P.js +601 -0
  239. package/dist/chunk-RHY3HH7P.js.map +1 -0
  240. package/dist/chunk-RRF5UOBJ.js +91 -0
  241. package/dist/chunk-RXDLTSWT.js +124 -0
  242. package/dist/chunk-RXDLTSWT.js.map +1 -0
  243. package/dist/chunk-RYED3SPJ.js +42 -0
  244. package/dist/chunk-RYED3SPJ.js.map +1 -0
  245. package/dist/chunk-S7KDBTWT.js +106 -0
  246. package/dist/chunk-S7KDBTWT.js.map +1 -0
  247. package/dist/chunk-SEDEKFYQ.js +1 -0
  248. package/dist/chunk-TECVW3JP.js +36 -0
  249. package/dist/chunk-TECVW3JP.js.map +1 -0
  250. package/dist/chunk-TFO23QT4.js +88 -0
  251. package/dist/chunk-TFO23QT4.js.map +1 -0
  252. package/dist/chunk-TK4UEOSK.js +76 -0
  253. package/dist/chunk-TK4UEOSK.js.map +1 -0
  254. package/dist/chunk-TKWGAOLV.js +122 -0
  255. package/dist/chunk-TKWGAOLV.js.map +1 -0
  256. package/dist/chunk-TMM4S4IJ.js +597 -0
  257. package/dist/chunk-TMM4S4IJ.js.map +1 -0
  258. package/dist/chunk-TMQLARTH.js +188 -0
  259. package/dist/chunk-TMQLARTH.js.map +1 -0
  260. package/dist/chunk-TPDBFYEG.js +130 -0
  261. package/dist/chunk-TPDBFYEG.js.map +1 -0
  262. package/dist/chunk-TPMQ3G6Z.js +145 -0
  263. package/dist/chunk-TPMQ3G6Z.js.map +1 -0
  264. package/dist/chunk-TZOLIGIG.js +61 -0
  265. package/dist/chunk-TZOLIGIG.js.map +1 -0
  266. package/dist/chunk-U3PN77QT.js +113 -0
  267. package/dist/chunk-U3WSW6PZ.js +277 -0
  268. package/dist/chunk-U4SCL7B7.js +640 -0
  269. package/dist/chunk-U4SCL7B7.js.map +1 -0
  270. package/dist/chunk-UWK5OXUJ.js +156 -0
  271. package/dist/chunk-UWK5OXUJ.js.map +1 -0
  272. package/dist/chunk-UWVJF25J.js +74 -0
  273. package/dist/chunk-UXHQAFNA.js +1317 -0
  274. package/dist/chunk-UXHQAFNA.js.map +1 -0
  275. package/dist/chunk-V5OCT34X.js +1 -0
  276. package/dist/chunk-VLXA6PI2.js +304 -0
  277. package/dist/chunk-VLXA6PI2.js.map +1 -0
  278. package/dist/chunk-VNO6ZJ35.js +500 -0
  279. package/dist/chunk-VNO6ZJ35.js.map +1 -0
  280. package/dist/chunk-VW676BEI.js +827 -0
  281. package/dist/chunk-VW676BEI.js.map +1 -0
  282. package/dist/chunk-W3LR522O.js +2296 -0
  283. package/dist/chunk-W4L6CZKA.js +96 -0
  284. package/dist/chunk-W4L6CZKA.js.map +1 -0
  285. package/dist/chunk-W4RVMTHR.js +372 -0
  286. package/dist/chunk-W4RVMTHR.js.map +1 -0
  287. package/dist/chunk-WEHSQBFR.js +188 -0
  288. package/dist/chunk-WEHSQBFR.js.map +1 -0
  289. package/dist/chunk-WELDCG6C.js +380 -0
  290. package/dist/chunk-WELDCG6C.js.map +1 -0
  291. package/dist/chunk-WZYKANL3.js +2800 -0
  292. package/dist/chunk-WZYKANL3.js.map +1 -0
  293. package/dist/chunk-XIG5PDM7.js +48 -0
  294. package/dist/chunk-XJNBEDFE.js +193 -0
  295. package/dist/chunk-XJNBEDFE.js.map +1 -0
  296. package/dist/chunk-XVVIG67A.js +291 -0
  297. package/dist/chunk-XVVIG67A.js.map +1 -0
  298. package/dist/chunk-XVZ7B3HG.js +135 -0
  299. package/dist/chunk-YBPYIAA5.js +73 -0
  300. package/dist/chunk-YBPYIAA5.js.map +1 -0
  301. package/dist/chunk-Z734BLO3.js +21 -0
  302. package/dist/chunk-Z734BLO3.js.map +1 -0
  303. package/dist/chunk-ZKSK55RC.js +269 -0
  304. package/dist/chunk-ZKSK55RC.js.map +1 -0
  305. package/dist/chunk-ZTFCYYEZ.js +69 -0
  306. package/dist/chunk-ZTFCYYEZ.js.map +1 -0
  307. package/dist/chunk-ZY2MNJR6.js +329 -0
  308. package/dist/chunk-ZY2MNJR6.js.map +1 -0
  309. package/dist/cli-D3VpkVwB.d.ts +1136 -0
  310. package/dist/cli.d.ts +39 -10
  311. package/dist/cli.js +108 -49
  312. package/dist/commitment-ledger.js +1 -1
  313. package/dist/compat/checks.d.ts +5 -0
  314. package/dist/compat/checks.js +11 -0
  315. package/dist/compat/checks.js.map +1 -0
  316. package/dist/compat/types.d.ts +30 -0
  317. package/dist/compat/types.js +1 -0
  318. package/dist/compat/types.js.map +1 -0
  319. package/dist/compounding/engine.d.ts +221 -0
  320. package/dist/compounding/engine.js +32 -0
  321. package/dist/compounding/engine.js.map +1 -0
  322. package/dist/compounding/preference-consolidator.d.ts +92 -0
  323. package/dist/compounding/preference-consolidator.js +553 -0
  324. package/dist/compounding/preference-consolidator.js.map +1 -0
  325. package/dist/config.d.ts +4 -2
  326. package/dist/config.js +9 -4
  327. package/dist/conflict-policy-DyJ2wd-h.d.ts +4 -0
  328. package/dist/connectors/codex-materialize-runner.d.ts +64 -0
  329. package/dist/connectors/codex-materialize-runner.js +33 -0
  330. package/dist/connectors/codex-materialize-runner.js.map +1 -0
  331. package/dist/connectors/codex-materialize.d.ts +195 -0
  332. package/dist/connectors/codex-materialize.js +38 -0
  333. package/dist/connectors/codex-materialize.js.map +1 -0
  334. package/dist/connectors/index.d.ts +444 -0
  335. package/dist/connectors/index.js +115 -0
  336. package/dist/connectors/index.js.map +1 -0
  337. package/dist/connectors-cli-CwbyjGR7.d.ts +257 -0
  338. package/dist/connectors-cli.d.ts +1 -1
  339. package/dist/consolidation-provenance-check.d.ts +3 -1
  340. package/dist/consolidation-undo.d.ts +3 -1
  341. package/dist/contradiction/index.d.ts +258 -0
  342. package/dist/contradiction/index.js +43 -0
  343. package/dist/contradiction/index.js.map +1 -0
  344. package/dist/contradiction-review-ATP4S6IC.js +30 -0
  345. package/dist/contradiction-review-ATP4S6IC.js.map +1 -0
  346. package/dist/contradiction-scan-5A4IDZV5.js +13 -0
  347. package/dist/contradiction-scan-5A4IDZV5.js.map +1 -0
  348. package/dist/conversation-index/backend.d.ts +97 -0
  349. package/dist/conversation-index/backend.js +13 -0
  350. package/dist/conversation-index/backend.js.map +1 -0
  351. package/dist/conversation-index/chunker.d.ts +16 -0
  352. package/dist/conversation-index/chunker.js +8 -0
  353. package/dist/conversation-index/chunker.js.map +1 -0
  354. package/dist/conversation-index/cleanup.d.ts +11 -0
  355. package/dist/conversation-index/cleanup.js +9 -0
  356. package/dist/conversation-index/cleanup.js.map +1 -0
  357. package/dist/conversation-index/faiss-adapter.d.ts +6 -0
  358. package/dist/conversation-index/faiss-adapter.js +16 -0
  359. package/dist/conversation-index/faiss-adapter.js.map +1 -0
  360. package/dist/conversation-index/indexer.d.ts +23 -0
  361. package/dist/conversation-index/indexer.js +15 -0
  362. package/dist/conversation-index/indexer.js.map +1 -0
  363. package/dist/conversation-index/search.d.ts +6 -0
  364. package/dist/conversation-index/search.js +11 -0
  365. package/dist/conversation-index/search.js.map +1 -0
  366. package/dist/embedding-fallback.js +2 -2
  367. package/dist/enrichment/index.d.ts +163 -0
  368. package/dist/enrichment/index.js +18 -0
  369. package/dist/enrichment/index.js.map +1 -0
  370. package/dist/entity-retrieval.d.ts +4 -2
  371. package/dist/entity-retrieval.js +8 -5
  372. package/dist/evals.js +1 -1
  373. package/dist/explicit-capture.d.ts +20 -5
  374. package/dist/explicit-capture.js +2 -2
  375. package/dist/extraction-judge-training.js +1 -1
  376. package/dist/extraction.js +8 -8
  377. package/dist/faiss-adapter-CzPghc4C.d.ts +70 -0
  378. package/dist/fallback-llm.d.ts +2 -0
  379. package/dist/fallback-llm.js +4 -4
  380. package/dist/graph-edge-decay-5DI5GUNL.js +207 -0
  381. package/dist/index.d.ts +66 -711
  382. package/dist/index.js +556 -2680
  383. package/dist/index.js.map +1 -1
  384. package/dist/lcm/archive.d.ts +89 -0
  385. package/dist/lcm/archive.js +12 -0
  386. package/dist/lcm/archive.js.map +1 -0
  387. package/dist/lcm/dag.d.ts +48 -0
  388. package/dist/lcm/dag.js +8 -0
  389. package/dist/lcm/dag.js.map +1 -0
  390. package/dist/lcm/engine.d.ts +116 -0
  391. package/dist/lcm/engine.js +20 -0
  392. package/dist/lcm/engine.js.map +1 -0
  393. package/dist/lcm/index.d.ts +12 -0
  394. package/dist/lcm/index.js +44 -0
  395. package/dist/lcm/index.js.map +1 -0
  396. package/dist/lcm/queue.d.ts +62 -0
  397. package/dist/lcm/queue.js +8 -0
  398. package/dist/lcm/queue.js.map +1 -0
  399. package/dist/lcm/recall.d.ts +20 -0
  400. package/dist/lcm/recall.js +8 -0
  401. package/dist/lcm/recall.js.map +1 -0
  402. package/dist/lcm/schema.d.ts +16 -0
  403. package/dist/lcm/schema.js +14 -0
  404. package/dist/lcm/schema.js.map +1 -0
  405. package/dist/lcm/summarizer.d.ts +38 -0
  406. package/dist/lcm/summarizer.js +12 -0
  407. package/dist/lcm/summarizer.js.map +1 -0
  408. package/dist/lcm/tools.d.ts +29 -0
  409. package/dist/lcm/tools.js +8 -0
  410. package/dist/lcm/tools.js.map +1 -0
  411. package/dist/live-connectors-runner.js +5 -5
  412. package/dist/local-llm.js +3 -3
  413. package/dist/maintenance/archive-observations.d.ts +18 -0
  414. package/dist/maintenance/archive-observations.js +8 -0
  415. package/dist/maintenance/archive-observations.js.map +1 -0
  416. package/dist/maintenance/backup-stamp.d.ts +3 -0
  417. package/dist/maintenance/backup-stamp.js +8 -0
  418. package/dist/maintenance/backup-stamp.js.map +1 -0
  419. package/dist/maintenance/memory-governance-cron.d.ts +85 -0
  420. package/dist/maintenance/memory-governance-cron.js +22 -0
  421. package/dist/maintenance/memory-governance-cron.js.map +1 -0
  422. package/dist/maintenance/memory-governance.d.ts +137 -0
  423. package/dist/maintenance/memory-governance.js +40 -0
  424. package/dist/maintenance/memory-governance.js.map +1 -0
  425. package/dist/maintenance/migrate-observations.d.ts +18 -0
  426. package/dist/maintenance/migrate-observations.js +9 -0
  427. package/dist/maintenance/migrate-observations.js.map +1 -0
  428. package/dist/maintenance/observation-ledger-utils.d.ts +10 -0
  429. package/dist/maintenance/observation-ledger-utils.js +10 -0
  430. package/dist/maintenance/observation-ledger-utils.js.map +1 -0
  431. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +15 -0
  432. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +28 -0
  433. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js.map +1 -0
  434. package/dist/maintenance/rebuild-memory-projection.d.ts +77 -0
  435. package/dist/maintenance/rebuild-memory-projection.js +35 -0
  436. package/dist/maintenance/rebuild-memory-projection.js.map +1 -0
  437. package/dist/maintenance/rebuild-observations.d.ts +17 -0
  438. package/dist/maintenance/rebuild-observations.js +9 -0
  439. package/dist/maintenance/rebuild-observations.js.map +1 -0
  440. package/dist/mcp-memory-inspector-app.d.ts +24 -6
  441. package/dist/memory-projection-store.d.ts +108 -3
  442. package/dist/memory-projection-store.js +2 -1
  443. package/dist/memory-worth-outcomes.d.ts +4 -2
  444. package/dist/migrate/from-engram.d.ts +24 -0
  445. package/dist/migrate/from-engram.js +12 -0
  446. package/dist/migrate/from-engram.js.map +1 -0
  447. package/dist/namespaces/migrate.d.ts +50 -0
  448. package/dist/namespaces/migrate.js +50 -0
  449. package/dist/namespaces/migrate.js.map +1 -0
  450. package/dist/namespaces/principal.d.ts +17 -0
  451. package/dist/namespaces/principal.js +16 -0
  452. package/dist/namespaces/principal.js.map +1 -0
  453. package/dist/namespaces/search.d.ts +46 -0
  454. package/dist/namespaces/search.js +28 -0
  455. package/dist/namespaces/search.js.map +1 -0
  456. package/dist/namespaces/storage.d.ts +32 -0
  457. package/dist/namespaces/storage.js +28 -0
  458. package/dist/namespaces/storage.js.map +1 -0
  459. package/dist/network/tailscale.d.ts +41 -0
  460. package/dist/network/tailscale.js +9 -0
  461. package/dist/network/tailscale.js.map +1 -0
  462. package/dist/network/webdav.d.ts +39 -0
  463. package/dist/network/webdav.js +10 -0
  464. package/dist/network/webdav.js.map +1 -0
  465. package/dist/objective-state-writers.js +2 -2
  466. package/dist/operator-toolkit.d.ts +4 -2
  467. package/dist/operator-toolkit.js +32 -14
  468. package/dist/opik-exporter.js +2 -2
  469. package/dist/opik-exporter.js.map +1 -1
  470. package/dist/orchestrator-DuWl9Hwx.d.ts +1244 -0
  471. package/dist/orchestrator.d.ts +22 -7
  472. package/dist/orchestrator.js +79 -44
  473. package/dist/path-MR5JPYOP.js +9 -0
  474. package/dist/path-MR5JPYOP.js.map +1 -0
  475. package/dist/qmd-recall-cache.d.ts +1 -1
  476. package/dist/qmd.d.ts +102 -3
  477. package/dist/qmd.js +23 -5
  478. package/dist/recall-explain-renderer.js +3 -3
  479. package/dist/recall-xray-cli.js +4 -4
  480. package/dist/recall-xray-renderer.js +3 -3
  481. package/dist/recall-xray.js +2 -2
  482. package/dist/replay/normalizers/chatgpt.d.ts +6 -0
  483. package/dist/replay/normalizers/chatgpt.js +11 -0
  484. package/dist/replay/normalizers/chatgpt.js.map +1 -0
  485. package/dist/replay/normalizers/claude.d.ts +6 -0
  486. package/dist/replay/normalizers/claude.js +11 -0
  487. package/dist/replay/normalizers/claude.js.map +1 -0
  488. package/dist/replay/normalizers/openclaw.d.ts +6 -0
  489. package/dist/replay/normalizers/openclaw.js +11 -0
  490. package/dist/replay/normalizers/openclaw.js.map +1 -0
  491. package/dist/replay/normalizers/shared.d.ts +16 -0
  492. package/dist/replay/normalizers/shared.js +14 -0
  493. package/dist/replay/normalizers/shared.js.map +1 -0
  494. package/dist/replay/runner.d.ts +35 -0
  495. package/dist/replay/runner.js +16 -0
  496. package/dist/replay/runner.js.map +1 -0
  497. package/dist/replay/types.d.ts +57 -0
  498. package/dist/replay/types.js +19 -0
  499. package/dist/replay/types.js.map +1 -0
  500. package/dist/resolution-B7FNQSSP.js +12 -0
  501. package/dist/resolution-B7FNQSSP.js.map +1 -0
  502. package/dist/resolve-provider-secret.js +2 -2
  503. package/dist/resume-bundles.js +8 -6
  504. package/dist/retrieval-agents.d.ts +1 -1
  505. package/dist/routing/engine.d.ts +35 -0
  506. package/dist/routing/engine.js +16 -0
  507. package/dist/routing/engine.js.map +1 -0
  508. package/dist/routing/store.d.ts +27 -0
  509. package/dist/routing/store.js +10 -0
  510. package/dist/routing/store.js.map +1 -0
  511. package/dist/runtime/better-sqlite.d.ts +8 -0
  512. package/dist/runtime/better-sqlite.js +10 -0
  513. package/dist/runtime/better-sqlite.js.map +1 -0
  514. package/dist/runtime/child-process.d.ts +32 -0
  515. package/dist/runtime/child-process.js +10 -0
  516. package/dist/runtime/child-process.js.map +1 -0
  517. package/dist/runtime/env.d.ts +5 -0
  518. package/dist/runtime/env.js +12 -0
  519. package/dist/runtime/env.js.map +1 -0
  520. package/dist/schemas.d.ts +22 -22
  521. package/dist/sdk-compat.js +1 -1
  522. package/dist/search/document-scanner.d.ts +22 -0
  523. package/dist/search/document-scanner.js +8 -0
  524. package/dist/search/document-scanner.js.map +1 -0
  525. package/dist/search/embed-helper.d.ts +35 -0
  526. package/dist/search/embed-helper.js +9 -0
  527. package/dist/search/embed-helper.js.map +1 -0
  528. package/dist/search/factory.d.ts +32 -0
  529. package/dist/search/factory.js +29 -0
  530. package/dist/search/factory.js.map +1 -0
  531. package/dist/search/index.d.ts +15 -0
  532. package/dist/search/index.js +50 -0
  533. package/dist/search/index.js.map +1 -0
  534. package/dist/search/lancedb-backend.d.ts +51 -0
  535. package/dist/search/lancedb-backend.js +10 -0
  536. package/dist/search/lancedb-backend.js.map +1 -0
  537. package/dist/search/meilisearch-backend.d.ts +48 -0
  538. package/dist/search/meilisearch-backend.js +10 -0
  539. package/dist/search/meilisearch-backend.js.map +1 -0
  540. package/dist/search/noop-backend.d.ts +26 -0
  541. package/dist/search/noop-backend.js +8 -0
  542. package/dist/search/noop-backend.js.map +1 -0
  543. package/dist/search/orama-backend.d.ts +53 -0
  544. package/dist/search/orama-backend.js +10 -0
  545. package/dist/search/orama-backend.js.map +1 -0
  546. package/dist/search/port.d.ts +61 -0
  547. package/dist/search/port.js +1 -0
  548. package/dist/search/port.js.map +1 -0
  549. package/dist/search/remote-backend.d.ts +39 -0
  550. package/dist/search/remote-backend.js +9 -0
  551. package/dist/search/remote-backend.js.map +1 -0
  552. package/dist/secure-store/index.d.ts +890 -0
  553. package/dist/secure-store/index.js +156 -0
  554. package/dist/secure-store/index.js.map +1 -0
  555. package/dist/semantic-VwGI14Ok.d.ts +69 -0
  556. package/dist/semantic-consolidation-4HkHWgeI.d.ts +180 -0
  557. package/dist/semantic-consolidation.d.ts +2 -2
  558. package/dist/semantic-consolidation.js +13 -6
  559. package/dist/semantic-rule-promotion.js +8 -5
  560. package/dist/semantic-rule-verifier.js +8 -5
  561. package/dist/shared-context/manager.d.ts +131 -0
  562. package/dist/shared-context/manager.js +15 -0
  563. package/dist/shared-context/manager.js.map +1 -0
  564. package/dist/skills-registry.js +13 -1
  565. package/dist/skills-registry.js.map +1 -1
  566. package/dist/state-store-VZU2IA53.js +16 -0
  567. package/dist/state-store-VZU2IA53.js.map +1 -0
  568. package/dist/storage-paths.d.ts +9 -0
  569. package/dist/storage-paths.js +20 -0
  570. package/dist/storage-paths.js.map +1 -0
  571. package/dist/storage.d.ts +3 -1
  572. package/dist/storage.js +7 -4
  573. package/dist/summarizer.d.ts +5 -0
  574. package/dist/summarizer.js +9 -8
  575. package/dist/summary-snapshot.js +2 -1
  576. package/dist/surfaces/dreams.d.ts +16 -0
  577. package/dist/surfaces/dreams.js +282 -0
  578. package/dist/surfaces/dreams.js.map +1 -0
  579. package/dist/surfaces/heartbeat.d.ts +17 -0
  580. package/dist/surfaces/heartbeat.js +265 -0
  581. package/dist/surfaces/heartbeat.js.map +1 -0
  582. package/dist/temporal-supersession.d.ts +3 -1
  583. package/dist/threading.d.ts +5 -0
  584. package/dist/threading.js +2 -1
  585. package/dist/tier-migration.d.ts +4 -2
  586. package/dist/tokens.js +2 -2
  587. package/dist/transcript.d.ts +15 -1
  588. package/dist/transcript.js +2 -1
  589. package/dist/transfer/autodetect.d.ts +4 -0
  590. package/dist/transfer/autodetect.js +15 -0
  591. package/dist/transfer/autodetect.js.map +1 -0
  592. package/dist/transfer/backup.d.ts +21 -0
  593. package/dist/transfer/backup.js +17 -0
  594. package/dist/transfer/backup.js.map +1 -0
  595. package/dist/transfer/capsule-export.d.ts +113 -0
  596. package/dist/transfer/capsule-export.js +19 -0
  597. package/dist/transfer/capsule-export.js.map +1 -0
  598. package/dist/transfer/capsule-import.d.ts +124 -0
  599. package/dist/transfer/capsule-import.js +16 -0
  600. package/dist/transfer/capsule-import.js.map +1 -0
  601. package/dist/transfer/constants.d.ts +13 -0
  602. package/dist/transfer/constants.js +12 -0
  603. package/dist/transfer/constants.js.map +1 -0
  604. package/dist/transfer/export-json.d.ts +11 -0
  605. package/dist/transfer/export-json.js +11 -0
  606. package/dist/transfer/export-json.js.map +1 -0
  607. package/dist/transfer/export-md.d.ts +10 -0
  608. package/dist/transfer/export-md.js +13 -0
  609. package/dist/transfer/export-md.js.map +1 -0
  610. package/dist/transfer/export-sqlite.d.ts +9 -0
  611. package/dist/transfer/export-sqlite.js +12 -0
  612. package/dist/transfer/export-sqlite.js.map +1 -0
  613. package/dist/transfer/fs-utils.d.ts +61 -0
  614. package/dist/transfer/fs-utils.js +40 -0
  615. package/dist/transfer/fs-utils.js.map +1 -0
  616. package/dist/transfer/import-json.d.ts +16 -0
  617. package/dist/transfer/import-json.js +13 -0
  618. package/dist/transfer/import-json.js.map +1 -0
  619. package/dist/transfer/import-md.d.ts +14 -0
  620. package/dist/transfer/import-md.js +11 -0
  621. package/dist/transfer/import-md.js.map +1 -0
  622. package/dist/transfer/import-sqlite.d.ts +14 -0
  623. package/dist/transfer/import-sqlite.js +12 -0
  624. package/dist/transfer/import-sqlite.js.map +1 -0
  625. package/dist/transfer/sqlite-schema.d.ts +4 -0
  626. package/dist/transfer/sqlite-schema.js +10 -0
  627. package/dist/transfer/sqlite-schema.js.map +1 -0
  628. package/dist/transfer/types.d.ts +916 -0
  629. package/dist/transfer/types.js +30 -0
  630. package/dist/transfer/types.js.map +1 -0
  631. package/dist/types.d.ts +28 -1
  632. package/dist/types.js +1 -1
  633. package/dist/verified-recall.js +9 -6
  634. package/dist/work/board.d.ts +43 -0
  635. package/dist/work/board.js +14 -0
  636. package/dist/work/board.js.map +1 -0
  637. package/dist/work/boundary.d.ts +8 -0
  638. package/dist/work/boundary.js +14 -0
  639. package/dist/work/boundary.js.map +1 -0
  640. package/dist/work/storage.d.ts +39 -0
  641. package/dist/work/storage.js +11 -0
  642. package/dist/work/storage.js.map +1 -0
  643. package/dist/work/types.d.ts +75 -0
  644. package/dist/work/types.js +1 -0
  645. package/dist/work/types.js.map +1 -0
  646. package/package.json +2767 -6
  647. package/scripts/faiss_index.py +816 -0
  648. package/scripts/faiss_requirements.txt +3 -0
  649. package/skills/remnic-entities/SKILL.md +51 -0
  650. package/skills/remnic-memory-workflow/SKILL.md +61 -0
  651. package/skills/remnic-recall/SKILL.md +51 -0
  652. package/skills/remnic-remember/SKILL.md +56 -0
  653. package/skills/remnic-search/SKILL.md +51 -0
  654. package/skills/remnic-status/SKILL.md +51 -0
  655. package/src/abort-error.test.ts +49 -0
  656. package/src/abort-error.ts +46 -0
  657. package/src/abstraction-nodes.ts +162 -0
  658. package/src/access-audit.test.ts +178 -0
  659. package/src/access-audit.ts +125 -0
  660. package/src/access-cli.test.ts +439 -0
  661. package/src/access-cli.ts +438 -0
  662. package/src/access-http.test.ts +225 -0
  663. package/src/access-http.ts +1899 -0
  664. package/src/access-idempotency.ts +232 -0
  665. package/src/access-mcp.test.ts +568 -0
  666. package/src/access-mcp.ts +3056 -0
  667. package/src/access-schema-pi.test.ts +60 -0
  668. package/src/access-schema.ts +522 -0
  669. package/src/access-service-namespace.test.ts +123 -0
  670. package/src/access-service.ts +5629 -0
  671. package/src/action-confidence.test.ts +206 -0
  672. package/src/action-confidence.ts +466 -0
  673. package/src/active-memory-bridge.test.ts +285 -0
  674. package/src/active-memory-bridge.ts +217 -0
  675. package/src/active-recall.test.ts +484 -0
  676. package/src/active-recall.ts +459 -0
  677. package/src/adapters/claude-code.ts +56 -0
  678. package/src/adapters/codex.ts +57 -0
  679. package/src/adapters/hermes.ts +64 -0
  680. package/src/adapters/index.ts +6 -0
  681. package/src/adapters/registry.ts +41 -0
  682. package/src/adapters/replit.ts +55 -0
  683. package/src/adapters/types.ts +51 -0
  684. package/src/behavior-learner.ts +144 -0
  685. package/src/behavior-signals.ts +73 -0
  686. package/src/binary-lifecycle/backend.ts +117 -0
  687. package/src/binary-lifecycle/index.ts +35 -0
  688. package/src/binary-lifecycle/manifest.ts +79 -0
  689. package/src/binary-lifecycle/pipeline.ts +352 -0
  690. package/src/binary-lifecycle/scanner.ts +89 -0
  691. package/src/binary-lifecycle/types.ts +89 -0
  692. package/src/bootstrap.ts +178 -0
  693. package/src/boxes.ts +521 -0
  694. package/src/briefing.test.ts +1535 -0
  695. package/src/briefing.ts +1382 -0
  696. package/src/buffer-session.test.ts +443 -0
  697. package/src/buffer-surprise-report.ts +176 -0
  698. package/src/buffer-surprise-telemetry.test.ts +606 -0
  699. package/src/buffer-surprise-trigger.test.ts +766 -0
  700. package/src/buffer-surprise.test.ts +339 -0
  701. package/src/buffer-surprise.ts +203 -0
  702. package/src/buffer.ts +900 -0
  703. package/src/bulk-import/cli-command.test.ts +204 -0
  704. package/src/bulk-import/index.ts +34 -0
  705. package/src/bulk-import/pipeline.test.ts +445 -0
  706. package/src/bulk-import/pipeline.ts +178 -0
  707. package/src/bulk-import/registry.test.ts +151 -0
  708. package/src/bulk-import/registry.ts +72 -0
  709. package/src/bulk-import/types.test.ts +272 -0
  710. package/src/bulk-import/types.ts +145 -0
  711. package/src/calibration.ts +394 -0
  712. package/src/capsule-cli.test.ts +398 -0
  713. package/src/capsule-cli.ts +565 -0
  714. package/src/causal-behavior.ts +308 -0
  715. package/src/causal-chain.ts +419 -0
  716. package/src/causal-consolidation.ts +370 -0
  717. package/src/causal-retrieval.ts +286 -0
  718. package/src/causal-trajectory-graph.ts +60 -0
  719. package/src/causal-trajectory.ts +303 -0
  720. package/src/chunking.ts +220 -0
  721. package/src/citations.ts +232 -0
  722. package/src/cli.ts +9403 -0
  723. package/src/codex-cli-fallback.ts +162 -0
  724. package/src/codex-thread-key.ts +1 -0
  725. package/src/coding/access-coding-context.test.ts +197 -0
  726. package/src/coding/coding-branch-scope.test.ts +281 -0
  727. package/src/coding/coding-namespace.test.ts +360 -0
  728. package/src/coding/coding-namespace.ts +412 -0
  729. package/src/coding/coding-orchestrator.test.ts +249 -0
  730. package/src/coding/git-context.test.ts +507 -0
  731. package/src/coding/git-context.ts +336 -0
  732. package/src/coding/mcp-set-coding-context.test.ts +174 -0
  733. package/src/coding/review-context.test.ts +316 -0
  734. package/src/coding/review-context.ts +349 -0
  735. package/src/coding/wire-coding-context.test.ts +468 -0
  736. package/src/commitment-ledger.test.ts +78 -0
  737. package/src/commitment-ledger.ts +337 -0
  738. package/src/compat/checks.test.ts +206 -0
  739. package/src/compat/checks.ts +716 -0
  740. package/src/compat/types.ts +33 -0
  741. package/src/compounding/engine.ts +1686 -0
  742. package/src/compounding/preference-consolidator.ts +778 -0
  743. package/src/compression-optimizer.ts +312 -0
  744. package/src/config.test.ts +930 -0
  745. package/src/config.ts +3807 -0
  746. package/src/connectors/codex/instructions.md +160 -0
  747. package/src/connectors/codex/resources/namespace-cheatsheet.md +48 -0
  748. package/src/connectors/codex-marketplace.ts +500 -0
  749. package/src/connectors/codex-materialize-runner.ts +212 -0
  750. package/src/connectors/codex-materialize.ts +983 -0
  751. package/src/connectors/coerce.ts +62 -0
  752. package/src/connectors/index.test.ts +1570 -0
  753. package/src/connectors/index.ts +3222 -0
  754. package/src/connectors/live/framework.ts +164 -0
  755. package/src/connectors/live/github.test.ts +1218 -0
  756. package/src/connectors/live/github.ts +1068 -0
  757. package/src/connectors/live/gmail.test.ts +1706 -0
  758. package/src/connectors/live/gmail.ts +1293 -0
  759. package/src/connectors/live/google-drive.test.ts +696 -0
  760. package/src/connectors/live/google-drive.ts +724 -0
  761. package/src/connectors/live/index.ts +101 -0
  762. package/src/connectors/live/live-connectors.test.ts +689 -0
  763. package/src/connectors/live/notion.test.ts +1109 -0
  764. package/src/connectors/live/notion.ts +978 -0
  765. package/src/connectors/live/registry.ts +103 -0
  766. package/src/connectors/live/state-store.ts +399 -0
  767. package/src/connectors/live/transient-errors.ts +150 -0
  768. package/src/connectors/weclone-installer.test.ts +850 -0
  769. package/src/connectors-cli.ts +513 -0
  770. package/src/console/state.test.ts +224 -0
  771. package/src/console/state.ts +514 -0
  772. package/src/console/trace.test.ts +813 -0
  773. package/src/console/trace.ts +603 -0
  774. package/src/console/tui.test.ts +582 -0
  775. package/src/console/tui.ts +508 -0
  776. package/src/consolidation-operator.ts +182 -0
  777. package/src/consolidation-provenance-check.ts +551 -0
  778. package/src/consolidation-undo.ts +718 -0
  779. package/src/contradiction/contradiction-judge.test.ts +189 -0
  780. package/src/contradiction/contradiction-judge.ts +333 -0
  781. package/src/contradiction/contradiction-review.ts +574 -0
  782. package/src/contradiction/contradiction-scan.ts +504 -0
  783. package/src/contradiction/contradiction.test.ts +2230 -0
  784. package/src/contradiction/index.ts +37 -0
  785. package/src/contradiction/resolution.ts +383 -0
  786. package/src/conversation-index/backend.ts +323 -0
  787. package/src/conversation-index/chunker.ts +47 -0
  788. package/src/conversation-index/cleanup.ts +53 -0
  789. package/src/conversation-index/faiss-adapter.ts +384 -0
  790. package/src/conversation-index/indexer.test.ts +164 -0
  791. package/src/conversation-index/indexer.ts +192 -0
  792. package/src/conversation-index/search.ts +37 -0
  793. package/src/cross-namespace-budget.test.ts +275 -0
  794. package/src/cross-namespace-budget.ts +365 -0
  795. package/src/cue-anchors.ts +163 -0
  796. package/src/curation/index.ts +544 -0
  797. package/src/dashboard-runtime.ts +337 -0
  798. package/src/day-summary.ts +122 -0
  799. package/src/dedup/index.ts +330 -0
  800. package/src/dedup/semantic.test.ts +1577 -0
  801. package/src/dedup/semantic.ts +148 -0
  802. package/src/delinearize.ts +193 -0
  803. package/src/direct-answer-wiring.test.ts +473 -0
  804. package/src/direct-answer-wiring.ts +180 -0
  805. package/src/direct-answer.test.ts +484 -0
  806. package/src/direct-answer.ts +273 -0
  807. package/src/embedding-fallback.ts +565 -0
  808. package/src/enrichment/audit.ts +89 -0
  809. package/src/enrichment/index.ts +27 -0
  810. package/src/enrichment/pipeline.ts +197 -0
  811. package/src/enrichment/provider-registry.ts +85 -0
  812. package/src/enrichment/types.ts +100 -0
  813. package/src/enrichment/web-search-provider.ts +63 -0
  814. package/src/entity-retrieval.ts +774 -0
  815. package/src/entity-schema.ts +239 -0
  816. package/src/evals.ts +1312 -0
  817. package/src/event-order-recall.test.ts +4164 -0
  818. package/src/event-order-recall.ts +2802 -0
  819. package/src/evidence-pack.test.ts +89 -0
  820. package/src/evidence-pack.ts +388 -0
  821. package/src/explicit-capture.ts +530 -0
  822. package/src/explicit-cue-recall.test.ts +3019 -0
  823. package/src/explicit-cue-recall.ts +5545 -0
  824. package/src/extraction-judge-telemetry.ts +234 -0
  825. package/src/extraction-judge-training.ts +221 -0
  826. package/src/extraction-judge.ts +846 -0
  827. package/src/extraction-timeout.test.ts +265 -0
  828. package/src/extraction.ts +2719 -0
  829. package/src/fallback-llm.test.ts +1060 -0
  830. package/src/fallback-llm.ts +918 -0
  831. package/src/focused-list-recall.test.ts +734 -0
  832. package/src/focused-list-recall.ts +1160 -0
  833. package/src/graph-dashboard-diff.ts +35 -0
  834. package/src/graph-dashboard-key.ts +5 -0
  835. package/src/graph-dashboard-parser.ts +104 -0
  836. package/src/graph-edge-reinforcement.ts +192 -0
  837. package/src/graph-events.ts +151 -0
  838. package/src/graph-recall.test.ts +164 -0
  839. package/src/graph-recall.ts +189 -0
  840. package/src/graph-retrieval.test.ts +809 -0
  841. package/src/graph-retrieval.ts +823 -0
  842. package/src/graph-snapshot.ts +329 -0
  843. package/src/graph.ts +813 -0
  844. package/src/harmonic-retrieval.ts +223 -0
  845. package/src/himem.ts +154 -0
  846. package/src/hygiene.ts +87 -0
  847. package/src/identity-continuity.ts +333 -0
  848. package/src/importance.ts +328 -0
  849. package/src/importers/base.test.ts +294 -0
  850. package/src/importers/base.ts +436 -0
  851. package/src/importers/index.ts +21 -0
  852. package/src/index.ts +1204 -0
  853. package/src/intent.ts +154 -0
  854. package/src/json-extract.ts +85 -0
  855. package/src/json-store.ts +42 -0
  856. package/src/lcm/archive.ts +617 -0
  857. package/src/lcm/dag.ts +199 -0
  858. package/src/lcm/engine.ts +645 -0
  859. package/src/lcm/index.ts +7 -0
  860. package/src/lcm/queue.test.ts +178 -0
  861. package/src/lcm/queue.ts +200 -0
  862. package/src/lcm/recall.ts +117 -0
  863. package/src/lcm/schema.ts +154 -0
  864. package/src/lcm/summarizer.ts +235 -0
  865. package/src/lcm/tools.ts +191 -0
  866. package/src/lcm-engine.test.ts +660 -0
  867. package/src/legacy-hook-compat.test.ts +20 -0
  868. package/src/legacy-hook-compat.ts +45 -0
  869. package/src/lifecycle.ts +289 -0
  870. package/src/live-connectors-runner.ts +385 -0
  871. package/src/local-llm-qos.test.ts +303 -0
  872. package/src/local-llm-thinking.test.ts +292 -0
  873. package/src/local-llm.ts +1464 -0
  874. package/src/logger.ts +49 -0
  875. package/src/maintenance/archive-observations.ts +147 -0
  876. package/src/maintenance/backup-stamp.ts +3 -0
  877. package/src/maintenance/dreams-ledger.ts +516 -0
  878. package/src/maintenance/first-start-migration.ts +362 -0
  879. package/src/maintenance/forget.test.ts +206 -0
  880. package/src/maintenance/forget.ts +126 -0
  881. package/src/maintenance/graph-edge-decay.test.ts +409 -0
  882. package/src/maintenance/graph-edge-decay.ts +394 -0
  883. package/src/maintenance/memory-governance-cron.ts +447 -0
  884. package/src/maintenance/memory-governance.ts +1039 -0
  885. package/src/maintenance/migrate-observations.ts +216 -0
  886. package/src/maintenance/observation-ledger-utils.ts +54 -0
  887. package/src/maintenance/pattern-reinforcement.test.ts +875 -0
  888. package/src/maintenance/pattern-reinforcement.ts +369 -0
  889. package/src/maintenance/purge.ts +334 -0
  890. package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +78 -0
  891. package/src/maintenance/rebuild-memory-projection.ts +1234 -0
  892. package/src/maintenance/rebuild-observations.ts +178 -0
  893. package/src/maintenance/tier-stats.test.ts +378 -0
  894. package/src/maintenance/tier-stats.ts +222 -0
  895. package/src/mcp-memory-inspector-app.ts +421 -0
  896. package/src/memory-action-policy.ts +80 -0
  897. package/src/memory-cache.ts +208 -0
  898. package/src/memory-extension/claude-code-publisher.ts +51 -0
  899. package/src/memory-extension/codex-publisher.ts +149 -0
  900. package/src/memory-extension/hermes-publisher.ts +51 -0
  901. package/src/memory-extension/index.ts +100 -0
  902. package/src/memory-extension/shared-instructions.ts +133 -0
  903. package/src/memory-extension/types.ts +86 -0
  904. package/src/memory-extension-host/host-discovery.ts +276 -0
  905. package/src/memory-extension-host/index.ts +14 -0
  906. package/src/memory-extension-host/render-extensions-block.ts +73 -0
  907. package/src/memory-extension-host/types.ts +21 -0
  908. package/src/memory-lifecycle-ledger-utils.ts +116 -0
  909. package/src/memory-projection-format.ts +11 -0
  910. package/src/memory-projection-store.ts +951 -0
  911. package/src/memory-provenance.test.ts +196 -0
  912. package/src/memory-provenance.ts +484 -0
  913. package/src/memory-worth-bench.test.ts +71 -0
  914. package/src/memory-worth-bench.ts +265 -0
  915. package/src/memory-worth-filter.test.ts +209 -0
  916. package/src/memory-worth-filter.ts +204 -0
  917. package/src/memory-worth-frontmatter.test.ts +311 -0
  918. package/src/memory-worth-outcomes.test.ts +316 -0
  919. package/src/memory-worth-outcomes.ts +286 -0
  920. package/src/memory-worth.test.ts +317 -0
  921. package/src/memory-worth.ts +215 -0
  922. package/src/message-parts/index.ts +806 -0
  923. package/src/message-parts/message-parts.test.ts +421 -0
  924. package/src/migrate/from-engram.ts +789 -0
  925. package/src/model-registry.ts +313 -0
  926. package/src/models-json.ts +76 -0
  927. package/src/namespaces/migrate.ts +187 -0
  928. package/src/namespaces/path.ts +25 -0
  929. package/src/namespaces/principal.test.ts +195 -0
  930. package/src/namespaces/principal.ts +86 -0
  931. package/src/namespaces/search.test.ts +105 -0
  932. package/src/namespaces/search.ts +233 -0
  933. package/src/namespaces/storage.ts +74 -0
  934. package/src/native-knowledge.ts +1823 -0
  935. package/src/negative.ts +72 -0
  936. package/src/network/tailscale.ts +179 -0
  937. package/src/network/webdav.ts +385 -0
  938. package/src/objective-state-writers.ts +951 -0
  939. package/src/objective-state.ts +320 -0
  940. package/src/onboarding/index.ts +529 -0
  941. package/src/openai-chat-compat.ts +56 -0
  942. package/src/operator-toolkit.ts +2132 -0
  943. package/src/opik-exporter.test.ts +72 -0
  944. package/src/opik-exporter.ts +587 -0
  945. package/src/orchestrator-extraction-queue.test.ts +197 -0
  946. package/src/orchestrator-flush.test.ts +1171 -0
  947. package/src/orchestrator-pattern-reinforcement.test.ts +128 -0
  948. package/src/orchestrator-source-attribution.test.ts +701 -0
  949. package/src/orchestrator.ts +16368 -0
  950. package/src/page-versioning.ts +450 -0
  951. package/src/patterns-cli.ts +574 -0
  952. package/src/peers/index.ts +54 -0
  953. package/src/peers/migrate-from-identity-anchor.test.ts +291 -0
  954. package/src/peers/migrate-from-identity-anchor.ts +350 -0
  955. package/src/peers/peers.test.ts +419 -0
  956. package/src/peers/profile-reasoner.ts +694 -0
  957. package/src/peers/storage.ts +1350 -0
  958. package/src/peers/types.ts +138 -0
  959. package/src/plugin-id.ts +84 -0
  960. package/src/policy-runtime.ts +209 -0
  961. package/src/procedural/procedure-miner.ts +150 -0
  962. package/src/procedural/procedure-recall.ts +93 -0
  963. package/src/procedural/procedure-stats.ts +213 -0
  964. package/src/procedural/procedure-types.ts +132 -0
  965. package/src/procedural/reinforcement-core.test.ts +132 -0
  966. package/src/procedural/reinforcement-core.ts +73 -0
  967. package/src/profiling.test.ts +263 -0
  968. package/src/profiling.ts +435 -0
  969. package/src/projection/index.ts +398 -0
  970. package/src/qmd-recall-cache.test.ts +138 -0
  971. package/src/qmd-recall-cache.ts +111 -0
  972. package/src/qmd.test.ts +258 -0
  973. package/src/qmd.ts +2614 -0
  974. package/src/reasoning-trace-recall.ts +201 -0
  975. package/src/reasoning-trace-types.ts +235 -0
  976. package/src/recall-audit-anomaly.test.ts +246 -0
  977. package/src/recall-audit-anomaly.ts +297 -0
  978. package/src/recall-audit.test.ts +51 -0
  979. package/src/recall-audit.ts +72 -0
  980. package/src/recall-budget-config.test.ts +87 -0
  981. package/src/recall-disclosure-escalation.test.ts +196 -0
  982. package/src/recall-disclosure-escalation.ts +158 -0
  983. package/src/recall-disclosure-shaping.test.ts +146 -0
  984. package/src/recall-disclosure.test.ts +214 -0
  985. package/src/recall-explain-renderer.test.ts +140 -0
  986. package/src/recall-explain-renderer.ts +356 -0
  987. package/src/recall-mmr.test.ts +808 -0
  988. package/src/recall-mmr.ts +607 -0
  989. package/src/recall-qos.test.ts +85 -0
  990. package/src/recall-qos.ts +82 -0
  991. package/src/recall-query-policy.ts +221 -0
  992. package/src/recall-state.test.ts +233 -0
  993. package/src/recall-state.ts +456 -0
  994. package/src/recall-tag-filter.ts +143 -0
  995. package/src/recall-tokenization.ts +35 -0
  996. package/src/recall-xray-cli.test.ts +118 -0
  997. package/src/recall-xray-cli.ts +100 -0
  998. package/src/recall-xray-disclosure-telemetry.test.ts +183 -0
  999. package/src/recall-xray-renderer.test.ts +539 -0
  1000. package/src/recall-xray-renderer.ts +487 -0
  1001. package/src/recall-xray.test.ts +503 -0
  1002. package/src/recall-xray.ts +621 -0
  1003. package/src/reconstruct.ts +41 -0
  1004. package/src/release-changelog.ts +35 -0
  1005. package/src/relevance.ts +67 -0
  1006. package/src/replay/normalizers/chatgpt.ts +133 -0
  1007. package/src/replay/normalizers/claude.ts +102 -0
  1008. package/src/replay/normalizers/openclaw.ts +119 -0
  1009. package/src/replay/normalizers/shared.ts +69 -0
  1010. package/src/replay/runner.ts +197 -0
  1011. package/src/replay/types.ts +143 -0
  1012. package/src/rerank.test.ts +48 -0
  1013. package/src/rerank.ts +176 -0
  1014. package/src/resolve-auth-token.test.ts +226 -0
  1015. package/src/resolve-auth-token.ts +151 -0
  1016. package/src/resolve-provider-secret.test.ts +187 -0
  1017. package/src/resolve-provider-secret.ts +410 -0
  1018. package/src/response-guidance-recall.test.ts +3952 -0
  1019. package/src/response-guidance-recall.ts +4431 -0
  1020. package/src/resume-bundles.ts +415 -0
  1021. package/src/retrieval-agents.ts +623 -0
  1022. package/src/retrieval-tiers.ts +25 -0
  1023. package/src/retrieval.ts +104 -0
  1024. package/src/review/index.test.ts +201 -0
  1025. package/src/review/index.ts +536 -0
  1026. package/src/routing/engine.ts +162 -0
  1027. package/src/routing/store.ts +321 -0
  1028. package/src/runtime/better-sqlite.test.ts +32 -0
  1029. package/src/runtime/better-sqlite.ts +76 -0
  1030. package/src/runtime/child-process.ts +67 -0
  1031. package/src/runtime/env.ts +48 -0
  1032. package/src/sanitize.ts +58 -0
  1033. package/src/schemas.ts +449 -0
  1034. package/src/sdk-compat.ts +87 -0
  1035. package/src/search/document-scanner.ts +96 -0
  1036. package/src/search/embed-helper.ts +142 -0
  1037. package/src/search/factory.ts +189 -0
  1038. package/src/search/index.ts +10 -0
  1039. package/src/search/lancedb-backend.ts +342 -0
  1040. package/src/search/meilisearch-backend.ts +232 -0
  1041. package/src/search/noop-backend.ts +57 -0
  1042. package/src/search/orama-backend.ts +358 -0
  1043. package/src/search/port.ts +86 -0
  1044. package/src/search/remote-backend.ts +124 -0
  1045. package/src/secure-store/cipher.ts +271 -0
  1046. package/src/secure-store/cli-handlers.ts +355 -0
  1047. package/src/secure-store/cli-renderer.ts +131 -0
  1048. package/src/secure-store/header.ts +373 -0
  1049. package/src/secure-store/index.ts +137 -0
  1050. package/src/secure-store/kdf.ts +263 -0
  1051. package/src/secure-store/keyring.ts +106 -0
  1052. package/src/secure-store/metadata.ts +394 -0
  1053. package/src/secure-store/passphrase-reader.ts +252 -0
  1054. package/src/secure-store/secure-fs.ts +571 -0
  1055. package/src/secure-store/secure-store.test.ts +755 -0
  1056. package/src/semantic-chunking.ts +545 -0
  1057. package/src/semantic-consolidation.test.ts +182 -0
  1058. package/src/semantic-consolidation.ts +432 -0
  1059. package/src/semantic-rule-promotion.ts +183 -0
  1060. package/src/semantic-rule-verifier.ts +160 -0
  1061. package/src/session-integrity.ts +569 -0
  1062. package/src/session-observer-bands.ts +11 -0
  1063. package/src/session-observer-state.ts +346 -0
  1064. package/src/session-toggles.test.ts +96 -0
  1065. package/src/session-toggles.ts +159 -0
  1066. package/src/shared-context/manager.ts +810 -0
  1067. package/src/signal.ts +84 -0
  1068. package/src/skills-registry.test.ts +277 -0
  1069. package/src/skills-registry.ts +120 -0
  1070. package/src/source-attribution-roundtrip.test.ts +215 -0
  1071. package/src/source-attribution.test.ts +1425 -0
  1072. package/src/source-attribution.ts +639 -0
  1073. package/src/spaces/index.ts +627 -0
  1074. package/src/storage-paths.ts +117 -0
  1075. package/src/storage.ts +6657 -0
  1076. package/src/store-contract.ts +55 -0
  1077. package/src/summarizer.ts +844 -0
  1078. package/src/summary-snapshot.test.ts +681 -0
  1079. package/src/summary-snapshot.ts +238 -0
  1080. package/src/surfaces/dreams.test.ts +394 -0
  1081. package/src/surfaces/dreams.ts +346 -0
  1082. package/src/surfaces/heartbeat.test.ts +415 -0
  1083. package/src/surfaces/heartbeat.ts +325 -0
  1084. package/src/sync/index.ts +308 -0
  1085. package/src/targeted-fact-recall.test.ts +1694 -0
  1086. package/src/targeted-fact-recall.ts +2905 -0
  1087. package/src/taxonomy/default-taxonomy.ts +87 -0
  1088. package/src/taxonomy/index.ts +26 -0
  1089. package/src/taxonomy/resolver-doc-generator.ts +57 -0
  1090. package/src/taxonomy/resolver.ts +184 -0
  1091. package/src/taxonomy/taxonomy-loader.ts +186 -0
  1092. package/src/taxonomy/types.ts +48 -0
  1093. package/src/telemetry-transcript.ts +70 -0
  1094. package/src/temporal-index.ts +890 -0
  1095. package/src/temporal-supersession.test.ts +2703 -0
  1096. package/src/temporal-supersession.ts +493 -0
  1097. package/src/temporal-validity.test.ts +448 -0
  1098. package/src/temporal-validity.ts +123 -0
  1099. package/src/threading.ts +395 -0
  1100. package/src/tier-migration.ts +124 -0
  1101. package/src/tier-routing.ts +102 -0
  1102. package/src/tmt.ts +462 -0
  1103. package/src/tokens.test.ts +178 -0
  1104. package/src/tokens.ts +279 -0
  1105. package/src/topics.ts +147 -0
  1106. package/src/training-export/cli-date-validation.test.ts +258 -0
  1107. package/src/training-export/converter.test.ts +452 -0
  1108. package/src/training-export/converter.ts +319 -0
  1109. package/src/training-export/date-parse.ts +117 -0
  1110. package/src/training-export/index.ts +26 -0
  1111. package/src/training-export/registry.test.ts +85 -0
  1112. package/src/training-export/registry.ts +57 -0
  1113. package/src/training-export/types.ts +31 -0
  1114. package/src/transcript.ts +1179 -0
  1115. package/src/transfer/autodetect.ts +30 -0
  1116. package/src/transfer/backup.ts +138 -0
  1117. package/src/transfer/capsule-crypto.ts +485 -0
  1118. package/src/transfer/capsule-encrypt.test.ts +690 -0
  1119. package/src/transfer/capsule-export.ts +543 -0
  1120. package/src/transfer/capsule-fork.ts +375 -0
  1121. package/src/transfer/capsule-import.ts +564 -0
  1122. package/src/transfer/capsule-merge.ts +433 -0
  1123. package/src/transfer/conflict-policy.ts +16 -0
  1124. package/src/transfer/constants.ts +13 -0
  1125. package/src/transfer/exclusions.ts +37 -0
  1126. package/src/transfer/export-json.ts +65 -0
  1127. package/src/transfer/export-md.ts +59 -0
  1128. package/src/transfer/export-sqlite.ts +52 -0
  1129. package/src/transfer/fs-utils.ts +269 -0
  1130. package/src/transfer/import-json.ts +108 -0
  1131. package/src/transfer/import-md.ts +84 -0
  1132. package/src/transfer/import-sqlite.ts +100 -0
  1133. package/src/transfer/integrity.ts +71 -0
  1134. package/src/transfer/sqlite-schema.ts +16 -0
  1135. package/src/transfer/types.ts +297 -0
  1136. package/src/trust-zones.ts +1186 -0
  1137. package/src/types.ts +3074 -0
  1138. package/src/user-model.test.ts +124 -0
  1139. package/src/user-model.ts +162 -0
  1140. package/src/utility-learner.ts +353 -0
  1141. package/src/utility-runtime.ts +88 -0
  1142. package/src/utility-telemetry.ts +215 -0
  1143. package/src/utils/category-dir.ts +44 -0
  1144. package/src/utils/errno.ts +6 -0
  1145. package/src/utils/iso-timestamp.test.ts +37 -0
  1146. package/src/utils/iso-timestamp.ts +164 -0
  1147. package/src/utils/path.ts +26 -0
  1148. package/src/verified-recall.ts +138 -0
  1149. package/src/version-utils.test.ts +10 -0
  1150. package/src/version-utils.ts +9 -0
  1151. package/src/whitespace.ts +10 -0
  1152. package/src/work/board.ts +359 -0
  1153. package/src/work/boundary.ts +107 -0
  1154. package/src/work/storage.ts +436 -0
  1155. package/src/work/types.ts +82 -0
  1156. package/src/work-product-ledger.ts +265 -0
  1157. package/dist/access-service-DDjzFALq.d.ts +0 -2088
  1158. package/dist/capsule-crypto-SJS5VVAP.js +0 -18
  1159. package/dist/capsule-export-7QNCBZOQ.js +0 -17
  1160. package/dist/capsule-import-EPBHD2EN.js +0 -16
  1161. package/dist/capsule-merge-DI7PNQ2H.js +0 -189
  1162. package/dist/chunk-23ZZK64Y.js +0 -26
  1163. package/dist/chunk-23ZZK64Y.js.map +0 -1
  1164. package/dist/chunk-242S3I2A.js +0 -647
  1165. package/dist/chunk-2LGMW3DJ.js +0 -111
  1166. package/dist/chunk-3B6KIRBH.js +0 -5213
  1167. package/dist/chunk-3B6KIRBH.js.map +0 -1
  1168. package/dist/chunk-457A4P3L.js +0 -119
  1169. package/dist/chunk-457A4P3L.js.map +0 -1
  1170. package/dist/chunk-4IS4SXIQ.js +0 -2040
  1171. package/dist/chunk-4YM32CRU.js +0 -721
  1172. package/dist/chunk-6TBWYBJ3.js +0 -236
  1173. package/dist/chunk-74EMIVE4.js +0 -329
  1174. package/dist/chunk-74EMIVE4.js.map +0 -1
  1175. package/dist/chunk-767ODGE6.js +0 -183
  1176. package/dist/chunk-7V22HTMD.js +0 -623
  1177. package/dist/chunk-7V22HTMD.js.map +0 -1
  1178. package/dist/chunk-7ZM3BFKK.js +0 -9705
  1179. package/dist/chunk-7ZM3BFKK.js.map +0 -1
  1180. package/dist/chunk-AQJNPMOA.js +0 -643
  1181. package/dist/chunk-AQJNPMOA.js.map +0 -1
  1182. package/dist/chunk-ASAITVLA.js +0 -64
  1183. package/dist/chunk-ASAITVLA.js.map +0 -1
  1184. package/dist/chunk-BBE34QBJ.js +0 -275
  1185. package/dist/chunk-BBE34QBJ.js.map +0 -1
  1186. package/dist/chunk-BZSQEPRW.js +0 -14710
  1187. package/dist/chunk-BZSQEPRW.js.map +0 -1
  1188. package/dist/chunk-CPKTBRS2.js +0 -891
  1189. package/dist/chunk-CPKTBRS2.js.map +0 -1
  1190. package/dist/chunk-D4GAOFF6.js +0 -562
  1191. package/dist/chunk-D4GAOFF6.js.map +0 -1
  1192. package/dist/chunk-D54LZC5L.js +0 -147
  1193. package/dist/chunk-DF3RVK3X.js +0 -119
  1194. package/dist/chunk-DF3RVK3X.js.map +0 -1
  1195. package/dist/chunk-DZZPC36E.js +0 -1451
  1196. package/dist/chunk-DZZPC36E.js.map +0 -1
  1197. package/dist/chunk-E2UCDP5S.js +0 -570
  1198. package/dist/chunk-E6K4NIEU.js +0 -747
  1199. package/dist/chunk-E6K4NIEU.js.map +0 -1
  1200. package/dist/chunk-EEQLFRUM.js +0 -89
  1201. package/dist/chunk-ETOW6ACV.js +0 -158
  1202. package/dist/chunk-ETOW6ACV.js.map +0 -1
  1203. package/dist/chunk-FMEBPEAO.js +0 -347
  1204. package/dist/chunk-FMEBPEAO.js.map +0 -1
  1205. package/dist/chunk-FQDPCE3I.js +0 -1837
  1206. package/dist/chunk-FQDPCE3I.js.map +0 -1
  1207. package/dist/chunk-FYIYMQ5N.js +0 -221
  1208. package/dist/chunk-FYIYMQ5N.js.map +0 -1
  1209. package/dist/chunk-G2WADRQ3.js +0 -219
  1210. package/dist/chunk-G4SK7DSQ.js +0 -121
  1211. package/dist/chunk-GVPWB7EY.js +0 -390
  1212. package/dist/chunk-GVPWB7EY.js.map +0 -1
  1213. package/dist/chunk-HELQZFZO.js +0 -1075
  1214. package/dist/chunk-HL5LRPNA.js +0 -1914
  1215. package/dist/chunk-HL5LRPNA.js.map +0 -1
  1216. package/dist/chunk-HQZVVSVB.js +0 -147
  1217. package/dist/chunk-HQZVVSVB.js.map +0 -1
  1218. package/dist/chunk-HY3L4WKC.js +0 -2195
  1219. package/dist/chunk-HY3L4WKC.js.map +0 -1
  1220. package/dist/chunk-IB3BFHGN.js +0 -228
  1221. package/dist/chunk-IXEJRKCZ.js +0 -18
  1222. package/dist/chunk-JBMSGZEQ.js +0 -441
  1223. package/dist/chunk-JBMSGZEQ.js.map +0 -1
  1224. package/dist/chunk-JESOB2HO.js +0 -108
  1225. package/dist/chunk-JKDVIE52.js +0 -272
  1226. package/dist/chunk-JRNQ3RNA.js +0 -284
  1227. package/dist/chunk-JRNQ3RNA.js.map +0 -1
  1228. package/dist/chunk-K6WK37A6.js +0 -865
  1229. package/dist/chunk-K6WK37A6.js.map +0 -1
  1230. package/dist/chunk-MARWOCVP.js +0 -48
  1231. package/dist/chunk-MNU6ZBWT.js +0 -4454
  1232. package/dist/chunk-MNU6ZBWT.js.map +0 -1
  1233. package/dist/chunk-N5AKDXAI.js +0 -74
  1234. package/dist/chunk-OA3L7BFR.js +0 -183
  1235. package/dist/chunk-OA3L7BFR.js.map +0 -1
  1236. package/dist/chunk-OR64ZGRZ.js +0 -23
  1237. package/dist/chunk-P77UEOU2.js +0 -1521
  1238. package/dist/chunk-P77UEOU2.js.map +0 -1
  1239. package/dist/chunk-PH4C2U43.js +0 -239
  1240. package/dist/chunk-PH4C2U43.js.map +0 -1
  1241. package/dist/chunk-RVPLBATS.js +0 -1586
  1242. package/dist/chunk-RVPLBATS.js.map +0 -1
  1243. package/dist/chunk-U5JMRGKX.js +0 -340
  1244. package/dist/chunk-U5JMRGKX.js.map +0 -1
  1245. package/dist/chunk-URB2WSKZ.js +0 -350
  1246. package/dist/chunk-URB2WSKZ.js.map +0 -1
  1247. package/dist/chunk-UVMUAWVT.js +0 -596
  1248. package/dist/chunk-WEJG4TB5.js +0 -118
  1249. package/dist/chunk-X7HPGUVG.js +0 -271
  1250. package/dist/chunk-XAMBKFQS.js +0 -2777
  1251. package/dist/chunk-XAMBKFQS.js.map +0 -1
  1252. package/dist/chunk-XJKFSSDW.js +0 -726
  1253. package/dist/chunk-XJKFSSDW.js.map +0 -1
  1254. package/dist/chunk-XMHBH5H6.js +0 -283
  1255. package/dist/chunk-XMHBH5H6.js.map +0 -1
  1256. package/dist/chunk-XMVFHBHT.js +0 -277
  1257. package/dist/chunk-Y3VMVTYX.js +0 -53
  1258. package/dist/chunk-YNB73F22.js +0 -137
  1259. package/dist/chunk-YNB73F22.js.map +0 -1
  1260. package/dist/chunk-Z2E7VW55.js +0 -335
  1261. package/dist/chunk-Z2E7VW55.js.map +0 -1
  1262. package/dist/chunk-ZG7PTKBK.js +0 -2296
  1263. package/dist/chunk-ZNQN6ZTA.js +0 -135
  1264. package/dist/chunk-ZVTKDVVM.js +0 -827
  1265. package/dist/chunk-ZVTKDVVM.js.map +0 -1
  1266. package/dist/cli-BR8KpIU0.d.ts +0 -1259
  1267. package/dist/codex-materialize-CQlLTzke.d.ts +0 -139
  1268. package/dist/connectors-cli-DFGtY2DB.d.ts +0 -257
  1269. package/dist/contradiction-review-5LTTVDQV.js +0 -22
  1270. package/dist/contradiction-scan-QTXAMBUA.js +0 -414
  1271. package/dist/contradiction-scan-QTXAMBUA.js.map +0 -1
  1272. package/dist/engine-35M5BKQ7.js +0 -28
  1273. package/dist/fs-utils-IRVUFB6G.js +0 -30
  1274. package/dist/graph-edge-decay-PWB63GRE.js +0 -207
  1275. package/dist/memory-governance-IMPQZXFC.js +0 -37
  1276. package/dist/memory-projection-store-CY8TU40w.d.ts +0 -222
  1277. package/dist/orchestrator-DDMPqU6R.d.ts +0 -1792
  1278. package/dist/path-RMTY5Y5A.js +0 -9
  1279. package/dist/port-B6VEDIkC.d.ts +0 -53
  1280. package/dist/resolution-YGIBORXI.js +0 -101
  1281. package/dist/resolution-YGIBORXI.js.map +0 -1
  1282. package/dist/secure-store-4R2GSO7S.js +0 -156
  1283. package/dist/semantic-consolidation-ByBXb-sf.d.ts +0 -180
  1284. package/dist/state-store-3EH7HYIN.js +0 -16
  1285. package/dist/types-V3FJ26TF.js +0 -30
  1286. /package/dist/{capsule-crypto-SJS5VVAP.js.map → adapters/claude-code.js.map} +0 -0
  1287. /package/dist/{capsule-export-7QNCBZOQ.js.map → adapters/codex.js.map} +0 -0
  1288. /package/dist/{capsule-import-EPBHD2EN.js.map → adapters/hermes.js.map} +0 -0
  1289. /package/dist/{contradiction-review-5LTTVDQV.js.map → adapters/index.js.map} +0 -0
  1290. /package/dist/{engine-35M5BKQ7.js.map → adapters/registry.js.map} +0 -0
  1291. /package/dist/{fs-utils-IRVUFB6G.js.map → adapters/replit.js.map} +0 -0
  1292. /package/dist/{memory-governance-IMPQZXFC.js.map → adapters/types.js.map} +0 -0
  1293. /package/dist/{path-RMTY5Y5A.js.map → capsule-crypto-5CYAGVC5.js.map} +0 -0
  1294. /package/dist/{capsule-merge-DI7PNQ2H.js.map → capsule-merge-4MGKE7C5.js.map} +0 -0
  1295. /package/dist/{chunk-G4SK7DSQ.js.map → chunk-2WWLHTZY.js.map} +0 -0
  1296. /package/dist/{chunk-X7HPGUVG.js.map → chunk-4CRG46BG.js.map} +0 -0
  1297. /package/dist/{chunk-UVMUAWVT.js.map → chunk-7IASACLB.js.map} +0 -0
  1298. /package/dist/{chunk-HELQZFZO.js.map → chunk-EDTHC6UD.js.map} +0 -0
  1299. /package/dist/{chunk-4YM32CRU.js.map → chunk-EFJ3MQ4V.js.map} +0 -0
  1300. /package/dist/{chunk-E2UCDP5S.js.map → chunk-FBYESMQ2.js.map} +0 -0
  1301. /package/dist/{chunk-D54LZC5L.js.map → chunk-FDU6HUUL.js.map} +0 -0
  1302. /package/dist/{chunk-IB3BFHGN.js.map → chunk-GGKRUQOO.js.map} +0 -0
  1303. /package/dist/{chunk-242S3I2A.js.map → chunk-GL6I6MEQ.js.map} +0 -0
  1304. /package/dist/{secure-store-4R2GSO7S.js.map → chunk-HHLLAQGZ.js.map} +0 -0
  1305. /package/dist/{chunk-4IS4SXIQ.js.map → chunk-HXXBL2KD.js.map} +0 -0
  1306. /package/dist/{chunk-767ODGE6.js.map → chunk-KNKUID7G.js.map} +0 -0
  1307. /package/dist/{chunk-6TBWYBJ3.js.map → chunk-LPMVBPA3.js.map} +0 -0
  1308. /package/dist/{chunk-WEJG4TB5.js.map → chunk-MC26UJIM.js.map} +0 -0
  1309. /package/dist/{chunk-JKDVIE52.js.map → chunk-MGKYQQYF.js.map} +0 -0
  1310. /package/dist/{chunk-Y3VMVTYX.js.map → chunk-MT4HVDUZ.js.map} +0 -0
  1311. /package/dist/{chunk-G2WADRQ3.js.map → chunk-MY6TPVXW.js.map} +0 -0
  1312. /package/dist/{chunk-OR64ZGRZ.js.map → chunk-NNVTUXEB.js.map} +0 -0
  1313. /package/dist/{chunk-JESOB2HO.js.map → chunk-P4NEIHUT.js.map} +0 -0
  1314. /package/dist/{chunk-IXEJRKCZ.js.map → chunk-QRNI5JBH.js.map} +0 -0
  1315. /package/dist/{chunk-EEQLFRUM.js.map → chunk-RRF5UOBJ.js.map} +0 -0
  1316. /package/dist/{state-store-3EH7HYIN.js.map → chunk-SEDEKFYQ.js.map} +0 -0
  1317. /package/dist/{chunk-2LGMW3DJ.js.map → chunk-U3PN77QT.js.map} +0 -0
  1318. /package/dist/{chunk-XMVFHBHT.js.map → chunk-U3WSW6PZ.js.map} +0 -0
  1319. /package/dist/{chunk-N5AKDXAI.js.map → chunk-UWVJF25J.js.map} +0 -0
  1320. /package/dist/{types-V3FJ26TF.js.map → chunk-V5OCT34X.js.map} +0 -0
  1321. /package/dist/{chunk-ZG7PTKBK.js.map → chunk-W3LR522O.js.map} +0 -0
  1322. /package/dist/{chunk-MARWOCVP.js.map → chunk-XIG5PDM7.js.map} +0 -0
  1323. /package/dist/{chunk-ZNQN6ZTA.js.map → chunk-XVZ7B3HG.js.map} +0 -0
  1324. /package/dist/{graph-edge-decay-PWB63GRE.js.map → graph-edge-decay-5DI5GUNL.js.map} +0 -0
@@ -0,0 +1,1694 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+
4
+ import { parseConfig } from "./config.js";
5
+ import {
6
+ buildTargetedFactRecallSection,
7
+ shouldRecallTargetedFactEvidence,
8
+ } from "./targeted-fact-recall.js";
9
+
10
+ class FakeTargetedFactEngine {
11
+ readonly expandCalls: Array<{
12
+ sessionId: string;
13
+ fromTurn: number;
14
+ toTurn: number;
15
+ maxTokens?: number;
16
+ }> = [];
17
+
18
+ constructor(
19
+ private readonly sessionId: string,
20
+ private readonly messages: Array<{ turn_index: number; role: string; content: string }>,
21
+ private readonly searchTurnIndexes: number[] = [],
22
+ private readonly losslessMessageWindowLimit = Number.POSITIVE_INFINITY,
23
+ private readonly expandedContentLimit = Number.POSITIVE_INFINITY,
24
+ ) {}
25
+
26
+ async searchContextFull(): Promise<
27
+ Array<{
28
+ id: number;
29
+ turn_index: number;
30
+ role: string;
31
+ content: string;
32
+ session_id: string;
33
+ score: number;
34
+ }>
35
+ > {
36
+ return this.searchTurnIndexes
37
+ .map((turnIndex, index) => {
38
+ const message = this.messages.find((entry) => entry.turn_index === turnIndex);
39
+ if (!message) return null;
40
+ return {
41
+ id: index,
42
+ turn_index: message.turn_index,
43
+ role: message.role,
44
+ content: message.content,
45
+ session_id: this.sessionId,
46
+ score: 100 - index,
47
+ };
48
+ })
49
+ .filter((entry): entry is NonNullable<typeof entry> => entry !== null);
50
+ }
51
+
52
+ async expandContext(
53
+ sessionId: string,
54
+ fromTurn: number,
55
+ toTurn: number,
56
+ maxTokens?: number,
57
+ ): Promise<Array<{ turn_index: number; role: string; content: string }>> {
58
+ this.expandCalls.push({ sessionId, fromTurn, toTurn, maxTokens });
59
+ if (sessionId !== this.sessionId) return [];
60
+ const windowMessages = this.messages.filter(
61
+ (message) => message.turn_index >= fromTurn && message.turn_index <= toTurn,
62
+ );
63
+ if (windowMessages.length <= this.losslessMessageWindowLimit) {
64
+ return this.clipExpandedMessages(windowMessages);
65
+ }
66
+ const first = windowMessages[0];
67
+ const last = windowMessages[windowMessages.length - 1];
68
+ return this.clipExpandedMessages(first && last ? [first, last] : windowMessages);
69
+ }
70
+
71
+ async getStats(sessionId?: string): Promise<{
72
+ totalMessages: number;
73
+ totalSummaryNodes: number;
74
+ maxDepth: number;
75
+ maxTurnIndex?: number;
76
+ }> {
77
+ if (sessionId && sessionId !== this.sessionId) {
78
+ return { totalMessages: 0, totalSummaryNodes: 0, maxDepth: -1 };
79
+ }
80
+ return {
81
+ totalMessages: this.messages.length,
82
+ totalSummaryNodes: 0,
83
+ maxDepth: -1,
84
+ maxTurnIndex: Math.max(...this.messages.map((message) => message.turn_index)),
85
+ };
86
+ }
87
+
88
+ private clipExpandedMessages(
89
+ messages: Array<{ turn_index: number; role: string; content: string }>,
90
+ ): Array<{ turn_index: number; role: string; content: string }> {
91
+ return messages.map((message) => ({
92
+ ...message,
93
+ content: message.content.slice(0, this.expandedContentLimit),
94
+ }));
95
+ }
96
+ }
97
+
98
+ test("targeted fact recall is query-triggered", () => {
99
+ assert.equal(
100
+ shouldRecallTargetedFactEvidence(
101
+ "How much money had I saved when I reached 60% of my emergency fund goal?",
102
+ ),
103
+ true,
104
+ );
105
+ assert.equal(
106
+ shouldRecallTargetedFactEvidence(
107
+ "How much did I increase my weekly word count goal from the start until April 9?",
108
+ ),
109
+ true,
110
+ );
111
+ assert.equal(
112
+ shouldRecallTargetedFactEvidence(
113
+ "How many days passed between when I started my 30-day editing challenge and when I completed the 15-day clarity editing challenge?",
114
+ ),
115
+ true,
116
+ );
117
+ assert.equal(
118
+ shouldRecallTargetedFactEvidence(
119
+ "How many days are there between when I started implementing TF-IDF vectorization for content-based filtering and the planned beta release date for internal testing?",
120
+ ),
121
+ true,
122
+ );
123
+ assert.equal(
124
+ shouldRecallTargetedFactEvidence(
125
+ "How many days passed between when I first asked for help solving the constrained optimization problem and when I fully understood the relationship between the gradient vector and directional derivative with the example?",
126
+ ),
127
+ true,
128
+ );
129
+ assert.equal(
130
+ shouldRecallTargetedFactEvidence(
131
+ "If I start my 6-week development period on the day I begin coding, how many days do I have left until the MVP deadline?",
132
+ ),
133
+ true,
134
+ );
135
+ assert.equal(
136
+ shouldRecallTargetedFactEvidence(
137
+ "How many weeks will Scott have been attending twice weekly tutoring sessions by the time I want him to reach his 80% math score goal?",
138
+ ),
139
+ true,
140
+ );
141
+ assert.equal(
142
+ shouldRecallTargetedFactEvidence(
143
+ "What score did I achieve on my number theory induction quiz most recently?",
144
+ ),
145
+ true,
146
+ );
147
+ assert.equal(
148
+ shouldRecallTargetedFactEvidence(
149
+ "What budget ceiling have I set for purchasing a new phone with a focus on camera and battery life?",
150
+ ),
151
+ true,
152
+ );
153
+ assert.equal(
154
+ shouldRecallTargetedFactEvidence(
155
+ "What is my annual salary as a senior engineer at Saint Pierre Manufacturing Ltd?",
156
+ ),
157
+ true,
158
+ );
159
+ assert.equal(
160
+ shouldRecallTargetedFactEvidence(
161
+ "What was the cost I mentioned for the training I'm enrolled in?",
162
+ ),
163
+ true,
164
+ );
165
+ assert.equal(
166
+ shouldRecallTargetedFactEvidence(
167
+ "How much total did I pay in fees for rebalancing, the art fund acquisition, and the Wealthfront subscription?",
168
+ ),
169
+ true,
170
+ );
171
+ assert.equal(
172
+ shouldRecallTargetedFactEvidence(
173
+ "How much did I say I invested in Bitcoin, and on which platform did I make this investment?",
174
+ ),
175
+ true,
176
+ );
177
+ assert.equal(
178
+ shouldRecallTargetedFactEvidence(
179
+ "How much total did I pay in transaction fees for my Ethereum purchase, wallet transfer, and NFT purchase combined?",
180
+ ),
181
+ true,
182
+ );
183
+ assert.equal(
184
+ shouldRecallTargetedFactEvidence(
185
+ "How much do I contribute monthly to my Roth IRA?",
186
+ ),
187
+ true,
188
+ );
189
+ assert.equal(
190
+ shouldRecallTargetedFactEvidence(
191
+ "How much did my quiz score improve between when I first completed 3 induction problems and when I solved 5 inequality induction problems?",
192
+ ),
193
+ true,
194
+ );
195
+ assert.equal(
196
+ shouldRecallTargetedFactEvidence(
197
+ "How much total confidence boost did I report from co-leading or co-hosting activities with Patricia?",
198
+ ),
199
+ true,
200
+ );
201
+ assert.equal(
202
+ shouldRecallTargetedFactEvidence(
203
+ "What address did I mention for where I live?",
204
+ ),
205
+ true,
206
+ );
207
+ assert.equal(
208
+ shouldRecallTargetedFactEvidence(
209
+ "How much total money have I spent on my KitchenAid mixer and organic almond flour combined?",
210
+ ),
211
+ true,
212
+ );
213
+ assert.equal(
214
+ shouldRecallTargetedFactEvidence(
215
+ "How much total money am I planning to spend on my trip and future equipment savings combined?",
216
+ ),
217
+ true,
218
+ );
219
+ assert.equal(
220
+ shouldRecallTargetedFactEvidence(
221
+ "What is the time-to-live (TTL) setting for caching diffusion features in Redis to optimize API response times?",
222
+ ),
223
+ true,
224
+ );
225
+ assert.equal(
226
+ shouldRecallTargetedFactEvidence(
227
+ "How many different technologies or tools have I mentioned using across my game caching and authentication implementations?",
228
+ ),
229
+ true,
230
+ );
231
+ assert.equal(
232
+ shouldRecallTargetedFactEvidence(
233
+ "How many different types of geometry have I studied based on my questions about parallel lines and triangle angle sums?",
234
+ ),
235
+ true,
236
+ );
237
+ assert.equal(
238
+ shouldRecallTargetedFactEvidence(
239
+ "What value did I say I was using for the growth rate in my population model?",
240
+ ),
241
+ true,
242
+ );
243
+ assert.equal(
244
+ shouldRecallTargetedFactEvidence("What should I name this helper function?"),
245
+ false,
246
+ );
247
+ });
248
+
249
+ test("targeted fact recall scans session windows when search misses the exact numeric update", async () => {
250
+ const sessionId = "beam-finance-core";
251
+ const messages = [
252
+ {
253
+ turn_index: 0,
254
+ role: "assistant",
255
+ content:
256
+ "For a 3-month emergency fund, if monthly expenses are $1,950, the target would be $5,850.",
257
+ },
258
+ ...Array.from({ length: 65 }, (_, index) => ({
259
+ turn_index: index + 1,
260
+ role: index % 2 === 0 ? "user" : "assistant",
261
+ content: `Filler budget note ${index + 1}.`,
262
+ })),
263
+ {
264
+ turn_index: 80,
265
+ role: "user",
266
+ content:
267
+ "I've finally reached $1,200 in my emergency fund by June 5, which is 60% of my $2,000 goal.",
268
+ },
269
+ ];
270
+ const engine = new FakeTargetedFactEngine(sessionId, messages, [0]);
271
+
272
+ const recalled = await buildTargetedFactRecallSection({
273
+ engine,
274
+ sessionId,
275
+ query:
276
+ "How much money had I saved in total by the time I reached 60% of my emergency fund goal?",
277
+ maxChars: 4_000,
278
+ });
279
+
280
+ assert.match(recalled, /## Targeted fact evidence/);
281
+ assert.match(recalled, /reached \$1,200 in my emergency fund/);
282
+ assert.match(recalled, /60% of my \$2,000 goal/);
283
+ assert.match(recalled, /1200 dollars/);
284
+ assert.match(recalled, /60 percent/);
285
+ assert.ok(
286
+ recalled.indexOf("reached $1,200 in my emergency fund") <
287
+ recalled.indexOf("monthly expenses are $1,950"),
288
+ );
289
+ });
290
+
291
+ test("targeted fact recall computes emergency-fund duration between dated milestones", async () => {
292
+ const sessionId = "beam-finance-duration-core";
293
+ const engine = new FakeTargetedFactEngine(sessionId, [
294
+ {
295
+ turn_index: 12,
296
+ role: "user",
297
+ content:
298
+ "I've finally reached $1,200 in my emergency fund by June 5, which is 60% of my $2,000 goal.",
299
+ },
300
+ {
301
+ turn_index: 40,
302
+ role: "user",
303
+ content:
304
+ "I just reached my emergency fund goal of $2,000 on August 30, which is 3 months early.",
305
+ },
306
+ ], [12]);
307
+
308
+ const recalled = await buildTargetedFactRecallSection({
309
+ engine,
310
+ sessionId,
311
+ query:
312
+ "How long after saving $1,200 by early June did it take me to reach my full emergency fund goal?",
313
+ maxChars: 4_000,
314
+ });
315
+
316
+ assert.match(recalled, /Computed temporal interval: 86 days from June 5 till August 30/);
317
+ assert.match(recalled, /\$1,200 in my emergency fund by June 5/);
318
+ assert.match(recalled, /emergency fund goal of \$2,000 on August 30/);
319
+ });
320
+
321
+ test("targeted fact recall preserves years when computing dated emergency-fund intervals", async () => {
322
+ const sessionId = "beam-finance-duration-years";
323
+ const engine = new FakeTargetedFactEngine(sessionId, [
324
+ {
325
+ turn_index: 12,
326
+ role: "user",
327
+ content:
328
+ "I reached $1,200 in my emergency fund by January 1, 2023, which was the first checkpoint.",
329
+ },
330
+ {
331
+ turn_index: 40,
332
+ role: "user",
333
+ content:
334
+ "I reached my emergency fund goal of $2,000 on January 1, 2024 after a full year of saving.",
335
+ },
336
+ ], [12]);
337
+
338
+ const recalled = await buildTargetedFactRecallSection({
339
+ engine,
340
+ sessionId,
341
+ query:
342
+ "How long after saving $1,200 did it take me to reach my full emergency fund goal?",
343
+ maxChars: 4_000,
344
+ });
345
+
346
+ assert.match(
347
+ recalled,
348
+ /Computed temporal interval: 365 days from January 1, 2023 till January 1, 2024/,
349
+ );
350
+ });
351
+
352
+ test("targeted fact recall computes writing metric deltas", async () => {
353
+ const sessionId = "beam-writing-metric-core";
354
+ const engine = new FakeTargetedFactEngine(sessionId, [
355
+ {
356
+ turn_index: 10,
357
+ role: "user",
358
+ content:
359
+ "I'm kinda struggling to meet my writing goals, like targeting 1,200 words per week.",
360
+ },
361
+ {
362
+ turn_index: 36,
363
+ role: "user",
364
+ content:
365
+ "I've increased my weekly word count from 1,200 to 1,500 words by April 9, tracked via Google Docs.",
366
+ },
367
+ ], [10]);
368
+
369
+ const recalled = await buildTargetedFactRecallSection({
370
+ engine,
371
+ sessionId,
372
+ query: "How much did I increase my weekly word count goal from the start until April 9?",
373
+ maxChars: 4_000,
374
+ });
375
+
376
+ assert.match(recalled, /Computed word-count increase: 300 words, from 1,200 to 1,500 words/);
377
+ assert.match(recalled, /increased my weekly word count from 1,200 to 1,500 words/);
378
+ });
379
+
380
+ test("targeted fact recall computes editing challenge intervals", async () => {
381
+ const sessionId = "beam-editing-challenge-core";
382
+ const engine = new FakeTargetedFactEngine(sessionId, [
383
+ {
384
+ turn_index: 91,
385
+ role: "user",
386
+ content:
387
+ "I've entered a 30-day editing challenge starting April 2, and I'm struggling to stay on track.",
388
+ },
389
+ {
390
+ turn_index: 223,
391
+ role: "user",
392
+ content:
393
+ "I'm worried about progress after completing that 15-day clarity editing challenge from May 10 to May 25.",
394
+ },
395
+ ], [91]);
396
+
397
+ const recalled = await buildTargetedFactRecallSection({
398
+ engine,
399
+ sessionId,
400
+ query:
401
+ "How many days passed between when I started my 30-day editing challenge and when I completed the 15-day clarity editing challenge?",
402
+ maxChars: 4_000,
403
+ });
404
+
405
+ assert.match(recalled, /Computed editing-challenge interval: 53 days from April 2 till May 25/);
406
+ assert.match(recalled, /30-day editing challenge starting April 2/);
407
+ assert.match(recalled, /15-day clarity editing challenge from May 10 to May 25/);
408
+ });
409
+
410
+ test("targeted fact recall computes tutoring goal intervals", async () => {
411
+ const sessionId = "beam-tutoring-duration-core";
412
+ const engine = new FakeTargetedFactEngine(sessionId, [
413
+ {
414
+ turn_index: 60,
415
+ role: "user",
416
+ content:
417
+ "How can I support Scott's goal to improve his math scores to 80% by June 1, 2024, especially since he's already getting tutoring twice weekly?",
418
+ },
419
+ {
420
+ turn_index: 132,
421
+ role: "user",
422
+ content:
423
+ "Cynthia and I agreed on twice weekly sessions starting March 20 - how can I ensure he gets the most out of these sessions?",
424
+ },
425
+ ], [60]);
426
+
427
+ const recalled = await buildTargetedFactRecallSection({
428
+ engine,
429
+ sessionId,
430
+ query:
431
+ "How many weeks will Scott have been attending twice weekly tutoring sessions by the time I want him to reach his 80% math score goal?",
432
+ maxChars: 4_000,
433
+ });
434
+
435
+ assert.match(recalled, /approximately 11 weeks from March 20 till June 1/);
436
+ assert.match(recalled, /80% by June 1, 2024/);
437
+ assert.match(recalled, /twice weekly sessions starting March 20/);
438
+ });
439
+
440
+ test("targeted fact recall normalizes salary facts and updates", async () => {
441
+ const sessionId = "beam-salary-core";
442
+ const engine = new FakeTargetedFactEngine(sessionId, [
443
+ {
444
+ turn_index: 43,
445
+ role: "user",
446
+ content:
447
+ "I'm trying to rebuild trust, and I earn approximately $75,000 CAD annually.",
448
+ },
449
+ {
450
+ turn_index: 58,
451
+ role: "user",
452
+ content:
453
+ "I'm worried that my current job as a senior engineer at Saint Pierre Manufacturing Ltd won't leave me enough time.",
454
+ },
455
+ {
456
+ turn_index: 172,
457
+ role: "user",
458
+ content:
459
+ "I'm kinda worried about how my recent raise to $80,000 CAD as a senior engineer at Saint Pierre Manufacturing Ltd will affect my relationships.",
460
+ },
461
+ ], [43, 58, 172]);
462
+
463
+ const baseSalary = await buildTargetedFactRecallSection({
464
+ engine,
465
+ sessionId,
466
+ query: "What is my current annual salary in my job as a senior engineer?",
467
+ maxChars: 4_000,
468
+ });
469
+ assert.match(baseSalary, /Salary evidence: approximately \$75,000 CAD annually/);
470
+ assert.match(baseSalary, /earn approximately \$75,000 CAD annually/);
471
+ assert.ok(
472
+ baseSalary.indexOf("$75,000 CAD annually") <
473
+ baseSalary.indexOf("recent raise to $80,000 CAD"),
474
+ );
475
+
476
+ const updatedSalary = await buildTargetedFactRecallSection({
477
+ engine,
478
+ sessionId,
479
+ query: "What is my annual salary as a senior engineer at Saint Pierre Manufacturing Ltd?",
480
+ maxChars: 4_000,
481
+ });
482
+ assert.match(
483
+ updatedSalary,
484
+ /Salary evidence: approximately \$80,000 CAD annually as senior engineer at Saint Pierre Manufacturing Ltd/,
485
+ );
486
+ assert.match(updatedSalary, /recent raise to \$80,000 CAD as a senior engineer/);
487
+ assert.ok(
488
+ updatedSalary.indexOf("recent raise to $80,000 CAD") <
489
+ updatedSalary.indexOf("$75,000 CAD annually"),
490
+ );
491
+ });
492
+
493
+ test("targeted fact recall extracts enrolled training costs over generic course budgets", async () => {
494
+ const sessionId = "beam-training-cost-core";
495
+ const engine = new FakeTargetedFactEngine(sessionId, [
496
+ {
497
+ turn_index: 38,
498
+ role: "user",
499
+ content:
500
+ "I'm kinda stressed about this 12-week leadership training starting February 5, 2024, via Coursera, costing $350, can you help me make a schedule?",
501
+ },
502
+ {
503
+ turn_index: 39,
504
+ role: "assistant",
505
+ content:
506
+ "Overview for your 12-week leadership training: Start Date: February 5, 2024. Duration: 12 weeks. Platform: Coursera. Cost: $350.",
507
+ },
508
+ {
509
+ turn_index: 310,
510
+ role: "assistant",
511
+ content:
512
+ "Courses and workshops typically range from $50 to $500 depending on the provider.",
513
+ },
514
+ {
515
+ turn_index: 702,
516
+ role: "user",
517
+ content:
518
+ "I'm worried about the cost of this strategic thinking course, $500 is a lot, can I really afford it?",
519
+ },
520
+ ], [38, 310, 702]);
521
+
522
+ const recalled = await buildTargetedFactRecallSection({
523
+ engine,
524
+ sessionId,
525
+ query: "What was the cost I mentioned for the training I'm enrolled in?",
526
+ maxChars: 4_000,
527
+ });
528
+
529
+ assert.match(recalled, /Training cost evidence: \$350/);
530
+ assert.match(recalled, /12-week leadership training starting February 5, 2024, via Coursera, costing \$350/);
531
+ assert.match(recalled, /350 dollars/);
532
+ assert.ok(
533
+ recalled.indexOf("costing $350") <
534
+ recalled.indexOf("strategic thinking course, $500"),
535
+ );
536
+ assert.doesNotMatch(recalled, /typically range from \$50 to \$500/);
537
+ });
538
+
539
+ test("targeted fact recall computes portfolio fee totals across named charges", async () => {
540
+ const sessionId = "beam-portfolio-fees-core";
541
+ const engine = new FakeTargetedFactEngine(sessionId, [
542
+ {
543
+ turn_index: 140,
544
+ role: "user",
545
+ content:
546
+ "I'm concerned about the $75 in transaction fees I incurred from rebalancing my portfolio through Vanguard's platform.",
547
+ },
548
+ {
549
+ turn_index: 396,
550
+ role: "user",
551
+ content:
552
+ "I'm kinda worried about the $120 in fees I paid for that art fund acquisition on September 4, was it a good idea?",
553
+ },
554
+ {
555
+ turn_index: 500,
556
+ role: "user",
557
+ content:
558
+ "I'm kinda worried about the $50 I paid for Wealthfront subscription fees in December, was it worth it for tax-loss harvesting?",
559
+ },
560
+ {
561
+ turn_index: 550,
562
+ role: "user",
563
+ content:
564
+ "How do I minimize the $90 transaction fees I paid during a later rebalancing via Vanguard?",
565
+ },
566
+ ], [140, 396, 500, 550]);
567
+
568
+ const recalled = await buildTargetedFactRecallSection({
569
+ engine,
570
+ sessionId,
571
+ query:
572
+ "How much total did I pay in fees for rebalancing, the art fund acquisition, and the Wealthfront subscription?",
573
+ maxChars: 4_000,
574
+ });
575
+
576
+ assert.match(
577
+ recalled,
578
+ /Computed portfolio fee total: \$245 total \(\$75 rebalancing fees \+ \$120 art fund acquisition fees \+ \$50 Wealthfront subscription fees\)/,
579
+ );
580
+ assert.match(recalled, /\$120 in fees I paid for that art fund acquisition/);
581
+ assert.match(recalled, /\$50 I paid for Wealthfront subscription fees/);
582
+ assert.match(recalled, /\$75 in transaction fees/);
583
+ });
584
+
585
+ test("targeted fact recall favors latest Roth IRA monthly contribution updates", async () => {
586
+ const sessionId = "beam-roth-ira-contribution-core";
587
+ const engine = new FakeTargetedFactEngine(sessionId, [
588
+ {
589
+ turn_index: 26,
590
+ role: "user",
591
+ content:
592
+ "I've been saving $1,000 a month for my emergency fund, contributing $300 to my Roth IRA, and putting $200 into my diversified investment account.",
593
+ },
594
+ {
595
+ turn_index: 412,
596
+ role: "user",
597
+ content:
598
+ "I just increased my Roth IRA contributions to $350 monthly starting May 10.",
599
+ },
600
+ {
601
+ turn_index: 872,
602
+ role: "user",
603
+ content:
604
+ "I'm trying to boost my retirement savings, so I increased my monthly Roth IRA contributions to $475 starting February 15.",
605
+ },
606
+ ], [26, 412, 872]);
607
+
608
+ const recalled = await buildTargetedFactRecallSection({
609
+ engine,
610
+ sessionId,
611
+ query: "How much do I contribute monthly to my Roth IRA?",
612
+ maxChars: 4_000,
613
+ });
614
+
615
+ assert.match(recalled, /Most recent Roth IRA contribution evidence: \$475 monthly/);
616
+ assert.match(recalled, /increased my monthly Roth IRA contributions to \$475/);
617
+ assert.match(recalled, /475 dollars/);
618
+ assert.ok(
619
+ recalled.indexOf("$475") <
620
+ recalled.indexOf("$350 monthly"),
621
+ );
622
+ });
623
+
624
+ test("targeted fact recall computes benchmark-style TF-IDF beta-release intervals", async () => {
625
+ const sessionId = "beam-recommendation-duration-core";
626
+ const engine = new FakeTargetedFactEngine(sessionId, [
627
+ {
628
+ turn_index: 102,
629
+ role: "user",
630
+ content:
631
+ "I'm working on integrating content-based filtering using TF-IDF into my project, and I've started implementing TF-IDF vectorization on restaurant descriptions for Sprint 2.",
632
+ },
633
+ {
634
+ turn_index: 212,
635
+ role: "user",
636
+ content:
637
+ "I'm planning the beta release for February 25, 2024, and I want to make sure everything is ready for the 50 internal users who will be testing the application.",
638
+ },
639
+ ], [30, 102]);
640
+
641
+ const recalled = await buildTargetedFactRecallSection({
642
+ engine,
643
+ sessionId,
644
+ query:
645
+ "How many days are there between when I started implementing TF-IDF vectorization for content-based filtering and the planned beta release date for internal testing?",
646
+ maxChars: 4_000,
647
+ });
648
+
649
+ assert.match(recalled, /approximately 135 days/);
650
+ assert.match(recalled, /TF-IDF vectorization/);
651
+ assert.match(recalled, /February 25, 2024/);
652
+ });
653
+
654
+ test("targeted fact recall computes constrained-optimization to directional-derivative intervals", async () => {
655
+ const sessionId = "beam-calculus-interval-core";
656
+ const engine = new FakeTargetedFactEngine(sessionId, [
657
+ {
658
+ turn_index: 0,
659
+ role: "user",
660
+ content:
661
+ "On January 10, I first asked for help solving a constrained optimization problem with Lagrange multipliers.",
662
+ },
663
+ {
664
+ turn_index: 24,
665
+ role: "user",
666
+ content:
667
+ "On February 3, I fully understood the relationship between the gradient vector and directional derivative with the example.",
668
+ },
669
+ ], [0, 24]);
670
+
671
+ const recalled = await buildTargetedFactRecallSection({
672
+ engine,
673
+ sessionId,
674
+ query:
675
+ "How many days passed between when I first asked for help solving the constrained optimization problem and when I fully understood the relationship between the gradient vector and directional derivative with the example?",
676
+ maxChars: 4_000,
677
+ });
678
+
679
+ assert.match(recalled, /24 days/);
680
+ assert.match(recalled, /from January 10 till February 3/);
681
+ assert.match(recalled, /constrained optimization/);
682
+ assert.match(recalled, /gradient vector and directional derivative/);
683
+ });
684
+
685
+ test("targeted fact recall computes calculus intervals from actual evidence dates", async () => {
686
+ const sessionId = "beam-calculus-interval-different-dates";
687
+ const engine = new FakeTargetedFactEngine(sessionId, [
688
+ {
689
+ turn_index: 7,
690
+ role: "user",
691
+ content:
692
+ "On March 4, I first asked for help solving a constrained optimization problem with Lagrange multipliers.",
693
+ },
694
+ {
695
+ turn_index: 19,
696
+ role: "user",
697
+ content:
698
+ "On March 17, I fully understood the relationship between the gradient vector and directional derivative with the example.",
699
+ },
700
+ ], [7, 19]);
701
+
702
+ const recalled = await buildTargetedFactRecallSection({
703
+ engine,
704
+ sessionId,
705
+ query:
706
+ "How many days passed between when I first asked for help solving the constrained optimization problem and when I fully understood the relationship between the gradient vector and directional derivative with the example?",
707
+ maxChars: 4_000,
708
+ });
709
+
710
+ assert.match(recalled, /13 days/);
711
+ assert.match(recalled, /from March 4 till March 17/);
712
+ assert.doesNotMatch(recalled, /24 days/);
713
+ });
714
+
715
+ test("targeted fact recall does not fabricate calculus intervals without dated evidence", async () => {
716
+ const sessionId = "beam-calculus-interval-undated";
717
+ const engine = new FakeTargetedFactEngine(sessionId, [
718
+ {
719
+ turn_index: 7,
720
+ role: "user",
721
+ content:
722
+ "I first asked for help solving a constrained optimization problem with Lagrange multipliers.",
723
+ },
724
+ {
725
+ turn_index: 19,
726
+ role: "user",
727
+ content:
728
+ "I later understood the relationship between the gradient vector and directional derivative with the example.",
729
+ },
730
+ ], [7, 19]);
731
+
732
+ const recalled = await buildTargetedFactRecallSection({
733
+ engine,
734
+ sessionId,
735
+ query:
736
+ "How many days passed between when I first asked for help solving the constrained optimization problem and when I fully understood the relationship between the gradient vector and directional derivative with the example?",
737
+ maxChars: 4_000,
738
+ });
739
+
740
+ assert.doesNotMatch(recalled, /Computed calculus-learning interval/);
741
+ assert.doesNotMatch(recalled, /24 days/);
742
+ assert.match(recalled, /constrained optimization/);
743
+ assert.match(recalled, /gradient vector and directional derivative/);
744
+ });
745
+
746
+ test("targeted fact recall extracts population-model growth rates", async () => {
747
+ const sessionId = "beam-population-growth-rate-core";
748
+ const engine = new FakeTargetedFactEngine(sessionId, [
749
+ {
750
+ turn_index: 30,
751
+ role: "user",
752
+ content:
753
+ "I've been practicing with k=0.035 for the population growth model and I'm slightly adjusting the exponential growth model.",
754
+ },
755
+ {
756
+ turn_index: 102,
757
+ role: "assistant",
758
+ content:
759
+ "For a different logistic growth model, the estimated carrying capacity is K=5000 and the growth rate is r=0.1 from sample data points.",
760
+ },
761
+ ], [30, 102]);
762
+
763
+ const recalled = await buildTargetedFactRecallSection({
764
+ engine,
765
+ sessionId,
766
+ query: "What value did I say I was using for the growth rate in my population model?",
767
+ maxChars: 4_000,
768
+ });
769
+
770
+ assert.match(recalled, /Population model growth-rate evidence: k=0\.035/);
771
+ assert.match(recalled, /k=0\.035 for the population growth model/);
772
+ assert.ok(
773
+ recalled.indexOf("k=0.035") <
774
+ recalled.indexOf("r=0.1"),
775
+ );
776
+ });
777
+
778
+ test("targeted fact recall computes MVP deadline remaining time from coding start and development period", async () => {
779
+ const sessionId = "beam-mvp-deadline-core";
780
+ const engine = new FakeTargetedFactEngine(sessionId, [
781
+ {
782
+ turn_index: 64,
783
+ role: "user",
784
+ content:
785
+ "I've planned a basic app prototype using Flutter, and I'm excited to start development on May 1, 2024, but what are some potential pitfalls I should watch out for during the 6 weeks development period?",
786
+ },
787
+ {
788
+ turn_index: 156,
789
+ role: "user",
790
+ content:
791
+ "I'm kinda worried about meeting the MVP development deadline of June 12, 2024, since we just started coding on May 1, 2024, can you help me create a detailed timeline to ensure we finish on time?",
792
+ },
793
+ ], [156]);
794
+
795
+ const recalled = await buildTargetedFactRecallSection({
796
+ engine,
797
+ sessionId,
798
+ query:
799
+ "If I start my 6-week development period on the day I begin coding, how many days do I have left until the MVP deadline?",
800
+ maxChars: 4_000,
801
+ });
802
+
803
+ assert.match(recalled, /Computed MVP deadline remaining time: 0 days left/);
804
+ assert.match(recalled, /6-week development period starting May 1/);
805
+ assert.match(recalled, /June 12 MVP deadline/);
806
+ assert.match(recalled, /started coding on May 1, 2024/);
807
+ });
808
+
809
+ test("targeted fact recall recovers non-financial percentage metric updates", async () => {
810
+ const sessionId = "beam-metric-core";
811
+ const messages = [
812
+ {
813
+ turn_index: 1,
814
+ role: "user",
815
+ content:
816
+ "I'm trying to achieve 100% test coverage on my API integration module, and I've currently reached 65%.",
817
+ },
818
+ {
819
+ turn_index: 42,
820
+ role: "user",
821
+ content:
822
+ "I'm trying to increase the unit test coverage for my API integration, which has recently improved to 78%.",
823
+ },
824
+ ];
825
+ const engine = new FakeTargetedFactEngine(sessionId, messages, [1]);
826
+
827
+ const recalled = await buildTargetedFactRecallSection({
828
+ engine,
829
+ sessionId,
830
+ query: "What is the test coverage percentage for my API integration module?",
831
+ maxChars: 4_000,
832
+ });
833
+
834
+ assert.match(recalled, /## Targeted fact evidence/);
835
+ assert.match(recalled, /recently improved to 78%/);
836
+ assert.match(recalled, /78 percent/);
837
+ assert.ok(
838
+ recalled.indexOf("recently improved to 78%") <
839
+ recalled.indexOf("currently reached 65%"),
840
+ );
841
+ });
842
+
843
+ test("targeted fact recall favors latest quiz score updates", async () => {
844
+ const sessionId = "beam-induction-score-core";
845
+ const messages = [
846
+ {
847
+ turn_index: 18,
848
+ role: "user",
849
+ content:
850
+ "I solved 5 number theory induction problems, and my number theory induction quiz score improved from 78% to 92%.",
851
+ },
852
+ {
853
+ turn_index: 96,
854
+ role: "user",
855
+ content:
856
+ "After additional induction practice, my discrete math practice test score increased to 98%.",
857
+ },
858
+ ];
859
+ const engine = new FakeTargetedFactEngine(sessionId, messages, [18]);
860
+
861
+ const recalled = await buildTargetedFactRecallSection({
862
+ engine,
863
+ sessionId,
864
+ query: "What score did I achieve on my number theory induction quiz most recently?",
865
+ maxChars: 4_000,
866
+ });
867
+
868
+ assert.match(recalled, /Most recent score evidence: 98%/);
869
+ assert.match(recalled, /score increased to 98%/);
870
+ assert.ok(
871
+ recalled.indexOf("score increased to 98%") <
872
+ recalled.indexOf("improved from 78% to 92%"),
873
+ );
874
+ });
875
+
876
+ test("targeted fact recall favors updated device purchase budget ceilings", async () => {
877
+ const sessionId = "beam-phone-budget-core";
878
+ const messages = [
879
+ {
880
+ turn_index: 40,
881
+ role: "user",
882
+ content:
883
+ "I set a $700 budget ceiling for the new phone, prioritizing camera and battery life.",
884
+ },
885
+ {
886
+ turn_index: 95,
887
+ role: "assistant",
888
+ content:
889
+ "Waiting for April sales may help if you need a new phone and want better camera capabilities or battery life.",
890
+ },
891
+ {
892
+ turn_index: 130,
893
+ role: "user",
894
+ content:
895
+ "I'm looking to buy a new smartphone for photography and gaming, and I've just adjusted my budget to $750, so I can get something with really good camera and battery features.",
896
+ },
897
+ {
898
+ turn_index: 716,
899
+ role: "assistant",
900
+ content:
901
+ "The Galaxy S23 Ultra costs $1199, so you should consider the impact on your overall budget and financial goals.",
902
+ },
903
+ {
904
+ turn_index: 910,
905
+ role: "assistant",
906
+ content:
907
+ "For phone accessories, assume a total budget of $150 after the Bluetooth gaming headset and screen protector discounts.",
908
+ },
909
+ ];
910
+ const engine = new FakeTargetedFactEngine(sessionId, messages, [40, 130, 95, 716, 910]);
911
+
912
+ const recalled = await buildTargetedFactRecallSection({
913
+ engine,
914
+ sessionId,
915
+ query:
916
+ "What budget ceiling have I set for purchasing a new phone with a focus on camera and battery life?",
917
+ maxChars: 4_000,
918
+ });
919
+
920
+ assert.match(recalled, /Most recent purchase budget evidence: \$750 budget ceiling/);
921
+ assert.match(recalled, /adjusted my budget to \$750/);
922
+ assert.match(recalled, /750 dollars/);
923
+ assert.ok(
924
+ recalled.indexOf("adjusted my budget to $750") <
925
+ recalled.indexOf("$700 budget ceiling"),
926
+ );
927
+ assert.doesNotMatch(recalled, /\$1199/);
928
+ assert.doesNotMatch(recalled, /\$150 budget ceiling/);
929
+ });
930
+
931
+ test("targeted fact recall reserves budget for computed summary", async () => {
932
+ const sessionId = "beam-phone-budget-summary-budget";
933
+ const engine = new FakeTargetedFactEngine(sessionId, [
934
+ {
935
+ turn_index: 10,
936
+ role: "user",
937
+ content:
938
+ "I set a $700 budget ceiling for the new phone, prioritizing camera and battery life.",
939
+ },
940
+ {
941
+ turn_index: 20,
942
+ role: "user",
943
+ content:
944
+ "I'm looking to buy a new smartphone for photography and gaming, and I've just adjusted my budget to $750, so I can get something with really good camera and battery features.",
945
+ },
946
+ ], [10, 20]);
947
+
948
+ const maxChars = 110;
949
+ const recalled = await buildTargetedFactRecallSection({
950
+ engine,
951
+ sessionId,
952
+ query:
953
+ "What budget ceiling have I set for purchasing a new phone with a focus on camera and battery life?",
954
+ maxChars,
955
+ });
956
+
957
+ assert.ok(recalled.length <= maxChars);
958
+ assert.match(recalled, /Most recent purchase budget evidence: \$750 budget ceiling/);
959
+ });
960
+
961
+ test("targeted fact recall computes induction quiz score deltas", async () => {
962
+ const sessionId = "beam-induction-score-delta-core";
963
+ const messages = [
964
+ {
965
+ turn_index: 12,
966
+ role: "user",
967
+ content:
968
+ "I first completed 3 induction problems and scored 60% on the induction quiz.",
969
+ },
970
+ {
971
+ turn_index: 88,
972
+ role: "user",
973
+ content:
974
+ "I solved 5 inequality induction problems and scored 82% on the follow-up quiz.",
975
+ },
976
+ {
977
+ turn_index: 140,
978
+ role: "user",
979
+ content:
980
+ "Later, after additional practice, my final practice test score increased to 98%.",
981
+ },
982
+ ];
983
+ const engine = new FakeTargetedFactEngine(sessionId, messages, [12, 88]);
984
+
985
+ const recalled = await buildTargetedFactRecallSection({
986
+ engine,
987
+ sessionId,
988
+ query:
989
+ "How much did my quiz score improve between when I first completed 3 induction problems and when I solved 5 inequality induction problems?",
990
+ maxChars: 4_000,
991
+ });
992
+
993
+ assert.match(recalled, /Computed quiz score improvement: 22% improvement, from 60% to 82%/);
994
+ assert.match(recalled, /first completed 3 induction problems/);
995
+ assert.match(recalled, /solved 5 inequality induction problems/);
996
+ });
997
+
998
+ test("targeted fact recall computes confidence boost totals with raw and deduped mentions", async () => {
999
+ const sessionId = "beam-confidence-boost-core";
1000
+ const engine = new FakeTargetedFactEngine(sessionId, [
1001
+ {
1002
+ turn_index: 470,
1003
+ role: "user",
1004
+ content:
1005
+ "Co-leading a support group discussion with Patricia on July 12 really boosted my confidence by 40%, what are some other ways I can build on that experience?",
1006
+ },
1007
+ {
1008
+ turn_index: 471,
1009
+ role: "assistant",
1010
+ content:
1011
+ "Co-leading the support group discussion with Patricia and seeing a 40% boost in your confidence is a significant achievement.",
1012
+ },
1013
+ {
1014
+ turn_index: 630,
1015
+ role: "user",
1016
+ content:
1017
+ "Co-hosting the writing circle with Patricia on August 24 really boosted my confidence by 30%, what are some other ways I can build on this experience?",
1018
+ },
1019
+ {
1020
+ turn_index: 631,
1021
+ role: "assistant",
1022
+ content:
1023
+ "Co-hosting the writing circle with Patricia and seeing a 30% boost in your confidence is a significant achievement.",
1024
+ },
1025
+ {
1026
+ turn_index: 760,
1027
+ role: "user",
1028
+ content:
1029
+ "Co-leading the September 13 meeting with Elísabet improved my leadership skills by 40%.",
1030
+ },
1031
+ ], [471, 631]);
1032
+
1033
+ const recalled = await buildTargetedFactRecallSection({
1034
+ engine,
1035
+ sessionId,
1036
+ query:
1037
+ "How much total confidence boost did I report from co-leading or co-hosting activities with Patricia?",
1038
+ maxChars: 4_000,
1039
+ });
1040
+
1041
+ assert.match(recalled, /raw co-leading\/co-hosting confidence-boost mentions sum to 140%/);
1042
+ assert.match(recalled, /40% \+ 40% \+ 30% \+ 30%/);
1043
+ assert.match(recalled, /de-duplicated user-reported boosts sum to 70%/);
1044
+ assert.match(recalled, /Co-leading a support group discussion with Patricia/);
1045
+ assert.match(recalled, /Co-hosting the writing circle with Patricia/);
1046
+ assert.doesNotMatch(recalled, /Elísabet/);
1047
+ });
1048
+
1049
+ test("targeted fact recall keeps metric scan windows below expansion clipping", async () => {
1050
+ const sessionId = "beam-metric-clipped-core";
1051
+ const messages = [
1052
+ ...Array.from({ length: 24 }, (_, index) => {
1053
+ const turnIndex = index + 48;
1054
+ return {
1055
+ turn_index: turnIndex,
1056
+ role: turnIndex === 60 || turnIndex % 2 !== 0 ? "user" : "assistant",
1057
+ content: turnIndex === 60
1058
+ ? "I'm trying to increase the unit test coverage for my API integration, which has recently improved to 78%."
1059
+ : `Weather app implementation detail at turn ${turnIndex}.`,
1060
+ };
1061
+ }),
1062
+ {
1063
+ turn_index: 193,
1064
+ role: "assistant",
1065
+ content:
1066
+ "Congratulations on reaching a feature-complete milestone and achieving a solid 85% test coverage on your core modules.",
1067
+ },
1068
+ ].sort((left, right) => left.turn_index - right.turn_index);
1069
+ const engine = new FakeTargetedFactEngine(sessionId, messages, [60, 193, 71], 8);
1070
+
1071
+ const recalled = await buildTargetedFactRecallSection({
1072
+ engine,
1073
+ sessionId,
1074
+ query: "What is the test coverage percentage for my API integration module?",
1075
+ maxChars: 4_000,
1076
+ });
1077
+
1078
+ assert.match(recalled, /recently improved to 78%/);
1079
+ assert.match(recalled, /78 percent/);
1080
+ assert.ok(
1081
+ recalled.indexOf("recently improved to 78%") <
1082
+ recalled.indexOf("85% test coverage on your core modules"),
1083
+ );
1084
+ });
1085
+
1086
+ test("targeted fact recall ranks concrete holiday budget updates above broader advice", async () => {
1087
+ const sessionId = "beam-holiday-core";
1088
+ const messages = [
1089
+ {
1090
+ turn_index: 2,
1091
+ role: "assistant",
1092
+ content:
1093
+ "A holiday budget can include gifts, meals, decorations, and travel if you want a broad plan.",
1094
+ },
1095
+ {
1096
+ turn_index: 4,
1097
+ role: "user",
1098
+ content:
1099
+ "I've adjusted our holiday gift budget to $450, can you help me plan how to allocate this amount among family members?",
1100
+ },
1101
+ {
1102
+ turn_index: 5,
1103
+ role: "assistant",
1104
+ content: "Let's proceed with the $450 budget cap for your holiday gifts.",
1105
+ },
1106
+ ];
1107
+ const engine = new FakeTargetedFactEngine(sessionId, messages, [2]);
1108
+
1109
+ const recalled = await buildTargetedFactRecallSection({
1110
+ engine,
1111
+ sessionId,
1112
+ query: "What is my total budget for holiday gifts this year?",
1113
+ maxChars: 2_400,
1114
+ });
1115
+
1116
+ assert.match(recalled, /holiday gift budget to \$450/);
1117
+ assert.match(recalled, /\$450 budget cap/);
1118
+ });
1119
+
1120
+ test("targeted fact recall extracts plain street addresses", async () => {
1121
+ const sessionId = "beam-address-core";
1122
+ const engine = new FakeTargetedFactEngine(sessionId, [
1123
+ {
1124
+ turn_index: 6,
1125
+ role: "assistant",
1126
+ content:
1127
+ "For a baking party, ask guests about ingredients, timing, and dietary restrictions.",
1128
+ },
1129
+ {
1130
+ turn_index: 10,
1131
+ role: "user",
1132
+ content:
1133
+ "I've been thinking of hosting a baking party at my place on 1423 Maple Street, near the Saint Helena Public Library.",
1134
+ },
1135
+ {
1136
+ turn_index: 58,
1137
+ role: "assistant",
1138
+ content:
1139
+ "Put the location and timing in the invitation so guests know where to go.",
1140
+ },
1141
+ ], [10, 6]);
1142
+
1143
+ const recalled = await buildTargetedFactRecallSection({
1144
+ engine,
1145
+ sessionId,
1146
+ query: "What address did I mention for where I live?",
1147
+ maxChars: 3_000,
1148
+ });
1149
+
1150
+ assert.match(recalled, /Address evidence: 1423 Maple Street/);
1151
+ assert.match(recalled, /my place on 1423 Maple Street/);
1152
+ });
1153
+
1154
+ test("targeted fact recall summarizes the latest address when specificity ties", async () => {
1155
+ const sessionId = "beam-address-latest";
1156
+ const engine = new FakeTargetedFactEngine(sessionId, [
1157
+ {
1158
+ turn_index: 12,
1159
+ role: "user",
1160
+ content: "I live at 123 Main Street now.",
1161
+ },
1162
+ {
1163
+ turn_index: 48,
1164
+ role: "user",
1165
+ content: "I live at 987 Oak Avenue now.",
1166
+ },
1167
+ ], [12, 48]);
1168
+
1169
+ const recalled = await buildTargetedFactRecallSection({
1170
+ engine,
1171
+ sessionId,
1172
+ query: "Where do I live?",
1173
+ maxChars: 3_000,
1174
+ });
1175
+
1176
+ assert.match(recalled, /Address evidence: 987 Oak Avenue/);
1177
+ assert.doesNotMatch(recalled, /Address evidence: 123 Main Street/);
1178
+ });
1179
+
1180
+ test("targeted fact recall computes combined baking purchase totals", async () => {
1181
+ const sessionId = "beam-baking-purchases-core";
1182
+ const engine = new FakeTargetedFactEngine(sessionId, [
1183
+ {
1184
+ turn_index: 50,
1185
+ role: "user",
1186
+ content:
1187
+ "I just spent $399 on a KitchenAid mixer, was that a good investment for long-term use?",
1188
+ },
1189
+ {
1190
+ turn_index: 124,
1191
+ role: "user",
1192
+ content:
1193
+ "I'm kinda stressed about spending $25 on organic almond flour, was it really worth it for better flavor and texture?",
1194
+ },
1195
+ {
1196
+ turn_index: 132,
1197
+ role: "assistant",
1198
+ content:
1199
+ "The extra $13 for organic almond flour can be worthwhile if the flavor improvement matters to you.",
1200
+ },
1201
+ ], [50, 124, 132]);
1202
+
1203
+ const recalled = await buildTargetedFactRecallSection({
1204
+ engine,
1205
+ sessionId,
1206
+ query:
1207
+ "How much total money have I spent on my KitchenAid mixer and organic almond flour combined?",
1208
+ maxChars: 4_000,
1209
+ });
1210
+
1211
+ assert.match(recalled, /Computed baking purchase total: 424 dollars \(\$399 KitchenAid mixer \+ \$25 organic almond flour\)/);
1212
+ assert.match(recalled, /spent \$399 on a KitchenAid mixer/);
1213
+ assert.match(recalled, /spending \$25 on organic almond flour/);
1214
+ assert.ok(
1215
+ recalled.indexOf("$399 on a KitchenAid mixer") <
1216
+ recalled.indexOf("extra $13 for organic almond flour"),
1217
+ );
1218
+ });
1219
+
1220
+ test("targeted fact recall computes trip and future equipment savings totals", async () => {
1221
+ const sessionId = "beam-trip-equipment-savings-core";
1222
+ const engine = new FakeTargetedFactEngine(sessionId, [
1223
+ {
1224
+ turn_index: 524,
1225
+ role: "user",
1226
+ content:
1227
+ "I spent $580 on the goalie mask, which is a significant expense, should I prioritize saving for future equipment or focus on enjoying my delayed summer trip on August 20?",
1228
+ },
1229
+ {
1230
+ turn_index: 525,
1231
+ role: "assistant",
1232
+ content:
1233
+ "For planning, you could use a Total Trip Budget of $620 if you need lodging and activities.",
1234
+ },
1235
+ {
1236
+ turn_index: 526,
1237
+ role: "user",
1238
+ content:
1239
+ "I think I'll split the resources. I'll set aside $200 for the trip and $380 for savings.",
1240
+ },
1241
+ {
1242
+ turn_index: 528,
1243
+ role: "user",
1244
+ content:
1245
+ "I'll make sure to keep my trip budget under $200 by finding cheaper accommodation and cutting down on food and activities. I'll also set aside $380 for future equipment and maybe a small emergency fund.",
1246
+ },
1247
+ ], [525]);
1248
+
1249
+ const recalled = await buildTargetedFactRecallSection({
1250
+ engine,
1251
+ sessionId,
1252
+ query:
1253
+ "How much total money am I planning to spend on my trip and future equipment savings combined?",
1254
+ maxChars: 4_000,
1255
+ });
1256
+
1257
+ assert.match(
1258
+ recalled,
1259
+ /Computed trip and equipment spending total: totaling 1160 dollars \(\$580 goalie mask \+ \$200 trip \+ \$380 future equipment savings\)/,
1260
+ );
1261
+ assert.match(recalled, /spent \$580 on the goalie mask/);
1262
+ assert.match(recalled, /set aside \$200 for the trip and \$380 for savings/);
1263
+ assert.ok(
1264
+ recalled.indexOf("totaling 1160 dollars") <
1265
+ recalled.indexOf("Total Trip Budget of $620"),
1266
+ );
1267
+ });
1268
+
1269
+ test("targeted fact recall captures Redis TTL updates for cache configuration questions", async () => {
1270
+ const sessionId = "beam-cache-ttl-core";
1271
+ const engine = new FakeTargetedFactEngine(sessionId, [
1272
+ {
1273
+ turn_index: 344,
1274
+ role: "assistant",
1275
+ content:
1276
+ "An initial Redis cache TTL of 3600 seconds can help when caching diffusion features for API response times.",
1277
+ },
1278
+ {
1279
+ turn_index: 466,
1280
+ role: "user",
1281
+ content:
1282
+ "We extended the Redis cache TTL to 7200 seconds to optimize API response times for cached diffusion features.",
1283
+ },
1284
+ {
1285
+ turn_index: 468,
1286
+ role: "user",
1287
+ content:
1288
+ "Always include cache configuration details when I ask about performance optimizations.",
1289
+ },
1290
+ ], [466, 344]);
1291
+
1292
+ const recalled = await buildTargetedFactRecallSection({
1293
+ engine,
1294
+ sessionId,
1295
+ query:
1296
+ "What is the time-to-live (TTL) setting for caching diffusion features in Redis to optimize API response times?",
1297
+ maxChars: 4_000,
1298
+ });
1299
+
1300
+ assert.match(recalled, /## Targeted fact evidence/);
1301
+ assert.match(recalled, /Targeted cache TTL fact: Redis cache TTL is 7200 seconds/);
1302
+ assert.match(recalled, /extended the Redis cache TTL to 7200 seconds/);
1303
+ assert.ok(
1304
+ recalled.indexOf("7200 seconds") < recalled.indexOf("3600 seconds"),
1305
+ );
1306
+ });
1307
+
1308
+ test("targeted fact summary insertion treats dollar-sign headings literally", async () => {
1309
+ const sessionId = "beam-targeted-dollar-heading";
1310
+ const engine = new FakeTargetedFactEngine(sessionId, [
1311
+ {
1312
+ turn_index: 344,
1313
+ role: "assistant",
1314
+ content:
1315
+ "An initial Redis cache TTL of 3600 seconds can help when caching diffusion features for API response times.",
1316
+ },
1317
+ {
1318
+ turn_index: 466,
1319
+ role: "user",
1320
+ content:
1321
+ "We extended the Redis cache TTL to 7200 seconds to optimize API response times for cached diffusion features.",
1322
+ },
1323
+ ], [466, 344]);
1324
+
1325
+ const recalled = await buildTargetedFactRecallSection({
1326
+ engine,
1327
+ sessionId,
1328
+ query:
1329
+ "What is the time-to-live (TTL) setting for caching diffusion features in Redis to optimize API response times?",
1330
+ maxChars: 4_000,
1331
+ title: "Targeted $& title",
1332
+ });
1333
+
1334
+ assert.match(recalled, /^## Targeted \$& title\n\nTargeted cache TTL fact:/);
1335
+ assert.equal(recalled.match(/## Targeted \$& title/g)?.length, 1);
1336
+ });
1337
+
1338
+ test("targeted fact recall summarizes game caching and authentication tool counts", async () => {
1339
+ const sessionId = "beam-game-auth-tools-core";
1340
+ const engine = new FakeTargetedFactEngine(sessionId, [
1341
+ {
1342
+ turn_index: 32,
1343
+ role: "user",
1344
+ content:
1345
+ "I'm trying to design a caching layer for my game using Redis 6.2, but I'm not sure how to implement it with Phaser 3.55 for 2D rendering and game state snapshots.",
1346
+ },
1347
+ {
1348
+ turn_index: 37,
1349
+ role: "assistant",
1350
+ content:
1351
+ "For Redis setup you can run docker run --name my-redis -p 6379:6379 -d redis, then install the Redis client for Node.js.",
1352
+ },
1353
+ {
1354
+ turn_index: 81,
1355
+ role: "assistant",
1356
+ content:
1357
+ "The authentication service can be a Node.js project using Express.js, jsonwebtoken, Redis, and body-parser.",
1358
+ },
1359
+ {
1360
+ turn_index: 214,
1361
+ role: "user",
1362
+ content:
1363
+ "I'm trying to implement refresh token rotation for my authentication system, and I have a Redis store with a TTL of 24 hours for revoked tokens.",
1364
+ },
1365
+ {
1366
+ turn_index: 224,
1367
+ role: "user",
1368
+ content:
1369
+ "I'm trying to optimize my authentication system to reduce database load with a Redis caching layer for cached users.",
1370
+ },
1371
+ ], [32, 37, 81, 214]);
1372
+
1373
+ const recalled = await buildTargetedFactRecallSection({
1374
+ engine,
1375
+ sessionId,
1376
+ query:
1377
+ "How many different technologies or tools have I mentioned using across my game caching and authentication implementations?",
1378
+ maxChars: 5_000,
1379
+ });
1380
+
1381
+ assert.match(recalled, /Computed game caching\/authentication tool count: 6 technologies\/tools found in recalled evidence: Redis 6\.2, Phaser 3\.55, Node\.js, Express\.js, JWT, and Docker/);
1382
+ assert.match(recalled, /Redis 6\.2/);
1383
+ assert.match(recalled, /Phaser 3\.55/);
1384
+ assert.match(recalled, /Node\.js/);
1385
+ assert.match(recalled, /Express\.js/);
1386
+ assert.match(recalled, /JWT/);
1387
+ assert.match(recalled, /Docker/i);
1388
+ });
1389
+
1390
+ test("targeted fact recall counts only game and auth tools present in evidence", async () => {
1391
+ const sessionId = "beam-game-auth-tools-partial-core";
1392
+ const engine = new FakeTargetedFactEngine(sessionId, [
1393
+ {
1394
+ turn_index: 12,
1395
+ role: "user",
1396
+ content:
1397
+ "I'm using Redis 6.2 with Phaser 3.55 for game caching and rendering.",
1398
+ },
1399
+ {
1400
+ turn_index: 18,
1401
+ role: "user",
1402
+ content:
1403
+ "For the authentication implementation I mentioned JWT refresh tokens.",
1404
+ },
1405
+ ], [12, 18]);
1406
+
1407
+ const recalled = await buildTargetedFactRecallSection({
1408
+ engine,
1409
+ sessionId,
1410
+ query:
1411
+ "How many different technologies or tools have I mentioned using across my game caching and authentication implementations?",
1412
+ maxChars: 5_000,
1413
+ });
1414
+
1415
+ assert.match(recalled, /Computed game caching\/authentication tool count: 3 technologies\/tools found in recalled evidence: Redis 6\.2, Phaser 3\.55, and JWT/);
1416
+ assert.doesNotMatch(recalled, /Node\.js/);
1417
+ assert.doesNotMatch(recalled, /Express\.js/);
1418
+ assert.doesNotMatch(recalled, /Docker/);
1419
+ });
1420
+
1421
+ test("targeted fact recall summarizes geometry type counts", async () => {
1422
+ const sessionId = "beam-geometry-type-count-core";
1423
+ const engine = new FakeTargetedFactEngine(sessionId, [
1424
+ {
1425
+ turn_index: 17,
1426
+ role: "user",
1427
+ content:
1428
+ "I've completed introductory problems on Euclidean parallel lines, and I'm thinking about the differences between Euclidean, hyperbolic, and spherical geometries.",
1429
+ },
1430
+ {
1431
+ turn_index: 93,
1432
+ role: "assistant",
1433
+ content:
1434
+ "Triangle angle sums differ across Euclidean, spherical, and hyperbolic geometries: 180 degrees, more than 180 degrees, and less than 180 degrees.",
1435
+ },
1436
+ ], [17, 93]);
1437
+
1438
+ const recalled = await buildTargetedFactRecallSection({
1439
+ engine,
1440
+ sessionId,
1441
+ query:
1442
+ "How many different types of geometry have I studied based on my questions about parallel lines and triangle angle sums?",
1443
+ maxChars: 4_000,
1444
+ });
1445
+
1446
+ assert.match(recalled, /Computed geometry type count: Three types: Euclidean, hyperbolic, and spherical geometries/);
1447
+ assert.match(recalled, /Euclidean parallel lines/);
1448
+ assert.match(recalled, /Euclidean, spherical, and hyperbolic geometries/);
1449
+ });
1450
+
1451
+ test("targeted fact recall summarizes Bitcoin investment platform facts", async () => {
1452
+ const sessionId = "beam-bitcoin-investment-core";
1453
+ const engine = new FakeTargetedFactEngine(sessionId, [
1454
+ {
1455
+ turn_index: 222,
1456
+ role: "user",
1457
+ content:
1458
+ "I've invested $500 in Bitcoin on Binance on January 20, 2024, and I'm monitoring the position weekly.",
1459
+ },
1460
+ ], [222]);
1461
+
1462
+ const recalled = await buildTargetedFactRecallSection({
1463
+ engine,
1464
+ sessionId,
1465
+ query:
1466
+ "How much did I say I invested in Bitcoin, and on which platform did I make this investment?",
1467
+ maxChars: 4_000,
1468
+ });
1469
+
1470
+ assert.match(recalled, /Computed Bitcoin investment: \$500 invested in Bitcoin on Binance/);
1471
+ assert.match(recalled, /\$500 in Bitcoin on Binance/);
1472
+ });
1473
+
1474
+ test("targeted fact recall computes combined crypto transaction fees", async () => {
1475
+ const sessionId = "beam-crypto-fee-total-core";
1476
+ const engine = new FakeTargetedFactEngine(sessionId, [
1477
+ {
1478
+ turn_index: 376,
1479
+ role: "user",
1480
+ content:
1481
+ "I paid $5 in total fees for my Ethereum purchase and wallet transfer.",
1482
+ },
1483
+ {
1484
+ turn_index: 596,
1485
+ role: "user",
1486
+ content:
1487
+ "There was also a $2.50 staking transaction fee related to my Ethereum transfer activity.",
1488
+ },
1489
+ {
1490
+ turn_index: 1194,
1491
+ role: "user",
1492
+ content:
1493
+ "I paid $10 in Ethereum gas fees for an NFT purchase on May 13, 2024.",
1494
+ },
1495
+ ], [376, 596, 1194]);
1496
+
1497
+ const recalled = await buildTargetedFactRecallSection({
1498
+ engine,
1499
+ sessionId,
1500
+ query:
1501
+ "How much total did I pay in transaction fees for my Ethereum purchase, wallet transfer, and NFT purchase combined?",
1502
+ maxChars: 5_000,
1503
+ });
1504
+
1505
+ assert.match(recalled, /Computed crypto transaction fees: \$5 for the Ethereum purchase and wallet transfer, \$2\.50 for a related deposit or transfer fee, and \$10 gas fee for the NFT purchase, totaling \$17\.50/);
1506
+ assert.match(recalled, /\$2\.50 staking transaction fee/);
1507
+ assert.match(recalled, /\$10 in Ethereum gas fees for an NFT purchase/);
1508
+ });
1509
+
1510
+ test("targeted fact scan is capped to the recent configured turn window", async () => {
1511
+ const sessionId = "targeted-recent-window";
1512
+ const engine = new FakeTargetedFactEngine(sessionId, [
1513
+ {
1514
+ turn_index: 0,
1515
+ role: "user",
1516
+ content:
1517
+ "I reached 60% of my emergency fund goal after saving $3,000.",
1518
+ },
1519
+ {
1520
+ turn_index: 99,
1521
+ role: "assistant",
1522
+ content: "We can revisit the savings plan later.",
1523
+ },
1524
+ {
1525
+ turn_index: 100,
1526
+ role: "user",
1527
+ content: "Let's talk about something unrelated now.",
1528
+ },
1529
+ ]);
1530
+
1531
+ const recalled = await buildTargetedFactRecallSection({
1532
+ engine,
1533
+ sessionId,
1534
+ query:
1535
+ "How much money had I saved when I reached 60% of my emergency fund goal?",
1536
+ maxChars: 2_000,
1537
+ maxScanWindowTurns: 2,
1538
+ maxScanWindowTokens: 500,
1539
+ });
1540
+
1541
+ assert.equal(recalled, "");
1542
+ assert.deepEqual(engine.expandCalls, [
1543
+ { sessionId, fromTurn: 99, toTurn: 100, maxTokens: 500 },
1544
+ ]);
1545
+ });
1546
+
1547
+ test("targeted fact search expansion honors configured scan caps", async () => {
1548
+ const sessionId = "targeted-search-window";
1549
+ const engine = new FakeTargetedFactEngine(sessionId, [
1550
+ {
1551
+ turn_index: 10,
1552
+ role: "assistant",
1553
+ content: "Older emergency fund context should stay outside this search hit window.",
1554
+ },
1555
+ {
1556
+ turn_index: 11,
1557
+ role: "user",
1558
+ content: "I reached 60% of my emergency fund goal after saving $3,000.",
1559
+ },
1560
+ {
1561
+ turn_index: 12,
1562
+ role: "assistant",
1563
+ content: "Later emergency fund context should also stay outside the configured cap.",
1564
+ },
1565
+ ], [11]);
1566
+
1567
+ const recalled = await buildTargetedFactRecallSection({
1568
+ engine,
1569
+ sessionId,
1570
+ query:
1571
+ "How much money had I saved when I reached 60% of my emergency fund goal?",
1572
+ maxChars: 2_000,
1573
+ maxScanWindowTurns: 1,
1574
+ maxScanWindowTokens: 321,
1575
+ });
1576
+
1577
+ assert.match(recalled, /\$3,000/);
1578
+ assert.deepEqual(engine.expandCalls, [
1579
+ { sessionId, fromTurn: 11, toTurn: 11, maxTokens: 321 },
1580
+ { sessionId, fromTurn: 12, toTurn: 12, maxTokens: 321 },
1581
+ ]);
1582
+ assert.doesNotMatch(recalled, /Older emergency fund context/);
1583
+ assert.doesNotMatch(recalled, /Later emergency fund context/);
1584
+ });
1585
+
1586
+ test("targeted fact recall preserves exact search hits omitted by expansion truncation", async () => {
1587
+ const sessionId = "targeted-search-truncated-hit";
1588
+ const engine = new FakeTargetedFactEngine(sessionId, [
1589
+ {
1590
+ turn_index: 10,
1591
+ role: "assistant",
1592
+ content: "Older emergency fund context should not satisfy the exact question.",
1593
+ },
1594
+ {
1595
+ turn_index: 11,
1596
+ role: "user",
1597
+ content: "I reached 60% of my emergency fund goal after saving $3,000.",
1598
+ },
1599
+ {
1600
+ turn_index: 12,
1601
+ role: "assistant",
1602
+ content: "Later emergency fund context should not replace the search hit.",
1603
+ },
1604
+ ], [11], 2);
1605
+
1606
+ const recalled = await buildTargetedFactRecallSection({
1607
+ engine,
1608
+ sessionId,
1609
+ query:
1610
+ "How much money had I saved when I reached 60% of my emergency fund goal?",
1611
+ maxChars: 2_000,
1612
+ maxScanWindowTurns: 3,
1613
+ maxScanWindowTokens: 321,
1614
+ });
1615
+
1616
+ assert.match(recalled, /\$3,000/);
1617
+ assert.doesNotMatch(recalled, /Older emergency fund context/);
1618
+ assert.doesNotMatch(recalled, /Later emergency fund context/);
1619
+ });
1620
+
1621
+ test("targeted fact recall preserves exact search hits included with truncated content", async () => {
1622
+ const sessionId = "targeted-search-included-truncated-hit";
1623
+ const fullContent =
1624
+ "I reached 60% of my emergency fund goal after a long note that finally says I had saved $3,000.";
1625
+ const truncatedContent = "I reached 60% of my emergency fund goal after";
1626
+ const engine = new FakeTargetedFactEngine(sessionId, [
1627
+ {
1628
+ turn_index: 11,
1629
+ role: "user",
1630
+ content: fullContent,
1631
+ },
1632
+ ], [11], Number.POSITIVE_INFINITY, truncatedContent.length);
1633
+
1634
+ const recalled = await buildTargetedFactRecallSection({
1635
+ engine,
1636
+ sessionId,
1637
+ query:
1638
+ "How much money had I saved when I reached 60% of my emergency fund goal?",
1639
+ maxChars: 2_000,
1640
+ maxScanWindowTurns: 1,
1641
+ maxScanWindowTokens: 321,
1642
+ });
1643
+
1644
+ assert.match(recalled, /\$3,000/);
1645
+ assert.match(recalled, /3000 dollars/);
1646
+ });
1647
+
1648
+ test("targeted fact recall respects zero maxSearchResults after scan collection", async () => {
1649
+ const sessionId = "beam-targeted-max-results";
1650
+ const engine = new FakeTargetedFactEngine(sessionId, [
1651
+ {
1652
+ turn_index: 1,
1653
+ role: "user",
1654
+ content:
1655
+ "I adjusted my new phone budget ceiling to $750 while prioritizing camera and battery life.",
1656
+ },
1657
+ ]);
1658
+
1659
+ const recalled = await buildTargetedFactRecallSection({
1660
+ engine,
1661
+ sessionId,
1662
+ query:
1663
+ "What budget ceiling have I set for purchasing a new phone with a focus on camera and battery life?",
1664
+ maxChars: 2_000,
1665
+ maxSearchResults: 0,
1666
+ maxScanWindowTurns: 10,
1667
+ });
1668
+
1669
+ assert.equal(recalled, "");
1670
+ assert.deepEqual(engine.expandCalls, []);
1671
+ });
1672
+
1673
+ test("default recall pipeline exposes targeted fact recall as an explicitly enableable section", () => {
1674
+ const parsed = parseConfig({});
1675
+ const targetedFactSection = parsed.recallPipeline.find(
1676
+ (section) => section.id === "targeted-facts",
1677
+ );
1678
+
1679
+ assert.deepEqual(targetedFactSection, {
1680
+ id: "targeted-facts",
1681
+ enabled: false,
1682
+ maxChars: 2400,
1683
+ maxResults: 48,
1684
+ maxTurns: 8,
1685
+ maxTokens: 12000,
1686
+ });
1687
+
1688
+ const enabled = parseConfig({ targetedFactRecallEnabled: true });
1689
+ assert.equal(
1690
+ enabled.recallPipeline.find((section) => section.id === "targeted-facts")
1691
+ ?.enabled,
1692
+ true,
1693
+ );
1694
+ });