agentic-qe 3.11.0 → 3.11.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 (470) hide show
  1. package/.claude/commands/agents/README.md +50 -0
  2. package/.claude/commands/agents/agent-capabilities.md +140 -0
  3. package/.claude/commands/agents/agent-coordination.md +28 -0
  4. package/.claude/commands/agents/agent-spawning.md +28 -0
  5. package/.claude/commands/agents/agent-types.md +216 -0
  6. package/.claude/commands/agents/health.md +139 -0
  7. package/.claude/commands/agents/list.md +100 -0
  8. package/.claude/commands/agents/logs.md +130 -0
  9. package/.claude/commands/agents/metrics.md +122 -0
  10. package/.claude/commands/agents/pool.md +127 -0
  11. package/.claude/commands/agents/spawn.md +140 -0
  12. package/.claude/commands/agents/status.md +115 -0
  13. package/.claude/commands/agents/stop.md +102 -0
  14. package/.claude/commands/claude-flow-help.md +1 -1
  15. package/.claude/commands/coordination/README.md +9 -0
  16. package/.claude/commands/coordination/agent-spawn.md +25 -0
  17. package/.claude/commands/coordination/init.md +44 -0
  18. package/.claude/commands/coordination/orchestrate.md +43 -0
  19. package/.claude/commands/coordination/spawn.md +45 -0
  20. package/.claude/commands/coordination/swarm-init.md +85 -0
  21. package/.claude/commands/coordination/task-orchestrate.md +25 -0
  22. package/.claude/commands/github/code-review-swarm.md +1 -1
  23. package/.claude/commands/github/issue-tracker.md +3 -3
  24. package/.claude/commands/github/release-manager.md +5 -3
  25. package/.claude/commands/github/release-swarm.md +1 -1
  26. package/.claude/commands/github/repo-architect.md +2 -2
  27. package/.claude/commands/github/swarm-issue.md +4 -1
  28. package/.claude/commands/github/swarm-pr.md +6 -3
  29. package/.claude/commands/github/sync-coordinator.md +3 -1
  30. package/.claude/commands/github/workflow-automation.md +2 -2
  31. package/.claude/commands/hive-mind/README.md +17 -0
  32. package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
  33. package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
  34. package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
  35. package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
  36. package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
  37. package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
  38. package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
  39. package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
  40. package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
  41. package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
  42. package/.claude/commands/hive-mind/hive-mind.md +27 -0
  43. package/.claude/commands/memory/README.md +9 -0
  44. package/.claude/commands/memory/memory-persist.md +25 -0
  45. package/.claude/commands/memory/memory-search.md +25 -0
  46. package/.claude/commands/memory/memory-usage.md +25 -0
  47. package/.claude/commands/memory/neural.md +47 -0
  48. package/.claude/commands/swarm/README.md +15 -0
  49. package/.claude/commands/swarm/analysis.md +95 -0
  50. package/.claude/commands/swarm/development.md +96 -0
  51. package/.claude/commands/swarm/examples.md +168 -0
  52. package/.claude/commands/swarm/maintenance.md +102 -0
  53. package/.claude/commands/swarm/optimization.md +117 -0
  54. package/.claude/commands/swarm/research.md +136 -0
  55. package/.claude/commands/swarm/swarm-analysis.md +8 -0
  56. package/.claude/commands/swarm/swarm-background.md +8 -0
  57. package/.claude/commands/swarm/swarm-init.md +19 -0
  58. package/.claude/commands/swarm/swarm-modes.md +8 -0
  59. package/.claude/commands/swarm/swarm-monitor.md +8 -0
  60. package/.claude/commands/swarm/swarm-spawn.md +19 -0
  61. package/.claude/commands/swarm/swarm-status.md +8 -0
  62. package/.claude/commands/swarm/swarm-strategies.md +8 -0
  63. package/.claude/commands/swarm/swarm.md +87 -0
  64. package/.claude/commands/swarm/testing.md +131 -0
  65. package/.claude/commands/workflows/README.md +9 -0
  66. package/.claude/commands/workflows/development.md +78 -0
  67. package/.claude/commands/workflows/research.md +63 -0
  68. package/.claude/commands/workflows/workflow-create.md +25 -0
  69. package/.claude/commands/workflows/workflow-execute.md +25 -0
  70. package/.claude/commands/workflows/workflow-export.md +25 -0
  71. package/.claude/helpers/auto-commit.sh +1 -1
  72. package/.claude/helpers/auto-memory-hook.mjs +37 -4
  73. package/.claude/helpers/github-safe.js +90 -40
  74. package/.claude/helpers/github-setup.sh +30 -13
  75. package/.claude/helpers/hook-handler.cjs +68 -49
  76. package/.claude/helpers/intelligence.cjs +156 -27
  77. package/.claude/helpers/post-commit +1 -1
  78. package/.claude/helpers/pre-commit +1 -1
  79. package/.claude/helpers/quick-start.sh +4 -4
  80. package/.claude/helpers/router.js +70 -31
  81. package/.claude/helpers/ruflo-hook.cjs +59 -0
  82. package/.claude/helpers/session.js +28 -6
  83. package/.claude/helpers/setup-mcp.sh +3 -3
  84. package/.claude/helpers/statusline.cjs +584 -468
  85. package/.claude/helpers/statusline.js +47 -11
  86. package/.claude/skills/github-code-review/SKILL.md +2 -17
  87. package/.claude/skills/github-multi-repo/SKILL.md +4 -16
  88. package/.claude/skills/github-project-management/SKILL.md +18 -33
  89. package/.claude/skills/github-release-management/SKILL.md +4 -21
  90. package/.claude/skills/github-workflow-automation/SKILL.md +8 -26
  91. package/.claude/skills/pair-programming/SKILL.md +2 -2
  92. package/.claude/skills/qe-code-intelligence/SKILL.md +3 -0
  93. package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
  94. package/.claude/skills/skill-builder/SKILL.md +0 -103
  95. package/.claude/skills/skills-manifest.json +1 -1
  96. package/.claude/skills/sparc-methodology/SKILL.md +2 -11
  97. package/.claude/skills/stream-chain/SKILL.md +0 -3
  98. package/.claude/skills/swarm-advanced/SKILL.md +2 -5
  99. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  100. package/.claude/skills/verification-quality/SKILL.md +121 -93
  101. package/CHANGELOG.md +84 -0
  102. package/README.md +1 -0
  103. package/assets/skills/pair-programming/SKILL.md +2 -2
  104. package/assets/skills/qe-code-intelligence/SKILL.md +3 -0
  105. package/assets/skills/verification-quality/SKILL.md +121 -93
  106. package/dist/audit/witness-chain.d.ts +1 -1
  107. package/dist/audit/witness-findings.d.ts +50 -0
  108. package/dist/audit/witness-findings.js +41 -0
  109. package/dist/cli/bundle.js +5 -5
  110. package/dist/cli/chunks/adapter-LDNYC4GH.js +2 -0
  111. package/dist/cli/chunks/{agent-booster-wasm-5CSKQB4O.js → agent-booster-wasm-FNCVODUJ.js} +2 -2
  112. package/dist/cli/chunks/{agent-handler-EBV3OKTE.js → agent-handler-JK7VK37B.js} +2 -2
  113. package/dist/cli/chunks/{agent-memory-branch-RZ53YM2U.js → agent-memory-branch-EPVVJNNA.js} +2 -2
  114. package/dist/cli/chunks/aqe-learning-engine-CA4CT5Q7.js +2 -0
  115. package/dist/cli/chunks/{arena-UCP74DRO.js → arena-EH2IMSRW.js} +4 -4
  116. package/dist/cli/chunks/{arena-QWYTIQ6I.js → arena-NTHVDZTJ.js} +2 -2
  117. package/dist/cli/chunks/{audit-M4FNIX47.js → audit-ODZV2T2B.js} +2 -2
  118. package/dist/cli/chunks/base-TSDAEMT4.js +2 -0
  119. package/dist/cli/chunks/{hnswlib-node-HMZC5TXM.js → better-sqlite3-5JTP47LA.js} +2 -2
  120. package/dist/cli/chunks/{brain-handler-OY6Q2GY5.js → brain-handler-NVB6OJ25.js} +3 -3
  121. package/dist/cli/chunks/{branch-enumerator-TQWN4NIX.js → branch-enumerator-BIXSELMY.js} +2 -2
  122. package/dist/cli/chunks/{browser-2EH3RXJ2.js → browser-S2Y2W33Z.js} +2 -2
  123. package/dist/cli/chunks/browser-workflow-3HCTJBLR.js +2 -0
  124. package/dist/cli/chunks/{chunk-V6WJVFRN.js → chunk-26ZMIYSK.js} +2 -2
  125. package/dist/cli/chunks/{chunk-I2HQLBWG.js → chunk-27KNLVOY.js} +2 -2
  126. package/dist/cli/chunks/{chunk-HNSZDIQU.js → chunk-2Q65LTJN.js} +2 -2
  127. package/dist/cli/chunks/{chunk-SKL225P5.js → chunk-3ATEYGVD.js} +2 -2
  128. package/dist/cli/chunks/{chunk-LTH6XARD.js → chunk-3J3QXLWP.js} +2 -2
  129. package/dist/cli/chunks/{chunk-NQD4CMXC.js → chunk-3KTOM7NN.js} +2 -2
  130. package/dist/cli/chunks/{chunk-QCJ7YOVN.js → chunk-3NCVUFAL.js} +2 -2
  131. package/dist/cli/chunks/{chunk-ZEUUVLS2.js → chunk-42DCMEUM.js} +1 -1
  132. package/dist/cli/chunks/{chunk-2QU6C3OS.js → chunk-4FTVTAMN.js} +2 -2
  133. package/dist/cli/chunks/{chunk-QYXTESM3.js → chunk-4PYJCIRO.js} +2 -2
  134. package/dist/cli/chunks/{chunk-LFT7WYHW.js → chunk-527U4AHC.js} +2 -2
  135. package/dist/cli/chunks/{chunk-VHON5NDM.js → chunk-5AFO7ZZG.js} +3 -3
  136. package/dist/cli/chunks/{chunk-F62ZQZQQ.js → chunk-5BDVFFYF.js} +2 -2
  137. package/dist/cli/chunks/{chunk-KBVXKFDI.js → chunk-5KMGG3QW.js} +4 -4
  138. package/dist/cli/chunks/{chunk-AVKGDS6F.js → chunk-6LQIVIZB.js} +2 -2
  139. package/dist/cli/chunks/{chunk-RKDNLPZM.js → chunk-6SOGYNJG.js} +2 -2
  140. package/dist/cli/chunks/{chunk-RPYYS6BX.js → chunk-6VAFRS5N.js} +2 -2
  141. package/dist/cli/chunks/chunk-72VVTMEL.js +2 -0
  142. package/dist/cli/chunks/{chunk-AURDGQNB.js → chunk-75C5GX7D.js} +2 -2
  143. package/dist/cli/chunks/{chunk-JN3IQB4L.js → chunk-76RO2RHG.js} +1 -1
  144. package/dist/cli/chunks/{chunk-7E5NYLJT.js → chunk-7HYO76F2.js} +2 -2
  145. package/dist/cli/chunks/{chunk-R3YO3Z7I.js → chunk-7KHZZVF2.js} +4 -4
  146. package/dist/cli/chunks/{chunk-G5VE3HQW.js → chunk-7MKF52GT.js} +2 -2
  147. package/dist/cli/chunks/{chunk-TGLEREP5.js → chunk-7VM4ZUHT.js} +2 -2
  148. package/dist/cli/chunks/{chunk-XW5OXBVV.js → chunk-7XIQR6VU.js} +2 -2
  149. package/dist/cli/chunks/{chunk-XKRG2U3V.js → chunk-A4ZDKF5F.js} +1 -1
  150. package/dist/cli/chunks/{chunk-XSG4XKGO.js → chunk-AAVUZVM6.js} +2 -2
  151. package/dist/cli/chunks/{chunk-XVQUVCFR.js → chunk-AINAWVGD.js} +2 -2
  152. package/dist/cli/chunks/{chunk-PUTRXS5I.js → chunk-AK5Q2WCJ.js} +2 -2
  153. package/dist/cli/chunks/{chunk-TYS77XHV.js → chunk-AKZK46TQ.js} +2 -2
  154. package/dist/cli/chunks/{chunk-JQM64WJ2.js → chunk-ARUXFZDY.js} +1 -1
  155. package/dist/cli/chunks/{chunk-YR44KQUK.js → chunk-AYXRT2ND.js} +1 -1
  156. package/dist/cli/chunks/{chunk-ZT4NPTML.js → chunk-AZQ6HDPM.js} +2 -2
  157. package/dist/cli/chunks/{chunk-DCJIXDO6.js → chunk-BGVEBYV4.js} +2 -2
  158. package/dist/cli/chunks/{chunk-IHNBZ5XG.js → chunk-C6UTRG66.js} +2 -2
  159. package/dist/cli/chunks/{chunk-R7FHQQAV.js → chunk-CAUTOCLZ.js} +2 -2
  160. package/dist/cli/chunks/{chunk-N52ZBTPM.js → chunk-CAVBEZV4.js} +2 -2
  161. package/dist/cli/chunks/{chunk-3LP5GPGU.js → chunk-CEMROADY.js} +1 -1
  162. package/dist/cli/chunks/{chunk-IQSPL2H4.js → chunk-CMVNYVKL.js} +2 -2
  163. package/dist/cli/chunks/{chunk-7BD7DZCB.js → chunk-CUDGKSFX.js} +2 -2
  164. package/dist/cli/chunks/{chunk-D3S4SRSA.js → chunk-CZYSCUJ4.js} +2 -2
  165. package/dist/cli/chunks/{chunk-4OTA6KYJ.js → chunk-DMUQV2YU.js} +2 -2
  166. package/dist/cli/chunks/{chunk-KZE5UR4T.js → chunk-DPFLJMEI.js} +3 -3
  167. package/dist/cli/chunks/{chunk-IOQYSR5S.js → chunk-DU4GQKTH.js} +2 -2
  168. package/dist/cli/chunks/{chunk-FMKALHT3.js → chunk-EDH4H55B.js} +2 -2
  169. package/dist/cli/chunks/{chunk-NI7O3GKZ.js → chunk-EIWZDVMT.js} +3 -3
  170. package/dist/cli/chunks/{chunk-5DG6H553.js → chunk-FPZLOVEF.js} +1 -1
  171. package/dist/cli/chunks/{chunk-DV7662EZ.js → chunk-FV53RMVB.js} +1 -1
  172. package/dist/cli/chunks/{chunk-BA4WZIAQ.js → chunk-FYY7OJ6Y.js} +2 -2
  173. package/dist/cli/chunks/{chunk-5ASPEVVF.js → chunk-G4CQBQBV.js} +1 -1
  174. package/dist/cli/chunks/{chunk-GBFAQ4DW.js → chunk-G6LIQFT2.js} +1 -1
  175. package/dist/cli/chunks/{chunk-2WVLFT2I.js → chunk-H3LGBH4Y.js} +1 -1
  176. package/dist/cli/chunks/{chunk-G25YZ7Z6.js → chunk-H4ZPPHOI.js} +2 -2
  177. package/dist/cli/chunks/{chunk-C33BMWYZ.js → chunk-H5TM4KIB.js} +5 -5
  178. package/dist/cli/chunks/{chunk-72QNONO6.js → chunk-H6MBRYA7.js} +2 -2
  179. package/dist/cli/chunks/{chunk-5OJXVVTI.js → chunk-HDBJORV7.js} +2 -2
  180. package/dist/cli/chunks/{chunk-HJFQVKPI.js → chunk-I3AD523O.js} +1 -1
  181. package/dist/cli/chunks/{chunk-2BBKA5J4.js → chunk-I7UWFV6N.js} +1 -1
  182. package/dist/cli/chunks/{chunk-IFTEM672.js → chunk-IMPSB5WW.js} +2 -2
  183. package/dist/cli/chunks/{chunk-YSTWLDVD.js → chunk-IO7ZUP2G.js} +3 -3
  184. package/dist/cli/chunks/{chunk-F6Y7DTHR.js → chunk-IQOCTGA2.js} +2 -2
  185. package/dist/cli/chunks/{chunk-RVQW6CBF.js → chunk-IXYF5BZY.js} +2 -2
  186. package/dist/cli/chunks/{chunk-3J6LYF6I.js → chunk-JC4Z2ADP.js} +2 -2
  187. package/dist/cli/chunks/{chunk-T6KT63NC.js → chunk-JCH2FHJ7.js} +2 -2
  188. package/dist/cli/chunks/{chunk-7PTA7AVW.js → chunk-JDFF2QMZ.js} +1 -1
  189. package/dist/cli/chunks/{chunk-UEH6C5JA.js → chunk-JELN5XTK.js} +1 -1
  190. package/dist/cli/chunks/{chunk-Z45QDDZQ.js → chunk-JSZNI3AO.js} +1 -1
  191. package/dist/cli/chunks/{chunk-ZFP3O5FM.js → chunk-K3YM2Z3E.js} +1 -1
  192. package/dist/cli/chunks/{chunk-X2TUDGFL.js → chunk-K426HTEQ.js} +44 -44
  193. package/dist/cli/chunks/{chunk-GGSXHGWD.js → chunk-K6IQBVD7.js} +2 -2
  194. package/dist/cli/chunks/{chunk-453UDYD2.js → chunk-KEJEZY2R.js} +163 -181
  195. package/dist/cli/chunks/{chunk-MTSMFEWK.js → chunk-KFE6LB4I.js} +2 -2
  196. package/dist/cli/chunks/{chunk-DDQWW22L.js → chunk-KO3WB4SU.js} +2 -2
  197. package/dist/cli/chunks/{chunk-ETGEGMYS.js → chunk-LAY35POY.js} +3 -3
  198. package/dist/cli/chunks/{chunk-P3NV6KN3.js → chunk-LFXXA325.js} +1 -1
  199. package/dist/cli/chunks/{chunk-ZK56THZT.js → chunk-LI3T5YNC.js} +3 -3
  200. package/dist/cli/chunks/{chunk-ACV2WVMX.js → chunk-LIEA5EON.js} +1 -1
  201. package/dist/cli/chunks/{chunk-KOOY72E3.js → chunk-LRJWKFGY.js} +2 -2
  202. package/dist/cli/chunks/{chunk-Y7TBCHW4.js → chunk-LY6PTRVL.js} +2 -2
  203. package/dist/cli/chunks/{chunk-WP6XUSVW.js → chunk-MAXOIEUG.js} +1 -1
  204. package/dist/cli/chunks/{chunk-X2L4POJE.js → chunk-MN6W7ZNL.js} +1 -1
  205. package/dist/cli/chunks/{chunk-CERSTEAJ.js → chunk-NGE5YNKC.js} +2 -2
  206. package/dist/cli/chunks/{chunk-J425SQFE.js → chunk-NIW4CLN2.js} +2 -2
  207. package/dist/cli/chunks/{chunk-PJ4HSXH3.js → chunk-NPT7BYGF.js} +1 -1
  208. package/dist/cli/chunks/{chunk-HHSEIPSQ.js → chunk-NZNXEEZR.js} +1 -1
  209. package/dist/cli/chunks/{chunk-FMULOSBL.js → chunk-O3IIAIXB.js} +1 -1
  210. package/dist/cli/chunks/{chunk-ITRUZ3WE.js → chunk-OC2W7KIW.js} +2 -2
  211. package/dist/cli/chunks/{chunk-QZQGYSDG.js → chunk-OFUF3APC.js} +2 -2
  212. package/dist/cli/chunks/{chunk-MKLLB4PM.js → chunk-OU52V67H.js} +4 -4
  213. package/dist/cli/chunks/{chunk-Y7UJC5OL.js → chunk-P2RR4SW5.js} +3 -3
  214. package/dist/cli/chunks/{chunk-7Q6CMSMD.js → chunk-P3VRXQ3H.js} +3 -3
  215. package/dist/cli/chunks/{chunk-YRP73HO4.js → chunk-P5SGBQLY.js} +1 -1
  216. package/dist/cli/chunks/{chunk-MDYI4IIW.js → chunk-P7MIOTVP.js} +1 -1
  217. package/dist/cli/chunks/{chunk-B4QA3YN6.js → chunk-PFDILSVO.js} +1 -1
  218. package/dist/cli/chunks/{chunk-2ZC7S4UG.js → chunk-PPD5ZLNA.js} +2 -2
  219. package/dist/cli/chunks/{chunk-VGYUVMSN.js → chunk-QFJDR4HC.js} +2 -2
  220. package/dist/cli/chunks/{chunk-3GWSHRDA.js → chunk-QZ2GQGJX.js} +2 -2
  221. package/dist/cli/chunks/{chunk-XMZ2DHUL.js → chunk-QZLTIGLB.js} +1 -1
  222. package/dist/cli/chunks/{chunk-BEOGI5FC.js → chunk-RHSUXQNF.js} +2 -2
  223. package/dist/cli/chunks/{chunk-ISVBO4XO.js → chunk-S6BWEZKK.js} +2 -2
  224. package/dist/cli/chunks/{chunk-AYOTODUV.js → chunk-SE4S23C7.js} +1 -1
  225. package/dist/cli/chunks/{chunk-SLWJNHCR.js → chunk-TOGZ37RL.js} +2 -2
  226. package/dist/cli/chunks/{chunk-73EWPVBJ.js → chunk-UCXW24HY.js} +2 -2
  227. package/dist/cli/chunks/{chunk-JQSA6EMI.js → chunk-UQ6WB4N2.js} +2 -2
  228. package/dist/cli/chunks/{chunk-SQPDGRYR.js → chunk-UQBGA4UA.js} +1 -1
  229. package/dist/cli/chunks/{chunk-N3R3JGUY.js → chunk-VNFL2TPU.js} +1 -1
  230. package/dist/cli/chunks/{chunk-QGBXENIP.js → chunk-WARFZ626.js} +1 -1
  231. package/dist/cli/chunks/{chunk-PVBJUANU.js → chunk-WEBHFIWS.js} +2 -2
  232. package/dist/cli/chunks/{chunk-YQIMO7VJ.js → chunk-WKIYYF3G.js} +2 -2
  233. package/dist/cli/chunks/{chunk-6VQKNPGY.js → chunk-WZC4HKGZ.js} +2 -2
  234. package/dist/cli/chunks/{chunk-O6FN53HB.js → chunk-X36TZXDK.js} +1 -1
  235. package/dist/cli/chunks/{chunk-IKNDGXZZ.js → chunk-XN4G3SRU.js} +2 -2
  236. package/dist/cli/chunks/{chunk-N7MKF4F4.js → chunk-XNREA3FG.js} +1 -1
  237. package/dist/cli/chunks/{chunk-PC3VIR2A.js → chunk-XRDPGJNW.js} +2 -2
  238. package/dist/cli/chunks/{chunk-ETZ62NFD.js → chunk-XXCSJMSR.js} +1 -1
  239. package/dist/cli/chunks/{chunk-LCDRRAES.js → chunk-XY2B2BEJ.js} +2 -2
  240. package/dist/cli/chunks/{chunk-HMSPPGUF.js → chunk-XY4JS3IZ.js} +2 -2
  241. package/dist/cli/chunks/{chunk-L7GQKJLV.js → chunk-Y4M2HMPR.js} +2 -2
  242. package/dist/cli/chunks/{chunk-2TUVBEWK.js → chunk-YDPBCN7H.js} +2 -2
  243. package/dist/cli/chunks/{chunk-NBTKI2TX.js → chunk-YGR54EAA.js} +2 -2
  244. package/dist/cli/chunks/{chunk-WBQEOACC.js → chunk-YGRY2TVI.js} +2 -2
  245. package/dist/cli/chunks/{chunk-VVJXQ4FR.js → chunk-YJUJCLXV.js} +2 -2
  246. package/dist/cli/chunks/{chunk-SHW43QQV.js → chunk-YWG4LHFU.js} +2 -2
  247. package/dist/cli/chunks/{chunk-FGOVDO3R.js → chunk-Z2QNTRUX.js} +2 -2
  248. package/dist/cli/chunks/{chunk-UFMW25MS.js → chunk-ZBJMVWQR.js} +2 -2
  249. package/dist/cli/chunks/{chunk-7MBF3S25.js → chunk-ZH6HYT7C.js} +1 -1
  250. package/dist/cli/chunks/{chunk-LYV7WJWA.js → chunk-ZP2GE6DM.js} +1 -1
  251. package/dist/cli/chunks/{chunk-JNX7IRSI.js → chunk-ZQYEBLTL.js} +2 -2
  252. package/dist/cli/chunks/{chunk-FTOICJQG.js → chunk-ZRU3OZEU.js} +2 -2
  253. package/dist/cli/chunks/{chunk-OZQIDDXB.js → chunk-ZU3V4CJ4.js} +2 -2
  254. package/dist/cli/chunks/{chunk-JZFA2PWY.js → chunk-ZWMXF6AX.js} +2 -2
  255. package/dist/cli/chunks/{ci-4JK2NFCD.js → ci-SM3EVLZ4.js} +2 -2
  256. package/dist/cli/chunks/{ci-output-LCGTJQWC.js → ci-output-YYXICZBC.js} +2 -2
  257. package/dist/cli/chunks/{circuit-breaker-EJF7D3L4.js → circuit-breaker-CV5UGKXT.js} +2 -2
  258. package/dist/cli/chunks/{claude-flow-setup-3RUC6OB4.js → claude-flow-setup-BSBUZ4B7.js} +2 -2
  259. package/dist/cli/chunks/client-WRDYZGM2.js +2 -0
  260. package/dist/cli/chunks/{cline-installer-6LY5C5QH.js → cline-installer-P2O6STIC.js} +2 -2
  261. package/dist/cli/chunks/code-M7DDLBGS.js +58 -0
  262. package/dist/cli/chunks/{code-index-extractor-OY5GQJBM.js → code-index-extractor-3QZIUYOG.js} +2 -2
  263. package/dist/cli/chunks/{codex-installer-BO7E2ZVA.js → codex-installer-5JVZCCTC.js} +2 -2
  264. package/dist/cli/chunks/{completions-VGL3KJ2R.js → completions-EM7IL2BJ.js} +8 -5
  265. package/dist/cli/chunks/{complexity-analyzer-5DPUK7IL.js → complexity-analyzer-VJXVB2CV.js} +2 -2
  266. package/dist/cli/chunks/{continuedev-installer-LFDG2D42.js → continuedev-installer-RCKJIAEC.js} +2 -2
  267. package/dist/cli/chunks/{copilot-installer-SEMMMIZH.js → copilot-installer-DZ7LTDOZ.js} +2 -2
  268. package/dist/cli/chunks/core-handlers-O6E5DNHT.js +2 -0
  269. package/dist/cli/chunks/{cost-tracker-OPBC6FQM.js → cost-tracker-QLOLXVAM.js} +2 -2
  270. package/dist/cli/chunks/{coverage-CFDUSRKU.js → coverage-LYHTLWRV.js} +3 -3
  271. package/dist/cli/chunks/cross-domain-router-EV7LQMDO.js +2 -0
  272. package/dist/cli/chunks/{cursor-installer-6TXUUVY4.js → cursor-installer-PSIZ3Y53.js} +2 -2
  273. package/dist/cli/chunks/{daemon-5KO46YQR.js → daemon-IYDTMA5M.js} +4 -4
  274. package/dist/cli/chunks/{daemon-7BDBPPAF.js → daemon-YLOAXM4X.js} +3 -3
  275. package/dist/cli/chunks/{dag-attention-scheduler-6DQKZOUW.js → dag-attention-scheduler-I2UIO3Z7.js} +2 -2
  276. package/dist/cli/chunks/{detect-R2QAYDPI.js → detect-ZXQ7X7GZ.js} +2 -2
  277. package/dist/cli/chunks/{dist-node-3POCIJ4N.js → dist-node-GK6OZX4H.js} +2 -2
  278. package/dist/cli/chunks/{domain-handler-KW63CHUH.js → domain-handler-NS3IBLRQ.js} +2 -2
  279. package/dist/cli/chunks/{domain-transfer-2QPOJCUD.js → domain-transfer-5G4RZEWF.js} +2 -2
  280. package/dist/cli/chunks/dream-E4C236UL.js +2 -0
  281. package/dist/cli/chunks/{embed-and-insert-pattern-OIDJZQEP.js → embed-and-insert-pattern-V4JJUFR6.js} +2 -2
  282. package/dist/cli/chunks/{eval-UGEKTTAQ.js → eval-7Q6PPYKR.js} +2 -2
  283. package/dist/cli/chunks/{experience-capture-middleware-3BIM2TT7.js → experience-capture-middleware-DUBKSYFM.js} +3 -3
  284. package/dist/cli/chunks/{fast-paths-HCJQXB7W.js → fast-paths-IDPPMBUW.js} +2 -2
  285. package/dist/cli/chunks/{feature-flags-W4JSFBMV.js → feature-flags-EPTMAAKA.js} +2 -2
  286. package/dist/cli/chunks/{feature-flags-GDGJKLN4.js → feature-flags-KXI6FDY7.js} +2 -2
  287. package/dist/cli/chunks/{file-discovery-JMUZ4MUH.js → file-discovery-EDX2OJO7.js} +2 -2
  288. package/dist/cli/chunks/{fleet-YNNK2CKW.js → fleet-67BO3LJ4.js} +3 -3
  289. package/dist/cli/chunks/{gnn-wrapper-R2ZY6CDD.js → gnn-wrapper-YARORYT7.js} +2 -2
  290. package/dist/cli/chunks/{heartbeat-handler-OZX2EJHQ.js → heartbeat-handler-K3JGPBYR.js} +4 -4
  291. package/dist/cli/chunks/heartbeat-scheduler-WMADLDKT.js +2 -0
  292. package/dist/cli/chunks/hnsw-adapter-STRDGJ65.js +2 -0
  293. package/dist/cli/chunks/hnsw-index-DBHX3TSC.js +2 -0
  294. package/dist/cli/chunks/{hnsw-legacy-bridge-3S6TYCG3.js → hnsw-legacy-bridge-CDDRSV5E.js} +2 -2
  295. package/dist/cli/chunks/{better-sqlite3-RIBLRHJL.js → hnswlib-node-2KL54YUA.js} +2 -2
  296. package/dist/cli/chunks/{hooks-KM7WR35T.js → hooks-6SCAE6LC.js} +10 -10
  297. package/dist/cli/chunks/hybrid-router-L2K55I4T.js +2 -0
  298. package/dist/cli/chunks/{hypergraph-engine-RX53A73M.js → hypergraph-engine-I3LUMO7I.js} +2 -2
  299. package/dist/cli/chunks/{hypergraph-handler-3QQB3H3Z.js → hypergraph-handler-YAKAIVCN.js} +3 -3
  300. package/dist/cli/chunks/impact-analyzer-WMO7ZGS7.js +2 -0
  301. package/dist/cli/chunks/{init-handler-Y62RH4ZI.js → init-handler-NBKCZD7Q.js} +6 -6
  302. package/dist/cli/chunks/init-wizard-ZAB7UZZS.js +2 -0
  303. package/dist/cli/chunks/kernel-4MUFDEQI.js +2 -0
  304. package/dist/cli/chunks/{kilocode-installer-26R253L2.js → kilocode-installer-YGPJCPU3.js} +2 -2
  305. package/dist/cli/chunks/{kiro-installer-PFA5QPZZ.js → kiro-installer-JV3ONVMN.js} +2 -2
  306. package/dist/cli/chunks/knowledge-graph-GZRFGXLX.js +2 -0
  307. package/dist/cli/chunks/{learning-CQLM5ANX.js → learning-2FEZJ5CX.js} +3 -3
  308. package/dist/cli/chunks/{llm-router-QZ5PG4PF.js → llm-router-SILI4KLU.js} +4 -4
  309. package/dist/cli/chunks/llm-router-service-5ODLU5U5.js +2 -0
  310. package/dist/cli/chunks/{load-UPA6LPHM.js → load-EGXLQVR3.js} +2 -2
  311. package/dist/cli/chunks/load-test-ZDQFS5XS.js +2 -0
  312. package/dist/cli/chunks/{mcp-LSWTLAJ4.js → mcp-OJH775TL.js} +2 -2
  313. package/dist/cli/chunks/{memory-VGEYYGCG.js → memory-FNEOK4FW.js} +5 -5
  314. package/dist/cli/chunks/memory-backend-UK7SQ6ZM.js +2 -0
  315. package/dist/cli/chunks/{memory-handlers-QBURG7NA.js → memory-handlers-6LDUH3JZ.js} +2 -2
  316. package/dist/cli/chunks/{multi-model-executor-VZVFBIKC.js → multi-model-executor-ORTFWLLE.js} +2 -2
  317. package/dist/cli/chunks/{opencode-installer-PBQAXNLV.js → opencode-installer-UAQLW6XX.js} +2 -2
  318. package/dist/cli/chunks/{orchestrator-YND7JB5O.js → orchestrator-VE5KJ2V4.js} +5 -5
  319. package/dist/cli/chunks/pattern-null-store-LO2QTIBU.js +2 -0
  320. package/dist/cli/chunks/{pipeline-GM5RRUES.js → pipeline-FNMDRWTU.js} +2 -2
  321. package/dist/cli/chunks/{platform-L7OGGRSL.js → platform-MGAKRUQN.js} +2 -2
  322. package/dist/cli/chunks/{plugin-N4YAE6H5.js → plugin-YX7THX3I.js} +2 -2
  323. package/dist/cli/chunks/{prime-radiant-advanced-wasm-7D67XV6Z.js → prime-radiant-advanced-wasm-XJV4RLMK.js} +2 -2
  324. package/dist/cli/chunks/protocol-executor-JWMYQEOI.js +2 -0
  325. package/dist/cli/chunks/{protocol-handler-V2WTFU7N.js → protocol-handler-QFET442Y.js} +2 -2
  326. package/dist/cli/chunks/{prove-33DS5Z3N.js → prove-QBAESCOC.js} +2 -2
  327. package/dist/cli/chunks/provider-manager-PEXOHGNB.js +2 -0
  328. package/dist/cli/chunks/qe-reasoning-bank-7B2G4UGQ.js +2 -0
  329. package/dist/cli/chunks/{quality-WCSEA5GH.js → quality-ZTNRL6EG.js} +2 -2
  330. package/dist/cli/chunks/queen-coordinator-6OF4HT3S.js +2 -0
  331. package/dist/cli/chunks/{real-embeddings-OQ5F37DG.js → real-embeddings-ZFFDV6HC.js} +2 -2
  332. package/dist/cli/chunks/{roocode-installer-II7LIR2X.js → roocode-installer-J4LFL4AE.js} +2 -2
  333. package/dist/cli/chunks/router-GMWRF6DU.js +2 -0
  334. package/dist/cli/chunks/routing-feedback-XKJSQK3I.js +2 -0
  335. package/dist/cli/chunks/{routing-handler-6OFHARIY.js → routing-handler-A5QG2TP2.js} +2 -2
  336. package/dist/cli/chunks/{ruvector-commands-GD5JTR4M.js → ruvector-commands-J5JL5WX5.js} +2 -2
  337. package/dist/cli/chunks/{rvf-dual-writer-HSK6BYZV.js → rvf-dual-writer-H7442GMO.js} +2 -2
  338. package/dist/cli/chunks/{rvf-migration-adapter-554SMF5S.js → rvf-migration-adapter-PTFQUYKC.js} +2 -2
  339. package/dist/cli/chunks/{rvf-migration-coordinator-OFDBCAYE.js → rvf-migration-coordinator-RSNROYRX.js} +2 -2
  340. package/dist/cli/chunks/rvf-native-adapter-YEA6TMXB.js +2 -0
  341. package/dist/cli/chunks/safe-db-5DOP2J3V.js +2 -0
  342. package/dist/cli/chunks/schedule-SUWTOBHP.js +2 -0
  343. package/dist/cli/chunks/scheduler-P4VTC5SQ.js +2 -0
  344. package/dist/cli/chunks/{security-GN4J6DSS.js → security-LHHLMCBA.js} +3 -3
  345. package/dist/cli/chunks/{shared-rvf-adapter-Q4PM3QCN.js → shared-rvf-adapter-NPSHVUTM.js} +2 -2
  346. package/dist/cli/chunks/{shared-rvf-dual-writer-R5WK5BXQ.js → shared-rvf-dual-writer-INQDY5WE.js} +2 -2
  347. package/dist/cli/chunks/sqlite-persistence-5Z2RAXH7.js +2 -0
  348. package/dist/cli/chunks/{status-handler-AHS5WVMG.js → status-handler-R2KIAMAE.js} +2 -2
  349. package/dist/cli/chunks/{structural-health-5KUKNLHZ.js → structural-health-2VPPIOZX.js} +2 -2
  350. package/dist/cli/chunks/{sync-PUMM3SR6.js → sync-ASZ3T5GT.js} +2 -2
  351. package/dist/cli/chunks/{sync-TQLGD5HX.js → sync-NLASP7AK.js} +2 -2
  352. package/dist/cli/chunks/{task-handler-D7VXV4AF.js → task-handler-UV5R6LJG.js} +2 -2
  353. package/dist/cli/chunks/{task-handlers-QMN4SWUG.js → task-handlers-I6YJXPYP.js} +3 -3
  354. package/dist/cli/chunks/{test-HEWZR6YQ.js → test-TE43TNTI.js} +4 -4
  355. package/dist/cli/chunks/{test-scheduling-VTMLBEPA.js → test-scheduling-WWWWF2TZ.js} +3 -3
  356. package/dist/cli/chunks/{token-bootstrap-IYBG7PQ6.js → token-bootstrap-HEWP7KKS.js} +2 -2
  357. package/dist/cli/chunks/{token-usage-C7H27BFZ.js → token-usage-3FVHUAW6.js} +2 -2
  358. package/dist/cli/chunks/{transformers-5ZJVC6NB.js → transformers-O5OFM4XM.js} +2 -2
  359. package/dist/cli/chunks/{tree-sitter-wasm-parser-EARBJG2H.js → tree-sitter-wasm-parser-YOYWFW63.js} +2 -2
  360. package/dist/cli/chunks/{types-3IHE42PZ.js → types-42GR6PLO.js} +2 -2
  361. package/dist/cli/chunks/unified-memory-HCKOPFAY.js +2 -0
  362. package/dist/cli/chunks/unified-memory-hnsw-6NQPYA5C.js +2 -0
  363. package/dist/cli/chunks/unified-persistence-NIMKNAFR.js +2 -0
  364. package/dist/cli/chunks/{upgrade-YP3VFSXO.js → upgrade-BU6DJ4LT.js} +2 -2
  365. package/dist/cli/chunks/{validate-VSBNKPN6.js → validate-MPTBARGN.js} +2 -2
  366. package/dist/cli/chunks/{validate-swarm-GOCJVWXE.js → validate-swarm-5LUQYHPP.js} +2 -2
  367. package/dist/cli/chunks/{vibium-U6YKCLDF.js → vibium-MJJDANDL.js} +2 -2
  368. package/dist/cli/chunks/visual-security-HFGHA57Z.js +2 -0
  369. package/dist/cli/chunks/{web-tree-sitter-TSNVGWSN.js → web-tree-sitter-5TF4UGB3.js} +2 -2
  370. package/dist/cli/chunks/{windsurf-installer-2VKMEFSD.js → windsurf-installer-NQAOSVCN.js} +2 -2
  371. package/dist/cli/chunks/{witness-chain-BWZCW52H.js → witness-chain-23UWK2JT.js} +2 -2
  372. package/dist/cli/chunks/witness-chain-VZGGJ7TJ.js +2 -0
  373. package/dist/cli/chunks/{workflow-J6SCYLU3.js → workflow-3QOLXRJC.js} +4 -4
  374. package/dist/cli/chunks/workflow-orchestrator-45L7D4SN.js +2 -0
  375. package/dist/cli/chunks/{wrappers-M5C7DONW.js → wrappers-S6EUZBCX.js} +2 -2
  376. package/dist/cli/commands/code.js +78 -2
  377. package/dist/cli/completions/index.js +4 -1
  378. package/dist/domains/code-intelligence/coordinator.js +8 -4
  379. package/dist/domains/code-intelligence/services/c4-model/from-detected.d.ts +41 -0
  380. package/dist/domains/code-intelligence/services/c4-model/from-detected.js +152 -0
  381. package/dist/domains/code-intelligence/services/c4-model/kg-relationships.d.ts +71 -0
  382. package/dist/domains/code-intelligence/services/c4-model/kg-relationships.js +87 -0
  383. package/dist/domains/code-intelligence/services/knowledge-graph.d.ts +6 -0
  384. package/dist/domains/code-intelligence/services/knowledge-graph.js +3 -3
  385. package/dist/domains/code-intelligence/services/product-factors-bridge.d.ts +26 -5
  386. package/dist/domains/code-intelligence/services/product-factors-bridge.js +72 -65
  387. package/dist/domains/requirements-validation/coordinator.d.ts +16 -2
  388. package/dist/domains/requirements-validation/coordinator.js +112 -7
  389. package/dist/domains/requirements-validation/plugin.js +20 -1
  390. package/dist/domains/test-generation/coordinator.d.ts +3 -1
  391. package/dist/domains/test-generation/coordinator.js +15 -33
  392. package/dist/integrations/darwin/types.d.ts +10 -3
  393. package/dist/integrations/darwin/types.js +10 -3
  394. package/dist/mcp/bundle.js +446 -464
  395. package/dist/mcp/tool-scoping.d.ts +8 -2
  396. package/dist/mcp/tool-scoping.js +13 -0
  397. package/dist/mcp/tools/code-intelligence/c4.d.ts +56 -0
  398. package/dist/mcp/tools/code-intelligence/c4.js +145 -0
  399. package/dist/mcp/tools/index.d.ts +1 -0
  400. package/dist/mcp/tools/index.js +1 -0
  401. package/dist/mcp/tools/registry.d.ts +1 -0
  402. package/dist/mcp/tools/registry.js +3 -0
  403. package/dist/routing/free-tier/coordinator-support.d.ts +90 -0
  404. package/dist/routing/free-tier/coordinator-support.js +78 -0
  405. package/dist/routing/free-tier/executor.d.ts +43 -1
  406. package/dist/routing/free-tier/executor.js +69 -26
  407. package/dist/routing/free-tier/index.d.ts +1 -0
  408. package/dist/routing/free-tier/index.js +1 -0
  409. package/dist/routing/value-score.d.ts +49 -0
  410. package/dist/routing/value-score.js +54 -0
  411. package/dist/shared/c4-model/confidence.d.ts +38 -0
  412. package/dist/shared/c4-model/confidence.js +69 -0
  413. package/dist/shared/c4-model/index.d.ts +4 -0
  414. package/dist/shared/c4-model/index.js +1 -0
  415. package/dist/shared/optional-module.d.ts +23 -0
  416. package/dist/shared/optional-module.js +46 -0
  417. package/dist/verification/adversarial-verify/calibrate.d.ts +32 -0
  418. package/dist/verification/adversarial-verify/calibrate.js +33 -0
  419. package/dist/verification/adversarial-verify/gate.d.ts +38 -0
  420. package/dist/verification/adversarial-verify/gate.js +32 -0
  421. package/dist/verification/adversarial-verify/index.d.ts +20 -0
  422. package/dist/verification/adversarial-verify/index.js +6 -0
  423. package/dist/verification/adversarial-verify/prompts.d.ts +14 -0
  424. package/dist/verification/adversarial-verify/prompts.js +17 -0
  425. package/dist/verification/adversarial-verify/synthesize.d.ts +18 -0
  426. package/dist/verification/adversarial-verify/synthesize.js +35 -0
  427. package/dist/verification/adversarial-verify/types.d.ts +59 -0
  428. package/dist/verification/adversarial-verify/types.js +10 -0
  429. package/dist/verification/adversarial-verify/verify.d.ts +20 -0
  430. package/dist/verification/adversarial-verify/verify.js +34 -0
  431. package/package.json +10 -1
  432. package/dist/cli/chunks/adapter-WLFT5VMV.js +0 -2
  433. package/dist/cli/chunks/aqe-learning-engine-JBH4GZUM.js +0 -2
  434. package/dist/cli/chunks/base-A7JGM473.js +0 -2
  435. package/dist/cli/chunks/browser-workflow-TIDJWULK.js +0 -2
  436. package/dist/cli/chunks/chunk-C4OYHUJV.js +0 -2
  437. package/dist/cli/chunks/client-ZLJ3JMBC.js +0 -2
  438. package/dist/cli/chunks/code-MPDG4UHS.js +0 -39
  439. package/dist/cli/chunks/core-handlers-EM7FUYTI.js +0 -2
  440. package/dist/cli/chunks/cross-domain-router-DYGHQ6P5.js +0 -2
  441. package/dist/cli/chunks/dream-DBE5D5BD.js +0 -2
  442. package/dist/cli/chunks/heartbeat-scheduler-NFHAANNL.js +0 -2
  443. package/dist/cli/chunks/hnsw-adapter-HMPCZFBY.js +0 -2
  444. package/dist/cli/chunks/hnsw-index-KRIWSXX4.js +0 -2
  445. package/dist/cli/chunks/hybrid-router-BAB32B2W.js +0 -2
  446. package/dist/cli/chunks/impact-analyzer-3D6XHWQE.js +0 -2
  447. package/dist/cli/chunks/init-wizard-LLU3WVGC.js +0 -2
  448. package/dist/cli/chunks/kernel-ZFHAYHHJ.js +0 -2
  449. package/dist/cli/chunks/knowledge-graph-ETZ65KOY.js +0 -2
  450. package/dist/cli/chunks/llm-router-service-R6CTGF5I.js +0 -2
  451. package/dist/cli/chunks/load-test-UOWIJUCH.js +0 -2
  452. package/dist/cli/chunks/memory-backend-E3ZQKW7A.js +0 -2
  453. package/dist/cli/chunks/pattern-null-store-OUOJO2RH.js +0 -2
  454. package/dist/cli/chunks/protocol-executor-KHAPG5CP.js +0 -2
  455. package/dist/cli/chunks/provider-manager-FGPPW7T4.js +0 -2
  456. package/dist/cli/chunks/qe-reasoning-bank-TS7XOJDA.js +0 -2
  457. package/dist/cli/chunks/queen-coordinator-J35FNFQ3.js +0 -2
  458. package/dist/cli/chunks/router-AFTKPDI5.js +0 -2
  459. package/dist/cli/chunks/routing-feedback-SABZUJTF.js +0 -2
  460. package/dist/cli/chunks/rvf-native-adapter-57MDDSFQ.js +0 -2
  461. package/dist/cli/chunks/safe-db-2HR6MVYM.js +0 -2
  462. package/dist/cli/chunks/schedule-KLVAN6XI.js +0 -2
  463. package/dist/cli/chunks/scheduler-WYZ6BC5Y.js +0 -2
  464. package/dist/cli/chunks/sqlite-persistence-2CGU5INO.js +0 -2
  465. package/dist/cli/chunks/unified-memory-PMYRQC5K.js +0 -2
  466. package/dist/cli/chunks/unified-memory-hnsw-7TRL2K5Q.js +0 -2
  467. package/dist/cli/chunks/unified-persistence-S4BNJK4S.js +0 -2
  468. package/dist/cli/chunks/visual-security-RPMZ3J7L.js +0 -2
  469. package/dist/cli/chunks/witness-chain-BTDZSQ6P.js +0 -2
  470. package/dist/cli/chunks/workflow-orchestrator-42B62D3V.js +0 -2
