@remnic/core 9.3.728 → 9.3.730

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 (348) hide show
  1. package/dist/access-boundary.d.ts +6 -5
  2. package/dist/access-boundary.js +13 -13
  3. package/dist/access-cli.js +34 -33
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +6 -5
  6. package/dist/access-http.js +19 -19
  7. package/dist/access-mcp.d.ts +6 -5
  8. package/dist/access-mcp.js +18 -18
  9. package/dist/access-operations-batch.js +16 -16
  10. package/dist/access-operations.d.ts +7 -6
  11. package/dist/access-operations.js +17 -17
  12. package/dist/access-schema.d.ts +4 -4
  13. package/dist/{access-service-Bgpjxo4f.d.ts → access-service-Byoe3HsT.d.ts} +18 -3
  14. package/dist/access-service.d.ts +6 -5
  15. package/dist/access-service.js +12 -12
  16. package/dist/access-surface-catalog.d.ts +6 -5
  17. package/dist/action-confidence.d.ts +1 -1
  18. package/dist/active-memory-bridge.d.ts +1 -1
  19. package/dist/active-recall.d.ts +1 -1
  20. package/dist/active-recall.js +2 -2
  21. package/dist/{auto-sync-F3KCSQFJ.js → auto-sync-G3V5AN4C.js} +2 -2
  22. package/dist/behavior-learner.d.ts +1 -1
  23. package/dist/behavior-signals.d.ts +1 -1
  24. package/dist/bootstrap.d.ts +5 -4
  25. package/dist/briefing.d.ts +1 -1
  26. package/dist/briefing.js +3 -3
  27. package/dist/buffer-surprise-report.d.ts +1 -1
  28. package/dist/buffer.d.ts +1 -1
  29. package/dist/calibration.d.ts +1 -1
  30. package/dist/capabilities.d.ts +55 -2
  31. package/dist/capabilities.js +5 -1
  32. package/dist/{catalog-bMczlO2G.d.ts → catalog-DM1nk7cM.d.ts} +1 -1
  33. package/dist/causal-behavior.d.ts +1 -1
  34. package/dist/causal-consolidation.d.ts +1 -1
  35. package/dist/causal-consolidation.js +4 -4
  36. package/dist/causal-trajectory-graph.d.ts +1 -1
  37. package/dist/{chunk-4NOI577P.js → chunk-24ZLC5QN.js} +2 -2
  38. package/dist/{chunk-DMQWV6SQ.js → chunk-5RZOFIDL.js} +2 -2
  39. package/dist/{chunk-UM5AWJNQ.js → chunk-646B5ERJ.js} +62 -37
  40. package/dist/chunk-646B5ERJ.js.map +1 -0
  41. package/dist/{chunk-H5BWGCRZ.js → chunk-6TUWSUUD.js} +51 -47
  42. package/dist/{chunk-H5BWGCRZ.js.map → chunk-6TUWSUUD.js.map} +1 -1
  43. package/dist/{chunk-36SEDFAU.js → chunk-C5WN74HH.js} +2 -2
  44. package/dist/{chunk-MLKWJOAJ.js → chunk-CGPHMNL4.js} +2 -2
  45. package/dist/{chunk-R6OVFAX6.js → chunk-DJECGBBM.js} +7 -2
  46. package/dist/{chunk-R6OVFAX6.js.map → chunk-DJECGBBM.js.map} +1 -1
  47. package/dist/{chunk-3RCBIOOJ.js → chunk-ESF7TRYJ.js} +18 -2
  48. package/dist/{chunk-3RCBIOOJ.js.map → chunk-ESF7TRYJ.js.map} +1 -1
  49. package/dist/{chunk-EY6MDMHK.js → chunk-F6OEXJQQ.js} +2 -2
  50. package/dist/{chunk-M4V2JVSZ.js → chunk-FFUCCKPN.js} +2 -2
  51. package/dist/{chunk-O6YH5F47.js → chunk-FYWUNVFZ.js} +8 -8
  52. package/dist/{chunk-37436GML.js → chunk-GEXI357K.js} +2 -2
  53. package/dist/{chunk-YGIQORJ3.js → chunk-GGL34GCW.js} +3 -3
  54. package/dist/{chunk-4H4F3BFL.js → chunk-GXTYEG7Q.js} +3 -3
  55. package/dist/{chunk-4H4F3BFL.js.map → chunk-GXTYEG7Q.js.map} +1 -1
  56. package/dist/{chunk-WAS3NV46.js → chunk-H3MB3F62.js} +2 -2
  57. package/dist/{chunk-UTHQPSRC.js → chunk-HHNSLPX7.js} +11 -8
  58. package/dist/chunk-HHNSLPX7.js.map +1 -0
  59. package/dist/{chunk-76NHR6ZL.js → chunk-HJWQJUKQ.js} +4 -4
  60. package/dist/{chunk-Y4YD5TYW.js → chunk-IIBFCZA7.js} +3 -3
  61. package/dist/{chunk-UVPL565C.js → chunk-IQOEW5YV.js} +2 -2
  62. package/dist/{chunk-V4GNSDFH.js → chunk-KQYGNGON.js} +2 -2
  63. package/dist/{chunk-CBWI22JN.js → chunk-KSJCXXOU.js} +2 -2
  64. package/dist/{chunk-M4AYVEWS.js → chunk-LUCARK4W.js} +12 -11
  65. package/dist/chunk-LUCARK4W.js.map +1 -0
  66. package/dist/{chunk-I5REUWLH.js → chunk-NIZQH6AU.js} +3 -3
  67. package/dist/{chunk-4ESAR77N.js → chunk-NOU77OHX.js} +2 -2
  68. package/dist/{chunk-BQCHEV7O.js → chunk-O4ZIBPIW.js} +3 -3
  69. package/dist/{chunk-HOHVIVDR.js → chunk-OBJUKYDO.js} +2 -2
  70. package/dist/{chunk-YKBHOBJK.js → chunk-OEHCMALU.js} +56 -4
  71. package/dist/chunk-OEHCMALU.js.map +1 -0
  72. package/dist/{chunk-YOLZS7NY.js → chunk-OTQE66IX.js} +2 -2
  73. package/dist/{chunk-QNEUZIAH.js → chunk-OUITHS6V.js} +381 -433
  74. package/dist/chunk-OUITHS6V.js.map +1 -0
  75. package/dist/{chunk-4T3BMHKD.js → chunk-OZECYVGI.js} +20 -7
  76. package/dist/chunk-OZECYVGI.js.map +1 -0
  77. package/dist/{chunk-C2PG7IEH.js → chunk-P3VJCTVE.js} +2 -2
  78. package/dist/{chunk-EH5ED3C6.js → chunk-PMAQRUN4.js} +4 -4
  79. package/dist/chunk-PMAQRUN4.js.map +1 -0
  80. package/dist/{chunk-7RLCCNHU.js → chunk-Q6BAA57B.js} +4 -3
  81. package/dist/chunk-Q6BAA57B.js.map +1 -0
  82. package/dist/{chunk-HGNOCPZX.js → chunk-QZHF4BWN.js} +6 -6
  83. package/dist/chunk-SYX73XD7.js +283 -0
  84. package/dist/chunk-SYX73XD7.js.map +1 -0
  85. package/dist/{chunk-ASKXIAHD.js → chunk-WDJCZQB4.js} +2 -2
  86. package/dist/{chunk-AQLOP5F4.js → chunk-WNGXQMRI.js} +95 -6
  87. package/dist/chunk-WNGXQMRI.js.map +1 -0
  88. package/dist/{chunk-JYLFZWUX.js → chunk-XYUFGHUW.js} +2 -2
  89. package/dist/{chunk-3TSTGI6F.js → chunk-ZQUAVZNG.js} +2 -2
  90. package/dist/{chunk-4NR2PDZ5.js → chunk-ZVHRSR2R.js} +14 -4
  91. package/dist/chunk-ZVHRSR2R.js.map +1 -0
  92. package/dist/{cli-BLME420h.d.ts → cli-Dt-tuiYH.d.ts} +3 -3
  93. package/dist/cli.d.ts +7 -6
  94. package/dist/cli.js +35 -35
  95. package/dist/compounding/engine.d.ts +12 -1
  96. package/dist/compounding/engine.js +3 -3
  97. package/dist/compounding/preference-consolidator.d.ts +1 -1
  98. package/dist/compression-optimizer.d.ts +1 -1
  99. package/dist/config.d.ts +1 -1
  100. package/dist/config.js +2 -2
  101. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  102. package/dist/connectors/codex-materialize-runner.js +3 -3
  103. package/dist/connectors/codex-materialize.d.ts +1 -1
  104. package/dist/connectors/index.d.ts +1 -1
  105. package/dist/connectors/index.js +3 -3
  106. package/dist/consolidation-provenance-check.d.ts +1 -1
  107. package/dist/consolidation-undo.d.ts +1 -1
  108. package/dist/contradiction/index.d.ts +1 -1
  109. package/dist/contradiction/index.js +1 -1
  110. package/dist/conversation-index/backend.d.ts +1 -1
  111. package/dist/conversation-index/chunker.d.ts +1 -1
  112. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  113. package/dist/conversation-index/indexer.d.ts +1 -1
  114. package/dist/conversation-index/search.d.ts +1 -1
  115. package/dist/day-summary.d.ts +1 -1
  116. package/dist/delinearize.d.ts +1 -1
  117. package/dist/direct-answer-wiring.d.ts +1 -1
  118. package/dist/direct-answer.d.ts +1 -1
  119. package/dist/embedding-fallback.d.ts +1 -1
  120. package/dist/embedding-fallback.js +2 -2
  121. package/dist/enrichment/index.d.ts +1 -1
  122. package/dist/entity-retrieval.d.ts +1 -1
  123. package/dist/entity-retrieval.js +3 -3
  124. package/dist/entity-schema.d.ts +1 -1
  125. package/dist/explicit-capture.d.ts +6 -4
  126. package/dist/explicit-capture.js +1 -1
  127. package/dist/extraction-faithfulness.d.ts +1 -1
  128. package/dist/extraction-judge-telemetry.d.ts +1 -1
  129. package/dist/extraction-judge-training.d.ts +1 -1
  130. package/dist/extraction-judge.d.ts +1 -1
  131. package/dist/extraction.d.ts +1 -1
  132. package/dist/extraction.js +3 -3
  133. package/dist/fallback-llm.d.ts +1 -1
  134. package/dist/{first-start-migration-22LPFHD5.js → first-start-migration-OOR57AYR.js} +2 -2
  135. package/dist/graph-dashboard-diff.d.ts +1 -1
  136. package/dist/graph-dashboard-key.d.ts +1 -1
  137. package/dist/graph-dashboard-parser.d.ts +1 -1
  138. package/dist/graph-edge-reinforcement.d.ts +1 -1
  139. package/dist/graph-snapshot.d.ts +1 -1
  140. package/dist/graph.d.ts +1 -1
  141. package/dist/identity-continuity.d.ts +1 -1
  142. package/dist/importance.d.ts +1 -1
  143. package/dist/index.d.ts +296 -11
  144. package/dist/index.js +359 -47
  145. package/dist/index.js.map +1 -1
  146. package/dist/intent.d.ts +1 -1
  147. package/dist/lcm/engine.d.ts +1 -1
  148. package/dist/lcm/index.d.ts +1 -1
  149. package/dist/lcm/tools.d.ts +1 -1
  150. package/dist/lifecycle.d.ts +1 -1
  151. package/dist/live-connectors-runner.d.ts +1 -1
  152. package/dist/local-llm.d.ts +1 -1
  153. package/dist/local-model-endpoint.d.ts +1 -1
  154. package/dist/maintenance/memory-governance.d.ts +1 -1
  155. package/dist/maintenance/memory-governance.js +3 -3
  156. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  157. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  158. package/dist/mcp-memory-inspector-app.d.ts +6 -5
  159. package/dist/memory-action-policy.d.ts +1 -1
  160. package/dist/memory-cache.d.ts +1 -1
  161. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  162. package/dist/memory-projection-store.d.ts +1 -1
  163. package/dist/memory-provenance.d.ts +1 -1
  164. package/dist/memory-worth-outcomes.d.ts +1 -1
  165. package/dist/models-json.d.ts +1 -1
  166. package/dist/namespaces/migrate.d.ts +2 -2
  167. package/dist/namespaces/migrate.js +9 -9
  168. package/dist/namespaces/principal.d.ts +1 -1
  169. package/dist/namespaces/search.d.ts +1 -1
  170. package/dist/namespaces/search.js +5 -5
  171. package/dist/namespaces/storage.d.ts +2 -2
  172. package/dist/namespaces/storage.js +3 -3
  173. package/dist/native-knowledge.d.ts +1 -1
  174. package/dist/operator-toolkit.d.ts +1 -1
  175. package/dist/operator-toolkit.js +14 -14
  176. package/dist/orchestration/compression-guideline-coordinator.d.ts +105 -0
  177. package/dist/orchestration/compression-guideline-coordinator.js +12 -0
  178. package/dist/orchestration/maintenance.d.ts +2 -2
  179. package/dist/orchestration/maintenance.js +5 -5
  180. package/dist/{orchestrator-DqPAz8ot.d.ts → orchestrator-B4KjaOtY.d.ts} +128 -34
  181. package/dist/orchestrator.d.ts +5 -4
  182. package/dist/orchestrator.js +28 -26
  183. package/dist/patterns-cli.d.ts +1 -1
  184. package/dist/policy-runtime.d.ts +1 -1
  185. package/dist/provenance.d.ts +1 -1
  186. package/dist/provenance.js +1 -1
  187. package/dist/qmd-recall-cache.d.ts +1 -1
  188. package/dist/qmd.d.ts +1 -1
  189. package/dist/recall-disclosure-escalation.d.ts +1 -1
  190. package/dist/recall-explain-renderer.d.ts +1 -1
  191. package/dist/recall-planner-llm.d.ts +1 -1
  192. package/dist/recall-state.d.ts +1 -1
  193. package/dist/recall-tag-filter.d.ts +1 -1
  194. package/dist/recall-xray-cli.d.ts +1 -1
  195. package/dist/recall-xray-renderer.d.ts +1 -1
  196. package/dist/recall-xray.d.ts +1 -1
  197. package/dist/{resolution-MN36NW5P.js → resolution-33PIX3TT.js} +2 -2
  198. package/dist/resolution-33PIX3TT.js.map +1 -0
  199. package/dist/resolve-auth-token.d.ts +1 -1
  200. package/dist/resume-bundles.js +3 -3
  201. package/dist/retrieval-agents.d.ts +1 -1
  202. package/dist/retrieval-tiers.d.ts +1 -1
  203. package/dist/routing/engine.d.ts +1 -1
  204. package/dist/routing/store.d.ts +1 -1
  205. package/dist/schemas.d.ts +32 -32
  206. package/dist/search/embed-helper.d.ts +1 -1
  207. package/dist/search/embed-helper.js +2 -2
  208. package/dist/search/factory.d.ts +1 -1
  209. package/dist/search/factory.js +4 -4
  210. package/dist/search/index.d.ts +1 -1
  211. package/dist/search/index.js +8 -8
  212. package/dist/search/lancedb-backend.d.ts +1 -1
  213. package/dist/search/meilisearch-backend.d.ts +1 -1
  214. package/dist/search/noop-backend.d.ts +1 -1
  215. package/dist/search/orama-backend.d.ts +1 -1
  216. package/dist/search/port.d.ts +1 -1
  217. package/dist/search/remote-backend.d.ts +1 -1
  218. package/dist/{semantic-consolidation-Cl15ksZy.d.ts → semantic-consolidation-CstTvHPo.d.ts} +1 -1
  219. package/dist/semantic-consolidation.d.ts +2 -2
  220. package/dist/semantic-consolidation.js +4 -4
  221. package/dist/semantic-rule-promotion.js +3 -3
  222. package/dist/semantic-rule-verifier.d.ts +1 -1
  223. package/dist/semantic-rule-verifier.js +3 -3
  224. package/dist/session-observer-bands.d.ts +1 -1
  225. package/dist/session-observer-state.d.ts +1 -1
  226. package/dist/shared-context/manager.d.ts +1 -1
  227. package/dist/signal.d.ts +1 -1
  228. package/dist/storage.d.ts +22 -3
  229. package/dist/storage.js +2 -2
  230. package/dist/summarizer.d.ts +1 -1
  231. package/dist/summary-snapshot.d.ts +1 -1
  232. package/dist/temporal-supersession.d.ts +1 -1
  233. package/dist/temporal-validity.d.ts +1 -1
  234. package/dist/threading.d.ts +1 -1
  235. package/dist/tier-migration.d.ts +1 -1
  236. package/dist/tier-routing.d.ts +1 -1
  237. package/dist/topics.d.ts +1 -1
  238. package/dist/transcript.d.ts +1 -1
  239. package/dist/transfer/types.d.ts +22 -22
  240. package/dist/trust-score-stage.d.ts +1 -1
  241. package/dist/trust-score.d.ts +1 -1
  242. package/dist/{types-ChQb9D6s.d.ts → types-VkxElCHR.d.ts} +8 -1
  243. package/dist/types.d.ts +1 -1
  244. package/dist/utility-runtime.d.ts +1 -1
  245. package/dist/verified-recall.js +3 -3
  246. package/package.json +12 -2
  247. package/src/access-service-coding-write.test.ts +2 -2
  248. package/src/access-service.ts +33 -14
  249. package/src/bitemporal-dedup-backfill.test.ts +10 -10
  250. package/src/bitemporal-frontmatter.test.ts +3 -3
  251. package/src/capabilities.test.ts +185 -0
  252. package/src/capabilities.ts +110 -0
  253. package/src/cli/creation-ledger-commands.ts +22 -21
  254. package/src/coding/architecture-surfaces.test.ts +25 -1
  255. package/src/coding/architecture-surfaces.ts +47 -19
  256. package/src/coding/decision-surfaces.ts +12 -3
  257. package/src/coding/review-context-structural.test.ts +303 -0
  258. package/src/coding/review-context.ts +79 -0
  259. package/src/coding/structural-context.test.ts +259 -0
  260. package/src/coding/structural-context.ts +315 -0
  261. package/src/coding/structural-subprocess-provider.test.ts +430 -0
  262. package/src/coding/structural-subprocess-provider.ts +355 -0
  263. package/src/compounding/engine.test.ts +90 -0
  264. package/src/compounding/engine.ts +25 -1
  265. package/src/contradiction/contradiction.test.ts +1 -1
  266. package/src/contradiction/resolution.ts +9 -1
  267. package/src/correction/correction-access-wiring.ts +21 -3
  268. package/src/correction/correction-contract.ts +7 -0
  269. package/src/correction/correction-planner.test.ts +231 -0
  270. package/src/correction/correction-planner.ts +73 -0
  271. package/src/correction/correction-service.ts +29 -0
  272. package/src/correction/correction-storage-integration.test.ts +2 -2
  273. package/src/dedup/semantic.test.ts +1 -1
  274. package/src/explicit-capture.ts +7 -4
  275. package/src/extraction-eventtime-wiring.test.ts +3 -3
  276. package/src/extraction-redaction-rules.test.ts +172 -0
  277. package/src/index.ts +29 -0
  278. package/src/maintenance/forget.test.ts +1 -1
  279. package/src/maintenance/memory-governance.test.ts +1 -1
  280. package/src/maintenance/pattern-reinforcement.test.ts +2 -2
  281. package/src/operator-toolkit.ts +4 -3
  282. package/src/orchestration/compression-guideline-coordinator.ts +449 -0
  283. package/src/orchestration/extraction-queue-coordinator.ts +175 -0
  284. package/src/orchestrator-extraction-queue.test.ts +26 -38
  285. package/src/orchestrator-flush.test.ts +10 -15
  286. package/src/orchestrator.ts +359 -542
  287. package/src/procedural/procedure-miner.test.ts +2 -2
  288. package/src/provenance-extraction.test.ts +382 -4
  289. package/src/provenance.ts +158 -22
  290. package/src/recall-handles-wiring.test.ts +1 -1
  291. package/src/search/factory.ts +4 -3
  292. package/src/semantic-rule-promotion.ts +1 -1
  293. package/src/source-attribution-roundtrip.test.ts +2 -2
  294. package/src/storage-contract/atomicity.test.ts +1 -1
  295. package/src/storage-contract/cache-coherence.test.ts +2 -2
  296. package/src/storage-contract/content-hash.test.ts +1 -1
  297. package/src/storage-contract/namespace-routing.test.ts +1 -1
  298. package/src/storage-contract/round-trip.test.ts +3 -3
  299. package/src/storage.ts +23 -2
  300. package/src/temporal-supersession.test.ts +12 -11
  301. package/src/temporal-validity.test.ts +11 -11
  302. package/src/wearables/cli.test.ts +30 -0
  303. package/src/wearables/cli.ts +3 -0
  304. package/src/wearables/memory-gen.test.ts +57 -1
  305. package/src/wearables/memory-gen.ts +31 -7
  306. package/src/wearables/pipeline.test.ts +40 -1
  307. package/src/wearables/pipeline.ts +4 -0
  308. package/src/wearables/service.test.ts +2 -2
  309. package/src/wearables/storage-io.test.ts +3 -3
  310. package/src/wearables/types.ts +7 -0
  311. package/dist/chunk-4NR2PDZ5.js.map +0 -1
  312. package/dist/chunk-4T3BMHKD.js.map +0 -1
  313. package/dist/chunk-7RLCCNHU.js.map +0 -1
  314. package/dist/chunk-AQLOP5F4.js.map +0 -1
  315. package/dist/chunk-EH5ED3C6.js.map +0 -1
  316. package/dist/chunk-M4AYVEWS.js.map +0 -1
  317. package/dist/chunk-QNEUZIAH.js.map +0 -1
  318. package/dist/chunk-UM5AWJNQ.js.map +0 -1
  319. package/dist/chunk-UTHQPSRC.js.map +0 -1
  320. package/dist/chunk-YKBHOBJK.js.map +0 -1
  321. /package/dist/{auto-sync-F3KCSQFJ.js.map → auto-sync-G3V5AN4C.js.map} +0 -0
  322. /package/dist/{chunk-4NOI577P.js.map → chunk-24ZLC5QN.js.map} +0 -0
  323. /package/dist/{chunk-DMQWV6SQ.js.map → chunk-5RZOFIDL.js.map} +0 -0
  324. /package/dist/{chunk-36SEDFAU.js.map → chunk-C5WN74HH.js.map} +0 -0
  325. /package/dist/{chunk-MLKWJOAJ.js.map → chunk-CGPHMNL4.js.map} +0 -0
  326. /package/dist/{chunk-EY6MDMHK.js.map → chunk-F6OEXJQQ.js.map} +0 -0
  327. /package/dist/{chunk-M4V2JVSZ.js.map → chunk-FFUCCKPN.js.map} +0 -0
  328. /package/dist/{chunk-O6YH5F47.js.map → chunk-FYWUNVFZ.js.map} +0 -0
  329. /package/dist/{chunk-37436GML.js.map → chunk-GEXI357K.js.map} +0 -0
  330. /package/dist/{chunk-YGIQORJ3.js.map → chunk-GGL34GCW.js.map} +0 -0
  331. /package/dist/{chunk-WAS3NV46.js.map → chunk-H3MB3F62.js.map} +0 -0
  332. /package/dist/{chunk-76NHR6ZL.js.map → chunk-HJWQJUKQ.js.map} +0 -0
  333. /package/dist/{chunk-Y4YD5TYW.js.map → chunk-IIBFCZA7.js.map} +0 -0
  334. /package/dist/{chunk-UVPL565C.js.map → chunk-IQOEW5YV.js.map} +0 -0
  335. /package/dist/{chunk-V4GNSDFH.js.map → chunk-KQYGNGON.js.map} +0 -0
  336. /package/dist/{chunk-CBWI22JN.js.map → chunk-KSJCXXOU.js.map} +0 -0
  337. /package/dist/{chunk-I5REUWLH.js.map → chunk-NIZQH6AU.js.map} +0 -0
  338. /package/dist/{chunk-4ESAR77N.js.map → chunk-NOU77OHX.js.map} +0 -0
  339. /package/dist/{chunk-BQCHEV7O.js.map → chunk-O4ZIBPIW.js.map} +0 -0
  340. /package/dist/{chunk-HOHVIVDR.js.map → chunk-OBJUKYDO.js.map} +0 -0
  341. /package/dist/{chunk-YOLZS7NY.js.map → chunk-OTQE66IX.js.map} +0 -0
  342. /package/dist/{chunk-C2PG7IEH.js.map → chunk-P3VJCTVE.js.map} +0 -0
  343. /package/dist/{chunk-HGNOCPZX.js.map → chunk-QZHF4BWN.js.map} +0 -0
  344. /package/dist/{chunk-ASKXIAHD.js.map → chunk-WDJCZQB4.js.map} +0 -0
  345. /package/dist/{chunk-JYLFZWUX.js.map → chunk-XYUFGHUW.js.map} +0 -0
  346. /package/dist/{chunk-3TSTGI6F.js.map → chunk-ZQUAVZNG.js.map} +0 -0
  347. /package/dist/{first-start-migration-22LPFHD5.js.map → first-start-migration-OOR57AYR.js.map} +0 -0
  348. /package/dist/{resolution-MN36NW5P.js.map → orchestration/compression-guideline-coordinator.js.map} +0 -0
