@remnic/core 1.1.0 → 1.1.2

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 (308) hide show
  1. package/dist/access-audit.d.ts +56 -0
  2. package/dist/access-audit.js +9 -0
  3. package/dist/access-cli.js +70 -53
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +16 -9
  6. package/dist/access-http.js +26 -18
  7. package/dist/access-mcp.d.ts +16 -9
  8. package/dist/access-mcp.js +30 -8
  9. package/dist/access-schema.d.ts +124 -33
  10. package/dist/access-schema.js +5 -1
  11. package/dist/{access-service-HmO1Trrx.d.ts → access-service-Br8ZydTK.d.ts} +158 -63
  12. package/dist/access-service.d.ts +13 -6
  13. package/dist/access-service.js +23 -14
  14. package/dist/bootstrap.d.ts +6 -3
  15. package/dist/briefing.d.ts +1 -0
  16. package/dist/briefing.js +8 -6
  17. package/dist/buffer-surprise-report.d.ts +70 -0
  18. package/dist/buffer-surprise-report.js +7 -0
  19. package/dist/buffer-surprise-report.js.map +1 -0
  20. package/dist/buffer-surprise.d.ts +98 -0
  21. package/dist/buffer-surprise.js +11 -0
  22. package/dist/buffer-surprise.js.map +1 -0
  23. package/dist/buffer.d.ts +100 -2
  24. package/dist/buffer.js +1 -1
  25. package/dist/calibration.js +6 -6
  26. package/dist/causal-behavior.js +4 -4
  27. package/dist/causal-chain.js +2 -2
  28. package/dist/causal-consolidation.js +19 -18
  29. package/dist/causal-consolidation.js.map +1 -1
  30. package/dist/causal-retrieval.js +4 -4
  31. package/dist/causal-trajectory.js +1 -1
  32. package/dist/{chunk-QNJMBKFK.js → chunk-2LGMW3DJ.js} +3 -2
  33. package/dist/chunk-2LGMW3DJ.js.map +1 -0
  34. package/dist/{chunk-QDYXG4CS.js → chunk-3FPTCC3Z.js} +4 -3
  35. package/dist/chunk-3FPTCC3Z.js.map +1 -0
  36. package/dist/chunk-3GPTTA4J.js +57 -0
  37. package/dist/chunk-3GPTTA4J.js.map +1 -0
  38. package/dist/{chunk-ITRLGI2T.js → chunk-3OGMS3PE.js} +2 -2
  39. package/dist/{chunk-DEPL3635.js → chunk-3YGHKTBF.js} +1446 -196
  40. package/dist/chunk-3YGHKTBF.js.map +1 -0
  41. package/dist/{chunk-BLKTA7MM.js → chunk-4HQS2HPX.js} +54 -21
  42. package/dist/chunk-4HQS2HPX.js.map +1 -0
  43. package/dist/chunk-54V4BZWP.js +139 -0
  44. package/dist/chunk-54V4BZWP.js.map +1 -0
  45. package/dist/chunk-5JRF2PZA.js +67 -0
  46. package/dist/chunk-5JRF2PZA.js.map +1 -0
  47. package/dist/chunk-64NJRYU2.js +332 -0
  48. package/dist/chunk-64NJRYU2.js.map +1 -0
  49. package/dist/{chunk-OIT5QGG4.js → chunk-6AUUAZEX.js} +72 -2
  50. package/dist/chunk-6AUUAZEX.js.map +1 -0
  51. package/dist/{chunk-3QHL5ABG.js → chunk-6YJHX2DL.js} +191 -10
  52. package/dist/chunk-6YJHX2DL.js.map +1 -0
  53. package/dist/chunk-AJU4PJGY.js +126 -0
  54. package/dist/chunk-AJU4PJGY.js.map +1 -0
  55. package/dist/chunk-ASAITVLA.js +64 -0
  56. package/dist/chunk-ASAITVLA.js.map +1 -0
  57. package/dist/{chunk-44ICJRF3.js → chunk-AYXIPSZO.js} +5 -5
  58. package/dist/{chunk-MBJHSA7F.js → chunk-BECYBZLX.js} +265 -20
  59. package/dist/chunk-BECYBZLX.js.map +1 -0
  60. package/dist/chunk-C4SQJZAF.js +486 -0
  61. package/dist/chunk-C4SQJZAF.js.map +1 -0
  62. package/dist/{chunk-6UJ47TVX.js → chunk-CUPFXL3J.js} +2 -2
  63. package/dist/chunk-DF3RVK3X.js +119 -0
  64. package/dist/chunk-DF3RVK3X.js.map +1 -0
  65. package/dist/{chunk-N42IWANG.js → chunk-DG6YMRDC.js} +3 -3
  66. package/dist/chunk-DGVM5SFL.js +69 -0
  67. package/dist/chunk-DGVM5SFL.js.map +1 -0
  68. package/dist/{chunk-3SV6CQHO.js → chunk-DIXB44VE.js} +102 -66
  69. package/dist/chunk-DIXB44VE.js.map +1 -0
  70. package/dist/chunk-EIR5VLIH.js +90 -0
  71. package/dist/chunk-EIR5VLIH.js.map +1 -0
  72. package/dist/{chunk-GV6NLQ4X.js → chunk-F5VP6YCB.js} +374 -16
  73. package/dist/chunk-F5VP6YCB.js.map +1 -0
  74. package/dist/{chunk-6ZH4TU6I.js → chunk-FAAFWE4G.js} +2 -1
  75. package/dist/chunk-FAAFWE4G.js.map +1 -0
  76. package/dist/{chunk-7WQ6SLIE.js → chunk-FVA6TGI3.js} +2 -2
  77. package/dist/{chunk-PAORGQRI.js → chunk-GA5P7RST.js} +37 -23
  78. package/dist/chunk-GA5P7RST.js.map +1 -0
  79. package/dist/chunk-GDFS42HT.js +206 -0
  80. package/dist/chunk-GDFS42HT.js.map +1 -0
  81. package/dist/chunk-IISBCCWR.js +52 -0
  82. package/dist/chunk-IISBCCWR.js.map +1 -0
  83. package/dist/chunk-JBMSGZEQ.js +441 -0
  84. package/dist/chunk-JBMSGZEQ.js.map +1 -0
  85. package/dist/{chunk-J4IYOZZ5.js → chunk-JXS5PDQ7.js} +3 -1
  86. package/dist/chunk-JXS5PDQ7.js.map +1 -0
  87. package/dist/chunk-KVBLZUKV.js +173 -0
  88. package/dist/chunk-KVBLZUKV.js.map +1 -0
  89. package/dist/{chunk-4LACOVZX.js → chunk-L7IXWRYE.js} +10 -5
  90. package/dist/chunk-L7IXWRYE.js.map +1 -0
  91. package/dist/chunk-LBLXEFWK.js +51 -0
  92. package/dist/chunk-LBLXEFWK.js.map +1 -0
  93. package/dist/{chunk-WBSAYXVI.js → chunk-LOIMBRDE.js} +201 -45
  94. package/dist/chunk-LOIMBRDE.js.map +1 -0
  95. package/dist/{chunk-3WHVNEN7.js → chunk-LTCGGW2D.js} +1 -1
  96. package/dist/chunk-LTCGGW2D.js.map +1 -0
  97. package/dist/{chunk-ZVBB3T7V.js → chunk-NBVAS5MT.js} +25 -23
  98. package/dist/chunk-NBVAS5MT.js.map +1 -0
  99. package/dist/{chunk-UEYA6UC7.js → chunk-NZLQTHS5.js} +25 -2
  100. package/dist/chunk-NZLQTHS5.js.map +1 -0
  101. package/dist/{chunk-NQEVYWX6.js → chunk-OC5OXUQ4.js} +211 -7
  102. package/dist/chunk-OC5OXUQ4.js.map +1 -0
  103. package/dist/{chunk-LK6SGL53.js → chunk-OR64ZGRZ.js} +3 -2
  104. package/dist/chunk-OR64ZGRZ.js.map +1 -0
  105. package/dist/{chunk-SYUK3VLY.js → chunk-PVICZTKG.js} +117 -5
  106. package/dist/chunk-PVICZTKG.js.map +1 -0
  107. package/dist/chunk-PVPWZSSI.js +37 -0
  108. package/dist/chunk-PVPWZSSI.js.map +1 -0
  109. package/dist/{chunk-JL2PU6AI.js → chunk-R2XRID2N.js} +2 -2
  110. package/dist/{chunk-4NRAJUDS.js → chunk-RBBWYEFJ.js} +1 -1
  111. package/dist/chunk-RFYAYKTD.js +146 -0
  112. package/dist/chunk-RFYAYKTD.js.map +1 -0
  113. package/dist/chunk-SOBJ6NEY.js +18 -0
  114. package/dist/chunk-SOBJ6NEY.js.map +1 -0
  115. package/dist/{chunk-JIU55F3X.js → chunk-SPI27QT6.js} +2 -2
  116. package/dist/{chunk-MVTHXUBX.js → chunk-STGWEHYR.js} +479 -20
  117. package/dist/chunk-STGWEHYR.js.map +1 -0
  118. package/dist/{chunk-6LX5ORAS.js → chunk-TMYO7B5P.js} +4 -4
  119. package/dist/chunk-TVVEYCNW.js +65 -0
  120. package/dist/chunk-TVVEYCNW.js.map +1 -0
  121. package/dist/chunk-ULYOGL6R.js +322 -0
  122. package/dist/chunk-ULYOGL6R.js.map +1 -0
  123. package/dist/{chunk-37UIFYWO.js → chunk-UWB5LMWY.js} +108 -9
  124. package/dist/chunk-UWB5LMWY.js.map +1 -0
  125. package/dist/{chunk-47UU5PU2.js → chunk-VBVG2M5G.js} +18 -3
  126. package/dist/chunk-VBVG2M5G.js.map +1 -0
  127. package/dist/{chunk-7ECD5ATE.js → chunk-VDX363PS.js} +2 -2
  128. package/dist/{chunk-O5ETUNBT.js → chunk-VTU2B4VF.js} +7 -3
  129. package/dist/chunk-VTU2B4VF.js.map +1 -0
  130. package/dist/{chunk-MTLYEMJB.js → chunk-WCLICCGB.js} +18 -3
  131. package/dist/chunk-WCLICCGB.js.map +1 -0
  132. package/dist/chunk-X6GF3FX2.js +26 -0
  133. package/dist/chunk-X6GF3FX2.js.map +1 -0
  134. package/dist/{chunk-3QFQGRHO.js → chunk-XMHBH5H6.js} +4 -4
  135. package/dist/{chunk-DHHP2Z4X.js → chunk-XXVWLXSG.js} +2 -2
  136. package/dist/{chunk-XZ2TIKGC.js → chunk-Y7R2XJ5Q.js} +25 -9
  137. package/dist/chunk-Y7R2XJ5Q.js.map +1 -0
  138. package/dist/{chunk-ALXMCZEU.js → chunk-Z2E7VW55.js} +6 -3
  139. package/dist/chunk-Z2E7VW55.js.map +1 -0
  140. package/dist/chunk-ZAIM4TUE.js +488 -0
  141. package/dist/chunk-ZAIM4TUE.js.map +1 -0
  142. package/dist/chunk-ZZTOURJI.js +91 -0
  143. package/dist/chunk-ZZTOURJI.js.map +1 -0
  144. package/dist/{cli-BneVIEvh.d.ts → cli-BkeRaYfk.d.ts} +2 -2
  145. package/dist/cli.d.ts +13 -6
  146. package/dist/cli.js +42 -31
  147. package/dist/config.js +2 -2
  148. package/dist/consolidation-operator.d.ts +41 -0
  149. package/dist/consolidation-operator.js +11 -0
  150. package/dist/consolidation-operator.js.map +1 -0
  151. package/dist/consolidation-provenance-check.d.ts +68 -0
  152. package/dist/consolidation-provenance-check.js +9 -0
  153. package/dist/consolidation-provenance-check.js.map +1 -0
  154. package/dist/consolidation-undo.d.ts +123 -0
  155. package/dist/consolidation-undo.js +426 -0
  156. package/dist/consolidation-undo.js.map +1 -0
  157. package/dist/{contradiction-scan-GR33PONM.js → contradiction-scan-E3GJTI4F.js} +43 -7
  158. package/dist/contradiction-scan-E3GJTI4F.js.map +1 -0
  159. package/dist/cross-namespace-budget.d.ts +133 -0
  160. package/dist/cross-namespace-budget.js +9 -0
  161. package/dist/cross-namespace-budget.js.map +1 -0
  162. package/dist/direct-answer-wiring.js +5 -70
  163. package/dist/direct-answer-wiring.js.map +1 -1
  164. package/dist/embedding-fallback.js +2 -1
  165. package/dist/{engine-5TIQBYZR.js → engine-72LSIWQP.js} +8 -7
  166. package/dist/engine-72LSIWQP.js.map +1 -0
  167. package/dist/entity-retrieval.d.ts +1 -0
  168. package/dist/entity-retrieval.js +7 -6
  169. package/dist/explicit-capture.d.ts +6 -3
  170. package/dist/explicit-capture.js +2 -2
  171. package/dist/extraction-judge-telemetry.d.ts +113 -0
  172. package/dist/extraction-judge-telemetry.js +14 -0
  173. package/dist/extraction-judge-telemetry.js.map +1 -0
  174. package/dist/extraction-judge-training.d.ts +85 -0
  175. package/dist/extraction-judge-training.js +16 -0
  176. package/dist/extraction-judge-training.js.map +1 -0
  177. package/dist/extraction-judge.d.ts +124 -2
  178. package/dist/extraction-judge.js +11 -1
  179. package/dist/extraction.js +10 -9
  180. package/dist/fallback-llm.js +3 -3
  181. package/dist/graph-recall.d.ts +100 -0
  182. package/dist/graph-recall.js +8 -0
  183. package/dist/graph-recall.js.map +1 -0
  184. package/dist/graph-retrieval.d.ts +271 -0
  185. package/dist/graph-retrieval.js +21 -0
  186. package/dist/graph-retrieval.js.map +1 -0
  187. package/dist/importance.js +1 -1
  188. package/dist/index.d.ts +585 -20
  189. package/dist/index.js +542 -344
  190. package/dist/index.js.map +1 -1
  191. package/dist/local-llm.js +2 -2
  192. package/dist/memory-worth-bench.d.ts +51 -0
  193. package/dist/memory-worth-bench.js +131 -0
  194. package/dist/memory-worth-bench.js.map +1 -0
  195. package/dist/memory-worth-filter.d.ts +128 -0
  196. package/dist/memory-worth-filter.js +10 -0
  197. package/dist/memory-worth-filter.js.map +1 -0
  198. package/dist/memory-worth-outcomes.d.ts +118 -0
  199. package/dist/memory-worth-outcomes.js +9 -0
  200. package/dist/memory-worth-outcomes.js.map +1 -0
  201. package/dist/memory-worth.d.ts +102 -0
  202. package/dist/memory-worth.js +7 -0
  203. package/dist/memory-worth.js.map +1 -0
  204. package/dist/operator-toolkit.d.ts +40 -1
  205. package/dist/operator-toolkit.js +25 -16
  206. package/dist/{orchestrator-DRYA6_lW.d.ts → orchestrator-CmJ-NTdJ.d.ts} +233 -8
  207. package/dist/orchestrator.d.ts +6 -3
  208. package/dist/orchestrator.js +54 -44
  209. package/dist/page-versioning.d.ts +12 -1
  210. package/dist/page-versioning.js +5 -3
  211. package/dist/{port-C1GZFv8h.d.ts → port-BADbLZU5.d.ts} +2 -2
  212. package/dist/qmd-recall-cache.d.ts +1 -1
  213. package/dist/qmd.d.ts +5 -3
  214. package/dist/qmd.js +3 -3
  215. package/dist/reasoning-trace-recall.d.ts +90 -0
  216. package/dist/reasoning-trace-recall.js +13 -0
  217. package/dist/reasoning-trace-recall.js.map +1 -0
  218. package/dist/reasoning-trace-types.d.ts +54 -0
  219. package/dist/reasoning-trace-types.js +17 -0
  220. package/dist/reasoning-trace-types.js.map +1 -0
  221. package/dist/recall-audit-anomaly.d.ts +112 -0
  222. package/dist/recall-audit-anomaly.js +11 -0
  223. package/dist/recall-audit-anomaly.js.map +1 -0
  224. package/dist/recall-audit.js +5 -44
  225. package/dist/recall-audit.js.map +1 -1
  226. package/dist/recall-explain-renderer.d.ts +49 -0
  227. package/dist/recall-explain-renderer.js +18 -0
  228. package/dist/recall-explain-renderer.js.map +1 -0
  229. package/dist/recall-state.d.ts +12 -1
  230. package/dist/recall-state.js +1 -1
  231. package/dist/recall-xray-cli.d.ts +40 -0
  232. package/dist/recall-xray-cli.js +11 -0
  233. package/dist/recall-xray-cli.js.map +1 -0
  234. package/dist/recall-xray-renderer.d.ts +44 -0
  235. package/dist/recall-xray-renderer.js +18 -0
  236. package/dist/recall-xray-renderer.js.map +1 -0
  237. package/dist/recall-xray.d.ts +179 -0
  238. package/dist/recall-xray.js +13 -0
  239. package/dist/recall-xray.js.map +1 -0
  240. package/dist/resolve-provider-secret.d.ts +5 -1
  241. package/dist/resolve-provider-secret.js +3 -1
  242. package/dist/resume-bundles.js +6 -6
  243. package/dist/retrieval-agents.d.ts +1 -1
  244. package/dist/retrieval-tiers.d.ts +17 -0
  245. package/dist/retrieval-tiers.js +9 -0
  246. package/dist/retrieval-tiers.js.map +1 -0
  247. package/dist/schemas.d.ts +309 -53
  248. package/dist/schemas.js +1 -1
  249. package/dist/{semantic-consolidation-DrvSYRdB.d.ts → semantic-consolidation-CxJU6MJk.d.ts} +62 -1
  250. package/dist/semantic-consolidation.d.ts +2 -1
  251. package/dist/semantic-consolidation.js +22 -7
  252. package/dist/semantic-rule-promotion.js +7 -6
  253. package/dist/semantic-rule-verifier.js +7 -6
  254. package/dist/storage.d.ts +82 -1
  255. package/dist/storage.js +6 -5
  256. package/dist/summarizer.js +6 -6
  257. package/dist/temporal-supersession.d.ts +1 -0
  258. package/dist/tier-migration.d.ts +2 -1
  259. package/dist/tokens.js +2 -1
  260. package/dist/types.d.ts +276 -2
  261. package/dist/types.js +1 -1
  262. package/dist/verified-recall.js +7 -6
  263. package/package.json +1 -1
  264. package/dist/chunk-37UIFYWO.js.map +0 -1
  265. package/dist/chunk-3QHL5ABG.js.map +0 -1
  266. package/dist/chunk-3SV6CQHO.js.map +0 -1
  267. package/dist/chunk-3WHVNEN7.js.map +0 -1
  268. package/dist/chunk-47UU5PU2.js.map +0 -1
  269. package/dist/chunk-4LACOVZX.js.map +0 -1
  270. package/dist/chunk-6ZH4TU6I.js.map +0 -1
  271. package/dist/chunk-ALXMCZEU.js.map +0 -1
  272. package/dist/chunk-BLKTA7MM.js.map +0 -1
  273. package/dist/chunk-DEPL3635.js.map +0 -1
  274. package/dist/chunk-GV6NLQ4X.js.map +0 -1
  275. package/dist/chunk-J4IYOZZ5.js.map +0 -1
  276. package/dist/chunk-LAYN4LDC.js +0 -267
  277. package/dist/chunk-LAYN4LDC.js.map +0 -1
  278. package/dist/chunk-LK6SGL53.js.map +0 -1
  279. package/dist/chunk-MBJHSA7F.js.map +0 -1
  280. package/dist/chunk-MTLYEMJB.js.map +0 -1
  281. package/dist/chunk-MVTHXUBX.js.map +0 -1
  282. package/dist/chunk-NQEVYWX6.js.map +0 -1
  283. package/dist/chunk-O5ETUNBT.js.map +0 -1
  284. package/dist/chunk-OIT5QGG4.js.map +0 -1
  285. package/dist/chunk-PAORGQRI.js.map +0 -1
  286. package/dist/chunk-QDYXG4CS.js.map +0 -1
  287. package/dist/chunk-QNJMBKFK.js.map +0 -1
  288. package/dist/chunk-SYUK3VLY.js.map +0 -1
  289. package/dist/chunk-UEYA6UC7.js.map +0 -1
  290. package/dist/chunk-UVJFDP7P.js +0 -202
  291. package/dist/chunk-UVJFDP7P.js.map +0 -1
  292. package/dist/chunk-WBSAYXVI.js.map +0 -1
  293. package/dist/chunk-XZ2TIKGC.js.map +0 -1
  294. package/dist/chunk-ZVBB3T7V.js.map +0 -1
  295. package/dist/contradiction-scan-GR33PONM.js.map +0 -1
  296. /package/dist/{engine-5TIQBYZR.js.map → access-audit.js.map} +0 -0
  297. /package/dist/{chunk-ITRLGI2T.js.map → chunk-3OGMS3PE.js.map} +0 -0
  298. /package/dist/{chunk-44ICJRF3.js.map → chunk-AYXIPSZO.js.map} +0 -0
  299. /package/dist/{chunk-6UJ47TVX.js.map → chunk-CUPFXL3J.js.map} +0 -0
  300. /package/dist/{chunk-N42IWANG.js.map → chunk-DG6YMRDC.js.map} +0 -0
  301. /package/dist/{chunk-7WQ6SLIE.js.map → chunk-FVA6TGI3.js.map} +0 -0
  302. /package/dist/{chunk-JL2PU6AI.js.map → chunk-R2XRID2N.js.map} +0 -0
  303. /package/dist/{chunk-4NRAJUDS.js.map → chunk-RBBWYEFJ.js.map} +0 -0
  304. /package/dist/{chunk-JIU55F3X.js.map → chunk-SPI27QT6.js.map} +0 -0
  305. /package/dist/{chunk-6LX5ORAS.js.map → chunk-TMYO7B5P.js.map} +0 -0
  306. /package/dist/{chunk-7ECD5ATE.js.map → chunk-VDX363PS.js.map} +0 -0
  307. /package/dist/{chunk-3QFQGRHO.js.map → chunk-XMHBH5H6.js.map} +0 -0
  308. /package/dist/{chunk-DHHP2Z4X.js.map → chunk-XXVWLXSG.js.map} +0 -0
