@remnic/core 9.3.684 → 9.3.686

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 (315) hide show
  1. package/dist/access-boundary.d.ts +4 -3
  2. package/dist/access-boundary.js +23 -23
  3. package/dist/access-cli.js +152 -71
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +3 -2
  6. package/dist/access-http.js +26 -26
  7. package/dist/access-mcp.d.ts +14 -3
  8. package/dist/access-mcp.js +25 -25
  9. package/dist/access-operations.d.ts +10 -4
  10. package/dist/access-operations.js +26 -24
  11. package/dist/access-schema.d.ts +4 -4
  12. package/dist/{access-service-D-siI-xJ.d.ts → access-service-DmCHJ4cH.d.ts} +106 -39
  13. package/dist/access-service.d.ts +3 -2
  14. package/dist/access-service.js +22 -22
  15. package/dist/access-surface-catalog.d.ts +3 -2
  16. package/dist/access-surface-catalog.js +2 -0
  17. package/dist/access-surface-catalog.js.map +1 -1
  18. package/dist/active-recall.js +2 -2
  19. package/dist/{auto-sync-5CJBJMPZ.js → auto-sync-NUQWSFQD.js} +7 -7
  20. package/dist/bootstrap.d.ts +2 -1
  21. package/dist/bootstrap.js +2 -2
  22. package/dist/boxes.js +2 -2
  23. package/dist/briefing.js +3 -3
  24. package/dist/buffer.js +2 -2
  25. package/dist/calibration.js +4 -4
  26. package/dist/catalog-COqWZlZ6.d.ts +456 -0
  27. package/dist/causal-behavior.js +4 -4
  28. package/dist/causal-chain.js +4 -4
  29. package/dist/causal-consolidation.js +11 -11
  30. package/dist/causal-retrieval.js +4 -4
  31. package/dist/causal-trajectory-graph.js +1 -1
  32. package/dist/causal-trajectory.js +1 -1
  33. package/dist/{chunk-ROHLEUTH.js → chunk-2KAYTPPT.js} +10 -10
  34. package/dist/{chunk-NHQGDVJF.js → chunk-2SJCWLQD.js} +3 -3
  35. package/dist/{chunk-YTWNKQ2G.js → chunk-3FC6LW6T.js} +2 -2
  36. package/dist/{chunk-5OE4PYY5.js → chunk-473JIN2U.js} +61 -11
  37. package/dist/chunk-473JIN2U.js.map +1 -0
  38. package/dist/{chunk-XEA4Z7JU.js → chunk-4FE2K57M.js} +3 -3
  39. package/dist/{chunk-WI7JKV2T.js → chunk-4N3TFFPH.js} +2 -2
  40. package/dist/{chunk-BTVX7ZXZ.js → chunk-4NFVPDIL.js} +4 -4
  41. package/dist/{chunk-OUWAQVDJ.js → chunk-5CEJH5ZN.js} +2 -2
  42. package/dist/{chunk-6QM24CP7.js → chunk-6GJS4BFH.js} +2 -2
  43. package/dist/{chunk-J2FBJ63F.js → chunk-6O6A6YUO.js} +4 -4
  44. package/dist/{chunk-HQ6NIBL6.js → chunk-7FL4CNPV.js} +2 -2
  45. package/dist/{chunk-5VDJMYTF.js → chunk-7WWURLG6.js} +3 -3
  46. package/dist/{chunk-QWRC7GIO.js → chunk-A4HH2EWA.js} +5 -5
  47. package/dist/{chunk-4SKKVWLQ.js → chunk-AGJH5ISO.js} +2 -2
  48. package/dist/{chunk-2L3KLWOV.js → chunk-B43NZNMG.js} +54 -92
  49. package/dist/chunk-B43NZNMG.js.map +1 -0
  50. package/dist/{chunk-WRE3JPAW.js → chunk-B4XVLHJA.js} +3 -3
  51. package/dist/{chunk-53FDU4CE.js → chunk-BLIWOONZ.js} +39 -36
  52. package/dist/chunk-BLIWOONZ.js.map +1 -0
  53. package/dist/{chunk-AJU4PJGY.js → chunk-BVKCV2ZY.js} +2 -2
  54. package/dist/{chunk-DQY7NJ5L.js → chunk-CTOQEZSN.js} +2 -2
  55. package/dist/{chunk-7OGJQP7T.js → chunk-DCWIQFNA.js} +4 -4
  56. package/dist/{chunk-MHQC2WU2.js → chunk-DKTSR7EK.js} +2 -2
  57. package/dist/{chunk-RN7MUWON.js → chunk-EHISUJFN.js} +2 -2
  58. package/dist/{chunk-WLEB7WCG.js → chunk-EO5QWINU.js} +2 -2
  59. package/dist/{chunk-XKXKSQU7.js → chunk-EXM3CQTZ.js} +2 -2
  60. package/dist/{chunk-M3FWYURP.js → chunk-FE6DQUNJ.js} +9 -9
  61. package/dist/{chunk-LCC5EZTT.js → chunk-FIVDN2SM.js} +4 -4
  62. package/dist/{chunk-3MY4W5V4.js → chunk-FUCUR2OZ.js} +550 -63
  63. package/dist/chunk-FUCUR2OZ.js.map +1 -0
  64. package/dist/{chunk-452WDNFO.js → chunk-GG6AJN7A.js} +2 -2
  65. package/dist/{chunk-2IBGHRIO.js → chunk-GS55WYRL.js} +3 -3
  66. package/dist/{chunk-IBTZEBUD.js → chunk-HYNHLBKA.js} +2 -2
  67. package/dist/{chunk-EVWIEEKZ.js → chunk-IQ7WCZRW.js} +2 -2
  68. package/dist/{chunk-B5XMS73R.js → chunk-IQVQJJL7.js} +2 -2
  69. package/dist/{chunk-6RHNCKHG.js → chunk-K43PI6DQ.js} +2 -2
  70. package/dist/{chunk-OIF36KGD.js → chunk-KCQA46NR.js} +2 -2
  71. package/dist/{chunk-2LDBXPLB.js → chunk-KF74X62T.js} +1 -1
  72. package/dist/{chunk-3EVIMVQU.js → chunk-KFBOZYME.js} +42 -3
  73. package/dist/chunk-KFBOZYME.js.map +1 -0
  74. package/dist/{chunk-MAV46GWQ.js → chunk-KYYL4U6X.js} +2 -2
  75. package/dist/{chunk-6GC5SGFE.js → chunk-L24JROPR.js} +2 -2
  76. package/dist/{chunk-Q5ZU3RNY.js → chunk-LQ6JI4VH.js} +2 -2
  77. package/dist/{chunk-GWKCEM3S.js → chunk-MCQDSY4G.js} +3 -3
  78. package/dist/{chunk-HP5FMB6L.js → chunk-MDJURR27.js} +2 -2
  79. package/dist/{chunk-FYEVFGJD.js → chunk-NN7QYW5W.js} +2 -2
  80. package/dist/chunk-NN7QYW5W.js.map +1 -0
  81. package/dist/{chunk-2ODBA7MQ.js → chunk-NU3CSQ4H.js} +5 -5
  82. package/dist/chunk-NU3CSQ4H.js.map +1 -0
  83. package/dist/{chunk-T2PO5MUF.js → chunk-O7GOFAM3.js} +2 -2
  84. package/dist/{chunk-Z2OXSMZK.js → chunk-OBXTMFZQ.js} +3 -3
  85. package/dist/{chunk-K6ZN34WC.js → chunk-OV4D5T7V.js} +3 -3
  86. package/dist/{chunk-OMLIFZ4I.js → chunk-PH3HOKYW.js} +2 -2
  87. package/dist/{chunk-C3IW2F5Z.js → chunk-PLBIPT6I.js} +2 -2
  88. package/dist/{chunk-QY7YA7OL.js → chunk-PNLCEFE4.js} +2 -2
  89. package/dist/{chunk-AGRPGAKR.js → chunk-PONNZ54D.js} +2 -2
  90. package/dist/{chunk-XZ4WBBB5.js → chunk-PWFWCGOO.js} +2 -2
  91. package/dist/{chunk-XWEXT4XU.js → chunk-QANVLERJ.js} +4 -4
  92. package/dist/{chunk-W4RVMTHR.js → chunk-QRDOSYOR.js} +2 -2
  93. package/dist/{chunk-OXNOINIP.js → chunk-QVMXQGT7.js} +24 -24
  94. package/dist/chunk-QVMXQGT7.js.map +1 -0
  95. package/dist/{chunk-6IMKOIZ6.js → chunk-R6OVFAX6.js} +2 -2
  96. package/dist/{chunk-5N5DXYDW.js → chunk-S2OU5DZY.js} +31 -10
  97. package/dist/chunk-S2OU5DZY.js.map +1 -0
  98. package/dist/{chunk-JOASJWQR.js → chunk-SANZHXY2.js} +2 -2
  99. package/dist/{chunk-7DTASS5T.js → chunk-SJHM6I4J.js} +2 -2
  100. package/dist/{chunk-M6BVYHBU.js → chunk-STOEE37X.js} +4 -4
  101. package/dist/{chunk-GKKAXVAJ.js → chunk-U33LWTQQ.js} +1 -7
  102. package/dist/chunk-U33LWTQQ.js.map +1 -0
  103. package/dist/{chunk-LXH3DIF2.js → chunk-U7D7NP4J.js} +2 -2
  104. package/dist/{chunk-DRD2Q7HQ.js → chunk-UFS7OXGL.js} +2 -2
  105. package/dist/{chunk-H3HDXD3U.js → chunk-UPTZYUYJ.js} +2 -2
  106. package/dist/{chunk-3Z7NPD5T.js → chunk-UTYBJR7M.js} +2 -2
  107. package/dist/{chunk-LN4YGHTM.js → chunk-UUH4YQOF.js} +2 -2
  108. package/dist/{chunk-6VF75M3X.js → chunk-VGUOEDTU.js} +2 -2
  109. package/dist/{chunk-44VFF3BB.js → chunk-VILEUJXC.js} +2 -2
  110. package/dist/{chunk-7SI52C65.js → chunk-VL7DP3OW.js} +2 -2
  111. package/dist/{chunk-7DHTMOND.js → chunk-VQ34TERH.js} +2 -2
  112. package/dist/{chunk-6VMIHVGO.js → chunk-VX6OBUDW.js} +2 -2
  113. package/dist/{chunk-EW5KFXHL.js → chunk-WDXCNJSF.js} +7 -7
  114. package/dist/{chunk-FMEKEF47.js → chunk-WIHPNY65.js} +79 -3
  115. package/dist/chunk-WIHPNY65.js.map +1 -0
  116. package/dist/{chunk-X6IRLNOO.js → chunk-WIWPSQYU.js} +2 -2
  117. package/dist/{chunk-DOCTITOP.js → chunk-WRFKZEO6.js} +2 -2
  118. package/dist/{chunk-E6ZDCOHM.js → chunk-XBZQRZ6G.js} +2 -2
  119. package/dist/{chunk-7YX23JBA.js → chunk-XHYGJVXL.js} +2 -2
  120. package/dist/{chunk-JD4SCARD.js → chunk-YN4ZT4CW.js} +1 -1
  121. package/dist/{chunk-YXWAILM4.js → chunk-YOI3ELXF.js} +2 -2
  122. package/dist/{chunk-XCAZF7KQ.js → chunk-ZA2S2VLL.js} +2 -2
  123. package/dist/{chunk-BEUDU7Y4.js → chunk-ZCWIH4LH.js} +2 -2
  124. package/dist/{chunk-V25ZAOSB.js → chunk-ZPTISBQU.js} +5 -5
  125. package/dist/{cli-ooj6JQBS.d.ts → cli-D8nZ2MPH.d.ts} +2 -2
  126. package/dist/cli.d.ts +4 -3
  127. package/dist/cli.js +44 -44
  128. package/dist/compounding/engine.js +4 -4
  129. package/dist/compounding/preference-consolidator.js +1 -1
  130. package/dist/config.js +2 -2
  131. package/dist/connectors/codex-materialize-runner.js +4 -4
  132. package/dist/connectors/codex-materialize.js +2 -2
  133. package/dist/connectors/index.js +5 -5
  134. package/dist/contradiction/index.js +3 -3
  135. package/dist/{contradiction-scan-AZTGFMPY.js → contradiction-scan-HWGEOUDS.js} +3 -3
  136. package/dist/conversation-index/backend.js +5 -5
  137. package/dist/conversation-index/cleanup.js +2 -2
  138. package/dist/conversation-index/faiss-adapter.js +2 -2
  139. package/dist/conversation-index/indexer.js +2 -2
  140. package/dist/conversation-index/search.js +2 -2
  141. package/dist/day-summary.js +2 -2
  142. package/dist/embedding-fallback.js +2 -2
  143. package/dist/entity-retrieval.js +4 -4
  144. package/dist/explicit-capture.d.ts +2 -1
  145. package/dist/explicit-capture.js +1 -1
  146. package/dist/extraction-judge-telemetry.js +2 -2
  147. package/dist/extraction-judge-training.js +2 -2
  148. package/dist/extraction-judge.js +5 -5
  149. package/dist/extraction.js +9 -9
  150. package/dist/fallback-llm.js +4 -4
  151. package/dist/{graph-edge-decay-KSVJGCZW.js → graph-edge-decay-D7OESCBR.js} +2 -2
  152. package/dist/graph-snapshot.js +2 -2
  153. package/dist/graph.js +1 -1
  154. package/dist/index.d.ts +5 -4
  155. package/dist/index.js +80 -80
  156. package/dist/lcm/archive.js +2 -2
  157. package/dist/lcm/engine.js +5 -5
  158. package/dist/lcm/index.js +5 -5
  159. package/dist/lcm/schema.js +2 -2
  160. package/dist/lcm/summarizer.js +3 -3
  161. package/dist/local-llm.js +2 -2
  162. package/dist/logger.js +1 -1
  163. package/dist/maintenance/memory-governance.js +3 -3
  164. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  165. package/dist/maintenance/rebuild-memory-projection.js +5 -5
  166. package/dist/mcp-memory-inspector-app.d.ts +3 -2
  167. package/dist/model-registry.js +2 -2
  168. package/dist/models-json.js +2 -2
  169. package/dist/namespaces/migrate.d.ts +1 -0
  170. package/dist/namespaces/migrate.js +16 -16
  171. package/dist/namespaces/search.js +13 -13
  172. package/dist/namespaces/storage.d.ts +42 -1
  173. package/dist/namespaces/storage.js +3 -3
  174. package/dist/native-knowledge.js +2 -2
  175. package/dist/negative.js +2 -2
  176. package/dist/operator-toolkit.js +22 -22
  177. package/dist/{orchestrator-DIDDvwDw.d.ts → orchestrator-CA6ouzBn.d.ts} +3 -464
  178. package/dist/orchestrator.d.ts +2 -1
  179. package/dist/orchestrator.js +61 -61
  180. package/dist/profiling.js +2 -2
  181. package/dist/qmd.js +2 -2
  182. package/dist/recall-planner-llm.js +4 -4
  183. package/dist/recall-qos.js +2 -2
  184. package/dist/recall-state.js +2 -2
  185. package/dist/relevance.js +2 -2
  186. package/dist/{resolution-IDTEBJFS.js → resolution-MN36NW5P.js} +3 -3
  187. package/dist/resolve-provider-secret.js +2 -2
  188. package/dist/resume-bundles.js +4 -4
  189. package/dist/retrieval-agents.js +2 -2
  190. package/dist/routing/store.js +2 -2
  191. package/dist/schemas.d.ts +38 -38
  192. package/dist/search/embed-helper.js +2 -2
  193. package/dist/search/factory.js +12 -12
  194. package/dist/search/index.js +12 -12
  195. package/dist/search/lancedb-backend.js +2 -2
  196. package/dist/search/meilisearch-backend.js +2 -2
  197. package/dist/search/orama-backend.js +2 -2
  198. package/dist/search/remote-backend.js +2 -2
  199. package/dist/semantic-consolidation.js +5 -5
  200. package/dist/semantic-rule-promotion.js +3 -3
  201. package/dist/semantic-rule-verifier.js +3 -3
  202. package/dist/session-observer-state.js +2 -2
  203. package/dist/session-transcript-migration.js +2 -2
  204. package/dist/shared-context/manager.js +2 -2
  205. package/dist/storage.d.ts +4 -0
  206. package/dist/storage.js +2 -2
  207. package/dist/summarizer.js +7 -7
  208. package/dist/temporal-supersession.js +2 -2
  209. package/dist/threading.js +2 -2
  210. package/dist/transcript.js +2 -2
  211. package/dist/transfer/types.d.ts +22 -22
  212. package/dist/verified-recall.js +4 -4
  213. package/package.json +2 -2
  214. package/src/access-boundary.ts +2 -1
  215. package/src/access-cli.ts +94 -4
  216. package/src/access-http.ts +40 -2
  217. package/src/access-mcp.ts +55 -2
  218. package/src/access-operations.ts +66 -0
  219. package/src/access-service.ts +148 -73
  220. package/src/access-surface-catalog.test.ts +1 -1
  221. package/src/access-surface-catalog.ts +2 -0
  222. package/src/cli.ts +2 -1
  223. package/src/coding/decision-surfaces.test.ts +279 -0
  224. package/src/coding/decision-surfaces.ts +475 -0
  225. package/src/explicit-capture.ts +3 -12
  226. package/src/logger.ts +13 -4
  227. package/src/namespaces/catalog.test.ts +2 -2
  228. package/src/namespaces/storage.ts +81 -0
  229. package/src/orchestrator.ts +22 -64
  230. package/src/storage.ts +36 -36
  231. package/dist/chunk-2L3KLWOV.js.map +0 -1
  232. package/dist/chunk-2ODBA7MQ.js.map +0 -1
  233. package/dist/chunk-3EVIMVQU.js.map +0 -1
  234. package/dist/chunk-3MY4W5V4.js.map +0 -1
  235. package/dist/chunk-53FDU4CE.js.map +0 -1
  236. package/dist/chunk-5N5DXYDW.js.map +0 -1
  237. package/dist/chunk-5OE4PYY5.js.map +0 -1
  238. package/dist/chunk-FMEKEF47.js.map +0 -1
  239. package/dist/chunk-FYEVFGJD.js.map +0 -1
  240. package/dist/chunk-GKKAXVAJ.js.map +0 -1
  241. package/dist/chunk-OXNOINIP.js.map +0 -1
  242. /package/dist/{auto-sync-5CJBJMPZ.js.map → auto-sync-NUQWSFQD.js.map} +0 -0
  243. /package/dist/{chunk-ROHLEUTH.js.map → chunk-2KAYTPPT.js.map} +0 -0
  244. /package/dist/{chunk-NHQGDVJF.js.map → chunk-2SJCWLQD.js.map} +0 -0
  245. /package/dist/{chunk-YTWNKQ2G.js.map → chunk-3FC6LW6T.js.map} +0 -0
  246. /package/dist/{chunk-XEA4Z7JU.js.map → chunk-4FE2K57M.js.map} +0 -0
  247. /package/dist/{chunk-WI7JKV2T.js.map → chunk-4N3TFFPH.js.map} +0 -0
  248. /package/dist/{chunk-BTVX7ZXZ.js.map → chunk-4NFVPDIL.js.map} +0 -0
  249. /package/dist/{chunk-OUWAQVDJ.js.map → chunk-5CEJH5ZN.js.map} +0 -0
  250. /package/dist/{chunk-6QM24CP7.js.map → chunk-6GJS4BFH.js.map} +0 -0
  251. /package/dist/{chunk-J2FBJ63F.js.map → chunk-6O6A6YUO.js.map} +0 -0
  252. /package/dist/{chunk-HQ6NIBL6.js.map → chunk-7FL4CNPV.js.map} +0 -0
  253. /package/dist/{chunk-5VDJMYTF.js.map → chunk-7WWURLG6.js.map} +0 -0
  254. /package/dist/{chunk-QWRC7GIO.js.map → chunk-A4HH2EWA.js.map} +0 -0
  255. /package/dist/{chunk-4SKKVWLQ.js.map → chunk-AGJH5ISO.js.map} +0 -0
  256. /package/dist/{chunk-WRE3JPAW.js.map → chunk-B4XVLHJA.js.map} +0 -0
  257. /package/dist/{chunk-AJU4PJGY.js.map → chunk-BVKCV2ZY.js.map} +0 -0
  258. /package/dist/{chunk-DQY7NJ5L.js.map → chunk-CTOQEZSN.js.map} +0 -0
  259. /package/dist/{chunk-7OGJQP7T.js.map → chunk-DCWIQFNA.js.map} +0 -0
  260. /package/dist/{chunk-MHQC2WU2.js.map → chunk-DKTSR7EK.js.map} +0 -0
  261. /package/dist/{chunk-RN7MUWON.js.map → chunk-EHISUJFN.js.map} +0 -0
  262. /package/dist/{chunk-WLEB7WCG.js.map → chunk-EO5QWINU.js.map} +0 -0
  263. /package/dist/{chunk-XKXKSQU7.js.map → chunk-EXM3CQTZ.js.map} +0 -0
  264. /package/dist/{chunk-M3FWYURP.js.map → chunk-FE6DQUNJ.js.map} +0 -0
  265. /package/dist/{chunk-LCC5EZTT.js.map → chunk-FIVDN2SM.js.map} +0 -0
  266. /package/dist/{chunk-452WDNFO.js.map → chunk-GG6AJN7A.js.map} +0 -0
  267. /package/dist/{chunk-2IBGHRIO.js.map → chunk-GS55WYRL.js.map} +0 -0
  268. /package/dist/{chunk-IBTZEBUD.js.map → chunk-HYNHLBKA.js.map} +0 -0
  269. /package/dist/{chunk-EVWIEEKZ.js.map → chunk-IQ7WCZRW.js.map} +0 -0
  270. /package/dist/{chunk-B5XMS73R.js.map → chunk-IQVQJJL7.js.map} +0 -0
  271. /package/dist/{chunk-6RHNCKHG.js.map → chunk-K43PI6DQ.js.map} +0 -0
  272. /package/dist/{chunk-OIF36KGD.js.map → chunk-KCQA46NR.js.map} +0 -0
  273. /package/dist/{chunk-2LDBXPLB.js.map → chunk-KF74X62T.js.map} +0 -0
  274. /package/dist/{chunk-MAV46GWQ.js.map → chunk-KYYL4U6X.js.map} +0 -0
  275. /package/dist/{chunk-6GC5SGFE.js.map → chunk-L24JROPR.js.map} +0 -0
  276. /package/dist/{chunk-Q5ZU3RNY.js.map → chunk-LQ6JI4VH.js.map} +0 -0
  277. /package/dist/{chunk-GWKCEM3S.js.map → chunk-MCQDSY4G.js.map} +0 -0
  278. /package/dist/{chunk-HP5FMB6L.js.map → chunk-MDJURR27.js.map} +0 -0
  279. /package/dist/{chunk-T2PO5MUF.js.map → chunk-O7GOFAM3.js.map} +0 -0
  280. /package/dist/{chunk-Z2OXSMZK.js.map → chunk-OBXTMFZQ.js.map} +0 -0
  281. /package/dist/{chunk-K6ZN34WC.js.map → chunk-OV4D5T7V.js.map} +0 -0
  282. /package/dist/{chunk-OMLIFZ4I.js.map → chunk-PH3HOKYW.js.map} +0 -0
  283. /package/dist/{chunk-C3IW2F5Z.js.map → chunk-PLBIPT6I.js.map} +0 -0
  284. /package/dist/{chunk-QY7YA7OL.js.map → chunk-PNLCEFE4.js.map} +0 -0
  285. /package/dist/{chunk-AGRPGAKR.js.map → chunk-PONNZ54D.js.map} +0 -0
  286. /package/dist/{chunk-XZ4WBBB5.js.map → chunk-PWFWCGOO.js.map} +0 -0
  287. /package/dist/{chunk-XWEXT4XU.js.map → chunk-QANVLERJ.js.map} +0 -0
  288. /package/dist/{chunk-W4RVMTHR.js.map → chunk-QRDOSYOR.js.map} +0 -0
  289. /package/dist/{chunk-6IMKOIZ6.js.map → chunk-R6OVFAX6.js.map} +0 -0
  290. /package/dist/{chunk-JOASJWQR.js.map → chunk-SANZHXY2.js.map} +0 -0
  291. /package/dist/{chunk-7DTASS5T.js.map → chunk-SJHM6I4J.js.map} +0 -0
  292. /package/dist/{chunk-M6BVYHBU.js.map → chunk-STOEE37X.js.map} +0 -0
  293. /package/dist/{chunk-LXH3DIF2.js.map → chunk-U7D7NP4J.js.map} +0 -0
  294. /package/dist/{chunk-DRD2Q7HQ.js.map → chunk-UFS7OXGL.js.map} +0 -0
  295. /package/dist/{chunk-H3HDXD3U.js.map → chunk-UPTZYUYJ.js.map} +0 -0
  296. /package/dist/{chunk-3Z7NPD5T.js.map → chunk-UTYBJR7M.js.map} +0 -0
  297. /package/dist/{chunk-LN4YGHTM.js.map → chunk-UUH4YQOF.js.map} +0 -0
  298. /package/dist/{chunk-6VF75M3X.js.map → chunk-VGUOEDTU.js.map} +0 -0
  299. /package/dist/{chunk-44VFF3BB.js.map → chunk-VILEUJXC.js.map} +0 -0
  300. /package/dist/{chunk-7SI52C65.js.map → chunk-VL7DP3OW.js.map} +0 -0
  301. /package/dist/{chunk-7DHTMOND.js.map → chunk-VQ34TERH.js.map} +0 -0
  302. /package/dist/{chunk-6VMIHVGO.js.map → chunk-VX6OBUDW.js.map} +0 -0
  303. /package/dist/{chunk-EW5KFXHL.js.map → chunk-WDXCNJSF.js.map} +0 -0
  304. /package/dist/{chunk-X6IRLNOO.js.map → chunk-WIWPSQYU.js.map} +0 -0
  305. /package/dist/{chunk-DOCTITOP.js.map → chunk-WRFKZEO6.js.map} +0 -0
  306. /package/dist/{chunk-E6ZDCOHM.js.map → chunk-XBZQRZ6G.js.map} +0 -0
  307. /package/dist/{chunk-7YX23JBA.js.map → chunk-XHYGJVXL.js.map} +0 -0
  308. /package/dist/{chunk-JD4SCARD.js.map → chunk-YN4ZT4CW.js.map} +0 -0
  309. /package/dist/{chunk-YXWAILM4.js.map → chunk-YOI3ELXF.js.map} +0 -0
  310. /package/dist/{chunk-XCAZF7KQ.js.map → chunk-ZA2S2VLL.js.map} +0 -0
  311. /package/dist/{chunk-BEUDU7Y4.js.map → chunk-ZCWIH4LH.js.map} +0 -0
  312. /package/dist/{chunk-V25ZAOSB.js.map → chunk-ZPTISBQU.js.map} +0 -0
  313. /package/dist/{contradiction-scan-AZTGFMPY.js.map → contradiction-scan-HWGEOUDS.js.map} +0 -0
  314. /package/dist/{graph-edge-decay-KSVJGCZW.js.map → graph-edge-decay-D7OESCBR.js.map} +0 -0
  315. /package/dist/{resolution-IDTEBJFS.js.map → resolution-MN36NW5P.js.map} +0 -0
