@remnic/core 9.7.7 → 9.7.9

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 (383) hide show
  1. package/dist/access-admin-ops-surface.d.ts +6 -6
  2. package/dist/access-admin-ops-surface.js +31 -29
  3. package/dist/access-audit.js +2 -2
  4. package/dist/access-boundary.d.ts +6 -6
  5. package/dist/access-boundary.js +32 -30
  6. package/dist/access-cli.js +88 -86
  7. package/dist/access-cli.js.map +1 -1
  8. package/dist/access-http.d.ts +6 -6
  9. package/dist/access-http.js +39 -37
  10. package/dist/access-identity-continuity-surface.d.ts +5 -5
  11. package/dist/access-identity-continuity-surface.js +31 -29
  12. package/dist/access-lcm-surface.d.ts +6 -6
  13. package/dist/access-lcm-surface.js +31 -29
  14. package/dist/access-mcp.d.ts +6 -6
  15. package/dist/access-mcp.js +36 -34
  16. package/dist/access-observe-write-surface.d.ts +6 -6
  17. package/dist/access-observe-write-surface.js +31 -29
  18. package/dist/access-operations-batch.js +34 -32
  19. package/dist/access-operations.d.ts +6 -6
  20. package/dist/access-operations.js +35 -33
  21. package/dist/access-recall-surface.d.ts +6 -6
  22. package/dist/access-recall-surface.js +31 -29
  23. package/dist/{access-service-CxDZXTKt.d.ts → access-service-DSuzikHQ.d.ts} +4 -4
  24. package/dist/access-service.d.ts +6 -6
  25. package/dist/access-service.js +31 -29
  26. package/dist/access-surface-catalog.d.ts +6 -6
  27. package/dist/action-confidence.d.ts +1 -1
  28. package/dist/active-memory-bridge.d.ts +1 -1
  29. package/dist/active-recall.d.ts +1 -1
  30. package/dist/active-recall.js +1 -1
  31. package/dist/adapters/index.js +4 -4
  32. package/dist/adapters/registry.js +2 -2
  33. package/dist/{auto-sync-676N6N6Y.js → auto-sync-AAMTVZMK.js} +5 -5
  34. package/dist/behavior-learner.d.ts +1 -1
  35. package/dist/behavior-signals.d.ts +1 -1
  36. package/dist/bootstrap.d.ts +5 -5
  37. package/dist/briefing.d.ts +2 -2
  38. package/dist/briefing.js +14 -12
  39. package/dist/buffer-surprise-report.d.ts +1 -1
  40. package/dist/buffer.d.ts +2 -2
  41. package/dist/bulk-import/index.d.ts +3 -3
  42. package/dist/calibration.d.ts +1 -1
  43. package/dist/calibration.js +2 -2
  44. package/dist/capabilities.d.ts +1 -1
  45. package/dist/{capsule-merge-GK5E647P.js → capsule-merge-Z2HUO6IK.js} +10 -2
  46. package/dist/capsule-merge-Z2HUO6IK.js.map +1 -0
  47. package/dist/{catalog-DzU9HowE.d.ts → catalog-BNwjACa5.d.ts} +1 -1
  48. package/dist/causal-behavior.d.ts +1 -1
  49. package/dist/causal-consolidation.d.ts +1 -1
  50. package/dist/causal-consolidation.js +15 -13
  51. package/dist/causal-consolidation.js.map +1 -1
  52. package/dist/causal-trajectory-graph.d.ts +1 -1
  53. package/dist/{chunk-TZJVTH3F.js → chunk-27VEKQQA.js} +14 -14
  54. package/dist/{chunk-JO5AT6QT.js → chunk-3ZVFLMFQ.js} +1 -1
  55. package/dist/chunk-3ZVFLMFQ.js.map +1 -0
  56. package/dist/{chunk-AD2KK5MT.js → chunk-5CFHYQU3.js} +9 -3
  57. package/dist/chunk-5CFHYQU3.js.map +1 -0
  58. package/dist/{chunk-7XH7VJN4.js → chunk-5S7Z5SHA.js} +2 -2
  59. package/dist/{chunk-TVVEYCNW.js → chunk-7K5Q6COX.js} +4 -4
  60. package/dist/{chunk-EJCVMPIM.js → chunk-7LMEY5KZ.js} +15 -1
  61. package/dist/chunk-7LMEY5KZ.js.map +1 -0
  62. package/dist/{chunk-3F4N4WDH.js → chunk-AHLPZ2SF.js} +2 -2
  63. package/dist/{chunk-AH3M6F4X.js → chunk-CDGGQGUU.js} +2 -2
  64. package/dist/{chunk-ZHKD4EZM.js → chunk-CK6RI52P.js} +3 -3
  65. package/dist/{chunk-6C35R7P4.js → chunk-DJCKXI4M.js} +2 -2
  66. package/dist/{chunk-GL3SMLMZ.js → chunk-DLPXS7BE.js} +109 -85
  67. package/dist/chunk-DLPXS7BE.js.map +1 -0
  68. package/dist/{chunk-NMMKRVUF.js → chunk-EIKBKQ6L.js} +6 -6
  69. package/dist/{chunk-O3BZ6PFY.js → chunk-F3FC7SMO.js} +2 -2
  70. package/dist/{chunk-ZW6OKHVX.js → chunk-FKCJH7KP.js} +2 -2
  71. package/dist/{chunk-DQPPRXFO.js → chunk-HQ7QZJM5.js} +2 -2
  72. package/dist/{chunk-UYZUJ4EB.js → chunk-I2THZUAF.js} +2 -2
  73. package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
  74. package/dist/{chunk-KIPLG7S7.js → chunk-JKLJ6A7W.js} +2 -2
  75. package/dist/{chunk-HXDKC3BI.js → chunk-JU3GHO6J.js} +2 -2
  76. package/dist/{chunk-74MJH7I3.js → chunk-KGNFFCZJ.js} +12 -3
  77. package/dist/chunk-KGNFFCZJ.js.map +1 -0
  78. package/dist/{chunk-Q6JPMCPO.js → chunk-KKASNHGF.js} +62 -57
  79. package/dist/chunk-KKASNHGF.js.map +1 -0
  80. package/dist/{chunk-R2SJDIPO.js → chunk-KPXAJ77O.js} +9 -7
  81. package/dist/chunk-KPXAJ77O.js.map +1 -0
  82. package/dist/{chunk-SYNYI4ZM.js → chunk-L5HJQC36.js} +2 -2
  83. package/dist/{chunk-VXMWDXIJ.js → chunk-LC7OODWZ.js} +2 -2
  84. package/dist/{chunk-CNWC274T.js → chunk-MLT5EG6K.js} +28 -28
  85. package/dist/{chunk-M5QKGHCR.js → chunk-OC35KQIN.js} +6 -2
  86. package/dist/chunk-OC35KQIN.js.map +1 -0
  87. package/dist/chunk-OKUEZOGW.js +27 -0
  88. package/dist/chunk-OKUEZOGW.js.map +1 -0
  89. package/dist/{chunk-PKGWJFNR.js → chunk-OVMS3DCB.js} +2 -2
  90. package/dist/chunk-PDJTHRAW.js +36 -0
  91. package/dist/chunk-PDJTHRAW.js.map +1 -0
  92. package/dist/{chunk-ZUFJ7ZTR.js → chunk-PHXCPVSX.js} +6 -2
  93. package/dist/chunk-PHXCPVSX.js.map +1 -0
  94. package/dist/{chunk-57INMZ6F.js → chunk-POUD5BLV.js} +2 -2
  95. package/dist/{chunk-KTOH7EJE.js → chunk-PV7E2FGY.js} +307 -43
  96. package/dist/chunk-PV7E2FGY.js.map +1 -0
  97. package/dist/{chunk-LRGSLV7M.js → chunk-PYHOAXTI.js} +4 -4
  98. package/dist/{chunk-WKE4VXSZ.js → chunk-QKVX4Y6D.js} +2 -2
  99. package/dist/{chunk-FXGC5UUH.js → chunk-RT7IP3D3.js} +2 -2
  100. package/dist/{chunk-CHVU4RE5.js → chunk-SKXBOZDF.js} +3 -3
  101. package/dist/{chunk-TVRPRFUB.js → chunk-TY43GBX2.js} +9 -7
  102. package/dist/chunk-TY43GBX2.js.map +1 -0
  103. package/dist/{chunk-UVIQHSS7.js → chunk-UP25ZZCN.js} +9 -3
  104. package/dist/chunk-UP25ZZCN.js.map +1 -0
  105. package/dist/{chunk-GKCCHHZK.js → chunk-UXKMMNJD.js} +4 -4
  106. package/dist/{chunk-XFTPUXCE.js → chunk-UXWGPODH.js} +4 -4
  107. package/dist/{chunk-2FSHROYK.js → chunk-V53GJUSL.js} +8 -8
  108. package/dist/{chunk-LKT755LP.js → chunk-VA4WSW54.js} +2 -2
  109. package/dist/{chunk-FYKIEOG6.js → chunk-VCFADTFS.js} +3 -3
  110. package/dist/{chunk-VF4XKTX3.js → chunk-VZ5OJE4X.js} +10 -2
  111. package/dist/chunk-VZ5OJE4X.js.map +1 -0
  112. package/dist/{chunk-AWJ2FHCF.js → chunk-X47LWMKA.js} +49 -21
  113. package/dist/chunk-X47LWMKA.js.map +1 -0
  114. package/dist/{chunk-VMGMY2AI.js → chunk-XG5CGR3K.js} +8 -8
  115. package/dist/{chunk-VMGMY2AI.js.map → chunk-XG5CGR3K.js.map} +1 -1
  116. package/dist/{chunk-T7VNN3ZM.js → chunk-XVLEGMJI.js} +2 -2
  117. package/dist/{chunk-CRFTLUWT.js → chunk-Y5U35ZVS.js} +2 -2
  118. package/dist/{chunk-UHGHTOR5.js → chunk-YGAOLHKN.js} +7 -7
  119. package/dist/{chunk-QDCJNRKK.js → chunk-YXOAQAH2.js} +3 -3
  120. package/dist/{cli-BqyGVyOe.d.ts → cli-DACyuK8-.d.ts} +5 -5
  121. package/dist/cli.d.ts +8 -8
  122. package/dist/cli.js +65 -63
  123. package/dist/compounding/engine.d.ts +2 -2
  124. package/dist/compounding/engine.js +14 -12
  125. package/dist/compounding/preference-consolidator.d.ts +1 -1
  126. package/dist/compression-optimizer.d.ts +1 -1
  127. package/dist/config.d.ts +1 -1
  128. package/dist/config.js +1 -1
  129. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  130. package/dist/connectors/codex-materialize-runner.js +14 -12
  131. package/dist/connectors/codex-materialize.d.ts +1 -1
  132. package/dist/connectors/index.d.ts +1 -1
  133. package/dist/connectors/index.js +14 -12
  134. package/dist/consolidation-provenance-check.d.ts +2 -2
  135. package/dist/consolidation-provenance-check.js +6 -2
  136. package/dist/consolidation-undo.d.ts +2 -2
  137. package/dist/consolidation-undo.js +8 -1
  138. package/dist/consolidation-undo.js.map +1 -1
  139. package/dist/contradiction/index.d.ts +2 -2
  140. package/dist/conversation-index/backend.d.ts +1 -1
  141. package/dist/conversation-index/chunker.d.ts +1 -1
  142. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  143. package/dist/conversation-index/indexer.d.ts +1 -1
  144. package/dist/conversation-index/search.d.ts +1 -1
  145. package/dist/day-summary.d.ts +1 -1
  146. package/dist/delinearize.d.ts +1 -1
  147. package/dist/direct-answer-wiring.d.ts +1 -1
  148. package/dist/direct-answer.d.ts +1 -1
  149. package/dist/embedding-fallback.d.ts +1 -1
  150. package/dist/enrichment/index.d.ts +1 -1
  151. package/dist/entity-retrieval.d.ts +2 -2
  152. package/dist/entity-retrieval.js +14 -12
  153. package/dist/entity-schema.d.ts +1 -1
  154. package/dist/explicit-capture.d.ts +5 -5
  155. package/dist/extraction-faithfulness.d.ts +1 -1
  156. package/dist/extraction-faithfulness.js +3 -3
  157. package/dist/extraction-judge-telemetry.d.ts +1 -1
  158. package/dist/extraction-judge-training.d.ts +1 -1
  159. package/dist/extraction-judge.d.ts +1 -1
  160. package/dist/extraction-judge.js +3 -3
  161. package/dist/extraction.d.ts +1 -1
  162. package/dist/extraction.js +3 -3
  163. package/dist/fallback-llm.d.ts +1 -1
  164. package/dist/fallback-llm.js +2 -2
  165. package/dist/{forget-KHF7A44H.js → forget-CQCLB5LB.js} +2 -2
  166. package/dist/graph-dashboard-diff.d.ts +1 -1
  167. package/dist/graph-dashboard-key.d.ts +1 -1
  168. package/dist/graph-dashboard-parser.d.ts +1 -1
  169. package/dist/graph-edge-reinforcement.d.ts +1 -1
  170. package/dist/graph-snapshot.d.ts +1 -1
  171. package/dist/graph.d.ts +1 -1
  172. package/dist/identity-continuity.d.ts +1 -1
  173. package/dist/importance.d.ts +1 -1
  174. package/dist/importers/index.d.ts +1 -1
  175. package/dist/in-flight-reads.d.ts +19 -0
  176. package/dist/in-flight-reads.js +16 -0
  177. package/dist/in-flight-reads.js.map +1 -0
  178. package/dist/index.d.ts +13 -13
  179. package/dist/index.js +105 -103
  180. package/dist/intent.d.ts +1 -1
  181. package/dist/lcm/engine.d.ts +1 -1
  182. package/dist/lcm/engine.js +2 -2
  183. package/dist/lcm/index.d.ts +1 -1
  184. package/dist/lcm/index.js +7 -7
  185. package/dist/lcm/tools.d.ts +1 -1
  186. package/dist/lifecycle.d.ts +1 -1
  187. package/dist/live-connectors-runner.d.ts +1 -1
  188. package/dist/local-llm.d.ts +1 -1
  189. package/dist/local-model-endpoint.d.ts +1 -1
  190. package/dist/maintenance/memory-governance.d.ts +1 -1
  191. package/dist/maintenance/memory-governance.js +14 -12
  192. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -12
  193. package/dist/maintenance/rebuild-memory-projection.js +15 -13
  194. package/dist/mcp-memory-inspector-app.d.ts +6 -6
  195. package/dist/memory-action-policy.d.ts +1 -1
  196. package/dist/memory-cache.d.ts +24 -13
  197. package/dist/memory-cache.js +3 -1
  198. package/dist/memory-corpus-version.d.ts +19 -0
  199. package/dist/memory-corpus-version.js +13 -0
  200. package/dist/memory-corpus-version.js.map +1 -0
  201. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  202. package/dist/memory-projection-store.d.ts +1 -1
  203. package/dist/memory-provenance.d.ts +1 -1
  204. package/dist/memory-worth-outcomes.d.ts +2 -2
  205. package/dist/models-json.d.ts +1 -1
  206. package/dist/namespaces/migrate.d.ts +3 -3
  207. package/dist/namespaces/migrate.js +21 -19
  208. package/dist/namespaces/principal.d.ts +1 -1
  209. package/dist/namespaces/search.d.ts +1 -1
  210. package/dist/namespaces/search.js +7 -7
  211. package/dist/namespaces/storage.d.ts +3 -3
  212. package/dist/namespaces/storage.js +14 -12
  213. package/dist/native-knowledge.d.ts +1 -1
  214. package/dist/operator-toolkit.d.ts +2 -2
  215. package/dist/operator-toolkit.js +26 -24
  216. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  217. package/dist/orchestration/maintenance.d.ts +2 -2
  218. package/dist/orchestration/maintenance.js +16 -14
  219. package/dist/{orchestrator-37Cx7yyw.d.ts → orchestrator-D83AvrPf.d.ts} +4 -4
  220. package/dist/orchestrator.d.ts +5 -5
  221. package/dist/orchestrator.js +88 -86
  222. package/dist/page-versioning.js +5 -1
  223. package/dist/patterns-cli.d.ts +1 -1
  224. package/dist/{pipeline-C6onljHc.d.ts → pipeline-BSqGpYl1.d.ts} +1 -1
  225. package/dist/policy-runtime.d.ts +1 -1
  226. package/dist/provenance.d.ts +1 -1
  227. package/dist/{qmd-J08G7MEm.d.ts → qmd-CutnpRVe.d.ts} +1 -1
  228. package/dist/qmd-preflight.d.ts +2 -2
  229. package/dist/qmd-recall-cache.d.ts +1 -1
  230. package/dist/qmd.d.ts +2 -2
  231. package/dist/qmd.js +2 -2
  232. package/dist/recall-disclosure-escalation.d.ts +1 -1
  233. package/dist/recall-explain-renderer.d.ts +1 -1
  234. package/dist/recall-explain-renderer.js +3 -3
  235. package/dist/recall-planner-llm.d.ts +1 -1
  236. package/dist/recall-planner-llm.js +2 -2
  237. package/dist/recall-state.d.ts +1 -1
  238. package/dist/recall-tag-filter.d.ts +1 -1
  239. package/dist/recall-timings.d.ts +1 -1
  240. package/dist/recall-xray-cli.d.ts +1 -1
  241. package/dist/recall-xray-cli.js +4 -4
  242. package/dist/recall-xray-renderer.d.ts +1 -1
  243. package/dist/recall-xray-renderer.js +3 -3
  244. package/dist/recall-xray.d.ts +1 -1
  245. package/dist/recall-xray.js +2 -2
  246. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  247. package/dist/replay/normalizers/claude.d.ts +1 -1
  248. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  249. package/dist/replay/normalizers/shared.d.ts +1 -1
  250. package/dist/replay/runner.d.ts +1 -1
  251. package/dist/replay/types.d.ts +1 -1
  252. package/dist/resolve-auth-token.d.ts +1 -1
  253. package/dist/resume-bundles.js +2 -2
  254. package/dist/retrieval-agents.d.ts +2 -2
  255. package/dist/retrieval-tiers.d.ts +1 -1
  256. package/dist/routing/engine.d.ts +1 -1
  257. package/dist/routing/store.d.ts +1 -1
  258. package/dist/search/embed-helper.d.ts +1 -1
  259. package/dist/search/factory.d.ts +1 -1
  260. package/dist/search/factory.js +6 -6
  261. package/dist/search/index.d.ts +1 -1
  262. package/dist/search/index.js +12 -12
  263. package/dist/search/lancedb-backend.d.ts +1 -1
  264. package/dist/search/meilisearch-backend.d.ts +1 -1
  265. package/dist/search/noop-backend.d.ts +1 -1
  266. package/dist/search/orama-backend.d.ts +1 -1
  267. package/dist/search/port.d.ts +1 -1
  268. package/dist/search/remote-backend.d.ts +1 -1
  269. package/dist/{semantic-consolidation-BFtoVosl.d.ts → semantic-consolidation-btIVRC4l.d.ts} +1 -1
  270. package/dist/semantic-consolidation.d.ts +2 -2
  271. package/dist/semantic-consolidation.js +15 -13
  272. package/dist/semantic-rule-promotion.js +14 -12
  273. package/dist/semantic-rule-verifier.d.ts +5 -1
  274. package/dist/semantic-rule-verifier.js +14 -12
  275. package/dist/session-observer-bands.d.ts +1 -1
  276. package/dist/session-observer-state.d.ts +1 -1
  277. package/dist/shared-context/manager.d.ts +1 -1
  278. package/dist/signal.d.ts +1 -1
  279. package/dist/{storage-CXjwBr69.d.ts → storage-BVv_Mqa0.d.ts} +133 -3
  280. package/dist/storage.d.ts +2 -2
  281. package/dist/storage.js +13 -11
  282. package/dist/summarizer.d.ts +1 -1
  283. package/dist/summarizer.js +3 -3
  284. package/dist/summary-snapshot.d.ts +1 -1
  285. package/dist/temporal-supersession.d.ts +2 -2
  286. package/dist/temporal-timeline-recall.d.ts +1 -1
  287. package/dist/temporal-validity.d.ts +1 -1
  288. package/dist/threading.d.ts +1 -1
  289. package/dist/tier-migration.d.ts +2 -2
  290. package/dist/tier-routing.d.ts +1 -1
  291. package/dist/topics.d.ts +1 -1
  292. package/dist/transcript.d.ts +1 -1
  293. package/dist/transfer/capsule-import.js +6 -2
  294. package/dist/transfer/import-sqlite.js +2 -2
  295. package/dist/trust-score-stage.d.ts +1 -1
  296. package/dist/trust-score.d.ts +1 -1
  297. package/dist/{types-DpxqC8dI.d.ts → types-Cmkz7csa.d.ts} +27 -0
  298. package/dist/types.d.ts +1 -1
  299. package/dist/types.js +1 -1
  300. package/dist/utility-runtime.d.ts +1 -1
  301. package/dist/verified-recall.d.ts +4 -0
  302. package/dist/verified-recall.js +14 -12
  303. package/package.json +12 -2
  304. package/src/binary-lifecycle/pipeline.ts +22 -0
  305. package/src/cli.ts +8 -0
  306. package/src/compounding/engine.ts +9 -1
  307. package/src/config.ts +14 -0
  308. package/src/consolidation-undo.ts +8 -0
  309. package/src/curation/index.ts +9 -0
  310. package/src/in-flight-reads.ts +63 -0
  311. package/src/maintenance/memory-governance.ts +6 -0
  312. package/src/memory-cache-hot.test.ts +131 -0
  313. package/src/memory-cache.ts +146 -22
  314. package/src/memory-corpus-version.ts +45 -0
  315. package/src/namespaces/storage.ts +20 -1
  316. package/src/operator-toolkit.ts +7 -1
  317. package/src/orchestration/recall-internal.ts +6 -3
  318. package/src/orchestrator.ts +25 -1
  319. package/src/page-versioning.ts +14 -1
  320. package/src/provenance-frontmatter.test.ts +6 -0
  321. package/src/review/index.ts +16 -8
  322. package/src/semantic-rule-promotion.ts +9 -1
  323. package/src/semantic-rule-verifier.ts +19 -6
  324. package/src/spaces/index.ts +10 -0
  325. package/src/storage/memory-read-store.ts +9 -2
  326. package/src/storage-contract/cache-coherence.test.ts +242 -0
  327. package/src/storage-contract/namespace-routing.test.ts +26 -1
  328. package/src/storage.ts +513 -31
  329. package/src/transfer/capsule-cache-coherence.test.ts +107 -0
  330. package/src/transfer/capsule-import.ts +8 -0
  331. package/src/transfer/capsule-merge.ts +7 -0
  332. package/src/types.ts +27 -0
  333. package/src/verified-recall.ts +20 -6
  334. package/dist/capsule-merge-GK5E647P.js.map +0 -1
  335. package/dist/chunk-74MJH7I3.js.map +0 -1
  336. package/dist/chunk-AD2KK5MT.js.map +0 -1
  337. package/dist/chunk-AWJ2FHCF.js.map +0 -1
  338. package/dist/chunk-EJCVMPIM.js.map +0 -1
  339. package/dist/chunk-GL3SMLMZ.js.map +0 -1
  340. package/dist/chunk-JO5AT6QT.js.map +0 -1
  341. package/dist/chunk-KTOH7EJE.js.map +0 -1
  342. package/dist/chunk-M5QKGHCR.js.map +0 -1
  343. package/dist/chunk-Q6JPMCPO.js.map +0 -1
  344. package/dist/chunk-R2SJDIPO.js.map +0 -1
  345. package/dist/chunk-TVRPRFUB.js.map +0 -1
  346. package/dist/chunk-UVIQHSS7.js.map +0 -1
  347. package/dist/chunk-VF4XKTX3.js.map +0 -1
  348. package/dist/chunk-ZUFJ7ZTR.js.map +0 -1
  349. /package/dist/{auto-sync-676N6N6Y.js.map → auto-sync-AAMTVZMK.js.map} +0 -0
  350. /package/dist/{chunk-TZJVTH3F.js.map → chunk-27VEKQQA.js.map} +0 -0
  351. /package/dist/{chunk-7XH7VJN4.js.map → chunk-5S7Z5SHA.js.map} +0 -0
  352. /package/dist/{chunk-TVVEYCNW.js.map → chunk-7K5Q6COX.js.map} +0 -0
  353. /package/dist/{chunk-3F4N4WDH.js.map → chunk-AHLPZ2SF.js.map} +0 -0
  354. /package/dist/{chunk-AH3M6F4X.js.map → chunk-CDGGQGUU.js.map} +0 -0
  355. /package/dist/{chunk-ZHKD4EZM.js.map → chunk-CK6RI52P.js.map} +0 -0
  356. /package/dist/{chunk-6C35R7P4.js.map → chunk-DJCKXI4M.js.map} +0 -0
  357. /package/dist/{chunk-NMMKRVUF.js.map → chunk-EIKBKQ6L.js.map} +0 -0
  358. /package/dist/{chunk-O3BZ6PFY.js.map → chunk-F3FC7SMO.js.map} +0 -0
  359. /package/dist/{chunk-ZW6OKHVX.js.map → chunk-FKCJH7KP.js.map} +0 -0
  360. /package/dist/{chunk-DQPPRXFO.js.map → chunk-HQ7QZJM5.js.map} +0 -0
  361. /package/dist/{chunk-UYZUJ4EB.js.map → chunk-I2THZUAF.js.map} +0 -0
  362. /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
  363. /package/dist/{chunk-KIPLG7S7.js.map → chunk-JKLJ6A7W.js.map} +0 -0
  364. /package/dist/{chunk-HXDKC3BI.js.map → chunk-JU3GHO6J.js.map} +0 -0
  365. /package/dist/{chunk-SYNYI4ZM.js.map → chunk-L5HJQC36.js.map} +0 -0
  366. /package/dist/{chunk-VXMWDXIJ.js.map → chunk-LC7OODWZ.js.map} +0 -0
  367. /package/dist/{chunk-CNWC274T.js.map → chunk-MLT5EG6K.js.map} +0 -0
  368. /package/dist/{chunk-PKGWJFNR.js.map → chunk-OVMS3DCB.js.map} +0 -0
  369. /package/dist/{chunk-57INMZ6F.js.map → chunk-POUD5BLV.js.map} +0 -0
  370. /package/dist/{chunk-LRGSLV7M.js.map → chunk-PYHOAXTI.js.map} +0 -0
  371. /package/dist/{chunk-WKE4VXSZ.js.map → chunk-QKVX4Y6D.js.map} +0 -0
  372. /package/dist/{chunk-FXGC5UUH.js.map → chunk-RT7IP3D3.js.map} +0 -0
  373. /package/dist/{chunk-CHVU4RE5.js.map → chunk-SKXBOZDF.js.map} +0 -0
  374. /package/dist/{chunk-GKCCHHZK.js.map → chunk-UXKMMNJD.js.map} +0 -0
  375. /package/dist/{chunk-XFTPUXCE.js.map → chunk-UXWGPODH.js.map} +0 -0
  376. /package/dist/{chunk-2FSHROYK.js.map → chunk-V53GJUSL.js.map} +0 -0
  377. /package/dist/{chunk-LKT755LP.js.map → chunk-VA4WSW54.js.map} +0 -0
  378. /package/dist/{chunk-FYKIEOG6.js.map → chunk-VCFADTFS.js.map} +0 -0
  379. /package/dist/{chunk-T7VNN3ZM.js.map → chunk-XVLEGMJI.js.map} +0 -0
  380. /package/dist/{chunk-CRFTLUWT.js.map → chunk-Y5U35ZVS.js.map} +0 -0
  381. /package/dist/{chunk-UHGHTOR5.js.map → chunk-YGAOLHKN.js.map} +0 -0
  382. /package/dist/{chunk-QDCJNRKK.js.map → chunk-YXOAQAH2.js.map} +0 -0
  383. /package/dist/{forget-KHF7A44H.js.map → forget-CQCLB5LB.js.map} +0 -0