@@ -9,6 +9,28 @@ interface SchemaValidationError {
9
9
  }>;
10
10
  }
11
11
  declare function formatZodError(error: z.ZodError): SchemaValidationError;
12
+ /**
13
+ * Coding-agent context (issue #569). Optional payload that connectors may
14
+ * ship with a recall request so the project/branch namespace overlay
15
+ * applies to that recall. All fields are validated per CLAUDE.md #51 —
16
+ * empty-string projectId / rootPath is rejected, not silently accepted.
17
+ */
18
+ declare const codingContextSchema: z.ZodNullable<z.ZodObject<{
19
+ projectId: z.ZodString;
20
+ branch: z.ZodNullable<z.ZodString>;
21
+ rootPath: z.ZodString;
22
+ defaultBranch: z.ZodNullable<z.ZodString>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ projectId: string;
25
+ branch: string | null;
26
+ rootPath: string;
27
+ defaultBranch: string | null;
28
+ }, {
29
+ projectId: string;
30
+ branch: string | null;
31
+ rootPath: string;
32
+ defaultBranch: string | null;
33
+ }>>;
12
34
  declare const recallRequestSchema: z.ZodObject<{
13
35
  query: z.ZodString;
14
36
  sessionKey: z.ZodOptional<z.ZodString>;
@@ -16,30 +38,98 @@ declare const recallRequestSchema: z.ZodObject<{
16
38
  topK: z.ZodOptional<z.ZodNumber>;
17
39
  mode: z.ZodOptional<z.ZodEnum<["auto", "no_recall", "minimal", "full", "graph_mode"]>>;
18
40
  includeDebug: z.ZodOptional<z.ZodBoolean>;
41
+ codingContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
42
+ projectId: z.ZodString;
43
+ branch: z.ZodNullable<z.ZodString>;
44
+ rootPath: z.ZodString;
45
+ defaultBranch: z.ZodNullable<z.ZodString>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ projectId: string;
48
+ branch: string | null;
49
+ rootPath: string;
50
+ defaultBranch: string | null;
51
+ }, {
52
+ projectId: string;
53
+ branch: string | null;
54
+ rootPath: string;
55
+ defaultBranch: string | null;
56
+ }>>>;
19
57
  }, "strip", z.ZodTypeAny, {
20
58
  query: string;
21
- namespace?: string | undefined;
22
59
  sessionKey?: string | undefined;
60
+ namespace?: string | undefined;
23
61
  topK?: number | undefined;
24
62
  mode?: "no_recall" | "minimal" | "full" | "graph_mode" | "auto" | undefined;
63
+ codingContext?: {
64
+ projectId: string;
65
+ branch: string | null;
66
+ rootPath: string;
67
+ defaultBranch: string | null;
68
+ } | null | undefined;
25
69
  includeDebug?: boolean | undefined;
26
70
  }, {
27
71
  query: string;
28
- namespace?: string | undefined;
29
72
  sessionKey?: string | undefined;
73
+ namespace?: string | undefined;
30
74
  topK?: number | undefined;
31
75
  mode?: "no_recall" | "minimal" | "full" | "graph_mode" | "auto" | undefined;
76
+ codingContext?: {
77
+ projectId: string;
78
+ branch: string | null;
79
+ rootPath: string;
80
+ defaultBranch: string | null;
81
+ } | null | undefined;
32
82
  includeDebug?: boolean | undefined;
33
83
  }>;
