@remnic/core 9.3.719 → 9.3.721

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 (387) hide show
  1. package/dist/access-boundary.d.ts +10 -7
  2. package/dist/access-boundary.js +37 -34
  3. package/dist/access-cli.js +71 -66
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +11 -8
  6. package/dist/access-http.js +44 -41
  7. package/dist/access-mcp.d.ts +11 -8
  8. package/dist/access-mcp.js +40 -37
  9. package/dist/access-operations-batch.js +38 -35
  10. package/dist/access-operations.d.ts +11 -8
  11. package/dist/access-operations.js +39 -36
  12. package/dist/access-schema.d.ts +19 -19
  13. package/dist/access-schema.js +3 -3
  14. package/dist/{access-service-CZbnt0t2.d.ts → access-service-Dj3I-VBS.d.ts} +3 -3
  15. package/dist/access-service.d.ts +11 -8
  16. package/dist/access-service.js +36 -33
  17. package/dist/access-surface-catalog.d.ts +10 -7
  18. package/dist/action-confidence.d.ts +1 -1
  19. package/dist/active-memory-bridge.d.ts +1 -1
  20. package/dist/active-recall.d.ts +1 -1
  21. package/dist/active-recall.js +4 -2
  22. package/dist/active-recall.js.map +1 -1
  23. package/dist/adapters/index.js +7 -7
  24. package/dist/adapters/registry.js +3 -3
  25. package/dist/{auto-sync-24NNS3GU.js → auto-sync-F3KCSQFJ.js} +5 -5
  26. package/dist/behavior-learner.d.ts +1 -1
  27. package/dist/behavior-signals.d.ts +1 -1
  28. package/dist/bootstrap.d.ts +11 -8
  29. package/dist/briefing.d.ts +1 -1
  30. package/dist/briefing.js +12 -10
  31. package/dist/buffer-surprise-report.d.ts +1 -1
  32. package/dist/buffer.d.ts +1 -1
  33. package/dist/calibration.d.ts +1 -1
  34. package/dist/calibration.js +2 -2
  35. package/dist/capabilities.d.ts +30 -2
  36. package/dist/capabilities.js +3 -1
  37. package/dist/{catalog-CEYlMs9X.d.ts → catalog-F-OEVbRQ.d.ts} +1 -1
  38. package/dist/causal-behavior.d.ts +1 -1
  39. package/dist/causal-behavior.js +2 -2
  40. package/dist/causal-chain.js +2 -2
  41. package/dist/causal-consolidation.d.ts +1 -1
  42. package/dist/causal-consolidation.js +15 -13
  43. package/dist/causal-consolidation.js.map +1 -1
  44. package/dist/causal-retrieval.js +2 -2
  45. package/dist/causal-trajectory-graph.d.ts +4 -0
  46. package/dist/causal-trajectory-graph.js +2 -2
  47. package/dist/causal-trajectory.js +1 -1
  48. package/dist/{chunk-TH7WMHVK.js → chunk-3NN73CM7.js} +2 -2
  49. package/dist/{chunk-A5TUPZ3N.js → chunk-4SF232E6.js} +60 -30
  50. package/dist/chunk-4SF232E6.js.map +1 -0
  51. package/dist/{chunk-DGTDRIUO.js → chunk-4T3BMHKD.js} +2 -2
  52. package/dist/{chunk-EH27LHML.js → chunk-5O42UKXI.js} +2 -2
  53. package/dist/{chunk-KRGC4EDX.js → chunk-6FAMMBQ3.js} +2 -2
  54. package/dist/{chunk-FEB7W5JG.js → chunk-6OIDDKAA.js} +27 -6
  55. package/dist/chunk-6OIDDKAA.js.map +1 -0
  56. package/dist/{chunk-67HG7KFE.js → chunk-6YKIYQU7.js} +2 -2
  57. package/dist/{chunk-LXSG4L55.js → chunk-7CTNUVHZ.js} +2 -2
  58. package/dist/{chunk-UCJ5CDTK.js → chunk-A5XNBK2D.js} +22 -14
  59. package/dist/chunk-A5XNBK2D.js.map +1 -0
  60. package/dist/{chunk-7EEVXW7X.js → chunk-A7TJZLPK.js} +2 -2
  61. package/dist/{chunk-P5IPFZVH.js → chunk-B7WISIAJ.js} +5 -5
  62. package/dist/chunk-BCDKBDSY.js +173 -0
  63. package/dist/chunk-BCDKBDSY.js.map +1 -0
  64. package/dist/{chunk-JAKYZGV4.js → chunk-BXEOHV7K.js} +3 -3
  65. package/dist/chunk-C4X4QGIO.js +60 -0
  66. package/dist/chunk-C4X4QGIO.js.map +1 -0
  67. package/dist/{chunk-S3OPGGZB.js → chunk-D7EBTQ24.js} +2 -2
  68. package/dist/{chunk-IO5NQEGZ.js → chunk-DKT3X5C3.js} +2 -2
  69. package/dist/{chunk-PBH4JUAB.js → chunk-DVRHLN2O.js} +18 -3
  70. package/dist/chunk-DVRHLN2O.js.map +1 -0
  71. package/dist/{chunk-S35FX6MU.js → chunk-EBDA5TYA.js} +2 -2
  72. package/dist/{chunk-2PTBLS2S.js → chunk-EDOQM4E4.js} +2 -2
  73. package/dist/{chunk-YTZLBBEB.js → chunk-EEJMD2L2.js} +3 -3
  74. package/dist/{chunk-YGKUAX2B.js → chunk-EHQ5HO5T.js} +11 -11
  75. package/dist/chunk-EHQ5HO5T.js.map +1 -0
  76. package/dist/{chunk-JIZGYQYH.js → chunk-EM2LDXJ2.js} +4 -4
  77. package/dist/{chunk-YYOK4GVF.js → chunk-EVPNWN7Z.js} +10 -10
  78. package/dist/{chunk-HLIR3RJ7.js → chunk-EXUCUPV2.js} +2 -2
  79. package/dist/{chunk-F3PVXKHP.js → chunk-GDUOCHCD.js} +27 -21
  80. package/dist/chunk-GDUOCHCD.js.map +1 -0
  81. package/dist/{chunk-L5ASZA2F.js → chunk-GJSL4WG2.js} +17 -2
  82. package/dist/chunk-GJSL4WG2.js.map +1 -0
  83. package/dist/{chunk-2SXMCQEQ.js → chunk-GZQXOQQ2.js} +3 -3
  84. package/dist/{chunk-2KAYTPPT.js → chunk-HCVWF657.js} +12 -12
  85. package/dist/{chunk-N3DUH6OO.js → chunk-ILFSEIRT.js} +1 -1
  86. package/dist/chunk-ILFSEIRT.js.map +1 -0
  87. package/dist/{chunk-4KZGLDJJ.js → chunk-J3JPB7ZI.js} +2 -2
  88. package/dist/{chunk-3JJWNZTT.js → chunk-L2B3EE7B.js} +102 -42
  89. package/dist/chunk-L2B3EE7B.js.map +1 -0
  90. package/dist/{chunk-NFRBADNR.js → chunk-LA3HZKES.js} +610 -369
  91. package/dist/chunk-LA3HZKES.js.map +1 -0
  92. package/dist/{chunk-LQ6JI4VH.js → chunk-LD53WPMU.js} +4 -4
  93. package/dist/{chunk-URM3HW2R.js → chunk-LLUGAZ3B.js} +2 -2
  94. package/dist/{chunk-RVLB4E6N.js → chunk-MDBZTH7N.js} +5 -32
  95. package/dist/chunk-MDBZTH7N.js.map +1 -0
  96. package/dist/{chunk-U5H7WHTS.js → chunk-N77ELJ2D.js} +4 -4
  97. package/dist/{chunk-2VHMVWPU.js → chunk-NXRUUDUF.js} +2 -2
  98. package/dist/{chunk-DIFU33GU.js → chunk-OHTOPFRF.js} +2 -2
  99. package/dist/{chunk-74MYJSKB.js → chunk-ORAK3LNZ.js} +2 -2
  100. package/dist/{chunk-REWQAFSA.js → chunk-PD42EYQN.js} +2 -2
  101. package/dist/chunk-PHK3HARR.js +32 -0
  102. package/dist/chunk-PHK3HARR.js.map +1 -0
  103. package/dist/{chunk-773DPI6T.js → chunk-PKMQK2WY.js} +4 -4
  104. package/dist/{chunk-72VDBALG.js → chunk-QD6QP5P6.js} +63 -54
  105. package/dist/chunk-QD6QP5P6.js.map +1 -0
  106. package/dist/{chunk-CTOQEZSN.js → chunk-QR67FU5G.js} +2 -2
  107. package/dist/{chunk-AU7Q3LSC.js → chunk-RKNJBZ55.js} +7 -7
  108. package/dist/{chunk-YI7RZO7Y.js → chunk-SQNED75R.js} +1 -1
  109. package/dist/{chunk-5CEJH5ZN.js → chunk-TAPSNIMA.js} +4 -4
  110. package/dist/{chunk-IF362TF6.js → chunk-TQT3USCG.js} +2 -2
  111. package/dist/chunk-TQT3USCG.js.map +1 -0
  112. package/dist/{chunk-5RHM43BJ.js → chunk-TXQCG6SE.js} +3 -3
  113. package/dist/{chunk-ANI5DUAE.js → chunk-UIXXE6NI.js} +7 -7
  114. package/dist/{chunk-2COL35PK.js → chunk-UO5ZHIIH.js} +2 -2
  115. package/dist/{chunk-OJU73BUX.js → chunk-VCLGUIFM.js} +2 -2
  116. package/dist/{chunk-5J4OL7TJ.js → chunk-VUA4S7P6.js} +4 -4
  117. package/dist/{chunk-A66YRSOS.js → chunk-WQYSDPMA.js} +2 -2
  118. package/dist/chunk-XGTBNVIU.js +79 -0
  119. package/dist/chunk-XGTBNVIU.js.map +1 -0
  120. package/dist/{chunk-OZ2KQ7HF.js → chunk-YEE5KJQQ.js} +2 -2
  121. package/dist/chunk-YN2UN7N3.js +217 -0
  122. package/dist/chunk-YN2UN7N3.js.map +1 -0
  123. package/dist/{chunk-WRFKZEO6.js → chunk-YQGHW5ML.js} +4 -4
  124. package/dist/{chunk-APUJIMDM.js → chunk-Z4RU5VPM.js} +2 -2
  125. package/dist/{chunk-DCWIQFNA.js → chunk-ZUDM75KG.js} +4 -4
  126. package/dist/{cli-1orcdXOY.d.ts → cli-P_GaYcCY.d.ts} +3 -3
  127. package/dist/cli.d.ts +9 -6
  128. package/dist/cli.js +67 -63
  129. package/dist/compounding/engine.d.ts +1 -1
  130. package/dist/compounding/engine.js +12 -10
  131. package/dist/compounding/preference-consolidator.d.ts +1 -1
  132. package/dist/compression-optimizer.d.ts +1 -1
  133. package/dist/config.d.ts +1 -1
  134. package/dist/config.js +4 -2
  135. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  136. package/dist/connectors/codex-materialize-runner.js +12 -10
  137. package/dist/connectors/codex-materialize.d.ts +1 -1
  138. package/dist/connectors/index.d.ts +1 -1
  139. package/dist/connectors/index.js +13 -11
  140. package/dist/consolidation-provenance-check.d.ts +1 -1
  141. package/dist/consolidation-undo.d.ts +1 -1
  142. package/dist/contradiction/index.d.ts +1 -1
  143. package/dist/conversation-index/backend.d.ts +1 -1
  144. package/dist/conversation-index/backend.js +2 -2
  145. package/dist/conversation-index/chunker.d.ts +1 -1
  146. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  147. package/dist/conversation-index/indexer.d.ts +1 -1
  148. package/dist/conversation-index/search.d.ts +1 -1
  149. package/dist/day-summary.d.ts +1 -1
  150. package/dist/delinearize.d.ts +1 -1
  151. package/dist/direct-answer-wiring.d.ts +1 -1
  152. package/dist/direct-answer.d.ts +1 -1
  153. package/dist/embedding-fallback.d.ts +1 -1
  154. package/dist/enrichment/index.d.ts +1 -1
  155. package/dist/entity-retrieval.d.ts +1 -1
  156. package/dist/entity-retrieval.js +12 -10
  157. package/dist/entity-schema.d.ts +1 -1
  158. package/dist/explicit-capture.d.ts +11 -8
  159. package/dist/extraction-faithfulness.d.ts +8 -2
  160. package/dist/extraction-faithfulness.js +4 -3
  161. package/dist/extraction-judge-telemetry.d.ts +1 -1
  162. package/dist/extraction-judge-training.d.ts +1 -1
  163. package/dist/extraction-judge.d.ts +1 -1
  164. package/dist/extraction-judge.js +3 -3
  165. package/dist/extraction.d.ts +1 -1
  166. package/dist/extraction.js +5 -4
  167. package/dist/faithfulness-config.d.ts +55 -0
  168. package/dist/faithfulness-config.js +11 -0
  169. package/dist/faithfulness-config.js.map +1 -0
  170. package/dist/fallback-llm.d.ts +1 -1
  171. package/dist/fallback-llm.js +2 -2
  172. package/dist/{forget-U66KPDPY.js → forget-OEE5OELK.js} +2 -2
  173. package/dist/graph-dashboard-diff.d.ts +4 -0
  174. package/dist/graph-dashboard-key.d.ts +4 -0
  175. package/dist/graph-dashboard-parser.d.ts +4 -0
  176. package/dist/{graph-edge-decay-JLOF3YW4.js → graph-edge-decay-QPRJQ7DL.js} +3 -3
  177. package/dist/graph-edge-reinforcement.d.ts +4 -0
  178. package/dist/graph-snapshot.d.ts +7 -3
  179. package/dist/graph-snapshot.js +3 -3
  180. package/dist/graph.d.ts +7 -1
  181. package/dist/graph.js +2 -2
  182. package/dist/identity-continuity.d.ts +1 -1
  183. package/dist/importance.d.ts +1 -1
  184. package/dist/index.d.ts +571 -570
  185. package/dist/index.js +104 -99
  186. package/dist/index.js.map +1 -1
  187. package/dist/intent.d.ts +1 -1
  188. package/dist/lcm/engine.d.ts +1 -1
  189. package/dist/lcm/engine.js +2 -2
  190. package/dist/lcm/index.d.ts +1 -1
  191. package/dist/lcm/index.js +4 -4
  192. package/dist/lcm/tools.d.ts +1 -1
  193. package/dist/lifecycle.d.ts +1 -1
  194. package/dist/live-connectors-runner.d.ts +1 -1
  195. package/dist/local-llm.d.ts +1 -1
  196. package/dist/local-model-endpoint.d.ts +96 -0
  197. package/dist/local-model-endpoint.js +12 -0
  198. package/dist/local-model-endpoint.js.map +1 -0
  199. package/dist/maintenance/memory-governance.d.ts +1 -1
  200. package/dist/maintenance/memory-governance.js +12 -10
  201. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +12 -10
  202. package/dist/maintenance/rebuild-memory-projection.js +13 -11
  203. package/dist/mcp-memory-inspector-app.d.ts +11 -8
  204. package/dist/memory-action-policy.d.ts +1 -1
  205. package/dist/memory-cache.d.ts +1 -1
  206. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  207. package/dist/memory-projection-store.d.ts +1 -1
  208. package/dist/memory-provenance.d.ts +1 -1
  209. package/dist/memory-worth-outcomes.d.ts +1 -1
  210. package/dist/models-json.d.ts +1 -1
  211. package/dist/namespaces/migrate.d.ts +2 -2
  212. package/dist/namespaces/migrate.js +22 -20
  213. package/dist/namespaces/principal.d.ts +1 -1
  214. package/dist/namespaces/search.d.ts +1 -1
  215. package/dist/namespaces/search.js +9 -9
  216. package/dist/namespaces/storage.d.ts +2 -2
  217. package/dist/namespaces/storage.js +12 -10
  218. package/dist/native-knowledge.d.ts +1 -1
  219. package/dist/operator-toolkit.d.ts +3 -2
  220. package/dist/operator-toolkit.js +32 -28
  221. package/dist/orchestration/maintenance.d.ts +2 -2
  222. package/dist/orchestration/maintenance.js +14 -12
  223. package/dist/{orchestrator-kOxredSr.d.ts → orchestrator-f5xv19kp.d.ts} +178 -81
  224. package/dist/orchestrator.d.ts +8 -5
  225. package/dist/orchestrator.js +56 -52
  226. package/dist/patterns-cli.d.ts +1 -1
  227. package/dist/policy-runtime.d.ts +1 -1
  228. package/dist/provenance.d.ts +1 -1
  229. package/dist/provenance.js +2 -1
  230. package/dist/qmd-recall-cache.d.ts +1 -1
  231. package/dist/qmd.d.ts +1 -1
  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-xray-cli.d.ts +1 -1
  240. package/dist/recall-xray-cli.js +4 -4
  241. package/dist/recall-xray-renderer.d.ts +1 -1
  242. package/dist/recall-xray-renderer.js +3 -3
  243. package/dist/recall-xray.d.ts +18 -1
  244. package/dist/recall-xray.js +2 -2
  245. package/dist/resolve-auth-token.d.ts +1 -1
  246. package/dist/resume-bundles.js +5 -3
  247. package/dist/retrieval-agents.d.ts +1 -1
  248. package/dist/retrieval-tiers.d.ts +1 -1
  249. package/dist/routing/engine.d.ts +1 -1
  250. package/dist/routing/store.d.ts +1 -1
  251. package/dist/search/embed-helper.d.ts +1 -1
  252. package/dist/search/factory.d.ts +1 -1
  253. package/dist/search/factory.js +8 -8
  254. package/dist/search/index.d.ts +1 -1
  255. package/dist/search/index.js +14 -14
  256. package/dist/search/lancedb-backend.d.ts +1 -1
  257. package/dist/search/lancedb-backend.js +2 -2
  258. package/dist/search/meilisearch-backend.d.ts +1 -1
  259. package/dist/search/meilisearch-backend.js +2 -2
  260. package/dist/search/noop-backend.d.ts +1 -1
  261. package/dist/search/orama-backend.d.ts +1 -1
  262. package/dist/search/orama-backend.js +2 -2
  263. package/dist/search/port.d.ts +1 -1
  264. package/dist/search/remote-backend.d.ts +1 -1
  265. package/dist/{semantic-consolidation-B58v3S-a.d.ts → semantic-consolidation-BQm1e1Pn.d.ts} +1 -1
  266. package/dist/semantic-consolidation.d.ts +2 -2
  267. package/dist/semantic-consolidation.js +13 -11
  268. package/dist/semantic-rule-promotion.js +12 -10
  269. package/dist/semantic-rule-verifier.d.ts +1 -1
  270. package/dist/semantic-rule-verifier.js +12 -10
  271. package/dist/session-observer-bands.d.ts +1 -1
  272. package/dist/session-observer-state.d.ts +1 -1
  273. package/dist/shared-context/manager.d.ts +1 -1
  274. package/dist/signal.d.ts +1 -1
  275. package/dist/storage.d.ts +45 -1
  276. package/dist/storage.js +11 -9
  277. package/dist/summarizer.d.ts +1 -1
  278. package/dist/summarizer.js +3 -3
  279. package/dist/summary-snapshot.d.ts +1 -1
  280. package/dist/temporal-supersession.d.ts +1 -1
  281. package/dist/temporal-validity.d.ts +1 -1
  282. package/dist/threading.d.ts +1 -1
  283. package/dist/tier-migration.d.ts +1 -1
  284. package/dist/tier-routing.d.ts +1 -1
  285. package/dist/topics.d.ts +1 -1
  286. package/dist/transcript.d.ts +1 -1
  287. package/dist/transfer/backup.js +2 -2
  288. package/dist/transfer/capsule-export.js +2 -2
  289. package/dist/transfer/capsule-import.js +1 -1
  290. package/dist/trust-score-stage.d.ts +178 -0
  291. package/dist/trust-score-stage.js +18 -0
  292. package/dist/trust-score-stage.js.map +1 -0
  293. package/dist/trust-score.d.ts +164 -0
  294. package/dist/trust-score.js +22 -0
  295. package/dist/trust-score.js.map +1 -0
  296. package/dist/{types-ACmDOScJ.d.ts → types-DwO1Ot4n.d.ts} +56 -2
  297. package/dist/types.d.ts +1 -1
  298. package/dist/types.js +1 -1
  299. package/dist/utility-runtime.d.ts +1 -1
  300. package/dist/verified-recall.js +12 -10
  301. package/package.json +2 -2
  302. package/src/access-service.ts +8 -5
  303. package/src/capabilities-cluster-b.test.ts +78 -0
  304. package/src/capabilities.test.ts +11 -1
  305. package/src/capabilities.ts +58 -0
  306. package/src/cli/research-status-commands.ts +7 -3
  307. package/src/cli.ts +11 -6
  308. package/src/config.ts +60 -30
  309. package/src/extraction-faithfulness.test.ts +175 -0
  310. package/src/extraction-faithfulness.ts +53 -1
  311. package/src/faithfulness-config.test.ts +96 -0
  312. package/src/faithfulness-config.ts +138 -0
  313. package/src/graph-snapshot.ts +3 -3
  314. package/src/graph.ts +8 -7
  315. package/src/lifecycle/tombstones.test.ts +242 -1
  316. package/src/lifecycle/tombstones.ts +157 -70
  317. package/src/local-model-endpoint.test.ts +155 -0
  318. package/src/local-model-endpoint.ts +189 -0
  319. package/src/operator-toolkit.ts +24 -7
  320. package/src/orchestration/tier-migration-coordinator.ts +286 -0
  321. package/src/orchestrator.ts +331 -222
  322. package/src/recall-xray.test.ts +62 -0
  323. package/src/recall-xray.ts +34 -0
  324. package/src/trust-score-recall-paths.test.ts +157 -0
  325. package/src/trust-score-stage.test.ts +350 -0
  326. package/src/trust-score-stage.ts +398 -0
  327. package/src/trust-score.test.ts +282 -0
  328. package/src/trust-score.ts +449 -0
  329. package/src/types.ts +61 -1
  330. package/dist/chunk-3JJWNZTT.js.map +0 -1
  331. package/dist/chunk-72VDBALG.js.map +0 -1
  332. package/dist/chunk-A5TUPZ3N.js.map +0 -1
  333. package/dist/chunk-F3PVXKHP.js.map +0 -1
  334. package/dist/chunk-FEB7W5JG.js.map +0 -1
  335. package/dist/chunk-IF362TF6.js.map +0 -1
  336. package/dist/chunk-L5ASZA2F.js.map +0 -1
  337. package/dist/chunk-N3DUH6OO.js.map +0 -1
  338. package/dist/chunk-NFRBADNR.js.map +0 -1
  339. package/dist/chunk-PBH4JUAB.js.map +0 -1
  340. package/dist/chunk-RVLB4E6N.js.map +0 -1
  341. package/dist/chunk-UCJ5CDTK.js.map +0 -1
  342. package/dist/chunk-YGKUAX2B.js.map +0 -1
  343. /package/dist/{auto-sync-24NNS3GU.js.map → auto-sync-F3KCSQFJ.js.map} +0 -0
  344. /package/dist/{chunk-TH7WMHVK.js.map → chunk-3NN73CM7.js.map} +0 -0
  345. /package/dist/{chunk-DGTDRIUO.js.map → chunk-4T3BMHKD.js.map} +0 -0
  346. /package/dist/{chunk-EH27LHML.js.map → chunk-5O42UKXI.js.map} +0 -0
  347. /package/dist/{chunk-KRGC4EDX.js.map → chunk-6FAMMBQ3.js.map} +0 -0
  348. /package/dist/{chunk-67HG7KFE.js.map → chunk-6YKIYQU7.js.map} +0 -0
  349. /package/dist/{chunk-LXSG4L55.js.map → chunk-7CTNUVHZ.js.map} +0 -0
  350. /package/dist/{chunk-7EEVXW7X.js.map → chunk-A7TJZLPK.js.map} +0 -0
  351. /package/dist/{chunk-P5IPFZVH.js.map → chunk-B7WISIAJ.js.map} +0 -0
  352. /package/dist/{chunk-JAKYZGV4.js.map → chunk-BXEOHV7K.js.map} +0 -0
  353. /package/dist/{chunk-S3OPGGZB.js.map → chunk-D7EBTQ24.js.map} +0 -0
  354. /package/dist/{chunk-IO5NQEGZ.js.map → chunk-DKT3X5C3.js.map} +0 -0
  355. /package/dist/{chunk-S35FX6MU.js.map → chunk-EBDA5TYA.js.map} +0 -0
  356. /package/dist/{chunk-2PTBLS2S.js.map → chunk-EDOQM4E4.js.map} +0 -0
  357. /package/dist/{chunk-YTZLBBEB.js.map → chunk-EEJMD2L2.js.map} +0 -0
  358. /package/dist/{chunk-JIZGYQYH.js.map → chunk-EM2LDXJ2.js.map} +0 -0
  359. /package/dist/{chunk-YYOK4GVF.js.map → chunk-EVPNWN7Z.js.map} +0 -0
  360. /package/dist/{chunk-HLIR3RJ7.js.map → chunk-EXUCUPV2.js.map} +0 -0
  361. /package/dist/{chunk-2SXMCQEQ.js.map → chunk-GZQXOQQ2.js.map} +0 -0
  362. /package/dist/{chunk-2KAYTPPT.js.map → chunk-HCVWF657.js.map} +0 -0
  363. /package/dist/{chunk-4KZGLDJJ.js.map → chunk-J3JPB7ZI.js.map} +0 -0
  364. /package/dist/{chunk-LQ6JI4VH.js.map → chunk-LD53WPMU.js.map} +0 -0
  365. /package/dist/{chunk-URM3HW2R.js.map → chunk-LLUGAZ3B.js.map} +0 -0
  366. /package/dist/{chunk-U5H7WHTS.js.map → chunk-N77ELJ2D.js.map} +0 -0
  367. /package/dist/{chunk-2VHMVWPU.js.map → chunk-NXRUUDUF.js.map} +0 -0
  368. /package/dist/{chunk-DIFU33GU.js.map → chunk-OHTOPFRF.js.map} +0 -0
  369. /package/dist/{chunk-74MYJSKB.js.map → chunk-ORAK3LNZ.js.map} +0 -0
  370. /package/dist/{chunk-REWQAFSA.js.map → chunk-PD42EYQN.js.map} +0 -0
  371. /package/dist/{chunk-773DPI6T.js.map → chunk-PKMQK2WY.js.map} +0 -0
  372. /package/dist/{chunk-CTOQEZSN.js.map → chunk-QR67FU5G.js.map} +0 -0
  373. /package/dist/{chunk-AU7Q3LSC.js.map → chunk-RKNJBZ55.js.map} +0 -0
  374. /package/dist/{chunk-YI7RZO7Y.js.map → chunk-SQNED75R.js.map} +0 -0
  375. /package/dist/{chunk-5CEJH5ZN.js.map → chunk-TAPSNIMA.js.map} +0 -0
  376. /package/dist/{chunk-5RHM43BJ.js.map → chunk-TXQCG6SE.js.map} +0 -0
  377. /package/dist/{chunk-ANI5DUAE.js.map → chunk-UIXXE6NI.js.map} +0 -0
  378. /package/dist/{chunk-2COL35PK.js.map → chunk-UO5ZHIIH.js.map} +0 -0
  379. /package/dist/{chunk-OJU73BUX.js.map → chunk-VCLGUIFM.js.map} +0 -0
  380. /package/dist/{chunk-5J4OL7TJ.js.map → chunk-VUA4S7P6.js.map} +0 -0
  381. /package/dist/{chunk-A66YRSOS.js.map → chunk-WQYSDPMA.js.map} +0 -0
  382. /package/dist/{chunk-OZ2KQ7HF.js.map → chunk-YEE5KJQQ.js.map} +0 -0
  383. /package/dist/{chunk-WRFKZEO6.js.map → chunk-YQGHW5ML.js.map} +0 -0
  384. /package/dist/{chunk-APUJIMDM.js.map → chunk-Z4RU5VPM.js.map} +0 -0
  385. /package/dist/{chunk-DCWIQFNA.js.map → chunk-ZUDM75KG.js.map} +0 -0
  386. /package/dist/{forget-U66KPDPY.js.map → forget-OEE5OELK.js.map} +0 -0
  387. /package/dist/{graph-edge-decay-JLOF3YW4.js.map → graph-edge-decay-QPRJQ7DL.js.map} +0 -0