@@ -4,10 +4,13 @@ import {
4
4
  loadSyncState,
5
5
  syncWearableSource,
6
6
  wearableSourceLabel
7
- } from "./chunk-4T3BMHKD.js";
7
+ } from "./chunk-OZECYVGI.js";
8
+ import {
9
+ CompressionGuidelineCoordinator
10
+ } from "./chunk-SYX73XD7.js";
8
11
  import {
9
12
  MaintenanceScheduler
10
- } from "./chunk-MLKWJOAJ.js";
13
+ } from "./chunk-CGPHMNL4.js";
11
14
  import {
12
15
  migrateFromEngram
13
16
  } from "./chunk-7HYPN2GC.js";
@@ -23,7 +26,7 @@ import {
23
26
  import {
24
27
  CompoundingEngine,
25
28
  defaultTierMigrationCycleBudget
26
- } from "./chunk-4NR2PDZ5.js";
29
+ } from "./chunk-ZVHRSR2R.js";
27
30
  import {
28
31
  SharedContextManager
29
32
  } from "./chunk-UFS7OXGL.js";
@@ -154,7 +157,7 @@ import {
154
157
  } from "./chunk-LTHVM4XN.js";
155
158
  import {
156
159
  ExtractionEngine
157
- } from "./chunk-I5REUWLH.js";
160
+ } from "./chunk-NIZQH6AU.js";
158
161
  import {
159
162
  parseMemoryActionEligibilityContext
160
163
  } from "./chunk-5GSUBCZM.js";
