@remnic/core 10.0.168 → 10.0.170

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 (492) hide show
  1. package/dist/access-admin-ops-surface.js +181 -179
  2. package/dist/access-cli.js +181 -179
  3. package/dist/access-cli.js.map +1 -1
  4. package/dist/access-coding-context-resolution.js +11 -11
  5. package/dist/access-extraction-force-flush-preempt.js +181 -179
  6. package/dist/access-extraction-force-flush.js +181 -179
  7. package/dist/access-http-briefing.js +181 -179
  8. package/dist/access-http-query.js +181 -179
  9. package/dist/access-http.js +181 -179
  10. package/dist/access-identity-continuity-surface.js +181 -179
  11. package/dist/access-lcm-surface.js +181 -179
  12. package/dist/access-mcp.js +181 -179
  13. package/dist/access-observe-write-category.js +11 -11
  14. package/dist/access-observe-write-surface.js +181 -179
  15. package/dist/access-offline-manifest.js +9 -9
  16. package/dist/access-operations-batch.js +181 -179
  17. package/dist/access-operations.js +181 -179
  18. package/dist/access-recall-concurrency.js +181 -179
  19. package/dist/access-recall-diagnostics.js +2 -2
  20. package/dist/access-recall-excerpt-attribution.d.ts +19 -0
  21. package/dist/access-recall-excerpt-attribution.d.ts.map +1 -0
  22. package/dist/access-recall-excerpt-attribution.js +8 -0
  23. package/dist/access-recall-response.js +181 -179
  24. package/dist/access-recall-surface.d.ts.map +1 -1
  25. package/dist/access-recall-surface.js +181 -179
  26. package/dist/access-schema.js +10 -10
  27. package/dist/access-service.js +181 -179
  28. package/dist/active-recall.js +30 -29
  29. package/dist/active-recall.js.map +1 -1
  30. package/dist/adapters/index.js +7 -7
  31. package/dist/adapters/registry.js +3 -3
  32. package/dist/{auto-sync-L3M4RKJD.js → auto-sync-ACP5U5A3.js} +3 -3
  33. package/dist/behavior-learner.js +1 -1
  34. package/dist/binary-lifecycle/scanner.d.ts +2 -4
  35. package/dist/binary-lifecycle/scanner.d.ts.map +1 -1
  36. package/dist/briefing.js +19 -19
  37. package/dist/buffer-add-turns-bounded.d.ts +11 -1
  38. package/dist/buffer-add-turns-bounded.d.ts.map +1 -1
  39. package/dist/buffer-add-turns-bounded.js +3 -3
  40. package/dist/buffer-session-cap.d.ts +2 -2
  41. package/dist/buffer-session-cap.d.ts.map +1 -1
  42. package/dist/buffer-session-cap.js +1 -1
  43. package/dist/buffer.d.ts +3 -2
  44. package/dist/buffer.d.ts.map +1 -1
  45. package/dist/buffer.js +13 -13
  46. package/dist/calibration.d.ts +19 -2
  47. package/dist/calibration.d.ts.map +1 -1
  48. package/dist/calibration.js +28 -5
  49. package/dist/calibration.js.map +1 -1
  50. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  51. package/dist/{capsule-merge-VHBRF65A.js → capsule-merge-BADOICNP.js} +2 -2
  52. package/dist/causal-behavior.js +2 -2
  53. package/dist/causal-chain.js +2 -2
  54. package/dist/causal-consolidation.js +23 -23
  55. package/dist/causal-retrieval.js +2 -2
  56. package/dist/causal-trajectory-graph.js +3 -3
  57. package/dist/causal-trajectory.js +1 -1
  58. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  59. package/dist/{chunk-CKELO7Q6.js → chunk-2OAFPBQB.js} +2 -2
  60. package/dist/{chunk-2DL3OFLD.js → chunk-45GEJRIG.js} +2 -2
  61. package/dist/{chunk-5IZL4DCV.js → chunk-4DF5LMBJ.js} +2 -2
  62. package/dist/{chunk-A5UOREWD.js → chunk-4DLGKTM6.js} +2 -2
  63. package/dist/{chunk-WEFFO2MJ.js → chunk-4E2Z44CV.js} +2 -2
  64. package/dist/{chunk-X67XNZ64.js → chunk-4LVQSHHN.js} +14 -14
  65. package/dist/{chunk-RB7NXZ2E.js → chunk-4X7HQKAG.js} +2 -2
  66. package/dist/{chunk-I74SUMNI.js → chunk-5ACIRCBO.js} +65 -3
  67. package/dist/chunk-5ACIRCBO.js.map +1 -0
  68. package/dist/{chunk-LPUEBFX2.js → chunk-5JCYPBY5.js} +2 -2
  69. package/dist/{chunk-IMULTENA.js → chunk-5SOSQTVE.js} +2 -2
  70. package/dist/{chunk-D6BOOYNJ.js → chunk-5YIOUS5T.js} +384 -345
  71. package/dist/chunk-5YIOUS5T.js.map +1 -0
  72. package/dist/{chunk-5PUZV73Z.js → chunk-6VFMEBXY.js} +12 -12
  73. package/dist/{chunk-333SBFXB.js → chunk-7AAMJQFW.js} +2 -2
  74. package/dist/{chunk-BKTCVXMK.js → chunk-7SNEJNA3.js} +96 -23
  75. package/dist/chunk-7SNEJNA3.js.map +1 -0
  76. package/dist/{chunk-PFLN6TTW.js → chunk-A2XFG462.js} +2 -2
  77. package/dist/{chunk-WEHSQBFR.js → chunk-AIF6V2OX.js} +9 -4
  78. package/dist/chunk-AIF6V2OX.js.map +1 -0
  79. package/dist/{chunk-HXFIILGF.js → chunk-BFPF5N3H.js} +4 -4
  80. package/dist/{chunk-QFTK6EDM.js → chunk-BFZFNXOC.js} +13 -13
  81. package/dist/{chunk-7OCKK5M5.js → chunk-BJOQQCYC.js} +9 -9
  82. package/dist/{chunk-ZX546Y3Y.js → chunk-CY2C5LM4.js} +3 -3
  83. package/dist/{chunk-73TPOGS4.js → chunk-DC55RIEZ.js} +9 -9
  84. package/dist/{chunk-ZDZJNXL6.js → chunk-DK2VBJ6Q.js} +4 -4
  85. package/dist/{chunk-CLVILSBR.js → chunk-DNXQVCIC.js} +22 -22
  86. package/dist/{chunk-7VIJUZYW.js → chunk-E53NLIAP.js} +3 -3
  87. package/dist/{chunk-2LA3H54D.js → chunk-E5IZTY4W.js} +2 -2
  88. package/dist/{chunk-J74YOBB3.js → chunk-EBI6FI5U.js} +12 -12
  89. package/dist/{chunk-YYXYZM2I.js → chunk-ETTV5F53.js} +2 -2
  90. package/dist/{chunk-FRYCXXTB.js → chunk-FSORYJRP.js} +3 -3
  91. package/dist/{chunk-TH6OYP6I.js → chunk-GOZXQNIM.js} +3 -3
  92. package/dist/{chunk-TNRGWJYT.js → chunk-GUF2JKG5.js} +2 -2
  93. package/dist/{chunk-AL3TCNSJ.js → chunk-H3MLOQ7F.js} +24 -53
  94. package/dist/chunk-H3MLOQ7F.js.map +1 -0
  95. package/dist/{chunk-SIONKXLU.js → chunk-H6TCS5XX.js} +18 -15
  96. package/dist/chunk-H6TCS5XX.js.map +1 -0
  97. package/dist/{chunk-FEUWI5QH.js → chunk-HHPY5SSE.js} +2 -2
  98. package/dist/{chunk-QPFM6DHY.js → chunk-HHVK2JRE.js} +2 -2
  99. package/dist/{chunk-YY57TRKN.js → chunk-HR3DKJCU.js} +2 -2
  100. package/dist/{chunk-FMFCQRDM.js → chunk-IJKO5RVJ.js} +3 -3
  101. package/dist/{chunk-UMEUU66X.js → chunk-IK7NPYYU.js} +2 -2
  102. package/dist/{chunk-ILNPU5W5.js → chunk-IMA4DJ7K.js} +5 -45
  103. package/dist/chunk-IMA4DJ7K.js.map +1 -0
  104. package/dist/chunk-IUGOGDCP.js +39 -0
  105. package/dist/chunk-IUGOGDCP.js.map +1 -0
  106. package/dist/{chunk-CKZWLAHN.js → chunk-JDH2BA2P.js} +2 -2
  107. package/dist/{chunk-QVXEXGIM.js → chunk-JNBSTHVT.js} +2 -2
  108. package/dist/chunk-JVVWCZ2P.js +18 -0
  109. package/dist/chunk-JVVWCZ2P.js.map +1 -0
  110. package/dist/{chunk-OBPOIZNR.js → chunk-KBHUGMUW.js} +2 -2
  111. package/dist/{chunk-OZKVVUJB.js → chunk-KIM5VNZN.js} +2 -2
  112. package/dist/{chunk-ZWDDY4WF.js → chunk-KW4XA7GM.js} +3 -3
  113. package/dist/{chunk-OAQRZ4SV.js → chunk-L5EE2CXU.js} +2 -2
  114. package/dist/{chunk-QNUNAXBE.js → chunk-L7LZDISF.js} +1 -9
  115. package/dist/{chunk-QNUNAXBE.js.map → chunk-L7LZDISF.js.map} +1 -1
  116. package/dist/{chunk-RO5EGRAI.js → chunk-LAOJHOTG.js} +2 -2
  117. package/dist/{chunk-FOTFLHBN.js → chunk-LH57QATU.js} +3 -2
  118. package/dist/chunk-LH57QATU.js.map +1 -0
  119. package/dist/{chunk-BFPQJNFZ.js → chunk-LXSDEPEK.js} +60 -11
  120. package/dist/{chunk-BFPQJNFZ.js.map → chunk-LXSDEPEK.js.map} +1 -1
  121. package/dist/{chunk-3PNJZTDV.js → chunk-NDPS6OU2.js} +2 -2
  122. package/dist/{chunk-N7AIFTSH.js → chunk-NJG63FY2.js} +1 -1
  123. package/dist/{chunk-N7AIFTSH.js.map → chunk-NJG63FY2.js.map} +1 -1
  124. package/dist/{chunk-BUKK5SWA.js → chunk-NKAGGDSL.js} +3 -3
  125. package/dist/{chunk-BUKK5SWA.js.map → chunk-NKAGGDSL.js.map} +1 -1
  126. package/dist/{chunk-U3BCW7GX.js → chunk-OGQL7QC7.js} +3 -3
  127. package/dist/{chunk-K3FH3LAQ.js → chunk-OJXK5C6Z.js} +4 -4
  128. package/dist/{chunk-HDLNSDLK.js → chunk-P3XO7HE3.js} +2 -2
  129. package/dist/{chunk-RFLC6PKQ.js → chunk-PQIFYBUX.js} +2 -2
  130. package/dist/{chunk-WLT6LTQP.js → chunk-PRRWKTK6.js} +2 -2
  131. package/dist/{chunk-LWZNSQN3.js → chunk-PUQQPLVV.js} +3 -3
  132. package/dist/{chunk-LWZNSQN3.js.map → chunk-PUQQPLVV.js.map} +1 -1
  133. package/dist/{chunk-4L25GAYL.js → chunk-Q7OKGBZY.js} +2 -2
  134. package/dist/{chunk-ZQUOUPP3.js → chunk-QJBULLKG.js} +4 -4
  135. package/dist/{chunk-W7N7NWG5.js → chunk-QKAFFVSO.js} +2 -2
  136. package/dist/{chunk-EZG54YDS.js → chunk-QKBFVLDH.js} +2 -2
  137. package/dist/{chunk-MOUSHJAR.js → chunk-QMFHKWHN.js} +5 -5
  138. package/dist/{chunk-QLQUAVVP.js → chunk-QRCE77YX.js} +16 -16
  139. package/dist/chunk-QRCE77YX.js.map +1 -0
  140. package/dist/{chunk-4D2EY4WM.js → chunk-R2AJAAHJ.js} +6 -6
  141. package/dist/{chunk-5BE3FLKL.js → chunk-R3UQIS3F.js} +8 -8
  142. package/dist/{chunk-B3M56D2A.js → chunk-RDHEBINJ.js} +2 -2
  143. package/dist/{chunk-L7SEYUHS.js → chunk-RHQL2RIM.js} +3 -3
  144. package/dist/{chunk-2MWKUVHT.js → chunk-RK7SE3BL.js} +5 -5
  145. package/dist/{chunk-CUPILBIP.js → chunk-SA2YALFU.js} +2 -2
  146. package/dist/{chunk-VRHY7Y5A.js → chunk-SAPC7N43.js} +3 -3
  147. package/dist/{chunk-6QWFZ3X5.js → chunk-SOQOUZ2Y.js} +2 -2
  148. package/dist/{chunk-VHXRLD6S.js → chunk-T2JZF45K.js} +2 -2
  149. package/dist/{chunk-HLWXCDUQ.js → chunk-T4MKFTJF.js} +5 -5
  150. package/dist/{chunk-WQUGCOKF.js → chunk-TFA6HPOA.js} +4 -4
  151. package/dist/{chunk-YZYAYUJQ.js → chunk-TLRIRISJ.js} +4 -4
  152. package/dist/{chunk-LVGTH6IQ.js → chunk-UFX24WNJ.js} +14 -14
  153. package/dist/{chunk-OM5ESBES.js → chunk-UH3FPX3L.js} +2 -2
  154. package/dist/{chunk-4NBUHYUV.js → chunk-V5W67PQV.js} +3 -3
  155. package/dist/{chunk-TAD6QMMD.js → chunk-VAQIBC2L.js} +2 -2
  156. package/dist/{chunk-3Q3XD3NO.js → chunk-W2E2WFXL.js} +3 -3
  157. package/dist/{chunk-UYIBNDQE.js → chunk-W2UV6VE3.js} +2 -2
  158. package/dist/{chunk-AVWOULJH.js → chunk-W35ICLYZ.js} +2 -2
  159. package/dist/{chunk-HDDRVXX4.js → chunk-W5LJ3SJ7.js} +2 -2
  160. package/dist/{chunk-FGT7CUYZ.js → chunk-WF2LYKOB.js} +2 -2
  161. package/dist/{chunk-JIF22AXI.js → chunk-WGKIXNLY.js} +5 -2
  162. package/dist/{chunk-JIF22AXI.js.map → chunk-WGKIXNLY.js.map} +1 -1
  163. package/dist/{chunk-FFWFFAP3.js → chunk-WI2WTIMY.js} +14 -8
  164. package/dist/chunk-WI2WTIMY.js.map +1 -0
  165. package/dist/{chunk-OWM2VWNX.js → chunk-X5MFCZDL.js} +82 -44
  166. package/dist/chunk-X5MFCZDL.js.map +1 -0
  167. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  168. package/dist/{chunk-22V3CMIW.js → chunk-XJTRIHTH.js} +8 -8
  169. package/dist/{chunk-3SL52JKD.js → chunk-XVZA6VXC.js} +4 -4
  170. package/dist/{chunk-WWQMZBDI.js → chunk-XYNUEXLC.js} +7 -7
  171. package/dist/{chunk-HDWISXFH.js → chunk-Y65XX5PC.js} +2 -2
  172. package/dist/{chunk-3YOX2BQD.js → chunk-YE77U5HZ.js} +3 -3
  173. package/dist/{chunk-U2PSE7MB.js → chunk-YLTU2DC4.js} +2 -2
  174. package/dist/{chunk-BPCR5DZP.js → chunk-YRD525ZO.js} +6 -6
  175. package/dist/chunk-YRD525ZO.js.map +1 -0
  176. package/dist/{chunk-SBRUTD5O.js → chunk-YSATDEBY.js} +5 -5
  177. package/dist/{chunk-TBBDFYXW.js → chunk-YVUNHNB6.js} +2 -3
  178. package/dist/chunk-YVUNHNB6.js.map +1 -0
  179. package/dist/{chunk-GBSXTTLP.js → chunk-YY5UXARJ.js} +24 -12
  180. package/dist/chunk-YY5UXARJ.js.map +1 -0
  181. package/dist/{chunk-L272A5QW.js → chunk-YYDUBGUF.js} +30 -22
  182. package/dist/chunk-YYDUBGUF.js.map +1 -0
  183. package/dist/{chunk-5QDTZIGH.js → chunk-ZJ3CEAJD.js} +2 -2
  184. package/dist/{chunk-GMO3BGOF.js → chunk-ZOJUWVAU.js} +1 -1
  185. package/dist/{chunk-T4BT4FQN.js → chunk-ZYP4YEEI.js} +3 -3
  186. package/dist/cli.js +181 -179
  187. package/dist/coding/export-okf-codegraph.js +30 -30
  188. package/dist/coding/pre-action-gate.js +2 -2
  189. package/dist/compounding/engine.js +20 -20
  190. package/dist/config-deprecations.d.ts +3 -0
  191. package/dist/config-deprecations.d.ts.map +1 -0
  192. package/dist/config-deprecations.js +9 -0
  193. package/dist/config.d.ts.map +1 -1
  194. package/dist/config.js +30 -29
  195. package/dist/connectors/codex-marketplace.d.ts.map +1 -1
  196. package/dist/connectors/codex-materialize-runner.js +20 -20
  197. package/dist/connectors/codex-materialize.d.ts.map +1 -1
  198. package/dist/connectors/codex-materialize.js +1 -1
  199. package/dist/connectors/index.js +21 -21
  200. package/dist/consolidation-provenance-check.js +2 -2
  201. package/dist/convergence-refresh.js +22 -22
  202. package/dist/conversation-index/backend.js +2 -2
  203. package/dist/corpus-watermark.js +21 -21
  204. package/dist/deep-recall-http-glue.js +11 -11
  205. package/dist/deep-recall.js +2 -2
  206. package/dist/embedding-fallback.js +2 -2
  207. package/dist/entity-retrieval.js +21 -21
  208. package/dist/event-order-recall.js +3 -3
  209. package/dist/explicit-capture.js +181 -179
  210. package/dist/extraction-judge.js +1 -1
  211. package/dist/extraction-normalization.js +1 -1
  212. package/dist/extraction-span-materialize.js +2 -2
  213. package/dist/extraction.js +35 -35
  214. package/dist/{first-start-migration-BPVJ4HJQ.js → first-start-migration-PPPP54X6.js} +5 -5
  215. package/dist/{graph-edge-decay-BC3IO2J4.js → graph-edge-decay-EKWXRBWF.js} +6 -6
  216. package/dist/graph-edge-decay-EKWXRBWF.js.map +1 -0
  217. package/dist/graph-jsonl.js +4 -4
  218. package/dist/graph-snapshot.js +4 -4
  219. package/dist/graph.js +5 -5
  220. package/dist/harmonic-retrieval.js +19 -19
  221. package/dist/index.js +272 -269
  222. package/dist/lcm/engine.js +2 -2
  223. package/dist/lcm/index.js +7 -7
  224. package/dist/lifecycle.d.ts +0 -6
  225. package/dist/lifecycle.d.ts.map +1 -1
  226. package/dist/lifecycle.js +1 -1
  227. package/dist/local-llm.js +2 -2
  228. package/dist/location/index.js +31 -21
  229. package/dist/location/provider-setup.d.ts +26 -1
  230. package/dist/location/provider-setup.d.ts.map +1 -1
  231. package/dist/maintenance/memory-governance.js +20 -20
  232. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +19 -19
  233. package/dist/maintenance/rebuild-memory-projection-runner.js +22 -22
  234. package/dist/maintenance/rebuild-memory-projection.js +21 -21
  235. package/dist/memory-browse.js +6 -6
  236. package/dist/memory-controller.d.ts.map +1 -1
  237. package/dist/memory-controller.js +1 -1
  238. package/dist/{migrate-from-identity-anchor-MJYB6NNN.js → migrate-from-identity-anchor-TZSZXJ6L.js} +2 -2
  239. package/dist/migrate-from-identity-anchor-TZSZXJ6L.js.map +1 -0
  240. package/dist/model-registry.d.ts +0 -5
  241. package/dist/model-registry.d.ts.map +1 -1
  242. package/dist/model-registry.js +1 -1
  243. package/dist/namespaces/migrate.js +20 -20
  244. package/dist/namespaces/search.js +9 -9
  245. package/dist/namespaces/storage.d.ts.map +1 -1
  246. package/dist/namespaces/storage.js +19 -19
  247. package/dist/offline-sync-changeset-generations.js +4 -4
  248. package/dist/offline-sync-embedding-generation.js +3 -3
  249. package/dist/offline-sync-snapshot-stream.js +7 -7
  250. package/dist/offline-sync.js +6 -6
  251. package/dist/operator-doctor-corpus.js +22 -22
  252. package/dist/operator-toolkit.js +42 -41
  253. package/dist/orchestration/backlog-scheduler.d.ts +4 -0
  254. package/dist/orchestration/backlog-scheduler.d.ts.map +1 -1
  255. package/dist/orchestration/backlog-scheduler.js +192 -184
  256. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  257. package/dist/orchestration/buffer-drain-runner.js +182 -180
  258. package/dist/orchestration/extraction-persist-citation.d.ts +2 -2
  259. package/dist/orchestration/extraction-persist-citation.d.ts.map +1 -1
  260. package/dist/orchestration/extraction-persist.d.ts.map +1 -1
  261. package/dist/orchestration/maintenance.js +30 -30
  262. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  263. package/dist/orchestration/semantic-consolidation-coordinator.d.ts.map +1 -1
  264. package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -1
  265. package/dist/orchestration/workspace-ops.d.ts.map +1 -1
  266. package/dist/orchestrator.d.ts.map +1 -1
  267. package/dist/orchestrator.js +183 -181
  268. package/dist/peers/index.d.ts +2 -1
  269. package/dist/peers/index.d.ts.map +1 -1
  270. package/dist/peers/index.js +3 -3
  271. package/dist/peers/interaction-log-append.d.ts +8 -0
  272. package/dist/peers/interaction-log-append.d.ts.map +1 -0
  273. package/dist/peers/storage.d.ts +22 -8
  274. package/dist/peers/storage.d.ts.map +1 -1
  275. package/dist/policy-runtime.js +2 -2
  276. package/dist/qmd.js +4 -4
  277. package/dist/recall-explain-renderer.js +3 -3
  278. package/dist/recall-navigate-access.js +2 -2
  279. package/dist/recall-navigate-disclosure.js +2 -2
  280. package/dist/recall-navigate.js +2 -2
  281. package/dist/recall-navigation.js +181 -179
  282. package/dist/recall-state-view-admission.js +6 -6
  283. package/dist/recall-state-view-packet.d.ts.map +1 -1
  284. package/dist/recall-state-view-packet.js +30 -8
  285. package/dist/recall-state-view-packet.js.map +1 -1
  286. package/dist/recall-why-service.js +6 -6
  287. package/dist/recall-xray-cli.js +4 -4
  288. package/dist/recall-xray-renderer.js +3 -3
  289. package/dist/recall-xray.js +2 -2
  290. package/dist/reconcile/manifest.js +2 -2
  291. package/dist/resume-bundles.js +31 -30
  292. package/dist/retrieval.js +2 -2
  293. package/dist/search/factory.js +8 -8
  294. package/dist/search/index.js +14 -14
  295. package/dist/semantic-consolidation.d.ts +10 -16
  296. package/dist/semantic-consolidation.d.ts.map +1 -1
  297. package/dist/semantic-consolidation.js +24 -24
  298. package/dist/semantic-rule-promotion.js +19 -19
  299. package/dist/semantic-rule-verifier.js +19 -19
  300. package/dist/source-agent-qualifier.js +25 -25
  301. package/dist/source-attribution.d.ts +3 -3
  302. package/dist/source-attribution.d.ts.map +1 -1
  303. package/dist/source-attribution.js +1 -1
  304. package/dist/standup/build.js +19 -19
  305. package/dist/storage/links-frontmatter.d.ts +3 -0
  306. package/dist/storage/links-frontmatter.d.ts.map +1 -0
  307. package/dist/storage.d.ts +1 -0
  308. package/dist/storage.d.ts.map +1 -1
  309. package/dist/storage.js +18 -18
  310. package/dist/summarizer.d.ts +7 -1
  311. package/dist/summarizer.d.ts.map +1 -1
  312. package/dist/summarizer.js +4 -4
  313. package/dist/support-passport/index.js +16 -16
  314. package/dist/tier-routing.js +2 -2
  315. package/dist/{tier-stats-FLFKN7Y6.js → tier-stats-XWJSVEHC.js} +5 -5
  316. package/dist/transfer/autodetect.js +3 -3
  317. package/dist/transfer/backup.js +2 -2
  318. package/dist/transfer/capsule-export.js +3 -3
  319. package/dist/transfer/capsule-import.js +3 -3
  320. package/dist/transfer/export-okf.js +19 -19
  321. package/dist/transfer/import-json.js +2 -2
  322. package/dist/transfer/import-md.js +2 -2
  323. package/dist/transfer/types.d.ts +15 -3
  324. package/dist/transfer/types.d.ts.map +1 -1
  325. package/dist/transfer/types.js +3 -1
  326. package/dist/types.d.ts +1 -0
  327. package/dist/types.d.ts.map +1 -1
  328. package/dist/types.js +1 -1
  329. package/dist/utility-learner.js +2 -2
  330. package/dist/utility-runtime.js +3 -3
  331. package/dist/verified-recall.js +19 -19
  332. package/dist/who-knows-cli.js +20 -20
  333. package/dist/who-knows.js +19 -19
  334. package/package.json +2 -2
  335. package/src/access-cli.test.ts +9 -9
  336. package/src/access-recall-excerpt-attribution.ts +69 -0
  337. package/src/access-recall-surface.ts +23 -23
  338. package/src/access-service-raw-excerpt-read-gate.test.ts +192 -11
  339. package/src/backlog-scheduler.test.ts +31 -0
  340. package/src/binary-lifecycle/scanner.ts +35 -14
  341. package/src/buffer-add-turns-bounded.ts +16 -2
  342. package/src/buffer-session-cap.ts +4 -4
  343. package/src/buffer.ts +5 -5
  344. package/src/calibration.ts +56 -4
  345. package/src/config-deprecations.ts +14 -0
  346. package/src/config.ts +2 -1
  347. package/src/connectors/codex-marketplace-git.test.ts +267 -0
  348. package/src/connectors/codex-marketplace.ts +76 -13
  349. package/src/connectors/codex-materialize.ts +29 -55
  350. package/src/lifecycle.ts +0 -8
  351. package/src/location/provider-setup.test.ts +273 -2
  352. package/src/location/provider-setup.ts +138 -32
  353. package/src/memory-controller.test.ts +11 -0
  354. package/src/memory-controller.ts +5 -1
  355. package/src/model-registry.ts +0 -11
  356. package/src/namespaces/storage.ts +1 -0
  357. package/src/orchestration/backlog-scheduler.ts +12 -3
  358. package/src/orchestration/extraction-persist-citation.ts +5 -3
  359. package/src/orchestration/extraction-persist.ts +15 -14
  360. package/src/orchestration/recall-internal.ts +2 -3
  361. package/src/orchestration/semantic-consolidation-coordinator.ts +40 -33
  362. package/src/orchestration/semantic-consolidation-split.test.ts +72 -0
  363. package/src/orchestration/turn-ingestion-buffered.test.ts +52 -1
  364. package/src/orchestration/turn-ingestion-buffered.ts +26 -8
  365. package/src/orchestration/workspace-ops.test.ts +23 -0
  366. package/src/orchestration/workspace-ops.ts +6 -5
  367. package/src/orchestrator.ts +1 -0
  368. package/src/peers/index.ts +1 -1
  369. package/src/peers/interaction-log-append.ts +132 -0
  370. package/src/peers/peers.test.ts +30 -0
  371. package/src/peers/profile-reasoner.ts +1 -1
  372. package/src/peers/storage.ts +4 -105
  373. package/src/recall-state-view-packet.test.ts +40 -0
  374. package/src/recall-state-view-packet.ts +46 -9
  375. package/src/semantic-consolidation.ts +35 -27
  376. package/src/source-attribution.test.ts +57 -0
  377. package/src/source-attribution.ts +46 -43
  378. package/src/storage/links-frontmatter.ts +69 -0
  379. package/src/storage-links-parse.test.ts +153 -0
  380. package/src/storage.ts +8 -21
  381. package/src/summarizer-shutdown.test.ts +49 -16
  382. package/src/summarizer.ts +13 -5
  383. package/src/testing/subjects/dependency-propagation.test.ts +5 -4
  384. package/src/testing/subjects/memory-maintenance.test.ts +293 -0
  385. package/src/transfer/capsule-export.ts +2 -1
  386. package/src/transfer/capsule-taxonomy-version.test.ts +70 -0
  387. package/src/transfer/types.ts +13 -3
  388. package/src/types.ts +1 -0
  389. package/dist/chunk-AL3TCNSJ.js.map +0 -1
  390. package/dist/chunk-BKTCVXMK.js.map +0 -1
  391. package/dist/chunk-BPCR5DZP.js.map +0 -1
  392. package/dist/chunk-D6BOOYNJ.js.map +0 -1
  393. package/dist/chunk-FFWFFAP3.js.map +0 -1
  394. package/dist/chunk-FOTFLHBN.js.map +0 -1
  395. package/dist/chunk-GBSXTTLP.js.map +0 -1
  396. package/dist/chunk-I74SUMNI.js.map +0 -1
  397. package/dist/chunk-ILNPU5W5.js.map +0 -1
  398. package/dist/chunk-L272A5QW.js.map +0 -1
  399. package/dist/chunk-OWM2VWNX.js.map +0 -1
  400. package/dist/chunk-QLQUAVVP.js.map +0 -1
  401. package/dist/chunk-SIONKXLU.js.map +0 -1
  402. package/dist/chunk-TBBDFYXW.js.map +0 -1
  403. package/dist/chunk-WEHSQBFR.js.map +0 -1
  404. /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-recall-excerpt-attribution.js.map} +0 -0
  405. /package/dist/{auto-sync-L3M4RKJD.js.map → auto-sync-ACP5U5A3.js.map} +0 -0
  406. /package/dist/{graph-edge-decay-BC3IO2J4.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  407. /package/dist/{capsule-merge-VHBRF65A.js.map → capsule-merge-BADOICNP.js.map} +0 -0
  408. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  409. /package/dist/{chunk-CKELO7Q6.js.map → chunk-2OAFPBQB.js.map} +0 -0
  410. /package/dist/{chunk-2DL3OFLD.js.map → chunk-45GEJRIG.js.map} +0 -0
  411. /package/dist/{chunk-5IZL4DCV.js.map → chunk-4DF5LMBJ.js.map} +0 -0
  412. /package/dist/{chunk-A5UOREWD.js.map → chunk-4DLGKTM6.js.map} +0 -0
  413. /package/dist/{chunk-WEFFO2MJ.js.map → chunk-4E2Z44CV.js.map} +0 -0
  414. /package/dist/{chunk-X67XNZ64.js.map → chunk-4LVQSHHN.js.map} +0 -0
  415. /package/dist/{chunk-RB7NXZ2E.js.map → chunk-4X7HQKAG.js.map} +0 -0
  416. /package/dist/{chunk-LPUEBFX2.js.map → chunk-5JCYPBY5.js.map} +0 -0
  417. /package/dist/{chunk-IMULTENA.js.map → chunk-5SOSQTVE.js.map} +0 -0
  418. /package/dist/{chunk-5PUZV73Z.js.map → chunk-6VFMEBXY.js.map} +0 -0
  419. /package/dist/{chunk-333SBFXB.js.map → chunk-7AAMJQFW.js.map} +0 -0
  420. /package/dist/{chunk-PFLN6TTW.js.map → chunk-A2XFG462.js.map} +0 -0
  421. /package/dist/{chunk-HXFIILGF.js.map → chunk-BFPF5N3H.js.map} +0 -0
  422. /package/dist/{chunk-QFTK6EDM.js.map → chunk-BFZFNXOC.js.map} +0 -0
  423. /package/dist/{chunk-7OCKK5M5.js.map → chunk-BJOQQCYC.js.map} +0 -0
  424. /package/dist/{chunk-ZX546Y3Y.js.map → chunk-CY2C5LM4.js.map} +0 -0
  425. /package/dist/{chunk-73TPOGS4.js.map → chunk-DC55RIEZ.js.map} +0 -0
  426. /package/dist/{chunk-ZDZJNXL6.js.map → chunk-DK2VBJ6Q.js.map} +0 -0
  427. /package/dist/{chunk-CLVILSBR.js.map → chunk-DNXQVCIC.js.map} +0 -0
  428. /package/dist/{chunk-7VIJUZYW.js.map → chunk-E53NLIAP.js.map} +0 -0
  429. /package/dist/{chunk-2LA3H54D.js.map → chunk-E5IZTY4W.js.map} +0 -0
  430. /package/dist/{chunk-J74YOBB3.js.map → chunk-EBI6FI5U.js.map} +0 -0
  431. /package/dist/{chunk-YYXYZM2I.js.map → chunk-ETTV5F53.js.map} +0 -0
  432. /package/dist/{chunk-FRYCXXTB.js.map → chunk-FSORYJRP.js.map} +0 -0
  433. /package/dist/{chunk-TH6OYP6I.js.map → chunk-GOZXQNIM.js.map} +0 -0
  434. /package/dist/{chunk-TNRGWJYT.js.map → chunk-GUF2JKG5.js.map} +0 -0
  435. /package/dist/{chunk-FEUWI5QH.js.map → chunk-HHPY5SSE.js.map} +0 -0
  436. /package/dist/{chunk-QPFM6DHY.js.map → chunk-HHVK2JRE.js.map} +0 -0
  437. /package/dist/{chunk-YY57TRKN.js.map → chunk-HR3DKJCU.js.map} +0 -0
  438. /package/dist/{chunk-FMFCQRDM.js.map → chunk-IJKO5RVJ.js.map} +0 -0
  439. /package/dist/{chunk-UMEUU66X.js.map → chunk-IK7NPYYU.js.map} +0 -0
  440. /package/dist/{chunk-CKZWLAHN.js.map → chunk-JDH2BA2P.js.map} +0 -0
  441. /package/dist/{chunk-QVXEXGIM.js.map → chunk-JNBSTHVT.js.map} +0 -0
  442. /package/dist/{chunk-OBPOIZNR.js.map → chunk-KBHUGMUW.js.map} +0 -0
  443. /package/dist/{chunk-OZKVVUJB.js.map → chunk-KIM5VNZN.js.map} +0 -0
  444. /package/dist/{chunk-ZWDDY4WF.js.map → chunk-KW4XA7GM.js.map} +0 -0
  445. /package/dist/{chunk-OAQRZ4SV.js.map → chunk-L5EE2CXU.js.map} +0 -0
  446. /package/dist/{chunk-RO5EGRAI.js.map → chunk-LAOJHOTG.js.map} +0 -0
  447. /package/dist/{chunk-3PNJZTDV.js.map → chunk-NDPS6OU2.js.map} +0 -0
  448. /package/dist/{chunk-U3BCW7GX.js.map → chunk-OGQL7QC7.js.map} +0 -0
  449. /package/dist/{chunk-K3FH3LAQ.js.map → chunk-OJXK5C6Z.js.map} +0 -0
  450. /package/dist/{chunk-HDLNSDLK.js.map → chunk-P3XO7HE3.js.map} +0 -0
  451. /package/dist/{chunk-RFLC6PKQ.js.map → chunk-PQIFYBUX.js.map} +0 -0
  452. /package/dist/{chunk-WLT6LTQP.js.map → chunk-PRRWKTK6.js.map} +0 -0
  453. /package/dist/{chunk-4L25GAYL.js.map → chunk-Q7OKGBZY.js.map} +0 -0
  454. /package/dist/{chunk-ZQUOUPP3.js.map → chunk-QJBULLKG.js.map} +0 -0
  455. /package/dist/{chunk-W7N7NWG5.js.map → chunk-QKAFFVSO.js.map} +0 -0
  456. /package/dist/{chunk-EZG54YDS.js.map → chunk-QKBFVLDH.js.map} +0 -0
  457. /package/dist/{chunk-MOUSHJAR.js.map → chunk-QMFHKWHN.js.map} +0 -0
  458. /package/dist/{chunk-4D2EY4WM.js.map → chunk-R2AJAAHJ.js.map} +0 -0
  459. /package/dist/{chunk-5BE3FLKL.js.map → chunk-R3UQIS3F.js.map} +0 -0
  460. /package/dist/{chunk-B3M56D2A.js.map → chunk-RDHEBINJ.js.map} +0 -0
  461. /package/dist/{chunk-L7SEYUHS.js.map → chunk-RHQL2RIM.js.map} +0 -0
  462. /package/dist/{chunk-2MWKUVHT.js.map → chunk-RK7SE3BL.js.map} +0 -0
  463. /package/dist/{chunk-CUPILBIP.js.map → chunk-SA2YALFU.js.map} +0 -0
  464. /package/dist/{chunk-VRHY7Y5A.js.map → chunk-SAPC7N43.js.map} +0 -0
  465. /package/dist/{chunk-6QWFZ3X5.js.map → chunk-SOQOUZ2Y.js.map} +0 -0
  466. /package/dist/{chunk-VHXRLD6S.js.map → chunk-T2JZF45K.js.map} +0 -0
  467. /package/dist/{chunk-HLWXCDUQ.js.map → chunk-T4MKFTJF.js.map} +0 -0
  468. /package/dist/{chunk-WQUGCOKF.js.map → chunk-TFA6HPOA.js.map} +0 -0
  469. /package/dist/{chunk-YZYAYUJQ.js.map → chunk-TLRIRISJ.js.map} +0 -0
  470. /package/dist/{chunk-LVGTH6IQ.js.map → chunk-UFX24WNJ.js.map} +0 -0
  471. /package/dist/{chunk-OM5ESBES.js.map → chunk-UH3FPX3L.js.map} +0 -0
  472. /package/dist/{chunk-4NBUHYUV.js.map → chunk-V5W67PQV.js.map} +0 -0
  473. /package/dist/{chunk-TAD6QMMD.js.map → chunk-VAQIBC2L.js.map} +0 -0
  474. /package/dist/{chunk-3Q3XD3NO.js.map → chunk-W2E2WFXL.js.map} +0 -0
  475. /package/dist/{chunk-UYIBNDQE.js.map → chunk-W2UV6VE3.js.map} +0 -0
  476. /package/dist/{chunk-AVWOULJH.js.map → chunk-W35ICLYZ.js.map} +0 -0
  477. /package/dist/{chunk-HDDRVXX4.js.map → chunk-W5LJ3SJ7.js.map} +0 -0
  478. /package/dist/{chunk-FGT7CUYZ.js.map → chunk-WF2LYKOB.js.map} +0 -0
  479. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  480. /package/dist/{chunk-22V3CMIW.js.map → chunk-XJTRIHTH.js.map} +0 -0
  481. /package/dist/{chunk-3SL52JKD.js.map → chunk-XVZA6VXC.js.map} +0 -0
  482. /package/dist/{chunk-WWQMZBDI.js.map → chunk-XYNUEXLC.js.map} +0 -0
  483. /package/dist/{chunk-HDWISXFH.js.map → chunk-Y65XX5PC.js.map} +0 -0
  484. /package/dist/{chunk-3YOX2BQD.js.map → chunk-YE77U5HZ.js.map} +0 -0
  485. /package/dist/{chunk-U2PSE7MB.js.map → chunk-YLTU2DC4.js.map} +0 -0
  486. /package/dist/{chunk-SBRUTD5O.js.map → chunk-YSATDEBY.js.map} +0 -0
  487. /package/dist/{chunk-5QDTZIGH.js.map → chunk-ZJ3CEAJD.js.map} +0 -0
  488. /package/dist/{chunk-GMO3BGOF.js.map → chunk-ZOJUWVAU.js.map} +0 -0
  489. /package/dist/{chunk-T4BT4FQN.js.map → chunk-ZYP4YEEI.js.map} +0 -0
  490. /package/dist/{migrate-from-identity-anchor-MJYB6NNN.js.map → config-deprecations.js.map} +0 -0
  491. /package/dist/{first-start-migration-BPVJ4HJQ.js.map → first-start-migration-PPPP54X6.js.map} +0 -0
  492. /package/dist/{tier-stats-FLFKN7Y6.js.map → tier-stats-XWJSVEHC.js.map} +0 -0
@@ -1518,3 +1518,60 @@ test("citation matcher resists polynomial ReDoS on hostile unterminated input (C
1518
1518
  const valid = parseAllCitations("body [Source: doc-1 , 2026-06-08 ]");
1519
1519
  assert.equal(valid.length, 1);
1520
1520
  });
