@remnic/core 1.1.2 → 1.1.3

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 (485) hide show
  1. package/dist/abort-error.js +1 -0
  2. package/dist/abstraction-nodes.js +1 -0
  3. package/dist/access-audit.js +1 -0
  4. package/dist/access-cli.js +70 -45
  5. package/dist/access-cli.js.map +1 -1
  6. package/dist/access-http.d.ts +50 -5
  7. package/dist/access-http.js +37 -15
  8. package/dist/access-idempotency.js +1 -0
  9. package/dist/access-mcp.d.ts +10 -5
  10. package/dist/access-mcp.js +36 -13
  11. package/dist/access-schema.d.ts +133 -13
  12. package/dist/access-schema.js +20 -1
  13. package/dist/access-service-_AEUMVyX.d.ts +1981 -0
  14. package/dist/access-service.d.ts +11 -6
  15. package/dist/access-service.js +38 -14
  16. package/dist/active-memory-bridge.js +1 -0
  17. package/dist/active-recall.js +1 -0
  18. package/dist/active-recall.js.map +1 -1
  19. package/dist/behavior-learner.js +1 -0
  20. package/dist/behavior-learner.js.map +1 -1
  21. package/dist/behavior-signals.js +1 -0
  22. package/dist/bootstrap.d.ts +6 -4
  23. package/dist/bootstrap.js +1 -0
  24. package/dist/boxes.js +1 -0
  25. package/dist/briefing.d.ts +9 -5
  26. package/dist/briefing.js +9 -6
  27. package/dist/buffer-surprise-report.js +1 -0
  28. package/dist/buffer-surprise.js +1 -0
  29. package/dist/buffer.d.ts +1 -1
  30. package/dist/buffer.js +1 -0
  31. package/dist/calibration.d.ts +8 -1
  32. package/dist/calibration.js +10 -2
  33. package/dist/calibration.js.map +1 -1
  34. package/dist/capsule-cli.d.ts +137 -0
  35. package/dist/capsule-cli.js +34 -0
  36. package/dist/capsule-crypto-5CYAGVC5.js +18 -0
  37. package/dist/capsule-export-NZQPOTQ4.js +17 -0
  38. package/dist/capsule-export-NZQPOTQ4.js.map +1 -0
  39. package/dist/capsule-import-SDCUXLEV.js +16 -0
  40. package/dist/capsule-import-SDCUXLEV.js.map +1 -0
  41. package/dist/capsule-merge-DI7PNQ2H.js +189 -0
  42. package/dist/capsule-merge-DI7PNQ2H.js.map +1 -0
  43. package/dist/causal-behavior.js +1 -0
  44. package/dist/causal-behavior.js.map +1 -1
  45. package/dist/causal-chain.js +1 -0
  46. package/dist/causal-consolidation.js +11 -8
  47. package/dist/causal-consolidation.js.map +1 -1
  48. package/dist/causal-retrieval.js +2 -1
  49. package/dist/causal-retrieval.js.map +1 -1
  50. package/dist/causal-trajectory-graph.js +4 -1
  51. package/dist/causal-trajectory-graph.js.map +1 -1
  52. package/dist/causal-trajectory.js +2 -1
  53. package/dist/chunk-2LSZVONP.js +67 -0
  54. package/dist/chunk-2LSZVONP.js.map +1 -0
  55. package/dist/chunk-32KD5IHZ.js +245 -0
  56. package/dist/chunk-32KD5IHZ.js.map +1 -0
  57. package/dist/{chunk-VDX363PS.js → chunk-34F3PLWZ.js} +10 -3
  58. package/dist/chunk-34F3PLWZ.js.map +1 -0
  59. package/dist/chunk-3KIS4VGT.js +228 -0
  60. package/dist/chunk-3KIS4VGT.js.map +1 -0
  61. package/dist/chunk-3LCWFNVS.js +350 -0
  62. package/dist/chunk-3LCWFNVS.js.map +1 -0
  63. package/dist/chunk-43EKP2UK.js +26 -0
  64. package/dist/chunk-43EKP2UK.js.map +1 -0
  65. package/dist/chunk-457A4P3L.js +119 -0
  66. package/dist/chunk-457A4P3L.js.map +1 -0
  67. package/dist/{chunk-TMYO7B5P.js → chunk-47WOM4YW.js} +2 -2
  68. package/dist/{chunk-OC5OXUQ4.js → chunk-4PLGJRBV.js} +653 -17
  69. package/dist/chunk-4PLGJRBV.js.map +1 -0
  70. package/dist/{chunk-PVICZTKG.js → chunk-55FXRRSJ.js} +5 -5
  71. package/dist/{chunk-PVICZTKG.js.map → chunk-55FXRRSJ.js.map} +1 -1
  72. package/dist/{chunk-ULYOGL6R.js → chunk-5HRY2WRF.js} +7 -3
  73. package/dist/chunk-5HRY2WRF.js.map +1 -0
  74. package/dist/chunk-6TBWYBJ3.js +236 -0
  75. package/dist/chunk-6TBWYBJ3.js.map +1 -0
  76. package/dist/chunk-74EMIVE4.js +329 -0
  77. package/dist/chunk-74EMIVE4.js.map +1 -0
  78. package/dist/chunk-74WWN7ZW.js +82 -0
  79. package/dist/chunk-74WWN7ZW.js.map +1 -0
  80. package/dist/{chunk-6YJHX2DL.js → chunk-7GCMLT7J.js} +242 -22
  81. package/dist/chunk-7GCMLT7J.js.map +1 -0
  82. package/dist/chunk-A6XUJE5D.js +126 -0
  83. package/dist/chunk-A6XUJE5D.js.map +1 -0
  84. package/dist/chunk-AJA46VX5.js +393 -0
  85. package/dist/chunk-AJA46VX5.js.map +1 -0
  86. package/dist/{chunk-UWB5LMWY.js → chunk-AKUCB2OG.js} +525 -24
  87. package/dist/chunk-AKUCB2OG.js.map +1 -0
  88. package/dist/chunk-ASIQZXYO.js +277 -0
  89. package/dist/chunk-ASIQZXYO.js.map +1 -0
  90. package/dist/{chunk-DG6YMRDC.js → chunk-B2TL6GA2.js} +2 -2
  91. package/dist/chunk-BJMBJZ2Y.js +290 -0
  92. package/dist/chunk-BJMBJZ2Y.js.map +1 -0
  93. package/dist/chunk-BT7NVCML.js +79 -0
  94. package/dist/chunk-BT7NVCML.js.map +1 -0
  95. package/dist/chunk-CK5NTM2S.js +454 -0
  96. package/dist/chunk-CK5NTM2S.js.map +1 -0
  97. package/dist/{chunk-AYXIPSZO.js → chunk-CRU27Q4J.js} +2 -2
  98. package/dist/{chunk-F5VP6YCB.js → chunk-DCE6SQLA.js} +572 -155
  99. package/dist/chunk-DCE6SQLA.js.map +1 -0
  100. package/dist/{chunk-CUPFXL3J.js → chunk-DHRQHX36.js} +4 -4
  101. package/dist/chunk-DHRQHX36.js.map +1 -0
  102. package/dist/{chunk-STGWEHYR.js → chunk-DR7MCMPS.js} +981 -61
  103. package/dist/chunk-DR7MCMPS.js.map +1 -0
  104. package/dist/chunk-FP2373TW.js +149 -0
  105. package/dist/chunk-FP2373TW.js.map +1 -0
  106. package/dist/{chunk-RBBWYEFJ.js → chunk-G2WADRQ3.js} +1 -1
  107. package/dist/chunk-G7D6GZ5J.js +48 -0
  108. package/dist/chunk-G7D6GZ5J.js.map +1 -0
  109. package/dist/chunk-H7XKCNR6.js +60 -0
  110. package/dist/chunk-H7XKCNR6.js.map +1 -0
  111. package/dist/{chunk-3YGHKTBF.js → chunk-IM3JSE73.js} +953 -322
  112. package/dist/chunk-IM3JSE73.js.map +1 -0
  113. package/dist/chunk-IXEJRKCZ.js +18 -0
  114. package/dist/chunk-IXEJRKCZ.js.map +1 -0
  115. package/dist/chunk-IYY4MCPG.js +275 -0
  116. package/dist/chunk-IYY4MCPG.js.map +1 -0
  117. package/dist/{chunk-BECYBZLX.js → chunk-JWSENLQI.js} +502 -22
  118. package/dist/chunk-JWSENLQI.js.map +1 -0
  119. package/dist/chunk-KNKUID7G.js +183 -0
  120. package/dist/chunk-KNKUID7G.js.map +1 -0
  121. package/dist/chunk-L2IO2QPY.js +2036 -0
  122. package/dist/chunk-L2IO2QPY.js.map +1 -0
  123. package/dist/{chunk-SPI27QT6.js → chunk-L5IIGA5V.js} +9 -4
  124. package/dist/chunk-L5IIGA5V.js.map +1 -0
  125. package/dist/{chunk-XXVWLXSG.js → chunk-LVYGDT5V.js} +56 -82
  126. package/dist/chunk-LVYGDT5V.js.map +1 -0
  127. package/dist/{chunk-ZAIM4TUE.js → chunk-LW2NMHDW.js} +46 -1
  128. package/dist/chunk-LW2NMHDW.js.map +1 -0
  129. package/dist/{chunk-3OGMS3PE.js → chunk-LZRYQK6L.js} +3 -2
  130. package/dist/chunk-LZRYQK6L.js.map +1 -0
  131. package/dist/chunk-MDYG7VI7.js +48 -0
  132. package/dist/chunk-MDYG7VI7.js.map +1 -0
  133. package/dist/chunk-MXC3AP5I.js +74 -0
  134. package/dist/chunk-MXC3AP5I.js.map +1 -0
  135. package/dist/{chunk-DIXB44VE.js → chunk-N7X62G74.js} +25 -10
  136. package/dist/chunk-N7X62G74.js.map +1 -0
  137. package/dist/chunk-NN3TS5BM.js +147 -0
  138. package/dist/chunk-NN3TS5BM.js.map +1 -0
  139. package/dist/chunk-OA3L7BFR.js +183 -0
  140. package/dist/chunk-OA3L7BFR.js.map +1 -0
  141. package/dist/chunk-OZHRDTDX.js +240 -0
  142. package/dist/chunk-OZHRDTDX.js.map +1 -0
  143. package/dist/chunk-PCUKNJAZ.js +165 -0
  144. package/dist/chunk-PCUKNJAZ.js.map +1 -0
  145. package/dist/{chunk-6PFRXT4K.js → chunk-PFV5C235.js} +11 -6
  146. package/dist/chunk-PFV5C235.js.map +1 -0
  147. package/dist/chunk-PZ5AY32C.js +10 -0
  148. package/dist/chunk-PZ5AY32C.js.map +1 -0
  149. package/dist/{chunk-Y7R2XJ5Q.js → chunk-Q7FJ5ZHM.js} +6 -2
  150. package/dist/chunk-Q7FJ5ZHM.js.map +1 -0
  151. package/dist/{chunk-NBVAS5MT.js → chunk-R2L7SUX2.js} +6 -6
  152. package/dist/{chunk-WCLICCGB.js → chunk-RILIVK4O.js} +91 -4
  153. package/dist/chunk-RILIVK4O.js.map +1 -0
  154. package/dist/{chunk-C2EFFULQ.js → chunk-RK2Y4XOM.js} +163 -20
  155. package/dist/chunk-RK2Y4XOM.js.map +1 -0
  156. package/dist/{chunk-TP4FZJIZ.js → chunk-RULE4VG5.js} +5 -1
  157. package/dist/chunk-RULE4VG5.js.map +1 -0
  158. package/dist/{chunk-PVPWZSSI.js → chunk-SMA4IMHV.js} +19 -3
  159. package/dist/chunk-SMA4IMHV.js.map +1 -0
  160. package/dist/{chunk-L7IXWRYE.js → chunk-SS253RXF.js} +22 -13
  161. package/dist/chunk-SS253RXF.js.map +1 -0
  162. package/dist/chunk-TUFG6VXY.js +875 -0
  163. package/dist/chunk-TUFG6VXY.js.map +1 -0
  164. package/dist/chunk-TYEOAFH3.js +251 -0
  165. package/dist/chunk-TYEOAFH3.js.map +1 -0
  166. package/dist/chunk-UKJAGEXH.js +260 -0
  167. package/dist/chunk-UKJAGEXH.js.map +1 -0
  168. package/dist/{chunk-KVBLZUKV.js → chunk-USFPPRAF.js} +93 -3
  169. package/dist/chunk-USFPPRAF.js.map +1 -0
  170. package/dist/{chunk-GA5P7RST.js → chunk-VTJVUHRK.js} +22 -36
  171. package/dist/chunk-VTJVUHRK.js.map +1 -0
  172. package/dist/chunk-WIICJPET.js +45 -0
  173. package/dist/chunk-WIICJPET.js.map +1 -0
  174. package/dist/{chunk-VBVG2M5G.js → chunk-WPGJYVUH.js} +6 -2
  175. package/dist/chunk-WPGJYVUH.js.map +1 -0
  176. package/dist/{chunk-4HQS2HPX.js → chunk-WSZIHQBK.js} +29 -9
  177. package/dist/{chunk-4HQS2HPX.js.map → chunk-WSZIHQBK.js.map} +1 -1
  178. package/dist/{chunk-NZLQTHS5.js → chunk-WW3QQF4H.js} +4 -1
  179. package/dist/chunk-WW3QQF4H.js.map +1 -0
  180. package/dist/{chunk-FVA6TGI3.js → chunk-Y3WQ4ZWK.js} +42 -2
  181. package/dist/chunk-Y3WQ4ZWK.js.map +1 -0
  182. package/dist/chunk-YNJHCGDT.js +309 -0
  183. package/dist/chunk-YNJHCGDT.js.map +1 -0
  184. package/dist/{chunk-LOIMBRDE.js → chunk-ZGXSCMQN.js} +1993 -411
  185. package/dist/chunk-ZGXSCMQN.js.map +1 -0
  186. package/dist/{chunk-W6SL7OFG.js → chunk-ZTSE2ZJ6.js} +12 -2
  187. package/dist/{chunk-W6SL7OFG.js.map → chunk-ZTSE2ZJ6.js.map} +1 -1
  188. package/dist/chunking.js +1 -0
  189. package/dist/cipher-GVE2GQ5H.js +28 -0
  190. package/dist/cipher-GVE2GQ5H.js.map +1 -0
  191. package/dist/citations.js +1 -0
  192. package/dist/{cli-BkeRaYfk.d.ts → cli-x2APT9a6.d.ts} +26 -7
  193. package/dist/cli.d.ts +11 -6
  194. package/dist/cli.js +67 -33
  195. package/dist/codex-thread-key.js +1 -0
  196. package/dist/commitment-ledger.js +1 -0
  197. package/dist/compression-optimizer.js +1 -0
  198. package/dist/config.d.ts +2 -1
  199. package/dist/config.js +4 -1
  200. package/dist/connectors-cli-DFGtY2DB.d.ts +257 -0
  201. package/dist/connectors-cli.d.ts +2 -0
  202. package/dist/connectors-cli.js +22 -0
  203. package/dist/connectors-cli.js.map +1 -0
  204. package/dist/consolidation-operator.d.ts +65 -5
  205. package/dist/consolidation-operator.js +6 -1
  206. package/dist/consolidation-provenance-check.d.ts +1 -1
  207. package/dist/consolidation-provenance-check.js +3 -2
  208. package/dist/consolidation-undo.d.ts +1 -1
  209. package/dist/consolidation-undo.js +1 -0
  210. package/dist/consolidation-undo.js.map +1 -1
  211. package/dist/{contradiction-review-WIUBAR52.js → contradiction-review-5LTTVDQV.js} +2 -1
  212. package/dist/contradiction-review-5LTTVDQV.js.map +1 -0
  213. package/dist/{contradiction-scan-E3GJTI4F.js → contradiction-scan-3Z6YW7YA.js} +2 -1
  214. package/dist/{contradiction-scan-E3GJTI4F.js.map → contradiction-scan-3Z6YW7YA.js.map} +1 -1
  215. package/dist/cross-namespace-budget.js +1 -0
  216. package/dist/cue-anchors.js +1 -0
  217. package/dist/dashboard-runtime.js +1 -0
  218. package/dist/day-summary.js +1 -0
  219. package/dist/delinearize.js +1 -0
  220. package/dist/direct-answer-wiring.js +1 -0
  221. package/dist/direct-answer.js +1 -0
  222. package/dist/dreams-ledger-LR2NBAZE.js +286 -0
  223. package/dist/dreams-ledger-LR2NBAZE.js.map +1 -0
  224. package/dist/embedding-fallback.js +1 -0
  225. package/dist/{engine-72LSIWQP.js → engine-ICC2DSQF.js} +10 -7
  226. package/dist/engine-ICC2DSQF.js.map +1 -0
  227. package/dist/entity-retrieval.d.ts +1 -1
  228. package/dist/entity-retrieval.js +9 -6
  229. package/dist/entity-schema.js +1 -0
  230. package/dist/evals.js +1 -0
  231. package/dist/evidence-pack.d.ts +16 -0
  232. package/dist/evidence-pack.js +8 -0
  233. package/dist/evidence-pack.js.map +1 -0
  234. package/dist/explicit-capture.d.ts +6 -4
  235. package/dist/explicit-capture.js +1 -0
  236. package/dist/extraction-judge-telemetry.js +1 -0
  237. package/dist/extraction-judge-training.js +1 -0
  238. package/dist/extraction-judge.js +1 -0
  239. package/dist/extraction.js +7 -6
  240. package/dist/fallback-llm.js +3 -2
  241. package/dist/first-start-migration-4MHQEOSD.js +263 -0
  242. package/dist/first-start-migration-4MHQEOSD.js.map +1 -0
  243. package/dist/forget-PLR6J5DN.js +69 -0
  244. package/dist/forget-PLR6J5DN.js.map +1 -0
  245. package/dist/framework-CyHYDcri.d.ts +153 -0
  246. package/dist/fs-utils-IRVUFB6G.js +30 -0
  247. package/dist/fs-utils-IRVUFB6G.js.map +1 -0
  248. package/dist/graph-dashboard-diff.js +1 -0
  249. package/dist/graph-dashboard-key.js +1 -0
  250. package/dist/graph-dashboard-parser.js +1 -0
  251. package/dist/graph-edge-decay-PWB63GRE.js +207 -0
  252. package/dist/graph-edge-decay-PWB63GRE.js.map +1 -0
  253. package/dist/graph-edge-reinforcement.d.ts +81 -0
  254. package/dist/graph-edge-reinforcement.js +24 -0
  255. package/dist/graph-edge-reinforcement.js.map +1 -0
  256. package/dist/graph-events.d.ts +87 -0
  257. package/dist/graph-events.js +14 -0
  258. package/dist/graph-events.js.map +1 -0
  259. package/dist/graph-recall.js +1 -0
  260. package/dist/graph-retrieval.js +1 -0
  261. package/dist/graph-snapshot.d.ts +112 -0
  262. package/dist/graph-snapshot.js +19 -0
  263. package/dist/graph-snapshot.js.map +1 -0
  264. package/dist/graph.d.ts +105 -7
  265. package/dist/graph.js +20 -3
  266. package/dist/harmonic-retrieval.js +1 -0
  267. package/dist/himem.js +1 -0
  268. package/dist/hygiene.js +1 -0
  269. package/dist/identity-continuity.js +1 -0
  270. package/dist/importance.js +1 -0
  271. package/dist/index.d.ts +562 -13
  272. package/dist/index.js +329 -67
  273. package/dist/index.js.map +1 -1
  274. package/dist/intent.js +1 -0
  275. package/dist/json-extract.js +1 -0
  276. package/dist/json-store.js +1 -0
  277. package/dist/kdf-7S6RWKLZ.js +26 -0
  278. package/dist/kdf-7S6RWKLZ.js.map +1 -0
  279. package/dist/legacy-hook-compat.js +1 -0
  280. package/dist/legacy-hook-compat.js.map +1 -1
  281. package/dist/lifecycle.js +1 -0
  282. package/dist/live-connectors-runner.d.ts +48 -0
  283. package/dist/live-connectors-runner.js +17 -0
  284. package/dist/live-connectors-runner.js.map +1 -0
  285. package/dist/local-llm.js +1 -0
  286. package/dist/logger.js +1 -0
  287. package/dist/memory-action-policy.js +1 -0
  288. package/dist/memory-cache.d.ts +2 -1
  289. package/dist/memory-cache.js +4 -1
  290. package/dist/memory-governance-KG52RITE.js +37 -0
  291. package/dist/memory-governance-KG52RITE.js.map +1 -0
  292. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  293. package/dist/memory-lifecycle-ledger-utils.js +4 -1
  294. package/dist/memory-projection-format.js +1 -0
  295. package/dist/{memory-projection-store-DeSXPh1j.d.ts → memory-projection-store-D3vBHS4J.d.ts} +1 -0
  296. package/dist/memory-projection-store.d.ts +1 -1
  297. package/dist/memory-projection-store.js +1 -0
  298. package/dist/memory-worth-bench.js +1 -0
  299. package/dist/memory-worth-bench.js.map +1 -1
  300. package/dist/memory-worth-filter.js +1 -0
  301. package/dist/memory-worth-outcomes.d.ts +1 -1
  302. package/dist/memory-worth-outcomes.js +1 -0
  303. package/dist/memory-worth.js +1 -0
  304. package/dist/metadata-FC3XPDRQ.js +21 -0
  305. package/dist/metadata-FC3XPDRQ.js.map +1 -0
  306. package/dist/migrate-from-identity-anchor-TTEDEJGX.js +8 -0
  307. package/dist/migrate-from-identity-anchor-TTEDEJGX.js.map +1 -0
  308. package/dist/model-registry.js +1 -0
  309. package/dist/models-json.js +1 -0
  310. package/dist/native-knowledge.js +1 -0
  311. package/dist/negative.js +1 -0
  312. package/dist/objective-state-writers.js +1 -0
  313. package/dist/objective-state-writers.js.map +1 -1
  314. package/dist/objective-state.js +1 -0
  315. package/dist/openai-chat-compat.js +1 -0
  316. package/dist/operator-toolkit.d.ts +46 -2
  317. package/dist/operator-toolkit.js +28 -16
  318. package/dist/opik-exporter.js +1 -0
  319. package/dist/opik-exporter.js.map +1 -1
  320. package/dist/{orchestrator-CmJ-NTdJ.d.ts → orchestrator-ChkesB8U.d.ts} +177 -13
  321. package/dist/orchestrator.d.ts +6 -4
  322. package/dist/orchestrator.js +55 -39
  323. package/dist/page-versioning.js +1 -0
  324. package/dist/path-RMTY5Y5A.js +9 -0
  325. package/dist/path-RMTY5Y5A.js.map +1 -0
  326. package/dist/patterns-cli.d.ts +160 -0
  327. package/dist/patterns-cli.js +29 -0
  328. package/dist/patterns-cli.js.map +1 -0
  329. package/dist/peers-6OSQ3NK6.js +44 -0
  330. package/dist/peers-6OSQ3NK6.js.map +1 -0
  331. package/dist/plugin-id.js +1 -0
  332. package/dist/policy-runtime.js +1 -0
  333. package/dist/{port-BADbLZU5.d.ts → port-hqGnoStS.d.ts} +6 -0
  334. package/dist/profiling.js +1 -0
  335. package/dist/purge-6ATBGT77.js +205 -0
  336. package/dist/purge-6ATBGT77.js.map +1 -0
  337. package/dist/qmd-recall-cache.d.ts +1 -1
  338. package/dist/qmd-recall-cache.js +1 -0
  339. package/dist/qmd.d.ts +2 -1
  340. package/dist/qmd.js +4 -3
  341. package/dist/reasoning-trace-recall.js +1 -0
  342. package/dist/reasoning-trace-types.js +1 -0
  343. package/dist/recall-audit-anomaly.js +1 -0
  344. package/dist/recall-audit.js +1 -0
  345. package/dist/recall-disclosure-escalation.d.ts +84 -0
  346. package/dist/recall-disclosure-escalation.js +14 -0
  347. package/dist/recall-disclosure-escalation.js.map +1 -0
  348. package/dist/recall-explain-renderer.js +4 -1
  349. package/dist/recall-mmr.js +1 -0
  350. package/dist/recall-qos.js +1 -0
  351. package/dist/recall-query-policy.js +1 -0
  352. package/dist/recall-state.d.ts +7 -0
  353. package/dist/recall-state.js +2 -1
  354. package/dist/recall-tag-filter.d.ts +56 -0
  355. package/dist/recall-tag-filter.js +14 -0
  356. package/dist/recall-tag-filter.js.map +1 -0
  357. package/dist/recall-tokenization.js +1 -0
  358. package/dist/recall-xray-cli.d.ts +9 -2
  359. package/dist/recall-xray-cli.js +9 -4
  360. package/dist/recall-xray-renderer.js +4 -1
  361. package/dist/recall-xray.d.ts +116 -2
  362. package/dist/recall-xray.js +9 -3
  363. package/dist/reconstruct.js +1 -0
  364. package/dist/release-changelog.js +2 -0
  365. package/dist/release-changelog.js.map +1 -1
  366. package/dist/relevance.js +1 -0
  367. package/dist/rerank.js +1 -0
  368. package/dist/{resolution-QBTDHTG7.js → resolution-YGIBORXI.js} +2 -1
  369. package/dist/{resolution-QBTDHTG7.js.map → resolution-YGIBORXI.js.map} +1 -1
  370. package/dist/resolve-auth-token.d.ts +51 -0
  371. package/dist/resolve-auth-token.js +12 -0
  372. package/dist/resolve-auth-token.js.map +1 -0
  373. package/dist/resolve-provider-secret.d.ts +9 -1
  374. package/dist/resolve-provider-secret.js +4 -1
  375. package/dist/resume-bundles.js +4 -3
  376. package/dist/retrieval-agents.d.ts +1 -1
  377. package/dist/retrieval-agents.js +1 -0
  378. package/dist/retrieval-tiers.js +1 -0
  379. package/dist/retrieval.js +1 -0
  380. package/dist/sanitize.js +1 -0
  381. package/dist/schemas.d.ts +37 -24
  382. package/dist/schemas.js +2 -1
  383. package/dist/sdk-compat.js +1 -0
  384. package/dist/sdk-compat.js.map +1 -1
  385. package/dist/secure-store-4R2GSO7S.js +156 -0
  386. package/dist/secure-store-4R2GSO7S.js.map +1 -0
  387. package/dist/semantic-chunking.js +1 -0
  388. package/dist/{semantic-consolidation-CxJU6MJk.d.ts → semantic-consolidation-ByBXb-sf.d.ts} +3 -3
  389. package/dist/semantic-consolidation.d.ts +2 -2
  390. package/dist/semantic-consolidation.js +11 -6
  391. package/dist/semantic-rule-promotion.d.ts +1 -1
  392. package/dist/semantic-rule-promotion.js +9 -6
  393. package/dist/semantic-rule-verifier.d.ts +1 -1
  394. package/dist/semantic-rule-verifier.js +9 -6
  395. package/dist/session-integrity.js +1 -0
  396. package/dist/session-observer-bands.js +1 -0
  397. package/dist/session-observer-state.js +1 -0
  398. package/dist/session-toggles.js +2 -0
  399. package/dist/session-toggles.js.map +1 -1
  400. package/dist/signal.js +1 -0
  401. package/dist/skills-registry.js +2 -0
  402. package/dist/skills-registry.js.map +1 -1
  403. package/dist/source-attribution.js +1 -0
  404. package/dist/state-NCHQ4TRG.js +8 -0
  405. package/dist/state-NCHQ4TRG.js.map +1 -0
  406. package/dist/state-store-3EH7HYIN.js +16 -0
  407. package/dist/state-store-3EH7HYIN.js.map +1 -0
  408. package/dist/storage.d.ts +76 -2
  409. package/dist/storage.js +8 -5
  410. package/dist/store-contract.js +1 -0
  411. package/dist/summarizer.js +5 -4
  412. package/dist/summary-snapshot.js +1 -0
  413. package/dist/temporal-index.js +1 -0
  414. package/dist/temporal-supersession.d.ts +1 -1
  415. package/dist/temporal-supersession.js +2 -1
  416. package/dist/temporal-validity.d.ts +52 -0
  417. package/dist/temporal-validity.js +14 -0
  418. package/dist/temporal-validity.js.map +1 -0
  419. package/dist/threading.js +1 -0
  420. package/dist/tier-migration.d.ts +2 -2
  421. package/dist/tier-migration.js +1 -0
  422. package/dist/tier-routing.js +1 -0
  423. package/dist/tier-stats-62ZVDFKS.js +152 -0
  424. package/dist/tier-stats-62ZVDFKS.js.map +1 -0
  425. package/dist/tmt.js +1 -0
  426. package/dist/tokens.js +1 -0
  427. package/dist/topics.js +1 -0
  428. package/dist/trace-C5ETWBEF.js +290 -0
  429. package/dist/trace-C5ETWBEF.js.map +1 -0
  430. package/dist/transcript.js +1 -0
  431. package/dist/trust-zones.js +1 -0
  432. package/dist/tui-RI7P6PBS.js +13 -0
  433. package/dist/tui-RI7P6PBS.js.map +1 -0
  434. package/dist/types-V3FJ26TF.js +30 -0
  435. package/dist/types-V3FJ26TF.js.map +1 -0
  436. package/dist/types.d.ts +634 -9
  437. package/dist/types.js +10 -3
  438. package/dist/utility-learner.js +1 -0
  439. package/dist/utility-runtime.js +1 -0
  440. package/dist/utility-telemetry.js +1 -0
  441. package/dist/verified-recall.js +9 -6
  442. package/dist/version-utils.js +1 -0
  443. package/dist/whitespace.js +1 -0
  444. package/dist/work-product-ledger.js +1 -0
  445. package/package.json +2 -1
  446. package/dist/access-service-Br8ZydTK.d.ts +0 -827
  447. package/dist/chunk-3OGMS3PE.js.map +0 -1
  448. package/dist/chunk-3YGHKTBF.js.map +0 -1
  449. package/dist/chunk-6PFRXT4K.js.map +0 -1
  450. package/dist/chunk-6YJHX2DL.js.map +0 -1
  451. package/dist/chunk-BECYBZLX.js.map +0 -1
  452. package/dist/chunk-C2EFFULQ.js.map +0 -1
  453. package/dist/chunk-CUPFXL3J.js.map +0 -1
  454. package/dist/chunk-DIXB44VE.js.map +0 -1
  455. package/dist/chunk-F5VP6YCB.js.map +0 -1
  456. package/dist/chunk-FVA6TGI3.js.map +0 -1
  457. package/dist/chunk-GA5P7RST.js.map +0 -1
  458. package/dist/chunk-KVBLZUKV.js.map +0 -1
  459. package/dist/chunk-L7IXWRYE.js.map +0 -1
  460. package/dist/chunk-LOIMBRDE.js.map +0 -1
  461. package/dist/chunk-LTCGGW2D.js +0 -14
  462. package/dist/chunk-LTCGGW2D.js.map +0 -1
  463. package/dist/chunk-NZLQTHS5.js.map +0 -1
  464. package/dist/chunk-OC5OXUQ4.js.map +0 -1
  465. package/dist/chunk-PVPWZSSI.js.map +0 -1
  466. package/dist/chunk-SPI27QT6.js.map +0 -1
  467. package/dist/chunk-STGWEHYR.js.map +0 -1
  468. package/dist/chunk-TP4FZJIZ.js.map +0 -1
  469. package/dist/chunk-ULYOGL6R.js.map +0 -1
  470. package/dist/chunk-UWB5LMWY.js.map +0 -1
  471. package/dist/chunk-VBVG2M5G.js.map +0 -1
  472. package/dist/chunk-VDX363PS.js.map +0 -1
  473. package/dist/chunk-WCLICCGB.js.map +0 -1
  474. package/dist/chunk-X6GF3FX2.js +0 -26
  475. package/dist/chunk-X6GF3FX2.js.map +0 -1
  476. package/dist/chunk-XXVWLXSG.js.map +0 -1
  477. package/dist/chunk-Y7R2XJ5Q.js.map +0 -1
  478. package/dist/chunk-ZAIM4TUE.js.map +0 -1
  479. /package/dist/{contradiction-review-WIUBAR52.js.map → capsule-cli.js.map} +0 -0
  480. /package/dist/{engine-72LSIWQP.js.map → capsule-crypto-5CYAGVC5.js.map} +0 -0
  481. /package/dist/{chunk-TMYO7B5P.js.map → chunk-47WOM4YW.js.map} +0 -0
  482. /package/dist/{chunk-DG6YMRDC.js.map → chunk-B2TL6GA2.js.map} +0 -0
  483. /package/dist/{chunk-AYXIPSZO.js.map → chunk-CRU27Q4J.js.map} +0 -0
  484. /package/dist/{chunk-RBBWYEFJ.js.map → chunk-G2WADRQ3.js.map} +0 -0
  485. /package/dist/{chunk-NBVAS5MT.js.map → chunk-R2L7SUX2.js.map} +0 -0