@@ -2682,7 +2682,7 @@ export class Orchestrator {
2682
2682
  this.rememberNamespaceStorageDirHint(namespace, storageDir);
2683
2683
  return this.namespaceCatalog.registerResolved(namespace, storageDir);
2684
2684
  },
2685
- });
2685
+ }, this.namespaceCatalog);
2686
2686
  this.namespaceSearchRouter = new NamespaceSearchRouter(
2687
2687
  config,
2688
2688
  this.storageRouter,
@@ -2691,6 +2691,8 @@ export class Orchestrator {
2691
2691
  // Propagate the inline-attribution template so the storage layer can strip
2692
2692
  // citations from legacy facts during the hash-index rebuild path.
2693
2693
  this.storage.citationTemplate = config.inlineSourceAttributionFormat;
2694
+ // #1522: bind the post-write catalog touch at the storage chokepoint.
2695
+ if (config.defaultNamespace) this.storageRouter.bindCatalogWriteHook(this.storage, config.defaultNamespace);
2694
2696
  // Wire page-level versioning (issue #371)
2695
2697
  this.storage.setVersioningConfig({
2696
2698
  enabled: config.versioningEnabled,
@@ -4479,11 +4481,7 @@ export class Orchestrator {
4479
4481
  // failures where the canonical memory was written but a later archive
4480
4482
  // step throws and the cluster catch continues (codex NY-dK).
4481
4483
  // Best-effort; namespace decoded from the storage dir since this path
4482
- // has no routed namespace name.
4483
- this.markCatalogWrite(
4484
- this.namespaceFromStorageDir(targetStorage.dir),
4485
- targetStorage.dir,
4486
- );
4484
+ // #1522: catalog touch handled at the storage chokepoint.
4487
4485
  }
4488
4486
  }
4489
4487
  }
@@ -7992,7 +7990,7 @@ export class Orchestrator {
7992
7990
  recallResultLimit > 0 &&
7993
7991
  !options.abortSignal?.aborted
7994
7992
  ) {
7995
- for (const ns of recallNamespaces) this.markCatalogRead(ns);
7993
+ for (const ns of recallNamespaces) this.storageRouter.recordRead(ns);
7996
7994
  }
7997
7995
 
7998
7996
  // 0. Shared context (v4.0, optional)
@@ -14200,7 +14198,6 @@ export class Orchestrator {
14200
14198
  );
14201
14199
  }
14202
14200
  }