@@ -93,6 +93,7 @@ import {
93
93
  gatewayTaskChainOptions,
94
94
  } from "./fallback-llm.js";
95
95
  import { MaintenanceScheduler } from "./orchestration/maintenance.js";
96
+ import { TierMigrationCoordinator } from "./orchestration/tier-migration-coordinator.js";
96
97
  import {
97
98
  runLiveConnectorsOnce,
98
99
  type LiveConnectorsRunSummary,
@@ -116,6 +117,9 @@ import {
116
117
  buildMemoryWorthCounterMap,
117
118
  type MemoryWorthCounters,
118
119
  } from "./memory-worth-filter.js";
120
+ import { applyTrustScoreStage, buildTrustSignalsForRerank, projectTrustForXray } from "./trust-score-stage.js";
121
+ import type { TrustStageResultItem } from "./trust-score-stage.js";
122
+ import { renderEpistemicHedge, type TrustSignals } from "./trust-score.js";
119
123
  import { reorderRecallResultsWithMmr } from "./recall-mmr.js";
120
124
  import { applyReasoningTraceBoost } from "./reasoning-trace-recall.js";
121
125
  import { buildRetrievedMemoryProvenance } from "./memory-provenance.js";
@@ -1902,6 +1906,7 @@ export class Orchestrator {
1902
1906
  readonly lastRecall: LastRecallStore;
1903
1907
  readonly handleHistory: RecallHandleHistoryStore;
1904
1908
  readonly tierMigrationStatus: TierMigrationStatusStore;
1909
+ readonly tierMigrationCoordinator: TierMigrationCoordinator;
1905
1910
  /**
1906
1911
  * In-memory X-ray snapshot from the most recent `recall()` call that
1907
1912
  * was invoked with `xrayCapture: true` (issue #570 PR 1). Scope is
@@ -1941,6 +1946,18 @@ export class Orchestrator {
1941
1946
  { at: number; counters: ReadonlyMap<string, MemoryWorthCounters> }
1942
1947
  >();
1943
1948
  private static readonly MEMORY_WORTH_CACHE_TTL_MS = 30_000;
1949
+ /**
1950
+ * Issue #1577 — per-namespace TrustScore signal map cache. Same TTL/shape
1951
+ * discipline as {@link memoryWorthCounterCache}: seconds-scale, evicted on
1952
+ * every call, keyed by namespace. Holds the frontmatter-derived signals
1953
+ * (worth, provenance, faithfulness, corroboration, recency) so the trust
1954
+ * stage doesn't trigger a fresh `readAllMemories` scan per query.
1955
+ */
1956
+ private readonly trustSignalCache = new Map<
1957
+ string,
1958
+ { at: number; signals: ReadonlyMap<string, TrustSignals> }
1959
+ >();
1960
+ private static readonly TRUST_SIGNAL_CACHE_TTL_MS = 30_000;
1944
1961
  /**
1945
1962
  * Per-session workspace selections keyed by sessionKey.
1946
1963
  * Set by the before_agent_start hook so recall() uses the correct
@@ -2007,8 +2024,6 @@ export class Orchestrator {
2007
2024
  private wearablesServiceInstance: WearablesService | null = null;
2008
2025
  private wearablesAutoSyncHandle: { stop(): Promise<void> } | null = null;
2009
2026
  private lastQmdReprobeAtMs = 0;
2010
- private tierMigrationInFlight = false;
2011
- private lastTierMigrationRunAtMs = 0;
2012
2027
  private readonly conversationIndexLastUpdateAtMs = new Map<string, number>();
2013
2028
  private lastFileHygieneRunAtMs = 0;
2014
2029
  // Pattern-reinforcement cadence gate (issue #687 PR 2/4). Tracks the
@@ -2833,6 +2848,14 @@ export class Orchestrator {
2833
2848
  maxDepth: config.recallHandleSnapshotDepth,
2834
2849
  });
2835
2850
  this.tierMigrationStatus = new TierMigrationStatusStore(config.memoryDir);
2851
+ this.tierMigrationCoordinator = new TierMigrationCoordinator({
2852
+ config,
2853
+ getQmd: () => this.qmd,
2854
+ tierMigrationStatus: this.tierMigrationStatus,
2855
+ getUtilityRuntimeValues: () => this.utilityRuntimeValues,
2856
+ getCompounding: () => this.compounding,
2857
+ createColdStorage: (parentDir) => new StorageManager(parentDir),
2858
+ });
2836
2859
  this.sessionObserver = new SessionObserverState({
2837
2860
  memoryDir: config.memoryDir,
2838
2861
  debounceMs: config.sessionObserverDebounceMs ?? 120_000,
@@ -7267,8 +7290,8 @@ export class Orchestrator {
7267
7290
  const timings: Record<string, string> = {};
7268
7291
  const profileTraceId = this.profiler.startTrace("recall", sessionKey, {
7269
7292
  qmdEnabled: this.config.qmdEnabled,
7270
- rerankEnabled: this.config.rerankEnabled,
7271
- parallelRetrieval: this.config.parallelRetrievalEnabled,
7293
+ rerankEnabled: caps.rerank,
7294
+ parallelRetrieval: caps.parallelRetrieval,
7272
7295
  });
7273
7296
  this.profiler.startSpan("planning", profileTraceId);
7274
7297
  let profileTraceClosed = false;
@@ -7374,6 +7397,23 @@ export class Orchestrator {
7374
7397
  // per-result explain data (e.g. reinforcementBoost) from the result that
7375
7398
  // was actually served.
7376
7399
  let xrayRecalledResults: QmdSearchResult[] = [];
7400
+ // Issue #1577 — per-recall trust map (admitted + quarantined items).
7401
+ // A LOCAL, not instance state, so concurrent recalls on the same
7402
+ // orchestrator cannot race on it (review: shared-trust-map concurrency).
7403
+ // Populated by applyTrustScoreRerank on whichever recall path runs;
7404
+ // consumed by formatQmdResults (epistemic hedge), publishRecallResults
7405
+ // (quarantine filtering on ALL paths), and the X-ray capture (trust
7406
+ // projection + quarantined-item visibility — rule 34).
7407
+ let recallTrustByPath: Map<string, TrustStageResultItem> | null = null;
7408
+ // Issue #1577 — sink for the cold-fallback pipeline's trust map. The cold
7409
+ // pipeline scores internally (applyColdFallbackPipeline) and writes its
7410
+ // per-path trust map here; each cold caller reads it back into
7411
+ // recallTrustByPath so cold/embedding/recent paths feed the same X-ray +
7412
+ // epistemic-rendering + publisher-quarantine consumers the hot path uses
7413
+ // (rule 41: the feature gate applies across ALL parallel recall paths).
7414
+ const trustByPathSink: { trustByPath: Map<string, TrustStageResultItem> | null } = {
7415
+ trustByPath: null,
7416
+ };
7377
7417
  const lcmStructuredXrayResults: RecallXrayResult[] = [];
7378
7418
  // Per-branch pre-limit candidate pool size for the X-ray filter
7379
7419
  // trace (issue #570 PR 1). `recalledMemoryCount` is assigned
@@ -8729,10 +8769,10 @@ export class Orchestrator {
8729
8769
  (async (): Promise<string | null> => {
8730
8770
  const t0 = Date.now();
8731
8771
  if (
8732
- !this.config.harmonicRetrievalEnabled ||
8772
+ !caps.harmonicRetrieval ||
8733
8773
  !this.isRecallSectionEnabled(
8734
8774
  "harmonic-retrieval",
8735
- this.config.harmonicRetrievalEnabled === true,
8775
+ caps.harmonicRetrieval,
8736
8776
  )
8737
8777
  ) {
8738
8778
  recordRecallSectionMetric({
@@ -9297,7 +9337,7 @@ export class Orchestrator {
9297
9337
  [ParallelSearchResult[], ParallelSearchResult[]]
9298
9338
  > | null =
9299
9339
  !queryAwarePrefilterIsEmpty &&
9300
- this.config.parallelRetrievalEnabled && maxPerAgent > 0
9340
+ caps.parallelRetrieval && maxPerAgent > 0
9301
9341
  ? Promise.all([
9302
9342
  shouldRunAgent("direct", retrievalQuery, 0)
9303
9343
  ? Promise.all(
@@ -9386,7 +9426,7 @@ export class Orchestrator {
9386
9426
  : 0;
9387
9427
  let augmentedResults = filteredResults;
9388
9428
  let maxSpecializedScore = 0;
9389
- if (this.config.parallelRetrievalEnabled && specializedAgentPromise) {
9429
+ if (caps.parallelRetrieval && specializedAgentPromise) {
9390
9430
  try {
9391
9431
  const [directResults, temporalResults] =
9392
9432
  await specializedAgentPromise;
@@ -11032,7 +11072,7 @@ export class Orchestrator {
11032
11072
  );
11033
11073
 
11034
11074
  // Optional LLM reranking (default off). Fail-open if rerank fails/slow.
11035
- if (this.config.rerankEnabled && this.config.rerankProvider === "local") {
11075
+ if (caps.rerank && this.config.rerankProvider === "local") {
11036
11076
  const ranked = await rerankLocalOrNoop({
11037
11077
  query: retrievalQuery,
11038
11078
  candidates: memoryResults
@@ -11064,24 +11104,26 @@ export class Orchestrator {
11064
11104
  memoryResults = reordered;
11065
11105
  }
11066
11106
  }
11067
- if (this.config.rerankEnabled && this.config.rerankProvider === "cloud") {
11107
+ if (caps.rerank && this.config.rerankProvider === "cloud") {
11068
11108
  log.debug(
11069
11109
  "rerankProvider=cloud is reserved/experimental in v2.2.0; skipping rerank",
11070
11110
  );
11071
11111
  }
11072
11112
 
11073
- // Memory Worth recall filter (issue #560 PR 4). When enabled, multiply
11074
- // each candidate's score by its Memory Worth factor so memories with
11075
- // a history of failed outcomes sink. Default off in this PR; PR 5
11076
- // flips the default once bench shows tie-or-win. Fail-open: any
11077
- // lookup error leaves the original scores untouched rather than
11078
- // breaking recall for the whole namespace.
11079
- if (caps.recallMemoryWorthFilter && memoryResults.length > 0) {
11080
- try {
11081
- memoryResults = await this.applyMemoryWorthRerank(memoryResults, recallNamespaces);
11082
- } catch (err) {
11083
- log.debug("memory-worth filter failed open", { error: (err as Error).message });
11084
- }
11113
+ // Trust-reweighting stage. TrustScore (issue #1577) SUBSUMES the Memory
11114
+ // Worth multiplier exactly one runs (rule 39; the double-multiplier
11115
+ // test in trust-score-stage.test.ts pins it structurally). Applied on
11116
+ // EVERY recall path via applyTrustScoreToBranch so the gate is consistent
11117
+ // (rule 41 parity). Fail-open on lookup errors so recall never breaks.
11118
+ {
11119
+ const trustOutcome = await this.applyTrustScoreToBranch(
11120
+ memoryResults,
11121
+ recallNamespaces,
11122
+ caps,
11123
+ "hot-qmd",
11124
+ );
11125
+ memoryResults = trustOutcome.results;
11126
+ recallTrustByPath = trustOutcome.trustByPath;
11085
11127
  }
11086
11128
 
11087
11129
  // Synapse-inspired confidence gate: check scores BEFORE slicing so
@@ -11198,6 +11240,7 @@ export class Orchestrator {
11198
11240
  injectedChars: identityInjectedChars,
11199
11241
  truncated: identityInjectionTruncated,
11200
11242
  },
11243
+ trustByPath: recallTrustByPath,
11201
11244
  });
11202
11245
  recalledMemoryIds = this.extractMemoryIdsFromResults(memoryResults);
11203
11246
  recalledMemoryPaths = memoryResults
@@ -11211,7 +11254,7 @@ export class Orchestrator {
11211
11254
  // low-relevance results from polluting context.
11212
11255
  const queryAwarePrefilter = await queryAwarePrefilterPromise;
11213
11256
  if (queryAwarePrefilter.candidatePaths?.size !== 0) {
11214
- const scoped = await awaitAssemblyStep(
11257
+ let scoped = await awaitAssemblyStep(
11215
11258
  "embedding-fallback",
11216
11259
  async () => {
11217
11260
  const embeddingResults = await this.searchEmbeddingFallback(
@@ -11254,6 +11297,18 @@ export class Orchestrator {
11254
11297
  },
11255
11298
  [] as QmdSearchResult[],
11256
11299
  );
11300
+ // Issue #1577 — apply TrustScore on the embedding-fallback path so the
11301
+ // feature gate is consistent across ALL recall paths (rule 41 parity).
11302
+ {
11303
+ const trustOutcome = await this.applyTrustScoreToBranch(
11304
+ scoped,
11305
+ recallNamespaces,
11306
+ caps,
11307
+ "embedding-fallback",
11308
+ );
11309
+ scoped = trustOutcome.results;
11310
+ recallTrustByPath = trustOutcome.trustByPath;
11311
+ }
11257
11312
  if (scoped.length > 0) {
11258
11313
  if (shouldPersistGraphSnapshot) {
11259
11314
  graphSnapshotFinalResults = this.buildGraphRecallRankedResults(
@@ -11274,6 +11329,7 @@ export class Orchestrator {
11274
11329
  injectedChars: identityInjectedChars,
11275
11330
  truncated: identityInjectionTruncated,
11276
11331
  },
11332
+ trustByPath: recallTrustByPath,
11277
11333
  });
11278
11334
  recalledMemoryIds = this.extractMemoryIdsFromResults(scoped);
11279
11335
  recalledMemoryPaths = scoped
@@ -11295,10 +11351,15 @@ export class Orchestrator {
11295
11351
  backendDegradations.push(degradation);
11296
11352
  },
11297
11353
  xrayPoolSizeSink: xrayColdPoolSink,
11354
+ trustByPathSink,
11298
11355
  deadlineAtMs: enrichmentAssemblyDeadlineAtMs,
11299
11356
  asOfMs,
11300
11357
  ...(options.includeLowConfidence === true ? { includeLowConfidence: true } : {}),
11301
11358
  });
11359
+ // Issue #1577 — read the cold pipeline's trust map back so cold
11360
+ // results feed X-ray + epistemic rendering + publisher quarantine
11361
+ // filtering (rule 41 parity; review: the sink was never read back).
11362
+ recallTrustByPath = trustByPathSink.trustByPath;
11302
11363
  if (longTerm.length > 0) {
11303
11364
  if (shouldPersistGraphSnapshot) {
11304
11365
  graphSnapshotFinalResults = this.buildGraphRecallRankedResults(
@@ -11319,6 +11380,7 @@ export class Orchestrator {
11319
11380
  injectedChars: identityInjectedChars,
11320
11381
  truncated: identityInjectionTruncated,
11321
11382
  },
11383
+ trustByPath: recallTrustByPath,
11322
11384
  });
11323
11385
  recalledMemoryIds = this.extractMemoryIdsFromResults(longTerm);
11324
11386
  recalledMemoryPaths = longTerm
@@ -11335,7 +11397,7 @@ export class Orchestrator {
11335
11397
  this.appendRecallSection(
11336
11398
  sectionBuckets,
11337
11399
  "workspace-context",
11338
- this.formatQmdResults("Workspace Context", globalResults, sessionKey),
11400
+ this.formatQmdResults("Workspace Context", globalResults, sessionKey, recallTrustByPath),
11339
11401
  );
11340
11402
  }
11341
11403
 
@@ -11371,7 +11433,7 @@ export class Orchestrator {
11371
11433
  // Fallback: embeddings first, then recency-only.
11372
11434
  const queryAwarePrefilter = await queryAwarePrefilterPromise;
11373
11435
  if (queryAwarePrefilter.candidatePaths?.size !== 0) {
11374
- const scoped = await awaitAssemblyStep(
11436
+ let scoped = await awaitAssemblyStep(
11375
11437
  "embedding-fallback",
11376
11438
  async () => {
11377
11439
  const embeddingResults = await this.searchEmbeddingFallback(
@@ -11414,6 +11476,18 @@ export class Orchestrator {
11414
11476
  },
11415
11477
  [] as QmdSearchResult[],
11416
11478
  );
11479
+ // Issue #1577 — apply TrustScore on the embedding-fallback path so the
11480
+ // feature gate is consistent across ALL recall paths (rule 41 parity).
11481
+ {
11482
+ const trustOutcome = await this.applyTrustScoreToBranch(
11483
+ scoped,
11484
+ recallNamespaces,
11485
+ caps,
11486
+ "embedding-fallback",
11487
+ );
11488
+ scoped = trustOutcome.results;
11489
+ recallTrustByPath = trustOutcome.trustByPath;
11490
+ }
11417
11491
  if (scoped.length > 0) {
11418
11492
  if (shouldPersistGraphSnapshot) {
11419
11493
  graphSnapshotFinalResults = this.buildGraphRecallRankedResults(
@@ -11434,6 +11508,7 @@ export class Orchestrator {
11434
11508
  injectedChars: identityInjectedChars,
11435
11509
  truncated: identityInjectionTruncated,
11436
11510
  },
11511
+ trustByPath: recallTrustByPath,
11437
11512
  });
11438
11513
  recalledMemoryIds = this.extractMemoryIdsFromResults(scoped);
11439
11514
  recalledMemoryPaths = scoped
@@ -11523,10 +11598,13 @@ export class Orchestrator {
11523
11598
  backendDegradations.push(degradation);
11524
11599
  },
11525
11600
  xrayPoolSizeSink: xrayColdPoolSink,
11601
+ trustByPathSink,
11526
11602
  deadlineAtMs: enrichmentAssemblyDeadlineAtMs,
11527
11603
  asOfMs,
11528
11604
  ...(options.includeLowConfidence === true ? { includeLowConfidence: true } : {}),
11529
11605
  });
11606
+ // Issue #1577 — read the cold pipeline's trust map back (rule 41).
11607
+ recallTrustByPath = trustByPathSink.trustByPath;
11530
11608
  if (longTerm.length > 0) {
11531
11609
  recallSource = "cold_fallback";
11532
11610
  recalledMemoryCount = longTerm.length;
@@ -11541,6 +11619,7 @@ export class Orchestrator {
11541
11619
  injectedChars: identityInjectedChars,
11542
11620
  truncated: identityInjectionTruncated,
11543
11621
  },
11622
+ trustByPath: recallTrustByPath,
11544
11623
  });
11545
11624
  recalledMemoryIds = this.extractMemoryIdsFromResults(longTerm);
11546
11625
  recalledMemoryPaths = longTerm
@@ -11550,7 +11629,7 @@ export class Orchestrator {
11550
11629
  impressionRecorded = true;
11551
11630
  }
11552
11631
  } else {
11553
- const recent = await awaitAssemblyStep(
11632
+ let recent = await awaitAssemblyStep(
11554
11633
  "recent-memory-scan",
11555
11634
  async () => {
11556
11635
  const recentSorted = queryAwareScopedMemories.sort(
@@ -11596,6 +11675,18 @@ export class Orchestrator {
11596
11675
  },
11597
11676
  [] as QmdSearchResult[],
11598
11677
  );
11678
+ // Issue #1577 — apply TrustScore on the recent-scan path so the
11679
+ // feature gate is consistent across ALL recall paths (rule 41).
11680
+ {
11681
+ const trustOutcome = await this.applyTrustScoreToBranch(
11682
+ recent,
11683
+ recallNamespaces,
11684
+ caps,
11685
+ "recent-scan",
11686
+ );
11687
+ recent = trustOutcome.results;
11688
+ recallTrustByPath = trustOutcome.trustByPath;
11689
+ }
11599
11690
 
11600
11691
  if (recent.length > 0) {
11601
11692
  if (shouldPersistGraphSnapshot) {
@@ -11617,6 +11708,7 @@ export class Orchestrator {
11617
11708
  injectedChars: identityInjectedChars,
11618
11709
  truncated: identityInjectionTruncated,
11619
11710
  },
11711
+ trustByPath: recallTrustByPath,
11620
11712
  });
11621
11713
  recalledMemoryIds = this.extractMemoryIdsFromResults(recent);
11622
11714
  recalledMemoryPaths = recent
@@ -11638,10 +11730,13 @@ export class Orchestrator {
11638
11730
  backendDegradations.push(degradation);
11639
11731
  },
11640
11732
  xrayPoolSizeSink: xrayColdPoolSink,
11733
+ trustByPathSink,
11641
11734
  deadlineAtMs: enrichmentAssemblyDeadlineAtMs,
11642
11735
  asOfMs,
11643
11736
  ...(options.includeLowConfidence === true ? { includeLowConfidence: true } : {}),
11644
11737
  });
11738
+ // Issue #1577 — read the cold pipeline's trust map back (rule 41).
11739
+ recallTrustByPath = trustByPathSink.trustByPath;
11645
11740
  if (longTerm.length > 0) {
11646
11741
  if (shouldPersistGraphSnapshot) {
11647
11742
  graphSnapshotFinalResults =
@@ -11663,6 +11758,7 @@ export class Orchestrator {
11663
11758
  injectedChars: identityInjectedChars,
11664
11759
  truncated: identityInjectionTruncated,
11665
11760
  },
11761
+ trustByPath: recallTrustByPath,
11666
11762
  });
11667
11763
  recalledMemoryIds = this.extractMemoryIdsFromResults(longTerm);
11668
11764
  recalledMemoryPaths = longTerm
@@ -11687,10 +11783,13 @@ export class Orchestrator {
11687
11783
  backendDegradations.push(degradation);
11688
11784
  },
11689
11785
  xrayPoolSizeSink: xrayColdPoolSink,
11786
+ trustByPathSink,
11690
11787
  deadlineAtMs: enrichmentAssemblyDeadlineAtMs,
11691
11788
  asOfMs,
11692
11789
  ...(options.includeLowConfidence === true ? { includeLowConfidence: true } : {}),
11693
11790
  });
11791
+ // Issue #1577 — read the cold pipeline's trust map back (rule 41).
11792
+ recallTrustByPath = trustByPathSink.trustByPath;
11694
11793
  if (longTerm.length > 0) {
11695
11794
  if (shouldPersistGraphSnapshot) {
11696
11795
  graphSnapshotFinalResults = this.buildGraphRecallRankedResults(
@@ -11711,6 +11810,7 @@ export class Orchestrator {
11711
11810
  injectedChars: identityInjectedChars,
11712
11811
  truncated: identityInjectionTruncated,
11713
11812
  },
11813
+ trustByPath: recallTrustByPath,
11714
11814
  });
11715
11815
  recalledMemoryIds = this.extractMemoryIdsFromResults(longTerm);
11716
11816
  recalledMemoryPaths = longTerm
@@ -11981,6 +12081,7 @@ export class Orchestrator {
11981
12081
  // X-ray capture is best-effort; missing provenance must not
11982
12082
  // perturb recall or suppress the surfaced result.
11983
12083
  }
12084
+ const trustItem = recallTrustByPath?.get(recalledPath);
11984
12085
  results.push({
11985
12086
  memoryId: derivedId,
11986
12087
  path: recalledPath,
@@ -11989,8 +12090,30 @@ export class Orchestrator {
11989
12090
  admittedBy: [],
11990
12091
  ...(provenance ? { provenance } : {}),
11991
12092
  ...(sourceSpan ? { sourceSpan } : {}),
12093
+ // Issue #1577 — per-result trust projection for X-ray visibility.
12094
+ ...(trustItem ? { trust: projectTrustForXray(trustItem) } : {}),
11992
12095
  });
11993
12096
  }
12097
+ // Issue #1577 — surface quarantined items in X-ray with their exclusion
12098
+ // reason so operators see WHY a memory was dropped (rule 34 — exclusion
12099
+ // must never look like "no result"). These are NOT in recalledMemoryPaths
12100
+ // (they were excluded from injection) but ARE in the trust map.
12101
+ if (recallTrustByPath) {
12102
+ for (const [qPath, qItem] of recallTrustByPath) {
12103
+ if (!qItem.quarantined || recalledMemoryPaths.includes(qPath)) continue;
12104
+ const qId = idFromPath(qPath);
12105
+ if (!qId) continue;
12106
+ results.push({
12107
+ memoryId: qId,
12108
+ path: qPath,
12109
+ servedBy,
12110
+ scoreDecomposition: { final: 0 },
12111
+ admittedBy: [],
12112
+ rejectedBy: "trust-score:quarantine",
12113
+ trust: projectTrustForXray(qItem),
12114
+ });
12115
+ }
12116
+ }
11994
12117
  // `considered` must reflect the pool size of the branch that
11995
12118
  // actually produced the admitted results, NOT the max across
11996
12119
  // every branch that ran. Otherwise a flow where hot_qmd
@@ -13751,192 +13874,7 @@ export class Orchestrator {
13751
13874
  force?: boolean;
13752
13875
  },
13753
13876
  ): Promise<TierMigrationCycleSummary> {
13754
- const dryRun = options?.dryRun === true;
13755
- const persistSkipped = options?.force === true || trigger === "manual";
13756
- if (!this.config.qmdTierMigrationEnabled && options?.force !== true) {
13757
- const skipped: TierMigrationCycleSummary = {
13758
- trigger,
13759
- scanned: 0,
13760
- migrated: 0,
13761
- promoted: 0,
13762
- demoted: 0,
13763
- limit: 0,
13764
- dryRun,
13765
- skipped: "tier_migration_disabled",
13766
- };
13767
- if (persistSkipped) await this.tierMigrationStatus.recordCycle(skipped);
13768
- return skipped;
13769
- }
13770
- if (
13771
- trigger === "maintenance" &&
13772
- !this.config.qmdTierAutoBackfillEnabled &&
13773
- options?.force !== true
13774
- ) {
13775
- const skipped: TierMigrationCycleSummary = {
13776
- trigger,
13777
- scanned: 0,
13778
- migrated: 0,
13779
- promoted: 0,
13780
- demoted: 0,
13781
- limit: 0,
13782
- dryRun,
13783
- skipped: "maintenance_backfill_disabled",
13784
- };
13785
- if (persistSkipped) await this.tierMigrationStatus.recordCycle(skipped);
13786
- return skipped;
13787
- }
13788
- if (this.tierMigrationInFlight) {
13789
- const skipped: TierMigrationCycleSummary = {
13790
- trigger,
13791
- scanned: 0,
13792
- migrated: 0,
13793
- promoted: 0,
13794
- demoted: 0,
13795
- limit: 0,
13796
- dryRun,
13797
- skipped: "migration_in_flight",
13798
- };
13799
- if (persistSkipped) await this.tierMigrationStatus.recordCycle(skipped);
13800
- return skipped;
13801
- }
13802
-
13803
- const budgetTrigger = trigger === "manual" ? "maintenance" : trigger;
13804
- const budget =
13805
- this.compounding?.tierMigrationCycleBudget(budgetTrigger) ??
13806
- defaultTierMigrationCycleBudget(this.config, budgetTrigger);
13807
- const limit =
13808
- options?.limitOverride !== undefined
13809
- ? Math.max(0, Math.floor(options.limitOverride))
13810
- : budget.limit;
13811
- const nowMs = Date.now();
13812
- if (
13813
- options?.force !== true &&
13814
- nowMs - this.lastTierMigrationRunAtMs < budget.minIntervalMs
13815
- ) {
13816
- const skipped: TierMigrationCycleSummary = {
13817
- trigger,
13818
- scanned: 0,
13819
- migrated: 0,
13820
- promoted: 0,
13821
- demoted: 0,
13822
- limit,
13823
- dryRun,
13824
- skipped: "min_interval",
13825
- };
13826
- if (persistSkipped) await this.tierMigrationStatus.recordCycle(skipped);
13827
- return skipped;
13828
- }
13829
-
13830
- const policy = applyUtilityPromotionRuntimePolicy(
13831
- {
13832
- enabled: this.config.qmdTierMigrationEnabled,
13833
- demotionMinAgeDays: this.config.qmdTierDemotionMinAgeDays,
13834
- demotionValueThreshold: this.config.qmdTierDemotionValueThreshold,
13835
- promotionValueThreshold: this.config.qmdTierPromotionValueThreshold,
13836
- },
13837
- this.utilityRuntimeValues,
13838
- );
13839
-
13840
- this.tierMigrationInFlight = true;
13841
- try {
13842
- const coldStorage = new StorageManager(path.join(storage.dir, "cold"));
13843
- const [hotMemories, coldMemories] = await Promise.all([
13844
- storage.readAllMemories(),
13845
- coldStorage.readAllMemories(),
13846
- ]);
13847
- const now = new Date();
13848
- const scanLimit = Math.max(0, Math.floor(budget.scanLimit));
13849
- const hotScanLimit = Math.min(
13850
- hotMemories.length,
13851
- Math.ceil(scanLimit * 0.75),
13852
- );
13853
- const coldScanLimit = Math.min(
13854
- coldMemories.length,
13855
- Math.max(0, scanLimit - hotScanLimit),
13856
- );
13857
- const toTimestamp = (memory: MemoryFile): number =>
13858
- Date.parse(memory.frontmatter.updated ?? memory.frontmatter.created);
13859
- const hotCandidates = hotMemories
13860
- .map((memory) => ({ memory, tier: "hot" as MemoryTier }))
13861
- .sort((a, b) => toTimestamp(a.memory) - toTimestamp(b.memory))
13862
- .slice(0, hotScanLimit);
13863
- const coldCandidates = coldMemories
13864
- .map((memory) => ({ memory, tier: "cold" as MemoryTier }))
13865
- .sort((a, b) => toTimestamp(b.memory) - toTimestamp(a.memory))
13866
- .slice(0, coldScanLimit);
13867
- const candidates = [...hotCandidates, ...coldCandidates];
13868
-
13869
- const migration = new TierMigrationExecutor({
13870
- storage,
13871
- qmd: this.qmd,
13872
- hotCollection: this.config.qmdCollection,
13873
- coldCollection:
13874
- this.config.qmdColdCollection ?? `${this.config.qmdCollection}-cold`,
13875
- autoEmbed: this.config.qmdAutoEmbedEnabled,
13876
- });
13877
-
13878
- let migrated = 0;
13879
- let promoted = 0;
13880
- let demoted = 0;
13881
- for (const candidate of candidates) {
13882
- if (migrated >= limit) break;
13883
- const decision = decideTierTransition(
13884
- candidate.memory,
13885
- candidate.tier,
13886
- policy,
13887
- now,
13888
- );
13889
- if (!decision.changed) continue;
13890
-
13891
- if (!dryRun) {
13892
- const res = await migration.migrateMemory({
13893
- memory: candidate.memory,
13894
- fromTier: candidate.tier,
13895
- toTier: decision.nextTier,
13896
- reason: `${trigger}:${decision.reason}`,
13897
- });
13898
- if (!res.changed) continue;
13899
- }
13900
- migrated += 1;
13901
- if (decision.nextTier === "cold") demoted += 1;
13902
- if (decision.nextTier === "hot") promoted += 1;
13903
- }
13904
-
13905
- if (!dryRun) this.lastTierMigrationRunAtMs = Date.now();
13906
- log.debug(
13907
- `tier migration cycle completed: trigger=${trigger} scanned=${candidates.length} migrated=${migrated} limit=${limit}${dryRun ? " dryRun=true" : ""}`,
13908
- );
13909
- const summary: TierMigrationCycleSummary = {
13910
- trigger,
13911
- scanned: candidates.length,
13912
- migrated,
13913
- promoted,
13914
- demoted,
13915
- limit,
13916
- dryRun,
13917
- };
13918
- const shouldPersistCycle = trigger === "manual" || migrated > 0;
13919
- if (shouldPersistCycle)
13920
- await this.tierMigrationStatus.recordCycle(summary);
13921
- return summary;
13922
- } catch (err) {
13923
- this.lastTierMigrationRunAtMs = Date.now();
13924
- log.warn(`tier migration cycle failed (${trigger}, fail-open): ${err}`);
13925
- const failed: TierMigrationCycleSummary = {
13926
- trigger,
13927
- scanned: 0,
13928
- migrated: 0,
13929
- promoted: 0,
13930
- demoted: 0,
13931
- limit,
13932
- dryRun,
13933
- errorCount: 1,
13934
- };
13935
- await this.tierMigrationStatus.recordCycle(failed);
13936
- return failed;
13937
- } finally {
13938
- this.tierMigrationInFlight = false;
13939
- }
13877
+ return this.tierMigrationCoordinator.runCycle(storage, trigger, options);
13940
13878
  }
13941
13879
 
13942
13880
  async getTierMigrationStatus(): Promise<TierMigrationStatusSnapshot> {
@@ -16283,6 +16221,7 @@ export class Orchestrator {
16283
16221
  storage: StorageManager,
16284
16222
  persistedIds: string[],
16285
16223
  ): Promise<void> {
16224
+ const caps = resolveCapabilities(this.config); // #1566 Cluster C
16286
16225
  // Build temporal/tag indexes whenever either consumer is enabled:
16287
16226
  // - queryAwareIndexingEnabled: uses indexes for query-aware prefiltering in recall
16288
16227
  // - parallelRetrievalEnabled: temporal agent reads index_time.json for date-range lookup
@@ -16290,7 +16229,7 @@ export class Orchestrator {
16290
16229
  // produce an empty temporal index, leaving the temporal agent with no data to work from.
16291
16230
  if (
16292
16231
  !this.config.queryAwareIndexingEnabled &&
16293
- !this.config.parallelRetrievalEnabled
16232
+ !caps.parallelRetrieval
16294
16233
  )
16295
16234
  return;
16296
16235
  // Check for missing indexes BEFORE the early-return so first-time enablement
@@ -17719,6 +17658,7 @@ export class Orchestrator {
17719
17658
  title: string,
17720
17659
  results: QmdSearchResult[],
17721
17660
  sessionKey?: string,
17661
+ trustByPath?: Map<string, TrustStageResultItem> | null,
17722
17662
  ): string {
17723
17663
  // Issue #1582 — handles are only rendered when a session key is available:
17724
17664
  // resolution requires the handle history to have been recorded for this
@@ -17729,6 +17669,13 @@ export class Orchestrator {
17729
17669
  results,
17730
17670
  this.config.recallMemoryHandles === true && sessionKey != null,
17731
17671
  );
17672
+ // Issue #1577 — epistemic hedge. Append a deterministic, component-derived
17673
+ // suffix so the downstream model knows each memory's trust status (the
17674
+ // cheap lever against confident-stale-answer failures). Gated separately
17675
+ // from scoring so rendering can ship after the stage is stable. High-band
17676
+ // and neutral items get no suffix (don't waste tokens on the common case).
17677
+ const renderHedge = this.config.trustScoreEpistemicRendering && trustByPath !== null && trustByPath !== undefined;
17678
+ const hedgeMap = renderHedge ? trustByPath : null;
17732
17679
  const lines = results.map((r, i) => {
17733
17680
  const snippet = r.snippet
17734
17681
  ? r.snippet.slice(0, 500).replace(/\n/g, " ")
@@ -17736,7 +17683,16 @@ export class Orchestrator {
17736
17683
  const source = typeof r.line === "number" ? `${r.path}:${r.line}` : r.path;
17737
17684
  const head = `[${i + 1}] ${source} (score: ${r.score.toFixed(3)})\n${snippet}`;
17738
17685
  const handle = handleByIndex.get(i);
17739
- return handle ? `${head.replace(/\s+$/, "")} ${handle}` : head;
17686
+ const hedged = head.replace(/\s+$/, "");
17687
+ const withHandle = handle ? `${hedged} ${handle}` : hedged;
17688
+ if (hedgeMap) {
17689
+ const item = hedgeMap.get(r.path);
17690
+ if (item) {
17691
+ const hedge = renderEpistemicHedge(item.trust);
17692
+ if (hedge.length > 0) return `${withHandle} ${hedge}`;
17693
+ }
17694
+ }
17695
+ return withHandle;
17740
17696
  });
17741
17697
  return `## ${title}\n\n${lines.join("\n\n")}`;
17742
17698
  }
@@ -18093,15 +18049,30 @@ export class Orchestrator {
18093
18049
  injectedChars: number;
18094
18050
  truncated: boolean;
18095
18051
  };
18052
+ /**
18053
+ * Issue #1577 — per-recall trust map. When present, quarantined items
18054
+ * are filtered from injection on EVERY recall path (hot QMD, embedding
18055
+ * fallback, cold archive, recent) so a faithfulness-contradicted memory
18056
+ * cannot sneak in via a branch that bypasses trust scoring (review:
18057
+ * fallback paths bypass trust). The map is also threaded to
18058
+ * formatQmdResults for the epistemic hedge.
18059
+ */
18060
+ trustByPath?: Map<string, TrustStageResultItem> | null;
18096
18061
  }): void {
18097
18062
  const sectionId = "memories";
18098
- const memoryIds = this.extractMemoryIdsFromResults(options.results);
18063
+ // Filter quarantined items from ALL recall paths so no branch can inject
18064
+ // a hard-negative memory that trust scoring excluded on another path.
18065
+ const trustByPath = options.trustByPath ?? null;
18066
+ const injectable = trustByPath
18067
+ ? options.results.filter((r) => !trustByPath.get(r.path)?.quarantined)
18068
+ : options.results;
18069
+ const memoryIds = this.extractMemoryIdsFromResults(injectable);
18099
18070
  this.trackMemoryAccess(memoryIds);
18100
18071
 
18101
18072
  this.appendRecallSection(
18102
18073
  options.sectionBuckets,
18103
18074
  sectionId,
18104
- this.formatQmdResults(options.title, options.results, options.sessionKey),
18075
+ this.formatQmdResults(options.title, injectable, options.sessionKey, trustByPath),
18105
18076
  );
18106
18077
  }