@@ -187,29 +190,29 @@ import {
187
190
  } from "./chunk-Q6IP2ARR.js";
188
191
  import {
189
192
  EmbeddingFallback
190
- } from "./chunk-C2PG7IEH.js";
193
+ } from "./chunk-P3VJCTVE.js";
191
194
  import {
192
195
  buildEntityRecallSection,
193
196
  entityRecentTranscriptLookbackHours,
194
197
  readRecentEntityTranscriptEntries
195
- } from "./chunk-YOLZS7NY.js";
196
- import {
197
- normalizeReplaySessionKey
198
- } from "./chunk-2PRQG7PV.js";
198
+ } from "./chunk-OTQE66IX.js";
199
199
  import {
200
200
  RoutingRulesStore
201
201
  } from "./chunk-WIWPSQYU.js";
202
+ import {
203
+ normalizeReplaySessionKey
204
+ } from "./chunk-2PRQG7PV.js";
202
205
  import {
203
206
  compareVerifiedEpisodeResults,
204
207
  searchVerifiedEpisodes
205
- } from "./chunk-ASKXIAHD.js";
208
+ } from "./chunk-WDJCZQB4.js";
206
209
  import {
207
210
  ThreadingManager
208
211
  } from "./chunk-QRDOSYOR.js";
209
212
  import {
210
213
  compareVerifiedSemanticRuleResults,
211
214
  searchVerifiedSemanticRules
212
- } from "./chunk-UVPL565C.js";
215
+ } from "./chunk-IQOEW5YV.js";
213
216
  import {
214
217
  searchWorkProductLedgerEntries
215
218
  } from "./chunk-ZRWB5D4H.js";
@@ -222,14 +225,14 @@ import {
222
225
  import {
223
226
  runNamespaceMaintenanceFanout,
224
227
  summarizeNamespaceMaintenanceHealth
225
- } from "./chunk-CBWI22JN.js";
228
+ } from "./chunk-KSJCXXOU.js";
226
229
  import {
227
230
  NamespaceCatalog,
228
231
  planNamespaceMaintenance
229
- } from "./chunk-M4V2JVSZ.js";
232
+ } from "./chunk-FFUCCKPN.js";
230
233
  import {
231
234
  NamespaceStorageRouter
232
- } from "./chunk-3TSTGI6F.js";
235
+ } from "./chunk-ZQUAVZNG.js";
233
236
  import {
234
237
  searchHarmonicRetrieval
235
238
  } from "./chunk-AV5ZEH4M.js";
@@ -253,10 +256,7 @@ import {
253
256
  applyCommitmentLedgerLifecycle
254
257
  } from "./chunk-LMDRGRJ2.js";
255
258
  import {
256
- buildCompressionGuidelinesMarkdown,
257
- computeCompressionGuidelineCandidate,
258
- refineCompressionGuidelineCandidateSemantically,
259
- renderCompressionGuidelinesMarkdown
259
+ buildCompressionGuidelinesMarkdown
260
260
  } from "./chunk-OD4FM2U7.js";
261
261
  import {
262
262
  buildConsolidationPrompt,
@@ -267,7 +267,7 @@ import {
267
267
  materializeAfterSemanticConsolidation,
268
268
  parseConsolidationResponse,
269
269
  parseOperatorAwareConsolidationResponse
270
- } from "./chunk-DMQWV6SQ.js";
270
+ } from "./chunk-5RZOFIDL.js";
271
271
  import {
272
272
  buildRecallQueryPolicy
273
273
  } from "./chunk-LBJBNWS2.js";
@@ -308,7 +308,7 @@ import {
308
308
  clusterByKey,
309
309
  createCorrectionService,
310
310
  detectPassiveCorrections
311
- } from "./chunk-AQLOP5F4.js";
311
+ } from "./chunk-WNGXQMRI.js";
312
312
  import {
313
313
  listTrustZoneRecords,
314
314
  searchTrustZoneRecords
@@ -333,11 +333,11 @@ import {
333
333
  } from "./chunk-J6BH2OBA.js";
334
334
  import {
335
335
  NamespaceSearchRouter
336
- } from "./chunk-V4GNSDFH.js";
336
+ } from "./chunk-KQYGNGON.js";
337
337
  import {
338
338
  createConversationIndexRuntime,
339
339
  createSearchBackend
340
- } from "./chunk-UTHQPSRC.js";
340
+ } from "./chunk-HHNSLPX7.js";
341
341
  import {
342
342
  NoopSearchBackend
343
343
  } from "./chunk-CYEPCZN5.js";
@@ -360,12 +360,14 @@ import {
360
360
  } from "./chunk-QDW3E4RD.js";
361
361
  import {
362
362
  shouldSkipImplicitExtraction
363
- } from "./chunk-EH5ED3C6.js";
363
+ } from "./chunk-PMAQRUN4.js";
364
364
  import {
365
365
  resolveCapabilities,
366
+ resolveCreationMemoryCapabilities,
366
367
  resolveGraphConstructionCapabilities,
368
+ resolveIndexingCapabilities,
367
369
  resolveMemoryLifecycleCapabilities
368
- } from "./chunk-3RCBIOOJ.js";
370
+ } from "./chunk-ESF7TRYJ.js";
369
371
  import {
370
372
  searchCausalTrajectories
371
373
  } from "./chunk-SQNED75R.js";
@@ -378,7 +380,7 @@ import {
378
380
  } from "./chunk-TBBDFYXW.js";
379
381
  import {
380
382
  buildChainFollowupGenerator
381
- } from "./chunk-EY6MDMHK.js";
383
+ } from "./chunk-F6OEXJQQ.js";
382
384
  import {
383
385
  ContentHashIndex,
384
386
  StorageManager,
@@ -386,7 +388,7 @@ import {
386
388
  fingerprintEntityStructuredFacts,
387
389
  normalizeAttributePairs,
388
390
  parseEntityFile
389
- } from "./chunk-7RLCCNHU.js";
391
+ } from "./chunk-Q6BAA57B.js";
390
392
  import {
391
393
  buildRetiredFactTombstoneInputs
392
394
  } from "./chunk-L2B3EE7B.js";
@@ -746,6 +748,130 @@ var TierMigrationCoordinator = class {
746
748
  }
747
749
  };
748
750
 
751
+ // src/orchestration/extraction-queue-coordinator.ts
752
+ var ExtractionQueueCoordinator = class {
753
+ /**
754
+ * Background serial queue for extractions (agent_end optimization).
755
+ * Queue stores tasks that resolve when extraction should run.
756
+ */
757
+ queue = [];
758
+ /** Whether the serial drain loop is currently running. */
759
+ processing = false;
760
+ /** Current queue depth (idle-wait + test seam). */
761
+ get length() {
762
+ return this.queue.length;
763
+ }
764
+ /** Whether the serial drain loop is currently running (idle-wait + test seam). */
765
+ get isProcessing() {
766
+ return this.processing;
767
+ }
768
+ /**
769
+ * Enqueue a task and start the serial processor if it is idle. This is
770
+ * the production entry point — the orchestrator's `queueBufferedExtraction`
771
+ * builds each task closure and hands it here.
772
+ */
773
+ enqueue(task) {
774
+ this.queue.push(task);
775
+ if (!this.processing) {
776
+ this.processing = true;
777
+ this.processQueue().catch((err) => {
778
+ this.logExtractionQueueFailure(err, "processor");
779
+ this.processing = false;
780
+ });
781
+ }
782
+ }
783
+ /**
784
+ * Background serial queue processor.
785
+ * Processes extractions one at a time to avoid race conditions.
786
+ * Called automatically when items are queued via `enqueue`; also exposed
787
+ * for the characterization tests that push raw tasks and assert drain
788
+ * semantics directly.
789
+ */
790
+ async processQueue() {
791
+ while (this.queue.length > 0) {
792
+ const task = this.queue.shift();
793
+ if (task) {
794
+ try {
795
+ await task();
796
+ } catch (err) {
797
+ this.logExtractionQueueFailure(err, "task");
798
+ }
799
+ }
800
+ }
801
+ this.processing = false;
802
+ }
803
+ /**
804
+ * Classify + log a failure from either the per-task catch inside
805
+ * `processQueue()` or the outer `processQueue().catch(...)` in
806
+ * `enqueue()`. Issue #549: `throwIfRecallAborted`
807
+ * (used throughout `runExtraction`) raises an Error whose `name` is
808
+ * `"AbortError"`. That path fires when `before_reset` aborts a
809
+ * queued task to avoid duplicate extraction — it is intentional
810
+ * cancellation, not a failure. Downgrading the log to debug
811
+ * prevents spurious `error`-level lines that routinely appear
812
+ * right next to a successful `persisted: N facts, M entities` log
813
+ * and that confuse operators into thinking extraction is broken.
814
+ * Genuine extraction failures (network, parse, I/O) still log at
815
+ * `error`.
816
+ *
817
+ * Source differentiates the two call sites so the log message
818
+ * names the right layer (`task` vs `processor`).
819
+ */
820
+ logExtractionQueueFailure(err, source) {
821
+ const aborted = source === "task" ? "background extraction task aborted (session transition)" : "background extraction queue processor aborted (session transition)";
822
+ const failed = source === "task" ? "background extraction task failed" : "background extraction queue processor failed";
823
+ if (isAbortError(err)) {
824
+ log.debug(aborted);
825
+ } else {
826
+ log.error(failed, err);
827
+ }
828
+ }
829
+ /**
830
+ * Wait until the extraction queue is fully drained (no tasks queued, no
831
+ * drain in flight) or `timeoutMs` elapses. Used by bootstrap (after a
832
+ * dry-run import) and by tests that need to assert extraction settled.
833
+ * Returns false on timeout, true once idle.
834
+ */
835
+ async waitForIdle(timeoutMs = 6e4) {
836
+ const started = Date.now();
837
+ while (this.processing || this.queue.length > 0) {
838
+ if (Date.now() - started > timeoutMs) {
839
+ log.warn(`waitForExtractionIdle timed out after ${timeoutMs}ms`);
840
+ return false;
841
+ }
842
+ const { promise, resolve } = Promise.withResolvers();
843
+ setTimeout(resolve, 50);
844
+ await promise;
845
+ }
846
+ return true;
847
+ }
848
+ // ── Test seams ─────────────────────────────────────────────────────────
849
+ // Mirror the pre-extraction `orchestrator.extractionQueue` /
850
+ // `orchestrator.queueProcessing` direct-field access the characterization
851
+ // and flush deadline tests relied on. Each is a thin, well-named handle
852
+ // onto the coordinator's private state — no behavior change.
853
+ /**
854
+ * Push a raw task WITHOUT auto-starting the processor, matching the
855
+ * pre-extraction `this.extractionQueue.push(...)` used by the
856
+ * characterization tests that drive the drain manually via `processQueue`.
857
+ */
858
+ pushRaw(task) {
859
+ this.queue.push(task);
860
+ }
861
+ /** Remove + return the front task (test seam for the flush deadline tests). */
862
+ shift() {
863
+ return this.queue.shift();
864
+ }
865
+ /**
866
+ * Force the processor-busy flag so `enqueue` does not auto-start the
867
+ * drain — used by the flush deadline test to simulate a busy queue and
868
+ * assert a queued task's deadline expires while it waits.
869
+ */
870
+ setProcessingForTest(value) {
871
+ this.processing = value;
872
+ }
873
+ };
874
+
749
875
  // src/maintenance/pattern-reinforcement.ts