@@ -1,14 +0,0 @@
1
- // src/types.ts
2
- function confidenceTier(score) {
3
- if (score >= 0.95) return "explicit";
4
- if (score >= 0.7) return "implied";
5
- if (score >= 0.4) return "inferred";
6
- return "speculative";
7
- }
8
- var SPECULATIVE_TTL_DAYS = 30;
9
-
10
- export {
11
- confidenceTier,
12
- SPECULATIVE_TTL_DAYS
13
- };
14
- //# sourceMappingURL=chunk-LTCGGW2D.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["export type ReasoningEffort = \"none\" | \"low\" | \"medium\" | \"high\";\nexport type TriggerMode = \"smart\" | \"every_n\" | \"time_based\";\nexport type SignalLevel = \"none\" | \"low\" | \"medium\" | \"high\";\nexport type MemoryCategory = \"fact\" | \"preference\" | \"correction\" | \"entity\" | \"decision\" | \"relationship\" | \"principle\" | \"commitment\" | \"moment\" | \"skill\" | \"rule\" | \"procedure\" | \"reasoning_trace\";\nexport type ConsolidationAction = \"ADD\" | \"MERGE\" | \"UPDATE\" | \"INVALIDATE\" | \"SKIP\";\nexport type ConfidenceTier = \"explicit\" | \"implied\" | \"inferred\" | \"speculative\";\nexport type PrincipalFromSessionKeyMode = \"map\" | \"prefix\" | \"regex\";\nexport type RecallPlanMode = \"no_recall\" | \"minimal\" | \"full\" | \"graph_mode\";\nexport type CronRecallMode = \"all\" | \"none\" | \"allowlist\";\nexport type CronConversationRecallMode = \"auto\" | \"always\" | \"never\";\nexport type IdentityInjectionMode = \"recovery_only\" | \"minimal\" | \"full\";\nexport type CaptureMode = \"implicit\" | \"explicit\" | \"hybrid\";\nexport type MemoryOsPresetName = \"conservative\" | \"balanced\" | \"research-max\" | \"local-llm-heavy\";\nexport type ExtractionPassSource = \"base\" | \"proactive\";\nexport type SlotMismatchMode = \"error\" | \"warn\" | \"silent\";\nexport type CodexCompactionFlushMode = \"signal\" | \"heuristic\" | \"auto\";\nexport type DreamingNarrativePromptStyle = \"reflective\" | \"diary\" | \"analytical\";\nexport type HeartbeatDetectionMode = \"runtime-signal\" | \"heuristic\" | \"auto\";\nexport type ActiveRecallQueryMode = \"message\" | \"recent\" | \"full\";\nexport type ActiveRecallPromptStyle =\n | \"balanced\"\n | \"strict\"\n | \"contextual\"\n | \"recall-heavy\"\n | \"precision-heavy\"\n | \"preference-only\";\nexport type ActiveRecallThinking =\n | \"off\"\n | \"minimal\"\n | \"low\"\n | \"medium\"\n | \"high\"\n | \"xhigh\"\n | \"adaptive\";\nexport type ActiveRecallChatType = \"direct\" | \"group\" | \"channel\";\nexport type ActiveRecallModelFallbackPolicy = \"default-remote\" | \"resolved-only\";\n\n/**\n * Retrieval tier ladder (issue #518). Identifies which tier served a recall\n * result. Ordered top-to-bottom by cost, but routing is not strictly\n * sequential — callers may jump straight to a lower tier when eligibility\n * does not hold.\n */\nexport type RetrievalTier =\n | \"exact-cache\"\n | \"fuzzy-cache\"\n | \"direct-answer\"\n | \"hybrid\"\n | \"rerank-graph\"\n | \"agentic\";\n\n/**\n * Per-recall annotation describing which retrieval tier served a result,\n * why that tier was chosen, and what was filtered along the way. Added as\n * part of issue #518 (direct-answer tier + `query --explain`).\n *\n * Not to be confused with the existing `recallExplain` operation\n * (graph-path explanation) — that is a user-invoked RPC; this is a\n * per-result annotation that can be attached to any recall response.\n */\nexport interface RecallTierExplain {\n tier: RetrievalTier;\n tierReason: string;\n filteredBy: string[];\n candidatesConsidered: number;\n latencyMs: number;\n sourceAnchors?: Array<{ path: string; lineRange?: [number, number] }>;\n}\n\nexport interface RecallSectionConfig {\n id: string;\n enabled?: boolean;\n maxChars?: number | null;\n maxHints?: number;\n maxSupportingFacts?: number;\n maxRelatedEntities?: number;\n consolidateTriggerLines?: number;\n consolidateTargetLines?: number;\n maxEntities?: number;\n maxResults?: number;\n recentTurns?: number;\n maxTurns?: number;\n maxTokens?: number;\n lookbackHours?: number;\n maxCount?: number;\n topK?: number;\n timeoutMs?: number;\n maxPatterns?: number;\n maxRubrics?: number;\n}\n\nexport interface RecallPipelineConfig {\n recallBudgetChars: number;\n pipeline: RecallSectionConfig[];\n}\n\nexport interface SessionObserverBandConfig {\n maxBytes: number;\n triggerDeltaBytes: number;\n triggerDeltaTokens: number;\n}\n\nexport interface FileHygieneConfig {\n enabled: boolean;\n // Lint (warn before truncation risk)\n lintEnabled: boolean;\n lintBudgetBytes: number;\n lintWarnRatio: number;\n lintPaths: string[];\n // Rotation/splitting\n rotateEnabled: boolean;\n rotateMaxBytes: number;\n rotateKeepTailChars: number;\n rotatePaths: string[];\n archiveDir: string;\n // Cadence\n runMinIntervalMs: number;\n // Optional warnings log (future-proofed)\n warningsLogEnabled: boolean;\n warningsLogPath: string;\n // Optional index file (future-proofed)\n indexEnabled: boolean;\n indexPath: string;\n}\n\nexport interface NativeKnowledgeConfig {\n enabled: boolean;\n includeFiles: string[];\n maxChunkChars: number;\n maxResults: number;\n maxChars: number;\n stateDir: string;\n obsidianVaults: NativeKnowledgeObsidianVaultConfig[];\n openclawWorkspace?: NativeKnowledgeOpenClawWorkspaceConfig;\n}\n\nexport interface NativeKnowledgeFolderRuleConfig {\n pathPrefix: string;\n namespace?: string;\n privacyClass?: string;\n}\n\nexport interface NativeKnowledgeObsidianVaultConfig {\n id: string;\n rootDir: string;\n includeGlobs: string[];\n excludeGlobs: string[];\n namespace?: string;\n privacyClass?: string;\n folderRules: NativeKnowledgeFolderRuleConfig[];\n dailyNotePatterns: string[];\n materializeBacklinks: boolean;\n}\n\nexport interface NativeKnowledgeOpenClawWorkspaceConfig {\n enabled: boolean;\n bootstrapFiles: string[];\n handoffGlobs: string[];\n dailySummaryGlobs: string[];\n automationNoteGlobs: string[];\n workspaceDocGlobs: string[];\n excludeGlobs: string[];\n sharedSafeGlobs: string[];\n}\n\nexport interface AgentAccessHttpConfig {\n enabled: boolean;\n host: string;\n port: number;\n authToken?: string;\n principal?: string;\n maxBodyBytes: number;\n}\n\nexport interface DreamingConfig {\n enabled: boolean;\n journalPath: string;\n maxEntries: number;\n injectRecentCount: number;\n minIntervalMinutes: number;\n narrativeModel: string | null;\n narrativePromptStyle: DreamingNarrativePromptStyle;\n watchFile: boolean;\n}\n\n/** Procedural memory (issue #519): mining + recall gates. All sub-features default off. */\nexport interface ProceduralConfig {\n enabled: boolean;\n /** Minimum cluster size before emitting a candidate; `0` disables mining (`minOccurrences_zero`). */\n minOccurrences: number;\n /** Minimum success rate from trajectory outcomes in [0, 1]. */\n successFloor: number;\n /** When auto-promotion is enabled, promote pending_review → active after this many occurrences. */\n autoPromoteOccurrences: number;\n autoPromoteEnabled: boolean;\n lookbackDays: number;\n /** When true, installer may register the nightly procedural mining cron (default off). */\n proceduralMiningCronAutoRegister: boolean;\n /** Max procedure memories to inject on task-initiation recall (1–10). */\n recallMaxProcedures: number;\n}\n\n/**\n * Coding-agent mode config (issue #569).\n *\n * When the connector provides a `CodingContext` (see below), Remnic overlays\n * a project- and/or branch-scoped namespace on top of the principal's default\n * namespace so that memories written while working on project A do not surface\n * while working on project B.\n *\n * Both flags default off-for-branch / on-for-project. Per CLAUDE.md #30 every\n * filter or transform needs an escape hatch: set `projectScope: false` to\n * exactly restore pre-#569 behaviour.\n */\nexport interface CodingModeConfig {\n /**\n * When true (default), a session with a resolved `CodingContext` uses a\n * project-scoped namespace. When false, the principal's default namespace\n * is used unchanged (pre-#569 behaviour).\n */\n projectScope: boolean;\n /**\n * When true, recall/write also overlay the current branch on top of the\n * project namespace. Default false — branch-scope is opt-in because active\n * development typically wants recall across branches. (Wired by PR 3 of\n * issue #569; declared here so the schema ships in one slice.)\n */\n branchScope: boolean;\n}\n\n/**\n * Session-scoped coding context. Produced by `resolveGitContext()` in the\n * connector layer and attached to a session so that recall + write paths can\n * compute an overlay namespace.\n *\n * All fields mirror `GitContext` from `./coding/git-context.ts`; kept as a\n * separate interface because `types.ts` must stay dependency-free (it is\n * imported by every other module).\n */\nexport interface CodingContext {\n projectId: string;\n branch: string | null;\n rootPath: string;\n defaultBranch: string | null;\n}\n\n/** Configuration for the nightly contradiction-scan cron (issue #520). */\nexport interface ContradictionScanConfig {\n /** Master switch for the contradiction scan cron. Default true. */\n enabled: boolean;\n /** Embedding cosine similarity floor for candidate pair generation. Default 0.82. */\n similarityFloor: number;\n /** Minimum topic-token Jaccard overlap for unstructured pairs. Default 0.4. */\n topicOverlapFloor: number;\n /** Cap on candidate pairs evaluated per cron run. Default 500. */\n maxPairsPerRun: number;\n /** Cooldown in days before re-evaluating a pair judged independent/both-valid. Default 14. */\n cooldownDays: number;\n /** When true, pairs judged \"duplicates\" are auto-flagged for dedup (still need user approval). Default false. */\n autoMergeDuplicates: boolean;\n}\n\nexport interface HeartbeatConfig {\n enabled: boolean;\n journalPath: string;\n maxPreviousRuns: number;\n watchFile: boolean;\n detectionMode: HeartbeatDetectionMode;\n gateExtractionDuringHeartbeat: boolean;\n}\n\nexport interface SlotBehaviorConfig {\n requireExclusiveMemorySlot: boolean;\n onSlotMismatch: SlotMismatchMode;\n}\n\nexport interface CodexCompatConfig {\n enabled: boolean;\n threadIdBufferKeying: boolean;\n compactionFlushMode: CodexCompactionFlushMode;\n fingerprintDedup: boolean;\n}\n\nexport function confidenceTier(score: number): ConfidenceTier {\n if (score >= 0.95) return \"explicit\";\n if (score >= 0.70) return \"implied\";\n if (score >= 0.40) return \"inferred\";\n return \"speculative\";\n}\n\n/** Default TTL in days for speculative memories (auto-expire if unconfirmed) */\nexport const SPECULATIVE_TTL_DAYS = 30;\n\n/**\n * Shape for semantic chunking config overrides stored in PluginConfig.\n * Mirrors SemanticChunkingConfig from semantic-chunking.ts without creating\n * a circular import (types.ts is imported by everything).\n */\nexport interface SemanticChunkingConfigShape {\n targetTokens: number;\n minTokens: number;\n maxTokens: number;\n smoothingWindowSize: number;\n boundaryThresholdStdDevs: number;\n embeddingBatchSize: number;\n fallbackToRecursive: boolean;\n}\n\nexport interface PluginConfig {\n openaiApiKey: string | undefined;\n openaiBaseUrl: string | undefined;\n model: string;\n reasoningEffort: ReasoningEffort;\n triggerMode: TriggerMode;\n bufferMaxTurns: number;\n bufferMaxMinutes: number;\n /**\n * Surprise-gated buffer flush (issue #563, D-MEM).\n *\n * When enabled, every turn added to the smart buffer is scored against a\n * configurable window of recent memories using an embedding-distance proxy\n * for novelty (see `buffer-surprise.ts`). A turn whose surprise score\n * exceeds `bufferSurpriseThreshold` triggers an immediate extract flush,\n * even if the existing signal/turn-count/time triggers would otherwise keep\n * buffering. Disabled by default — when `false`, buffer behavior is\n * identical to pre-#563 code. Additive only: existing triggers are never\n * suppressed by this flag.\n */\n bufferSurpriseTriggerEnabled: boolean;\n /**\n * Threshold in `[0, 1]` above which a surprise score causes an immediate\n * flush. `0.35` is a conservative default chosen to favor precision over\n * recall during the opt-in phase. Ignored unless\n * `bufferSurpriseTriggerEnabled` is `true`.\n */\n bufferSurpriseThreshold: number;\n /**\n * Number of nearest neighbors to average over when computing the surprise\n * score (see `computeSurprise`). Default `5`. Clamped to the recent-memory\n * window size at call time.\n */\n bufferSurpriseK: number;\n /**\n * Maximum number of recent memories to sample when computing the surprise\n * score. Bounds embedding cost per turn. Default `20`. Set to `0` to\n * disable the trigger even when the flag is on (no memories to compare\n * against → treat as not-applicable rather than maximally surprising).\n */\n bufferSurpriseRecentMemoryCount: number;\n /**\n * Hard timeout (ms) for the surprise probe. If the probe does not\n * resolve within this window, the buffer treats the probe as failed,\n * logs at debug, and falls through to the existing triggers. Ensures\n * a slow or hung embedder cannot stall the turn-append path. Default\n * `2000` (2s).\n */\n bufferSurpriseProbeTimeoutMs: number;\n consolidateEveryN: number;\n highSignalPatterns: string[];\n maxMemoryTokens: number;\n memoryOsPreset?: MemoryOsPresetName;\n qmdEnabled: boolean;\n qmdCollection: string;\n qmdMaxResults: number;\n qmdColdTierEnabled?: boolean;\n qmdColdCollection?: string;\n qmdColdMaxResults?: number;\n qmdTierMigrationEnabled: boolean;\n qmdTierDemotionMinAgeDays: number;\n qmdTierDemotionValueThreshold: number;\n qmdTierPromotionValueThreshold: number;\n qmdTierParityGraphEnabled: boolean;\n qmdTierParityHiMemEnabled: boolean;\n qmdTierAutoBackfillEnabled: boolean;\n embeddingFallbackEnabled: boolean;\n embeddingFallbackProvider: \"auto\" | \"openai\" | \"local\";\n /** Optional absolute path to qmd binary. If unset, PATH/fallback discovery is used. */\n qmdPath?: string;\n memoryDir: string;\n debug: boolean;\n identityEnabled: boolean;\n identityContinuityEnabled: boolean;\n identityInjectionMode: IdentityInjectionMode;\n identityMaxInjectChars: number;\n continuityIncidentLoggingEnabled: boolean;\n continuityAuditEnabled: boolean;\n sessionObserverEnabled?: boolean;\n sessionObserverDebounceMs?: number;\n sessionObserverBands?: SessionObserverBandConfig[];\n injectQuestions: boolean;\n commitmentDecayDays: number;\n workspaceDir: string;\n captureMode: CaptureMode;\n fileHygiene?: FileHygieneConfig;\n nativeKnowledge?: NativeKnowledgeConfig;\n agentAccessHttp: AgentAccessHttpConfig;\n // Access tracking (Phase 1A)\n accessTrackingEnabled: boolean;\n accessTrackingBufferMaxSize: number;\n // Retrieval options\n recencyWeight: number;\n boostAccessCount: boolean;\n /** Record empty recall impressions (memoryIds: []) when no memories are injected. Disabled by default. */\n recordEmptyRecallImpressions: boolean;\n // v2.2 Advanced Retrieval\n queryExpansionEnabled: boolean;\n queryExpansionMaxQueries: number;\n /** Minimum token length to consider for query expansion. */\n queryExpansionMinTokenLen: number;\n rerankEnabled: boolean;\n /** Rerank provider. \"local\" uses Local LLM only; \"cloud\" uses gateway fallback chain. */\n rerankProvider: \"local\" | \"cloud\";\n rerankMaxCandidates: number;\n rerankTimeoutMs: number;\n rerankCacheEnabled: boolean;\n rerankCacheTtlMs: number;\n feedbackEnabled: boolean;\n // v2.2 Negative Examples (safe defaults: off unless enabled)\n /** If true, allow recording negative examples and apply a soft penalty during ranking. */\n negativeExamplesEnabled: boolean;\n /** Score penalty per \"not useful\" hit (typical QMD scores ~0-1). Keep small. */\n negativeExamplesPenaltyPerHit: number;\n /** Maximum penalty applied from negative examples. */\n negativeExamplesPenaltyCap: number;\n // Chunking (Phase 2A)\n chunkingEnabled: boolean;\n chunkingTargetTokens: number;\n chunkingMinTokens: number;\n chunkingOverlapSentences: number;\n // Semantic Chunking (Issue #368)\n /** Enable semantic chunking with embedding-based topic boundary detection. Default: false. */\n semanticChunkingEnabled: boolean;\n /** Optional overrides for the semantic chunking algorithm. */\n semanticChunkingConfig: Partial<SemanticChunkingConfigShape>;\n // Contradiction Detection (Phase 2B)\n contradictionDetectionEnabled: boolean;\n contradictionSimilarityThreshold: number;\n contradictionMinConfidence: number;\n contradictionAutoResolve: boolean;\n /** Nightly contradiction-scan cron config (issue #520). */\n contradictionScan: ContradictionScanConfig;\n // Temporal Supersession (issue #375)\n /**\n * When enabled, writes that carry `structuredAttributes` mark any older\n * fact with the same `entityRef + attribute_name` supersession key and a\n * conflicting value as `status: \"superseded\"`.\n */\n temporalSupersessionEnabled: boolean;\n /**\n * When enabled, superseded memories are still returned by recall (useful\n * for audit/history queries). Default: false — superseded memories are\n * filtered out.\n */\n temporalSupersessionIncludeInRecall: boolean;\n // Direct-answer retrieval tier (issue #518)\n /**\n * When true, recall checks whether a single validated memory in a\n * high-trust taxonomy bucket can answer the query before invoking QMD.\n * Default false — enable explicitly after bench validation.\n */\n recallDirectAnswerEnabled: boolean;\n /**\n * Graph-based retrieval tier via Personalized PageRank (issue #559 PR 4).\n * When true, recall builds a retrieval graph from memory frontmatter\n * and runs PPR, merging the result with QMD via MMR. Default false —\n * ships off pending the retrieval-graph bench in PR 5.\n */\n recallGraphEnabled: boolean;\n /** PPR damping factor used when `recallGraphEnabled` is true. */\n recallGraphDamping: number;\n /** PPR power-iteration cap used when `recallGraphEnabled` is true. */\n recallGraphIterations: number;\n /**\n * Max memories returned by the graph tier before MMR. Set to 0 to\n * disable the graph tier's contribution without flipping the flag.\n */\n recallGraphTopK: number;\n /**\n * Minimum token-overlap ratio (query tokens ∩ memory tokens / query tokens)\n * required for direct-answer eligibility. Set to 0 to disable the gate.\n */\n recallDirectAnswerTokenOverlapFloor: number;\n /**\n * Minimum calibrated importance score required for direct-answer\n * eligibility. Set to 0 to disable the gate.\n */\n recallDirectAnswerImportanceFloor: number;\n /**\n * Ambiguity margin: if the second-best candidate scores within this\n * ratio of the top candidate, direct-answer defers to the hybrid tier.\n */\n recallDirectAnswerAmbiguityMargin: number;\n /**\n * Taxonomy category IDs eligible for direct-answer routing. Memories\n * whose resolved taxonomy category is not in this list never qualify.\n */\n recallDirectAnswerEligibleTaxonomyBuckets: string[];\n /**\n * Cross-namespace query-budget limiter (issue #565 PR 4/5). When true,\n * a principal that issues a burst of recalls against namespaces other\n * than their own is throttled once its per-window count crosses\n * `recallCrossNamespaceBudgetHardLimit`. Default false — ships disabled.\n */\n recallCrossNamespaceBudgetEnabled: boolean;\n /** Rolling window in milliseconds over which cross-namespace reads are counted. */\n recallCrossNamespaceBudgetWindowMs: number;\n /**\n * Soft threshold — the first point at which the limiter flags a burst.\n * Calls are still allowed; anomaly detection (issue #565 PR 5) will\n * surface the warning.\n */\n recallCrossNamespaceBudgetSoftLimit: number;\n /** Hard threshold — calls past this count are denied in the window. */\n recallCrossNamespaceBudgetHardLimit: number;\n // Memory Worth recall filter (issue #560 PR 4)\n /**\n * When true, recall multiplies candidate scores by the Memory Worth\n * factor computed from `mw_success` / `mw_fail` counters on each\n * memory's frontmatter (see `computeMemoryWorth`). Memories with a\n * history of failed sessions sink; neutral / uninstrumented memories\n * are untouched (multiplier 1.0). Default false — flip to true in PR 5\n * once the benchmark shows precision tie-or-win.\n */\n recallMemoryWorthFilterEnabled: boolean;\n /**\n * Recall-audit anomaly detector (issue #565 PR 5/5). When true,\n * access surfaces run the anomaly detector over a tail of the audit\n * trail after each recall and surface any flags via logs / metrics.\n * Ships disabled.\n */\n recallAuditAnomalyDetectionEnabled: boolean;\n /** Rolling window over which audit entries are analyzed. */\n recallAuditAnomalyWindowMs: number;\n /** Threshold for the `repeat-query` flag. */\n recallAuditAnomalyRepeatQueryLimit: number;\n /** Threshold for the `namespace-walk` flag (distinct namespaces). */\n recallAuditAnomalyNamespaceWalkLimit: number;\n /** Threshold for the `high-cardinality-return` flag. */\n recallAuditAnomalyHighCardinalityLimit: number;\n /** Threshold for the `rapid-fire` flag. */\n recallAuditAnomalyRapidFireLimit: number;\n /**\n * Optional half-life for Memory Worth decay, in milliseconds. When\n * positive, older outcome observations are exponentially decayed toward\n * the uniform prior. Set to 0 (default) to disable decay and use raw\n * counter values.\n */\n recallMemoryWorthHalfLifeMs: number;\n // Memory Linking (Phase 3A)\n memoryLinkingEnabled: boolean;\n // Conversation Threading (Phase 3B)\n threadingEnabled: boolean;\n threadingGapMinutes: number;\n // Memory Summarization (Phase 4A)\n summarizationEnabled: boolean;\n summarizationTriggerCount: number;\n summarizationRecentToKeep: number;\n summarizationImportanceThreshold: number;\n summarizationProtectedTags: string[];\n // Topic Extraction (Phase 4B)\n topicExtractionEnabled: boolean;\n topicExtractionTopN: number;\n // Transcript & Context Preservation (v2.0)\n // Transcript archive\n transcriptEnabled: boolean;\n transcriptRetentionDays: number;\n /** Channel types to skip from transcript logging (e.g., [\"cron\"]) */\n transcriptSkipChannelTypes: string[];\n // Transcript injection\n transcriptRecallHours: number;\n maxTranscriptTurns: number;\n maxTranscriptTokens: number;\n // Checkpoint\n checkpointEnabled: boolean;\n checkpointTurns: number;\n // Compaction reset: trigger session reset after compaction instead of continuing degraded.\n // Requires OC fork with PR #29985 (api.resetSession).\n compactionResetEnabled: boolean;\n beforeResetTimeoutMs: number;\n flushOnResetEnabled: boolean;\n commandsListEnabled: boolean;\n openclawToolsEnabled: boolean;\n openclawToolSnippetMaxChars: number;\n sessionTogglesEnabled: boolean;\n verboseRecallVisibility: boolean;\n recallTranscriptsEnabled: boolean;\n recallTranscriptRetentionDays: number;\n respectBundledActiveMemoryToggle: boolean;\n activeRecallEnabled: boolean;\n activeRecallAgents: string[] | null;\n activeRecallAllowedChatTypes: ActiveRecallChatType[];\n activeRecallQueryMode: ActiveRecallQueryMode;\n activeRecallPromptStyle: ActiveRecallPromptStyle;\n activeRecallPromptOverride: string | null;\n activeRecallPromptAppend: string | null;\n activeRecallMaxSummaryChars: number;\n activeRecallRecentUserTurns: number;\n activeRecallRecentAssistantTurns: number;\n activeRecallRecentUserChars: number;\n activeRecallRecentAssistantChars: number;\n activeRecallThinking: ActiveRecallThinking;\n activeRecallTimeoutMs: number;\n activeRecallCacheTtlMs: number;\n activeRecallModel: string | null;\n activeRecallModelFallbackPolicy: ActiveRecallModelFallbackPolicy;\n activeRecallPersistTranscripts: boolean;\n activeRecallTranscriptDir: string;\n activeRecallEntityGraphDepth: number;\n activeRecallIncludeCausalTrajectories: boolean;\n activeRecallIncludeDaySummary: boolean;\n activeRecallAttachRecallExplain: boolean;\n activeRecallAllowChainedActiveMemory: boolean;\n dreaming: DreamingConfig;\n procedural: ProceduralConfig;\n // Coding-agent project/branch scoping (issue #569)\n codingMode: CodingModeConfig;\n heartbeat: HeartbeatConfig;\n slotBehavior: SlotBehaviorConfig;\n codexCompat: CodexCompatConfig;\n // Extraction judge (issue #376)\n /** Enable the LLM-as-judge fact-worthiness gate on extracted facts. Default false (opt-in). */\n extractionJudgeEnabled: boolean;\n /** Model override for the judge LLM. Empty string means use the local model. */\n extractionJudgeModel: string;\n /** Maximum number of candidate facts per judge LLM batch call. */\n extractionJudgeBatchSize: number;\n /** Shadow mode: log judge verdicts but do not filter facts. Default false. */\n extractionJudgeShadow: boolean;\n /**\n * Maximum number of times the same candidate text may be deferred before\n * the judge forcibly converts the verdict to `\"reject\"`. Prevents\n * pathological LLM responses from looping forever on ambiguous facts.\n * Defaults to 2 (issue #562, PR 2).\n */\n extractionJudgeMaxDeferrals: number;\n /**\n * Emit structured telemetry rows to\n * `state/observation-ledger/extraction-judge-verdicts.jsonl` on every\n * judge verdict. Off by default; enable to collect defer-rate / latency\n * metrics for operator dashboards (issue #562, PR 3).\n */\n extractionJudgeTelemetryEnabled: boolean;\n /**\n * Collect `(candidate_text, verdict_kind, reason)` tuples into\n * `~/.remnic/judge-training/<date>.jsonl` for use by a future GRPO\n * training pipeline (issue #562, PR 4). Off by default. Rows live in\n * the user's home directory rather than the shared memory directory so\n * they are not committed, sync'd, or bundled into memory exports.\n */\n collectJudgeTrainingPairs: boolean;\n /**\n * Override directory for judge training-pair collection. Empty string\n * means use the default (`~/.remnic/judge-training`). Primarily for\n * tests and for operators who want the output to land in a specific\n * location.\n */\n judgeTrainingDir: string;\n // Hourly summaries\n hourlySummariesEnabled: boolean;\n daySummaryEnabled: boolean;\n /** If true, Engram may attempt to auto-register an hourly summary cron job (default off). */\n hourlySummaryCronAutoRegister: boolean;\n /** If true, Engram may attempt to auto-register the nightly governance cron job (default off). */\n nightlyGovernanceCronAutoRegister: boolean;\n summaryRecallHours: number;\n maxSummaryCount: number;\n summaryModel: string;\n // v2.4 Extended hourly summaries\n hourlySummariesExtendedEnabled: boolean;\n hourlySummariesIncludeToolStats: boolean;\n hourlySummariesIncludeSystemMessages: boolean;\n hourlySummariesMaxTurnsPerRun: number;\n // v2.4 Conversation index (optional)\n conversationIndexEnabled: boolean;\n conversationIndexBackend: \"qmd\" | \"faiss\";\n conversationIndexQmdCollection: string;\n conversationIndexRetentionDays: number;\n conversationIndexMinUpdateIntervalMs: number;\n conversationIndexEmbedOnUpdate: boolean;\n conversationIndexFaissScriptPath?: string;\n conversationIndexFaissPythonBin?: string;\n conversationIndexFaissModelId: string;\n conversationIndexFaissIndexDir: string;\n conversationIndexFaissUpsertTimeoutMs: number;\n conversationIndexFaissSearchTimeoutMs: number;\n conversationIndexFaissHealthTimeoutMs: number;\n conversationIndexFaissMaxBatchSize: number;\n conversationIndexFaissMaxSearchK: number;\n conversationRecallTopK: number;\n conversationRecallMaxChars: number;\n conversationRecallTimeoutMs: number;\n // Evaluation harness foundation\n evalHarnessEnabled: boolean;\n evalShadowModeEnabled: boolean;\n benchmarkBaselineSnapshotsEnabled: boolean;\n benchmarkDeltaReporterEnabled: boolean;\n benchmarkStoredBaselineEnabled: boolean;\n evalStoreDir: string;\n // Objective-state memory foundation\n objectiveStateMemoryEnabled: boolean;\n objectiveStateSnapshotWritesEnabled: boolean;\n objectiveStateRecallEnabled: boolean;\n objectiveStateStoreDir: string;\n // Causal trajectory memory foundation\n causalTrajectoryMemoryEnabled: boolean;\n causalTrajectoryStoreDir: string;\n causalTrajectoryRecallEnabled: boolean;\n actionGraphRecallEnabled: boolean;\n // Trust-zone memory foundation\n trustZonesEnabled: boolean;\n quarantinePromotionEnabled: boolean;\n trustZoneStoreDir: string;\n trustZoneRecallEnabled: boolean;\n memoryPoisoningDefenseEnabled: boolean;\n memoryRedTeamBenchEnabled: boolean;\n // Harmonic retrieval foundation\n harmonicRetrievalEnabled: boolean;\n abstractionAnchorsEnabled: boolean;\n abstractionNodeStoreDir: string;\n // Episodic/semantic split foundation\n verifiedRecallEnabled: boolean;\n semanticRulePromotionEnabled: boolean;\n semanticRuleVerificationEnabled: boolean;\n semanticConsolidationEnabled: boolean;\n semanticConsolidationModel: string;\n semanticConsolidationThreshold: number;\n semanticConsolidationMinClusterSize: number;\n semanticConsolidationExcludeCategories: string[];\n semanticConsolidationIntervalHours: number;\n semanticConsolidationMaxPerRun: number;\n /**\n * When true (default), semantic-consolidation prompts the LLM with an\n * operator-aware format asking for JSON `{operator, output}` and records\n * the resulting SPLIT/MERGE/UPDATE operator on `derived_via`. When\n * false, falls back to the legacy plain-text prompt — `derived_via` is\n * still populated via the cluster-shape heuristic in\n * `chooseConsolidationOperator`. Issue #561 PR 3.\n */\n operatorAwareConsolidationEnabled: boolean;\n // Creation-memory foundation\n creationMemoryEnabled: boolean;\n memoryUtilityLearningEnabled: boolean;\n promotionByOutcomeEnabled: boolean;\n commitmentLedgerEnabled: boolean;\n commitmentLifecycleEnabled: boolean;\n commitmentStaleDays: number;\n commitmentLedgerDir: string;\n resumeBundlesEnabled: boolean;\n resumeBundleDir: string;\n workProductRecallEnabled: boolean;\n workProductLedgerDir: string;\n workTasksEnabled: boolean;\n workProjectsEnabled: boolean;\n workTasksDir: string;\n workProjectsDir: string;\n workIndexEnabled: boolean;\n workIndexDir: string;\n workTaskIndexEnabled: boolean;\n workProjectIndexEnabled: boolean;\n workIndexAutoRebuildEnabled: boolean;\n workIndexAutoRebuildDebounceMs: number;\n // Local LLM Provider (v2.1)\n localLlmEnabled: boolean;\n localLlmUrl: string;\n localLlmModel: string;\n /** Optional API key for authenticated OpenAI-compatible endpoints. */\n localLlmApiKey?: string;\n /** Additional headers for local/compatible endpoint requests. */\n localLlmHeaders?: Record<string, string>;\n /** If false, do not send Authorization header even when localLlmApiKey is set. */\n localLlmAuthHeader: boolean;\n localLlmFallback: boolean;\n /** Optional home directory override for local LLM helpers (LM Studio settings, CLI PATH). */\n localLlmHomeDir?: string;\n /** Optional absolute path to LMS CLI binary (preferred over auto-detection). */\n localLmsCliPath?: string;\n /** Optional bin directory prepended to PATH for LMS CLI execution. */\n localLmsBinDir?: string;\n /** Hard timeout for local LLM requests (ms). */\n localLlmTimeoutMs: number;\n /** Max context window for local LLM (override auto-detection). Set lower if your LLM server defaults to smaller contexts. */\n localLlmMaxContext?: number;\n // Observability\n /** If true, log slow operations (local LLM + related I/O) with durations and metadata (no content). */\n slowLogEnabled: boolean;\n /**\n * If true, include the full recalled memory text in `RecallTraceEvent.recalledContent`.\n * Disabled by default — enable only when you want external trace subscribers (e.g. Langfuse)\n * to see the exact memory context injected into each conversation turn.\n * This adds payload to trace events but does not log to files or the gateway log.\n */\n traceRecallContent: boolean;\n /** Threshold for slow operation logging (ms). */\n slowLogThresholdMs: number;\n // Performance profiling (opt-in)\n /** If true, collect and persist timing traces for recall and extraction pipelines. */\n profilingEnabled: boolean;\n /** Directory for profiling trace JSONL files. Defaults to <memoryDir>/profiling. */\n profilingStorageDir: string;\n /** Maximum number of trace files to keep (rolling window). */\n profilingMaxTraces: number;\n // Extraction stability guards (P0/P1)\n extractionDedupeEnabled: boolean;\n extractionDedupeWindowMs: number;\n extractionMinChars: number;\n extractionMinUserTurns: number;\n extractionMaxTurnChars: number;\n extractionMaxFactsPerRun: number;\n extractionMaxEntitiesPerRun: number;\n extractionMaxQuestionsPerRun: number;\n extractionMaxProfileUpdatesPerRun: number;\n /**\n * Minimum importance level required to persist an extracted fact. Facts\n * whose locally-scored level falls below this threshold are dropped before\n * write and counted toward the `importance_gated` metric. Defaults to\n * \"low\" so trivial content (greetings, single-word replies, filler) is\n * silently dropped while everything else still passes.\n */\n extractionMinImportanceLevel: ImportanceLevel;\n /**\n * Inline source attribution (issue #369).\n * When enabled, extracted facts carry a compact provenance tag (agent,\n * session, timestamp) inlined into the fact text — not just in YAML\n * frontmatter — so the citation survives prompt injection, copy/paste,\n * and LLM quoting. Off by default to preserve backwards compatibility\n * with existing downstream consumers that expect raw fact text.\n */\n inlineSourceAttributionEnabled: boolean;\n /**\n * Template used when injecting inline citations. Supported placeholders:\n * `{agent}`, `{session}`, `{sessionId}`, `{ts}`, `{date}`. Defaults to\n * `[Source: agent={agent}, session={sessionId}, ts={ts}]`.\n */\n inlineSourceAttributionFormat: string;\n consolidationRequireNonZeroExtraction: boolean;\n consolidationMinIntervalMs: number;\n // QMD maintenance (debounced singleflight)\n qmdMaintenanceEnabled: boolean;\n qmdMaintenanceDebounceMs: number;\n qmdAutoEmbedEnabled: boolean;\n qmdEmbedMinIntervalMs: number;\n qmdUpdateTimeoutMs: number;\n qmdUpdateMinIntervalMs: number;\n // Local LLM resilience\n localLlmRetry5xxCount: number;\n localLlmRetryBackoffMs: number;\n localLlm400TripThreshold: number;\n localLlm400CooldownMs: number;\n // Local LLM fast tier (v9.1) — smaller model for quick ops\n localLlmFastEnabled: boolean;\n localLlmFastModel: string;\n localLlmFastUrl: string;\n localLlmFastTimeoutMs: number;\n /**\n * Suppress chain-of-thought / thinking mode on the main local LLM\n * (issue #548). When true, Remnic injects\n * `chat_template_kwargs: { enable_thinking: false }` on every\n * request so thinking-capable models (Qwen 3.5, Gemma 4, DeepSeek,\n * etc.) skip reasoning tokens that structured-output tasks like\n * extraction and consolidation cannot benefit from. Default: true\n * — the dominant localLlm use case is JSON-shaped extraction where\n * thinking is pure latency tax and a common cause of 60s timeouts.\n * Set to false to restore thinking for narrative tasks.\n *\n * The fast-tier client (`fastLlm`) always disables thinking; that\n * contract is baked into \"fast tier\" and is unaffected by this flag.\n */\n localLlmDisableThinking: boolean;\n // Gateway config for fallback AI\n gatewayConfig?: GatewayConfig;\n // Gateway model source (v9.2) — route LLM calls through gateway agent model chain\n modelSource: \"plugin\" | \"gateway\";\n gatewayAgentId: string;\n fastGatewayAgentId: string;\n\n // v3.0 Multi-agent memory (namespaces)\n namespacesEnabled: boolean;\n defaultNamespace: string;\n sharedNamespace: string;\n principalFromSessionKeyMode: PrincipalFromSessionKeyMode;\n principalFromSessionKeyRules: PrincipalRule[];\n namespacePolicies: NamespacePolicy[];\n defaultRecallNamespaces: Array<\"self\" | \"shared\">;\n cronRecallMode: CronRecallMode;\n cronRecallAllowlist: string[];\n cronRecallPolicyEnabled: boolean;\n cronRecallNormalizedQueryMaxChars: number;\n cronRecallInstructionHeavyTokenCap: number;\n cronConversationRecallMode: CronConversationRecallMode;\n autoPromoteToSharedEnabled: boolean;\n autoPromoteToSharedCategories: Array<\"fact\" | \"correction\" | \"decision\" | \"preference\">;\n autoPromoteMinConfidenceTier: ConfidenceTier;\n routingRulesEnabled: boolean;\n routingRulesStateFile: string;\n\n // v4.0 Shared-context (cross-agent shared intelligence)\n sharedContextEnabled: boolean;\n sharedContextDir?: string;\n sharedContextMaxInjectChars: number;\n crossSignalsSemanticEnabled: boolean;\n crossSignalsSemanticTimeoutMs: number;\n sharedCrossSignalSemanticEnabled?: boolean;\n sharedCrossSignalSemanticTimeoutMs?: number;\n sharedCrossSignalSemanticMaxCandidates?: number;\n\n // v5.0 Compounding engine\n compoundingEnabled: boolean;\n compoundingWeeklyCronEnabled: boolean;\n compoundingSemanticEnabled: boolean;\n compoundingSynthesisTimeoutMs: number;\n compoundingInjectEnabled: boolean;\n\n // IRC (Inductive Rule Consolidation) — preference synthesis\n ircEnabled: boolean;\n ircMaxPreferences: number;\n ircIncludeCorrections: boolean;\n ircMinConfidence: number;\n\n // CMC (Causal Memory Consolidation) — cross-session causal reasoning\n cmcEnabled: boolean;\n cmcStitchLookbackDays: number;\n cmcStitchMinScore: number;\n cmcStitchMaxEdgesPerTrajectory: number;\n cmcConsolidationEnabled: boolean;\n cmcConsolidationMinRecurrence: number;\n cmcConsolidationMinSessions: number;\n cmcConsolidationSuccessThreshold: number;\n cmcRetrievalEnabled: boolean;\n cmcRetrievalMaxDepth: number;\n cmcRetrievalMaxChars: number;\n cmcRetrievalCounterfactualBoost: number;\n cmcBehaviorLearningEnabled: boolean;\n cmcBehaviorMinFrequency: number;\n cmcBehaviorMinSessions: number;\n cmcBehaviorConfidenceThreshold: number;\n cmcLifecycleCausalImpactWeight: number;\n\n // PEDC (Prediction-Error-Driven Calibration) — model-user alignment\n calibrationEnabled: boolean;\n calibrationMaxRulesPerRecall: number;\n calibrationMaxChars: number;\n\n // Search backend abstraction\n searchBackend?: \"qmd\" | \"remote\" | \"noop\" | \"lancedb\" | \"meilisearch\" | \"orama\";\n remoteSearchBaseUrl?: string;\n remoteSearchApiKey?: string;\n remoteSearchTimeoutMs?: number;\n\n // LanceDB backend\n lancedbEnabled: boolean;\n lanceDbPath?: string;\n lanceEmbeddingDimension?: number;\n\n // Meilisearch backend\n meilisearchEnabled: boolean;\n meilisearchHost?: string;\n meilisearchApiKey?: string;\n meilisearchTimeoutMs?: number;\n meilisearchAutoIndex?: boolean;\n\n // Orama backend\n oramaEnabled: boolean;\n oramaDbPath?: string;\n oramaEmbeddingDimension?: number;\n\n // QMD daemon mode\n qmdDaemonEnabled: boolean;\n qmdDaemonUrl: string;\n qmdDaemonRecheckIntervalMs: number;\n qmdIntentHintsEnabled: boolean;\n qmdExplainEnabled: boolean;\n\n // v7.0 Knowledge Graph Enhancement\n knowledgeIndexEnabled: boolean;\n knowledgeIndexMaxEntities: number;\n knowledgeIndexMaxChars: number;\n entityRetrievalEnabled: boolean;\n entityRetrievalMaxChars: number;\n entityRetrievalMaxHints: number;\n entityRetrievalMaxSupportingFacts: number;\n entityRetrievalMaxRelatedEntities: number;\n entityRetrievalRecentTurns: number;\n entitySchemas?: Record<string, EntitySchemaDefinition>;\n // Recall assembly controls\n recallBudgetChars: number;\n recallOuterTimeoutMs: number;\n recallCoreDeadlineMs: number;\n recallEnrichmentDeadlineMs: number;\n recallPipeline: RecallSectionConfig[];\n /** Apply Maximal Marginal Relevance to the final recall selection per-section. */\n recallMmrEnabled: boolean;\n /** MMR λ parameter. 1.0 = pure relevance, 0.0 = pure diversity. Default 0.7. */\n recallMmrLambda: number;\n /** MMR is applied over the top N candidates per section. Default 40. */\n recallMmrTopN: number;\n /**\n * Boost stored `reasoning_trace` memories in recall results when the\n * incoming query reads like a problem-solving ask (e.g. \"how do I…\",\n * \"step by step\", \"walk me through…\"). Default false — opt in after\n * benchmarking (issue #564 PR 3).\n */\n recallReasoningTraceBoostEnabled: boolean;\n qmdRecallCacheTtlMs: number;\n qmdRecallCacheStaleTtlMs: number;\n qmdRecallCacheMaxEntries: number;\n entityRelationshipsEnabled: boolean;\n entityActivityLogEnabled: boolean;\n entityActivityLogMaxEntries: number;\n entityAliasesEnabled: boolean;\n entitySummaryEnabled: boolean;\n entitySynthesisMaxTokens: number;\n\n // v6.0 Fact deduplication & archival\n /** Enable content-hash deduplication to prevent storing semantically identical facts. */\n factDeduplicationEnabled: boolean;\n /**\n * Issue #373 — Write-time semantic similarity guard. When enabled (default),\n * the orchestrator embeds each candidate fact and queries the existing\n * embedding index for its top-K nearest neighbors. If the best cosine\n * similarity is at or above `semanticDedupThreshold`, the fact is dropped\n * as a near-duplicate. Fails open (keeps the fact) if the embedding backend\n * is unavailable.\n */\n semanticDedupEnabled: boolean;\n /** Cosine similarity threshold in [0, 1] above which a candidate fact is skipped. */\n semanticDedupThreshold: number;\n /** Number of nearest-neighbor candidates to consider during semantic dedup. */\n semanticDedupCandidates: number;\n /** Enable automatic archival of old, low-importance, rarely-accessed facts. */\n factArchivalEnabled: boolean;\n /** Minimum age in days before a fact is eligible for archival. */\n factArchivalAgeDays: number;\n /** Maximum importance score for archival eligibility (0-1). Only facts below this are archived. */\n factArchivalMaxImportance: number;\n /** Maximum access count for archival eligibility. Only rarely-accessed facts are archived. */\n factArchivalMaxAccessCount: number;\n /** Tags that protect a fact from archival regardless of other criteria. */\n factArchivalProtectedCategories: string[];\n // v8.3 Lifecycle policy engine\n lifecyclePolicyEnabled: boolean;\n lifecycleFilterStaleEnabled: boolean;\n lifecyclePromoteHeatThreshold: number;\n lifecycleStaleDecayThreshold: number;\n lifecycleArchiveDecayThreshold: number;\n lifecycleProtectedCategories: MemoryCategory[];\n lifecycleMetricsEnabled: boolean;\n // v8.3 proactive + policy learning\n proactiveExtractionEnabled: boolean;\n contextCompressionActionsEnabled: boolean;\n compressionGuidelineLearningEnabled: boolean;\n compressionGuidelineSemanticRefinementEnabled: boolean;\n compressionGuidelineSemanticTimeoutMs: number;\n maxProactiveQuestionsPerExtraction: number;\n proactiveExtractionTimeoutMs: number;\n proactiveExtractionMaxTokens: number;\n extractionMaxOutputTokens: number;\n proactiveExtractionCategoryAllowlist?: MemoryCategory[];\n maxCompressionTokensPerHour: number;\n behaviorLoopAutoTuneEnabled: boolean;\n behaviorLoopLearningWindowDays: number;\n behaviorLoopMinSignalCount: number;\n behaviorLoopMaxDeltaPerCycle: number;\n behaviorLoopProtectedParams: string[];\n // v8.0 Phase 1: recall planner + intent routing + verbatim artifacts\n recallPlannerEnabled: boolean;\n recallPlannerModel: string;\n recallPlannerTimeoutMs: number;\n recallPlannerUseResponsesApi: boolean;\n recallPlannerMaxPromptChars: number;\n recallPlannerMaxMemoryHints: number;\n recallPlannerShadowMode: boolean;\n recallPlannerTelemetryEnabled: boolean;\n recallPlannerMaxQmdResultsMinimal: number;\n recallPlannerMaxQmdResultsFull: number;\n intentRoutingEnabled: boolean;\n intentRoutingBoost: number;\n verbatimArtifactsEnabled: boolean;\n verbatimArtifactsMinConfidence: number;\n verbatimArtifactsMaxRecall: number;\n verbatimArtifactCategories: MemoryCategory[];\n // v8.0 Phase 2A: Memory Boxes + Trace Weaving\n memoryBoxesEnabled: boolean;\n /** Jaccard overlap threshold below which a topic shift triggers box sealing (0-1, default 0.35) */\n boxTopicShiftThreshold: number;\n /** Time gap in ms before an open box is sealed (default 30 min) */\n boxTimeGapMs: number;\n /** Max memories per box before forced seal */\n boxMaxMemories: number;\n traceWeaverEnabled: boolean;\n /** Days back to search for trace links */\n traceWeaverLookbackDays: number;\n /** Minimum Jaccard overlap to assign the same traceId (0-1, default 0.4) */\n traceWeaverOverlapThreshold: number;\n /** Number of recent days of boxes to inject during recall */\n boxRecallDays: number;\n // v8.0 Phase 2B: Episode/Note dual store (HiMem)\n /** Classify extracted memories as episode or note and tag with memoryKind */\n episodeNoteModeEnabled: boolean;\n // v8.1 Temporal + Tag Indexes (SwiftMem-inspired)\n /** Build and maintain temporal (state/index_time.json) and tag (state/index_tags.json) indexes */\n queryAwareIndexingEnabled: boolean;\n /** Max candidate paths returned from index prefilter (0 = no cap) */\n queryAwareIndexingMaxCandidates: number;\n temporalIndexWindowDays: number;\n temporalIndexMaxEntries: number;\n temporalBoostRecentDays: number;\n temporalBoostScore: number;\n temporalDecayEnabled: boolean;\n tagMemoryEnabled: boolean;\n tagMaxPerMemory: number;\n tagIndexMaxEntries: number;\n tagRecallBoost: number;\n tagRecallMaxMatches: number;\n // v8.2 multi-graph memory (PR 18)\n multiGraphMemoryEnabled: boolean;\n // v8.2 PR 19A: graph recall planner gating\n graphRecallEnabled: boolean;\n graphRecallMaxExpansions: number;\n graphRecallMaxPerSeed: number;\n graphRecallMinEdgeWeight: number;\n graphRecallShadowEnabled: boolean;\n graphRecallSnapshotEnabled: boolean;\n graphRecallShadowSampleRate: number;\n graphRecallExplainToolEnabled: boolean;\n graphRecallStoreColdMirror: boolean;\n graphRecallColdMirrorCollection?: string;\n graphRecallColdMirrorMinAgeDays: number;\n graphRecallUseEntityPriors: boolean;\n graphRecallEntityPriorBoost: number;\n graphRecallPreferHubSeeds: boolean;\n graphRecallHubBias: number;\n graphRecallRecencyHalfLifeDays: number;\n graphRecallDampingFactor: number;\n graphRecallMaxSeedNodes: number;\n graphRecallMaxExpandedNodes: number;\n graphRecallMaxTrailPerNode: number;\n graphRecallMinSeedScore: number;\n graphRecallExpansionScoreThreshold: number;\n graphRecallExplainMaxPaths: number;\n graphRecallExplainMaxChars: number;\n graphRecallExplainEdgeLimit: number;\n graphRecallExplainEnabled: boolean;\n graphRecallEntityHintsEnabled: boolean;\n graphRecallEntityHintMax: number;\n graphRecallEntityHintMaxChars: number;\n graphRecallSnapshotDir: string;\n graphRecallEnableTrace: boolean;\n graphRecallEnableDebug: boolean;\n /** Allow graph_mode escalation for broader causal/timeline phrasing beyond strict keywords. */\n graphExpandedIntentEnabled?: boolean;\n /** Run bounded graph expansion in full mode when enough recall seeds exist. */\n graphAssistInFullModeEnabled?: boolean;\n /** In full mode, compute graph assist for telemetry/snapshotting but do not inject merged results. */\n graphAssistShadowEvalEnabled?: boolean;\n /** Minimum seed results required before full-mode graph assist runs. */\n graphAssistMinSeedResults?: number;\n entityGraphEnabled: boolean;\n timeGraphEnabled: boolean;\n /** When true, write fallback temporal adjacency edges for consecutive extracted memories. */\n graphWriteSessionAdjacencyEnabled?: boolean;\n causalGraphEnabled: boolean;\n maxGraphTraversalSteps: number;\n graphActivationDecay: number;\n /** Weight of graph activation score when blending with seed QMD score (0-1). */\n graphExpansionActivationWeight: number;\n /** Lower bound for blended graph-expanded recall scores (0-1). */\n graphExpansionBlendMin: number;\n /** Upper bound for blended graph-expanded recall scores (0-1). */\n graphExpansionBlendMax: number;\n maxEntityGraphEdgesPerMemory: number;\n /** SimpleMem-inspired de-linearization: resolve pronouns and anchor relative dates after extraction. */\n delinearizeEnabled: boolean;\n /** Synapse-inspired confidence gate — skip memory injection when top score is below threshold. */\n recallConfidenceGateEnabled: boolean;\n recallConfidenceGateThreshold: number;\n /** PlugMem-inspired causal rule extraction: mine IF→THEN rules during consolidation. */\n causalRuleExtractionEnabled: boolean;\n /** E-Mem-inspired memory reconstruction: targeted retrieval for missing entity context. */\n memoryReconstructionEnabled: boolean;\n /** Maximum number of entity expansions per recall. */\n memoryReconstructionMaxExpansions: number;\n /** Synapse-inspired lateral inhibition to suppress hub-node dominance. */\n graphLateralInhibitionEnabled: boolean;\n /** Inhibition strength (default 0.15). Higher = more suppression. */\n graphLateralInhibitionBeta: number;\n /** Number of top competing nodes considered for inhibition (default 7). */\n graphLateralInhibitionTopM: number;\n // v8.2: Temporal Memory Tree\n temporalMemoryTreeEnabled: boolean;\n tmtHourlyMinMemories: number;\n tmtSummaryMaxTokens: number;\n // Lossless Context Management (LCM)\n lcmEnabled: boolean;\n lcmLeafBatchSize: number;\n lcmRollupFanIn: number;\n lcmFreshTailTurns: number;\n lcmMaxDepth: number;\n lcmRecallBudgetShare: number;\n lcmDeterministicMaxTokens: number;\n lcmArchiveRetentionDays: number;\n\n // v9.1 Parallel Specialized Retrieval (ASMR-inspired)\n /** Enable three-agent parallel retrieval (DirectFact + Contextual + Temporal). Default false. */\n parallelRetrievalEnabled: boolean;\n /** Per-agent source weights for score blending during merge. */\n parallelAgentWeights: { direct: number; contextual: number; temporal: number };\n /** Max results fetched per agent before merge. */\n parallelMaxResultsPerAgent: number;\n\n // Daily Context Briefing (Issue #370)\n /** Briefing configuration knobs — see BriefingConfig for field docs. */\n briefing: BriefingConfig;\n\n // Codex CLI connector settings (install-time)\n codex: CodexConnectorConfig;\n\n // MECE Taxonomy (#366)\n /** Enable the MECE taxonomy knowledge directory. Default false. */\n taxonomyEnabled: boolean;\n /** Auto-regenerate RESOLVER.md when taxonomy changes. Default true. */\n taxonomyAutoGenResolver: boolean;\n\n // Codex CLI — native memory materialization (#378)\n /** Materialize Remnic memories into Codex's expected ~/.codex/memories/ layout. Default true. */\n codexMaterializeMemories: boolean;\n /** Namespace to materialize; \"auto\" derives from the connector context. Default \"auto\". */\n codexMaterializeNamespace: string;\n /** Max whitespace-tokenized size of memory_summary.md. Default 4500. */\n codexMaterializeMaxSummaryTokens: number;\n /** Max age in days for rollout_summaries/*.md before pruning. Default 30. */\n codexMaterializeRolloutRetentionDays: number;\n /** Run materialization after semantic/causal consolidation completes. Default true. */\n codexMaterializeOnConsolidation: boolean;\n /** Run materialization at Codex session-end hook. Default true. */\n codexMaterializeOnSessionEnd: boolean;\n /** Enable Codex marketplace integration. Default true. */\n codexMarketplaceEnabled: boolean;\n\n // Page-level versioning (issue #371)\n /** Enable page-level versioning with sidecar snapshots. Default false. */\n versioningEnabled: boolean;\n /** Maximum number of version snapshots to keep per page. Default 50. Set to 0 to disable pruning. */\n versioningMaxPerPage: number;\n /** Name of the sidecar directory inside memoryDir. Default \".versions\". */\n versioningSidecarDir: string;\n\n // Binary file lifecycle management (#367)\n /** Enable binary file lifecycle management (mirror, redirect, clean). Default: false. */\n binaryLifecycleEnabled: boolean;\n /** Grace period in days before a mirrored binary is eligible for local cleanup. Default: 7. */\n binaryLifecycleGracePeriodDays: number;\n /** Storage backend type: \"filesystem\" copies to a local dir, \"none\" is no-op. Default: \"none\". */\n binaryLifecycleBackendType: \"filesystem\" | \"s3\" | \"none\";\n /** Base path for the filesystem backend. Required when backendType is \"filesystem\". */\n binaryLifecycleBackendPath: string;\n\n // Codex citation parity (issue #379)\n /** Enable oai-mem-citation blocks in recall responses. Default false. */\n citationsEnabled: boolean;\n /** Auto-enable citations when the Codex adapter is detected. Default true. */\n citationsAutoDetect: boolean;\n\n // External enrichment pipeline (issue #365)\n /** Enable the external enrichment pipeline. Default false. */\n enrichmentEnabled: boolean;\n /** Automatically enrich new entities on creation. Default false. */\n enrichmentAutoOnCreate: boolean;\n /** Max candidates accepted per entity per enrichment run. Default 20. */\n enrichmentMaxCandidatesPerEntity: number;\n\n // Memory extensions discovery (#382)\n /** Whether third-party memory extensions are discovered and injected into consolidation. Default true. */\n memoryExtensionsEnabled: boolean;\n /**\n * Root directory for memory extensions. Empty string means derive from\n * memoryDir: go up to the Remnic home dir and append memory_extensions.\n */\n memoryExtensionsRoot: string;\n}\n\n/** Runtime configuration for the daily context briefing feature. */\nexport interface BriefingConfig {\n /** Whether `remnic briefing` CLI and MCP tool are enabled. */\n enabled: boolean;\n /** Default lookback window token (e.g. \"yesterday\", \"3d\", \"1w\", \"24h\"). */\n defaultWindow: string;\n /** Default output format for the CLI. */\n defaultFormat: \"markdown\" | \"json\";\n /** Maximum number of LLM-generated suggested follow-ups. */\n maxFollowups: number;\n /** Optional path to an ICS or JSON calendar file. null disables the section. */\n calendarSource: string | null;\n /** If true, CLI writes a dated briefing file by default. */\n saveByDefault: boolean;\n /** Override directory for saved briefings. null → $REMNIC_HOME/briefings/. */\n saveDir: string | null;\n /** Whether to call the Responses API for follow-up suggestions. */\n llmFollowups: boolean;\n}\n\n/** Parsed representation of a briefing lookback window. */\nexport type BriefingWindow = \"yesterday\" | \"today\" | string;\n\n/** Filter the briefing to a single entity / project / topic. */\nexport interface BriefingFocus {\n type: \"person\" | \"project\" | \"topic\";\n value: string;\n}\n\n/** Calendar event surfaced by a CalendarSource implementation. */\nexport interface CalendarEvent {\n /** Stable identifier for dedupe / linking. */\n id: string;\n /** Event title (short). */\n title: string;\n /** ISO 8601 start timestamp. */\n start: string;\n /** Optional ISO 8601 end timestamp. */\n end?: string;\n /** Optional freeform location. */\n location?: string;\n /** Optional short notes. */\n notes?: string;\n}\n\n/** Abstraction over any calendar backend. Concrete implementations: `FileCalendarSource`. */\nexport interface CalendarSource {\n /** Return events that fall on the given UTC date (YYYY-MM-DD). */\n eventsForDate(dateIso: string): Promise<CalendarEvent[]>;\n}\n\n/** A single \"active thread\" surfaced in a briefing. */\nexport interface BriefingActiveThread {\n id: string;\n title: string;\n updatedAt: string;\n reason: string;\n}\n\n/** A single \"recent entity\" entry. */\nexport interface BriefingRecentEntity {\n name: string;\n type: string;\n updatedAt: string;\n score: number;\n summary?: string;\n}\n\n/** A single unresolved commitment or open question. */\nexport interface BriefingOpenCommitment {\n id: string;\n kind: \"question\" | \"commitment\" | \"pending_memory\";\n text: string;\n source?: string;\n createdAt?: string;\n}\n\n/** An LLM-generated short follow-up suggestion. */\nexport interface BriefingFollowup {\n text: string;\n rationale?: string;\n}\n\n/** Structured sections of a briefing result. */\nexport interface BriefingSections {\n activeThreads: BriefingActiveThread[];\n recentEntities: BriefingRecentEntity[];\n openCommitments: BriefingOpenCommitment[];\n suggestedFollowups: BriefingFollowup[];\n /** Only populated when a calendar source is configured and returns events. */\n todayCalendar?: CalendarEvent[];\n}\n\n/** A calendar source failure recorded when a CalendarSource throws during briefing generation. */\nexport interface BriefingCalendarSourceError {\n /** Human-readable description of the source (e.g. file path or source name). */\n source: string;\n /** Stringified error message from the failed source. */\n error: string;\n}\n\n/** Result returned by `buildBriefing`. */\nexport interface BriefingResult {\n markdown: string;\n json: Record<string, unknown>;\n sections: BriefingSections;\n /** Reason why suggested follow-ups were omitted (e.g. missing API key, LLM error). */\n followupsUnavailableReason?: string;\n /** Effective lookback window (ISO date range) used for this briefing. */\n window: { from: string; to: string };\n /**\n * Calendar sources that failed during this briefing run.\n * Only present (non-empty) when at least one source threw.\n * Allows callers to distinguish \"no events today\" from \"source unavailable\".\n */\n calendarSourceErrors?: BriefingCalendarSourceError[];\n}\n\n/**\n * Settings for the Codex CLI connector. These are consumed by\n * `remnic connectors install codex-cli` to decide where the phase-2 memory\n * extension is dropped and whether to install it at all.\n */\nexport interface CodexConnectorConfig {\n /**\n * Whether to install the Remnic memory extension into\n * `<codex_home>/memories_extensions/remnic/` when the `codex-cli`\n * connector is installed. Default `true`. Set to `false` for users who\n * self-manage the Codex memory extensions folder.\n */\n installExtension: boolean;\n /**\n * Optional override for the Codex home directory. When `null`, the\n * connector reads `$CODEX_HOME` and falls back to `~/.codex`. Setting\n * this is useful for integration tests and non-default installs.\n */\n codexHome: string | null;\n}\n\nexport interface BootstrapOptions {\n dryRun?: boolean;\n sessionsDir?: string;\n limit?: number;\n since?: Date;\n}\n\nexport interface BootstrapResult {\n sessionsScanned: number;\n turnsProcessed: number;\n highSignalTurns: number;\n memoriesCreated: number;\n skipped: number;\n}\n\nexport interface PrincipalRule {\n match: string;\n principal: string;\n}\n\nexport interface NamespacePolicy {\n name: string;\n readPrincipals: string[];\n writePrincipals: string[];\n includeInRecallByDefault?: boolean;\n}\n\nexport interface RelevanceFeedback {\n up: number;\n down: number;\n lastUpdatedAt: string;\n notes?: string[];\n}\n\nexport interface BufferTurn {\n role: \"user\" | \"assistant\";\n content: string;\n timestamp: string;\n sessionKey?: string;\n logicalSessionKey?: string;\n providerThreadId?: string | null;\n turnFingerprint?: string;\n persistProcessedFingerprint?: boolean;\n}\n\nexport interface BufferEntryState {\n turns: BufferTurn[];\n lastExtractionAt: string | null;\n extractionCount: number;\n /**\n * Turns retained across `clearAfterExtraction` so a later extraction pass\n * sees the context that caused a defer verdict (issue #562, PR 2). Bounded\n * to the configured retention cap by `retainDeferredTurns`. Empty / absent\n * means no retention in effect.\n */\n retainedTurns?: BufferTurn[];\n}\n\nexport interface BufferState {\n turns: BufferTurn[];\n lastExtractionAt: string | null;\n extractionCount: number;\n entries?: Record<string, BufferEntryState>;\n}\n\nexport interface BehaviorLoopAdjustment {\n parameter: string;\n previousValue: number;\n nextValue: number;\n delta: number;\n evidenceCount: number;\n confidence: number;\n reason: string;\n appliedAt: string;\n}\n\nexport interface BehaviorLoopPolicyState {\n version: number;\n windowDays: number;\n minSignalCount: number;\n maxDeltaPerCycle: number;\n protectedParams: string[];\n adjustments: BehaviorLoopAdjustment[];\n updatedAt: string;\n}\n\nexport type BehaviorSignalType = \"correction_override\" | \"preference_affinity\" | \"topic_revisitation\" | \"action_pattern\" | \"outcome_preference\" | \"phrasing_style\";\nexport type BehaviorSignalDirection = \"positive\" | \"negative\";\n\nexport interface BehaviorSignalEvent {\n timestamp: string;\n namespace: string;\n memoryId: string;\n category: Extract<MemoryCategory, \"correction\" | \"preference\">;\n signalType: BehaviorSignalType;\n direction: BehaviorSignalDirection;\n confidence: number;\n signalHash: string;\n source: \"extraction\" | \"correction\";\n}\n\n/**\n * One row of the buffer-surprise telemetry ledger (issue #563 PR 3).\n *\n * Emitted by `SmartBuffer` each time the surprise probe produces a score\n * for an incoming turn (i.e. the feature flag is on and the existing\n * trigger-logic path called through to the probe). Not written when the\n * probe is skipped — the absence of a row is meaningful and matches the\n * \"probe was not consulted\" state.\n *\n * The ledger is intentionally lean: we record the score, the threshold in\n * force, whether the turn caused a flush, and the turn count so operators\n * can re-derive precision/recall without replaying traffic. Turn content\n * is never persisted — this ledger is safe to commit to shared storage.\n */\nexport interface BufferSurpriseEvent {\n /** Literal tag to simplify multiplexed log consumers. */\n event: \"BUFFER_SURPRISE\";\n /** ISO timestamp when the decision was made. Server-side, not turn ts. */\n timestamp: string;\n /** Buffer identifier (session / thread). Opaque string. */\n bufferKey: string;\n /** Session key if available; null when the turn has no session binding. */\n sessionKey: string | null;\n /** Role of the scored turn. */\n turnRole: \"user\" | \"assistant\";\n /** Surprise score in `[0, 1]`, already clamped. */\n surpriseScore: number;\n /** Threshold in force when the decision was made. */\n threshold: number;\n /** Whether this turn upgraded `keep_buffering` → `extract_now`. */\n triggeredFlush: boolean;\n /** Number of turns in the buffer (including the current turn). */\n turnCountInWindow: number;\n}\n\n/** Memory status for lifecycle management */\nexport type MemoryStatus = \"active\" | \"pending_review\" | \"rejected\" | \"quarantined\" | \"superseded\" | \"archived\";\nexport type LifecycleState = \"candidate\" | \"validated\" | \"active\" | \"stale\" | \"archived\";\nexport type VerificationState = \"unverified\" | \"user_confirmed\" | \"system_inferred\" | \"disputed\";\nexport type PolicyClass = \"ephemeral\" | \"durable\" | \"protected\";\n\n/** Importance level tiers */\nexport type ImportanceLevel = \"critical\" | \"high\" | \"normal\" | \"low\" | \"trivial\";\n\n/** Importance scoring result */\nexport interface ImportanceScore {\n /** Numeric score 0-1 */\n score: number;\n /** Tier level */\n level: ImportanceLevel;\n /** Reasons for this score */\n reasons: string[];\n /** Salient keywords extracted */\n keywords: string[];\n}\n\nexport interface MemoryFrontmatter {\n id: string;\n category: MemoryCategory;\n created: string;\n updated: string;\n source: string;\n confidence: number;\n confidenceTier: ConfidenceTier;\n tags: string[];\n entityRef?: string;\n supersedes?: string;\n /** ISO 8601 date — memory expires and gets cleaned up after this date */\n expiresAt?: string;\n /** IDs of parent memories this was derived from (lineage tracking) */\n lineage?: string[];\n /** Memory status: active (default), pending_review, rejected, quarantined, superseded, or archived */\n status?: MemoryStatus;\n /** ID of memory that superseded this one */\n supersededBy?: string;\n /** Timestamp when superseded */\n supersededAt?: string;\n /** Timestamp when archived */\n archivedAt?: string;\n /** Policy-driven lifecycle state used for retrieval eligibility/ranking. */\n lifecycleState?: LifecycleState;\n /** Verification provenance used by lifecycle policy. */\n verificationState?: VerificationState;\n /** Policy class used by lifecycle guardrails. */\n policyClass?: PolicyClass;\n /** Last lifecycle validation timestamp (ISO 8601). */\n lastValidatedAt?: string;\n /** Lifecycle decay score in [0,1]. */\n decayScore?: number;\n /** Lifecycle heat score in [0,1]. */\n heatScore?: number;\n // Access tracking (Phase 1A)\n /** Number of times this memory has been retrieved */\n accessCount?: number;\n /** Last time this memory was accessed (ISO 8601) */\n lastAccessed?: string;\n // Memory Worth counters (issue #560)\n //\n // Per-fact outcome counters used to derive a dynamic utility score —\n // `p(success | retrieved)` — as a complement to the static `importance`\n // field. Absent on legacy memories written before #560; readers must treat\n // `undefined` as zero observations (uniform Beta(1,1) prior).\n //\n // Both values must be non-negative integers on write. PR 1 wires only the\n // schema + storage round-trip — no increments, scoring, or filtering yet.\n /** Number of sessions where this memory was retrieved and the outcome was judged a success. */\n mw_success?: number;\n /** Number of sessions where this memory was retrieved and the outcome was judged a failure. */\n mw_fail?: number;\n // Importance scoring (Phase 1B)\n /** Importance score with level, reasons, and keywords */\n importance?: ImportanceScore;\n // Chunking (Phase 2A)\n /** Parent memory ID if this is a chunk */\n parentId?: string;\n /** Chunk index within parent (0-based) */\n chunkIndex?: number;\n /** Total number of chunks for this parent */\n chunkTotal?: number;\n // Memory Linking (Phase 3A)\n /** Links to other memories */\n links?: MemoryLink[];\n // Intent-grounded memory routing (v8.0 phase 1)\n intentGoal?: string;\n intentActionType?: string;\n intentEntityTypes?: string[];\n // Verbatim artifact lineage (v8.0 phase 1)\n artifactType?: \"decision\" | \"constraint\" | \"todo\" | \"definition\" | \"commitment\" | \"correction\" | \"fact\";\n sourceMemoryId?: string;\n sourceTurnId?: string;\n // v8.0 Phase 2B: HiMem episode/note classification\n /** episode = time-specific event; note = stable belief/preference/decision */\n memoryKind?: \"episode\" | \"note\" | \"box\" | \"dream\" | \"procedural\";\n /** Structured key-value attributes extracted from the content (e.g., product attributes, dates, quantities). */\n structuredAttributes?: Record<string, string>;\n /**\n * SHA-256 (via ContentHashIndex.computeHash) of the raw content that was\n * used as the dedup key at write time. Persists through archive and\n * consolidation so the hash can be removed from the index even if the stored\n * content has been transformed (e.g. an inline citation was appended).\n *\n * When present, archive/consolidation paths use this directly instead of\n * calling stripCitation(memory.content), which only handles the default\n * [Source: ...] format and silently fails for custom citation templates.\n */\n contentHash?: string;\n /**\n * Consolidation provenance — pointers to the page-versioning snapshots\n * that this memory was derived from (issue #561). Each entry is a\n * `\"<memory-path>:<version-number>\"` string (e.g.\n * `\"facts/preferences.md:3\"`) referencing a snapshot recorded by\n * `page-versioning.ts`.\n *\n * PR 1 introduces this field as read-through only — storage preserves\n * it verbatim but no code produces it yet. PR 2 populates it on\n * consolidation writes; PR 4 adds a `remnic doctor` integrity check\n * that validates each referent actually exists.\n */\n derived_from?: string[];\n /**\n * Which consolidation operator produced this memory (issue #561). See\n * `ConsolidationOperator` in `semantic-consolidation.ts` for the\n * operator algebra. Absent on memories that were not produced by a\n * consolidation pass.\n */\n derived_via?: \"split\" | \"merge\" | \"update\";\n}\n\n/** Memory link relationship types */\nexport type MemoryLinkType = \"follows\" | \"references\" | \"contradicts\" | \"supports\" | \"related\";\n\n/** A link between memories */\nexport interface MemoryLink {\n targetId: string;\n linkType: MemoryLinkType;\n strength: number;\n reason?: string;\n}\n\n// Conversation Threading (Phase 3B)\nexport interface ConversationThread {\n id: string;\n title: string;\n createdAt: string;\n updatedAt: string;\n sessionKey?: string;\n episodeIds: string[];\n linkedThreadIds: string[];\n}\n\n// Memory Summarization (Phase 4A)\nexport interface MemorySummary {\n id: string;\n createdAt: string;\n timeRangeStart: string;\n timeRangeEnd: string;\n summaryText: string;\n keyFacts: string[];\n keyEntities: string[];\n sourceEpisodeIds: string[];\n}\n\nexport interface DaySummaryResult {\n summary: string;\n bullets: string[];\n next_actions: string[];\n risks_or_open_loops: string[];\n}\n\n// Topic Extraction (Phase 4B)\nexport interface TopicScore {\n term: string;\n score: number;\n count: number;\n}\n\nexport interface MemoryFile {\n path: string;\n frontmatter: MemoryFrontmatter;\n content: string;\n}\n\n/** Ordered step for extracted procedure memories (issue #519). */\nexport interface ExtractedProcedureStep {\n order: number;\n intent: string;\n toolCall?: { kind: string; signature: string };\n expectedOutcome?: string;\n optional?: boolean;\n}\n\nexport interface ExtractedFact {\n category: MemoryCategory;\n content: string;\n confidence: number;\n tags: string[];\n entityRef?: string;\n source?: ExtractionPassSource;\n promptedByQuestion?: string;\n /** Structured key-value attributes extracted from the content (e.g., product attributes, dates, quantities). */\n structuredAttributes?: Record<string, string>;\n /** When category is `procedure`, ordered steps with intents (persisted under procedures/). */\n procedureSteps?: ExtractedProcedureStep[];\n /**\n * When category is `reasoning_trace`, the stored solution chain the user\n * walked through. Persisted under reasoning-traces/.\n */\n reasoningTrace?: ExtractedReasoningTrace;\n}\n\nexport interface ExtractedReasoningTraceStep {\n order: number;\n description: string;\n}\n\nexport interface ExtractedReasoningTrace {\n steps: ExtractedReasoningTraceStep[];\n finalAnswer: string;\n observedOutcome?: string;\n}\n\nexport interface MemoryIntent {\n goal: string;\n actionType: string;\n entityTypes: string[];\n /** True when the prompt reads like starting a concrete task (ship/deploy/tests/PR, etc.). */\n taskInitiation?: boolean;\n}\n\nexport interface ExtractedQuestion {\n question: string;\n context: string;\n priority: number;\n}\n\nexport interface QuestionEntry {\n id: string;\n question: string;\n context: string;\n priority: number; // 0-1, higher = more important\n created: string;\n resolved: boolean;\n resolvedAt?: string;\n}\n\nexport interface ExtractionResult {\n facts: ExtractedFact[];\n profileUpdates: string[];\n entities: EntityMention[];\n questions: ExtractedQuestion[];\n identityReflection?: string;\n relationships?: ExtractedRelationship[];\n}\n\nexport interface EntityMention {\n name: string;\n type: \"person\" | \"project\" | \"tool\" | \"company\" | \"place\" | \"other\";\n facts: string[];\n structuredSections?: EntityStructuredSection[];\n source?: ExtractionPassSource;\n promptedByQuestion?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Knowledge Graph Enhancement (Entity Relationships, Activity, Scoring)\n// ---------------------------------------------------------------------------\n\nexport interface EntityRelationship {\n target: string;\n label: string;\n}\n\nexport interface EntityActivityEntry {\n date: string;\n note: string;\n}\n\nexport interface EntityTimelineEntry {\n timestamp: string;\n text: string;\n source?: string;\n sessionKey?: string;\n principal?: string;\n}\n\nexport interface EntityStructuredSection {\n key: string;\n title: string;\n facts: string[];\n}\n\nexport interface EntitySchemaSectionDefinition {\n key: string;\n title: string;\n description: string;\n aliases?: string[];\n}\n\nexport interface EntitySchemaDefinition {\n sections: EntitySchemaSectionDefinition[];\n}\n\nexport interface EntityFile {\n name: string;\n type: string;\n created?: string;\n updated: string;\n extraFrontmatterLines?: string[];\n preSectionLines?: string[];\n facts: string[];\n summary?: string;\n synthesis?: string;\n synthesisUpdatedAt?: string;\n synthesisTimelineCount?: number;\n synthesisStructuredFactCount?: number;\n synthesisStructuredFactDigest?: string;\n synthesisVersion?: number;\n timeline: EntityTimelineEntry[];\n structuredSections?: EntityStructuredSection[];\n relationships: EntityRelationship[];\n activity: EntityActivityEntry[];\n aliases: string[];\n extraSections?: Array<{\n title: string;\n lines: string[];\n }>;\n}\n\nexport interface ScoredEntity {\n name: string;\n type: string;\n score: number;\n factCount: number;\n summary?: string;\n topRelationships: string[];\n}\n\nexport interface ExtractedRelationship {\n source: string;\n target: string;\n label: string;\n extractionSource?: ExtractionPassSource;\n promptedByQuestion?: string;\n}\n\nexport interface ConsolidationItem {\n existingId: string;\n action: ConsolidationAction;\n mergeWith?: string;\n updatedContent?: string;\n reason: string;\n}\n\nexport interface ConsolidationResult {\n items: ConsolidationItem[];\n profileUpdates: string[];\n entityUpdates: EntityMention[];\n}\n\nexport interface ConsolidationObservation {\n runAt: string;\n recentMemories: MemoryFile[];\n existingMemories: MemoryFile[];\n profile: string;\n result: ConsolidationResult;\n merged: number;\n invalidated: number;\n}\n\nexport interface QmdSearchResult {\n docid: string;\n path: string;\n snippet: string;\n score: number;\n explain?: QmdSearchExplain;\n transport?: \"daemon\" | \"subprocess\" | \"hybrid\" | \"scoped_prefilter\";\n}\n\nexport interface QmdSearchExplain {\n ftsScores?: number[];\n vectorScores?: number[];\n rrf?: number;\n rerankScore?: number;\n blendedScore?: number;\n}\n\nexport interface MetaState {\n extractionCount: number;\n lastExtractionAt: string | null;\n lastConsolidationAt: string | null;\n totalMemories: number;\n totalEntities: number;\n processedExtractionFingerprints?: Array<{\n fingerprint: string;\n observedAt: string;\n }>;\n}\n\nexport type MemoryActionType =\n | \"store_episode\"\n | \"store_note\"\n | \"update_note\"\n | \"create_artifact\"\n | \"summarize_node\"\n | \"discard\"\n | \"link_graph\";\n\nexport type MemoryActionOutcome = \"applied\" | \"skipped\" | \"failed\";\n\nexport type MemoryActionPolicyDecision = \"allow\" | \"defer\" | \"deny\";\n\nexport type MemoryActionStatus = \"validated\" | \"applied\" | \"rejected\";\n\nexport type MemoryActionEligibilitySource =\n | \"extraction\"\n | \"consolidation\"\n | \"replay\"\n | \"manual\"\n | \"unknown\";\n\nexport interface MemoryActionEligibilityContext {\n confidence: number;\n lifecycleState: LifecycleState;\n importance: number;\n source: MemoryActionEligibilitySource;\n}\n\nexport interface MemoryActionPolicyResult {\n action: MemoryActionType;\n decision: MemoryActionPolicyDecision;\n rationale: string;\n eligibility: MemoryActionEligibilityContext;\n}\n\nexport interface MemoryActionEvent {\n schemaVersion?: number;\n actionId?: string;\n timestamp: string;\n action: MemoryActionType;\n outcome: MemoryActionOutcome;\n status?: MemoryActionStatus;\n actor?: string;\n subsystem?: string;\n reason?: string;\n memoryId?: string;\n namespace?: string;\n sessionKey?: string;\n sourceSessionKey?: string;\n checkpointCapturedAt?: string;\n checkpointTtl?: string;\n checkpointTurnCount?: number;\n inputSummary?: string;\n outputMemoryIds?: string[];\n dryRun?: boolean;\n policyVersion?: string;\n promptHash?: string;\n policyDecision?: MemoryActionPolicyDecision;\n policyRationale?: string;\n policyEligibility?: MemoryActionEligibilityContext;\n}\n\nexport type MemoryLifecycleEventType =\n | \"created\"\n | \"updated\"\n | \"superseded\"\n | \"archived\"\n | \"rejected\"\n | \"restored\"\n | \"merged\"\n | \"imported\"\n | \"promoted\"\n | \"explicit_capture_accepted\"\n | \"explicit_capture_queued\";\n\nexport interface MemoryLifecycleStateSummary {\n category?: MemoryCategory;\n path?: string;\n status?: MemoryStatus;\n lifecycleState?: LifecycleState;\n}\n\nexport interface MemoryLifecycleEvent {\n eventId: string;\n memoryId: string;\n eventType: MemoryLifecycleEventType;\n timestamp: string;\n actor: string;\n reasonCode?: string;\n ruleVersion: string;\n relatedMemoryIds?: string[];\n before?: MemoryLifecycleStateSummary;\n after?: MemoryLifecycleStateSummary;\n correlationId?: string;\n}\n\nexport interface MemoryProjectionCurrentState {\n memoryId: string;\n category: MemoryCategory;\n status: MemoryStatus;\n lifecycleState?: LifecycleState;\n path: string;\n pathRel: string;\n created: string;\n updated: string;\n archivedAt?: string;\n supersededAt?: string;\n entityRef?: string;\n source: string;\n confidence: number;\n confidenceTier: ConfidenceTier;\n memoryKind?: MemoryFrontmatter[\"memoryKind\"];\n accessCount?: number;\n lastAccessed?: string;\n tags?: string[];\n preview?: string;\n}\n\nexport interface CompressionGuidelineOptimizerSourceWindow {\n from: string;\n to: string;\n}\n\nexport interface CompressionGuidelineOptimizerEventCounts {\n total: number;\n applied: number;\n skipped: number;\n failed: number;\n}\n\nexport type CompressionGuidelineActivationState = \"draft\" | \"active\";\n\nexport interface CompressionGuidelineOptimizerActionSummary {\n action: MemoryActionType;\n total: number;\n outcomes: Record<MemoryActionOutcome, number>;\n quality: {\n good: number;\n poor: number;\n unknown: number;\n };\n}\n\nexport interface CompressionGuidelineOptimizerRuleUpdate {\n action: MemoryActionType;\n delta: number;\n direction: \"increase\" | \"decrease\" | \"hold\";\n confidence: \"low\" | \"medium\" | \"high\";\n notes: string[];\n}\n\nexport interface CompressionGuidelineOptimizerState {\n version: number;\n updatedAt: string;\n sourceWindow: CompressionGuidelineOptimizerSourceWindow;\n eventCounts: CompressionGuidelineOptimizerEventCounts;\n guidelineVersion: number;\n contentHash?: string;\n activationState?: CompressionGuidelineActivationState;\n actionSummaries?: CompressionGuidelineOptimizerActionSummary[];\n ruleUpdates?: CompressionGuidelineOptimizerRuleUpdate[];\n}\n\nexport type ContinuityIncidentState = \"open\" | \"closed\";\n\nexport interface ContinuityIncidentRecord {\n id: string;\n state: ContinuityIncidentState;\n openedAt: string;\n updatedAt: string;\n triggerWindow?: string;\n symptom: string;\n suspectedCause?: string;\n fixApplied?: string;\n verificationResult?: string;\n preventiveRule?: string;\n closedAt?: string;\n filePath?: string;\n}\n\nexport interface ContinuityIncidentOpenInput {\n triggerWindow?: string;\n symptom: string;\n suspectedCause?: string;\n}\n\nexport interface ContinuityIncidentCloseInput {\n fixApplied: string;\n verificationResult: string;\n preventiveRule?: string;\n}\n\nexport type ContinuityLoopCadence = \"daily\" | \"weekly\" | \"monthly\" | \"quarterly\";\nexport type ContinuityLoopStatus = \"active\" | \"paused\" | \"retired\";\n\nexport interface ContinuityImprovementLoop {\n id: string;\n cadence: ContinuityLoopCadence;\n purpose: string;\n status: ContinuityLoopStatus;\n killCondition: string;\n lastReviewed: string;\n notes?: string;\n}\n\nexport interface ContinuityLoopUpsertInput {\n id: string;\n cadence: ContinuityLoopCadence;\n purpose: string;\n status: ContinuityLoopStatus;\n killCondition: string;\n lastReviewed?: string;\n notes?: string;\n}\n\nexport interface ContinuityLoopReviewInput {\n status?: ContinuityLoopStatus;\n notes?: string;\n reviewedAt?: string;\n}\n\n/** Entry in the access tracking buffer (batched updates) */\nexport interface AccessTrackingEntry {\n memoryId: string;\n newCount: number;\n lastAccessed: string;\n}\n\nexport interface SignalScanResult {\n level: SignalLevel;\n patterns: string[];\n}\n\n// ============================================================================\n// LLM Trace Callback (for external observability plugins)\n// ============================================================================\n\nexport interface LlmTraceEvent {\n kind: \"llm_start\" | \"llm_end\" | \"llm_error\";\n traceId: string;\n model: string;\n operation: \"extraction\" | \"consolidation\" | \"profile_consolidation\" | \"identity_consolidation\" | \"day_summary\";\n input?: string;\n output?: string;\n durationMs?: number;\n error?: string;\n tokenUsage?: { input?: number; output?: number; total?: number };\n}\n\nexport interface RecallTraceEvent {\n kind: \"recall_summary\";\n traceId: string;\n operation: \"recall\";\n sessionKey?: string;\n promptHash: string;\n promptLength: number;\n retrievalQueryHash: string;\n retrievalQueryLength: number;\n recallMode: RecallPlanMode;\n recallResultLimit: number;\n qmdEnabled: boolean;\n qmdAvailable: boolean;\n recallNamespaces: string[];\n source: \"none\" | \"hot_qmd\" | \"hot_embedding\" | \"cold_fallback\" | \"recent_scan\";\n recalledMemoryCount: number;\n injected: boolean;\n contextChars: number;\n policyVersion?: string;\n identityInjectionMode?: IdentityInjectionMode | \"none\";\n identityInjectedChars?: number;\n identityInjectionTruncated?: boolean;\n durationMs: number;\n timings?: Record<string, string>;\n /**\n * The full recalled memory context injected into the system prompt.\n * Only populated when `traceRecallContent` config option is `true`.\n * Omitted by default to avoid sending potentially sensitive memory content\n * to external trace collectors unless explicitly opted in.\n */\n recalledContent?: string;\n}\n\nexport type EngramTraceEvent = LlmTraceEvent | RecallTraceEvent;\nexport type LlmTraceCallback = (event: EngramTraceEvent) => void;\n\n// ============================================================================\n// Gateway Configuration Types (for fallback AI)\n// ============================================================================\n\nexport type ModelApi = \"openai-completions\" | \"anthropic-messages\" | \"google-generative\" | string;\n\nexport type ModelProviderAuthMode = \"bearer\" | \"header\" | \"query\";\n\nexport interface ModelDefinitionConfig {\n id: string;\n name?: string;\n contextWindow?: number;\n maxOutputTokens?: number;\n costPer1MInput?: number;\n costPer1MOutput?: number;\n aliases?: string[];\n}\n\nexport interface ModelProviderConfig {\n baseUrl: string;\n apiKey?: string | Record<string, unknown>;\n auth?: ModelProviderAuthMode;\n api?: ModelApi;\n headers?: Record<string, string>;\n authHeader?: boolean;\n models: ModelDefinitionConfig[];\n}\n\nexport interface AgentDefaultsConfig {\n model?: {\n primary?: string;\n backup?: string;\n fallbacks?: string[];\n };\n thinking?: {\n mode?: \"off\" | \"on\" | \"adaptive\";\n budget?: number;\n };\n}\n\nexport interface AgentPersonaModelConfig {\n primary?: string;\n fallbacks?: string[];\n}\n\nexport interface AgentPersona {\n id: string;\n name?: string;\n model?: AgentPersonaModelConfig;\n}\n\nexport interface GatewayConfig {\n agents?: {\n defaults?: AgentDefaultsConfig;\n list?: AgentPersona[];\n };\n models?: {\n providers?: Record<string, ModelProviderConfig>;\n };\n}\n\n// ============================================================================\n// Transcript & Context Preservation (v2.0)\n// ============================================================================\n\nexport interface TranscriptEntry {\n timestamp: string;\n role: \"user\" | \"assistant\";\n content: string;\n sessionKey: string;\n turnId: string;\n metadata?: {\n compactAfter?: boolean;\n compactionId?: string | null;\n };\n}\n\nexport interface Checkpoint {\n sessionKey: string;\n capturedAt: string;\n turns: TranscriptEntry[];\n ttl: string; // ISO timestamp when checkpoint expires\n}\n\nexport interface HourlySummary {\n hour: string; // \"2026-02-08T14:00:00Z\"\n sessionKey: string;\n bullets: string[];\n turnCount: number;\n generatedAt: string;\n}\n"],"mappings":";AA2RO,SAAS,eAAe,OAA+B;AAC5D,MAAI,SAAS,KAAM,QAAO;AAC1B,MAAI,SAAS,IAAM,QAAO;AAC1B,MAAI,SAAS,IAAM,QAAO;AAC1B,SAAO;AACT;AAGO,IAAM,uBAAuB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/schemas.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const MemoryActionTypeSchema = z.enum([\n \"store_episode\",\n \"store_note\",\n \"update_note\",\n \"create_artifact\",\n \"summarize_node\",\n \"discard\",\n \"link_graph\",\n]);\n\nexport const MemoryActionEligibilityContextSchema = z\n .object({\n confidence: z.number().min(0).max(1),\n lifecycleState: z.enum([\"active\", \"validated\", \"candidate\", \"stale\", \"archived\"]),\n importance: z.number().min(0).max(1),\n source: z.enum([\"extraction\", \"consolidation\", \"replay\", \"manual\", \"unknown\"]),\n })\n .strict();\n\nexport function parseMemoryActionType(value: unknown): z.infer<typeof MemoryActionTypeSchema> {\n const parsed = MemoryActionTypeSchema.safeParse(value);\n return parsed.success ? parsed.data : \"discard\";\n}\n\nexport function parseMemoryActionEligibilityContext(\n value: unknown,\n): z.infer<typeof MemoryActionEligibilityContextSchema> {\n const parsed = MemoryActionEligibilityContextSchema.safeParse(value);\n if (parsed.success) return parsed.data;\n return {\n confidence: 0,\n lifecycleState: \"candidate\",\n importance: 0,\n source: \"unknown\",\n };\n}\n\nexport const ProcedureStepExtractSchema = z.object({\n order: z.number(),\n intent: z.string(),\n toolCall: z\n .object({\n kind: z.string(),\n signature: z.string(),\n })\n .optional()\n .nullable(),\n expectedOutcome: z.string().optional().nullable(),\n optional: z.boolean().optional().nullable(),\n});\n\nexport const ExtractedFactSchema = z.object({\n category: z.enum([\n \"fact\",\n \"preference\",\n \"correction\",\n \"entity\",\n \"decision\",\n \"relationship\",\n \"principle\",\n \"commitment\",\n \"moment\",\n \"skill\",\n \"rule\",\n \"procedure\",\n \"reasoning_trace\",\n ]),\n content: z\n .string()\n .describe(\"The memory content — a clear, standalone statement\"),\n confidence: z\n .number()\n .min(0)\n .max(1)\n .describe(\"How confident are you this is correct (0-1)\"),\n tags: z.array(z.string()).describe(\"Relevant tags for categorization\"),\n entityRef: z\n .string()\n .optional()\n .nullable()\n .describe(\"If about an entity, its normalized name (e.g. person-jane-doe)\"),\n promptedByQuestion: z\n .string()\n .optional()\n .nullable()\n .describe(\"Optional proactive follow-up question that surfaced this fact.\"),\n structuredAttributes: z\n .record(z.string(), z.string())\n .optional()\n .nullable()\n .describe(\"Structured key-value attributes when the fact contains measurable or categorical data (e.g., {\\\"price\\\": \\\"29.99\\\", \\\"color\\\": \\\"blue\\\", \\\"date\\\": \\\"2024-03-15\\\"}).\"),\n procedureSteps: z\n .array(ProcedureStepExtractSchema)\n .optional()\n .nullable()\n .describe(\n 'For category \"procedure\" only: ordered steps (intent per step). At least two steps; include explicit trigger phrasing in content (e.g. \"When you deploy…\").',\n ),\n reasoningTrace: z\n .object({\n steps: z\n .array(\n z.object({\n order: z.number(),\n description: z.string(),\n }),\n )\n // Prompts and normalizer require >=2 ordered steps; enforce it at\n // the schema layer so gateway-path parsing rejects malformed traces\n // rather than persisting them (local/direct-client normalization\n // already enforces this, keeping the two paths symmetric).\n .min(2)\n .describe(\"Ordered reasoning steps the user walked through (require >=2).\"),\n // Accept snake_case aliases so a loose gateway model using\n // `final_answer` / `observed_outcome` does not fail schema parsing\n // and drop the entire extraction result. Local/direct-client\n // normalization already tolerates these keys; the gateway path must\n // too. Zod's `union` keeps the parse successful either way.\n finalAnswer: z\n .string()\n .optional()\n .nullable()\n .describe(\"The conclusion, decision, or answer the chain arrived at.\"),\n final_answer: z\n .string()\n .optional()\n .nullable()\n .describe(\"Alias for finalAnswer (snake_case). Gateway-tolerance shim.\"),\n observedOutcome: z\n .string()\n .optional()\n .nullable()\n .describe(\"Optional note about how the answer actually played out.\"),\n observed_outcome: z\n .string()\n .optional()\n .nullable()\n .describe(\"Alias for observedOutcome (snake_case). Gateway-tolerance shim.\"),\n })\n // Either finalAnswer OR final_answer must be present — enforce here so\n // the rest of the pipeline can assume a usable string downstream.\n .refine(\n (v) =>\n (typeof v.finalAnswer === \"string\" && v.finalAnswer.trim().length > 0) ||\n (typeof v.final_answer === \"string\" && v.final_answer.trim().length > 0),\n { message: \"reasoningTrace requires finalAnswer (or final_answer)\" },\n )\n .optional()\n .nullable()\n .describe(\n 'For category \"reasoning_trace\" only: a stored solution chain with ordered steps, a final answer, and an optional observed outcome. Require at least two steps.',\n ),\n});\n\nexport const EntityMentionSchema = z.object({\n name: z\n .string()\n .describe(\"Normalized entity name (e.g. jane-doe, acme-corp, my-project)\"),\n type: z.enum([\"person\", \"project\", \"tool\", \"company\", \"place\", \"other\"]),\n facts: z\n .array(z.string())\n .describe(\"New facts learned about this entity in this conversation\"),\n promptedByQuestion: z\n .string()\n .optional()\n .nullable()\n .describe(\"Optional proactive follow-up question that surfaced this entity.\"),\n structuredSections: z\n .array(z.object({\n key: z.string(),\n title: z.string(),\n facts: z.array(z.string()),\n }))\n .optional()\n .nullable()\n .describe(\"Optional named sections for entity-specific facts. Use when facts clearly belong under a durable heading such as Beliefs or Building / Working On.\"),\n});\n\nexport const ExtractedQuestionSchema = z.object({\n question: z.string().describe(\"A genuine question the AI is curious about based on this conversation\"),\n context: z.string().describe(\"Why this question matters or what prompted it\"),\n priority: z.number().min(0).max(1).describe(\"How important/urgent this question is (0-1)\"),\n});\n\nexport const ProactiveQuestionsResultSchema = z.object({\n questions: z\n .array(ExtractedQuestionSchema)\n .describe(\"Additional follow-up questions discovered in a proactive second-pass extraction.\"),\n});\n\nexport const ExtractedRelationshipSchema = z.object({\n source: z.string().describe(\"Source entity name (normalized, e.g. person-jane-doe)\"),\n target: z.string().describe(\"Target entity name (normalized, e.g. company-acme-corp)\"),\n label: z.string().describe(\"Relationship label (e.g. 'works at', 'created', 'manages')\"),\n promptedByQuestion: z\n .string()\n .optional()\n .nullable()\n .describe(\"Optional proactive follow-up question that surfaced this relationship.\"),\n});\n\nexport const ProactiveExtractionResultSchema = z.object({\n facts: z\n .array(ExtractedFactSchema)\n .describe(\n \"Additional high-confidence memories recovered only after answering proactive follow-up questions from the same buffered conversation.\",\n ),\n profileUpdates: z\n .array(z.string())\n .describe(\n \"Additional profile updates directly supported by the buffered conversation. Omit anything speculative.\",\n ),\n entities: z\n .array(EntityMentionSchema)\n .describe(\n \"Additional entities or entity facts surfaced by the proactive follow-up pass.\",\n ),\n relationships: z\n .array(ExtractedRelationshipSchema)\n .optional()\n .nullable()\n .describe(\n \"Additional relationships surfaced by the proactive follow-up pass.\",\n ),\n});\n\nexport const ExtractionResultSchema = z.object({\n facts: z\n .array(ExtractedFactSchema)\n .describe(\n \"Extracted memories from the conversation. Include facts, preferences, corrections, and decisions. Only extract genuinely new, durable information — skip transient task state.\",\n ),\n profileUpdates: z\n .array(z.string())\n .describe(\n \"Updates to the user's behavioral profile. Each string is a standalone statement about the user's preferences, habits, or personality. Only include genuinely new insights.\",\n ),\n entities: z\n .array(EntityMentionSchema)\n .describe(\n \"Entities mentioned in the conversation with new facts about them.\",\n ),\n questions: z\n .array(ExtractedQuestionSchema)\n .describe(\n \"1-3 genuine questions you're curious about from this conversation. These should be things you'd actually want to know the answer to in future sessions.\",\n ),\n identityReflection: z\n .string()\n .optional()\n .nullable()\n .describe(\n \"A brief reflection on what you learned about yourself as an agent in this interaction — patterns in your behavior, growth, things you did well or could improve.\",\n ),\n relationships: z\n .array(ExtractedRelationshipSchema)\n .optional()\n .nullable()\n .describe(\n \"Relationships between entities discovered in this conversation. Max 5 per extraction. Format: {source, target, label}.\",\n ),\n});\n\nexport const ConsolidationItemSchema = z.object({\n existingId: z\n .string()\n .describe(\"The ID of the existing memory being evaluated\"),\n action: z.enum([\"ADD\", \"MERGE\", \"UPDATE\", \"INVALIDATE\", \"SKIP\"]),\n mergeWith: z\n .string()\n .optional()\n .nullable()\n .describe(\"If MERGE, the ID of the memory to merge with\"),\n updatedContent: z\n .string()\n .optional()\n .nullable()\n .describe(\"If UPDATE or MERGE, the new content\"),\n reason: z.string().describe(\"Brief reason for this decision\"),\n});\n\nexport const ConsolidationResultSchema = z.object({\n items: z\n .array(ConsolidationItemSchema)\n .describe(\n \"Decisions for each existing memory: ADD (keep as-is), MERGE (combine with another), UPDATE (revise content), INVALIDATE (mark as outdated/wrong), SKIP (no action needed)\",\n ),\n profileUpdates: z\n .array(z.string())\n .describe(\"New profile statements to add or update\"),\n entityUpdates: z\n .array(EntityMentionSchema)\n .describe(\"Entity updates from consolidation analysis\"),\n});\n\nexport function buildProfileConsolidationResultSchema(targetLines: number) {\n return z.object({\n consolidatedProfile: z\n .string()\n .describe(\n `The full consolidated profile as markdown. Preserve all ## section headers. Merge duplicate or near-duplicate bullets into single clear statements. Remove stale or superseded information. Keep the most important and durable observations. Target roughly ${targetLines} lines.`,\n ),\n removedCount: z\n .number()\n .describe(\"Number of bullets removed or merged during consolidation\"),\n summary: z\n .string()\n .describe(\"Brief summary of what was consolidated\"),\n });\n}\n\nexport const ProfileConsolidationResultSchema = buildProfileConsolidationResultSchema(50);\n\nexport const IdentityConsolidationResultSchema = z.object({\n learnedPatterns: z\n .array(z.string())\n .describe(\n \"Consolidated behavioral patterns and lessons learned, each a concise standalone statement\",\n ),\n summary: z\n .string()\n .describe(\n \"A brief paragraph summarizing the agent's core identity insights\",\n ),\n});\n\nexport type IdentityConsolidationResultParsed = z.infer<\n typeof IdentityConsolidationResultSchema\n>;\n\n// Contradiction Verification (Phase 2B)\nexport const ContradictionVerificationSchema = z.object({\n isContradiction: z\n .boolean()\n .describe(\"Whether the two memories truly contradict each other\"),\n confidence: z\n .number()\n .min(0)\n .max(1)\n .describe(\"How confident are you in this assessment (0-1)\"),\n reasoning: z\n .string()\n .describe(\"Explanation of why these are or are not contradictory\"),\n whichIsNewer: z\n .enum([\"first\", \"second\", \"unclear\"])\n .describe(\"Which memory represents the more recent/current state\"),\n});\n\nexport type ContradictionVerificationResult = z.infer<\n typeof ContradictionVerificationSchema\n>;\n\n// Memory Linking (Phase 3A)\nexport const MemoryLinkSchema = z.object({\n targetId: z\n .string()\n .describe(\"The ID of the memory this links to\"),\n linkType: z\n .enum([\"follows\", \"references\", \"contradicts\", \"supports\", \"related\"])\n .describe(\"The type of relationship\"),\n strength: z\n .number()\n .min(0)\n .max(1)\n .describe(\"How strong is this relationship (0-1)\"),\n reason: z\n .string()\n .optional()\n .nullable()\n .describe(\"Why this link exists\"),\n});\n\nexport const SuggestedLinksSchema = z.object({\n links: z\n .array(MemoryLinkSchema)\n .describe(\"Suggested links between memories based on semantic analysis\"),\n});\n\nexport type MemoryLink = z.infer<typeof MemoryLinkSchema>;\nexport type SuggestedLinks = z.infer<typeof SuggestedLinksSchema>;\n\n// Memory Summarization (Phase 4A)\nexport const MemorySummarySchema = z.object({\n summaryText: z\n .string()\n .describe(\"A concise summary of the batch of memories\"),\n keyFacts: z\n .array(z.string())\n .describe(\"The most important facts extracted from these memories\"),\n keyEntities: z\n .array(z.string())\n .describe(\"Key entities mentioned across these memories\"),\n});\n\nexport type MemorySummaryResult = z.infer<typeof MemorySummarySchema>;\n\nexport const DaySummaryResultSchema = z.object({\n summary: z.string().min(1).describe(\"A concise end-of-day summary paragraph.\"),\n bullets: z.array(z.string()).default([]).describe(\"The most important moments from the day.\"),\n next_actions: z.array(z.string()).default([]).describe(\"Concrete next actions for tomorrow.\"),\n risks_or_open_loops: z.array(z.string()).default([]).describe(\"Open loops, blockers, or fragile assumptions still needing attention.\"),\n});\n\n// v8.15 behavior-loop auto-tuning state contracts\nexport const BehaviorLoopAdjustmentSchema = z.object({\n parameter: z.string().min(1),\n previousValue: z.number(),\n nextValue: z.number(),\n delta: z.number(),\n evidenceCount: z.number().int().min(0),\n confidence: z.number().min(0).max(1),\n reason: z.string(),\n appliedAt: z.string(),\n});\n\nexport const BehaviorLoopPolicyStateSchema = z.object({\n version: z.number().int().min(0),\n windowDays: z.number().int().min(0),\n minSignalCount: z.number().int().min(0),\n maxDeltaPerCycle: z.number().min(0).max(1),\n protectedParams: z.array(z.string()),\n adjustments: z.array(BehaviorLoopAdjustmentSchema),\n updatedAt: z.string(),\n});\n\nexport type BehaviorLoopAdjustmentParsed = z.infer<typeof BehaviorLoopAdjustmentSchema>;\nexport type BehaviorLoopPolicyStateParsed = z.infer<typeof BehaviorLoopPolicyStateSchema>;\n\nexport type MemoryActionTypeParsed = z.infer<typeof MemoryActionTypeSchema>;\nexport type MemoryActionEligibilityContextParsed = z.infer<typeof MemoryActionEligibilityContextSchema>;\nexport type ExtractedFactParsed = z.infer<typeof ExtractedFactSchema>;\nexport type EntityMentionParsed = z.infer<typeof EntityMentionSchema>;\nexport type ExtractedQuestionParsed = z.infer<typeof ExtractedQuestionSchema>;\nexport type ProactiveQuestionsResultParsed = z.infer<typeof ProactiveQuestionsResultSchema>;\nexport type ExtractionResultParsed = z.infer<typeof ExtractionResultSchema>;\nexport type ConsolidationItemParsed = z.infer<typeof ConsolidationItemSchema>;\nexport type ConsolidationResultParsed = z.infer<\n typeof ConsolidationResultSchema\n>;\n\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,yBAAyB,EAAE,KAAK;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,uCAAuC,EACjD,OAAO;AAAA,EACN,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CA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AA,EAClC,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;AAAA,EACtC,kBAAkB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACzC,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EACnC,aAAa,EAAE,MAAM,4BAA4B;AAAA,EACjD,WAAW,EAAE,OAAO;AACtB,CAAC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/access-mcp.ts"],"sourcesContent":["import type { Readable, Writable } from \"node:stream\";\nimport { readFile } from \"node:fs/promises\";\nimport { randomUUID } from \"node:crypto\";\nimport { EngramAccessInputError, type EngramAccessService, type EngramAccessRecallResponse } from \"./access-service.js\";\nimport { readEnvVar } from \"./runtime/env.js\";\nimport type { RecallPlanMode } from \"./types.js\";\nimport { validateBriefingFormat } from \"./briefing.js\";\nimport { buildCitationGuidance, type CitationMetadata } from \"./citations.js\";\n\ntype JsonRpcId = string | number | null;\n\ntype JsonRpcRequest = {\n jsonrpc?: string;\n id?: JsonRpcId;\n method?: string;\n params?: Record<string, unknown>;\n};\n\ntype McpTool = {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n};\n\nconst MCP_PROTOCOL_VERSION = \"2024-11-05\";\nconst LEGACY_MCP_PREFIX = \"engram.\";\nconst CANONICAL_MCP_PREFIX = \"remnic.\";\n\nfunction toCanonicalToolName(name: string): string {\n return name.startsWith(LEGACY_MCP_PREFIX)\n ? `${CANONICAL_MCP_PREFIX}${name.slice(LEGACY_MCP_PREFIX.length)}`\n : name;\n}\n\nfunction toLegacyToolName(name: string): string {\n return name.startsWith(CANONICAL_MCP_PREFIX)\n ? `${LEGACY_MCP_PREFIX}${name.slice(CANONICAL_MCP_PREFIX.length)}`\n : name;\n}\n\nfunction withToolAliases(tool: McpTool): McpTool[] {\n const canonicalName = toCanonicalToolName(tool.name);\n const canonicalTool = canonicalName === tool.name ? tool : { ...tool, name: canonicalName };\n if (canonicalName === tool.name) return [canonicalTool];\n return [canonicalTool, tool];\n}\n\nasync function getMcpServerVersion(): Promise<string> {\n const envVersion =\n readEnvVar(\"OPENCLAW_ENGRAM_VERSION\")?.trim() ||\n readEnvVar(\"npm_package_version\")?.trim();\n if (envVersion) return envVersion;\n try {\n const pkgPath = new URL(\"../package.json\", import.meta.url);\n const raw = await readFile(pkgPath, \"utf-8\");\n const parsed = JSON.parse(raw) as { version?: string };\n return parsed.version?.trim() || \"unknown\";\n } catch {\n return \"unknown\";\n }\n}\n\nexport class EngramMcpServer {\n private buffer = Buffer.alloc(0);\n private flushTask: Promise<void> | null = null;\n private readonly tools: McpTool[];\n private readonly authenticatedPrincipal?: string;\n /**\n * MCP client info keyed by server-assigned session ID. On each `initialize`\n * handshake the server generates a UUID, stores the client's clientInfo\n * against it, and returns the ID as `Mcp-Session-Id` in the response\n * metadata. Subsequent requests from the same client include this header,\n * allowing per-session clientInfo lookup without cross-session leaks.\n */\n private clientInfoBySession = new Map<string, { name: string; version?: string }>();\n /**\n * Session IDs generated during initialize, keyed by caller-supplied correlation\n * ID (unique per HTTP request) to avoid collisions when multiple clients send\n * initialize with the same JSON-RPC id concurrently.\n */\n private initSessionIds = new Map<string, string>();\n\n /** Whether oai-mem-citation guidance is explicitly enabled via config. */\n private readonly citationsEnabled: boolean;\n /** Whether to auto-enable citations for Codex adapter connections. */\n private readonly citationsAutoDetect: boolean;\n\n constructor(\n private readonly service: EngramAccessService,\n options: { principal?: string; citationsEnabled?: boolean; citationsAutoDetect?: boolean } = {},\n ) {\n this.citationsEnabled = options.citationsEnabled === true;\n this.citationsAutoDetect = options.citationsAutoDetect !== false;\n this.authenticatedPrincipal =\n options.principal?.trim() ||\n readEnvVar(\"OPENCLAW_ENGRAM_ACCESS_PRINCIPAL\")?.trim() ||\n undefined;\n this.tools = [\n {\n name: \"engram.recall\",\n description: \"Recall Engram context for a query.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\" },\n sessionKey: { type: \"string\" },\n namespace: { type: \"string\" },\n topK: { type: \"number\" },\n mode: { type: \"string\", enum: [\"auto\", \"no_recall\", \"minimal\", \"full\", \"graph_mode\"] },\n includeDebug: { type: \"boolean\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.recall_explain\",\n description: \"Return the last recall snapshot for a session or the most recent one.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.set_coding_context\",\n description:\n \"Attach a coding-agent context (project / branch) to a session so recall routes to a project- / branch-scoped namespace (issue #569). For MCP clients that do not ship cwd automatically (Cursor, generic agents, etc.). Also aliased as remnic.set_coding_context. Pass codingContext: null to clear.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: {\n type: \"string\",\n description: \"Session identifier the context should attach to.\",\n },\n codingContext: {\n anyOf: [\n { type: \"null\" },\n {\n type: \"object\",\n properties: {\n projectId: { type: \"string\", description: \"Stable project id (origin:<hex> or root:<hex>).\" },\n branch: { type: [\"string\", \"null\"], description: \"Current branch, or null in detached HEAD.\" },\n rootPath: { type: \"string\", description: \"Absolute path to the repo root.\" },\n defaultBranch: { type: [\"string\", \"null\"], description: \"Default branch (usually main/master), or null when unknown.\" },\n },\n required: [\"projectId\", \"branch\", \"rootPath\", \"defaultBranch\"],\n additionalProperties: false,\n },\n ],\n description: \"The context to attach, or null to clear.\",\n },\n },\n required: [\"sessionKey\", \"codingContext\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.recall_tier_explain\",\n description:\n \"Return a structured tier-explain payload for the last direct-answer-eligible recall (issue #518). Orthogonal to engram.recall_explain, which returns a graph-path explanation.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: {\n type: \"string\",\n description: \"Optional session key. Omit to read the most recent snapshot.\",\n },\n namespace: {\n type: \"string\",\n description: \"Optional namespace to scope the returned snapshot.\",\n },\n },\n additionalProperties: false,\n },\n },\n {\n // Registered as `engram.recall_xray`; `withToolAliases` below\n // emits the canonical `remnic.recall_xray` alias automatically\n // (dual-naming invariant for every new MCP tool).\n name: \"engram.recall_xray\",\n description:\n \"Run a recall with X-ray capture enabled and return the unified per-result attribution snapshot (tier + audit + MMR + filters in one view). Issue #570.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description: \"Query to recall against. Required; non-empty.\",\n },\n sessionKey: {\n type: \"string\",\n description: \"Optional session key to scope the recall.\",\n },\n namespace: {\n type: \"string\",\n description:\n \"Optional namespace. Enforced against the caller's principal; a mismatch yields snapshotFound:false.\",\n },\n budget: {\n type: \"integer\",\n minimum: 1,\n description:\n \"Optional positive-integer override for the recall character budget.\",\n },\n },\n required: [\"query\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.day_summary\",\n description:\n \"Generate a structured end-of-day summary. When memories is omitted or empty, auto-gathers today's facts and hourly summaries from storage.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memories: { type: \"string\" },\n sessionKey: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n required: [],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_governance_run\",\n description: \"Run Remnic memory governance in a bounded shadow/apply pass.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n mode: { type: \"string\", enum: [\"shadow\", \"apply\"] },\n recentDays: { type: \"number\" },\n maxMemories: { type: \"number\" },\n batchSize: { type: \"number\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.procedure_mining_run\",\n description:\n \"Run procedural memory mining from causal trajectories (issue #519). Respects procedural.enabled; writes under procedures/ when clusters qualify.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n // The canonical `remnic.procedural_stats` alias is added automatically\n // by `withToolAliases` — the dual-naming invariant keeps both names\n // alive for the legacy surface.\n name: \"engram.procedural_stats\",\n description:\n \"Procedural memory stats (issue #567): counts by status, recent write activity, and the active procedural.* config. Read-only, namespace-scoped.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_get\",\n description: \"Fetch one Remnic memory by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n required: [\"memoryId\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_timeline\",\n description: \"Fetch one Remnic memory timeline by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n namespace: { type: \"string\" },\n limit: { type: \"number\" },\n },\n required: [\"memoryId\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_store\",\n description: \"Store an explicit Remnic memory through the access layer.\",\n inputSchema: {\n type: \"object\",\n properties: {\n schemaVersion: { type: \"number\" },\n idempotencyKey: { type: \"string\" },\n dryRun: { type: \"boolean\" },\n sessionKey: { type: \"string\" },\n content: { type: \"string\" },\n category: { type: \"string\" },\n confidence: { type: \"number\" },\n namespace: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n entityRef: { type: \"string\" },\n ttl: { type: \"string\" },\n sourceReason: { type: \"string\" },\n },\n required: [\"content\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.suggestion_submit\",\n description: \"Queue a suggested Remnic memory for review.\",\n inputSchema: {\n type: \"object\",\n properties: {\n schemaVersion: { type: \"number\" },\n idempotencyKey: { type: \"string\" },\n dryRun: { type: \"boolean\" },\n sessionKey: { type: \"string\" },\n content: { type: \"string\" },\n category: { type: \"string\" },\n confidence: { type: \"number\" },\n namespace: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n entityRef: { type: \"string\" },\n ttl: { type: \"string\" },\n sourceReason: { type: \"string\" },\n },\n required: [\"content\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.entity_get\",\n description: \"Fetch one Engram entity by name.\",\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n required: [\"name\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.review_queue_list\",\n description: \"Fetch the latest Engram review queue artifact bundle.\",\n inputSchema: {\n type: \"object\",\n properties: {\n runId: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.observe\",\n description: \"Feed conversation messages into Engram's memory pipeline (LCM archive + extraction).\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: { type: \"string\", description: \"Conversation session identifier\" },\n messages: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n role: { type: \"string\", enum: [\"user\", \"assistant\"] },\n content: { type: \"string\" },\n },\n required: [\"role\", \"content\"],\n },\n description: \"Conversation messages to observe\",\n },\n namespace: { type: \"string\" },\n skipExtraction: { type: \"boolean\" },\n },\n required: [\"sessionKey\", \"messages\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.lcm_search\",\n description: \"Search the LCM conversation archive for matching content.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n sessionKey: { type: \"string\", description: \"Optional session filter\" },\n namespace: { type: \"string\" },\n limit: { type: \"number\", description: \"Max results to return\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n },\n },\n // ── Continuity / Identity tools ─────────────────────────────────────\n {\n name: \"engram.continuity_audit_generate\",\n description: \"Generate a deterministic identity continuity audit report (weekly/monthly).\",\n inputSchema: {\n type: \"object\",\n properties: {\n period: { type: \"string\", enum: [\"weekly\", \"monthly\"] },\n key: { type: \"string\", description: \"Period key (weekly: YYYY-Www, monthly: YYYY-MM). Defaults to current.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_incident_open\",\n description: \"Create a new continuity incident record in append-only storage.\",\n inputSchema: {\n type: \"object\",\n properties: {\n symptom: { type: \"string\", description: \"Observed continuity failure symptom.\" },\n namespace: { type: \"string\" },\n triggerWindow: { type: \"string\", description: \"Time window when incident occurred.\" },\n suspectedCause: { type: \"string\" },\n },\n required: [\"symptom\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_incident_close\",\n description: \"Close an open continuity incident with verification details.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Incident ID to close.\" },\n namespace: { type: \"string\" },\n fixApplied: { type: \"string\", description: \"What fix was applied.\" },\n verificationResult: { type: \"string\", description: \"How closure was verified.\" },\n preventiveRule: { type: \"string\", description: \"Optional preventive follow-up rule.\" },\n },\n required: [\"id\", \"fixApplied\", \"verificationResult\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_incident_list\",\n description: \"List continuity incidents, optionally filtered by state.\",\n inputSchema: {\n type: \"object\",\n properties: {\n state: { type: \"string\", enum: [\"open\", \"closed\", \"all\"] },\n namespace: { type: \"string\" },\n limit: { type: \"number\", description: \"Max incidents (default 25, max 200).\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_loop_add_or_update\",\n description: \"Add or update a continuity improvement loop entry.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Stable loop identifier.\" },\n cadence: { type: \"string\", enum: [\"daily\", \"weekly\", \"monthly\", \"quarterly\"] },\n purpose: { type: \"string\", description: \"What this recurring loop improves.\" },\n status: { type: \"string\", enum: [\"active\", \"paused\", \"retired\"] },\n killCondition: { type: \"string\", description: \"Clear condition for retiring this loop.\" },\n namespace: { type: \"string\" },\n lastReviewed: { type: \"string\", description: \"ISO timestamp for last review.\" },\n notes: { type: \"string\" },\n },\n required: [\"id\", \"cadence\", \"purpose\", \"status\", \"killCondition\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_loop_review\",\n description: \"Update review metadata for an existing continuity improvement loop.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Loop ID to review.\" },\n namespace: { type: \"string\" },\n status: { type: \"string\", enum: [\"active\", \"paused\", \"retired\"] },\n notes: { type: \"string\" },\n reviewedAt: { type: \"string\", description: \"ISO timestamp for review event.\" },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.identity_anchor_get\",\n description: \"Read the identity continuity anchor document (recovery-safe identity context).\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.identity_anchor_update\",\n description: \"Conservatively merge identity anchor sections without overwriting existing material.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n identityTraits: { type: \"string\", description: \"Updates for 'Identity Traits' section.\" },\n communicationPreferences: { type: \"string\", description: \"Updates for 'Communication Preferences' section.\" },\n operatingPrinciples: { type: \"string\", description: \"Updates for 'Operating Principles' section.\" },\n continuityNotes: { type: \"string\", description: \"Updates for 'Continuity Notes' section.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_identity\",\n description: \"Read the agent's identity reflections from the workspace IDENTITY.md file.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n // ── Work Layer tools ─────────────────────────────────────────────────\n {\n name: \"engram.work_task\",\n description: \"Manage work-layer tasks (create, get, list, update, transition, delete). Excluded from memory extraction.\",\n inputSchema: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"create\", \"get\", \"list\", \"update\", \"transition\", \"delete\"] },\n id: { type: \"string\" },\n title: { type: \"string\" },\n description: { type: \"string\" },\n status: { type: \"string\", enum: [\"todo\", \"in_progress\", \"blocked\", \"done\", \"cancelled\"] },\n priority: { type: \"string\", enum: [\"low\", \"medium\", \"high\"] },\n owner: { type: \"string\" },\n assignee: { type: \"string\" },\n projectId: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n dueAt: { type: \"string\" },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.work_project\",\n description: \"Manage work-layer projects (create, get, list, update, delete, link_task). Excluded from memory extraction.\",\n inputSchema: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"create\", \"get\", \"list\", \"update\", \"delete\", \"link_task\"] },\n id: { type: \"string\" },\n name: { type: \"string\" },\n description: { type: \"string\" },\n status: { type: \"string\", enum: [\"active\", \"on_hold\", \"completed\", \"archived\"] },\n owner: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n taskId: { type: \"string\", description: \"Task ID for link_task.\" },\n projectId: { type: \"string\", description: \"Project ID for link_task.\" },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.work_board\",\n description: \"Export/import work-layer board snapshots and markdown.\",\n inputSchema: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"export_markdown\", \"export_snapshot\", \"import_snapshot\"] },\n projectId: { type: \"string\" },\n snapshotJson: { type: \"string\", description: \"Snapshot JSON for import_snapshot.\" },\n linkToMemory: { type: \"boolean\", description: \"If true, output can be retained as long-term memory.\" },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n },\n // ── Shared Context / Compounding tools ────────────────────────────\n {\n name: \"engram.shared_context_write_output\",\n description: \"Write agent work product into shared-context directory for cross-agent coordination.\",\n inputSchema: {\n type: \"object\",\n properties: {\n agentId: { type: \"string\", description: \"Agent ID producing this output.\" },\n title: { type: \"string\", description: \"Short title for the output.\" },\n content: { type: \"string\", description: \"Markdown content to write.\" },\n },\n required: [\"agentId\", \"title\", \"content\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.shared_feedback_record\",\n description: \"Append approval/rejection decision into shared-context feedback inbox for compounding learning.\",\n inputSchema: {\n type: \"object\",\n properties: {\n agent: { type: \"string\", description: \"Agent name that produced the output.\" },\n decision: { type: \"string\", enum: [\"approved\", \"approved_with_feedback\", \"rejected\"] },\n reason: { type: \"string\" },\n date: { type: \"string\", description: \"ISO timestamp. Defaults to now.\" },\n learning: { type: \"string\" },\n outcome: { type: \"string\" },\n severity: { type: \"string\", enum: [\"low\", \"medium\", \"high\"] },\n confidence: { type: \"number\", description: \"Confidence 0-1.\" },\n workflow: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n evidenceWindowStart: { type: \"string\" },\n evidenceWindowEnd: { type: \"string\" },\n refs: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"agent\", \"decision\", \"reason\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.shared_priorities_append\",\n description: \"Append priorities text into shared-context inbox for curator merge.\",\n inputSchema: {\n type: \"object\",\n properties: {\n agentId: { type: \"string\" },\n text: { type: \"string\", description: \"Priority notes (markdown).\" },\n },\n required: [\"agentId\", \"text\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.shared_context_cross_signals_run\",\n description: \"Generate cross-signal markdown + JSON artifacts from agent outputs and feedback.\",\n inputSchema: {\n type: \"object\",\n properties: {\n date: { type: \"string\", description: \"YYYY-MM-DD. Defaults to today.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.shared_context_curate_daily\",\n description: \"Generate daily roundtable summary (deterministic baseline aggregation).\",\n inputSchema: {\n type: \"object\",\n properties: {\n date: { type: \"string\", description: \"YYYY-MM-DD. Defaults to today.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.compounding_weekly_synthesize\",\n description: \"Generate weekly compounding outputs: reports, mistake registry, rubrics, and promotion candidates.\",\n inputSchema: {\n type: \"object\",\n properties: {\n weekId: { type: \"string\", description: \"ISO week ID (YYYY-Www). Defaults to current week.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.compounding_promote_candidate\",\n description: \"Promote a compounding candidate from weekly report into durable rule/principle memory.\",\n inputSchema: {\n type: \"object\",\n properties: {\n weekId: { type: \"string\" },\n candidateId: { type: \"string\" },\n dryRun: { type: \"boolean\", description: \"Preview without writing.\" },\n },\n required: [\"weekId\", \"candidateId\"],\n additionalProperties: false,\n },\n },\n // ── Compression Guidelines tools ────────────────────────────────────\n {\n name: \"engram.compression_guidelines_optimize\",\n description: \"Run compression guideline optimizer, optionally persisting new guidelines.\",\n inputSchema: {\n type: \"object\",\n properties: {\n dryRun: { type: \"boolean\" },\n eventLimit: { type: \"number\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.compression_guidelines_activate\",\n description: \"Promote staged compression guideline draft to active (after review).\",\n inputSchema: {\n type: \"object\",\n properties: {\n expectedContentHash: { type: \"string\" },\n expectedGuidelineVersion: { type: \"number\" },\n },\n additionalProperties: false,\n },\n },\n // ── Memory search & debug tools ────────────────────────────────────\n {\n name: \"engram.memory_search\",\n description: \"Direct semantic search over memory files using the QMD index. Returns matching memories with relevance scores.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\" },\n namespace: { type: \"string\" },\n maxResults: { type: \"number\" },\n collection: { type: \"string\", description: \"QMD collection (omit for memory, 'global' for all)\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_profile\",\n description: \"Read the user's behavioral profile — a living document of their preferences, habits, and personality.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_entities_list\",\n description: \"List all tracked entities (people, projects, tools, companies).\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_questions\",\n description: \"List open questions the system is curious about from past conversations.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_last_recall\",\n description: \"Return the last recall snapshot for a session (debug introspection).\",\n inputSchema: {\n type: \"object\",\n properties: { sessionKey: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_intent_debug\",\n description: \"Return the last intent classification debug snapshot.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_qmd_debug\",\n description: \"Return QMD search index debug information from the last recall.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_graph_explain\",\n description: \"Explain the last entity graph recall — which entities were activated and why.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_feedback\",\n description: \"Record relevance feedback (thumbs up/down) for a specific memory.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n vote: { type: \"string\", enum: [\"up\", \"down\"] },\n note: { type: \"string\" },\n },\n required: [\"memoryId\", \"vote\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_promote\",\n description: \"Promote a memory's lifecycle state (e.g. from draft to active).\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n namespace: { type: \"string\" },\n sessionKey: { type: \"string\" },\n },\n required: [\"memoryId\"],\n additionalProperties: false,\n },\n },\n // Memory Worth outcome signal (issue #560 PR 3). Callers record whether\n // a session that used a given memory ultimately succeeded or failed;\n // the counter is persisted in the memory's frontmatter (mw_success /\n // mw_fail) and will feed the recall-time filter added in PR 4.\n {\n name: \"engram.memory_outcome\",\n description: \"Record a Memory Worth outcome (success/failure) for a memory. Increments mw_success or mw_fail in the memory's frontmatter for use by the recall filter.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n outcome: { type: \"string\", enum: [\"success\", \"failure\"] },\n namespace: { type: \"string\" },\n sessionKey: { type: \"string\" },\n timestamp: { type: \"string\", description: \"Optional ISO-8601 timestamp of the observation.\" },\n },\n required: [\"memoryId\", \"outcome\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.context_checkpoint\",\n description: \"Save a structured context checkpoint for a session (preserves conversation state to disk).\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: { type: \"string\" },\n context: { type: \"string\", description: \"Context content to checkpoint\" },\n namespace: { type: \"string\" },\n },\n required: [\"sessionKey\", \"context\"],\n additionalProperties: false,\n },\n },\n // ── Daily Context Briefing (#370) ───────────────────────────────────\n // Uses the legacy \"engram.*\" prefix like every other tool in this array;\n // withToolAliases (applied via .flatMap below) generates the canonical\n // \"remnic.briefing\" alias automatically.\n ...(service.briefingEnabled ? [{\n name: \"engram.briefing\",\n description: \"Generate a daily context briefing by cross-referencing active entities, recent facts, open commitments, and optional calendar events.\",\n inputSchema: {\n type: \"object\",\n properties: {\n since: { type: \"string\", description: \"Lookback window (e.g. 'yesterday', '3d', '1w', '24h').\" },\n focus: { type: \"string\", description: \"Optional focus filter (e.g. 'person:Jane Doe', 'project:remnic-core', 'topic:retrieval').\" },\n namespace: { type: \"string\" },\n format: { type: \"string\", enum: [\"markdown\", \"json\"] },\n maxFollowups: { type: \"number\", description: \"Maximum LLM-suggested follow-ups (0 disables that section).\" },\n },\n additionalProperties: false,\n },\n }] : []),\n // ── Contradiction Review (issue #520) ────────────────────────────────\n {\n name: \"engram.review_list\",\n description: \"List contradiction review items pending user resolution.\",\n inputSchema: {\n type: \"object\",\n properties: {\n filter: { type: \"string\", enum: [\"all\", \"unresolved\", \"contradicts\", \"independent\", \"duplicates\", \"needs-user\"], description: \"Filter by verdict type. Default: unresolved.\" },\n namespace: { type: \"string\" },\n limit: { type: \"number\", description: \"Max items to return (default 50).\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.review_resolve\",\n description: \"Resolve a contradiction pair with a chosen verb.\",\n inputSchema: {\n type: \"object\",\n properties: {\n pairId: { type: \"string\", description: \"The contradiction pair ID to resolve.\" },\n verb: { type: \"string\", enum: [\"keep-a\", \"keep-b\", \"merge\", \"both-valid\", \"needs-more-context\"], description: \"Resolution action.\" },\n },\n required: [\"pairId\", \"verb\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.contradiction_scan_run\",\n description: \"Run an on-demand contradiction scan over the memory corpus.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n ].flatMap((tool) => withToolAliases(tool));\n }\n\n /** Get clientInfo for a specific MCP session. Returns undefined for non-MCP requests. */\n getClientInfo(sessionId?: string): { name: string; version?: string } | undefined {\n if (sessionId) {\n return this.clientInfoBySession.get(sessionId);\n }\n return undefined;\n }\n\n /** Pop the session ID generated during an initialize handshake, keyed by correlation ID. */\n popInitSessionId(correlationId: string): string | undefined {\n const sid = this.initSessionIds.get(correlationId);\n if (sid !== undefined) this.initSessionIds.delete(correlationId);\n return sid;\n }\n\n async handleRequest(request: JsonRpcRequest, options?: { principalOverride?: string; sessionId?: string; correlationId?: string }): Promise<Record<string, unknown> | null> {\n const id = request.id ?? null;\n const method = request.method ?? \"\";\n\n if (method === \"notifications/initialized\") return null;\n if (method === \"ping\") {\n return { jsonrpc: \"2.0\", id, result: {} };\n }\n if (method === \"initialize\") {\n const params = request.params ?? {};\n const rawClientInfo = params.clientInfo as { name?: string; version?: string } | undefined;\n // Generate a server-side session ID for this MCP session.\n // The caller should send this back as Mcp-Session-Id on subsequent requests.\n const newSessionId = randomUUID();\n if (rawClientInfo && typeof rawClientInfo.name === \"string\") {\n const info = { name: rawClientInfo.name, version: rawClientInfo.version as string | undefined };\n this.clientInfoBySession.set(newSessionId, info);\n // Evict oldest sessions if map exceeds limit\n if (this.clientInfoBySession.size > 1000) {\n const firstKey = this.clientInfoBySession.keys().next().value;\n if (firstKey) this.clientInfoBySession.delete(firstKey);\n }\n }\n const version = await getMcpServerVersion();\n // Store session ID keyed by correlation ID (unique per HTTP request) so\n // concurrent initializes with the same JSON-RPC id don't collide.\n const corrId = options?.correlationId;\n if (corrId) this.initSessionIds.set(corrId, newSessionId);\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n protocolVersion: MCP_PROTOCOL_VERSION,\n capabilities: {\n tools: {},\n },\n serverInfo: {\n name: \"remnic\",\n version,\n },\n },\n };\n }\n if (method === \"tools/list\") {\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n tools: this.tools,\n },\n };\n }\n if (method === \"tools/call\") {\n const params = request.params ?? {};\n const name = typeof params.name === \"string\" ? params.name : \"\";\n const argumentsObject =\n params.arguments && typeof params.arguments === \"object\" && !Array.isArray(params.arguments)\n ? (params.arguments as Record<string, unknown>)\n : {};\n\n try {\n const effectivePrincipal = options?.principalOverride ?? this.authenticatedPrincipal;\n const result = await this.callTool(name, argumentsObject, effectivePrincipal, options?.sessionId);\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n content: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n structuredContent: result,\n isError: false,\n },\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n content: [{ type: \"text\", text: message }],\n isError: true,\n },\n };\n }\n }\n\n return {\n jsonrpc: \"2.0\",\n id,\n error: {\n code: -32601,\n message: `Method not found: ${method}`,\n },\n };\n }\n\n async runStdio(input: Readable, output: Writable): Promise<void> {\n input.on(\"data\", (chunk) => {\n this.buffer = Buffer.concat([this.buffer, Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)]);\n this.scheduleFlush(output);\n });\n await new Promise<void>((resolve, reject) => {\n input.on(\"end\", resolve);\n input.on(\"error\", reject);\n });\n while (this.flushTask) {\n await this.flushTask;\n }\n }\n\n private scheduleFlush(output: Writable): void {\n if (this.flushTask) return;\n const task = this.flushBuffer(output)\n .catch((err) => {\n this.writeMessage(output, {\n jsonrpc: \"2.0\",\n id: null,\n error: {\n code: -32700,\n message: err instanceof Error ? err.message : String(err),\n },\n });\n })\n .finally(() => {\n if (this.flushTask === task) {\n this.flushTask = null;\n }\n if (this.buffer.length > 0) {\n this.scheduleFlush(output);\n }\n });\n this.flushTask = task;\n }\n\n private async flushBuffer(output: Writable): Promise<void> {\n while (true) {\n const headerEnd = this.buffer.indexOf(\"\\r\\n\\r\\n\");\n if (headerEnd < 0) return;\n const headerText = this.buffer.slice(0, headerEnd).toString(\"utf-8\");\n const headers = headerText.split(\"\\r\\n\");\n const contentLengthHeader = headers.find((line) => line.toLowerCase().startsWith(\"content-length:\"));\n if (!contentLengthHeader) {\n this.buffer = Buffer.alloc(0);\n return;\n }\n const contentLength = parseInt(contentLengthHeader.split(\":\")[1]?.trim() ?? \"0\", 10);\n if (!Number.isFinite(contentLength) || contentLength < 0) {\n this.buffer = Buffer.alloc(0);\n return;\n }\n const messageStart = headerEnd + 4;\n const messageEnd = messageStart + contentLength;\n if (this.buffer.length < messageEnd) return;\n const body = this.buffer.slice(messageStart, messageEnd).toString(\"utf-8\");\n this.buffer = this.buffer.slice(messageEnd);\n\n let parsed: JsonRpcRequest;\n try {\n parsed = JSON.parse(body) as JsonRpcRequest;\n } catch {\n this.writeMessage(output, {\n jsonrpc: \"2.0\",\n id: null,\n error: {\n code: -32700,\n message: \"Parse error\",\n },\n });\n continue;\n }\n const response = await this.handleRequest(parsed);\n if (response) {\n this.writeMessage(output, response);\n }\n }\n }\n\n private writeMessage(output: Writable, payload: Record<string, unknown>): void {\n const body = JSON.stringify(payload);\n const message = `Content-Length: ${Buffer.byteLength(body, \"utf-8\")}\\r\\n\\r\\n${body}`;\n output.write(message);\n }\n\n /**\n * Determine whether oai-mem-citation guidance should be appended to recall.\n * Returns true when explicitly enabled via config OR when auto-detect is\n * active and the current MCP session belongs to a Codex adapter client.\n *\n * When no sessionId is provided (e.g., stdio transport where there are no\n * HTTP headers carrying mcp-session-id), fall back to checking if there is\n * exactly one known session whose clientInfo matches the Codex pattern.\n * This covers the common stdio case where a single client connection exists.\n */\n private shouldEmitCitations(mcpSessionId?: string): boolean {\n if (this.citationsEnabled) return true;\n if (!this.citationsAutoDetect) return false;\n\n // Direct session lookup (HTTP transport with mcp-session-id header).\n if (mcpSessionId) {\n const info = this.clientInfoBySession.get(mcpSessionId);\n if (!info) return false;\n return this.isCodexClient(info);\n }\n\n // Stdio fallback: no session ID available. If there is exactly one session\n // registered (the typical stdio pattern), check that session's clientInfo.\n if (this.clientInfoBySession.size === 1) {\n const [info] = [...this.clientInfoBySession.values()];\n if (info) return this.isCodexClient(info);\n }\n\n return false;\n }\n\n /** Check whether a clientInfo record identifies a Codex adapter client. */\n private isCodexClient(info: { name: string; version?: string }): boolean {\n const lowerName = info.name.toLowerCase();\n return lowerName === \"codex-mcp-client\" || lowerName.includes(\"codex\");\n }\n\n /**\n * Build citation metadata for each recall result that has a path.\n * Line range defaults to 1-1 when not determinable from the summary.\n */\n private buildRecallCitations(response: EngramAccessRecallResponse): CitationMetadata[] {\n return response.results\n .filter((r) => r.path && r.path.length > 0)\n .map((r) => ({\n memoryId: r.id,\n path: r.path,\n lineStart: 1,\n lineEnd: 1,\n noteDefault: r.preview?.slice(0, 60) || r.id,\n }));\n }\n\n private async callTool(name: string, args: Record<string, unknown>, effectivePrincipal?: string, mcpSessionId?: string): Promise<unknown> {\n switch (toLegacyToolName(name)) {\n case \"engram.recall\": {\n const response = await this.service.recall({\n query: typeof args.query === \"string\" ? args.query : \"\",\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n topK: typeof args.topK === \"number\" && Number.isFinite(args.topK) ? args.topK : undefined,\n mode: typeof args.mode === \"string\" ? args.mode as RecallPlanMode | \"auto\" : undefined,\n includeDebug: args.includeDebug === true,\n });\n\n if (this.shouldEmitCitations(mcpSessionId)) {\n const citations = this.buildRecallCitations(response);\n const guidance = buildCitationGuidance(citations);\n if (guidance.length > 0) {\n return {\n ...response,\n context: response.context + guidance,\n citations,\n };\n }\n }\n return response;\n }\n case \"engram.recall_explain\":\n return this.service.recallExplain({\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n });\n case \"engram.set_coding_context\": {\n // Issue #569 PR 7 — MCP tool for clients that don't ship cwd.\n // Validation lives in EngramAccessService.setCodingContext; any\n // EngramAccessInputError surfaces as a structured tool-call error.\n const sessionKey = typeof args.sessionKey === \"string\" ? args.sessionKey : \"\";\n const rawCtx = args.codingContext;\n let codingContext: {\n projectId: string;\n branch: string | null;\n rootPath: string;\n defaultBranch: string | null;\n } | null = null;\n if (rawCtx !== null) {\n if (typeof rawCtx !== \"object\" || rawCtx === undefined) {\n throw new EngramAccessInputError(\"codingContext must be an object or null\");\n }\n const obj = rawCtx as Record<string, unknown>;\n const projectId = typeof obj.projectId === \"string\" ? obj.projectId : \"\";\n const rootPath = typeof obj.rootPath === \"string\" ? obj.rootPath : \"\";\n const branch = obj.branch === null\n ? null\n : typeof obj.branch === \"string\" ? obj.branch : undefined;\n const defaultBranch = obj.defaultBranch === null\n ? null\n : typeof obj.defaultBranch === \"string\" ? obj.defaultBranch : undefined;\n if (branch === undefined) {\n throw new EngramAccessInputError(\"codingContext.branch must be a string or null\");\n }\n if (defaultBranch === undefined) {\n throw new EngramAccessInputError(\"codingContext.defaultBranch must be a string or null\");\n }\n codingContext = { projectId, branch, rootPath, defaultBranch };\n }\n this.service.setCodingContext({ sessionKey, codingContext });\n return { ok: true };\n }\n case \"engram.recall_tier_explain\":\n return this.service.recallTierExplain(\n typeof args.sessionKey === \"string\" && args.sessionKey.length > 0\n ? args.sessionKey\n : undefined,\n typeof args.namespace === \"string\" && args.namespace.length > 0\n ? args.namespace\n : undefined,\n effectivePrincipal,\n );\n case \"engram.recall_xray\": {\n // `recallXray` throws on empty query / invalid budget; surface\n // those as MCP errors with a listed-options message rather\n // than silently returning `snapshotFound: false` (CLAUDE.md\n // rule 51). Namespace scope is enforced inside the service\n // via `canReadNamespace`.\n const query = typeof args.query === \"string\" ? args.query : \"\";\n const sessionKey =\n typeof args.sessionKey === \"string\" && args.sessionKey.length > 0\n ? args.sessionKey\n : undefined;\n const namespace =\n typeof args.namespace === \"string\" && args.namespace.length > 0\n ? args.namespace\n : undefined;\n // `budget` may arrive as a JSON number or a string ('4096')\n // from loosely-typed MCP clients; coerce + validate here so\n // the service sees a number. Reject booleans, objects, and\n // other non-string-non-number inputs explicitly — `Number()`\n // otherwise coerces `true` to `1`, which would silently force\n // an extremely small recall budget (CLAUDE.md rule 51).\n let budget: number | undefined;\n if (args.budget !== undefined && args.budget !== null) {\n if (typeof args.budget !== \"number\" && typeof args.budget !== \"string\") {\n throw new Error(\n `engram.recall_xray: budget expects a positive integer; got ${JSON.stringify(args.budget)}`,\n );\n }\n const parsed =\n typeof args.budget === \"number\"\n ? args.budget\n : Number(args.budget);\n if (\n !Number.isFinite(parsed)\n || parsed <= 0\n || !Number.isInteger(parsed)\n ) {\n throw new Error(\n `engram.recall_xray: budget expects a positive integer; got ${JSON.stringify(args.budget)}`,\n );\n }\n budget = parsed;\n }\n return this.service.recallXray({\n query,\n sessionKey,\n namespace,\n budget,\n authenticatedPrincipal: effectivePrincipal,\n });\n }\n case \"engram.day_summary\":\n return this.service.daySummary({\n memories: typeof args.memories === \"string\" ? args.memories : \"\",\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n });\n case \"engram.memory_governance_run\":\n return this.service.governanceRun({\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n mode: args.mode === \"apply\" ? \"apply\" : \"shadow\",\n recentDays: typeof args.recentDays === \"number\" && Number.isFinite(args.recentDays) ? args.recentDays : undefined,\n maxMemories: typeof args.maxMemories === \"number\" && Number.isFinite(args.maxMemories) ? args.maxMemories : undefined,\n batchSize: typeof args.batchSize === \"number\" && Number.isFinite(args.batchSize) ? args.batchSize : undefined,\n authenticatedPrincipal: effectivePrincipal,\n }, effectivePrincipal);\n case \"engram.procedure_mining_run\":\n return this.service.procedureMiningRun(\n {\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n authenticatedPrincipal: effectivePrincipal,\n },\n effectivePrincipal,\n );\n case \"remnic.procedural_stats\":\n case \"engram.procedural_stats\":\n return this.service.procedureStats(\n {\n namespace:\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n },\n effectivePrincipal,\n );\n case \"engram.memory_get\":\n return this.service.memoryGet(\n typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.memory_timeline\": {\n const limit = typeof args.limit === \"number\" && Number.isFinite(args.limit) ? args.limit : 200;\n return this.service.memoryTimeline(\n typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n limit,\n effectivePrincipal,\n );\n }\n case \"engram.memory_store\":\n return this.service.memoryStore({\n schemaVersion: typeof args.schemaVersion === \"number\" ? args.schemaVersion : undefined,\n idempotencyKey: typeof args.idempotencyKey === \"string\" ? args.idempotencyKey : undefined,\n dryRun: args.dryRun === true,\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n authenticatedPrincipal: effectivePrincipal,\n content: typeof args.content === \"string\" ? args.content : \"\",\n category: typeof args.category === \"string\" ? args.category : undefined,\n confidence: typeof args.confidence === \"number\" ? args.confidence : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((tag): tag is string => typeof tag === \"string\") : undefined,\n entityRef: typeof args.entityRef === \"string\" ? args.entityRef : undefined,\n ttl: typeof args.ttl === \"string\" ? args.ttl : undefined,\n sourceReason: typeof args.sourceReason === \"string\" ? args.sourceReason : undefined,\n });\n case \"engram.suggestion_submit\":\n return this.service.suggestionSubmit({\n schemaVersion: typeof args.schemaVersion === \"number\" ? args.schemaVersion : undefined,\n idempotencyKey: typeof args.idempotencyKey === \"string\" ? args.idempotencyKey : undefined,\n dryRun: args.dryRun === true,\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n authenticatedPrincipal: effectivePrincipal,\n content: typeof args.content === \"string\" ? args.content : \"\",\n category: typeof args.category === \"string\" ? args.category : undefined,\n confidence: typeof args.confidence === \"number\" ? args.confidence : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((tag): tag is string => typeof tag === \"string\") : undefined,\n entityRef: typeof args.entityRef === \"string\" ? args.entityRef : undefined,\n ttl: typeof args.ttl === \"string\" ? args.ttl : undefined,\n sourceReason: typeof args.sourceReason === \"string\" ? args.sourceReason : undefined,\n });\n case \"engram.entity_get\":\n return this.service.entityGet(\n typeof args.name === \"string\" ? args.name : \"\",\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n );\n case \"engram.review_queue_list\":\n return this.service.reviewQueue(\n typeof args.runId === \"string\" ? args.runId : undefined,\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.observe\":\n return this.service.observe({\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : \"\",\n messages: Array.isArray(args.messages) ? args.messages : [],\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n authenticatedPrincipal: effectivePrincipal,\n skipExtraction: args.skipExtraction === true,\n });\n case \"engram.lcm_search\":\n return this.service.lcmSearch({\n query: typeof args.query === \"string\" ? args.query : \"\",\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n limit: typeof args.limit === \"number\" && Number.isFinite(args.limit) ? args.limit : undefined,\n authenticatedPrincipal: effectivePrincipal,\n });\n // ── Continuity / Identity tools ───────────────────────────────────\n case \"engram.continuity_audit_generate\":\n return this.service.continuityAuditGenerate({\n period: args.period === \"monthly\" ? \"monthly\" : args.period === \"weekly\" ? \"weekly\" : undefined,\n key: typeof args.key === \"string\" ? args.key : undefined,\n });\n case \"engram.continuity_incident_open\":\n return this.service.continuityIncidentOpen({\n symptom: typeof args.symptom === \"string\" ? args.symptom : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n triggerWindow: typeof args.triggerWindow === \"string\" ? args.triggerWindow : undefined,\n suspectedCause: typeof args.suspectedCause === \"string\" ? args.suspectedCause : undefined,\n });\n case \"engram.continuity_incident_close\":\n return this.service.continuityIncidentClose({\n id: typeof args.id === \"string\" ? args.id : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n fixApplied: typeof args.fixApplied === \"string\" ? args.fixApplied : \"\",\n verificationResult: typeof args.verificationResult === \"string\" ? args.verificationResult : \"\",\n preventiveRule: typeof args.preventiveRule === \"string\" ? args.preventiveRule : undefined,\n });\n case \"engram.continuity_incident_list\":\n return this.service.continuityIncidentList({\n state: args.state === \"closed\" ? \"closed\" : args.state === \"all\" ? \"all\" : args.state === \"open\" ? \"open\" : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n limit: typeof args.limit === \"number\" ? args.limit : undefined,\n });\n case \"engram.continuity_loop_add_or_update\":\n return this.service.continuityLoopAddOrUpdate({\n id: typeof args.id === \"string\" ? args.id : \"\",\n cadence: (args.cadence as \"daily\" | \"weekly\" | \"monthly\" | \"quarterly\") ?? \"weekly\",\n purpose: typeof args.purpose === \"string\" ? args.purpose : \"\",\n status: (args.status as \"active\" | \"paused\" | \"retired\") ?? \"active\",\n killCondition: typeof args.killCondition === \"string\" ? args.killCondition : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n lastReviewed: typeof args.lastReviewed === \"string\" ? args.lastReviewed : undefined,\n notes: typeof args.notes === \"string\" ? args.notes : undefined,\n });\n case \"engram.continuity_loop_review\":\n return this.service.continuityLoopReview({\n id: typeof args.id === \"string\" ? args.id : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n status: args.status === \"active\" || args.status === \"paused\" || args.status === \"retired\" ? args.status : undefined,\n notes: typeof args.notes === \"string\" ? args.notes : undefined,\n reviewedAt: typeof args.reviewedAt === \"string\" ? args.reviewedAt : undefined,\n });\n case \"engram.identity_anchor_get\":\n return this.service.identityAnchorGet({\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n });\n case \"engram.identity_anchor_update\":\n return this.service.identityAnchorUpdate({\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n identityTraits: typeof args.identityTraits === \"string\" ? args.identityTraits : undefined,\n communicationPreferences: typeof args.communicationPreferences === \"string\" ? args.communicationPreferences : undefined,\n operatingPrinciples: typeof args.operatingPrinciples === \"string\" ? args.operatingPrinciples : undefined,\n continuityNotes: typeof args.continuityNotes === \"string\" ? args.continuityNotes : undefined,\n });\n case \"engram.memory_identity\":\n return this.service.memoryIdentity({\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n });\n // ── Work Layer tools ──────────────────────────────────────────────\n case \"engram.work_task\":\n return this.service.workTask({\n action: (args.action as any) ?? \"list\",\n id: typeof args.id === \"string\" ? args.id : undefined,\n title: typeof args.title === \"string\" ? args.title : undefined,\n description: typeof args.description === \"string\" ? args.description : undefined,\n status: typeof args.status === \"string\" ? args.status : undefined,\n priority: typeof args.priority === \"string\" ? args.priority : undefined,\n owner: typeof args.owner === \"string\" ? args.owner : undefined,\n assignee: typeof args.assignee === \"string\" ? args.assignee : undefined,\n projectId: typeof args.projectId === \"string\" ? args.projectId : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((x: unknown): x is string => typeof x === \"string\") : undefined,\n dueAt: typeof args.dueAt === \"string\" ? args.dueAt : undefined,\n });\n case \"engram.work_project\":\n return this.service.workProject({\n action: (args.action as any) ?? \"list\",\n id: typeof args.id === \"string\" ? args.id : undefined,\n name: typeof args.name === \"string\" ? args.name : undefined,\n description: typeof args.description === \"string\" ? args.description : undefined,\n status: typeof args.status === \"string\" ? args.status : undefined,\n owner: typeof args.owner === \"string\" ? args.owner : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((x: unknown): x is string => typeof x === \"string\") : undefined,\n taskId: typeof args.taskId === \"string\" ? args.taskId : undefined,\n projectId: typeof args.projectId === \"string\" ? args.projectId : undefined,\n });\n case \"engram.work_board\":\n return this.service.workBoard({\n action: (args.action as any) ?? \"export_markdown\",\n projectId: typeof args.projectId === \"string\" ? args.projectId : undefined,\n snapshotJson: typeof args.snapshotJson === \"string\" ? args.snapshotJson : undefined,\n linkToMemory: args.linkToMemory === true,\n });\n // ── Shared Context / Compounding tools ─────────────────────────\n case \"engram.shared_context_write_output\":\n return this.service.sharedContextWriteOutput({\n agentId: typeof args.agentId === \"string\" ? args.agentId : \"\",\n title: typeof args.title === \"string\" ? args.title : \"\",\n content: typeof args.content === \"string\" ? args.content : \"\",\n });\n case \"engram.shared_feedback_record\":\n return this.service.sharedFeedbackRecord({\n agent: typeof args.agent === \"string\" ? args.agent : \"\",\n decision: (args.decision as any) ?? \"approved\",\n reason: typeof args.reason === \"string\" ? args.reason : \"\",\n date: typeof args.date === \"string\" ? args.date : undefined,\n learning: typeof args.learning === \"string\" ? args.learning : undefined,\n outcome: typeof args.outcome === \"string\" ? args.outcome : undefined,\n severity: args.severity === \"low\" || args.severity === \"medium\" || args.severity === \"high\" ? args.severity : undefined,\n confidence: typeof args.confidence === \"number\" ? args.confidence : undefined,\n workflow: typeof args.workflow === \"string\" ? args.workflow : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((x: unknown): x is string => typeof x === \"string\") : undefined,\n evidenceWindowStart: typeof args.evidenceWindowStart === \"string\" ? args.evidenceWindowStart : undefined,\n evidenceWindowEnd: typeof args.evidenceWindowEnd === \"string\" ? args.evidenceWindowEnd : undefined,\n refs: Array.isArray(args.refs) ? args.refs.filter((x: unknown): x is string => typeof x === \"string\") : undefined,\n });\n case \"engram.shared_priorities_append\":\n return this.service.sharedPrioritiesAppend({\n agentId: typeof args.agentId === \"string\" ? args.agentId : \"\",\n text: typeof args.text === \"string\" ? args.text : \"\",\n });\n case \"engram.shared_context_cross_signals_run\":\n return this.service.sharedContextCrossSignalsRun({\n date: typeof args.date === \"string\" ? args.date : undefined,\n });\n case \"engram.shared_context_curate_daily\":\n return this.service.sharedContextCurateDaily({\n date: typeof args.date === \"string\" ? args.date : undefined,\n });\n case \"engram.compounding_weekly_synthesize\":\n return this.service.compoundingWeeklySynthesize({\n weekId: typeof args.weekId === \"string\" ? args.weekId : undefined,\n });\n case \"engram.compounding_promote_candidate\":\n return this.service.compoundingPromoteCandidate({\n weekId: typeof args.weekId === \"string\" ? args.weekId : \"\",\n candidateId: typeof args.candidateId === \"string\" ? args.candidateId : \"\",\n dryRun: args.dryRun === true,\n });\n // ── Compression Guidelines tools ───────────────────────────────────\n case \"engram.compression_guidelines_optimize\":\n return this.service.compressionGuidelinesOptimize({\n dryRun: args.dryRun === true,\n eventLimit: typeof args.eventLimit === \"number\" ? args.eventLimit : undefined,\n });\n case \"engram.compression_guidelines_activate\":\n return this.service.compressionGuidelinesActivate({\n expectedContentHash: typeof args.expectedContentHash === \"string\" ? args.expectedContentHash : undefined,\n expectedGuidelineVersion: typeof args.expectedGuidelineVersion === \"number\" ? args.expectedGuidelineVersion : undefined,\n });\n // ── Memory search & debug tools ──────────────────────────────────\n case \"engram.memory_search\":\n return this.service.memorySearch({\n query: typeof args.query === \"string\" ? args.query : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n maxResults: typeof args.maxResults === \"number\" && Number.isFinite(args.maxResults) ? args.maxResults : undefined,\n collection: typeof args.collection === \"string\" ? args.collection : undefined,\n principal: effectivePrincipal,\n });\n case \"engram.memory_profile\":\n return this.service.memoryProfile(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.memory_entities_list\":\n return this.service.memoryEntitiesList(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.memory_questions\":\n return this.service.memoryQuestions(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.memory_last_recall\":\n return this.service.lastRecallSnapshot(\n typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n );\n case \"engram.memory_intent_debug\":\n return this.service.intentDebug(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n );\n case \"engram.memory_qmd_debug\":\n return this.service.qmdDebug(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n );\n case \"engram.memory_graph_explain\":\n return this.service.graphExplainLastRecall(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n );\n case \"engram.memory_feedback\":\n return this.service.memoryFeedback({\n memoryId: typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n vote: args.vote === \"down\" ? \"down\" : \"up\",\n note: typeof args.note === \"string\" ? args.note : undefined,\n });\n case \"engram.memory_promote\":\n return this.service.memoryPromote({\n memoryId: typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n });\n case \"engram.memory_outcome\": {\n // Validate `outcome` up front — silently defaulting unknown values\n // to \"success\" or \"failure\" would poison the counters a downstream\n // recall filter (PR 4) will trust.\n const outcome = args.outcome;\n if (outcome !== \"success\" && outcome !== \"failure\") {\n throw new Error(\n `engram.memory_outcome: outcome must be \"success\" or \"failure\"; got ${JSON.stringify(outcome)}`,\n );\n }\n return this.service.memoryOutcome({\n memoryId: typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n outcome,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n timestamp: typeof args.timestamp === \"string\" ? args.timestamp : undefined,\n });\n }\n case \"engram.context_checkpoint\":\n return this.service.contextCheckpoint({\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : \"\",\n context: typeof args.context === \"string\" ? args.context : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n });\n // ── Daily Context Briefing (#370) ───────────────────────────────────\n case \"engram.briefing\": {\n // Validate the format value upfront — unsupported values (e.g. \"xml\")\n // must be rejected with a descriptive error rather than silently\n // falling back to the default format.\n const rawFormat = typeof args.format === \"string\" ? args.format : undefined;\n const formatErr = validateBriefingFormat(rawFormat);\n if (formatErr) throw new Error(formatErr);\n return this.service.briefing({\n since: typeof args.since === \"string\" ? args.since : undefined,\n focus: typeof args.focus === \"string\" ? args.focus : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n format: rawFormat as \"json\" | \"markdown\" | undefined,\n maxFollowups:\n typeof args.maxFollowups === \"number\" ? args.maxFollowups : undefined,\n principal: effectivePrincipal,\n });\n }\n // ── Contradiction Review (issue #520) ──────────────────────────────────\n case \"engram.review_list\":\n case \"remnic.review_list\": {\n const { listPairs } = await import(\"./contradiction/contradiction-review.js\");\n const VALID_REVIEW_FILTERS = new Set([\"all\", \"unresolved\", \"contradicts\", \"independent\", \"duplicates\", \"needs-user\"]);\n const rawFilter = typeof args.filter === \"string\" ? args.filter : \"unresolved\";\n if (!VALID_REVIEW_FILTERS.has(rawFilter)) {\n throw new Error(`Invalid filter '${rawFilter}'. Valid: ${[...VALID_REVIEW_FILTERS].join(\", \")}`);\n }\n const filter = rawFilter as \"all\" | \"unresolved\" | \"contradicts\" | \"independent\" | \"duplicates\" | \"needs-user\";\n const ns = typeof args.namespace === \"string\" ? args.namespace : undefined;\n const limit = typeof args.limit === \"number\" ? args.limit : 50;\n return listPairs(this.service.memoryDir, { filter, namespace: ns, limit });\n }\n case \"engram.review_resolve\":\n case \"remnic.review_resolve\": {\n const pairId = typeof args.pairId === \"string\" ? args.pairId : \"\";\n const verb = typeof args.verb === \"string\" ? args.verb : \"\";\n if (!pairId) throw new Error(\"pairId is required\");\n if (!verb) throw new Error(\"verb is required\");\n const { isValidResolutionVerb } = await import(\"./contradiction/resolution.js\");\n if (!isValidResolutionVerb(verb)) throw new Error(`Invalid verb: ${verb}. Must be one of: keep-a, keep-b, merge, both-valid, needs-more-context`);\n const { executeResolution } = await import(\"./contradiction/resolution.js\");\n return executeResolution(this.service.memoryDir, this.service.storageRef, pairId, verb);\n }\n case \"engram.contradiction_scan_run\":\n case \"remnic.contradiction_scan_run\": {\n const { runContradictionScan } = await import(\"./contradiction/contradiction-scan.js\");\n return runContradictionScan({\n storage: this.service.storageRef,\n config: this.service.configRef,\n memoryDir: this.service.memoryDir,\n embeddingLookupFactory: this.service.embeddingLookupFactoryRef,\n localLlm: this.service.localLlmRef,\n fallbackLlm: this.service.fallbackLlmRef,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n });\n }\n default:\n throw new Error(`unknown tool: ${name}`);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAsB3B,IAAM,uBAAuB;AAC7B,IAAM,oBAAoB;AAC1B,IAAM,uBAAuB;AAE7B,SAAS,oBAAoB,MAAsB;AACjD,SAAO,KAAK,WAAW,iBAAiB,IACpC,GAAG,oBAAoB,GAAG,KAAK,MAAM,kBAAkB,MAAM,CAAC,KAC9D;AACN;AAEA,SAAS,iBAAiB,MAAsB;AAC9C,SAAO,KAAK,WAAW,oBAAoB,IACvC,GAAG,iBAAiB,GAAG,KAAK,MAAM,qBAAqB,MAAM,CAAC,KAC9D;AACN;AAEA,SAAS,gBAAgB,MAA0B;AACjD,QAAM,gBAAgB,oBAAoB,KAAK,IAAI;AACnD,QAAM,gBAAgB,kBAAkB,KAAK,OAAO,OAAO,EAAE,GAAG,MAAM,MAAM,cAAc;AAC1F,MAAI,kBAAkB,KAAK,KAAM,QAAO,CAAC,aAAa;AACtD,SAAO,CAAC,eAAe,IAAI;AAC7B;AAEA,eAAe,sBAAuC;AACpD,QAAM,aACJ,WAAW,yBAAyB,GAAG,KAAK,KAC5C,WAAW,qBAAqB,GAAG,KAAK;AAC1C,MAAI,WAAY,QAAO;AACvB,MAAI;AACF,UAAM,UAAU,IAAI,IAAI,mBAAmB,YAAY,GAAG;AAC1D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AC9E,YAAI,CAAC,sBAAsB,IAAI,EAAG,OAAM,IAAI,MAAM,iBAAiB,IAAI,yEAAyE;AAChJ,cAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,0BAA+B;AAC1E,eAAO,kBAAkB,KAAK,QAAQ,WAAW,KAAK,QAAQ,YAAY,QAAQ,IAAI;AAAA,MACxF;AAAA,MACA,KAAK;AAAA,MACL,KAAK,iCAAiC;AACpC,cAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,kCAAuC;AACrF,eAAO,qBAAqB;AAAA,UAC1B,SAAS,KAAK,QAAQ;AAAA,UACtB,QAAQ,KAAK,QAAQ;AAAA,UACrB,WAAW,KAAK,QAAQ;AAAA,UACxB,wBAAwB,KAAK,QAAQ;AAAA,UACrC,UAAU,KAAK,QAAQ;AAAA,UACvB,aAAa,KAAK,QAAQ;AAAA,UAC1B,WAAW,OAAO,KAAK,cAAc,WAAW,KAAK,YAAY;AAAA,QACnE,CAAC;AAAA,MACH;AAAA,MACA;AACE,cAAM,IAAI,MAAM,iBAAiB,IAAI,EAAE;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/recall-xray-cli.ts"],"sourcesContent":["/**\n * Input-validation helpers for the `remnic xray` CLI command (issue\n * #570, PR 3).\n *\n * Pulled out of `cli.ts` so the validation paths can be unit-tested in\n * isolation — the full CLI handler is hard to exercise without booting\n * an orchestrator. CLAUDE.md rules 14 + 51 require that `--format`,\n * `--budget`, `--namespace`, and `--out` reject missing-value /\n * unknown / non-positive arguments with a listed-options error, rather\n * than silently defaulting.\n */\n\nimport {\n parseXrayFormat,\n type RecallXrayFormat,\n} from \"./recall-xray-renderer.js\";\n\nexport interface ParsedXrayCliOptions {\n format: RecallXrayFormat;\n /** Positive integer override, or undefined when not specified. */\n budget?: number;\n /** Trimmed namespace, or undefined when not specified. */\n namespace?: string;\n /** Trimmed, tilde-unexpanded output path, or undefined when stdout. */\n outPath?: string;\n}\n\n/**\n * Validate and coerce `--budget <chars>`. Must be a positive integer;\n * throws a listed-options error otherwise.\n */\nexport function parseXrayBudgetFlag(value: unknown): number | undefined {\n if (value === undefined || value === null) return undefined;\n const parsed = typeof value === \"number\" ? value : Number(value);\n if (\n !Number.isFinite(parsed) ||\n parsed <= 0 ||\n !Number.isInteger(parsed)\n ) {\n throw new Error(\n `--budget expects a positive integer; got ${JSON.stringify(value)}`,\n );\n }\n return parsed;\n}\n\n/**\n * Parse and validate the full option bag for `remnic xray`. Extracted\n * so the CLI handler in `cli.ts` can stay thin and the validation can\n * be unit-tested without booting an orchestrator.\n */\nexport function parseXrayCliOptions(\n rawQuery: unknown,\n options: Record<string, unknown>,\n): { query: string } & ParsedXrayCliOptions {\n if (typeof rawQuery !== \"string\" || rawQuery.trim().length === 0) {\n throw new Error(\"xray: <query> is required and must be non-empty\");\n }\n const format = parseXrayFormat(options.format);\n const budget = parseXrayBudgetFlag(options.budget);\n const namespace =\n typeof options.namespace === \"string\" &&\n options.namespace.trim().length > 0\n ? options.namespace.trim()\n : undefined;\n const outPath =\n typeof options.out === \"string\" && options.out.trim().length > 0\n ? options.out.trim()\n : undefined;\n return {\n query: rawQuery,\n format,\n ...(budget !== undefined ? { budget } : {}),\n ...(namespace !== undefined ? { namespace } : {}),\n ...(outPath !== undefined ? { outPath } : {}),\n };\n}\n"],"mappings":";;;;;AA+BO,SAAS,oBAAoB,OAAoC;AACtE,MAAI,UAAU,UAAa,UAAU,KAAM,QAAO;AAClD,QAAM,SAAS,OAAO,UAAU,WAAW,QAAQ,OAAO,KAAK;AAC/D,MACE,CAAC,OAAO,SAAS,MAAM,KACvB,UAAU,KACV,CAAC,OAAO,UAAU,MAAM,GACxB;AACA,UAAM,IAAI;AAAA,MACR,4CAA4C,KAAK,UAAU,KAAK,CAAC;AAAA,IACnE;AAAA,EACF;AACA,SAAO;AACT;AAOO,SAAS,oBACd,UACA,SAC0C;AAC1C,MAAI,OAAO,aAAa,YAAY,SAAS,KAAK,EAAE,WAAW,GAAG;AAChE,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACnE;AACA,QAAM,SAAS,gBAAgB,QAAQ,MAAM;AAC7C,QAAM,SAAS,oBAAoB,QAAQ,MAAM;AACjD,QAAM,YACJ,OAAO,QAAQ,cAAc,YAC7B,QAAQ,UAAU,KAAK,EAAE,SAAS,IAC9B,QAAQ,UAAU,KAAK,IACvB;AACN,QAAM,UACJ,OAAO,QAAQ,QAAQ,YAAY,QAAQ,IAAI,KAAK,EAAE,SAAS,IAC3D,QAAQ,IAAI,KAAK,IACjB;AACN,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA,GAAI,WAAW,SAAY,EAAE,OAAO,IAAI,CAAC;AAAA,IACzC,GAAI,cAAc,SAAY,EAAE,UAAU,IAAI,CAAC;AAAA,IAC/C,GAAI,YAAY,SAAY,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC7C;AACF;","names":[]}