18107
18078
 
@@ -18522,6 +18493,125 @@ export class Orchestrator {
18522
18493
  return reordered;
18523
18494
  }
18524
18495
 
18496
+ /**
18497
+ * Issue #1577 — unified TrustScore recall stage. Thin wiring over the pure
18498
+ * {@link applyTrustScoreStage} scorer + the {@link buildTrustSignalsForRerank}
18499
+ * signal builder. The stage subsumes the Memory Worth multiplier — the
18500
+ * orchestrator runs exactly one of the two (mutual exclusion, rule 39; the
18501
+ * double-multiplier test in trust-score-stage.test.ts pins it structurally).
18502
+ *
18503
+ * Returns the admitted results AND the per-path trust map (including
18504
+ * quarantined items) so the caller can: (a) render epistemic hedges, (b)
18505
+ * surface quarantined items in X-ray with a reason (rule 34), and (c) filter
18506
+ * quarantined paths from fallback recall branches. The trust map is a
18507
+ * per-recall local — never instance state — so concurrent recalls cannot
18508
+ * race on it (review: shared-trust-map concurrency).
18509
+ */
18510
+ private async applyTrustScoreRerank(
18511
+ results: QmdSearchResult[],
18512
+ namespaces: string[],
18513
+ ): Promise<{
18514
+ results: QmdSearchResult[];
18515
+ trustByPath: Map<string, TrustStageResultItem> | null;
18516
+ }> {
18517
+ if (results.length === 0) return { results, trustByPath: null };
18518
+ const now = new Date();
18519
+ const halfLifeDays =
18520
+ this.config.recallMemoryWorthHalfLifeMs > 0
18521
+ ? this.config.recallMemoryWorthHalfLifeMs / (24 * 60 * 60 * 1000)
18522
+ : undefined;
18523
+ // Cold-tier direct-fallback reader: resolve once, reuse for every missing
18524
+ // candidate (mirrors the memory-worth filter's reader selection).
18525
+ let fallbackReader: StorageManager | null = null;
18526
+ const signals = await buildTrustSignalsForRerank(
18527
+ results.map((r) => r.path),
18528
+ namespaces,
18529
+ {
18530
+ readNamespaceMemories: async (ns) => (await this.getStorage(ns)).readAllMemories(),
18531
+ readMemoryFrontmatter: async (path) => {
18532
+ if (!fallbackReader) {
18533
+ for (const ns of namespaces) {
18534
+ try {
18535
+ fallbackReader = await this.getStorage(ns);
18536
+ break;
18537
+ } catch {
18538
+ // try next namespace
18539
+ }
18540
+ }
18541
+ }
18542
+ if (!fallbackReader) return null;
18543
+ const memory = await this.readQmdResultMemory(path, fallbackReader, namespaces);
18544
+ return memory ? memory.frontmatter : null;
18545
+ },
18546
+ },
18547
+ { cache: this.trustSignalCache, ttlMs: Orchestrator.TRUST_SIGNAL_CACHE_TTL_MS },
18548
+ now,
18549
+ {
18550
+ recencyHalfLifeDays: halfLifeDays,
18551
+ logDebug: (message, context) => log.debug(message, context),
18552
+ },
18553
+ );
18554
+ if (signals.size === 0) {
18555
+ return { results, trustByPath: null };
18556
+ }
18557
+ // Synthetic monotone-decreasing rank so the multiplier rebias is applied
18558
+ // on top of upstream ordering, not raw QMD scores (see applyMemoryWorthRerank).
18559
+ const rankedInputs = results.map((r, i) => ({ path: r.path, score: results.length - i }));
18560
+ const stage = applyTrustScoreStage(rankedInputs, {
18561
+ signals,
18562
+ weights: this.config.trustScoreWeights,
18563
+ minMultiplier: this.config.trustScoreMinMultiplier,
18564
+ maxMultiplier: this.config.trustScoreMaxMultiplier,
18565
+ quarantine: this.config.trustScoreQuarantine,
18566
+ });
18567
+ const trustByPath = new Map(stage.all.map((item) => [item.path, item]));
18568
+ const byPath = new Map(results.map((r) => [r.path, r]));
18569
+ const admitted = stage.admitted
18570
+ .map((item) => byPath.get(item.path))
18571
+ .filter((r): r is QmdSearchResult => r !== undefined);
18572
+ return { results: admitted, trustByPath };
18573
+ }
18574
+
18575
+ /**
18576
+ * Issue #1577 — apply the TrustScore stage (or, when trust is off, the Memory
18577
+ * Worth multiplier fallback) to ONE recall branch's results, returning the
18578
+ * scored results + the per-path trust map. Thin wiring over
18579
+ * {@link applyTrustScoreRerank} so every recall path — hot QMD, embedding
18580
+ * fallback, recent scan — applies the SAME multiplier gate (rule 41: a
18581
+ * feature gate must apply across ALL parallel recall paths). TrustScore
18582
+ * subsumes Memory Worth; exactly one runs (rule 39). Fail-open on lookup
18583
+ * errors so a storage hiccup never breaks a fallback path.
18584
+ */
18585
+ private async applyTrustScoreToBranch(
18586
+ results: QmdSearchResult[],
18587
+ namespaces: string[],
18588
+ caps: CapabilitySet,
18589
+ label: string,
18590
+ ): Promise<{
18591
+ results: QmdSearchResult[];
18592
+ trustByPath: Map<string, TrustStageResultItem> | null;
18593
+ }> {
18594
+ if (caps.recallTrustScore && results.length > 0) {
18595
+ try {
18596
+ return await this.applyTrustScoreRerank(results, namespaces);
18597
+ } catch (err) {
18598
+ log.debug(`trust-score stage (${label}) failed open`, {
18599
+ error: (err as Error).message,
18600
+ });
18601
+ }
18602
+ } else if (caps.recallMemoryWorthFilter && results.length > 0) {
18603
+ try {
18604
+ const filtered = await this.applyMemoryWorthRerank(results, namespaces);
18605
+ return { results: filtered, trustByPath: null };
18606
+ } catch (err) {
18607
+ log.debug(`memory-worth filter (${label}) failed open`, {
18608
+ error: (err as Error).message,
18609
+ });
18610
+ }
18611
+ }
18612
+ return { results, trustByPath: null };
18613
+ }
18614
+
18525
18615
  private diversifyAndLimitRecallResults(
18526
18616
  sectionId: string,
18527
18617
  results: QmdSearchResult[],
@@ -18896,6 +18986,14 @@ export class Orchestrator {
18896
18986
  * Unset by default so existing call sites are unaffected.
18897
18987
  */
18898
18988
  xrayPoolSizeSink?: { size: number };
18989
+ /**
18990
+ * Issue #1577 — out-parameter that receives the TrustScore stage's
18991
+ * per-path trust map (admitted + quarantined) when the cold path runs
18992
+ * trust scoring. Mirrors the xrayPoolSizeSink pattern so recallInternal
18993
+ can propagate trust data for epistemic rendering and X-ray visibility
18994
+ without changing the cold pipeline's return type.
18995
+ */
18996
+ trustByPathSink?: { trustByPath: Map<string, TrustStageResultItem> | null };
18899
18997
  deadlineAtMs?: number | null;
18900
18998
  /** Issue #681 — when true, bypass graphTraversalConfidenceFloor. */
18901
18999
  includeLowConfidence?: boolean;
@@ -19201,7 +19299,7 @@ export class Orchestrator {
19201
19299
  log.debug("cold-tier recall boost skipped: shared assembly deadline already expired");
19202
19300
  }
19203
19301
 
19204
- if (this.config.rerankEnabled && this.config.rerankProvider === "local") {
19302
+ if (caps.rerank && this.config.rerankProvider === "local") {
19205
19303
  const ranked = await rerankLocalOrNoop({
19206
19304
  query: options.prompt,
19207
19305
  candidates: results
@@ -19232,16 +19330,27 @@ export class Orchestrator {
19232
19330
  results = reordered;
19233
19331
  }
19234
19332
  }
19235
- if (this.config.rerankEnabled && this.config.rerankProvider === "cloud") {
19333
+ if (caps.rerank && this.config.rerankProvider === "cloud") {
19236
19334
  log.debug(
19237
19335
  "rerankProvider=cloud is reserved/experimental in v2.2.0; skipping rerank",
19238
19336
  );
19239
19337
  }
19240
19338
 
19241
- // Memory Worth filter — must fire on the cold fallback path too, or the
19242
- // feature flag produces divergent behavior by retrieval path (CLAUDE.md
19243
- // rule 39). Fail-open on lookup errors.
19244
- if (caps.recallMemoryWorthFilter && results.length > 0) {
19339
+ // Trust-reweighting — must fire on the cold fallback path too, or the
19340
+ // feature flag produces divergent behavior by retrieval path (rule 39).
19341
+ // TrustScore subsumes the Memory Worth multiplier; run exactly one.
19342
+ // Fail-open on lookup errors.
19343
+ if (caps.recallTrustScore && results.length > 0) {
19344
+ try {
19345
+ const trustOutcome = await this.applyTrustScoreRerank(results, options.recallNamespaces);
19346
+ results = trustOutcome.results;
19347
+ if (options.trustByPathSink) options.trustByPathSink.trustByPath = trustOutcome.trustByPath;
19348
+ } catch (err) {
19349
+ log.debug("trust-score stage (cold) failed open", {
19350
+ error: (err as Error).message,
19351
+ });
19352
+ }
19353
+ } else if (caps.recallMemoryWorthFilter && results.length > 0) {
19245
19354
  try {
19246
19355
  results = await this.applyMemoryWorthRerank(results, options.recallNamespaces);
19247
19356
  } catch (err) {