34
84
  declare const recallExplainRequestSchema: z.ZodObject<{
35
85
  sessionKey: z.ZodOptional<z.ZodString>;
36
86
  namespace: z.ZodOptional<z.ZodString>;
37
87
  }, "strip", z.ZodTypeAny, {
38
- namespace?: string | undefined;
39
88
  sessionKey?: string | undefined;
40
- }, {
41
89
  namespace?: string | undefined;
90
+ }, {
42
91
  sessionKey?: string | undefined;
92
+ namespace?: string | undefined;
93
+ }>;
94
+ /**
95
+ * Standalone "set coding context" request. Used by the HTTP endpoint
96
+ * `POST /engram/v1/coding-context` and the MCP `remnic.set_coding_context`
97
+ * tool (PR 7). `codingContext: null` clears the attached context.
98
+ */
99
+ declare const setCodingContextRequestSchema: z.ZodObject<{
100
+ sessionKey: z.ZodString;
101
+ codingContext: z.ZodNullable<z.ZodObject<{
102
+ projectId: z.ZodString;
103
+ branch: z.ZodNullable<z.ZodString>;
104
+ rootPath: z.ZodString;
105
+ defaultBranch: z.ZodNullable<z.ZodString>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ projectId: string;
108
+ branch: string | null;
109
+ rootPath: string;
110
+ defaultBranch: string | null;
111
+ }, {
112
+ projectId: string;
113
+ branch: string | null;
114
+ rootPath: string;
115
+ defaultBranch: string | null;
116
+ }>>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ sessionKey: string;
119
+ codingContext: {
120
+ projectId: string;
121
+ branch: string | null;
122
+ rootPath: string;
123
+ defaultBranch: string | null;
124
+ } | null;
125
+ }, {
126
+ sessionKey: string;
127
+ codingContext: {
128
+ projectId: string;
129
+ branch: string | null;
130
+ rootPath: string;
131
+ defaultBranch: string | null;
132
+ } | null;
43
133
  }>;