14203
- this.markCatalogWrite(target.namespace, targetStorage.dir);
14204
14201
  trackPersistedId(targetStorage, promotedId, { includeReturnedIds: false });
14205
14202
  await this.indexPersistedMemory(targetStorage, promotedId);
14206
14203
  trackBehaviorSignals(
@@ -14391,17 +14388,16 @@ export class Orchestrator {
14391
14388
  useCallerTimestamp: true,
14392
14389
  });
14393
14390
  // Catalog touch (issue #1499 — codex P2 NElSf): this dedup branch
14394
- // returns WITHOUT reaching the post-write `markCatalogWrite` below,
14391
+ // returns WITHOUT the post-write catalog touch (now at the storage chokepoint #1522),
14395
14392
  // but `applyTemporalSupersession` mutated the shared namespace
14396
14393
  // (it rewrote frontmatter to retire stale shared facts). When any
14397
14394
  // ids were actually superseded, the shared namespace changed, so we
14398
14395
  // must record the write — otherwise the shared record's
14399
14396
  // `lastWriteAt` stays stale and `writtenSince` maintenance / QMD
14400
14397
  // fanout skips the namespace after a supersession-only update.
14401
- // Best-effort and failure-tolerant (markCatalogWrite swallows
14398
+ // Best-effort and failure-tolerant (the storage chokepoint swallows
14402
14399
  // errors); only touch when work happened to avoid spurious writes.