750
876
  function patternReinforcementKey(content) {
751
877
  return content.trim().toLowerCase().replace(/\s+/g, " ").slice(0, 200);
@@ -2468,20 +2594,6 @@ function deriveTopicsFromExtraction(result) {
2468
2594
  function buildCompressionGuidelinesMarkdown2(events, generatedAtIso = (/* @__PURE__ */ new Date()).toISOString()) {
2469
2595
  return buildCompressionGuidelinesMarkdown(events, generatedAtIso);
2470
2596
  }
2471
- function formatCompressionGuidelinesForRecall(raw, maxLines = 5) {
2472
- if (typeof raw !== "string" || raw.trim().length === 0) return null;
2473
- const sectionMatch = raw.match(
2474
- // End the section at `\n## ` or end-of-string. Plain $ (not \s*$): the
2475
- // \s* branch overlapped the lazy body and backtracked polynomially
2476
- // (CodeQL js/polynomial-redos). Captured lines are trimmed/filtered below,
2477
- // so trailing whitespace handling is unchanged.
2478
- /## Suggested Guidelines\s*\n([\s\S]*?)(?:\n##\s+|$)/i
2479
- );
2480
- if (!sectionMatch) return null;
2481
- const lines = sectionMatch[1].split("\n").map((line) => line.trim()).filter((line) => line.startsWith("- ")).slice(0, Math.max(1, Math.floor(maxLines)));
2482
- if (lines.length === 0) return null;
2483
- return lines.join("\n");
2484
- }
2485
2597
  function filterRecallCandidates(candidates, options) {
2486
2598
  const scopedByNamespace = options.namespacesEnabled ? candidates.filter(
2487
2599
  (r) => options.recallNamespaces.includes(options.resolveNamespace(r.path))
@@ -2918,6 +3030,7 @@ var Orchestrator = class _Orchestrator {
2918
3030
  handleHistory;
2919
3031
  tierMigrationStatus;
2920
3032
  tierMigrationCoordinator;
3033
+ compressionGuidelineCoordinator;
2921
3034
  /**
2922
3035
  * In-memory X-ray snapshot from the most recent `recall()` call that
2923
3036
  * was invoked with `xrayCapture: true` (issue #570 PR 1). Scope is
@@ -2998,10 +3111,14 @@ var Orchestrator = class _Orchestrator {
2998
3111
  passiveCorrectionDedup = /* @__PURE__ */ new Set();
2999
3112
  _passiveCorrectionService = null;
3000
3113
  passiveCorrectionTelemetry = { detected: 0, queued: 0, autoApplied: 0, suppressedReasonCounts: {} };
3001
- // Background serial queue for extractions (agent_end optimization)
3002
- // Queue stores promises that resolve when extraction should run
3003
- extractionQueue = [];
3004
- queueProcessing = false;
3114
+ /**
3115
+ * Background serial extraction queue coordinator (issue #1526 moved
3116
+ * from inline `extractionQueue`/`queueProcessing` fields). Owns queue
3117
+ * state + scheduling + the serial drain + failure classification; the
3118
+ * orchestrator builds each task closure in `queueBufferedExtraction` and
3119
+ * hands it to `enqueue`.
3120
+ */
3121
+ extractionQueueCoordinator;
3005
3122
  heartbeatObserverChains = /* @__PURE__ */ new Map();
3006
3123
  recentExtractionFingerprints = /* @__PURE__ */ new Map();
3007
3124
  consolidationObservers = /* @__PURE__ */ new Set();
@@ -3706,6 +3823,7 @@ var Orchestrator = class _Orchestrator {
3706
3823
  namespaceSearchRouter: this.namespaceSearchRouter,
3707
3824
  namespaceCatalog: this.namespaceCatalog
3708
3825
  });
3826
+ this.extractionQueueCoordinator = new ExtractionQueueCoordinator();
3709
3827
  const conversationIndexRuntime = createConversationIndexRuntime(config, {
3710
3828
  getQmd: () => this.conversationQmd,
3711
3829
  getFaiss: () => this.conversationFaiss
@@ -3738,6 +3856,11 @@ var Orchestrator = class _Orchestrator {
3738
3856
  getCompounding: () => this.compounding,
3739
3857
  createColdStorage: (parentDir) => new StorageManager(parentDir)
3740
3858
  });
3859
+ this.compressionGuidelineCoordinator = new CompressionGuidelineCoordinator({
3860
+ config,
3861
+ getStorage: () => this.storage,
3862
+ fastChatCompletion: (messages, options) => this.fastChatCompletion(messages, options)
3863
+ });
3741
3864
  this.sessionObserver = new SessionObserverState({
3742
3865
  memoryDir: config.memoryDir,
3743
3866
  debounceMs: config.sessionObserverDebounceMs ?? 12e4,
@@ -4048,6 +4171,25 @@ var Orchestrator = class _Orchestrator {
4048
4171
  }
4049
4172
  await this.namespaceCatalog.registerConfiguredNamespaces().catch(() => void 0);
4050
4173
  }
4174
+ try {
4175
+ const correctionNamespaces = new Set(this.configuredNamespaceList());
4176
+ if (this.namespaceCatalog.enabled) {
4177
+ try {
4178
+ for (const rec of await this.namespaceCatalog.listNamespaces()) {
4179
+ correctionNamespaces.add(rec.namespace);
4180
+ }
4181
+ } catch {
4182
+ }
4183
+ }
4184
+ const recovered = await this.passiveCorrectionService().recoverStaleApplyingPlans(
4185
+ [...correctionNamespaces]
4186
+ );
4187
+ if (recovered > 0) {
4188
+ log.info(`correction: recovered ${recovered} stale applying plan(s) on startup`);
4189
+ }
4190
+ } catch (staleErr) {
4191
+ log.debug(`correction: stale-plan recovery skipped: ${staleErr instanceof Error ? staleErr.message : String(staleErr)}`);
4192
+ }
4051
4193
  await this.relevance.load();
4052
4194
  await this.negatives.load();
4053
4195
  await this.lastRecall.load();
@@ -4253,7 +4395,7 @@ var Orchestrator = class _Orchestrator {
4253
4395
  }));
4254
4396
  await Promise.all(cacheWarmups);
4255
4397
  if (signal.aborted) return;
4256
- if (this.config.conversationIndexEnabled && this.conversationIndexBackend) {
4398
+ if (resolveIndexingCapabilities(this.config).conversationIndex && this.conversationIndexBackend) {
4257
4399
  try {
4258
4400
  const init = await this.conversationIndexBackend.initialize();
4259
4401
  if (!init.enabled) {
@@ -4284,7 +4426,7 @@ var Orchestrator = class _Orchestrator {
4284
4426
  if (signal.aborted) return;
4285
4427
  if (lifecycleCaps.lifecyclePolicy && this.config.qmdTierMigrationEnabled) {
4286
4428
  try {
4287
- const { runFirstStartMigration } = await import("./first-start-migration-22LPFHD5.js");
4429
+ const { runFirstStartMigration } = await import("./first-start-migration-OOR57AYR.js");
4288
4430
  const result = await runFirstStartMigration({
4289
4431
  storage: this.storage,
4290
4432
  config: this.config,
@@ -4307,7 +4449,7 @@ var Orchestrator = class _Orchestrator {
4307
4449
  if (signal.aborted) return;
4308
4450
  if (!this.wearablesAutoSyncHandle && this.config.wearables.enabled && this.config.wearables.autoSyncEnabled && Object.values(this.config.wearables.sources).some((source) => source.enabled)) {
4309
4451
  try {
4310
- const { startWearablesAutoSync } = await import("./auto-sync-F3KCSQFJ.js");
4452
+ const { startWearablesAutoSync } = await import("./auto-sync-G3V5AN4C.js");
4311
4453
  if (signal.aborted) return;
4312
4454
  this.wearablesAutoSyncHandle = startWearablesAutoSync(
4313
4455
  {
@@ -4814,7 +4956,7 @@ ${doc.content}` : doc.content,
4814
4956
  const entry = await targetStorage.snapshotForProvenance(m.path);
4815
4957
  if (entry) derivedFromEntries.push(entry);
4816
4958
  }
4817
- const canonicalId = await targetStorage.writeMemory(
4959
+ const { id: canonicalId, tombstoneBlocked: canonicalBlocked } = await targetStorage.writeMemory(
4818
4960
  newest.frontmatter.category,
4819
4961
  canonicalContent,
4820
4962
  {
@@ -4831,6 +4973,10 @@ ${doc.content}` : doc.content,
4831
4973
  derivedVia: operator
4832
4974
  }
4833
4975
  );
4976
+ if (canonicalBlocked) {
4977
+ log.info(`[semantic-consolidation] cluster in "${cluster.category}" tombstone-blocked \u2014 keeping ${cluster.memories.length} source(s) active (pending_review ${canonicalId})`);
4978
+ continue;
4979
+ }
4834
4980
  canonicalWriteCompleted = true;
4835
4981
  result.memoriesConsolidated++;
4836
4982
  for (const m of cluster.memories) {
@@ -4847,7 +4993,7 @@ ${doc.content}` : doc.content,
4847
4993
  );
4848
4994
  try {
4849
4995
  await this.embeddingFallback.removeFromIndex(m.frontmatter.id);
4850
- if (this.config.queryAwareIndexingEnabled && m.path && m.frontmatter?.created) {
4996
+ if (resolveIndexingCapabilities(this.config).queryAwareIndexing && m.path && m.frontmatter?.created) {
4851
4997
  deindexMemory(
4852
4998
  targetStorage.dir,
4853
4999
  m.path,
@@ -4928,15 +5074,7 @@ ${doc.content}` : doc.content,
4928
5074
  return result;
4929
5075
  }
4930
5076
  async waitForExtractionIdle(timeoutMs = 6e4) {
4931
- const started = Date.now();
4932
- while (this.queueProcessing || this.extractionQueue.length > 0) {
4933
- if (Date.now() - started > timeoutMs) {
4934
- log.warn(`waitForExtractionIdle timed out after ${timeoutMs}ms`);
4935
- return false;
4936
- }
4937
- await new Promise((resolve) => setTimeout(resolve, 50));
4938
- }
4939
- return true;
5077
+ return this.extractionQueueCoordinator.waitForIdle(timeoutMs);
4940
5078
  }
4941
5079
  async waitForConsolidationIdle(timeoutMs = 6e4) {
4942
5080
  const started = Date.now();
@@ -5537,7 +5675,7 @@ ${r.snippet.trim()}
5537
5675
  ...this.conversationIndexLastUpdateAtMs.values()
5538
5676
  );
5539
5677
  const lastUpdateAt = lastUpdateAtMs > 0 ? new Date(lastUpdateAtMs).toISOString() : null;
5540
- if (!this.config.conversationIndexEnabled) {
5678
+ if (!resolveIndexingCapabilities(this.config).conversationIndex) {
5541
5679
  return {
5542
5680
  enabled: false,
5543
5681
  backend: this.config.conversationIndexBackend,
@@ -5566,7 +5704,7 @@ ${r.snippet.trim()}
5566
5704
  ...this.conversationIndexLastUpdateAtMs.values()
5567
5705
  );
5568
5706
  const lastUpdateAt = lastUpdateAtMs > 0 ? new Date(lastUpdateAtMs).toISOString() : null;
5569
- if (!this.config.conversationIndexEnabled) {
5707
+ if (!resolveIndexingCapabilities(this.config).conversationIndex) {
5570
5708
  return {
5571
5709
  enabled: false,
5572
5710
  backend: this.config.conversationIndexBackend,
@@ -5604,7 +5742,7 @@ ${r.snippet.trim()}
5604
5742
  return this.transcript.getRecoverySummary(sessionKey);
5605
5743
  }
5606
5744
  async updateConversationIndex(sessionKey, hours = 24, opts) {
5607
- if (!this.config.conversationIndexEnabled) {
5745
+ if (!resolveIndexingCapabilities(this.config).conversationIndex) {
5608
5746
  return { chunks: 0, skipped: true, reason: "disabled", embedded: false };
5609
5747
  }
5610
5748
  const enforceMinInterval = opts?.enforceMinInterval !== false;
@@ -5646,7 +5784,7 @@ ${r.snippet.trim()}
5646
5784
  return { chunks: chunks.length, skipped: false, embedded };
5647
5785
  }
5648
5786
  async rebuildConversationIndex(sessionKey, hours = 24, opts) {
5649
- if (!this.config.conversationIndexEnabled) {
5787
+ if (!resolveIndexingCapabilities(this.config).conversationIndex) {
5650
5788
  return {
5651
5789
  chunks: 0,
5652
5790
  skipped: true,
@@ -6083,7 +6221,7 @@ ${r.snippet.trim()}
6083
6221
  return scoped;
6084
6222
  }
6085
6223
  async buildQueryAwarePrefilter(prompt, recallNamespaces) {
6086
- if (!this.config.queryAwareIndexingEnabled || !prompt.trim()) {
6224
+ if (!resolveIndexingCapabilities(this.config).queryAwareIndexing || !prompt.trim()) {
6087
6225
  return {
6088
6226
  candidatePaths: null,
6089
6227
  temporalFromDate: null,
@@ -8179,7 +8317,7 @@ ${rows.join("\n")}
8179
8317
  })();
8180
8318
  const workProductsPromise = (async () => {
8181
8319
  const t0 = Date.now();
8182
- if (!this.config.creationMemoryEnabled || !this.config.workProductRecallEnabled || !this.isRecallSectionEnabled(
8320
+ if (!resolveCreationMemoryCapabilities(this.config).creationMemory || !this.config.workProductRecallEnabled || !this.isRecallSectionEnabled(
8183
8321
  "work-products",
8184
8322
  this.config.workProductRecallEnabled === true
8185
8323
  )) {
@@ -8241,7 +8379,7 @@ ${rows.join("\n")}
8241
8379
  })();
8242
8380
  const queryAwarePrefilterPromise = (async () => {
8243
8381
  const t0 = Date.now();
8244
- if (!this.config.queryAwareIndexingEnabled || !prompt.trim()) {
8382
+ if (!resolveIndexingCapabilities(this.config).queryAwareIndexing || !prompt.trim()) {
8245
8383
  recordRecallSectionMetric({
8246
8384
  section: "queryAware",
8247
8385
  priority: "enrichment",
@@ -8834,7 +8972,7 @@ ${formatted}`;
8834
8972
  );
8835
8973
  const conversationRecallPromise = (async () => {
8836
8974
  const t0 = Date.now();
8837
- if (!this.config.conversationIndexEnabled || queryPolicy.skipConversationRecall || !this.isRecallSectionEnabled("conversation-recall", true)) {
8975
+ if (!resolveIndexingCapabilities(this.config).conversationIndex || queryPolicy.skipConversationRecall || !this.isRecallSectionEnabled("conversation-recall", true)) {
8838
8976
  recordRecallSectionMetric({
8839
8977
  section: "convRecall",
8840
8978
  priority: "core",
@@ -11161,7 +11299,7 @@ _Context: ${topQuestion.context}_`
11161
11299
  settleTask(new Error("replay extraction deadline exceeded (queue_wait)"));
11162
11300
  }, remainingMs);
11163
11301
  }
11164
- this.extractionQueue.push(async () => {
11302
+ this.extractionQueueCoordinator.enqueue(async () => {
11165
11303
  if (settled) return;
11166
11304
  if (typeof extractionDeadlineMs === "number" && extractionDeadlineMs <= Date.now()) {
11167
11305
  settleTask(new Error("replay extraction deadline exceeded (queue_wait)"));
@@ -11187,13 +11325,6 @@ _Context: ${topQuestion.context}_`
11187
11325
  }
11188
11326
  }
11189
11327
  });
11190
- if (!this.queueProcessing) {
11191
- this.queueProcessing = true;
11192
- this.processQueue().catch((err) => {
11193
- this.logExtractionQueueFailure(err, "processor");
11194
- this.queueProcessing = false;
11195
- });
11196
- }
11197
11328
  log.debug(`queued extraction from ${reason}`);
11198
11329
  }
11199
11330
  normalizeExtractionFingerprintTurns(turns) {
@@ -11237,50 +11368,6 @@ ${normalized}`).digest("hex");
11237
11368
  }
11238
11369
  return true;
11239
11370
  }
11240
- /**
11241
- * Background serial queue processor.
11242
- * Processes extractions one at a time to avoid race conditions.
11243
- * Called automatically when items are queued.
11244
- */
11245
- async processQueue() {
11246
- while (this.extractionQueue.length > 0) {
11247
- const task = this.extractionQueue.shift();
11248
- if (task) {
11249
- try {
11250
- await task();
11251
- } catch (err) {
11252
- this.logExtractionQueueFailure(err, "task");
11253
- }
11254
- }
11255
- }
11256
- this.queueProcessing = false;
11257
- }
11258
- /**
11259
- * Classify + log a failure from either the per-task catch inside
11260
- * `processQueue()` or the outer `processQueue().catch(...)` in
11261
- * `queueBufferedExtraction()`. Issue #549: `throwIfRecallAborted`
11262
- * (used throughout `runExtraction`) raises an Error whose `name` is
11263
- * `"AbortError"`. That path fires when `before_reset` aborts a
11264
- * queued task to avoid duplicate extraction — it is intentional
11265
- * cancellation, not a failure. Downgrading the log to debug
11266
- * prevents spurious `error`-level lines that routinely appear
11267
- * right next to a successful `persisted: N facts, M entities` log
11268
- * and that confuse operators into thinking extraction is broken.
11269
- * Genuine extraction failures (network, parse, I/O) still log at
11270
- * `error`.
11271
- *
11272
- * Source differentiates the two call sites so the log message
11273
- * names the right layer (`task` vs `processor`).
11274
- */
11275
- logExtractionQueueFailure(err, source) {
11276
- const aborted = source === "task" ? "background extraction task aborted (session transition)" : "background extraction queue processor aborted (session transition)";
11277
- const failed = source === "task" ? "background extraction task failed" : "background extraction queue processor failed";
11278
- if (isAbortError(err)) {
11279
- log.debug(aborted);
11280
- } else {
11281
- log.error(failed, err);
11282
- }
11283
- }
11284
11371
  /**
11285
11372
  * Passive correction capture (issue #1581) — detects corrections expressed
11286
11373
  * passively in conversation turns and routes them to the Correction Contract
@@ -11895,6 +11982,7 @@ ${normalized}`).digest("hex");
11895
11982
  const profileAllowsSharedWrites = !scopeProfileWritePlan || Boolean(
11896
11983
  scopeProfileWritePlan.profile.readOrder.includes("serverShared") && scopeProfileWritePlan.readNamespaces.includes(this.config.sharedNamespace) && sharedProfileLayer?.readable && sharedProfileLayer.writable && sharedPromotionTarget?.authorized
11897
11984
  );
11985
+ const namespacesEnabled = this.config.namespacesEnabled;
11898
11986
  const profileAutoPromotionAllows = (category, confidence) => {
11899
11987
  if (!scopeProfileWritePlan) return false;
11900
11988
  const actualTier = confidenceTier(confidence);
@@ -11963,7 +12051,7 @@ ${normalized}`).digest("hex");
11963
12051
  }
11964
12052
  continue;
11965
12053
  }
11966
- const promotedId = await targetStorage.writeMemory(
12054
+ const targetPromotion = await targetStorage.writeMemory(
11967
12055
  options.category,
11968
12056
  citedContent,
11969
12057
  {
@@ -11989,7 +12077,8 @@ ${normalized}`).digest("hex");
11989
12077
  ...options.provenance ? { provenance: options.provenance } : {}
11990
12078
  }
11991
12079
  );
11992
- if (lifecycleCaps.temporalSupersession && options.category === "fact" && options.entityRef && options.structuredAttributes && Object.keys(options.structuredAttributes).length > 0) {
12080
+ const promotedId = targetPromotion.id;
12081
+ if (!targetPromotion.tombstoneBlocked && lifecycleCaps.temporalSupersession && options.category === "fact" && options.entityRef && options.structuredAttributes && Object.keys(options.structuredAttributes).length > 0) {
11993
12082
  try {
11994
12083
  await applyTemporalSupersession({
11995
12084
  storage: targetStorage,
@@ -12005,19 +12094,21 @@ ${normalized}`).digest("hex");
12005
12094
  );
12006
12095
  }
12007
12096
  }
12008
- trackPersistedId(targetStorage, promotedId, { includeReturnedIds: false });
12009
- await this.indexPersistedMemory(targetStorage, promotedId);
12010
- trackBehaviorSignals(
12011
- targetStorage,
12012
- buildBehaviorSignalsForMemory({
12013
- memoryId: promotedId,
12014
- category: options.category,
12015
- content: options.content,
12016
- namespace: target.namespace,
12017
- confidence: options.confidence,
12018
- source: "extraction"
12019
- })
12020
- );
12097
+ if (!targetPromotion.tombstoneBlocked) {
12098
+ trackPersistedId(targetStorage, promotedId, { includeReturnedIds: false });
12099
+ await this.indexPersistedMemory(targetStorage, promotedId);
12100
+ trackBehaviorSignals(
12101
+ targetStorage,
12102
+ buildBehaviorSignalsForMemory({
12103
+ memoryId: promotedId,
12104
+ category: options.category,
12105
+ content: options.content,
12106
+ namespace: target.namespace,
12107
+ confidence: options.confidence,
12108
+ source: "extraction"
12109
+ })
12110
+ );
12111
+ }
12021
12112
  } catch (err) {
12022
12113
  log.warn(
12023
12114
  `persistExtraction: ${target.target} promotion failed open for ${options.sourceMemoryId}: ${err}`
@@ -12109,7 +12200,7 @@ ${normalized}`).digest("hex");
12109
12200
  return;
12110
12201
  }
12111
12202
  }
12112
- const promotedId = await sharedStorage.writeMemory(
12203
+ const sharedPromotion = await sharedStorage.writeMemory(
12113
12204
  options.category,
12114
12205
  citedContent,
12115
12206
  {
@@ -12136,7 +12227,8 @@ ${normalized}`).digest("hex");
12136
12227
  ...options.provenance ? { provenance: options.provenance } : {}
12137
12228
  }
12138
12229
  );
12139
- if (lifecycleCaps.temporalSupersession && options.entityRef && options.structuredAttributes && Object.keys(options.structuredAttributes).length > 0) {
12230
+ const promotedId = sharedPromotion.id;
12231
+ if (!sharedPromotion.tombstoneBlocked && lifecycleCaps.temporalSupersession && options.entityRef && options.structuredAttributes && Object.keys(options.structuredAttributes).length > 0) {
12140
12232
  try {
12141
12233
  await applyTemporalSupersession({
12142
12234
  storage: sharedStorage,
@@ -12152,21 +12244,23 @@ ${normalized}`).digest("hex");
12152
12244
  );
12153
12245
  }
12154
12246
  }
12155
- trackPersistedId(sharedStorage, promotedId, {
12156
- includeReturnedIds: false
12157
- });
12158
- await this.indexPersistedMemory(sharedStorage, promotedId);
12159
- trackBehaviorSignals(
12160
- sharedStorage,
12161
- buildBehaviorSignalsForMemory({
12162
- memoryId: promotedId,
12163
- category: options.category,
12164
- content: options.content,
12165
- namespace: this.config.sharedNamespace,
12166
- confidence: options.confidence,
12167
- source: "extraction"
12168
- })
12169
- );
12247
+ if (!sharedPromotion.tombstoneBlocked) {
12248
+ trackPersistedId(sharedStorage, promotedId, {
12249
+ includeReturnedIds: false
12250
+ });
12251
+ await this.indexPersistedMemory(sharedStorage, promotedId);
12252
+ trackBehaviorSignals(
12253
+ sharedStorage,
12254
+ buildBehaviorSignalsForMemory({
12255
+ memoryId: promotedId,
12256
+ category: options.category,
12257
+ content: options.content,
12258
+ namespace: this.config.sharedNamespace,
12259
+ confidence: options.confidence,
12260
+ source: "extraction"
12261
+ })
12262
+ );
12263
+ }
12170
12264
  } catch (err) {
12171
12265
  log.warn(
12172
12266
  `persistExtraction: shared promotion failed open for ${options.sourceMemoryId}: ${err}`
@@ -12294,6 +12388,7 @@ ${normalized}`).digest("hex");
12294
12388
  const routeRules = await this.loadRoutingRules();
12295
12389
  const routeOptions = this.routeEngineOptions();
12296
12390
  const preRoutedCategories = new Array(facts.length);
12391
+ const preRoutedNamespaceByFact = new Array(facts.length);
12297
12392
  if (routeRules.length > 0) {
12298
12393
  for (let fi = 0; fi < facts.length; fi++) {
12299
12394
  const f = facts[fi];
@@ -12307,6 +12402,9 @@ ${normalized}`).digest("hex");
12307
12402
  if (selected?.target.category) {
12308
12403
  preRoutedCategories[fi] = selected.target.category;
12309
12404
  }
12405
+ if (selected?.target.namespace) {
12406
+ preRoutedNamespaceByFact[fi] = selected.target.namespace;
12407
+ }
12310
12408
  } catch {
12311
12409
  }
12312
12410
  }
@@ -12344,9 +12442,24 @@ ${normalized}`).digest("hex");
12344
12442
  )) {
12345
12443
  continue;
12346
12444
  }
12347
- if (preJudgeRedactionRules.length > 0) {
12445
+ let factRedactionRules = preJudgeRedactionRules;
12446
+ let factNs = preRoutedNamespaceByFact[fi];
12447
+ if (!factNs && lifecycleCaps.extractionScopeClassification && namespacesEnabled && f.scope === "global" && profileAllowsSharedWrites && this.storageDirNamespace(storage.dir) !== this.config.sharedNamespace) {
12448
+ factNs = this.config.sharedNamespace;
12449
+ }
12450
+ if (factNs) {
12451
+ try {
12452
+ const factDir = (await this.storageRouter.storageFor(factNs)).dir;
12453
+ if (factDir !== storage.dir) {
12454
+ const targetRules = await redactionRulesFor(factDir);
12455
+ if (targetRules.length) factRedactionRules = [...preJudgeRedactionRules, ...targetRules];
12456
+ }
12457
+ } catch {
12458
+ }
12459
+ }
12460
+ if (factRedactionRules.length > 0) {
12348
12461
  const rc = f.content + (f.structuredAttributes ? " " + JSON.stringify(f.structuredAttributes) : "") + (f.procedureSteps ? " " + f.procedureSteps.map((s) => `${s.intent} ${s.expectedOutcome ?? ""} ${s.toolCall ? `${s.toolCall.kind} ${s.toolCall.signature}` : ""}`.trim()).join(" ") : "");
12349
- if (contentMatchesRedactionRules(rc, preJudgeRedactionRules)) continue;
12462
+ if (contentMatchesRedactionRules(rc, factRedactionRules)) continue;
12350
12463
  }
12351
12464
  judgeCandidates.push({
12352
12465
  text: f.content,
@@ -12483,7 +12596,7 @@ ${normalized}`).digest("hex");
12483
12596
  );
12484
12597
  }
12485
12598
  }
12486
- if (lifecycleCaps.extractionScopeClassification && this.config.namespacesEnabled && fact.scope === "global" && !routedNamespaceExplicit) {
12599
+ if (lifecycleCaps.extractionScopeClassification && namespacesEnabled && fact.scope === "global" && !routedNamespaceExplicit) {
12487
12600
  const currentNs = this.storageDirNamespace(targetStorage.dir);
12488
12601
  if (currentNs !== this.config.sharedNamespace && profileAllowsSharedWrites) {
12489
12602
  try {
@@ -12677,9 +12790,10 @@ ${normalized}`).digest("hex");
12677
12790
  let supersedes;
12678
12791
  let links = [];
12679
12792
  let contradictionDetected = false;
12793
+ let contradiction;
12680
12794
  if (this.config.contradictionDetectionEnabled && this.qmd.isAvailable() && faithfulnessEnforceStatus !== "pending_review") {
12681
12795
  const targetNamespace = this.storageDirNamespace(targetStorage.dir);
12682
- const contradiction = await this.checkForContradiction(
12796
+ contradiction = await this.checkForContradiction(
12683
12797
  fact.content,
12684
12798
  writeCategory,
12685
12799
  targetNamespace
@@ -12695,14 +12809,6 @@ ${normalized}`).digest("hex");
12695
12809
  strength: contradiction.confidence,
12696
12810
  reason: contradiction.reason
12697
12811
  });
12698
- if (this.config.contradictionAutoResolve && this.config.queryAwareIndexingEnabled && contradiction.supersededPath) {
12699
- deindexMemory(
12700
- this.config.memoryDir,
12701
- contradiction.supersededPath,
12702
- contradiction.supersededCreated,
12703
- contradiction.supersededTags
12704
- );
12705
- }
12706
12812
  }
12707
12813
  }
12708
12814
  const isCorrection = writeCategory === "correction";
@@ -12742,7 +12848,7 @@ ${normalized}`).digest("hex");
12742
12848
  const memoryKind2 = this.config.episodeNoteModeEnabled ? classifyMemoryKind(fact.content, fact.tags ?? [], writeCategory) : void 0;
12743
12849
  const rawChunkedContent = citationEnabled && hasCitationForTemplate(fact.content, citationTemplate) ? stripCitationForTemplate(fact.content, citationTemplate) : fact.content;
12744
12850
  const citedChunkedContent = applyInlineCitation(rawChunkedContent);
12745
- const parentId = await targetStorage.writeMemory(
12851
+ const parentWrite = await targetStorage.writeMemory(
12746
12852
  writeCategory,
12747
12853
  citedChunkedContent,
12748
12854
  {
@@ -12769,6 +12875,15 @@ ${normalized}`).digest("hex");
12769
12875
  ...fact.provenance ? { provenance: fact.provenance } : {}
12770
12876
  }
12771
12877
  );
12878
+ const parentId = parentWrite.id;
12879
+ const tombstoneBlocked2 = parentWrite.tombstoneBlocked;
12880
+ const postWriteGuard2 = faithfulnessEnforceStatus === "pending_review" || tombstoneBlocked2;
12881
+ await this.applyDeferredContradictionResolve(
12882
+ contradiction,
12883
+ targetStorage,
12884
+ parentId,
12885
+ postWriteGuard2
12886
+ );
12772
12887
  try {
12773
12888
  for (const chunk of chunkResult.chunks) {
12774
12889
  const chunkImportance = scoreImportance(
@@ -12806,7 +12921,9 @@ ${normalized}`).digest("hex");
12806
12921
  // fact's verdict + enforce status so a pending_review fact
12807
12922
  // is not indexed as active through its chunks (chatgpt P2).
12808
12923
  ...faithfulnessFm ? { faithfulness: faithfulnessFm } : {},
12809
- ...faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {},
12924
+ // #1645 (OchiE): inherit pending_review + blockedBy so no chunk lands active.
12925
+ ...postWriteGuard2 ? { status: "pending_review" } : faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {},
12926
+ ...tombstoneBlocked2 && parentWrite.blockedBy ? { blockedBy: parentWrite.blockedBy } : {},
12810
12927
  // Claim-level provenance (issue #1575 PR 2): mirror the
12811
12928
  // parent's spans onto each chunk so a chunk surfaced
12812
12929
  // independently (memory_get/x-ray on a chunk ID) preserves
@@ -12827,13 +12944,15 @@ ${normalized}`).digest("hex");
12827
12944
  `chunked memory ${parentId} into ${chunkResult.chunks.length} chunks`
12828
12945
  );
12829
12946
  trackPersistedId(targetStorage, parentId, {
12830
- pendingReview: faithfulnessEnforceStatus === "pending_review"
12947
+ pendingReview: postWriteGuard2
12831
12948
  });
12832
- if (faithfulnessEnforceStatus !== "pending_review" && threadEpisodeIdsForGraph && !threadEpisodeIdsForGraph.includes(parentId)) {
12949
+ if (!postWriteGuard2 && threadEpisodeIdsForGraph && !threadEpisodeIdsForGraph.includes(parentId)) {
12833
12950
  threadEpisodeIdsForGraph.push(parentId);
12834
12951
  }
12835
- await this.indexPersistedMemory(targetStorage, parentId);
12836
- if (faithfulnessEnforceStatus !== "pending_review") {
12952
+ if (!postWriteGuard2) {
12953
+ await this.indexPersistedMemory(targetStorage, parentId);
12954
+ }
12955
+ if (!postWriteGuard2) {
12837
12956
  try {
12838
12957
  const supersessionEntityRef = typeof fact.entityRef === "string" ? fact.entityRef : void 0;
12839
12958
  await applyTemporalSupersession({
@@ -12851,7 +12970,7 @@ ${normalized}`).digest("hex");
12851
12970
  log.warn(`temporal-supersession (chunked): unexpected error: ${err}`);
12852
12971
  }
12853
12972
  }
12854
- if (faithfulnessEnforceStatus !== "pending_review") await promoteMemoryToShared({
12973
+ if (!postWriteGuard2) await promoteMemoryToShared({
12855
12974
  sourceStorage: targetStorage,
12856
12975
  category: writeCategory,
12857
12976
  content: fact.content,
@@ -12877,7 +12996,9 @@ ${normalized}`).digest("hex");
12877
12996
  });
12878
12997
  try {
12879
12998
  const canonicalChunkedContent = citationEnabled && hasCitationForTemplate(fact.content, citationTemplate) ? stripCitationForTemplate(fact.content, citationTemplate) : fact.content;
12880
- await this.addContentHashDedup(targetStorage, canonicalChunkedContent);
12999
+ if (!tombstoneBlocked2) {
13000
+ await this.addContentHashDedup(targetStorage, canonicalChunkedContent);
13001
+ }
12881
13002
  } catch (err) {
12882
13003
  log.warn(
12883
13004
  `content-hash dedup registration failed for chunked memory ${parentId}: ${err}`
@@ -12885,10 +13006,12 @@ ${normalized}`).digest("hex");
12885
13006
  }
12886
13007
  for (const chunk of chunkResult.chunks) {
12887
13008
  const chunkId = `${parentId}-chunk-${chunk.index}`;
12888
- await this.indexPersistedMemory(targetStorage, chunkId);
13009
+ if (!postWriteGuard2) {
13010
+ await this.indexPersistedMemory(targetStorage, chunkId);
13011
+ }
12889
13012
  }
12890
13013
  try {
12891
- if (this.config.verbatimArtifactsEnabled && this.config.verbatimArtifactCategories.includes(writeCategory) && fact.confidence >= this.config.verbatimArtifactsMinConfidence && faithfulnessEnforceStatus !== "pending_review") {
13014
+ if (this.config.verbatimArtifactsEnabled && this.config.verbatimArtifactCategories.includes(writeCategory) && fact.confidence >= this.config.verbatimArtifactsMinConfidence && !postWriteGuard2) {
12892
13015
  await targetStorage.writeArtifact(citedChunkedContent, {
12893
13016
  confidence: fact.confidence,
12894
13017
  tags: [...fact.tags, "artifact", "chunked-parent"],
@@ -12899,7 +13022,7 @@ ${normalized}`).digest("hex");
12899
13022
  intentEntityTypes: inferredIntent?.entityTypes
12900
13023
  });
12901
13024
  }
12902
- if (graphCaps.multiGraphMemory && faithfulnessEnforceStatus !== "pending_review") {
13025
+ if (graphCaps.multiGraphMemory && !postWriteGuard2) {
12903
13026
  try {
12904
13027
  const graphContext = await ensureGraphContext(targetStorage);
12905
13028
  const entityRef = typeof fact.entityRef === "string" ? fact.entityRef : void 0;
@@ -12965,7 +13088,7 @@ ${normalized}`).digest("hex");
12965
13088
  const memoryKind = writeCategory === "procedure" ? void 0 : this.config.episodeNoteModeEnabled ? classifyMemoryKind(fact.content, fact.tags ?? [], writeCategory) : void 0;
12966
13089
  const rawPersistBody = writeCategory === "procedure" ? buildProcedurePersistBody(fact.content, fact.procedureSteps) : fact.content;
12967
13090
  const citedFactContent = applyInlineCitation(rawPersistBody);
12968
- const memoryId = await targetStorage.writeMemory(
13091
+ const factWrite = await targetStorage.writeMemory(
12969
13092
  writeCategory,
12970
13093
  citedFactContent,
12971
13094
  {
@@ -12994,12 +13117,21 @@ ${normalized}`).digest("hex");
12994
13117
  ...fact.provenance ? { provenance: fact.provenance } : {}
12995
13118
  }
12996
13119
  );
13120
+ const memoryId = factWrite.id;
13121
+ const tombstoneBlocked = factWrite.tombstoneBlocked;
13122
+ const postWriteGuard = faithfulnessEnforceStatus === "pending_review" || tombstoneBlocked;
13123
+ await this.applyDeferredContradictionResolve(
13124
+ contradiction,
13125
+ targetStorage,
13126
+ memoryId,
13127
+ postWriteGuard
13128
+ );
12997
13129
  if (routedRuleId) {
12998
13130
  log.debug(
12999
13131
  `routing applied for memory ${memoryId}: rule=${routedRuleId} category=${writeCategory} storage=${targetStorage.dir}`
13000
13132
  );
13001
13133
  }
13002
- if (faithfulnessEnforceStatus !== "pending_review") {
13134
+ if (!postWriteGuard) {
13003
13135
  try {
13004
13136
  const supersessionEntityRef = typeof fact.entityRef === "string" ? fact.entityRef : void 0;
13005
13137
  await applyTemporalSupersession({
@@ -13027,13 +13159,15 @@ ${normalized}`).digest("hex");
13027
13159
  })
13028
13160
  );
13029
13161
  trackPersistedId(targetStorage, memoryId, {
13030
- pendingReview: faithfulnessEnforceStatus === "pending_review"
13162
+ pendingReview: postWriteGuard
13031
13163
  });
13032
- if (faithfulnessEnforceStatus !== "pending_review" && threadEpisodeIdsForGraph && !threadEpisodeIdsForGraph.includes(memoryId)) {
13164
+ if (!postWriteGuard && threadEpisodeIdsForGraph && !threadEpisodeIdsForGraph.includes(memoryId)) {
13033
13165
  threadEpisodeIdsForGraph.push(memoryId);
13034
13166
  }
13035
- await this.indexPersistedMemory(targetStorage, memoryId);
13036
- if (faithfulnessEnforceStatus !== "pending_review") await promoteMemoryToShared({
13167
+ if (!postWriteGuard) {
13168
+ await this.indexPersistedMemory(targetStorage, memoryId);
13169
+ }
13170
+ if (!postWriteGuard) await promoteMemoryToShared({
13037
13171
  sourceStorage: targetStorage,
13038
13172
  category: writeCategory,
13039
13173
  content: fact.content,
@@ -13057,7 +13191,7 @@ ${normalized}`).digest("hex");
13057
13191
  ...fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {},
13058
13192
  ...fact.provenance ? { provenance: fact.provenance } : {}
13059
13193
  });
13060
- if (graphCaps.multiGraphMemory && faithfulnessEnforceStatus !== "pending_review") {
13194
+ if (graphCaps.multiGraphMemory && !postWriteGuard) {
13061
13195
  try {
13062
13196
  const graphContext = await ensureGraphContext(targetStorage);
13063
13197
  const entityRef = typeof fact.entityRef === "string" ? fact.entityRef : void 0;
@@ -13093,7 +13227,7 @@ ${normalized}`).digest("hex");
13093
13227
  } catch {
13094
13228
  }
13095
13229
  }
13096
- if (this.config.verbatimArtifactsEnabled && this.config.verbatimArtifactCategories.includes(writeCategory) && fact.confidence >= this.config.verbatimArtifactsMinConfidence && faithfulnessEnforceStatus !== "pending_review") {
13230
+ if (this.config.verbatimArtifactsEnabled && this.config.verbatimArtifactCategories.includes(writeCategory) && fact.confidence >= this.config.verbatimArtifactsMinConfidence && !postWriteGuard) {
13097
13231
  await targetStorage.writeArtifact(citedFactContent, {
13098
13232
  confidence: fact.confidence,
13099
13233
  tags: [...fact.tags, "artifact"],
@@ -13107,7 +13241,9 @@ ${normalized}`).digest("hex");
13107
13241
  try {
13108
13242
  const canonicalFactContent = citationEnabled && hasCitationForTemplate(fact.content, citationTemplate) ? stripCitationForTemplate(fact.content, citationTemplate) : fact.content;
13109
13243
  const hashRegisterKey = writeCategory === "procedure" ? buildProcedurePersistBody(fact.content, fact.procedureSteps) : canonicalFactContent;
13110
- await this.addContentHashDedup(targetStorage, hashRegisterKey);
13244
+ if (!tombstoneBlocked) {
13245
+ await this.addContentHashDedup(targetStorage, hashRegisterKey);
13246
+ }
13111
13247
  } catch (err) {
13112
13248
  log.warn(
13113
13249
  `content-hash dedup registration failed for memory ${memoryId}: ${err}`
@@ -13344,7 +13480,7 @@ ${normalized}`).digest("hex");
13344
13480
  */
13345
13481
  async updateTemporalTagIndexes(storage, persistedIds) {
13346
13482
  const caps = resolveCapabilities(this.config);
13347
- if (!this.config.queryAwareIndexingEnabled && !caps.parallelRetrieval)
13483
+ if (!resolveIndexingCapabilities(this.config).queryAwareIndexing && !caps.parallelRetrieval)
13348
13484
  return;
13349
13485
  const needsFullRebuild = !indexesExist(this.config.memoryDir);
13350
13486
  if (!needsFullRebuild && persistedIds.length === 0) return;
@@ -13410,11 +13546,11 @@ ${normalized}`).digest("hex");
13410
13546
  );
13411
13547
  const profile = await this.storage.readProfile();
13412
13548
  const result = await this.extraction.consolidate(recent, older, profile);
13413
- const memoryLookup = this.config.queryAwareIndexingEnabled ? new Map(allMemories.map((m) => [m.frontmatter.id, m])) : null;
13549
+ const memoryLookup = resolveIndexingCapabilities(this.config).queryAwareIndexing ? new Map(allMemories.map((m) => [m.frontmatter.id, m])) : null;
13414
13550
  for (const item of result.items) {
13415
13551
  switch (item.action) {
13416
13552
  case "INVALIDATE": {
13417
- const toInvalidate = this.config.queryAwareIndexingEnabled ? memoryLookup?.get(item.existingId) ?? null : null;
13553
+ const toInvalidate = resolveIndexingCapabilities(this.config).queryAwareIndexing ? memoryLookup?.get(item.existingId) ?? null : null;
13418
13554
  if (await this.storage.invalidateMemory(item.existingId)) {
13419
13555
  invalidated += 1;
13420
13556
  memoryItemMutated = true;
@@ -13455,7 +13591,7 @@ ${normalized}`).digest("hex");
13455
13591
  );
13456
13592
  memoryItemMutated = true;
13457
13593
  await this.indexPersistedMemory(this.storage, item.existingId);
13458
- const toMergeInvalidate = this.config.queryAwareIndexingEnabled ? memoryLookup?.get(item.mergeWith) ?? null : null;
13594
+ const toMergeInvalidate = resolveIndexingCapabilities(this.config).queryAwareIndexing ? memoryLookup?.get(item.mergeWith) ?? null : null;
13459
13595
  if (await this.storage.invalidateMemory(item.mergeWith)) {
13460
13596
  invalidated += 1;
13461
13597
  merged += 1;
@@ -13511,7 +13647,7 @@ ${normalized}`).digest("hex");
13511
13647
  if (deletedCommitments.length > 0) {
13512
13648
  memoryItemMutated = true;
13513
13649
  log.info(`cleaned ${deletedCommitments.length} expired commitments`);
13514
- if (this.config.queryAwareIndexingEnabled) {
13650
+ if (resolveIndexingCapabilities(this.config).queryAwareIndexing) {
13515
13651
  for (const m of deletedCommitments) {
13516
13652
  deindexMemory(
13517
13653
  this.config.memoryDir,
@@ -13522,7 +13658,7 @@ ${normalized}`).digest("hex");
13522
13658
  }
13523
13659
  }
13524
13660
  }
13525
- if (this.config.creationMemoryEnabled && this.config.commitmentLedgerEnabled && this.config.commitmentLifecycleEnabled) {
13661
+ if (resolveCreationMemoryCapabilities(this.config).creationMemory && resolveCreationMemoryCapabilities(this.config).commitmentLedger && resolveCreationMemoryCapabilities(this.config).commitmentLifecycle) {
13526
13662
  try {
13527
13663
  const lifecycle = await applyCommitmentLedgerLifecycle({
13528
13664
  memoryDir: this.config.memoryDir,
@@ -13544,7 +13680,7 @@ ${normalized}`).digest("hex");
13544
13680
  if (deletedTTL.length > 0) {
13545
13681
  memoryItemMutated = true;
13546
13682
  log.info(`cleaned ${deletedTTL.length} TTL-expired memories`);
13547
- if (this.config.queryAwareIndexingEnabled) {
13683
+ if (resolveIndexingCapabilities(this.config).queryAwareIndexing) {
13548
13684
  for (const m of deletedTTL) {
13549
13685
  deindexMemory(
13550
13686
  this.config.memoryDir,
@@ -13769,242 +13905,19 @@ ${texts.map((t, i) => `[${i + 1}] ${t}`).join("\n\n")}`;
13769
13905
  return { memoriesProcessed: allMemories.length, merged, invalidated };
13770
13906
  }
13771
13907
  async optimizeCompressionGuidelines(options) {
13772
- const dryRun = options?.dryRun === true;
13773
- const eventLimit = typeof options?.eventLimit === "number" ? Math.max(0, Math.floor(options.eventLimit)) : 500;
13774
- const [activeState, draftState] = await Promise.all([
13775
- this.storage.readCompressionGuidelineOptimizerState(),
13776
- this.storage.readCompressionGuidelineDraftState().catch(() => null)
13777
- ]);
13778
- const previousState = draftState && ((activeState?.guidelineVersion ?? 0) < draftState.guidelineVersion || (activeState?.guidelineVersion ?? 0) === draftState.guidelineVersion) ? draftState : activeState;
13779
- if (!this.config.compressionGuidelineLearningEnabled) {
13780
- return {
13781
- enabled: false,
13782
- dryRun,
13783
- eventCount: 0,
13784
- previousGuidelineVersion: previousState?.guidelineVersion ?? null,
13785
- nextGuidelineVersion: previousState?.guidelineVersion ?? 0,
13786
- changedRules: 0,
13787
- semanticRefinementApplied: false,
13788
- persisted: false,
13789
- draftContentHash: null
13790
- };
13791
- }
13792
- let events = await this.storage.readMemoryActionEvents(eventLimit);
13793
- if (eventLimit > 0) {
13794
- let effectiveEvents = events.filter((event) => event.dryRun !== true);
13795
- let fetchLimit = eventLimit;
13796
- while (effectiveEvents.length < eventLimit && events.length === fetchLimit) {
13797
- fetchLimit = Math.min(fetchLimit * 2, fetchLimit + 1e3);
13798
- if (fetchLimit <= events.length) break;
13799
- events = await this.storage.readMemoryActionEvents(fetchLimit);
13800
- effectiveEvents = events.filter((event) => event.dryRun !== true);
13801
- }
13802
- events = effectiveEvents.slice(-eventLimit);
13803
- }
13804
- const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
13805
- const candidate = computeCompressionGuidelineCandidate(events, {
13806
- generatedAtIso: generatedAt,
13807
- previousState
13808
- });
13809
- if (candidate.eventCounts.total === 0) {
13810
- return {
13811
- enabled: true,
13812
- dryRun,
13813
- eventCount: 0,
13814
- previousGuidelineVersion: previousState?.guidelineVersion ?? null,
13815
- nextGuidelineVersion: previousState?.guidelineVersion ?? 0,
13816
- changedRules: 0,
13817
- semanticRefinementApplied: false,
13818
- persisted: false,
13819
- draftContentHash: null
13820
- };
13821
- }
13822
- const refinedCandidate = await refineCompressionGuidelineCandidateSemantically(candidate, {
13823
- enabled: this.config.compressionGuidelineSemanticRefinementEnabled,
13824
- timeoutMs: this.config.compressionGuidelineSemanticTimeoutMs,
13825
- runRefinement: async (baseline) => {
13826
- const prompt = [
13827
- "You refine compression policy suggestions conservatively.",
13828
- "Return JSON only in this shape:",
13829
- '{"updates":[{"action":"summarize_node","delta":0.02,"confidence":"medium","note":"..."}]}',
13830
- "Constraints:",
13831
- "- Keep updates sparse and conservative.",
13832
- "- delta must stay between -0.15 and 0.15.",
13833
- "- Only include actions present in the input.",
13834
- "Input candidate:",
13835
- JSON.stringify(baseline)
13836
- ].join("\n");
13837
- const response = await this.fastChatCompletion(
13838
- [
13839
- {
13840
- role: "system",
13841
- content: "Respond with strict JSON only. No markdown."
13842
- },
13843
- { role: "user", content: prompt }
13844
- ],
13845
- {
13846
- temperature: 0.1,
13847
- maxTokens: 400,
13848
- operation: "compression_guideline_semantic_refinement",
13849
- priority: "background"
13850
- }
13851
- );
13852
- return this.parseCompressionSemanticRefinement(
13853
- response?.content ?? ""
13854
- );
13855
- }
13856
- });
13857
- const content = renderCompressionGuidelinesMarkdown(refinedCandidate);
13858
- const contentHash = createHash("sha256").update(content).digest("hex");
13859
- const semanticRefinementApplied = JSON.stringify(refinedCandidate.ruleUpdates) !== JSON.stringify(candidate.ruleUpdates);
13860
- const changedRules = refinedCandidate.ruleUpdates.filter(
13861
- (rule) => rule.delta !== 0
13862
- ).length;
13863
- if (!dryRun) {
13864
- await this.storage.writeCompressionGuidelineDraft(content);
13865
- await this.storage.writeCompressionGuidelineDraftState({
13866
- version: refinedCandidate.optimizerVersion,
13867
- updatedAt: refinedCandidate.generatedAt,
13868
- sourceWindow: refinedCandidate.sourceWindow,
13869
- eventCounts: refinedCandidate.eventCounts,
13870
- guidelineVersion: refinedCandidate.guidelineVersion,
13871
- contentHash,
13872
- activationState: "draft",
13873
- actionSummaries: refinedCandidate.actionSummaries,
13874
- ruleUpdates: refinedCandidate.ruleUpdates
13875
- });
13876
- }
13877
- return {
13878
- enabled: true,
13879
- dryRun,
13880
- eventCount: candidate.eventCounts.total,
13881
- previousGuidelineVersion: previousState?.guidelineVersion ?? null,
13882
- nextGuidelineVersion: refinedCandidate.guidelineVersion,
13883
- changedRules,
13884
- semanticRefinementApplied,
13885
- persisted: !dryRun,
13886
- draftContentHash: dryRun ? null : contentHash
13887
- };
13908
+ return this.compressionGuidelineCoordinator.optimizeCompressionGuidelines(options);
13888
13909
  }
13889
13910
  async activateCompressionGuidelineDraft(options) {
13890
- if (!this.config.compressionGuidelineLearningEnabled) {
13891
- return {
13892
- enabled: false,
13893
- activated: false,
13894
- guidelineVersion: null,
13895
- reason: "disabled"
13896
- };
13897
- }
13898
- const draftState = await this.storage.readCompressionGuidelineDraftState();
13899
- if (!draftState) {
13900
- return {
13901
- enabled: true,
13902
- activated: false,
13903
- guidelineVersion: null,
13904
- reason: "missing_draft"
13905
- };
13906
- }
13907
- const expectedContentHash = options?.expectedContentHash?.trim();
13908
- const expectedGuidelineVersion = options?.expectedGuidelineVersion;
13909
- if ((!expectedContentHash || expectedContentHash.length === 0) && typeof expectedGuidelineVersion !== "number") {
13910
- return {
13911
- enabled: true,
13912
- activated: false,
13913
- guidelineVersion: null,
13914
- reason: "expected_revision_required"
13915
- };
13916
- }
13917
- if (expectedContentHash && draftState.contentHash !== expectedContentHash) {
13918
- return {
13919
- enabled: true,
13920
- activated: false,
13921
- guidelineVersion: null,
13922
- reason: "content_hash_mismatch"
13923
- };
13924
- }
13925
- if (typeof expectedGuidelineVersion === "number" && draftState.guidelineVersion !== expectedGuidelineVersion) {
13926
- return {
13927
- enabled: true,
13928
- activated: false,
13929
- guidelineVersion: null,
13930
- reason: "guideline_version_mismatch"
13931
- };
13932
- }
13933
- const activated = await this.storage.activateCompressionGuidelineDraft({
13934
- ...expectedContentHash ? { expectedContentHash } : {},
13935
- ...typeof expectedGuidelineVersion === "number" ? { expectedGuidelineVersion } : {}
13936
- });
13937
- return {
13938
- enabled: true,
13939
- activated,
13940
- guidelineVersion: activated ? draftState.guidelineVersion : null,
13941
- ...activated ? {} : { reason: "draft_changed" }
13942
- };
13911
+ return this.compressionGuidelineCoordinator.activateCompressionGuidelineDraft(options);
13943
13912
  }
13913
+ // Issue #1526 (seam 4): compression-guideline learning moved to
13914
+ // CompressionGuidelineCoordinator. Thin delegation keeps the
13915
+ // consolidation-loop hook + recall-section hook call sites stable.
13944
13916
  async runCompressionGuidelineLearningPass() {
13945
- if (!this.config.compressionGuidelineLearningEnabled) return;
13946
- try {
13947
- const result = await this.optimizeCompressionGuidelines({
13948
- dryRun: false,
13949
- eventLimit: 500
13950
- });
13951
- log.info(
13952
- `compression guideline learning updated (${result.eventCount} events)`
13953
- );
13954
- } catch (err) {
13955
- log.warn(`compression guideline learning failed (ignored): ${err}`);
13956
- }
13917
+ return this.compressionGuidelineCoordinator.runCompressionGuidelineLearningPass();
13957
13918
  }
13958
13919
  async buildCompressionGuidelineRecallSection() {
13959
- if (!this.config.contextCompressionActionsEnabled) return null;
13960
- if (!this.config.compressionGuidelineLearningEnabled) return null;
13961
- const state = await this.storage.readCompressionGuidelineOptimizerState().catch(() => null);
13962
- if (!state || state.guidelineVersion <= 0) return null;
13963
- const raw = await this.storage.readCompressionGuidelines().catch(() => null);
13964
- const summary = raw ? formatCompressionGuidelinesForRecall(raw, 5) : null;
13965
- if (!summary) return null;
13966
- return [
13967
- "## Active Compression Guidelines",
13968
- "",
13969
- `Guideline version: ${state.guidelineVersion}`,
13970
- `Updated: ${state.updatedAt}`,
13971
- "",
13972
- summary
13973
- ].join("\n");
13974
- }
13975
- parseCompressionSemanticRefinement(raw) {
13976
- if (typeof raw !== "string" || raw.trim().length === 0) return null;
13977
- const trimmed = raw.trim();
13978
- const start = trimmed.indexOf("{");
13979
- const end = trimmed.lastIndexOf("}");
13980
- if (start === -1 || end === -1 || end <= start) return null;
13981
- try {
13982
- const parsed = JSON.parse(trimmed.slice(start, end + 1));
13983
- if (!Array.isArray(parsed?.updates)) return null;
13984
- const validActions = /* @__PURE__ */ new Set([
13985
- "store_episode",
13986
- "store_note",
13987
- "update_note",
13988
- "create_artifact",
13989
- "summarize_node",
13990
- "discard",
13991
- "link_graph"
13992
- ]);
13993
- const updates = parsed.updates.filter(
13994
- (item) => item && typeof item.action === "string" && validActions.has(item.action)
13995
- ).map((item) => {
13996
- const confidence = item.confidence === "low" || item.confidence === "medium" || item.confidence === "high" ? item.confidence : void 0;
13997
- return {
13998
- action: item.action,
13999
- delta: typeof item.delta === "number" && Number.isFinite(item.delta) ? item.delta : void 0,
14000
- confidence,
14001
- note: typeof item.note === "string" ? item.note : void 0
14002
- };
14003
- });
14004
- return { updates };
14005
- } catch {
14006
- return null;
14007
- }
13920
+ return this.compressionGuidelineCoordinator.buildCompressionGuidelineRecallSection();
14008
13921
  }
14009
13922
  actionOutcomePriorDelta(event) {
14010
13923
  if (event.outcome === "failed") return -0.3;
@@ -14198,7 +14111,7 @@ ${texts.map((t, i) => `[${i + 1}] ${t}`).join("\n\n")}`;
14198
14111
  "fact-archival"
14199
14112
  );
14200
14113
  await this.embeddingFallback.removeFromIndex(memory.frontmatter.id);
14201
- if (this.config.queryAwareIndexingEnabled && memory.path && memory.frontmatter?.created) {
14114
+ if (resolveIndexingCapabilities(this.config).queryAwareIndexing && memory.path && memory.frontmatter?.created) {
14202
14115
  deindexMemory(
14203
14116
  this.config.memoryDir,
14204
14117
  memory.path,
@@ -15868,7 +15781,7 @@ ${lines.join("\n\n")}`;
15868
15781
  );
15869
15782
  let temporalFromDate = null;
15870
15783
  let promptTags = [];
15871
- if (this.config.queryAwareIndexingEnabled && prompt) {
15784
+ if (resolveIndexingCapabilities(this.config).queryAwareIndexing && prompt) {
15872
15785
  if (isTemporalQuery(prompt)) {
15873
15786
  temporalFromDate = recencyWindowFromPrompt(prompt, now);
15874
15787
  }
@@ -15881,7 +15794,7 @@ ${lines.join("\n\n")}`;
15881
15794
  const queryIntent = this.config.intentRoutingEnabled && prompt ? inferIntentFromText(prompt) : null;
15882
15795
  let temporalCandidates = null;
15883
15796
  let tagCandidates = null;
15884
- if (this.config.queryAwareIndexingEnabled && prompt) {
15797
+ if (resolveIndexingCapabilities(this.config).queryAwareIndexing && prompt) {
15885
15798
  const maxCandidates = this.config.queryAwareIndexingMaxCandidates;
15886
15799
  const capSet = (s) => {
15887
15800
  if (!s) return null;
@@ -15967,7 +15880,7 @@ ${lines.join("\n\n")}`;
15967
15880
  "boost"
15968
15881
  );
15969
15882
  }
15970
- if (this.config.queryAwareIndexingEnabled && r.path) {
15883
+ if (resolveIndexingCapabilities(this.config).queryAwareIndexing && r.path) {
15971
15884
  if (temporalCandidates?.has(r.path)) {
15972
15885
  score += applyUtilityRankingRuntimeDelta(
15973
15886
  0.08,
@@ -16126,14 +16039,6 @@ ${lines.join("\n\n")}`;
16126
16039
  );
16127
16040
  continue;
16128
16041
  }
16129
- if (this.config.contradictionAutoResolve) {
16130
- await resultStorage.supersedeMemory(
16131
- existingMemory.frontmatter.id,
16132
- "pending-new",
16133
- // Will be updated after the new memory is written
16134
- verification.reasoning
16135
- );
16136
- }
16137
16042
  log.info(
16138
16043
  `detected contradiction (confidence: ${verification.confidence}): ${existingMemory.frontmatter.id} vs new memory${this.config.contradictionAutoResolve ? " (auto-resolved)" : " (queued for manual review)"}`
16139
16044
  );
@@ -16149,6 +16054,50 @@ ${lines.join("\n\n")}`;
16149
16054
  }
16150
16055
  return null;
16151
16056
  }
16057
+ /**
16058
+ * #1645: Complete the deferred contradiction auto-resolve after writeMemory
16059
+ * returns and the new write's tombstone status is known. Retires the old
16060
+ * memory + deindexes it ONLY when the new write is genuinely active (not
16061
+ * tombstone-blocked / pending_review). A blocked write must not retire the
16062
+ * only active copy — deferring here closes the "contradictionAutoResolve
16063
+ * supersedes before tombstone status is known" defect class.
16064
+ */
16065
+ async applyDeferredContradictionResolve(contradiction, storage, newMemoryId, postWriteGuard) {
16066
+ if (postWriteGuard && contradiction && this.config.contradictionAutoResolve) {
16067
+ try {
16068
+ const blockedRow = await storage.getMemoryById(newMemoryId);
16069
+ if (blockedRow?.frontmatter?.supersedes) {
16070
+ await storage.writeMemoryFrontmatter(blockedRow, { supersedes: void 0 });
16071
+ }
16072
+ } catch (err) {
16073
+ log.warn(
16074
+ `contradiction auto-resolve supersedes clear failed for blocked ${newMemoryId}: ${err}`
16075
+ );
16076
+ }
16077
+ }
16078
+ if (!contradiction || !this.config.contradictionAutoResolve || postWriteGuard) {
16079
+ return;
16080
+ }
16081
+ try {
16082
+ await storage.supersedeMemory(
16083
+ contradiction.supersededId,
16084
+ newMemoryId,
16085
+ contradiction.reason
16086
+ );
16087
+ if (resolveIndexingCapabilities(this.config).queryAwareIndexing && contradiction.supersededPath) {
16088
+ deindexMemory(
16089
+ this.config.memoryDir,
16090
+ contradiction.supersededPath,
16091
+ contradiction.supersededCreated,
16092
+ contradiction.supersededTags
16093
+ );
16094
+ }
16095
+ } catch (err) {
16096
+ log.warn(
16097
+ `contradiction auto-resolve supersede failed for ${contradiction.supersededId}: ${err}`
16098
+ );
16099
+ }
16100
+ }
16152
16101
  // ---------------------------------------------------------------------------
16153
16102
  // Memory Linking (Phase 3A)
16154
16103
  // ---------------------------------------------------------------------------
@@ -16299,7 +16248,6 @@ export {
16299
16248
  isArtifactMemoryPath,
16300
16249
  deriveTopicsFromExtraction,
16301
16250
  buildCompressionGuidelinesMarkdown2 as buildCompressionGuidelinesMarkdown,
16302
- formatCompressionGuidelinesForRecall,
16303
16251
  filterRecallCandidates,
16304
16252
  shouldFilterLifecycleRecallCandidate,
16305
16253
  lifecycleRecallScoreAdjustment,
@@ -16322,4 +16270,4 @@ export {
16322
16270
  resolvePersistedMemoryRelativePath,
16323
16271
  Orchestrator
16324
16272
  };
16325
- //# sourceMappingURL=chunk-QNEUZIAH.js.map
16273
+ //# sourceMappingURL=chunk-OUITHS6V.js.map