@@ -37,20 +37,7 @@ import {
37
37
  import {
38
38
  SPECULATIVE_TTL_DAYS,
39
39
  confidenceTier
40
- } from "./chunk-JO5AT6QT.js";
41
- import {
42
- markProjectedMemoryPathInvalid,
43
- readProjectedGovernanceRecord,
44
- readProjectedMemoryBrowse,
45
- readProjectedMemoryState,
46
- readProjectedMemoryTimeline,
47
- updateProjectedMemoryPath
48
- } from "./chunk-RHOZ5LLO.js";
49
- import {
50
- getCachedEntities,
51
- invalidateAllForDir,
52
- setCachedEntities
53
- } from "./chunk-AWJ2FHCF.js";
40
+ } from "./chunk-3ZVFLMFQ.js";
54
41
  import {
55
42
  inferMemoryStatus,
56
43
  isArchivedMemoryPath,
@@ -61,6 +48,14 @@ import {
61
48
  normalizeProjectionPreview,
62
49
  normalizeProjectionTags
63
50
  } from "./chunk-SCU65EZI.js";
51
+ import {
52
+ markProjectedMemoryPathInvalid,
53
+ readProjectedGovernanceRecord,
54
+ readProjectedMemoryBrowse,
55
+ readProjectedMemoryState,
56
+ readProjectedMemoryTimeline,
57
+ updateProjectedMemoryPath
58
+ } from "./chunk-RHOZ5LLO.js";
64
59
  import {
65
60
  rotateMarkdownFileToArchive
66
61
  } from "./chunk-DM2T26WE.js";
@@ -76,14 +71,32 @@ import {
76
71
  import {
77
72
  parseFaithfulnessField,
78
73
  serializeFaithfulnessFields
79
- } from "./chunk-LKT755LP.js";
74
+ } from "./chunk-VA4WSW54.js";
80
75
  import {
81
76
  isConsolidationOperator,
82
77
  isValidDerivedFromEntry
83
78
  } from "./chunk-G7D6GZ5J.js";
84
79
  import {
85
80
  createVersion
86
- } from "./chunk-VF4XKTX3.js";
81
+ } from "./chunk-VZ5OJE4X.js";
82
+ import {
83
+ clearMemoryCache,
84
+ getCachedEntities,
85
+ getCachedMemories,
86
+ invalidateAllForDir,
87
+ invalidateDerivedAndGlobalForDir,
88
+ setCachedEntities,
89
+ setCachedMemories,
90
+ updateCacheOnDelete,
91
+ updateCacheOnWrite
92
+ } from "./chunk-X47LWMKA.js";
93
+ import {
94
+ clearInFlightReads,
95
+ deleteInFlightRead,
96
+ deleteInFlightReadsForDir,
97
+ getInFlightRead,
98
+ setInFlightRead
99
+ } from "./chunk-PDJTHRAW.js";
87
100
  import {
88
101
  computeContentHash,
89
102
  normalizeContent
@@ -339,8 +352,9 @@ var MemoryReadStore = class {
339
352
  async readAllColdMemories() {
340
353
  const coldRoot = this.deps.resolveTierRootDir("cold");
341
354
  const currentColdVersion = this.deps.readColdWriteVersion();
355
+ const keyId = this.deps.hotCacheKeyId();
342
356
  const cached = this.deps.storageManagerClass.coldMemoriesCache.get(coldRoot);
343
- if (cached && Date.now() - cached.loadedAt < this.deps.storageManagerClass.COLD_SCAN_CACHE_TTL_MS && cached.coldVersion === currentColdVersion) {
357
+ if (cached && cached.keyId === keyId && Date.now() - cached.loadedAt < this.deps.storageManagerClass.COLD_SCAN_CACHE_TTL_MS && cached.coldVersion === currentColdVersion) {
344
358
  return cached.memories;
345
359
  }
346
360
  const filePaths = [];
@@ -364,7 +378,7 @@ var MemoryReadStore = class {
364
378
  };
365
379
  await collectPaths(coldRoot);
366
380
  const memories = await this.deps.readParsedMemoriesFromPaths(filePaths, 50);
367
- this.deps.storageManagerClass.coldMemoriesCache.set(coldRoot, { memories, loadedAt: Date.now(), coldVersion: currentColdVersion });
381
+ this.deps.storageManagerClass.coldMemoriesCache.set(coldRoot, { memories, loadedAt: Date.now(), coldVersion: currentColdVersion, keyId });
368
382
  return memories;
369
383
  }
370
384
  /** Read a single memory file by its absolute path. Returns null if unreadable. */
@@ -3952,9 +3966,10 @@ function parseExtractionRetryStateEntries(raw) {
3952
3966
  return valid;
3953
3967
  }
3954
3968
  var StorageManager3 = class _StorageManager {
3955
- constructor(baseDir, entitySchemas) {
3969
+ constructor(baseDir, entitySchemas, hotMemoriesCacheEnabledOverride) {
3956
3970
  this.baseDir = baseDir;
3957
3971
  this.entitySchemas = entitySchemas;
3972
+ this.hotMemoriesCacheEnabled = hotMemoriesCacheEnabledOverride ?? _StorageManager.hotMemoriesCacheDefaultByDir.get(baseDir) ?? _StorageManager.hotMemoriesCacheDefault;
3958
3973
  this.loadAliasesSync();
3959
3974
  }
3960
3975
  baseDir;
@@ -3969,22 +3984,66 @@ var StorageManager3 = class _StorageManager {
3969
3984
  // 1 minute
3970
3985
  static artifactWriteVersionByDir = /* @__PURE__ */ new Map();
3971
3986
  static memoryStatusVersionByDir = /* @__PURE__ */ new Map();
3987
+ // Corpus version sentinel (issue #1902): bumped on every memory-FILE mutation
3988
+ // so the version-keyed hot-memories cache stays coherent across processes,
3989
+ // without touching memory-status (which would invalidate the entity cache on
3990
+ // every plain create). In-process fallback when the on-disk sentinel is
3991
+ // unavailable; canonical source is state/.memory-corpus-version.log.
3992
+ static memoryCorpusVersionByDir = /* @__PURE__ */ new Map();
3972
3993
  static secureStoreEntityCacheKeyIds = /* @__PURE__ */ new WeakMap();
3973
3994
  static nextSecureStoreEntityCacheKeyId = 1;
3974
3995
  // In-process fallback for the cold-write sentinel (used when the disk file
3975
3996
  // is not accessible). The canonical source of truth is state/cold-write.log.
3976
3997
  static coldWriteVersionByDir = /* @__PURE__ */ new Map();
3977
- // Module-level cache for readAllMemories() keyed by base directory.
3978
- // Shared across all StorageManager instances to avoid duplicate I/O when
3979
- // multiple concurrent callers (e.g. verifiedRecall + verifiedRules) read the
3980
- // same directory simultaneously. In-flight deduplication prevents multiple
3981
- // concurrent reads of the same directory.
3982
- //
3983
- // Stale-while-revalidate: once the cache has a value, subsequent reads after
3984
- // TTL expiry return the stale cached data immediately and kick off a background
3985
- // refresh. This eliminates the 13-60 s cold-scan penalty that would otherwise
3986
- // block recall requests every 5 minutes on large memory collections (80k+ files).
3987
- static allMemoriesInFlight = /* @__PURE__ */ new Map();
3998
+ /**
3999
+ * Process-wide default for the hot-memories result cache gate (issue #1902).
4000
+ * Set once from config by the orchestrator/access layer via
4001
+ * setHotMemoriesCacheDefault() so that EVERY StorageManager — including the
4002
+ * ephemeral instances recall sub-stages (verified-recall, semantic-rule
4003
+ * verification, ...) construct over the same dir — honors the operator's
4004
+ * hotMemoriesCacheEnabled setting. The constructor option overrides this
4005
+ * per-instance (tests). Defaults true (cache on).
4006
+ */
4007
+ static hotMemoriesCacheDefault = true;
4008
+ /**
4009
+ * Per-memory-directory override of the hot-cache gate (issue #1902, Codex
4010
+ * P2). setHotMemoriesCacheDefault(memoryDir, enabled) registers the
4011
+ * operator's setting keyed by dir, so a StorageManager constructed over that
4012
+ * dir honors ITS owning orchestrator's config — not merely the last
4013
+ * orchestrator constructed in the process. Unregistered dirs fall back to
4014
+ * the process-wide default above.
4015
+ */
4016
+ static hotMemoriesCacheDefaultByDir = /* @__PURE__ */ new Map();
4017
+ /**
4018
+ * Process-wide TTL (ms) safety net for the hot cache (issue #1902). Bounds
4019
+ * how long a version-keyed entry is served before a fresh disk scan, so
4020
+ * external filesystem edits (manual/git/editor) that don't bump the sentinel
4021
+ * self-heal. Set from config by the orchestrator via setHotMemoriesCacheDefault.
4022
+ * 0 disables the TTL (version invalidation only). Default 60s.
4023
+ */
4024
+ static hotMemoriesCacheTtlMs = 6e4;
4025
+ /**
4026
+ * Per-memory-directory override of the hot-cache TTL (issue #1902, Codex P2),
4027
+ * mirroring hotMemoriesCacheDefaultByDir. Registered by
4028
+ * setHotMemoriesCacheDefault so two orchestrators in one process with
4029
+ * different TTLs don't clobber each other's setting. Unregistered dirs fall
4030
+ * back to the process-wide default above.
4031
+ */
4032
+ static hotMemoriesCacheTtlByDir = /* @__PURE__ */ new Map();
4033
+ /**
4034
+ * Whether the process-wide hot-cache fallbacks (hotMemoriesCacheDefault /
4035
+ * hotMemoriesCacheTtlMs) have been seeded by the first
4036
+ * setHotMemoriesCacheDefault call (issue #1902, Cursor Low). Only the first
4037
+ * registration seeds them; later registrations touch ONLY their per-dir map
4038
+ * entry. This makes the process-wide fallback deterministic (first-writer,
4039
+ * by init order) instead of last-writer-wins, so a second orchestrator with
4040
+ * a divergent config cannot silently flip the fallback that unregistered
4041
+ * dirs resolve to. All REGISTERED dirs are isolated by the per-dir maps.
4042
+ */
4043
+ static hotMemoriesCacheProcessDefaultSeeded = false;
4044
+ // Module-level maps for readAllMemories() keyed by base directory, shared
4045
+ // across all StorageManager instances (static) so concurrent callers over
4046
+ // the same dir cooperate.
3988
4047
  // Cache for readAllColdMemories() — keyed by cold root directory path.
3989
4048
  // Prevents an uncached full-tree directory scan on every structured-attribute
3990
4049
  // write (Finding UOGi, PR #402 round-6). Invalidated when cold-tier content
@@ -4085,6 +4144,45 @@ var StorageManager3 = class _StorageManager {
4085
4144
  }
4086
4145
  return `secure-store:key:${id}`;
4087
4146
  }
4147
+ /**
4148
+ * Secure-store key identity for the version-keyed hot/archive memory caches
4149
+ * (issue #1902, Codex P1). Scopes cached DECRYPTED corpora by the key that
4150
+ * decrypted them, so a locked/unkeyed StorageManager for the same baseDir
4151
+ * never reads content another instance decrypted under a key (which would
4152
+ * bypass the locked-store error). Plaintext and locked stores share the ""
4153
+ * namespace; an unlocked encrypted store uses its per-key id.
4154
+ */
4155
+ hotCacheKeyId() {
4156
+ return this._secureStoreKey === null ? "" : this.getEntityCacheSecureStoreKey();
4157
+ }
4158
+ /**
4159
+ * Resolved hot-cache gate for THIS store (issue #1902, Cursor Medium): the
4160
+ * per-instance override if one was passed, else the per-dir/process default.
4161
+ * Recall sub-stages (verified-recall, semantic-rule) read this to honor the
4162
+ * operator's opt-out for their derived caches even when the caller omits the
4163
+ * flag in options.
4164
+ */
4165
+ isHotCacheEnabled() {
4166
+ return this.hotMemoriesCacheEnabled;
4167
+ }
4168
+ /**
4169
+ * Effective hot-cache TTL (ms) for this store's dir (issue #1902): the per-dir
4170
+ * registration if present, else the process-wide default. 0 disables the TTL.
4171
+ */
4172
+ hotCacheTtlMs() {
4173
+ return _StorageManager.hotMemoriesCacheTtlByDir.get(this.baseDir) ?? _StorageManager.hotMemoriesCacheTtlMs;
4174
+ }
4175
+ /**
4176
+ * True if `p` lives in this store's cold/ or archive/ tier (issue #1902,
4177
+ * Codex P2). Determined RELATIVE to baseDir — a substring scan of the
4178
+ * absolute path would misclassify every active path when memoryDir itself is
4179
+ * nested under a dir literally named "cold" or "archive" (e.g.
4180
+ * /srv/cold/remnic), skipping the patch and stranding a stale hot entry.
4181
+ */
4182
+ isColdOrArchiveTierPath(p) {
4183
+ const rel = path5.relative(this.baseDir, p);
4184
+ return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path5.sep}`) || rel.startsWith(`archive${path5.sep}`);
4185
+ }
4088
4186
  /**
4089
4187
  * Mark the secure-store as required for this storage instance.
4090
4188
  * When required and locked, writes throw SecureStoreLockedError
@@ -4172,6 +4270,25 @@ var StorageManager3 = class _StorageManager {
4172
4270
  return null;
4173
4271
  }
4174
4272
  }
4273
+ hotMemoriesCacheEnabled;
4274
+ /** Set the process-wide hot-memories cache default (issue #1902). The
4275
+ * orchestrator/access layer calls this with the operator's
4276
+ * hotMemoriesCacheEnabled config so the escape hatch reaches every
4277
+ * StorageManager, including ephemeral recall-sub-stage instances. Only an
4278
+ * explicit `false` disables; `undefined` (e.g. a cast test config missing
4279
+ * the field) leaves the cache on. */
4280
+ static setHotMemoriesCacheDefault(memoryDir, enabled, ttlMs) {
4281
+ _StorageManager.hotMemoriesCacheDefaultByDir.set(memoryDir, enabled !== false);
4282
+ const ttlValid = typeof ttlMs === "number" && Number.isFinite(ttlMs) && ttlMs >= 0;
4283
+ if (ttlValid) {
4284
+ _StorageManager.hotMemoriesCacheTtlByDir.set(memoryDir, ttlMs);
4285
+ }
4286
+ if (!_StorageManager.hotMemoriesCacheProcessDefaultSeeded) {
4287
+ _StorageManager.hotMemoriesCacheDefault = enabled !== false;
4288
+ if (ttlValid) _StorageManager.hotMemoriesCacheTtlMs = ttlMs;
4289
+ _StorageManager.hotMemoriesCacheProcessDefaultSeeded = true;
4290
+ }
4291
+ }
4175
4292
  /**
4176
4293
  * The LIVE class object of this instance (issue #1809 review of the
4177
4294
  * storage decomposition): extracted store modules must read/write the
@@ -4221,7 +4338,7 @@ var StorageManager3 = class _StorageManager {
4221
4338
  return path5.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
4222
4339
  }
4223
4340
  versionFilePath(kind) {
4224
- const fileName = kind === "memory-status" ? ".memory-status-version.log" : kind === "artifact-write" ? ".artifact-write-version.log" : ".cold-write-version.log";
4341
+ const fileName = kind === "memory-status" ? ".memory-status-version.log" : kind === "artifact-write" ? ".artifact-write-version.log" : kind === "cold-write" ? ".cold-write-version.log" : ".memory-corpus-version.log";
4225
4342
  return path5.join(this.stateDir, fileName);
4226
4343
  }
4227
4344
  bumpSharedVersion(kind, fallbackMap) {
@@ -4248,11 +4365,56 @@ var StorageManager3 = class _StorageManager {
4248
4365
  }
4249
4366
  bumpMemoryStatusVersion() {
4250
4367
  this.bumpSharedVersion("memory-status", _StorageManager.memoryStatusVersionByDir);
4368
+ this.bumpSharedVersion("memory-corpus", _StorageManager.memoryCorpusVersionByDir);
4251
4369
  invalidateAllForDir(this.baseDir);
4252
4370
  }
4253
4371
  getMemoryStatusVersion() {
4254
4372
  return this.readSharedVersion("memory-status", _StorageManager.memoryStatusVersionByDir);
4255
4373
  }
4374
+ /**
4375
+ * Corpus version sentinel for the hot-memories result cache (issue #1902).
4376
+ * Distinct from memory-status: it bumps on EVERY memory-file mutation
4377
+ * (create/update/delete/bulk) so the version-keyed hot cache stays coherent
4378
+ * across processes, WITHOUT bumping memory-status — which would needlessly
4379
+ * invalidate the version-keyed entity cache on every plain fact create (the
4380
+ * ki-spike regression the sibling perf work removes). memory-status keeps its
4381
+ * lifecycle/status/entity semantics unchanged.
4382
+ */
4383
+ getMemoryCorpusVersion() {
4384
+ return this.readSharedVersion("memory-corpus", _StorageManager.memoryCorpusVersionByDir);
4385
+ }
4386
+ bumpMemoryCorpusVersion() {
4387
+ this.bumpSharedVersion("memory-corpus", _StorageManager.memoryCorpusVersionByDir);
4388
+ deleteInFlightReadsForDir(this.baseDir);
4389
+ }
4390
+ /**
4391
+ * Corpus bump that reports whether THIS process's append was the only one
4392
+ * since the pre-bump size (issue #1902, Codex P1). appendFileSync is atomic
4393
+ * per write, but a peer process can append concurrently; the `exclusive`
4394
+ * flag lets patchHotMemoriesCache refuse to re-key its locally patched
4395
+ * (peer-incomplete) corpus at a version that already reflects a peer's
4396
+ * still-unread write.
4397
+ */
4398
+ bumpMemoryCorpusVersionExclusive() {
4399
+ const filePath = this.versionFilePath("memory-corpus");
4400
+ try {
4401
+ mkdirSync(this.stateDir, { recursive: true });
4402
+ let before = 0;
4403
+ try {
4404
+ before = statSync(filePath).size;
4405
+ } catch {
4406
+ before = 0;
4407
+ }
4408
+ appendFileSync(filePath, "x");
4409
+ const produced = statSync(filePath).size;
4410
+ _StorageManager.memoryCorpusVersionByDir.set(this.baseDir, produced);
4411
+ return { produced, exclusive: produced === before + 1 };
4412
+ } catch {
4413
+ const next = (_StorageManager.memoryCorpusVersionByDir.get(this.baseDir) ?? 0) + 1;
4414
+ _StorageManager.memoryCorpusVersionByDir.set(this.baseDir, next);
4415
+ return { produced: next, exclusive: true };
4416
+ }
4417
+ }
4256
4418
  bumpArtifactWriteVersion() {
4257
4419
  return this.bumpSharedVersion("artifact-write", _StorageManager.artifactWriteVersionByDir);
4258
4420
  }
@@ -4990,6 +5152,9 @@ var StorageManager3 = class _StorageManager {
4990
5152
  await mkdir(this.identityAuditsWeeklyDir, { recursive: true });
4991
5153
  await mkdir(this.identityAuditsMonthlyDir, { recursive: true });
4992
5154
  await mkdir(path5.join(this.baseDir, "config"), { recursive: true });
5155
+ if (this.hotMemoriesCacheEnabled && this.getMemoryCorpusVersion() === 0) {
5156
+ this.bumpMemoryCorpusVersion();
5157
+ }
4993
5158
  }
4994
5159
  /**
4995
5160
  * Resolve the on-disk write path for a memory of the given category, creating
@@ -5133,7 +5298,7 @@ ${sanitized.text}
5133
5298
  const filePath = await this.resolveCategoryWritePath(category, id, today);
5134
5299
  await this.snapshotBeforeWrite(filePath, "write");
5135
5300
  await this.writeStorageSecureFile(filePath, fileContent);
5136
- this.invalidateAllMemoriesCache();
5301
+ await this.patchHotMemoriesCache({ addedPath: filePath });
5137
5302
  await this.appendGeneratedMemoryLifecycleEventFailOpen("storage.writeMemory", {
5138
5303
  memoryId: id,
5139
5304
  eventType: "created",
@@ -5399,16 +5564,31 @@ ${sanitized.text}
5399
5564
  return lineCount > threshold;
5400
5565
  }
5401
5566
  async readAllMemories() {
5402
- const inFlight = _StorageManager.allMemoriesInFlight.get(this.baseDir);
5567
+ if (this.hotMemoriesCacheEnabled) {
5568
+ const cached = getCachedMemories(
5569
+ this.baseDir,
5570
+ this.getMemoryCorpusVersion(),
5571
+ this.hotCacheKeyId(),
5572
+ this.hotCacheTtlMs()
5573
+ );
5574
+ if (cached !== null) return cached;
5575
+ }
5576
+ const keyId = this.hotCacheKeyId();
5577
+ const inFlight = getInFlightRead(this.baseDir, keyId);
5403
5578
  if (inFlight) return inFlight;
5404
- const readPromise = this._readAllMemoriesFromDisk();
5405
- _StorageManager.allMemoriesInFlight.set(this.baseDir, readPromise);
5579
+ const readPromise = (async () => {
5580
+ const version = this.getMemoryCorpusVersion();
5581
+ const memories = await this._readAllMemoriesFromDisk();
5582
+ if (this.hotMemoriesCacheEnabled && this.getMemoryCorpusVersion() === version && this.hotCacheKeyId() === keyId) {
5583
+ setCachedMemories(this.baseDir, memories, version, keyId, this.hotCacheTtlMs());
5584
+ }
5585
+ return memories;
5586
+ })();
5587
+ setInFlightRead(this.baseDir, keyId, readPromise);
5406
5588
  try {
5407
5589
  return await readPromise;
5408
5590
  } finally {
5409
- if (_StorageManager.allMemoriesInFlight.get(this.baseDir) === readPromise) {
5410
- _StorageManager.allMemoriesInFlight.delete(this.baseDir);
5411
- }
5591
+ deleteInFlightRead(this.baseDir, keyId, readPromise);
5412
5592
  }
5413
5593
  }
5414
5594
  /** Invalidate the readAllMemories() cache after writes that add/remove memories. */
@@ -5438,9 +5618,15 @@ ${sanitized.text}
5438
5618
  /** Clear ALL static caches. Use in tests that write files directly
5439
5619
  * (bypassing StorageManager.writeMemory) to avoid stale reads. */
5440
5620
  static clearAllStaticCaches() {
5441
- _StorageManager.allMemoriesInFlight.clear();
5621
+ clearInFlightReads();
5442
5622
  _StorageManager.questionsCache.clear();
5443
5623
  _StorageManager.coldMemoriesCache.clear();
5624
+ clearMemoryCache();
5625
+ _StorageManager.hotMemoriesCacheDefaultByDir.clear();
5626
+ _StorageManager.hotMemoriesCacheTtlByDir.clear();
5627
+ _StorageManager.hotMemoriesCacheDefault = true;
5628
+ _StorageManager.hotMemoriesCacheTtlMs = 6e4;
5629
+ _StorageManager.hotMemoriesCacheProcessDefaultSeeded = false;
5444
5630
  }
5445
5631
  /** Cancel any in-flight concurrent read so the next readAllMemories()
5446
5632
  * starts a fresh disk scan and sees the just-written data.
@@ -5455,7 +5641,8 @@ ${sanitized.text}
5455
5641
  * cold content actually changes (hot→cold demotions, writeMemoryFileAtomic
5456
5642
  * inside cold/, archiveMemory, etc.). */
5457
5643
  invalidateAllMemoriesCache() {
5458
- _StorageManager.allMemoriesInFlight.delete(this.baseDir);
5644
+ deleteInFlightReadsForDir(this.baseDir);
5645
+ this.bumpMemoryCorpusVersion();
5459
5646
  invalidateAllForDir(this.baseDir);
5460
5647
  if (this.tombstoneStore) {
5461
5648
  this.tombstoneStore.invalidate();
@@ -5463,6 +5650,57 @@ ${sanitized.text}
5463
5650
  this.tombstoneStoreLoadPromise = null;
5464
5651
  }
5465
5652
  }
5653
+ /**
5654
+ * Single-file write/delete fast path for the hot-memories cache (issue
5655
+ * #1902). Keeps THIS process's version-keyed corpus entry warm by patching
5656
+ * the changed memory in place, bumps the dedicated `.memory-corpus-version.log`
5657
+ * sentinel so PEER processes rescan (memory-status is deliberately NOT bumped
5658
+ * here so plain creates/content edits don't invalidate the entity cache), and
5659
+ * evicts only the derived/global layers (which
5660
+ * are cheap to rebuild and are never patched). Mirrors the in-flight-dedup
5661
+ * and tombstone-store invalidation that invalidateAllMemoriesCache() does.
5662
+ *
5663
+ * `added` is the written MemoryFile (writes/overwrites); `removedPath` is a
5664
+ * deleted path. A path outside the active scan roots (under cold/ or
5665
+ * archive/) is NOT applied to the hot map — that cache holds active memories
5666
+ * only — but the version bump and derived/global eviction still run so
5667
+ * coherence is preserved. Bulk/ambiguous mutations keep the wholesale
5668
+ * invalidateAllMemoriesCache() drop instead (issue #1902 Step 5).
5669
+ */
5670
+ async patchHotMemoriesCache(opts) {
5671
+ const prevVersion = this.getMemoryCorpusVersion();
5672
+ const keyId = this.hotCacheKeyId();
5673
+ const warm = this.hotMemoriesCacheEnabled && getCachedMemories(this.baseDir, prevVersion, keyId, this.hotCacheTtlMs()) !== null;
5674
+ if (warm && opts.removedPath !== void 0 && !this.isColdOrArchiveTierPath(opts.removedPath)) {
5675
+ updateCacheOnDelete(this.baseDir, opts.removedPath, keyId);
5676
+ }
5677
+ const { produced, exclusive } = this.bumpMemoryCorpusVersionExclusive();
5678
+ deleteInFlightReadsForDir(this.baseDir);
5679
+ let patchedOk = warm;
5680
+ if (warm && opts.addedPath !== void 0 && !this.isColdOrArchiveTierPath(opts.addedPath)) {
5681
+ let parsed;
5682
+ try {
5683
+ [parsed] = await this.readParsedMemoriesFromPaths([opts.addedPath], 1);
5684
+ } catch {
5685
+ parsed = void 0;
5686
+ }
5687
+ if (parsed) {
5688
+ updateCacheOnWrite(this.baseDir, parsed, keyId);
5689
+ } else {
5690
+ patchedOk = false;
5691
+ }
5692
+ }
5693
+ if (patchedOk && exclusive && produced === prevVersion + 1 && this.getMemoryCorpusVersion() === produced && this.hotCacheKeyId() === keyId) {
5694
+ const patched = getCachedMemories(this.baseDir, prevVersion, keyId);
5695
+ if (patched) setCachedMemories(this.baseDir, patched, produced, keyId, this.hotCacheTtlMs());
5696
+ }
5697
+ invalidateDerivedAndGlobalForDir(this.baseDir);
5698
+ if (this.tombstoneStore) {
5699
+ this.tombstoneStore.invalidate();
5700
+ this.tombstoneStore = null;
5701
+ this.tombstoneStoreLoadPromise = null;
5702
+ }
5703
+ }
5466
5704
  /**
5467
5705
  * Invalidate the cold-scan cache for this storage root and bump the
5468
5706
  * on-disk cold-version sentinel so that other processes (gateway, CLI) see
@@ -5881,7 +6119,7 @@ ${memory.content}
5881
6119
  ${sanitized.text}
5882
6120
  `;
5883
6121
  await this.writeStorageSecureFile(memory.path, fileContent);
5884
- this.invalidateAllMemoriesCache();
6122
+ await this.patchHotMemoriesCache({ addedPath: memory.path });
5885
6123
  await this.appendGeneratedMemoryLifecycleEventFailOpen("storage.updateMemory", {
5886
6124
  memoryId: id,
5887
6125
  eventType: "updated",
@@ -5913,7 +6151,7 @@ ${sanitized.text}
5913
6151
  ${memory.content}
5914
6152
  `;
5915
6153
  await this.writeStorageSecureFile(memory.path, fileContent);
5916
- this.invalidateAllMemoriesCache();
6154
+ await this.patchHotMemoriesCache({ addedPath: memory.path });
5917
6155
  if (memory.path.includes(`${path5.sep}cold${path5.sep}`)) {
5918
6156
  this.invalidateColdMemoriesCache();
5919
6157
  }
@@ -5971,6 +6209,7 @@ ${memory.content}
5971
6209
  try {
5972
6210
  await unlink2(m.path);
5973
6211
  markProjectedMemoryPathInvalid(this.baseDir, m.frontmatter.id);
6212
+ this.bumpMemoryCorpusVersion();
5974
6213
  deleted.push(m);
5975
6214
  log.debug(`cleaned expired memory ${m.frontmatter.id} (TTL expired)`);
5976
6215
  } catch {
@@ -6761,6 +7000,7 @@ ${reflection}
6761
7000
  try {
6762
7001
  await unlink2(m.path);
6763
7002
  markProjectedMemoryPathInvalid(this.baseDir, m.frontmatter.id);
7003
+ this.bumpMemoryCorpusVersion();
6764
7004
  deleted.push(m);
6765
7005
  log.debug(`cleaned expired commitment ${m.frontmatter.id}`);
6766
7006
  } catch {
@@ -6784,6 +7024,10 @@ ${reflection}
6784
7024
  const memories = await this.readAllMemories();
6785
7025
  const memoryMap = new Map(memories.map((m) => [m.frontmatter.id, m]));
6786
7026
  let updated = 0;
7027
+ const prevVersion = this.getMemoryCorpusVersion();
7028
+ const keyId = this.hotCacheKeyId();
7029
+ const warm = this.hotMemoriesCacheEnabled && getCachedMemories(this.baseDir, prevVersion, keyId, this.hotCacheTtlMs()) !== null;
7030
+ const appliedPatches = /* @__PURE__ */ new Map();
6787
7031
  for (const entry of entries) {
6788
7032
  const memory = memoryMap.get(entry.memoryId);
6789
7033
  if (!memory) continue;
@@ -6798,12 +7042,29 @@ ${reflection}
6798
7042
  ${memory.content}
6799
7043
  `;
6800
7044
  await this.writeStorageSecureFile(memory.path, fileContent);
7045
+ if (warm) {
7046
+ updateCacheOnWrite(this.baseDir, { ...memory, frontmatter: newFm }, keyId);
7047
+ }
7048
+ appliedPatches.set(entry.memoryId, { accessCount: entry.newCount, lastAccessed: entry.lastAccessed });
6801
7049
  updated++;
6802
7050
  } catch (err) {
6803
7051
  log.debug(`failed to update access tracking for ${entry.memoryId}: ${err}`);
6804
7052
  }
6805
7053
  }
6806
7054
  if (updated > 0) {
7055
+ const { produced, exclusive } = this.bumpMemoryCorpusVersionExclusive();
7056
+ deleteInFlightReadsForDir(this.baseDir);
7057
+ if (warm && exclusive && produced === prevVersion + 1 && this.getMemoryCorpusVersion() === produced && this.hotCacheKeyId() === keyId) {
7058
+ const cur = getCachedMemories(this.baseDir, prevVersion, keyId);
7059
+ if (cur) {
7060
+ const reapplied = cur.map((m) => {
7061
+ const patch = appliedPatches.get(m.frontmatter.id);
7062
+ return patch ? { ...m, frontmatter: { ...m.frontmatter, accessCount: patch.accessCount, lastAccessed: patch.lastAccessed } } : m;
7063
+ });
7064
+ setCachedMemories(this.baseDir, reapplied, produced, keyId, this.hotCacheTtlMs());
7065
+ }
7066
+ }
7067
+ invalidateDerivedAndGlobalForDir(this.baseDir);
6807
7068
  log.debug(`flushed access tracking for ${updated} memories`);
6808
7069
  }
6809
7070
  return updated;
@@ -6943,6 +7204,7 @@ ${sanitized.text}
6943
7204
  `;
6944
7205
  const filePath = await this.resolveCategoryWritePath(category, id, today);
6945
7206
  await this.writeStorageSecureFile(filePath, fileContent);
7207
+ await this.patchHotMemoriesCache({ addedPath: filePath });
6946
7208
  log.debug(`wrote chunk ${id} (${chunkIndex + 1}/${chunkTotal}) to ${filePath}`);
6947
7209
  return id;
6948
7210
  }
@@ -6979,6 +7241,7 @@ ${oldMemory.content}
6979
7241
  `;
6980
7242
  try {
6981
7243
  await this.writeStorageSecureFile(oldMemory.path, fileContent);
7244
+ this.bumpMemoryCorpusVersion();
6982
7245
  await this.appendGeneratedMemoryLifecycleEventFailOpen("storage.supersedeMemory", {
6983
7246
  memoryId: oldMemoryId,
6984
7247
  eventType: "superseded",
@@ -7082,6 +7345,7 @@ Reason: ${reason}`, {
7082
7345
  ${memory.content}
7083
7346
  `;
7084
7347
  await this.writeStorageSecureFile(memory.path, fileContent);
7348
+ this.bumpMemoryCorpusVersion();
7085
7349
  await this.appendGeneratedMemoryLifecycleEventFailOpen("storage.archiveMemories", {
7086
7350
  memoryId: id,
7087
7351
  eventType: "archived",
@@ -7231,4 +7495,4 @@ export {
7231
7495
  isValidBufferSurpriseEvent,
7232
7496
  StorageManager3 as StorageManager
7233
7497
  };
7234
- //# sourceMappingURL=chunk-KTOH7EJE.js.map
7498
+ //# sourceMappingURL=chunk-PV7E2FGY.js.map