14403
14400
  if (hashDedupSupersession.supersededIds.length > 0) {
14404
- this.markCatalogWrite(this.config.sharedNamespace, sharedStorage.dir);
14405
14401
  }
14406
14402
  // Active matching fact exists — normal short-circuit is safe.
14407
14403
  return;
@@ -14505,7 +14501,6 @@ export class Orchestrator {
14505
14501
  // the same promotion pass. The hot-path source-namespace touch uses a
14506
14502
  // different storage dir, so this does not double-count the source.
14507
14503
  // Best-effort and failure-tolerant — it must never crash the promotion.
14508
- this.markCatalogWrite(this.config.sharedNamespace, sharedStorage.dir);
14509
14504
  trackPersistedId(sharedStorage, promotedId, {
14510
14505
  includeReturnedIds: false,
14511
14506
  });
@@ -15358,7 +15353,6 @@ export class Orchestrator {
15358
15353
  // failure still surfaces the partially durable parent/chunk files to
15359
15354
  // catalog-driven `writtenSince` maintenance. The final touch below
15360
15355
  // still refreshes `lastWriteAt` after later durable writes on success.
15361
- this.markCatalogWrite(targetNamespaceName, targetStorage.dir);
15362
15356
  }
15363
15357
 
15364
15358
  if (routedRuleId) {
@@ -15502,7 +15496,6 @@ export class Orchestrator {
15502
15496
  // promotion, optional artifact writes, and graph-edge writes — so
15503
15497
  // `lastWriteAt` cannot precede later file changes on successful
15504
15498
  // completion. Use the KNOWN routed name, not a dir-decoded guess.
15505
- this.markCatalogWrite(targetNamespaceName, targetStorage.dir);
15506
15499
  }
15507
15500
  trackBehaviorSignals(
15508
15501
  targetStorage,
@@ -15732,13 +15725,12 @@ export class Orchestrator {
15732
15725
  // The `finally` preserves the write touch when post-write indexing or
15733
15726
  // promotion fails after the canonical memory is already durable. Use the
15734
15727
  // KNOWN routed name, not a dir-decoded guess (NCQI0).
15735
- this.markCatalogWrite(targetNamespaceName, targetStorage.dir);
15736
15728
  }
15737
15729
  }
15738
15730
 
15739
15731
  // Tracks whether THIS extraction persisted any durable, non-fact output to the
15740
15732
  // BASE namespace's storage (entity / relationship / profile / question). The
15741
- // per-fact `markCatalogWrite` only fires inside the fact write loop, so a
15733
+ // per-fact catalog touch (storage chokepoint #1522) only fires inside the fact write loop, so a
15742
15734
  // fact-less extraction that still persists durable data must record exactly one
15743
15735
  // base-namespace catalog touch after all writes complete (NHZEZ, codex P2).
15744
15736
  let durableNonFactWritten = false;
@@ -15748,7 +15740,6 @@ export class Orchestrator {
15748
15740
  baseNamespace && baseNamespace.length > 0
15749
15741
  ? baseNamespace
15750
15742
  : this.namespaceFromStorageDir(storage.dir);
15751
- this.markCatalogWrite(baseTouchNamespace, storage.dir);
15752
15743
  };
15753
15744
  const recordDurableNonFactWrite = () => {
15754
15745
  durableNonFactWritten = true;
@@ -15863,7 +15854,7 @@ export class Orchestrator {
15863
15854
  }
15864
15855
 
15865
15856
  // Catalog touch for durable NON-FACT outputs (NHZEZ / NIIly, codex P2). The
15866
- // per-fact `markCatalogWrite` above only fires inside the fact write loop, so
15857
+ // per-fact catalog touch (storage chokepoint #1522) above only fires inside the fact write loop, so
15867
15858
  // an extraction that persists ONLY entities, relationships, profile updates,
15868
15859
  // questions, or an identity reflection (no facts) would record durable data to
15869
15860
  // the BASE namespace's storage without ever touching the catalog — leaving that
@@ -15874,7 +15865,7 @@ export class Orchestrator {
15874
15865
  // KNOWN base namespace name, not a dir-decoded guess (NCQI0). One touch per
15875
15866
  // namespace per extraction — `markWrite` is idempotent, so if the fact path
15876
15867
  // already touched the base namespace this only refreshes `lastWriteAt`.
15877
- // Best-effort and failure-tolerant (markCatalogWrite swallows errors).
15868
+ // Best-effort and failure-tolerant (storage chokepoint #1522 swallows errors).
15878
15869
  if (durableNonFactWritten) {
15879
15870
  touchBaseNonFactNamespace();
15880
15871
  }
@@ -16604,19 +16595,13 @@ export class Orchestrator {
16604
16595
  }
16605
16596
  }
16606
16597
 
16607
- // Consolidated catalog write touch (issue #1499 sweep; NIBOi + NIjwl). One
16608
- // touch covering EVERY durable namespace mutation this pass made LLM
16609
- // profile/entity/memory-item actions AND cleanup-only maintenance (entity-file
16610
- // merges, expired-commitment / ledger-lifecycle / TTL cleanup, fact archival).
16611
- // Recorded here, after all mutation-producing steps, so a cleanup-only run that
16612
- // rewrote the store still refreshes `lastWriteAt` (rule #25). The default
16613
- // namespace is always configured/cataloged; `markWrite` is idempotent so this
16614
- // only refreshes recency. Best-effort and failure-tolerant.
16598
+ // Consolidated catalog write touch belt-and-suspenders for cleanup-only
16599
+ // passes that mutate the store via delete-only paths (entity merges, TTL
16600
+ // cleanup) without triggering the storage chokepoint's post-write hook.
16601
+ // Gated on memoryItemMutated (set by every durable mutation including cleanup-only passes)
16602
+ // Best-effort and failure-tolerant.
16615
16603
  if (memoryItemMutated) {
16616
- this.markCatalogWrite(
16617
- this.namespaceFromStorageDir(this.storage.dir),
16618
- this.storage.dir,
16619
- );
16604
+ this.storageRouter.recordWrite(this.config.defaultNamespace, this.storage.dir);
16620
16605
  }
16621
16606
 
16622
16607
  log.info("consolidation complete");
@@ -17070,7 +17055,6 @@ export class Orchestrator {
17070
17055
  const lifecycleCorpus = await storage.readAllMemories();
17071
17056
  // Record the catalog write when the pass rewrote any frontmatter (codex NR-tS).
17072
17057
  if ((await this.runLifecyclePolicyPass(lifecycleCorpus, storage)) > 0) {
17073
- this.markCatalogWrite(this.namespaceFromStorageDir(storage.dir), storage.dir);
17074
17058
  }
17075
17059
  return { memoriesAssessed: lifecycleCorpus.length };
17076
17060
  }
@@ -17355,10 +17339,7 @@ export class Orchestrator {
17355
17339
  // summary and then rewrites source-memory archive status, bypassing the
17356
17340
  // extraction write path. Record the touch after both mutations complete so
17357
17341
  // `lastWriteAt` covers the final archived-state write.
17358
- this.markCatalogWrite(
17359
- this.namespaceFromStorageDir(this.storage.dir),
17360
- this.storage.dir,
17361
- );
17342
+ // #1522: catalog touch handled at the storage chokepoint.
17362
17343
 
17363
17344
  log.info(
17364
17345
  `created summary ${summary.id} from ${batch.length} memories, archived ${archived}`,
@@ -17469,11 +17450,10 @@ export class Orchestrator {
17469
17450
  // a namespace whose sole mutation in the pass is identity consolidation would
17470
17451
  // otherwise keep a stale `lastWriteAt`, making `listNamespaces({ writtenSince })`
17471
17452
  // and catalog-recency consumers miss the write. Best-effort and
17472
- // failure-tolerant (`markCatalogWrite` swallows errors, never crashing the
17453
+ // failure-tolerant (the storage chokepoint (#1522) swallows errors, never crashing the
17473
17454
  // consolidation; gotcha #13, rule #40). No double-count with the consolidated
17474
17455
  // touch above: that one is gated on `memoryItemMutated` (which identity
17475
17456
  // consolidation does not set), and `markWrite` is idempotent regardless.
17476
- this.markCatalogWrite(namespace, storage.dir);
17477
17457
  log.info(
17478
17458
  `IDENTITY(${namespace}) consolidated: ${identityContent.length} → ${newContent.length} chars, ${result.learnedPatterns.length} patterns`,
17479
17459
  );
@@ -19917,24 +19897,13 @@ export class Orchestrator {
19917
19897
  return dirName;
19918
19898
  }
19919
19899
 
19920
- /**
19921
- * Record a namespace write in the catalog (issue #1499). Best-effort and
19922
- * failure-tolerant: a catalog write error MUST NOT crash the primary memory
19923
- * write (CLAUDE.md gotcha #13, rule #40). Fire-and-forget by design.
19924
- */
19925
- private markCatalogWrite(namespace: string, storageDir?: string): void {
19926
- if (!this.namespaceCatalog.enabled) return;
19927
- this.rememberNamespaceStorageDirHint(namespace, storageDir);
19928
- void this.namespaceCatalog
19929
- .markWrite(namespace, { discoveredBy: "write", storageDir })
19930
- .catch(() => undefined);
19931
- }
19900
+ // #1522: catalog touch methods removed — touches now happen at the storage chokepoint.
19932
19901
 
19933
19902
  /**
19934
19903
  * Public best-effort catalog write touch (issue #1499). User-facing explicit
19935
19904
  * captures (`memory_store`) and review-queue approvals persist via
19936
19905
  * `persistExplicitCapture()` → `storage.writeMemory()`, which bypasses the
19937
- * extraction write path that calls `markCatalogWrite`. Without this their
19906
+ * extraction write path that owns the catalog touch. Without this their
19938
19907
  * namespaces never record `lastWriteAt`, so the catalog under-reports write
19939
19908
  * recency (round 5, codex P2). Fire-and-forget and failure-tolerant — a
19940
19909
  * catalog error must never affect the explicit write (gotcha #13, rule #40).
@@ -19944,20 +19913,9 @@ export class Orchestrator {
19944
19913
  * default rather than skipping it (round 6, codex P2 — default `memory_store`
19945
19914
  * and inline-note writes were missing from `writtenSince`/maintenance).
19946
19915
  */
19947
- recordCatalogWrite(namespace?: string, storageDir?: string): void {
19948
- const ns = namespace && namespace.trim().length > 0 ? namespace : this.config.defaultNamespace;
19949
- if (!ns) return;
19950
- this.markCatalogWrite(ns, storageDir);
19951
- }
19952
19916
 
19953
- /** Record a namespace read in the catalog. Best-effort, failure-tolerant. */
19954
- private markCatalogRead(namespace: string, storageDir?: string): void {
19955
- if (!this.namespaceCatalog.enabled) return;
19956
- this.rememberNamespaceStorageDirHint(namespace, storageDir);
19957
- void this.namespaceCatalog
19958
- .markRead(namespace, { discoveredBy: "read", storageDir })
19959
- .catch(() => undefined);
19960
- }
19917
+
19918
+ // markCatalogRead removed use storageRouter.recordRead() instead (#1522).
19961
19919
 
19962
19920
  private async readAllMemoriesForNamespaces(
19963
19921
  namespaces: string[],
package/src/storage.ts CHANGED
@@ -2238,24 +2238,12 @@ export class StorageManager {
2238
2238
 
2239
2239
  // Cache for readAllColdMemories() — keyed by cold root directory path.
2240
2240
  // Prevents an uncached full-tree directory scan on every structured-attribute
2241
- // write (Finding UOGi, PR #402 round-6). The cache is only invalidated when
2242
- // cold-tier content actually changes (via invalidateColdMemoriesCache), NOT
2243
- // on every hot-tier write. It also expires after COLD_SCAN_CACHE_TTL_MS as
2244
- // a safety net.
2245
- //
2246
- // Finding UvUy (PR #402 round-11): cache entries now carry a `coldVersion`
2247
- // sentinel that is bumped (via a file-size counter in state/cold-write.log)
2248
- // on every write that modifies cold-tier content. Before serving a cached
2249
- // result, readAllColdMemories() reads the sentinel from disk and compares.
2250
- // If they differ the entry is dropped and the cold tree is re-scanned. This
2251
- // makes the cache correct across process boundaries (gateway + CLI): a second
2252
- // process that writes a new cold memory bumps the sentinel on disk, so the
2253
- // first process's next readAllColdMemories() sees the change within one call
2254
- // (rather than waiting up to 30s for TTL expiry).
2255
- //
2256
- // After Finding UTsP broadened readAllColdMemories to scan the entire cold/
2257
- // subtree (not just facts/+corrections/), amortizing this I/O across
2258
- // back-to-back writes in the same burst is even more important.
2241
+ // write (Finding UOGi, PR #402 round-6). Invalidated when cold-tier content
2242
+ // changes (via invalidateColdMemoriesCache) and expires after COLD_SCAN_CACHE_TTL_MS.
2243
+ // Entries carry a `coldVersion` sentinel (Finding UvUy, PR #402 round-11) bumped
2244
+ // on every cold-tier write, making the cache correct across process boundaries
2245
+ // (gateway + CLI). After Finding UTsP broadened the scan to the entire cold/
2246
+ // subtree, amortizing across back-to-back writes is even more important.
2259
2247
  private static readonly COLD_SCAN_CACHE_TTL_MS = 30_000; // 30 seconds
2260
2248
  private static readonly coldMemoriesCache = new Map<string, { memories: MemoryFile[]; loadedAt: number; coldVersion: number }>();
2261
2249
 
@@ -2289,6 +2277,11 @@ export class StorageManager {
2289
2277
  private offlineSyncDigestCacheWriteTimer: ReturnType<typeof setTimeout> | null = null;
2290
2278
  /** Optional: set by the orchestrator after construction to enable template-aware citation stripping during legacy hash rebuild. */
2291
2279
  citationTemplate: string = DEFAULT_CITATION_FORMAT;
2280
+ /** Post-write catalog hook (#1522). Installed by the namespace router; fire-and-forget. */
2281
+ onCatalogWrite?: () => void;
2282
+ private notifyCatalogWrite(): void {
2283
+ try { this.onCatalogWrite?.(); } catch { /* gotcha #13 */ }
2284
+ }
2292
2285
 
2293
2286
  /** Page-versioning configuration. Set by the orchestrator after construction. */
2294
2287
  private _versioningConfig: VersioningConfig | null = null;
@@ -2576,7 +2569,7 @@ export class StorageManager {
2576
2569
  ): Promise<void> {
2577
2570
  const targetPath = this.wearableTranscriptPath(sourceId, date);
2578
2571
  // writeMaybeEncryptedFile handles mkdir + atomic temp→rename.
2579
- await writeMaybeEncryptedFile(targetPath, serialized, this.resolveWriteKey(), {}, this.baseDir);
2572
+ await this.writeStorageSecureFile(targetPath, serialized);
2580
2573
  }
2581
2574
 
2582
2575
  /** Read a stored day transcript; null when the day has no file. */
@@ -2747,8 +2740,13 @@ export class StorageManager {
2747
2740
  private readStorageSecureFile(filePath: string): Promise<string> {
2748
2741
  return readMaybeEncryptedFile(filePath, this._secureStoreKey, this.baseDir);
2749
2742
  }
2750
- private writeStorageSecureFile(filePath: string, content: string): Promise<void> {
2751
- return writeMaybeEncryptedFile(filePath, content, this.resolveWriteKey(), {}, this.baseDir);
2743
+ private writeStorageSecureFile(filePath: string, content: string | Buffer): Promise<void> {
2744
+ return writeMaybeEncryptedFile(filePath, content, this.resolveWriteKey(), {}, this.baseDir)
2745
+ .then(() => this.notifyCatalogWrite());
2746
+ }
2747
+ private writeStorageSecureFileChunks(filePath: string, chunks: AsyncIterable<Buffer>): Promise<void> {
2748
+ return writeMaybeEncryptedFileFromChunks(filePath, chunks, this.resolveWriteKey(), {}, this.baseDir)
2749
+ .then(() => this.notifyCatalogWrite());
2752
2750
  }
2753
2751
 
2754
2752
  private assertManagedStoragePath(filePath: string, method: string): string {
@@ -2929,18 +2927,18 @@ export class StorageManager {
2929
2927
 
2930
2928
  async writeOfflineSyncFile(filePath: string, content: Buffer): Promise<void> {
2931
2929
  const target = this.assertManagedStoragePath(filePath, "storage.writeOfflineSyncFile");
2932
- await writeMaybeEncryptedFile(target, content, this.resolveWriteKey(), {}, this.baseDir);
2930
+ await this.writeStorageSecureFile(target, content);
2933
2931
  await this.invalidateAfterOfflineSyncMutation(target);
2934
2932
  }
2935
2933
 
2936
2934
  async writeOfflineSyncStagingFile(filePath: string, content: Buffer): Promise<void> {
2937
2935
  const target = this.assertManagedStoragePath(filePath, "storage.writeOfflineSyncStagingFile");
2938
- await writeMaybeEncryptedFile(target, content, this.resolveWriteKey(), {}, this.baseDir);
2936
+ await this.writeStorageSecureFile(target, content);
2939
2937
  }
2940
2938
 
2941
2939
  async writeOfflineSyncFileChunks(filePath: string, chunks: AsyncIterable<Buffer>): Promise<void> {
2942
2940
  const target = this.assertManagedStoragePath(filePath, "storage.writeOfflineSyncFileChunks");
2943
- await writeMaybeEncryptedFileFromChunks(target, chunks, this.resolveWriteKey(), {}, this.baseDir);
2941
+ await this.writeStorageSecureFileChunks(target, chunks);
2944
2942
  await this.invalidateAfterOfflineSyncMutation(target);
2945
2943
  }
2946
2944
 
@@ -3005,12 +3003,14 @@ export class StorageManager {
3005
3003
  if (isEncryptedFile(await readFile(filePath))) {
3006
3004
  const existing = await this.readStorageSecureFile(filePath);
3007
3005
  await writeMaybeEncryptedFile(filePath, `${existing}${content}`, null, {}, this.baseDir);
3006
+ this.notifyCatalogWrite();
3008
3007
  return;
3009
3008
  }
3010
3009
  } catch (err) {
3011
3010
  if (!isErrnoCode(err, "ENOENT")) throw err;
3012
3011
  }
3013
3012
  await appendFile(filePath, content, "utf-8");
3013
+ this.notifyCatalogWrite();
3014
3014
  return;
3015
3015
  }
3016
3016
 
@@ -3021,6 +3021,7 @@ export class StorageManager {
3021
3021
  if (!isErrnoCode(err, "ENOENT")) throw err;
3022
3022
  }
3023
3023
  await writeMaybeEncryptedFile(filePath, `${existing}${content}`, writeKey, {}, this.baseDir);
3024
+ this.notifyCatalogWrite();
3024
3025
  }
3025
3026
  private get stateDir(): string {
3026
3027
  return path.join(this.baseDir, "state");
@@ -3465,7 +3466,7 @@ export class StorageManager {
3465
3466
  const filePath = await this.resolveCategoryWritePath(category, id, today);
3466
3467
 
3467
3468
  await this.snapshotBeforeWrite(filePath, "write");
3468
- await writeMaybeEncryptedFile(filePath, fileContent, this.resolveWriteKey(), {}, this.baseDir);
3469
+ await this.writeStorageSecureFile(filePath, fileContent);
3469
3470
  this.invalidateAllMemoriesCache();
3470
3471
  await this.appendGeneratedMemoryLifecycleEventFailOpen("storage.writeMemory", {
3471
3472
  memoryId: id,
@@ -3638,7 +3639,7 @@ export class StorageManager {
3638
3639
  return "";
3639
3640
  }
3640
3641
  const filePath = path.join(dir, `${id}.md`);
3641
- await writeMaybeEncryptedFile(filePath, `${serializeFrontmatter(fm)}\n\n${sanitized.text}\n`, this.resolveWriteKey(), {}, this.baseDir);
3642
+ await this.writeStorageSecureFile(filePath, `${serializeFrontmatter(fm)}\n\n${sanitized.text}\n`);
3642
3643
  const actor =
3643
3644
  typeof options.actor === "string" && options.actor.length > 0
3644
3645
  ? options.actor
@@ -3876,7 +3877,7 @@ export class StorageManager {
3876
3877
  async writeProfile(content: string): Promise<void> {
3877
3878
  await this.ensureDirectories();
3878
3879
  await this.snapshotBeforeWrite(this.profilePath, "consolidation");
3879
- await writeMaybeEncryptedFile(this.profilePath, content, this.resolveWriteKey(), {}, this.baseDir);
3880
+ await this.writeStorageSecureFile(this.profilePath, content);
3880
3881
  log.debug("updated profile.md");
3881
3882
  }
3882
3883
 
@@ -4601,10 +4602,9 @@ export class StorageManager {
4601
4602
 
4602
4603
  private async writeMemoryFileAtomic(targetPath: string, memory: MemoryFile): Promise<void> {
4603
4604
  const fileContent = `${serializeFrontmatter(memory.frontmatter)}\n\n${memory.content}\n`;
4604
- // writeMaybeEncryptedFile handles atomic temp→rename internally and
4605
- // calls mkdir on the parent directory — no need to duplicate here.
4606
4605
  await writeMaybeEncryptedFile(targetPath, fileContent, this.resolveWriteKey(), {}, this.baseDir);
4607
4606
  this.invalidateAllMemoriesCache();
4607
+ this.notifyCatalogWrite();
4608
4608
  }
4609
4609
 
4610
4610
  async moveMemoryToPath(memory: MemoryFile, targetPath: string): Promise<void> {
@@ -4694,7 +4694,7 @@ export class StorageManager {
4694
4694
  const destPath = path.join(destDir, path.basename(memory.path));
4695
4695
 
4696
4696
  // Write to archive location first (encrypted if applicable), then remove original.
4697
- await writeMaybeEncryptedFile(destPath, fileContent, this.resolveWriteKey(), {}, this.baseDir);
4697
+ await this.writeStorageSecureFile(destPath, fileContent);
4698
4698
  await unlink(memory.path);
4699
4699
  this.invalidateAllMemoriesCache();
4700
4700
  await this.appendGeneratedMemoryLifecycleEventFailOpen(
@@ -4851,7 +4851,7 @@ export class StorageManager {
4851
4851
  log.warn(`updated memory content sanitized for ${id}; violations=${sanitized.violations.join(", ")}`);
4852
4852
  }
4853
4853
  const fileContent = `${serializeFrontmatter(updated)}\n\n${sanitized.text}\n`;
4854
- await writeMaybeEncryptedFile(memory.path, fileContent, this.resolveWriteKey(), {}, this.baseDir);
4854
+ await this.writeStorageSecureFile(memory.path, fileContent);
4855
4855
  this.invalidateAllMemoriesCache();
4856
4856
  await this.appendGeneratedMemoryLifecycleEventFailOpen("storage.updateMemory", {
4857
4857
  memoryId: id,
@@ -4886,7 +4886,7 @@ export class StorageManager {
4886
4886
  const afterStatus = updated.status ?? "active";
4887
4887
 
4888
4888
  const fileContent = `${serializeFrontmatter(updated)}\n\n${memory.content}\n`;
4889
- await writeMaybeEncryptedFile(memory.path, fileContent, this.resolveWriteKey(), {}, this.baseDir);
4889
+ await this.writeStorageSecureFile(memory.path, fileContent);
4890
4890
  this.invalidateAllMemoriesCache();
4891
4891
  // If the target file lives in cold/, bump the cold-version sentinel so
4892
4892
  // other processes detect the change on their next readAllColdMemories()
@@ -5826,7 +5826,7 @@ export class StorageManager {
5826
5826
  const content = `---\n${Object.entries(frontmatter).map(([k, v]) => `${k}: ${JSON.stringify(v)}`).join("\n")}\n---\n\n${question}\n\n**Context:** ${context}\n`;
5827
5827
 
5828
5828
  const filePath = path.join(this.questionsDir, `${id}.md`);
5829
- await writeFile(filePath, content, "utf-8");
5829
+ await this.writeStorageSecureFile(filePath, content);
5830
5830
 
5831
5831
  log.debug(`wrote question ${id} to ${filePath}`);
5832
5832
  this.invalidateQuestionsCache();
@@ -5942,13 +5942,13 @@ export class StorageManager {
5942
5942
  const q = questions.find((q) => q.id === id);
5943
5943
  if (!q) return false;
5944
5944
 
5945
- let raw = await readFile(q.filePath, "utf-8");
5945
+ let raw = await this.readStorageSecureFile(q.filePath);
5946
5946
  raw = raw.replace(/resolved: false/, "resolved: true");
5947
5947
  raw = raw.replace(
5948
5948
  /---\n\n/,
5949
5949
  `resolvedAt: "${new Date().toISOString()}"\n---\n\n`,
5950
5950
  );
5951
- await writeFile(q.filePath, raw, "utf-8");
5951
+ await this.writeStorageSecureFile(q.filePath, raw);
5952
5952
  log.debug(`resolved question ${id}`);
5953
5953
  return true;
5954
5954
  }
@@ -7080,7 +7080,7 @@ export class StorageManager {
7080
7080
  const fileContent = `${serializeFrontmatter(updatedFm)}\n\n${oldMemory.content}\n`;
7081
7081
 
7082
7082
  try {
7083
- await writeMaybeEncryptedFile(oldMemory.path, fileContent, this.resolveWriteKey(), {}, this.baseDir);
7083
+ await this.writeStorageSecureFile(oldMemory.path, fileContent);
7084
7084
  await this.appendGeneratedMemoryLifecycleEventFailOpen("storage.supersedeMemory", {
7085
7085
  memoryId: oldMemoryId,
7086
7086
  eventType: "superseded",