1521
+
1522
+ test("#3567 hasCitationForTemplate: default fast path consults configured prior templates", () => {
1523
+ // Fact written while a custom template was configured; config later reverted
1524
+ // to the default. The marker does not match the default shape, so the old
1525
+ // `template === DEFAULT_CITATION_FORMAT` fast path returned false and the
1526
+ // body was double-cited / hash-mismatched on reprocess.
1527
+ const priorTemplate = "[src:{agent}/{session}@{date}]";
1528
+ const body = "Latency improved after the index rebuild.";
1529
+ const cited = attachCitation(
1530
+ body,
1531
+ { agent: "scout", session: "agent:scout:alpha", ts: "2026-04-10T14:25:07Z" },
1532
+ priorTemplate,
1533
+ );
1534
+
1535
+ // The prior template is out of history: the miss stands (documents the
1536
+ // operator contract — list prior formats in inlineSourceAttributionFormatHistory).
1537
+ assert.equal(hasCitationForTemplate(cited, DEFAULT_CITATION_FORMAT), false);
1538
+
1539
+ // With the prior template declared, the same check detects it.
1540
+ assert.equal(
1541
+ hasCitationForTemplate(cited, DEFAULT_CITATION_FORMAT, [priorTemplate]),
1542
+ true,
1543
+ );
1544
+ });
1545
+
1546
+ test("#3567 stripCitationForTemplate strips a prior-template marker under a reverted config", () => {
1547
+ const priorTemplate = "[src:{agent}/{session}@{date}]";
1548
+ const body = "Latency improved after the index rebuild.";
1549
+ const cited = attachCitation(
1550
+ body,
1551
+ { agent: "scout", session: "agent:scout:alpha", ts: "2026-04-10T14:25:07Z" },
1552
+ priorTemplate,
1553
+ );
1554
+
1555
+ assert.equal(
1556
+ stripCitationForTemplate(cited, DEFAULT_CITATION_FORMAT, [priorTemplate]),
1557
+ body,
1558
+ );
1559
+ });
1560
+
1561
+ test("#3567 attachCitation does not double-cite a body carrying a prior-template marker", () => {
1562
+ const priorTemplate = "[src:{agent}/{session}@{date}]";
1563
+ const body = "Latency improved after the index rebuild.";
1564
+ const cited = attachCitation(
1565
+ body,
1566
+ { agent: "scout", session: "agent:scout:alpha", ts: "2026-04-10T14:25:07Z" },
1567
+ priorTemplate,
1568
+ );
1569
+
1570
+ const reattached = attachCitation(
1571
+ cited,
1572
+ { agent: "planner", session: "agent:planner:main", ts: "2026-06-01T00:00:00Z" },
1573
+ DEFAULT_CITATION_FORMAT,
1574
+ [priorTemplate],
1575
+ );
1576
+ assert.equal(reattached, cited);
1577
+ });
@@ -407,40 +407,34 @@ function templateMatcher(template: string): RegExp | null {
407
407
  * `[Source: ...]` marker detection which is always available via
408
408
  * {@link hasCitation}.
409
409
  */
410
- export function hasCitationForTemplate(text: string, template: string): boolean {
410
+ export function hasCitationForTemplate(
411
+ text: string,
412
+ template: string,
413
+ priorTemplates: readonly string[] = [],
414
+ ): boolean {
411
415
  if (typeof text !== "string" || text.length === 0) return false;
412
416
  // Always accept the default format as a fallback so facts tagged before a
413
417
  // configuration change are not double-tagged on reprocessing.
414
418
  if (hasCitation(text)) return true;
415
- // If the configured template matches the default, we're done.
416
- //
417
- // Known limitation (Thread 2 — Codex P2): this fast path exits without
418
- // checking whether the content carries a citation from a DIFFERENT custom
419
- // template that was active before the config was changed back to the default.
420
- // Such a fact would be detected by `hasCitation` above only if the prior
421
- // custom template happened to match the default `[Source: ...]` pattern.
422
- // In practice, template changes mid-stream are rare, and the false-negative
423
- // (missing an old custom citation) produces a benign duplicate citation rather
424
- // than data loss. A full fix would require storing the citation template used
425
- // at write time in the frontmatter and checking that here.
426
- if (template === DEFAULT_CITATION_FORMAT) return false;
427
-
428
- // Fully-literal template (no placeholders): exact inclusion check.
429
- if (!PLACEHOLDER_REGEX.test(template)) {
430
- // Reset lastIndex because PLACEHOLDER_REGEX is declared with /g.
419
+ // Probe the current template plus every declared prior format
420
+ // (`inlineSourceAttributionFormatHistory`, issue #3567). A fact written
421
+ // while a different template was configured is detected here instead of
422
+ // being double-cited or hashed with its marker intact on reprocess.
423
+ // citationTemplatesToRecognize drops undetectable shapes, so an
424
+ // all-placeholder prior cannot false-positive.
425
+ for (const candidate of citationTemplatesToRecognize(template, priorTemplates)) {
426
+ if (candidate === DEFAULT_CITATION_FORMAT) continue;
431
427
  PLACEHOLDER_REGEX.lastIndex = 0;
432
- return text.includes(template);
433
- }
434
- // Reset lastIndex after the .test() probe above.
435
- PLACEHOLDER_REGEX.lastIndex = 0;
436
-
437
- const matcher = templateMatcher(template);
438
- if (!matcher) {
439
- // All-placeholder template: cannot build a reliable matcher. See the
440
- // docstring — callers should not rely on dedup for this shape.
441
- return false;
428
+ if (!PLACEHOLDER_REGEX.test(candidate)) {
429
+ PLACEHOLDER_REGEX.lastIndex = 0;
430
+ if (text.includes(candidate)) return true;
431
+ continue;
432
+ }
433
+ PLACEHOLDER_REGEX.lastIndex = 0;
434
+ const matcher = templateMatcher(candidate);
435
+ if (matcher?.test(text)) return true;
442
436
  }
443
- return matcher.test(text);
437
+ return false;
444
438
  }
445
439
 
446
440
  /**
@@ -573,9 +567,10 @@ export function attachCitation(
573
567
  text: string,
574
568
  ctx: CitationContext,
575
569
  template: string = DEFAULT_CITATION_FORMAT,
570
+ priorTemplates: readonly string[] = [],
576
571
  ): string {
577
572
  if (typeof text !== "string") return text as unknown as string;
578
- if (hasCitationForTemplate(text, template)) return text;
573
+ if (hasCitationForTemplate(text, template, priorTemplates)) return text;
579
574
  const trimmedEnd = trimTrailingWhitespace(text);
580
575
  if (trimmedEnd.length === 0) return text;
581
576
  const citation = formatCitation(ctx, template);
@@ -730,28 +725,36 @@ export function stripCitation(text: string): string {
730
725
  export function stripCitationForTemplate(
731
726
  text: string,
732
727
  template: string,
728
+ priorTemplates: readonly string[] = [],
733
729
  ): string {
734
730
  if (typeof text !== "string" || text.length === 0) return text;
735
731
 
736
- // First pass: the default-format marker, if any. A second pass below still
737
- // runs — a body can carry the default marker AND the custom template's
738
- // marker, and canonicalization must remove every recognized form.
739
- const afterDefault = hasCitation(text) ? stripCitation(text) : text;
732
+ // First pass: the default-format marker, if any. Later passes still run —
733
+ // a body can carry the default marker AND markers from the current or a
734
+ // prior configured template, and canonicalization must remove every
735
+ // recognized form.
736
+ let out = hasCitation(text) ? stripCitation(text) : text;
740
737
 
741
- if (!hasCitationForTemplate(afterDefault, template)) return afterDefault;
738
+ for (const candidate of citationTemplatesToRecognize(template, priorTemplates)) {
739
+ if (candidate === DEFAULT_CITATION_FORMAT) continue;
740
+ out = stripSingleTemplateCitation(out, candidate);
741
+ }
742
+ return out;
743
+ }
742
744
 
745
+ // Strips every marker `template` produces — literal templates by exact
746
+ // match, placeholder templates via the compiled matcher. Undetectable
747
+ // (all-placeholder) shapes leave the text unchanged.
748
+ function stripSingleTemplateCitation(text: string, template: string): string {
743
749
  PLACEHOLDER_REGEX.lastIndex = 0;
744
750
  if (!PLACEHOLDER_REGEX.test(template)) {
745
751
  PLACEHOLDER_REGEX.lastIndex = 0;
746
- return stripExactLiteralCitation(afterDefault, template);
752
+ return stripExactLiteralCitation(text, template);
747
753
  }
748
754
  PLACEHOLDER_REGEX.lastIndex = 0;
749
755
 
750
- // Build the template matcher. hasCitationForTemplate already returned true,
751
- // which means templateMatcher produced a non-null result. The null branch
752
- // here is a defensive fallback only — the default pass already ran.
753
756
  const matcher = templateMatcher(template);
754
- if (!matcher) return afterDefault;
757
+ if (!matcher) return text;
755
758
 
756
759
  // The matcher regex was built without the global flag; add it for exec loop.
757
760
  const globalMatcher = new RegExp(
@@ -762,12 +765,12 @@ export function stripCitationForTemplate(
762
765
  let lastIndex = 0;
763
766
  let match: RegExpExecArray | null;
764
767
 
765
- while ((match = globalMatcher.exec(afterDefault)) !== null) {
768
+ while ((match = globalMatcher.exec(text)) !== null) {
766
769
  const matchEnd = match.index + match[0].length;
767
- const enclosure = enclosingDelimiterRange(afterDefault, match.index, matchEnd);
770
+ const enclosure = enclosingDelimiterRange(text, match.index, matchEnd);
768
771
  const removalStart = enclosure?.start ?? match.index;
769
772
  const removalEnd = enclosure?.end ?? matchEnd;
770
- const before = afterDefault.slice(lastIndex, removalStart).replace(/[ \t]+$/, "");
773
+ const before = text.slice(lastIndex, removalStart).replace(/[ \t]+$/, "");
771
774
  result += before;
772
775
  lastIndex = removalEnd;
773
776
  // Guard against zero-width matches causing an infinite loop.
@@ -776,7 +779,7 @@ export function stripCitationForTemplate(
776
779
  }
777
780
  }
778
781
 
779
- const after = afterDefault.slice(lastIndex).replace(/^[ \t]+/, "");
782
+ const after = text.slice(lastIndex).replace(/^[ \t]+/, "");
780
783
  if (after.length > 0) {
781
784
  if (result.length > 0) result += " ";
782
785
  result += after;
@@ -0,0 +1,69 @@
1
+ import type { MemoryLink } from "../types.js";
2
+
3
+ // Parse links: block-sequence items of "key: value" fields under the
4
+ // links: key. Field order is free; an item missing targetId, a known
5
+ // linkType, or a 0-1 strength drops alone (issue #3568). Fields must sit
6
+ // at the item's own key column — deeper lines are nested scalar content
7
+ // (e.g. a "note: |" block), not link fields.
8
+ export function parseFrontmatterLinks(
9
+ fmBlock: string,
10
+ parseReason: (raw: string) => string,
11
+ ): MemoryLink[] | undefined {
12
+ const fmLines = fmBlock.split("\n");
13
+ const linksKeyIdx = fmLines.findIndex((l) => l.trimEnd() === "links:");
14
+ if (linksKeyIdx === -1) return undefined;
15
+
16
+ const linksIndent = fmLines[linksKeyIdx].search(/\S/);
17
+ const items: Record<string, string>[] = [];
18
+ let fieldIndent = -1;
19
+ let itemIndent = -1;
20
+ for (let k = linksKeyIdx + 1; k < fmLines.length; k++) {
21
+ const line = fmLines[k];
22
+ const t = line.trim();
23
+ if (!t || t.startsWith("#")) continue;
24
+ const indent = line.search(/\S/);
25
+ if (indent <= linksIndent) break;
26
+ if (t.startsWith("- ")) {
27
+ if (itemIndent === -1) itemIndent = indent;
28
+ if (indent !== itemIndent) continue;
29
+ items.push({});
30
+ const inline = t.slice(2);
31
+ const colon = inline.indexOf(":");
32
+ fieldIndent = colon > 0 ? indent + 2 : -1;
33
+ if (colon > 0) {
34
+ items[items.length - 1][inline.slice(0, colon).trim()] = inline.slice(colon + 1).trim();
35
+ }
36
+ continue;
37
+ }
38
+ if (items.length === 0) continue;
39
+ const colon = t.indexOf(":");
40
+ if (colon <= 0) continue;
41
+ if (fieldIndent === -1) fieldIndent = indent;
42
+ if (indent !== fieldIndent) continue;
43
+ items[items.length - 1][t.slice(0, colon).trim()] = t.slice(colon + 1).trim();
44
+ }
45
+
46
+ const links: MemoryLink[] = [];
47
+ for (const item of items) {
48
+ const strength = item.strength ? Number(item.strength) : NaN;
49
+ if (
50
+ !item.targetId ||
51
+ !["follows", "references", "contradicts", "supports", "related"].includes(item.linkType ?? "") ||
52
+ !Number.isFinite(strength) ||
53
+ strength < 0 ||
54
+ strength > 1
55
+ ) continue;
56
+ links.push({
57
+ targetId: item.targetId,
58
+ // SAFETY: linkType passed the closed literal list in the guard
59
+ // above, so the string narrows to MemoryLink["linkType"].
60
+ linkType: item.linkType as MemoryLink["linkType"],
61
+ strength,
62
+ reason:
63
+ item.reason?.startsWith('"') && item.reason.endsWith('"')
64
+ ? parseReason(item.reason.slice(1, -1))
65
+ : item.reason,
66
+ });
67
+ }
68
+ return links.length > 0 ? links : undefined;
69
+ }
@@ -0,0 +1,153 @@
1
+ import * as assert from "node:assert/strict";
2
+ import test from "node:test";
3
+
4
+ import { parseFrontmatter } from "./storage.js";
5
+
6
+ const BODY = "body text\n";
7
+
8
+ test("links: block items parse regardless of field order (issue #3568)", () => {
9
+ const raw = `---
10
+ links:
11
+ - strength: 0.8
12
+ targetId: mem-a
13
+ linkType: related
14
+ ---
15
+ ${BODY}`;
16
+ const links = parseFrontmatter(raw)?.frontmatter.links;
17
+ assert.deepEqual(links, [
18
+ { targetId: "mem-a", linkType: "related", strength: 0.8, reason: undefined },
19
+ ]);
20
+ });
21
+
22
+ test("links: items round-trip in the serializer's own order", () => {
23
+ const raw = `---
24
+ links:
25
+ - targetId: mem-a
26
+ linkType: related
27
+ strength: 0.8
28
+ reason: "because \\"quoted\\""
29
+ - targetId: mem-b
30
+ linkType: contradicts
31
+ strength: 0.2
32
+ ---
33
+ ${BODY}`;
34
+ const links = parseFrontmatter(raw)?.frontmatter.links;
35
+ assert.equal(links?.length, 2);
36
+ assert.equal(links?.[0]?.reason, 'because "quoted"');
37
+ assert.equal(links?.[1]?.targetId, "mem-b");
38
+ });
39
+
40
+ test("links: a corrupt item drops without losing its siblings", () => {
41
+ const raw = `---
42
+ links:
43
+ - targetId: mem-a
44
+ linkType: related
45
+ strength: 0.8
46
+ - targetId: mem-b
47
+ linkType: related
48
+ - targetId: mem-c
49
+ linkType: bogus-type
50
+ strength: 0.5
51
+ - targetId: mem-d
52
+ linkType: supports
53
+ strength: 1.5
54
+ ---
55
+ ${BODY}`;
56
+ const links = parseFrontmatter(raw)?.frontmatter.links;
57
+ assert.deepEqual(links, [
58
+ { targetId: "mem-a", linkType: "related", strength: 0.8, reason: undefined },
59
+ ]);
60
+ });
61
+
62
+ test("links: a link-shaped string inside another scalar makes no phantom link", () => {
63
+ const raw = `---
64
+ description: "note - targetId: mem-x linkType: related strength: 0.9 inside"
65
+ ---
66
+ ${BODY}`;
67
+ const links = parseFrontmatter(raw)?.frontmatter.links;
68
+ assert.equal(links, undefined);
69
+ });
70
+
71
+ test("links: a standalone comment between items does not truncate the list", () => {
72
+ const raw = `---
73
+ links:
74
+ - targetId: mem-a
75
+ linkType: related
76
+ strength: 0.8
77
+ # next link
78
+ - targetId: mem-b
79
+ linkType: supports
80
+ strength: 0.5
81
+ ---
82
+ ${BODY}`;
83
+ const links = parseFrontmatter(raw)?.frontmatter.links;
84
+ assert.equal(links?.length, 2);
85
+ assert.equal(links?.[1]?.targetId, "mem-b");
86
+ });
87
+
88
+ test("links: block-scalar content inside an item cannot overwrite link fields", () => {
89
+ const raw = `---
90
+ links:
91
+ - targetId: mem-a
92
+ linkType: related
93
+ strength: 0.8
94
+ note: |
95
+ targetId: mem-x
96
+ linkType: contradicts
97
+ strength: 0.9
98
+ ---
99
+ ${BODY}`;
100
+ const links = parseFrontmatter(raw)?.frontmatter.links;
101
+ assert.deepEqual(links, [
102
+ { targetId: "mem-a", linkType: "related", strength: 0.8, reason: undefined },
103
+ ]);
104
+ });
105
+
106
+ test("links: a dash line inside nested scalar content is not a new item", () => {
107
+ const raw = `---
108
+ links:
109
+ - targetId: mem-a
110
+ linkType: related
111
+ strength: 0.8
112
+ note: |
113
+ - targetId: mem-x
114
+ linkType: contradicts
115
+ strength: 0.9
116
+ ---
117
+ ${BODY}`;
118
+ const links = parseFrontmatter(raw)?.frontmatter.links;
119
+ assert.deepEqual(links, [
120
+ { targetId: "mem-a", linkType: "related", strength: 0.8, reason: undefined },
121
+ ]);
122
+ });
123
+
124
+ test("links: an empty strength drops the item, strength 0 stays valid", () => {
125
+ const raw = `---
126
+ links:
127
+ - targetId: mem-a
128
+ linkType: related
129
+ strength:
130
+ - targetId: mem-b
131
+ linkType: supports
132
+ strength: 0
133
+ ---
134
+ ${BODY}`;
135
+ const links = parseFrontmatter(raw)?.frontmatter.links;
136
+ assert.deepEqual(links, [
137
+ { targetId: "mem-b", linkType: "supports", strength: 0, reason: undefined },
138
+ ]);
139
+ });
140
+
141
+ test("links: unknown keys on an item do not drop the link", () => {
142
+ const raw = `---
143
+ links:
144
+ - targetId: mem-a
145
+ linkType: related
146
+ strength: 0.8
147
+ created: 2026-11-21
148
+ ---
149
+ ${BODY}`;
150
+ const links = parseFrontmatter(raw)?.frontmatter.links;
151
+ assert.equal(links?.length, 1);
152
+ assert.equal(links?.[0]?.targetId, "mem-a");
153
+ });
package/src/storage.ts CHANGED
@@ -29,6 +29,7 @@ import { MemoryReadStore, readWindowedMemories, type WindowedMemoryReadOptions,
29
29
  import { runCommittedInvalidation } from "./storage/committed-invalidation.js";
30
30
  import { renderProfileWithLastUpdated, stripOkfProfileFrontmatter, withOkfProfileFrontmatter } from "./storage/profile-header.js";
31
31
  import { appendToProfileSerialized, commitConsolidatedProfileSerialized, type ProfileMutationPorts } from "./storage/profile-mutation.js";
32
+ import { parseFrontmatterLinks } from "./storage/links-frontmatter.js";
32
33
  import { parseQuestionFile as parseQuestionFileText } from "./storage/questions-file.js";
33
34
  import { assertNotOkfReservedBasename, OKF_QUESTION_TYPE, okfTypeForEntityKind, okfTypeForMemory } from "./okf/type-mapping.js";
34
35
  import { appendContextTransformRecords, readContextTransformRecords } from "./storage/context-transform-ledger.js";
@@ -954,24 +955,9 @@ export function parseFrontmatter(raw: string): { frontmatter: MemoryFrontmatter;
954
955
  content,
955
956
  };
956
957
 
957
- // Parse links (YAML array format)
958
- // Note: Simple parsing - for full YAML we'd need a library.
959
- if (fmBlock.includes("links:")) {
960
- const links: MemoryLink[] = [];
961
- const linkMatches = fmBlock.matchAll(
962
- /- targetId: (\S+)\s+linkType: (\S+)\s+strength: ([\d.]+)(?:\s+reason: "((?:\\.|[^"\\])*)")?/g
963
- );
964
- for (const match of linkMatches) {
965
- links.push({
966
- targetId: match[1],
967
- linkType: match[2] as MemoryLink["linkType"],
968
- strength: parseFloat(match[3]),
969
- reason: match[4] ? parseLinkReasonValue(match[4]) : undefined,
970
- });
971
- }
972
- if (links.length > 0) {
973
- result.frontmatter.links = links;
974
- }
958
+ const links = parseFrontmatterLinks(fmBlock, parseLinkReasonValue);
959
+ if (links) {
960
+ result.frontmatter.links = links;
975
961
  }
976
962
 
977
963
  return result;
@@ -1923,6 +1909,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
1923
1909
  private offlineSyncDigestCacheWriteTimer: ReturnType<typeof setTimeout> | null = null;
1924
1910
  /** Optional: set by the orchestrator after construction to enable template-aware citation stripping during legacy hash rebuild. */
1925
1911
  citationTemplate: string = DEFAULT_CITATION_FORMAT;
1912
+ citationTemplateHistory: string[] = [];
1926
1913
  /** Post-write catalog hook (#1522). Installed by the namespace router; fire-and-forget. */
1927
1914
  onCatalogWrite?: () => void;
1928
1915
  /** Post-write embedding hook (#2019). Installed by the orchestrator; fire-and-forget. */
@@ -3142,7 +3129,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
3142
3129
  // and the normalized-text tier must match re-extraction, which hashes
3143
3130
  // the citation-stripped contentHashSource. Idempotent on pre-stripped
3144
3131
  // text (e.g. recordSupersession).
3145
- const strippedRawContent = stripCitationForTemplate(input.rawContent, this.citationTemplate);
3132
+ const strippedRawContent = stripCitationForTemplate(input.rawContent, this.citationTemplate, this.citationTemplateHistory);
3146
3133
  // Canonicalization + post-append recheck (#2213) live in the helper.
3147
3134
  return await entityRefs.appendCanonicalizedTombstone(
3148
3135
  this.stateDir,
@@ -3212,7 +3199,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
3212
3199
  const all = [...(await this.readAllMemories()), ...(await this.readAllColdMemories())];
3213
3200
  // Pure projection (lifecycle/tombstones.ts) keeps this method thin (#1520).
3214
3201
  const retired = collectRetiredMemoriesForRebuild(all, {
3215
- stripCitation: (text) => stripCitationForTemplate(text, this.citationTemplate),
3202
+ stripCitation: (text) => stripCitationForTemplate(text, this.citationTemplate, this.citationTemplateHistory),
3216
3203
  supersessionKeysForFact,
3217
3204
  });
3218
3205
  return await store.rebuild(retired);
@@ -3428,7 +3415,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
3428
3415
  }
3429
3416
  private storedContentIdentityCandidates(content: string): string[] {
3430
3417
  return storedContentIdentityCandidates(content, (value) =>
3431
- hasCitationForTemplate(value, this.citationTemplate) ? stripCitationForTemplate(value, this.citationTemplate) : value
3418
+ hasCitationForTemplate(value, this.citationTemplate, this.citationTemplateHistory) ? stripCitationForTemplate(value, this.citationTemplate, this.citationTemplateHistory) : value
3432
3419
  );
3433
3420
  }
3434
3421
 
@@ -11,6 +11,7 @@ import { parseConfig } from "./config.js";
11
11
  import { initLogger, resetLogger } from "./logger.js";
12
12
  import { HourlySummarizer } from "./summarizer.js";
13
13
  import type { LocalLlmChatCompletionOptions } from "./local-llm-helpers.js";
14
+ import type { LocalLlmClient } from "./local-llm.js";
14
15
  import type { TranscriptEntry } from "./types.js";
15
16
 
16
17
  function createConfig(memoryDir: string, extended = false) {
@@ -34,11 +35,9 @@ interface LlmStub {
34
35
  calls: { signal: AbortSignal | undefined }[];
35
36
  }
36
37
 
37
- function stubLocalLlm(summarizer: HourlySummarizer, stub: LlmStub): void {
38
- // SAFETY: localLlm is a private field, stubbed at the established field
39
- // seam with the client's real call shape; the stub parks until its caller
40
- // signal aborts (real transport behavior), mirroring a wedged local LLM.
41
- (summarizer as any).localLlm = {
38
+
39
+ function parkingChatCompletionStub(stub: LlmStub): Pick<LocalLlmClient, "chatCompletion"> {
40
+ return {
42
41
  chatCompletion: async (
43
42
  messages: Array<{ role: string; content: string }>,
44
43
  options: LocalLlmChatCompletionOptions,
@@ -98,8 +97,8 @@ test("aborting the shutdown signal aborts an in-flight generateSummary and reach
98
97
  undefined,
99
98
  undefined,
100
99
  controller.signal,
100
+ { localLlm: parkingChatCompletionStub(stub) },
101
101
  );
102
- stubLocalLlm(summarizer, stub);
103
102
 
104
103
  const hourStart = new Date(Date.now() - 3_600_000);
105
104
  hourStart.setMinutes(0, 0, 0);
@@ -135,8 +134,8 @@ test("an already-aborted summarizer refuses to start new work and never contacts
135
134
  undefined,
136
135
  undefined,
137
136
  controller.signal,
137
+ { localLlm: parkingChatCompletionStub(stub) },
138
138
  );
139
- stubLocalLlm(summarizer, stub);
140
139
 
141
140
  const hourStart = new Date(Date.now() - 3_600_000);
142
141
  hourStart.setMinutes(0, 0, 0);
@@ -150,6 +149,40 @@ test("an already-aborted summarizer refuses to start new work and never contacts
150
149
  }
151
150
  });
152
151
 
152
+
153
+ test("an injected local LLM stub receives the summary call through the constructor seam", async () => {
154
+ quietLogger();
155
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-summary-seam-"));
156
+ const stub: LlmStub = { calls: [] };
157
+ try {
158
+ const controller = new AbortController();
159
+ const summarizer = new HourlySummarizer(
160
+ createConfig(memoryDir),
161
+ undefined,
162
+ undefined,
163
+ undefined,
164
+ controller.signal,
165
+ { localLlm: parkingChatCompletionStub(stub) },
166
+ );
167
+
168
+ const hourStart = new Date(Date.now() - 3_600_000);
169
+ hourStart.setMinutes(0, 0, 0);
170
+ const pending = summarizer.generateSummary("sess-summary-seam", hourStart, entriesFor());
171
+ await withTestDeadline((async () => {
172
+ while (stub.calls.length === 0) {
173
+ await new Promise((resolve) => setTimeout(resolve, 10));
174
+ }
175
+ })(), 5_000, "injected LLM stub to be entered");
176
+ controller.abort();
177
+ assert.equal(await withTestDeadline(pending, 2_000, "in-flight summarizer abort"), null);
178
+ assert.equal(stub.calls.length, 1);
179
+ assert.equal(stub.calls[0]?.signal?.aborted, true);
180
+ } finally {
181
+ resetLogger();
182
+ await rm(memoryDir, { recursive: true, force: true });
183
+ }
184
+ });
185
+
153
186
  for (const extended of [false, true]) {
154
187
  test(`a shutdown abort during the local call does not start a gateway call (${extended ? "extended" : "standard"} summary)`, async () => {
155
188
  quietLogger();
@@ -164,16 +197,16 @@ for (const extended of [false, true]) {
164
197
  undefined,
165
198
  undefined,
166
199
  controller.signal,
167
- );
168
- stubLocalLlm(summarizer, stub);
169
- // SAFETY: fallbackLlm is a private field, stubbed at the same field seam
170
- // as localLlm; the stub counts gateway calls and returns no result.
171
- (summarizer as any).fallbackLlm = {
172
- parseWithSchema: async (): Promise<null> => {
173
- gatewayCalls += 1;
174
- return null;
200
+ {
201
+ localLlm: parkingChatCompletionStub(stub),
202
+ fallbackLlm: {
203
+ parseWithSchema: async (): Promise<null> => {
204
+ gatewayCalls += 1;
205
+ return null;
206
+ },
207
+ },
175
208
  },
176
- };
209
+ );
177
210
 
178
211
  const hourStart = new Date(Date.now() - 3_600_000);
179
212
  hourStart.setMinutes(0, 0, 0);
package/src/summarizer.ts CHANGED
@@ -107,11 +107,16 @@ export function summarizeHourlyStatus(stats: HourlySummarizerRunStats): {
107
107
  };
108
108
  }
109
109
 
110
+ export type HourlySummarizerLlmClients = {
111
+ localLlm?: Pick<LocalLlmClient, "chatCompletion">;
112
+ fallbackLlm?: Pick<FallbackLlmClient, "parseWithSchema">;
113
+ };
114
+
110
115
  export class HourlySummarizer {
111
116
  private summariesDir: string;
112
117
  private config: PluginConfig;
113
- private localLlm: LocalLlmClient;
114
- private fallbackLlm: FallbackLlmClient;
118
+ private localLlm: Pick<LocalLlmClient, "chatCompletion">;
119
+ private fallbackLlm: Pick<FallbackLlmClient, "parseWithSchema">;
115
120
  private modelRegistry: ModelRegistry;
116
121
  private transcript?: TranscriptManager;
117
122
  /** Orchestrator-owned stop signal: refuses new summaries and aborts the
@@ -123,7 +128,8 @@ export class HourlySummarizer {
123
128
  gatewayConfig?: GatewayConfig,
124
129
  modelRegistry?: ModelRegistry,
125
130
  transcript?: TranscriptManager,
126
- shutdownSignal?: AbortSignal
131
+ shutdownSignal?: AbortSignal,
132
+ llmClients?: HourlySummarizerLlmClients
127
133
  ) {
128
134
  this.config = config;
129
135
  this.summariesDir = path.join(config.memoryDir, "summaries", "hourly");
@@ -132,10 +138,12 @@ export class HourlySummarizer {
132
138
  this.shutdownSignal = shutdownSignal;
133
139
 
134
140
  // Initialize local LLM client with shared model registry
135
- this.localLlm = new LocalLlmClient(config, this.modelRegistry, shutdownSignal);
141
+ this.localLlm = llmClients?.localLlm ?? new LocalLlmClient(config, this.modelRegistry, shutdownSignal);
136
142
 
137
143
  // Initialize fallback client with gateway config
138
- this.fallbackLlm = new FallbackLlmClient(gatewayConfig, fallbackLlmRuntimeContextFromConfig(config));
144
+ this.fallbackLlm =
145
+ llmClients?.fallbackLlm ??
146
+ new FallbackLlmClient(gatewayConfig, fallbackLlmRuntimeContextFromConfig(config));
139
147
 
140
148
  if (
141
149
  !gatewayConfig?.agents?.defaults?.model?.primary &&
@@ -123,10 +123,11 @@ function namespaceMemories(namespace: NamespaceName): MemoryFile[] {
123
123
 
124
124
  function serializeFixture(memory: MemoryFile): string {
125
125
  const links = (memory.frontmatter.links ?? [])
126
- .map(
127
- (link) =>
128
- ` - targetId: ${link.targetId} linkType: ${link.linkType} strength: ${link.strength ?? 0.9}`,
129
- )
126
+ .flatMap((link) => [
127
+ ` - targetId: ${link.targetId}`,
128
+ ` linkType: ${link.linkType}`,
129
+ ` strength: ${link.strength ?? 0.9}`,
130
+ ])
130
131
  .join("\n");
131
132
  return [
132
133
  "---",