@@ -18,8 +18,10 @@ import * as fs from 'fs/promises';
18
18
  import { ok, err } from '../../../shared/types';
19
19
  import { CodeIntelligenceEvents, createEvent, } from '../../../shared/events/domain-events';
20
20
  import { toError } from '../../../shared/error-utils.js';
21
- import { isCacheValid, sanitizeId, inferComponentType, } from '../../../shared/c4-model';
21
+ import { isCacheValid, sanitizeId, inferComponentType, assessC4Confidence, } from '../../../shared/c4-model';
22
22
  import { safeJsonParse } from '../../../shared/safe-json.js';
23
+ import { C4ModelService } from './c4-model';
24
+ import { toContextRequest, toContainerRequest, toComponentRequest, } from './c4-model/from-detected';
23
25
  const DEFAULT_CONFIG = {
24
26
  cacheTtlMs: 3600000, // 1 hour
25
27
  publishEvents: true,
@@ -96,11 +98,26 @@ export class ProductFactorsBridgeService {
96
98
  config;
97
99
  initialized = false;
98
100
  eventSubscriptions = [];
101
+ /** ADR-112: the consolidated render+analyze+store engine (lazily built). */
102
+ c4Service;
99
103
  constructor(eventBus, memory, config = {}) {
100
104
  this.eventBus = eventBus;
101
105
  this.memory = memory;
102
106
  this.config = { ...DEFAULT_CONFIG, ...config };
103
107
  }
108
+ /**
109
+ * ADR-112: lazily construct the shared C4ModelService.
110
+ * Embeddings are OFF on this internal product-factors path (keeps it offline +
111
+ * fast); the CLI/MCP surfaces opt embeddings in when semantic search is wanted.
112
+ */
113
+ getC4Service() {
114
+ if (!this.c4Service) {
115
+ this.c4Service = new C4ModelService(this.memory, {
116
+ enableEmbeddings: this.config.enableC4Embeddings ?? false,
117
+ });
118
+ }
119
+ return this.c4Service;
120
+ }
104
121
  // ==========================================================================
105
122
  // Lifecycle
106
123
  // ==========================================================================
@@ -130,7 +147,7 @@ export class ProductFactorsBridgeService {
130
147
  const sub2 = this.eventBus.subscribe(CodeIntelligenceEvents.ImpactAnalysisCompleted, this.handleImpactAnalysisCompleted.bind(this));
131
148
  this.eventSubscriptions.push(sub2);
132
149
  }
133
- async handleKnowledgeGraphUpdated(event) {
150
+ async handleKnowledgeGraphUpdated(_event) {
134
151
  // Invalidate relevant caches when knowledge graph is updated
135
152
  logger.info('[ProductFactorsBridge] Knowledge graph updated, considering cache invalidation');
136
153
  // Note: We don't have project path in this event, so we rely on hash-based invalidation
@@ -198,30 +215,40 @@ export class ProductFactorsBridgeService {
198
215
  if (request.analyzeCoupling && components.length > 1) {
199
216
  couplingAnalysis = this.analyzeCoupling(components, relationships);
200
217
  }
201
- // Generate diagrams
218
+ // Generate diagrams. ADR-112: the three C4 levels render through the
219
+ // consolidated C4ModelService (richer + stored + searchable); the bridge
220
+ // keeps only detection. Inline generators remain as a safety fallback.
202
221
  const diagrams = {};
203
222
  if (request.includeContext !== false) {
204
- diagrams.context = this.generateContextDiagram(projectInfo, externalSystems);
223
+ diagrams.context = await this.renderContext(projectInfo, externalSystems);
205
224
  }
206
225
  if (request.includeContainer !== false) {
207
- diagrams.container = this.generateContainerDiagram(projectInfo, externalSystems);
226
+ diagrams.container = await this.renderContainer(projectInfo, externalSystems);
208
227
  }
209
228
  if (request.includeComponent !== false && components.length > 0) {
210
- diagrams.component = this.generateComponentDiagram(projectInfo.name, components, relationships);
229
+ diagrams.component = await this.renderComponent(projectInfo, components, relationships);
211
230
  }
212
231
  if (request.includeDependency && components.length > 0) {
213
232
  diagrams.dependency = this.generateDependencyGraph(components, relationships);
214
233
  }
234
+ const filesAnalyzed = components.reduce((sum, c) => sum + c.files.length, 0);
215
235
  const metadata = {
216
236
  projectName: projectInfo.name,
217
237
  projectDescription: projectInfo.description,
218
238
  generatedAt: new Date(),
219
239
  source: 'codebase-analysis',
220
240
  analysisMetadata: {
221
- filesAnalyzed: components.reduce((sum, c) => sum + c.files.length, 0),
241
+ filesAnalyzed,
222
242
  componentsDetected: components.length,
223
243
  externalSystemsDetected: externalSystems.length,
224
244
  analysisTimeMs: Date.now() - startTime,
245
+ // ADR-112: deterministic confidence gate — never present a wrong diagram as truth.
246
+ confidence: assessC4Confidence({
247
+ componentsDetected: components.length,
248
+ relationshipsDetected: relationships.length,
249
+ externalSystemsDetected: externalSystems.length,
250
+ filesAnalyzed,
251
+ }),
225
252
  },
226
253
  };
227
254
  return ok({
@@ -239,70 +266,37 @@ export class ProductFactorsBridgeService {
239
266
  }
240
267
  }
241
268
  // ==========================================================================
242
- // IC4DiagramGenerator Implementation
269
+ // ADR-112: render via the consolidated C4ModelService (the single engine).
270
+ // On failure we FAIL LOUD — propagate the error so the caller surfaces it —
271
+ // rather than silently degrading to a weaker inline diagram. A masked render
272
+ // failure is worse than a surfaced one (ADR-050: no silent degradation).
243
273
  // ==========================================================================
244
- generateContextDiagram(project, externalSystems) {
245
- let mermaid = `C4Context
246
- title System Context diagram for ${project.name}
247
-
248
- Person(user, "User", "A user of the system")
249
- System(system, "${project.name}", "${project.description}")
250
- `;
251
- for (const sys of externalSystems) {
252
- mermaid += ` System_Ext(${sys.id}, "${sys.name}", "${sys.type}")
253
- `;
254
- }
255
- mermaid += `
256
- Rel(user, system, "Uses")
257
- `;
258
- for (const sys of externalSystems) {
259
- mermaid += ` Rel(system, ${sys.id}, "${sys.relationship}")
260
- `;
274
+ async renderContext(projectInfo, externalSystems) {
275
+ const res = await this.getC4Service().buildContext(toContextRequest(projectInfo, externalSystems));
276
+ if (!res.success) {
277
+ logger.error('[ProductFactorsBridge] C4 context render failed', res.error);
278
+ throw res.error;
261
279
  }
262
- return mermaid;
280
+ return res.value.mermaid;
263
281
  }
264
- generateContainerDiagram(project, externalSystems) {
265
- let mermaid = `C4Container
266
- title Container diagram for ${project.name}
267
-
268
- Person(user, "User", "A user of the system")
269
-
270
- Container_Boundary(c1, "${project.name}") {
271
- Container(app, "Application", "TypeScript", "Main application")
272
- }
273
- `;
274
- for (const sys of externalSystems) {
275
- mermaid += ` System_Ext(${sys.id}, "${sys.name}", "${sys.type}")
276
- `;
277
- }
278
- mermaid += `
279
- Rel(user, app, "Uses")
280
- `;
281
- for (const sys of externalSystems) {
282
- mermaid += ` Rel(app, ${sys.id}, "${sys.relationship}")
283
- `;
282
+ async renderContainer(projectInfo, externalSystems) {
283
+ const res = await this.getC4Service().buildContainer(toContainerRequest(projectInfo, externalSystems));
284
+ if (!res.success) {
285
+ logger.error('[ProductFactorsBridge] C4 container render failed', res.error);
286
+ throw res.error;
284
287
  }
285
- return mermaid;
288
+ return res.value.mermaid;
286
289
  }
287
- generateComponentDiagram(projectName, components, relationships) {
288
- let mermaid = `C4Component
289
- title Component diagram for ${projectName}
290
-
291
- Container_Boundary(app, "Application") {
292
- `;
293
- for (const comp of components) {
294
- const responsibility = comp.responsibilities?.[0] || '';
295
- mermaid += ` Component(${comp.id}, "${comp.name}", "${comp.technology || 'TypeScript'}", "${responsibility}")
296
- `;
297
- }
298
- mermaid += ` }
299
- `;
300
- for (const rel of relationships) {
301
- mermaid += ` Rel(${rel.sourceId}, ${rel.targetId}, "${rel.type}")
302
- `;
290
+ async renderComponent(projectInfo, components, relationships) {
291
+ const res = await this.getC4Service().buildComponent(toComponentRequest(components, relationships));
292
+ if (!res.success) {
293
+ logger.error('[ProductFactorsBridge] C4 component render failed', res.error);
294
+ throw res.error;
303
295
  }
304
- return mermaid;
296
+ return res.value.mermaid;
305
297
  }
298
+ // The dependency graph is NOT a C4 level and C4ModelService does not render
299
+ // it, so this stays as the bridge's own renderer.
306
300
  generateDependencyGraph(components, relationships) {
307
301
  let mermaid = `graph TD
308
302
  `;
@@ -439,6 +433,19 @@ export class ProductFactorsBridgeService {
439
433
  catch (error) {
440
434
  logger.error('Component analysis failed:', error instanceof Error ? error : undefined);
441
435
  }
436
+ // ADR-112 C2: prefer REAL KG-derived edges (AST import/call graph) over the
437
+ // naming heuristic. The resolver returns null on any miss → heuristic stands.
438
+ if (this.config.relationshipResolver && components.length > 0) {
439
+ try {
440
+ const resolved = await this.config.relationshipResolver(components, projectPath);
441
+ if (resolved && resolved.length > 0) {
442
+ return { components, relationships: resolved };
443
+ }
444
+ }
445
+ catch (error) {
446
+ logger.debug(`KG relationship resolver failed; using heuristic: ${toError(error).message}`);
447
+ }
448
+ }
442
449
  return { components, relationships };
443
450
  }
444
451
  shouldExclude(name) {
@@ -473,7 +480,7 @@ export class ProductFactorsBridgeService {
473
480
  }
474
481
  }
475
482
  }
476
- catch (error) {
483
+ catch {
477
484
  // Non-critical: permission errors when scanning directories
478
485
  logger.debug('Directory scan error:');
479
486
  }
@@ -9,6 +9,7 @@
9
9
  import { Result } from '../../shared/types/index.js';
10
10
  import { EventBus, MemoryBackend, AgentCoordinator } from '../../kernel/interfaces.js';
11
11
  import type { HybridRouter } from '../../shared/llm/router/hybrid-router.js';
12
+ import { type FreeTierCoordinatorConfig, type RoutingFeedbackLike } from '../../routing/free-tier/index.js';
12
13
  import { IRequirementsValidationCoordinator, RequirementAnalysis, TestArtifacts, SprintValidation } from './interfaces.js';
13
14
  import { BaseDomainCoordinator, type BaseDomainCoordinatorConfig } from '../base-domain-coordinator.js';
14
15
  import { type DomainFinding } from '../../coordination/consensus/domain-findings.js';
@@ -22,7 +23,7 @@ export declare const RequirementsValidationEvents: {
22
23
  /**
23
24
  * CQ-002: Extends BaseDomainCoordinatorConfig — removes duplicate fields
24
25
  */
25
- export interface CoordinatorConfig extends BaseDomainCoordinatorConfig {
26
+ export interface CoordinatorConfig extends BaseDomainCoordinatorConfig, FreeTierCoordinatorConfig {
26
27
  minTestabilityThreshold: number;
27
28
  enablePPO: boolean;
28
29
  enableSONA: boolean;
@@ -45,10 +46,14 @@ export declare class RequirementsValidationCoordinator extends BaseDomainCoordin
45
46
  private readonly bddWriter;
46
47
  private readonly testabilityScorer;
47
48
  private readonly repository;
49
+ /** Opt-in cheap-first BDD scenario generation (plan 06, ADR-111). Null = off. */
50
+ private readonly freeTierExecutor;
48
51
  private ppoAlgorithm?;
49
52
  private sonaEngine?;
50
53
  private rlInitialized;
51
- constructor(eventBus: EventBus, memory: MemoryBackend, agentCoordinator: AgentCoordinator, config?: Partial<CoordinatorConfig>, llmRouter?: HybridRouter);
54
+ constructor(eventBus: EventBus, memory: MemoryBackend, agentCoordinator: AgentCoordinator, config?: Partial<CoordinatorConfig>, llmRouter?: HybridRouter,
55
+ /** Optional D9 sink — when provided, free-tier outcomes feed routing-feedback. */
56
+ routingFeedback?: RoutingFeedbackLike | null);
52
57
  /**
53
58
  * Initialize the coordinator
54
59
  * CQ-002: Domain-specific initialization
@@ -74,6 +79,15 @@ export declare class RequirementsValidationCoordinator extends BaseDomainCoordin
74
79
  /**
75
80
  * Generate test artifacts from requirement
76
81
  */
82
+ /**
83
+ * Cheap-first BDD generation (plan 06 broadening; ADR-111 escalation lane).
84
+ * Generates raw Gherkin on the free local tier (best-effort), verifies Gherkin
85
+ * STRUCTURE as the objective oracle (§10 — never the model's own judgement),
86
+ * parses it back into structured scenarios, and escalates the hard tail via the
87
+ * router. Returns null when off or nothing usable → caller falls back to the
88
+ * normal structured path. Off by default.
89
+ */
90
+ private tryFreeTierScenarios;
77
91
  generateTestArtifacts(requirementId: string): Promise<Result<TestArtifacts>>;
78
92
  /**
79
93
  * Validate sprint requirements
@@ -10,6 +10,7 @@ import { v4 as uuidv4 } from 'uuid';
10
10
  import { LoggerFactory } from '../../logging/index.js';
11
11
  import { ok, err } from '../../shared/types/index.js';
12
12
  import { toError } from '../../shared/error-utils.js';
13
+ import { buildFreeTierExecutor, } from '../../routing/free-tier/index.js';
13
14
  import { createEvent } from '../../shared/events/domain-events.js';
14
15
  import { RequirementsValidatorService } from './services/requirements-validator.js';
15
16
  import { BDDScenarioWriterService } from './services/bdd-scenario-writer.js';
@@ -93,6 +94,25 @@ class InMemoryRequirementRepository {
93
94
  * CQ-002: Extends BaseDomainCoordinator
94
95
  */
95
96
  const logger = LoggerFactory.create('requirements-validation');
97
+ /** Strip a ```gherkin fence (truncation-robust); else return the text as-is. */
98
+ function stripGherkinFence(s) {
99
+ s = (s ?? '').trim();
100
+ const full = /```(?:gherkin|feature)?\s*([\s\S]*?)```/.exec(s);
101
+ if (full)
102
+ return full[1].trim();
103
+ const open = /```(?:gherkin|feature)?[^\n]*\n([\s\S]*)$/.exec(s);
104
+ return open ? open[1].trim() : s;
105
+ }
106
+ const GHERKIN_STOPWORDS = new Set([
107
+ 'given', 'when', 'then', 'scenario', 'feature', 'with', 'that', 'this', 'from', 'into',
108
+ 'should', 'must', 'have', 'will', 'shall', 'able', 'user', 'users', 'system', 'value',
109
+ 'valid', 'invalid', 'returns', 'return', 'apply', 'using', 'based', 'their', 'they',
110
+ ]);
111
+ /** Significant lowercased terms (>3 chars, non-stopword) from a requirement. */
112
+ function significantTerms(requirement) {
113
+ const src = `${requirement.title} ${(requirement.acceptanceCriteria ?? []).join(' ')}`.toLowerCase();
114
+ return Array.from(new Set(src.match(/[a-z][a-z0-9]{3,}/g) ?? [])).filter((w) => !GHERKIN_STOPWORDS.has(w));
115
+ }
96
116
  export class RequirementsValidationCoordinator extends BaseDomainCoordinator {
97
117
  memory;
98
118
  agentCoordinator;
@@ -100,11 +120,15 @@ export class RequirementsValidationCoordinator extends BaseDomainCoordinator {
100
120
  bddWriter;
101
121
  testabilityScorer;
102
122
  repository;
123
+ /** Opt-in cheap-first BDD scenario generation (plan 06, ADR-111). Null = off. */
124
+ freeTierExecutor;
103
125
  // V3: RL and SONA integrations
104
126
  ppoAlgorithm;
105
127
  sonaEngine;
106
128
  rlInitialized = false;
107
- constructor(eventBus, memory, agentCoordinator, config = {}, llmRouter) {
129
+ constructor(eventBus, memory, agentCoordinator, config = {}, llmRouter,
130
+ /** Optional D9 sink — when provided, free-tier outcomes feed routing-feedback. */
131
+ routingFeedback) {
108
132
  const fullConfig = { ...DEFAULT_CONFIG, ...config };
109
133
  super(eventBus, 'requirements-validation', fullConfig, {
110
134
  verifyFindingTypes: ['requirement-conflict', 'testability-assessment', 'ambiguous-requirement'],
@@ -116,6 +140,16 @@ export class RequirementsValidationCoordinator extends BaseDomainCoordinator {
116
140
  this.bddWriter = new BDDScenarioWriterService(memory);
117
141
  this.testabilityScorer = new TestabilityScorerService(memory);
118
142
  this.repository = new InMemoryRequirementRepository(memory);
143
+ // Opt-in cheap-first BDD generation (plan 06 broadening; ADR-111 escalation
144
+ // lane). OFF by default; BDD/Gherkin is a bounded-gen + objective-oracle fit.
145
+ this.freeTierExecutor = buildFreeTierExecutor({
146
+ config: this.config,
147
+ agentType: 'qe-requirements-validator',
148
+ taskKind: 'requirements-validation',
149
+ llmRouter,
150
+ routingFeedback, // D9 sink (undefined unless wired by the plugin)
151
+ logger,
152
+ });
119
153
  }
120
154
  // ==========================================================================
121
155
  // BaseDomainCoordinator Template Methods
@@ -294,6 +328,72 @@ export class RequirementsValidationCoordinator extends BaseDomainCoordinator {
294
328
  /**
295
329
  * Generate test artifacts from requirement
296
330
  */
331
+ /**
332
+ * Cheap-first BDD generation (plan 06 broadening; ADR-111 escalation lane).
333
+ * Generates raw Gherkin on the free local tier (best-effort), verifies Gherkin
334
+ * STRUCTURE as the objective oracle (§10 — never the model's own judgement),
335
+ * parses it back into structured scenarios, and escalates the hard tail via the
336
+ * router. Returns null when off or nothing usable → caller falls back to the
337
+ * normal structured path. Off by default.
338
+ */
339
+ async tryFreeTierScenarios(requirement, scenarioCount) {
340
+ if (!this.freeTierExecutor)
341
+ return null;
342
+ const ac = (requirement.acceptanceCriteria ?? []).map((c, i) => `${i + 1}. ${c}`).join('\n');
343
+ const system = 'You write Gherkin .feature files. Output ONLY a single fenced ```gherkin code block — no prose.';
344
+ const user = `Write a Gherkin feature with ~${scenarioCount} scenarios for this requirement. ` +
345
+ 'Use Feature/Scenario/Given/When/Then; cover the acceptance criteria and edge cases.\n\n' +
346
+ `Title: ${requirement.title}\nDescription: ${requirement.description}\n` +
347
+ (ac ? `Acceptance criteria:\n${ac}\n` : '');
348
+ // Objective oracle (structural proxy — does NOT execute the scenarios). Beyond
349
+ // bare structure it requires: parses to >=1 scenario, EVERY scenario has a
350
+ // non-empty Given/When/Then, AND the feature is RELEVANT to the requirement
351
+ // (token overlap) — so generic off-topic boilerplate is rejected, not rewarded
352
+ // (resists the §10 Goodhart trap). Still a proxy, not semantic ground truth.
353
+ const sigTerms = significantTerms(requirement);
354
+ const verify = (out) => {
355
+ const text = stripGherkinFence(out);
356
+ const structural = /\bFeature:/i.test(text) && /\bScenario:/i.test(text) &&
357
+ /\bGiven\b/i.test(text) && /\bWhen\b/i.test(text) && /\bThen\b/i.test(text);
358
+ if (!structural) {
359
+ return { passed: false, feedback: 'must be valid Gherkin: Feature:, Scenario:, and Given/When/Then steps' };
360
+ }
361
+ const parsed = this.bddWriter.parseGherkin(text);
362
+ if (!parsed.success || parsed.value.length === 0) {
363
+ return { passed: false, feedback: 'Gherkin did not parse into any scenario' };
364
+ }
365
+ const wellFormed = parsed.value.every((s) => s.given.length > 0 && s.when.length > 0 && s.then.length > 0);
366
+ if (!wellFormed) {
367
+ return { passed: false, feedback: 'every scenario needs at least one Given, one When, and one Then step' };
368
+ }
369
+ if (sigTerms.length > 0) {
370
+ const lower = text.toLowerCase();
371
+ const hits = sigTerms.filter((t) => lower.includes(t)).length;
372
+ if (hits < Math.min(2, sigTerms.length)) {
373
+ return { passed: false, feedback: `scenarios must address THIS requirement — reference its terms (e.g. ${sigTerms.slice(0, 6).join(', ')})` };
374
+ }
375
+ }
376
+ return { passed: true };
377
+ };
378
+ const r = await this.freeTierExecutor.execute({
379
+ agentId: `requirements:${requirement.id}`,
380
+ messages: [
381
+ { role: 'system', content: system },
382
+ { role: 'user', content: user },
383
+ ],
384
+ verify,
385
+ escalate: true,
386
+ bestOfK: this.config.freeTierBestOfK ?? 2, // §12, matches the D3-validated config
387
+ repairAttempts: this.config.freeTierRepairAttempts ?? 1,
388
+ });
389
+ if (!r.ok)
390
+ return null;
391
+ const parsed = this.bddWriter.parseGherkin(stripGherkinFence(r.content));
392
+ if (!parsed.success || parsed.value.length === 0)
393
+ return null;
394
+ logger.info(`Free-tier BDD scenarios for ${requirement.id} via tier=${r.tierUsed} (${parsed.value.length} scenarios)`);
395
+ return parsed.value;
396
+ }
297
397
  async generateTestArtifacts(requirementId) {
298
398
  const workflowId = uuidv4();
299
399
  try {
@@ -320,15 +420,20 @@ export class RequirementsValidationCoordinator extends BaseDomainCoordinator {
320
420
  logger.info(`[PPO] Optimized scenario count to ${optimizedScenarioCount}`);
321
421
  }
322
422
  }
323
- // Generate BDD scenarios with optimized count
324
- const scenariosResult = await this.bddWriter.generateScenariosWithExamples(requirement, optimizedScenarioCount);
325
- if (!scenariosResult.success) {
326
- this.failWorkflow(workflowId, scenariosResult.error.message);
327
- return err(scenariosResult.error);
423
+ // Cheap-first (opt-in, ADR-111): generate Gherkin on the free local tier,
424
+ // verify its structure (objective oracle), parse back to scenarios. Falls
425
+ // through to the normal structured path on any miss (off by default).
426
+ let scenarios = await this.tryFreeTierScenarios(requirement, optimizedScenarioCount);
427
+ if (!scenarios) {
428
+ const scenariosResult = await this.bddWriter.generateScenariosWithExamples(requirement, optimizedScenarioCount);
429
+ if (!scenariosResult.success) {
430
+ this.failWorkflow(workflowId, scenariosResult.error.message);
431
+ return err(scenariosResult.error);
432
+ }
433
+ scenarios = scenariosResult.value;
328
434
  }
329
435
  this.updateWorkflowProgress(workflowId, 50);
330
436
  // V3: Use PPO to optimize scenario ordering
331
- let scenarios = scenariosResult.value;
332
437
  if (this.config.enablePPO && this.ppoAlgorithm) {
333
438
  scenarios = await this.optimizeScenarioOrdering(requirement, scenarios);
334
439
  }
@@ -9,6 +9,7 @@ import { RequirementsValidatorService, } from './services/requirements-validator
9
9
  import { BDDScenarioWriterService, } from './services/bdd-scenario-writer.js';
10
10
  import { TestabilityScorerService, } from './services/testability-scorer.js';
11
11
  import { createQCSDIdeationPlugin, } from './qcsd-ideation-plugin.js';
12
+ import { RoutingFeedbackCollector } from '../../routing/routing-feedback.js';
12
13
  import { toError } from '../../shared/error-utils.js';
13
14
  // ============================================================================
14
15
  // Plugin Implementation
@@ -171,8 +172,26 @@ export class RequirementsValidationPlugin extends BaseDomainPlugin {
171
172
  this.validator = new RequirementsValidatorService({ memory: this.memory, llmRouter: this.llmRouter }, this.pluginConfig.validator);
172
173
  this.bddWriter = new BDDScenarioWriterService(this.memory, this.pluginConfig.bddWriter);
173
174
  this.testabilityScorer = new TestabilityScorerService(this.memory, this.pluginConfig.testabilityScorer);
175
+ // D9: when the free tier is opted in, stand up a live RoutingFeedbackCollector
176
+ // (calibrator + auto-escalation) so each cheap-vs-escalated BDD outcome feeds
177
+ // routing confidence. Memory-only fallback if the DB is unavailable.
178
+ let routingFeedback;
179
+ const freeTierOn = this.pluginConfig.coordinator?.enableFreeTier === true || process.env.AQE_FREE_TIER === '1';
180
+ if (freeTierOn) {
181
+ routingFeedback = new RoutingFeedbackCollector(10000, {
182
+ enableEMACalibration: true,
183
+ enableAutoEscalation: true,
184
+ });
185
+ try {
186
+ await routingFeedback.initialize();
187
+ }
188
+ catch {
189
+ // memory-only is fine — recording still drives calibration/escalation
190
+ }
191
+ }
174
192
  // Create and initialize coordinator
175
- this.coordinator = new RequirementsValidationCoordinator(this.eventBus, this.memory, this.agentCoordinator, this.pluginConfig.coordinator, this.llmRouter);
193
+ this.coordinator = new RequirementsValidationCoordinator(this.eventBus, this.memory, this.agentCoordinator, this.pluginConfig.coordinator, this.llmRouter, routingFeedback // D9 sink (undefined unless free tier is on)
194
+ );
176
195
  await this.coordinator.initialize();
177
196
  // Create and initialize QCSD Ideation Plugin
178
197
  this.qcsdIdeationPlugin = createQCSDIdeationPlugin(this.memory);
@@ -68,10 +68,12 @@ export interface CoordinatorConfig extends BaseDomainCoordinatorConfig {
68
68
  * — also enables via env `AQE_FREE_TIER=1`. Local-only / no paid escalation yet.
69
69
  */
70
70
  enableFreeTier?: boolean;
71
- /** Local model id for the free tier (default 'qwen3:8b' or env AQE_FREE_TIER_MODEL). */
71
+ /** Local model id for the free tier (default qwen3:30b-a3b or env AQE_FREE_TIER_MODEL). */
72
72
  freeTierModel?: string;
73
73
  /** Same-tier repair retries on a failed free-tier generation (D8). Default 1. */
74
74
  freeTierRepairAttempts?: number;
75
+ /** Best-of-k diverse local attempts per tier (§12; D3-validated k=2). Default 2. */
76
+ freeTierBestOfK?: number;
75
77
  }
76
78
  type TestGenWorkflowType = 'generate' | 'tdd' | 'property' | 'data' | 'learn';
77
79
  export declare class TestGenerationCoordinator extends BaseDomainCoordinator<CoordinatorConfig, TestGenWorkflowType> implements ITestGenerationCoordinator {
@@ -13,7 +13,7 @@ import { readFile } from 'node:fs/promises';
13
13
  import { ok, err, } from '../../shared/types';
14
14
  import { toError } from '../../shared/error-utils.js';
15
15
  // Opt-in free-tier local test generation (cross-pollination plan 06, D7-wire/D8/D9).
16
- import { FreeTierEscalatingExecutor, defaultFreeTierLadder, createRoutingFeedbackSink, } from '../../routing/free-tier/index.js';
16
+ import { buildFreeTierExecutor, } from '../../routing/free-tier/index.js';
17
17
  import { TestGenerationEvents, LearningOptimizationEvents, createEvent, } from '../../shared/events/domain-events';
18
18
  import { createTestGeneratorServiceWithDependencies, } from './services/test-generator';
19
19
  import { PatternMatcherService, } from './services/pattern-matcher';
@@ -123,36 +123,16 @@ export class TestGenerationCoordinator extends BaseDomainCoordinator {
123
123
  // ADR-043 wiring: dependencies factory accepts llmRouter.
124
124
  this.testGenerator = createTestGeneratorServiceWithDependencies({ memory, llmRouter });
125
125
  this.patternMatcher = new PatternMatcherService(memory);
126
- // Opt-in free-tier local generation (plan 06, D7-wire/D8/D9). OFF by default;
127
- // local-only with a same-tier repair loop and NO paid escalation yet.
128
- const freeTierOn = this.config.enableFreeTier === true || process.env.AQE_FREE_TIER === '1';
129
- if (freeTierOn) {
130
- const model = this.config.freeTierModel || process.env.AQE_FREE_TIER_MODEL || 'qwen3:8b';
131
- // Paid escalation: delegate Claude tiers to the existing HybridRouter, mapping
132
- // the ladder tier to a complexity hint so the router selects that tier. When no
133
- // router is wired, the executor stays local-only (Claude tiers report unavailable).
134
- const claudeRunner = llmRouter
135
- ? async (tier, msgs) => {
136
- const complexity = tier === 'opus' ? 'high' : tier === 'sonnet' ? 'medium' : 'low';
137
- const resp = await llmRouter.chat({
138
- messages: msgs.map((m) => ({ role: m.role, content: m.content })),
139
- agentType: 'qe-test-architect',
140
- complexity,
141
- });
142
- return { content: resp.content };
143
- }
144
- : undefined;
145
- this.freeTierExecutor = new FreeTierEscalatingExecutor({
146
- ladder: defaultFreeTierLadder(model),
147
- claudeRunner,
148
- defaultRepairAttempts: this.config.freeTierRepairAttempts ?? 1,
149
- onOutcome: routingFeedback
150
- ? createRoutingFeedbackSink(routingFeedback, { taskKind: 'test-generation' }) // D9
151
- : undefined,
152
- });
153
- logger.info(`Free-tier local test generation enabled (model=${model}, repair, ` +
154
- `${claudeRunner ? 'escalation→HybridRouter' : 'local-only'})`);
155
- }
126
+ // Opt-in free-tier local generation (plan 06, D7-wire/D8/D9; ADR-111).
127
+ // OFF by default. Generic wiring lives in the shared factory now.
128
+ this.freeTierExecutor = buildFreeTierExecutor({
129
+ config: this.config,
130
+ agentType: 'qe-test-architect',
131
+ taskKind: 'test-generation',
132
+ llmRouter,
133
+ routingFeedback,
134
+ logger,
135
+ });
156
136
  // Initialize coherence gate if service is provided (ADR-052)
157
137
  if (this.config.enableCoherenceGate && coherenceService) {
158
138
  this.coherenceGate = createTestGenerationCoherenceGate(coherenceService, undefined, // Use default embedding service
@@ -472,9 +452,11 @@ export class TestGenerationCoordinator extends BaseDomainCoordinator {
472
452
  agentId: `test-gen:${src}`,
473
453
  messages,
474
454
  verify,
475
- // Cheap-first: try local + repair, then escalate the hard tail up the
476
- // ladder via the HybridRouter (when wired). Local-only if no router.
455
+ // Cheap-first: best-of-k (§12) + repair on the local tier, then escalate the
456
+ // hard tail up the ladder via the HybridRouter (when wired). Matches the D3
457
+ // config that was validated (k=2). Local-only if no router.
477
458
  escalate: true,
459
+ bestOfK: this.config.freeTierBestOfK ?? 2,
478
460
  repairAttempts: this.config.freeTierRepairAttempts ?? 1,
479
461
  });
480
462
  if (!r.ok)
@@ -5,10 +5,17 @@
5
5
  * `packages/darwin-mode/src/types.ts` (ADR-072 ScoreCard) so AQE can produce
6
6
  * Darwin-compatible scores WITHOUT a build-time dependency on the pre-1.0
7
7
  * MetaHarness package (per cross-pollination plan 05: Phase-0 actions stay
8
- * decoupled). If/when a version contract lands (plan A8), replace this with a
9
- * real import.
8
+ * decoupled).
10
9
  *
11
- * Source of truth at time of writing: @metaharness/darwin@0.2.1.
10
+ * VERSION CONTRACT (plan A8, verified 2026-06-25): `DarwinScoreCard` is byte-for-
11
+ * byte structurally identical to upstream `ScoreCard` from @metaharness/darwin@0.2.1
12
+ * THROUGH @0.7.0 (no drift across 5 minors). The mirror is INTENTIONALLY KEPT, not
13
+ * replaced by a real import: the upstream is a fast-moving pre-1.0 package whose
14
+ * tarball pulls napi/wasm transitive deps, so the zero-coupling mirror is the lower-
15
+ * risk substrate (see plan 05 "A8 — status"). `tests/.../darwin-version-contract.test.ts`
16
+ * pins the mirror's field set so any divergence is caught.
17
+ *
18
+ * Pinned upstream contract: @metaharness/darwin ScoreCard @ 0.2.1–0.7.0.
12
19
  */
13
20
  /** The seven mutation surfaces (mirror of Darwin's MutationSurface). */
14
21
  export type MutationSurface = 'planner' | 'contextBuilder' | 'reviewer' | 'retryPolicy' | 'toolPolicy' | 'memoryPolicy' | 'scorePolicy';
@@ -5,10 +5,17 @@
5
5
  * `packages/darwin-mode/src/types.ts` (ADR-072 ScoreCard) so AQE can produce
6
6
  * Darwin-compatible scores WITHOUT a build-time dependency on the pre-1.0
7
7
  * MetaHarness package (per cross-pollination plan 05: Phase-0 actions stay
8
- * decoupled). If/when a version contract lands (plan A8), replace this with a
9
- * real import.
8
+ * decoupled).
10
9
  *
11
- * Source of truth at time of writing: @metaharness/darwin@0.2.1.
10
+ * VERSION CONTRACT (plan A8, verified 2026-06-25): `DarwinScoreCard` is byte-for-
11
+ * byte structurally identical to upstream `ScoreCard` from @metaharness/darwin@0.2.1
12
+ * THROUGH @0.7.0 (no drift across 5 minors). The mirror is INTENTIONALLY KEPT, not
13
+ * replaced by a real import: the upstream is a fast-moving pre-1.0 package whose
14
+ * tarball pulls napi/wasm transitive deps, so the zero-coupling mirror is the lower-
15
+ * risk substrate (see plan 05 "A8 — status"). `tests/.../darwin-version-contract.test.ts`
16
+ * pins the mirror's field set so any divergence is caught.
17
+ *
18
+ * Pinned upstream contract: @metaharness/darwin ScoreCard @ 0.2.1–0.7.0.
12
19
  */
13
20
  export {};
14
21
  //# sourceMappingURL=types.js.map