44
134
  declare const observeRequestSchema: z.ZodObject<{
45
135
  sessionKey: z.ZodString;
@@ -78,7 +168,7 @@ declare const memoryStoreRequestSchema: z.ZodObject<{
78
168
  dryRun: z.ZodOptional<z.ZodBoolean>;
79
169
  sessionKey: z.ZodOptional<z.ZodString>;
80
170
  content: z.ZodString;
81
- category: z.ZodOptional<z.ZodEnum<["fact", "preference", "correction", "entity", "decision", "relationship", "principle", "commitment", "moment", "skill", "rule", "procedure"]>>;
171
+ category: z.ZodOptional<z.ZodEnum<["fact", "preference", "correction", "entity", "decision", "relationship", "principle", "commitment", "moment", "skill", "rule", "procedure", "reasoning_trace"]>>;
82
172
  confidence: z.ZodOptional<z.ZodNumber>;
83
173
  namespace: z.ZodOptional<z.ZodString>;
84
174
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -87,28 +177,28 @@ declare const memoryStoreRequestSchema: z.ZodObject<{
87
177
  sourceReason: z.ZodOptional<z.ZodString>;
88
178
  }, "strip", z.ZodTypeAny, {
89
179
  content: string;
90
- namespace?: string | undefined;
91
- category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | undefined;
92
- confidence?: number | undefined;
93
- ttl?: string | undefined;
94
180
  schemaVersion?: number | undefined;
95
181
  sessionKey?: string | undefined;
96
182
  tags?: string[] | undefined;
183
+ namespace?: string | undefined;
184
+ category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
185
+ confidence?: number | undefined;
97
186
  entityRef?: string | undefined;
98
187
  dryRun?: boolean | undefined;
188
+ ttl?: string | undefined;
99
189
  sourceReason?: string | undefined;
100
190
  idempotencyKey?: string | undefined;
101
191
  }, {
102
192
  content: string;
103
- namespace?: string | undefined;
104
- category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | undefined;
105
- confidence?: number | undefined;
106
- ttl?: string | undefined;
107
193
  schemaVersion?: number | undefined;
108
194
  sessionKey?: string | undefined;
109
195
  tags?: string[] | undefined;
196
+ namespace?: string | undefined;
197
+ category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
198
+ confidence?: number | undefined;
110
199
  entityRef?: string | undefined;
111
200
  dryRun?: boolean | undefined;
201
+ ttl?: string | undefined;
112
202
  sourceReason?: string | undefined;
113
203
  idempotencyKey?: string | undefined;
114
204
  }>;
@@ -118,7 +208,7 @@ declare const suggestionSubmitRequestSchema: z.ZodObject<{
118
208
  dryRun: z.ZodOptional<z.ZodBoolean>;
119
209
  sessionKey: z.ZodOptional<z.ZodString>;
120
210
  content: z.ZodString;
121
- category: z.ZodOptional<z.ZodEnum<["fact", "preference", "correction", "entity", "decision", "relationship", "principle", "commitment", "moment", "skill", "rule", "procedure"]>>;
211
+ category: z.ZodOptional<z.ZodEnum<["fact", "preference", "correction", "entity", "decision", "relationship", "principle", "commitment", "moment", "skill", "rule", "procedure", "reasoning_trace"]>>;
122
212
  confidence: z.ZodOptional<z.ZodNumber>;
123
213
  namespace: z.ZodOptional<z.ZodString>;
124
214
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -127,28 +217,28 @@ declare const suggestionSubmitRequestSchema: z.ZodObject<{
127
217
  sourceReason: z.ZodOptional<z.ZodString>;
128
218
  }, "strip", z.ZodTypeAny, {
129
219
  content: string;
130
- namespace?: string | undefined;
131
- category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | undefined;
132
- confidence?: number | undefined;
133
- ttl?: string | undefined;
134
220
  schemaVersion?: number | undefined;
135
221
  sessionKey?: string | undefined;
136
222
  tags?: string[] | undefined;
223
+ namespace?: string | undefined;
224
+ category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
225
+ confidence?: number | undefined;
137
226
  entityRef?: string | undefined;
138
227
  dryRun?: boolean | undefined;
228
+ ttl?: string | undefined;
139
229
  sourceReason?: string | undefined;
140
230
  idempotencyKey?: string | undefined;
141
231
  }, {
142
232
  content: string;
143
- namespace?: string | undefined;
144
- category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | undefined;
145
- confidence?: number | undefined;
146
- ttl?: string | undefined;
147
233
  schemaVersion?: number | undefined;
148
234
  sessionKey?: string | undefined;
149
235
  tags?: string[] | undefined;
236
+ namespace?: string | undefined;
237
+ category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
238
+ confidence?: number | undefined;
150
239
  entityRef?: string | undefined;
151
240
  dryRun?: boolean | undefined;
241
+ ttl?: string | undefined;
152
242
  sourceReason?: string | undefined;
153
243
  idempotencyKey?: string | undefined;
154
244
  }>;
@@ -180,17 +270,17 @@ declare const trustZonePromoteRequestSchema: z.ZodObject<{
180
270
  recordId: string;
181
271
  targetZone: "working" | "trusted";
182
272
  promotionReason: string;
183
- namespace?: string | undefined;
184
273
  recordedAt?: string | undefined;
185
274
  summary?: string | undefined;
275
+ namespace?: string | undefined;
186
276
  dryRun?: boolean | undefined;
187
277
  }, {
188
278
  recordId: string;
189
279
  targetZone: "working" | "trusted";
190
280
  promotionReason: string;
191
- namespace?: string | undefined;
192
281
  recordedAt?: string | undefined;
193
282
  summary?: string | undefined;
283
+ namespace?: string | undefined;
194
284
  dryRun?: boolean | undefined;
195
285
  }>;
196
286
  declare const trustZoneDemoSeedRequestSchema: z.ZodObject<{
@@ -199,13 +289,13 @@ declare const trustZoneDemoSeedRequestSchema: z.ZodObject<{
199
289
  dryRun: z.ZodOptional<z.ZodBoolean>;
200
290
  namespace: z.ZodOptional<z.ZodString>;
201
291
  }, "strip", z.ZodTypeAny, {
202
- namespace?: string | undefined;
203
292
  recordedAt?: string | undefined;
293
+ namespace?: string | undefined;
204
294
  dryRun?: boolean | undefined;
205
295
  scenario?: string | undefined;
206
296
  }, {
207
- namespace?: string | undefined;
208
297
  recordedAt?: string | undefined;
298
+ namespace?: string | undefined;
209
299
  dryRun?: boolean | undefined;
210
300
  scenario?: string | undefined;
211
301
  }>;
@@ -216,30 +306,31 @@ declare const lcmSearchRequestSchema: z.ZodObject<{
216
306
  limit: z.ZodOptional<z.ZodNumber>;
217
307
  }, "strip", z.ZodTypeAny, {
218
308
  query: string;
309
+ sessionKey?: string | undefined;
219
310
  namespace?: string | undefined;
220
311
  limit?: number | undefined;
221
- sessionKey?: string | undefined;
222
312
  }, {
223
313
  query: string;
314
+ sessionKey?: string | undefined;
224
315
  namespace?: string | undefined;
225
316
  limit?: number | undefined;
226
- sessionKey?: string | undefined;
227
317
  }>;
228
318
  declare const daySummaryRequestSchema: z.ZodObject<{
229
319
  memories: z.ZodOptional<z.ZodString>;
230
320
  sessionKey: z.ZodOptional<z.ZodString>;
231
321
  namespace: z.ZodOptional<z.ZodString>;
232
322
  }, "strip", z.ZodTypeAny, {
233
- namespace?: string | undefined;
234
323
  sessionKey?: string | undefined;
324
+ namespace?: string | undefined;
235
325
  memories?: string | undefined;
236
326
  }, {
237
- namespace?: string | undefined;
238
327
  sessionKey?: string | undefined;
328
+ namespace?: string | undefined;
239
329
  memories?: string | undefined;
240
330
  }>;
241
331
  type RecallRequest = z.infer<typeof recallRequestSchema>;
242
332
  type RecallExplainRequest = z.infer<typeof recallExplainRequestSchema>;
333
+ type SetCodingContextRequest = z.infer<typeof setCodingContextRequestSchema>;
243
334
  type ObserveRequest = z.infer<typeof observeRequestSchema>;
244
335
  type MemoryStoreRequest = z.infer<typeof memoryStoreRequestSchema>;
245
336
  type SuggestionSubmitRequest = z.infer<typeof suggestionSubmitRequestSchema>;
@@ -248,8 +339,8 @@ type TrustZonePromoteRequest = z.infer<typeof trustZonePromoteRequestSchema>;
248
339
  type TrustZoneDemoSeedRequest = z.infer<typeof trustZoneDemoSeedRequestSchema>;
249
340
  type LcmSearchRequest = z.infer<typeof lcmSearchRequestSchema>;
250
341
  type DaySummaryRequest = z.infer<typeof daySummaryRequestSchema>;
251
- type SchemaName = "recall" | "recallExplain" | "observe" | "memoryStore" | "suggestionSubmit" | "reviewDisposition" | "trustZonePromote" | "trustZoneDemoSeed" | "lcmSearch" | "daySummary";
252
- type SchemaTypeFor<N extends SchemaName> = N extends "recall" ? RecallRequest : N extends "recallExplain" ? RecallExplainRequest : N extends "observe" ? ObserveRequest : N extends "memoryStore" ? MemoryStoreRequest : N extends "suggestionSubmit" ? SuggestionSubmitRequest : N extends "reviewDisposition" ? ReviewDispositionRequest : N extends "trustZonePromote" ? TrustZonePromoteRequest : N extends "trustZoneDemoSeed" ? TrustZoneDemoSeedRequest : N extends "lcmSearch" ? LcmSearchRequest : N extends "daySummary" ? DaySummaryRequest : never;
342
+ type SchemaName = "recall" | "recallExplain" | "setCodingContext" | "observe" | "memoryStore" | "suggestionSubmit" | "reviewDisposition" | "trustZonePromote" | "trustZoneDemoSeed" | "lcmSearch" | "daySummary";
343
+ type SchemaTypeFor<N extends SchemaName> = N extends "recall" ? RecallRequest : N extends "recallExplain" ? RecallExplainRequest : N extends "setCodingContext" ? SetCodingContextRequest : N extends "observe" ? ObserveRequest : N extends "memoryStore" ? MemoryStoreRequest : N extends "suggestionSubmit" ? SuggestionSubmitRequest : N extends "reviewDisposition" ? ReviewDispositionRequest : N extends "trustZonePromote" ? TrustZonePromoteRequest : N extends "trustZoneDemoSeed" ? TrustZoneDemoSeedRequest : N extends "lcmSearch" ? LcmSearchRequest : N extends "daySummary" ? DaySummaryRequest : never;
253
344
  /**
254
345
  * Validate a request body against the named schema.
255
346
  * Returns `{ success: true, data }` on pass or
@@ -263,4 +354,4 @@ declare function validateRequest<T = unknown>(schemaName: SchemaName, body: unkn
263
354
  error: SchemaValidationError;
264
355
  };
265
356
 
266
- export { type DaySummaryRequest, type LcmSearchRequest, type MemoryStoreRequest, type ObserveRequest, type RecallExplainRequest, type RecallRequest, type ReviewDispositionRequest, type SchemaName, type SchemaTypeFor, type SchemaValidationError, type SuggestionSubmitRequest, type TrustZoneDemoSeedRequest, type TrustZonePromoteRequest, daySummaryRequestSchema, formatZodError, lcmSearchRequestSchema, memoryStoreRequestSchema, observeRequestSchema, recallExplainRequestSchema, recallRequestSchema, reviewDispositionRequestSchema, suggestionSubmitRequestSchema, trustZoneDemoSeedRequestSchema, trustZonePromoteRequestSchema, validateRequest };
357
+ export { type DaySummaryRequest, type LcmSearchRequest, type MemoryStoreRequest, type ObserveRequest, type RecallExplainRequest, type RecallRequest, type ReviewDispositionRequest, type SchemaName, type SchemaTypeFor, type SchemaValidationError, type SetCodingContextRequest, type SuggestionSubmitRequest, type TrustZoneDemoSeedRequest, type TrustZonePromoteRequest, codingContextSchema, daySummaryRequestSchema, formatZodError, lcmSearchRequestSchema, memoryStoreRequestSchema, observeRequestSchema, recallExplainRequestSchema, recallRequestSchema, reviewDispositionRequestSchema, setCodingContextRequestSchema, suggestionSubmitRequestSchema, trustZoneDemoSeedRequestSchema, trustZonePromoteRequestSchema, validateRequest };
@@ -1,4 +1,5 @@
1
1
  import {
2
+ codingContextSchema,
2
3
  daySummaryRequestSchema,
3
4
  formatZodError,
4
5
  lcmSearchRequestSchema,
@@ -7,12 +8,14 @@ import {
7
8
  recallExplainRequestSchema,
8
9
  recallRequestSchema,
9
10
  reviewDispositionRequestSchema,
11
+ setCodingContextRequestSchema,
10
12
  suggestionSubmitRequestSchema,
11
13
  trustZoneDemoSeedRequestSchema,
12
14
  trustZonePromoteRequestSchema,
13
15
  validateRequest
14
- } from "./chunk-MTLYEMJB.js";
16
+ } from "./chunk-WCLICCGB.js";
15
17
  export {
18
+ codingContextSchema,
16
19
  daySummaryRequestSchema,
17
20
  formatZodError,
18
21
  lcmSearchRequestSchema,
@@ -21,6 +24,7 @@ export {
21
24
  recallExplainRequestSchema,
22
25
  recallRequestSchema,
23
26
  reviewDispositionRequestSchema,
27
+ setCodingContextRequestSchema,
24
28
  suggestionSubmitRequestSchema,
25
29
  trustZoneDemoSeedRequestSchema,
26
30
  trustZonePromoteRequestSchema,
@@ -1,80 +1,80 @@
1
- import { DaySummaryResult, RecallPlanMode, MemoryFile, MemoryLifecycleEvent, EntityFile, MemoryStatus, PluginConfig } from './types.js';
1
+ import { StorageManager } from './storage.js';
2
+ import { RecallXraySnapshot } from './recall-xray.js';
3
+ import { RecallExplainJsonPayload } from './recall-explain-renderer.js';
4
+ import { PluginConfig, DaySummaryResult, RecallPlanMode, MemoryFile, MemoryLifecycleEvent, EntityFile, MemoryStatus } from './types.js';
5
+ import { AnomalyDetectorResult } from './recall-audit-anomaly.js';
2
6
  import { ExplicitCaptureInput } from './explicit-capture.js';
7
+ import { BudgetDecision } from './cross-namespace-budget.js';
3
8
  import { r as readMemoryGovernanceRunArtifact } from './memory-projection-store-DeSXPh1j.js';
4
9
  import { LastRecallSnapshot } from './recall-state.js';
5
- import { O as Orchestrator, I as IntentDebugSnapshot, G as GraphRecallSnapshot } from './orchestrator-DRYA6_lW.js';
6
- import { StorageManager } from './storage.js';
10
+ import { O as Orchestrator, I as IntentDebugSnapshot, G as GraphRecallSnapshot, S as SemanticDedupLookup } from './orchestrator-CmJ-NTdJ.js';
7
11
  import { TrustZoneStoreStatus, TrustZoneName, TrustZoneRecordKind, TrustZoneSourceClass, TrustZoneProvenanceScore, TrustZonePromotionResult, TrustZoneDemoSeedResult } from './trust-zones.js';
8
12
  import { LocalLlmClient } from './local-llm.js';
9
13
  import { FallbackLlmClient } from './fallback-llm.js';
14
+ import { MemoryOutcomeKind, RecordMemoryOutcomeResult } from './memory-worth-outcomes.js';
10
15
 
11
16
  /**
12
- * @remnic/core Write-time semantic dedup guard
13
- *
14
- * Complements the exact content-hash check in the orchestrator's write path
15
- * by detecting near-duplicate candidate facts via embedding cosine similarity.
17
+ * Procedural memory stats surface (issue #567 PR 5/5).
16
18
  *
17
- * The module intentionally has no dependency on the EmbeddingFallback or QMD
18
- * classes directly callers pass in a `lookup` function that returns the
19
- * top-K nearest neighbors with their cosine scores. This keeps the decision
20
- * logic pure and trivially testable with synthetic fixtures, and lets the
21
- * orchestrator reuse whichever backend it already has wired up.
19
+ * Pure helper that tallies procedure memories by status and summarizes the
20
+ * current `procedural.*` config so operators (and the dashboard) can see,
21
+ * in one call, how procedural memory is behaving in a namespace.
22
22
  *
23
- * Related issue: joshuaswarren/remnic#373
23
+ * Consumed by:
24
+ * - CLI `remnic procedural stats`
25
+ * - HTTP `GET /engram/v1/procedural/stats`
26
+ * - MCP `remnic.procedural_stats` (+ `engram.procedural_stats` alias)
24
27
  */
25
- /** A single nearest-neighbor hit from the embedding backend. */
26
- interface SemanticDedupHit {
27
- /** Memory id of the existing neighbor. */
28
- id: string;
29
- /** Cosine similarity score in [0, 1]. */
30
- score: number;
31
- /** Optional source path, purely informational. */
32
- path?: string;
28
+
29
+ interface ProcedureStatusCounts {
30
+ total: number;
31
+ active: number;
32
+ pending_review: number;
33
+ rejected: number;
34
+ quarantined: number;
35
+ superseded: number;
36
+ archived: number;
37
+ /** Any status the enum doesn't yet cover. */
38
+ other: number;
39
+ }
40
+ interface ProcedureStatsConfigSnapshot {
41
+ enabled: boolean;
42
+ minOccurrences: number;
43
+ successFloor: number;
44
+ autoPromoteOccurrences: number;
45
+ autoPromoteEnabled: boolean;
46
+ lookbackDays: number;
47
+ recallMaxProcedures: number;
48
+ }
49
+ interface ProcedureStatsRecent {
50
+ /** ISO 8601 timestamp of the most recent procedure write, or null. */
51
+ lastWriteAt: string | null;
52
+ /** Count of procedure files with `created` (or `updated`) in the last 7 days. */
53
+ writesLast7Days: number;
54
+ /** Count of procedures whose `source` is the procedure miner. */
55
+ minerSourced: number;
56
+ }
57
+ interface ProcedureStatsReport {
58
+ schemaVersion: 1;
59
+ generatedAt: string;
60
+ counts: ProcedureStatusCounts;
61
+ recent: ProcedureStatsRecent;
62
+ config: ProcedureStatsConfigSnapshot;
33
63
  }
34
64
  /**
35
- * Lookup function passed by the caller. Must return an array of hits sorted
36
- * descending by score. Implementations should return an empty array (never
37
- * throw) when the embedding backend is unavailable — the decision function
38
- * treats that as "no near duplicate" (fail-open).
65
+ * Read all memories from storage and tally procedures by status + recency.
66
+ * `nowMs` is injectable so tests can pin the "last 7 days" window.
39
67
  */
40
- type SemanticDedupLookup = (content: string, limit: number) => Promise<SemanticDedupHit[]>;
41
- interface SemanticDedupOptions {
42
- /** Master switch. When false, `decideSemanticDedup` always returns `keep`. */
43
- enabled: boolean;
44
- /** Cosine similarity threshold (0-1). ≥ threshold ⇒ treat as duplicate. */
45
- threshold: number;
46
- /** How many nearest neighbors to compare against. */
47
- candidates: number;
48
- }
49
- type SemanticDedupDecision = {
50
- action: "keep";
51
- reason: "disabled" | "backend_unavailable" | "no_candidates" | "no_near_duplicate";
52
- topScore?: number;
53
- topId?: string;
54
- } | {
55
- action: "skip";
56
- reason: "near_duplicate";
57
- topScore: number;
58
- topId: string;
59
- topPath?: string;
60
- };
68
+ declare function computeProcedureStats(options: {
69
+ storage: StorageManager;
70
+ config: PluginConfig;
71
+ nowMs?: number;
72
+ }): Promise<ProcedureStatsReport>;
61
73
  /**
62
- * Pure decision function: given a lookup callback and options, decide whether
63
- * the candidate content should be written or skipped as a near-duplicate.
64
- *
65
- * Contract:
66
- * - When `options.enabled` is false → always keep, reason="disabled".
67
- * - When the lookup throws (provider down / network error) → keep,
68
- * reason="backend_unavailable". Fail-open: a lookup failure must not block
69
- * writes.
70
- * - When the lookup succeeds but returns 0 hits (empty index or no
71
- * neighbors above the score floor) → keep, reason="no_candidates".
72
- * This is distinct from backend_unavailable so telemetry dashboards can
73
- * correctly distinguish "provider is down" from "index is empty".
74
- * - When the top hit's score ≥ threshold → skip with reason="near_duplicate".
75
- * - Otherwise → keep with reason="no_near_duplicate".
74
+ * Render `ProcedureStatsReport` as a human-friendly plain-text block for CLI
75
+ * operators. Keep it deterministic no colors, no ANSI. Used by `--format text`.
76
76
  */
77
- declare function decideSemanticDedup(content: string, lookup: SemanticDedupLookup, options: SemanticDedupOptions): Promise<SemanticDedupDecision>;
77
+ declare function formatProcedureStatsText(report: ProcedureStatsReport): string;
78
78
 
79
79
  declare class EngramAccessInputError extends Error {
80
80
  }
@@ -96,6 +96,34 @@ interface EngramAccessRecallRequest {
96
96
  topK?: number;
97
97
  mode?: RecallPlanMode | "auto";
98
98
  includeDebug?: boolean;
99
+ /**
100
+ * Coding-agent context (issue #569). When a connector resolves a git
101
+ * context for the session's cwd, it passes it here and the access service
102
+ * attaches it to the orchestrator before recall so project- / branch-
103
+ * scoped namespace overlays apply.
104
+ *
105
+ * Keyed by `sessionKey`; ignored when `sessionKey` is absent.
106
+ */
107
+ codingContext?: {
108
+ projectId: string;
109
+ branch: string | null;
110
+ rootPath: string;
111
+ defaultBranch: string | null;
112
+ } | null;
113
+ }
114
+ /**
115
+ * Standalone request to attach / clear the coding context for a session
116
+ * without performing a recall. Used by the Claude Code / Codex connectors
117
+ * at session start, and by the `remnic.set_coding_context` MCP tool (PR 7).
118
+ */
119
+ interface EngramAccessSetCodingContextRequest {
120
+ sessionKey: string;
121
+ codingContext: {
122
+ projectId: string;
123
+ branch: string | null;
124
+ rootPath: string;
125
+ defaultBranch: string | null;
126
+ } | null;
99
127
  }
100
128
  interface EngramAccessRecallResponse {
101
129
  query: string;
@@ -111,6 +139,8 @@ interface EngramAccessRecallResponse {
111
139
  fallbackUsed: boolean;
112
140
  sourcesUsed: string[];
113
141
  budgetsApplied?: LastRecallSnapshot["budgetsApplied"];
142
+ auditAnomalies?: AnomalyDetectorResult;
143
+ budgetWarning?: BudgetDecision;
114
144
  latencyMs?: number;
115
145
  debug?: {
116
146
  snapshot?: LastRecallSnapshot;
@@ -424,6 +454,8 @@ declare class EngramAccessService {
424
454
  private readonly orchestrator;
425
455
  private readonly idempotency;
426
456
  private readonly idempotencyLocks;
457
+ private readonly budget;
458
+ private readonly auditAdapter;
427
459
  constructor(orchestrator: Orchestrator);
428
460
  get briefingEnabled(): boolean;
429
461
  private resolveNamespace;
@@ -444,8 +476,39 @@ declare class EngramAccessService {
444
476
  * or Responses API is unavailable — never throws for LLM-related problems.
445
477
  */
446
478
  briefing(request: EngramAccessBriefingRequest): Promise<EngramAccessBriefingResponse>;
479
+ /**
480
+ * Attach a coding context to a session (issue #569). Used by the Claude
481
+ * Code / Codex / generic-MCP connectors at session start so that recall +
482
+ * write paths can route to a project- / branch-scoped namespace.
483
+ *
484
+ * Validates the input shape and rejects malformed payloads rather than
485
+ * silently accepting them (CLAUDE.md #51). Pass `codingContext: null` to
486
+ * clear.
487
+ */
488
+ setCodingContext(request: EngramAccessSetCodingContextRequest): void;
447
489
  recall(request: EngramAccessRecallRequest): Promise<EngramAccessRecallResponse>;
448
490
  recallExplain(request?: EngramAccessRecallExplainRequest): Promise<EngramAccessRecallExplainResponse>;
491
+ recallTierExplain(sessionKey?: string, namespace?: string, authenticatedPrincipal?: string): Promise<RecallExplainJsonPayload>;
492
+ /**
493
+ * Recall X-ray (issue #570). Runs a recall with `xrayCapture: true`
494
+ * and returns the resulting snapshot as structured JSON so every
495
+ * surface (CLI / HTTP / MCP) gets the same payload. Namespace scope
496
+ * is enforced before the recall fires (CLAUDE.md rule 42 — read and
497
+ * write paths must resolve through the same namespace layer) so an
498
+ * unauthorized principal cannot capture an x-ray for a namespace it
499
+ * cannot read.
500
+ */
501
+ recallXray(request: {
502
+ query: string;
503
+ sessionKey?: string;
504
+ namespace?: string;
505
+ budget?: number;
506
+ authenticatedPrincipal?: string;
507
+ }): Promise<{
508
+ snapshotFound: boolean;
509
+ snapshot?: RecallXraySnapshot;
510
+ }>;
511
+ private xrayQueue;
449
512
  memoryStore(request: EngramAccessMemoryStoreRequest): Promise<EngramAccessWriteResponse>;
450
513
  peekMemoryStoreIdempotency(request: EngramAccessMemoryStoreRequest): Promise<EngramAccessIdempotencyStatus>;
451
514
  suggestionSubmit(request: EngramAccessSuggestionSubmitRequest): Promise<EngramAccessWriteResponse>;
@@ -491,6 +554,16 @@ declare class EngramAccessService {
491
554
  proceduresWritten: number;
492
555
  skippedReason?: string;
493
556
  }>;
557
+ /**
558
+ * Procedural memory stats (issue #567 PR 5/5). Read-only — resolves the
559
+ * namespace via the same path used by `recallExplain` / `trustZoneStatus`
560
+ * so cross-tenant reads are impossible (CLAUDE.md rule 42).
561
+ */
562
+ procedureStats(request?: {
563
+ namespace?: string;
564
+ }, principal?: string): Promise<ProcedureStatsReport & {
565
+ namespace: string;
566
+ }>;
494
567
  trustZoneStatus(namespace?: string, principal?: string): Promise<EngramAccessTrustZoneStatusResponse>;
495
568
  trustZoneBrowse(request: EngramAccessTrustZoneBrowseRequest, principal?: string): Promise<EngramAccessTrustZoneBrowseResponse>;
496
569
  trustZonePromote(request: EngramAccessTrustZonePromoteRequest): Promise<EngramAccessTrustZonePromoteResponse>;
@@ -685,6 +758,28 @@ declare class EngramAccessService {
685
758
  enabled?: boolean;
686
759
  reason?: string;
687
760
  }>;
761
+ /**
762
+ * Record a Memory Worth outcome observation (issue #560 PR 3).
763
+ *
764
+ * This is distinct from `memoryFeedback` — feedback is a human thumbs
765
+ * up/down on whether a recalled memory was relevant; outcome is an
766
+ * automated signal about whether the session that consumed the memory
767
+ * ultimately succeeded or failed. Outcomes feed the Laplace-smoothed
768
+ * worth score (`computeMemoryWorth`, PR 2) that PR 4 will use to
769
+ * downweight memories correlated with bad sessions.
770
+ *
771
+ * The underlying writer only touches fact-category memories. Corrections,
772
+ * procedures, and other kinds return `{ ok: false, reason:
773
+ * "ineligible_category" }` so a ledger drainer doesn't need to pre-filter.
774
+ */
775
+ memoryOutcome(request: {
776
+ memoryId: string;
777
+ outcome: MemoryOutcomeKind;
778
+ namespace?: string;
779
+ principal?: string;
780
+ sessionKey?: string;
781
+ timestamp?: string;
782
+ }): Promise<RecordMemoryOutcomeResult>;
688
783
  memoryPromote(request: {
689
784
  memoryId: string;
690
785
  namespace?: string;
@@ -726,7 +821,7 @@ declare class EngramAccessService {
726
821
  get configRef(): PluginConfig;
727
822
  get localLlmRef(): LocalLlmClient | null;
728
823
  get fallbackLlmRef(): FallbackLlmClient | null;
729
- get embeddingLookupRef(): SemanticDedupLookup | undefined;
824
+ get embeddingLookupFactoryRef(): (storage: StorageManager) => SemanticDedupLookup | undefined;
730
825
  }
731
826
 
732
- export { type EngramAccessRecallExplainRequest as A, type EngramAccessRecallExplainResponse as B, type EngramAccessRecallRequest as C, type EngramAccessRecallResponse as D, EngramAccessService as E, type EngramAccessReviewDispositionRequest as F, type EngramAccessReviewDispositionResponse as G, type EngramAccessReviewQueueResponse as H, type EngramAccessSuggestionSubmitRequest as I, type EngramAccessTimelineResponse as J, type EngramAccessTrustZoneBrowseRequest as K, type EngramAccessTrustZoneBrowseResponse as L, type EngramAccessTrustZoneDemoSeedRequest as M, type EngramAccessTrustZoneDemoSeedResponse as N, type EngramAccessTrustZonePromoteRequest as O, type EngramAccessTrustZonePromoteResponse as P, type EngramAccessTrustZoneRecordSummary as Q, type EngramAccessTrustZoneStatusResponse as R, type SemanticDedupDecision as S, type EngramAccessWriteEnvelope as T, type EngramAccessWriteResponse as U, EngramAccessInputError as a, type SemanticDedupHit as b, type SemanticDedupLookup as c, type SemanticDedupOptions as d, decideSemanticDedup as e, ENGRAM_ACCESS_WRITE_SCHEMA_VERSION as f, type EngramAccessBriefingRequest as g, type EngramAccessBriefingResponse as h, type EngramAccessDaySummaryRequest as i, type EngramAccessEntityListResponse as j, type EngramAccessEntityResponse as k, type EngramAccessEntitySummary as l, type EngramAccessHealthResponse as m, type EngramAccessLcmSearchRequest as n, type EngramAccessLcmSearchResponse as o, type EngramAccessLcmStatusResponse as p, type EngramAccessMaintenanceResponse as q, type EngramAccessMemoryBrowseRequest as r, type EngramAccessMemoryBrowseResponse as s, type EngramAccessMemoryRecord as t, type EngramAccessMemoryResponse as u, type EngramAccessMemoryStoreRequest as v, type EngramAccessMemorySummary as w, type EngramAccessObserveRequest as x, type EngramAccessObserveResponse as y, type EngramAccessQualityResponse as z };
827
+ export { type EngramAccessQualityResponse as A, type EngramAccessRecallExplainRequest as B, type EngramAccessRecallExplainResponse as C, type EngramAccessRecallRequest as D, EngramAccessService as E, type EngramAccessRecallResponse as F, type EngramAccessReviewDispositionRequest as G, type EngramAccessReviewDispositionResponse as H, type EngramAccessReviewQueueResponse as I, type EngramAccessSetCodingContextRequest as J, type EngramAccessSuggestionSubmitRequest as K, type EngramAccessTimelineResponse as L, type EngramAccessTrustZoneBrowseRequest as M, type EngramAccessTrustZoneBrowseResponse as N, type EngramAccessTrustZoneDemoSeedRequest as O, type ProcedureStatsConfigSnapshot as P, type EngramAccessTrustZoneDemoSeedResponse as Q, type EngramAccessTrustZonePromoteRequest as R, type EngramAccessTrustZonePromoteResponse as S, type EngramAccessTrustZoneRecordSummary as T, type EngramAccessTrustZoneStatusResponse as U, type EngramAccessWriteEnvelope as V, type EngramAccessWriteResponse as W, EngramAccessInputError as a, type ProcedureStatsRecent as b, type ProcedureStatsReport as c, type ProcedureStatusCounts as d, computeProcedureStats as e, formatProcedureStatsText as f, ENGRAM_ACCESS_WRITE_SCHEMA_VERSION as g, type EngramAccessBriefingRequest as h, type EngramAccessBriefingResponse as i, type EngramAccessDaySummaryRequest as j, type EngramAccessEntityListResponse as k, type EngramAccessEntityResponse as l, type EngramAccessEntitySummary as m, type EngramAccessHealthResponse as n, type EngramAccessLcmSearchRequest as o, type EngramAccessLcmSearchResponse as p, type EngramAccessLcmStatusResponse as q, type EngramAccessMaintenanceResponse as r, type EngramAccessMemoryBrowseRequest as s, type EngramAccessMemoryBrowseResponse as t, type EngramAccessMemoryRecord as u, type EngramAccessMemoryResponse as v, type EngramAccessMemoryStoreRequest as w, type EngramAccessMemorySummary as x, type EngramAccessObserveRequest as y, type EngramAccessObserveResponse as z };