@claude-flow/cli 3.32.26 → 3.32.30

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 (403) hide show
  1. package/.claude/helpers/.helpers-version +1 -1
  2. package/.claude/helpers/helpers.manifest.json +2 -2
  3. package/catalog-manifest.json +4 -4
  4. package/dist/src/commands/index.d.ts +1 -0
  5. package/dist/src/commands/index.js +5 -3
  6. package/dist/src/commands/memory.js +49 -5
  7. package/dist/src/commands/metaharness.js +25 -5
  8. package/dist/src/commands/policy.d.ts +4 -0
  9. package/dist/src/commands/policy.js +107 -0
  10. package/dist/src/index.js +18 -0
  11. package/dist/src/init/claudemd-generator.js +53 -2
  12. package/dist/src/mcp-client.js +25 -1
  13. package/dist/src/mcp-tools/capability-brain.d.ts +134 -0
  14. package/dist/src/mcp-tools/capability-brain.js +697 -0
  15. package/dist/src/mcp-tools/guidance-tools.d.ts +2 -0
  16. package/dist/src/mcp-tools/guidance-tools.js +369 -37
  17. package/dist/src/mcp-tools/index.d.ts +4 -1
  18. package/dist/src/mcp-tools/index.js +3 -1
  19. package/dist/src/mcp-tools/memory-tools.js +26 -0
  20. package/dist/src/mcp-tools/metaharness-tools.js +27 -1
  21. package/dist/src/mcp-tools/policy-tools.d.ts +3 -0
  22. package/dist/src/mcp-tools/policy-tools.js +121 -0
  23. package/dist/src/memory/memory-bridge.d.ts +11 -0
  24. package/dist/src/memory/memory-bridge.js +100 -21
  25. package/dist/src/memory/memory-initializer.d.ts +22 -1
  26. package/dist/src/memory/memory-initializer.js +184 -39
  27. package/dist/src/services/bounded-worker-pool.d.ts +28 -0
  28. package/dist/src/services/bounded-worker-pool.js +90 -0
  29. package/dist/src/services/harness-flywheel-runtime.d.ts +2 -0
  30. package/dist/src/services/harness-flywheel-runtime.js +18 -0
  31. package/dist/src/services/harness-flywheel.d.ts +4 -1
  32. package/dist/src/services/harness-flywheel.js +27 -6
  33. package/dist/src/services/policy-runtime.d.ts +38 -0
  34. package/dist/src/services/policy-runtime.js +340 -0
  35. package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
  36. package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
  37. package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
  38. package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
  39. package/node_modules/@claude-flow/codex/README.md +1044 -0
  40. package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
  41. package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
  42. package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
  43. package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
  44. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
  45. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
  46. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
  47. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
  48. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
  49. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
  50. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
  51. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
  52. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
  53. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
  54. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
  55. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
  56. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
  57. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
  58. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
  59. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
  60. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
  61. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
  62. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
  63. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
  64. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
  65. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
  66. package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
  67. package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
  68. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
  69. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
  70. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
  71. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
  72. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
  73. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
  74. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
  75. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
  76. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
  77. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
  78. package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
  79. package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
  80. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
  81. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
  82. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
  83. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
  84. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
  85. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
  86. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
  87. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
  88. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
  89. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
  90. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
  91. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
  92. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
  93. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
  94. package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
  95. package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
  96. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
  97. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
  98. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
  99. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
  100. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
  101. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
  102. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
  103. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
  104. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
  105. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
  106. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
  107. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
  108. package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
  109. package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
  110. package/node_modules/@claude-flow/codex/dist/index.js +54 -0
  111. package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
  112. package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
  113. package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
  114. package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
  115. package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
  116. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
  117. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
  118. package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
  119. package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
  120. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
  121. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
  122. package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
  123. package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
  124. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
  125. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
  126. package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
  127. package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
  128. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
  129. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
  130. package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
  131. package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
  132. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
  133. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
  134. package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
  135. package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
  136. package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
  137. package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
  138. package/node_modules/@claude-flow/codex/dist/types.js +8 -0
  139. package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
  140. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
  141. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
  142. package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
  143. package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
  144. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
  145. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
  146. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
  147. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
  148. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
  149. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
  150. package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
  151. package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
  152. package/node_modules/@claude-flow/codex/package.json +122 -0
  153. package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
  154. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
  155. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
  156. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
  157. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
  158. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
  159. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
  160. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
  161. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
  162. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
  163. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
  164. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
  165. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
  166. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
  167. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
  168. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
  169. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
  170. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
  171. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
  172. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
  173. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
  174. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
  175. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
  176. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
  177. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
  178. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
  179. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
  180. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
  181. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
  182. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
  183. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
  184. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
  185. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
  186. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
  187. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
  188. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
  189. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
  190. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
  191. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
  192. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
  193. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
  194. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
  195. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
  196. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
  197. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
  198. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
  199. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
  200. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
  201. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
  202. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
  203. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
  204. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
  205. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
  206. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
  207. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
  208. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
  209. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
  210. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
  211. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
  212. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
  213. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
  214. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
  215. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
  216. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
  217. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
  218. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
  219. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
  220. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
  221. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
  222. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
  223. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
  224. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
  225. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
  226. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
  227. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
  228. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
  229. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
  230. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
  231. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
  232. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
  233. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
  234. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
  235. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
  236. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
  237. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
  238. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
  239. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
  240. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
  241. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
  242. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
  243. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
  244. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
  245. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
  246. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
  247. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
  248. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
  249. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
  250. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
  251. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
  252. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
  253. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
  254. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
  255. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
  256. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
  257. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
  258. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
  259. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
  260. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
  261. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
  262. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
  263. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
  264. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
  265. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
  266. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
  267. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
  268. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
  269. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
  270. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
  271. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
  272. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
  273. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
  274. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
  275. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
  276. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
  277. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
  278. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
  279. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
  280. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
  281. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
  282. package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
  283. package/node_modules/@claude-flow/security/README.md +292 -0
  284. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
  285. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
  286. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
  287. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
  288. package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
  289. package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
  290. package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
  291. package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
  292. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
  293. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
  294. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
  295. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
  296. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
  297. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
  298. package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
  299. package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
  300. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
  301. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
  302. package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
  303. package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
  304. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
  305. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
  306. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
  307. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
  308. package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
  309. package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
  310. package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
  311. package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
  312. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
  313. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
  314. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
  315. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
  316. package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
  317. package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
  318. package/node_modules/@claude-flow/security/dist/index.js +176 -0
  319. package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
  320. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
  321. package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
  322. package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
  323. package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
  324. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
  325. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
  326. package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
  327. package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
  328. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
  329. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
  330. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
  331. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
  332. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
  333. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
  334. package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
  335. package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
  336. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
  337. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
  338. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
  339. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
  340. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
  341. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
  342. package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
  343. package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
  344. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
  345. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
  346. package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
  347. package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
  348. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
  349. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
  350. package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
  351. package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
  352. package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
  353. package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
  354. package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
  355. package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
  356. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
  357. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
  358. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
  359. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
  360. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
  361. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
  362. package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
  363. package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
  364. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
  365. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
  366. package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
  367. package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
  368. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
  369. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
  370. package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
  371. package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
  372. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
  373. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
  374. package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
  375. package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
  376. package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
  377. package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
  378. package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
  379. package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
  380. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
  381. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
  382. package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
  383. package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
  384. package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
  385. package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
  386. package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
  387. package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
  388. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
  389. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
  390. package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
  391. package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
  392. package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
  393. package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
  394. package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
  395. package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
  396. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
  397. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
  398. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
  399. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
  400. package/node_modules/@claude-flow/security/package.json +44 -0
  401. package/package.json +44 -12
  402. package/plugins/ruflo-metaharness/scripts/smoke.sh +22 -14
  403. package/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs +3 -1
@@ -7,6 +7,8 @@
7
7
  * @module @claude-flow/cli/mcp-tools/guidance
8
8
  */
9
9
  import { type MCPTool } from './types.js';
10
+ import { type CapabilityToolMetadata } from './capability-brain.js';
11
+ export declare function configureGuidanceToolProvider(provider: () => readonly CapabilityToolMetadata[]): void;
10
12
  /**
11
13
  * All guidance tools
12
14
  */
@@ -9,30 +9,41 @@
9
9
  import { getProjectCwd } from './types.js';
10
10
  import { validateIdentifier, validateText } from './validate-input.js';
11
11
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
12
- import { join, dirname } from 'node:path';
12
+ import { join, dirname, relative } from 'node:path';
13
13
  import { fileURLToPath } from 'node:url';
14
+ import { buildCapabilityBrain, recommendCapabilities, } from './capability-brain.js';
14
15
  const __filename = fileURLToPath(import.meta.url);
15
16
  const __dirname = dirname(__filename);
16
- const CLI_ROOT = join(__dirname, '../../..');
17
17
  /**
18
18
  * Find the project root by looking for .claude/ directory.
19
19
  * Tries CWD first (most common), then walks up from the CLI package location.
20
20
  */
21
21
  function findProjectRoot() {
22
- // Strategy 1: CWD (most reliable when invoked by user)
23
- if (existsSync(join(getProjectCwd(), '.claude'))) {
24
- return getProjectCwd();
22
+ const cwd = getProjectCwd();
23
+ let cwdIsCliPackage = false;
24
+ const cwdManifest = join(cwd, 'package.json');
25
+ if (existsSync(cwdManifest)) {
26
+ try {
27
+ const manifest = JSON.parse(readFileSync(cwdManifest, 'utf-8'));
28
+ cwdIsCliPackage = manifest.name === '@claude-flow/cli';
29
+ }
30
+ catch {
31
+ // An invalid project manifest is not a reason to hide discoverable files.
32
+ }
25
33
  }
26
- // Strategy 2: Walk up from CLI package location
27
- // CLI is at v3/@claude-flow/cli/ project root is 4 levels up
28
- const fromPackage = join(CLI_ROOT, '../../../..');
29
- if (existsSync(join(fromPackage, '.claude'))) {
30
- return fromPackage;
34
+ // User projects with a local .claude directory remain the primary root.
35
+ // Exclude the CLI package's own shipped .claude assets during repository
36
+ // development; otherwise ecosystem discovery silently stops at the package.
37
+ if (!cwdIsCliPackage && existsSync(join(cwd, '.claude'))) {
38
+ return cwd;
31
39
  }
32
- // Strategy 3: Walk up from CWD
33
- let dir = getProjectCwd();
40
+ // Walk up to a Git/workspace root. Worktrees use a .git file, so existsSync
41
+ // is intentionally used instead of requiring a directory.
42
+ let dir = cwd;
34
43
  for (let i = 0; i < 10; i++) {
35
- if (existsSync(join(dir, '.claude')))
44
+ if (existsSync(join(dir, '.git')))
45
+ return dir;
46
+ if (!(cwdIsCliPackage && dir === cwd) && existsSync(join(dir, '.claude')))
36
47
  return dir;
37
48
  const parent = dirname(dir);
38
49
  if (parent === dir)
@@ -40,9 +51,20 @@ function findProjectRoot() {
40
51
  dir = parent;
41
52
  }
42
53
  // Fallback: CWD
43
- return getProjectCwd();
54
+ return cwd;
44
55
  }
45
56
  const PROJECT_ROOT = findProjectRoot();
57
+ /**
58
+ * Injected by mcp-client after every MCP tool has been registered. Keeping the
59
+ * provider here avoids guidance importing the registry and creating a cycle.
60
+ */
61
+ let liveToolProvider = () => [];
62
+ export function configureGuidanceToolProvider(provider) {
63
+ liveToolProvider = provider;
64
+ }
65
+ function getCapabilityBrain() {
66
+ return buildCapabilityBrain(liveToolProvider());
67
+ }
46
68
  const CAPABILITY_CATALOG = {
47
69
  'agent-management': {
48
70
  name: 'Agent Management',
@@ -285,9 +307,6 @@ const WORKFLOW_TEMPLATES = {
285
307
  };
286
308
  // ── Dynamic Discovery ───────────────────────────────────────
287
309
  function discoverAgents() {
288
- const agentsDir = join(PROJECT_ROOT, '.claude/agents');
289
- if (!existsSync(agentsDir))
290
- return [];
291
310
  const agents = [];
292
311
  function walk(dir) {
293
312
  try {
@@ -306,27 +325,125 @@ function discoverAgents() {
306
325
  }
307
326
  catch { /* ignore */ }
308
327
  }
309
- walk(agentsDir);
328
+ const roots = [
329
+ join(PROJECT_ROOT, '.claude/agents'),
330
+ join(PROJECT_ROOT, '.agents/agents'),
331
+ ];
332
+ const pluginsDir = join(PROJECT_ROOT, 'plugins');
333
+ if (existsSync(pluginsDir)) {
334
+ for (const entry of readdirSync(pluginsDir, { withFileTypes: true })) {
335
+ if (entry.isDirectory())
336
+ roots.push(join(pluginsDir, entry.name, 'agents'));
337
+ }
338
+ }
339
+ for (const root of roots) {
340
+ if (existsSync(root))
341
+ walk(root);
342
+ }
310
343
  return [...new Set(agents)].sort();
311
344
  }
312
345
  function discoverSkills() {
313
- const skillsDir = join(PROJECT_ROOT, '.claude/skills');
314
- if (!existsSync(skillsDir))
315
- return [];
316
346
  const skills = [];
317
- try {
318
- const entries = readdirSync(skillsDir, { withFileTypes: true });
319
- for (const entry of entries) {
320
- if (entry.isDirectory()) {
321
- const skillFile = join(skillsDir, entry.name, 'SKILL.md');
322
- if (existsSync(skillFile)) {
323
- skills.push(entry.name);
347
+ function walk(dir) {
348
+ try {
349
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
350
+ const target = join(dir, entry.name);
351
+ if (entry.isDirectory()) {
352
+ walk(target);
353
+ }
354
+ else if (entry.name === 'SKILL.md') {
355
+ const content = readFileSync(target, 'utf-8');
356
+ const nameMatch = content.match(/^name:\s*(.+)$/m);
357
+ skills.push(nameMatch
358
+ ? nameMatch[1].trim().replace(/^["']|["']$/g, '')
359
+ : relative(PROJECT_ROOT, dirname(target)));
324
360
  }
325
361
  }
326
362
  }
363
+ catch {
364
+ // Missing or unreadable optional capability roots are reported by absence.
365
+ }
366
+ }
367
+ const roots = [
368
+ join(PROJECT_ROOT, '.claude/skills'),
369
+ join(PROJECT_ROOT, '.agents/skills'),
370
+ ];
371
+ const pluginsDir = join(PROJECT_ROOT, 'plugins');
372
+ if (existsSync(pluginsDir)) {
373
+ for (const entry of readdirSync(pluginsDir, { withFileTypes: true })) {
374
+ if (entry.isDirectory())
375
+ roots.push(join(pluginsDir, entry.name, 'skills'));
376
+ }
377
+ }
378
+ for (const root of roots) {
379
+ if (existsSync(root))
380
+ walk(root);
327
381
  }
328
- catch { /* ignore */ }
329
- return skills.sort();
382
+ return [...new Set(skills)].sort();
383
+ }
384
+ function discoverPlugins() {
385
+ const pluginsDir = join(PROJECT_ROOT, 'plugins');
386
+ if (!existsSync(pluginsDir))
387
+ return [];
388
+ const plugins = [];
389
+ for (const entry of readdirSync(pluginsDir, { withFileTypes: true })) {
390
+ if (!entry.isDirectory())
391
+ continue;
392
+ const manifestPath = join(pluginsDir, entry.name, '.claude-plugin', 'plugin.json');
393
+ if (!existsSync(manifestPath))
394
+ continue;
395
+ try {
396
+ const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
397
+ plugins.push({
398
+ id: entry.name,
399
+ name: manifest.name ?? entry.name,
400
+ version: manifest.version ?? 'unknown',
401
+ description: manifest.description ?? '',
402
+ manifest: relative(PROJECT_ROOT, manifestPath),
403
+ });
404
+ }
405
+ catch {
406
+ plugins.push({
407
+ id: entry.name,
408
+ name: entry.name,
409
+ version: 'unknown',
410
+ manifest: relative(PROJECT_ROOT, manifestPath),
411
+ invalidManifest: true,
412
+ });
413
+ }
414
+ }
415
+ return plugins.sort((left, right) => String(left.id).localeCompare(String(right.id), 'en-US'));
416
+ }
417
+ function discoverPackages() {
418
+ const packagesDir = join(PROJECT_ROOT, 'v3', '@claude-flow');
419
+ if (!existsSync(packagesDir))
420
+ return [];
421
+ const packages = [];
422
+ for (const entry of readdirSync(packagesDir, { withFileTypes: true })) {
423
+ if (!entry.isDirectory())
424
+ continue;
425
+ const manifestPath = join(packagesDir, entry.name, 'package.json');
426
+ if (!existsSync(manifestPath))
427
+ continue;
428
+ try {
429
+ const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
430
+ packages.push({
431
+ name: manifest.name ?? entry.name,
432
+ version: manifest.version ?? 'unknown',
433
+ description: manifest.description ?? '',
434
+ manifest: relative(PROJECT_ROOT, manifestPath),
435
+ });
436
+ }
437
+ catch {
438
+ packages.push({
439
+ name: entry.name,
440
+ version: 'unknown',
441
+ manifest: relative(PROJECT_ROOT, manifestPath),
442
+ invalidManifest: true,
443
+ });
444
+ }
445
+ }
446
+ return packages.sort((left, right) => String(left.name).localeCompare(String(right.name), 'en-US'));
330
447
  }
331
448
  // ── MCP Tool Definitions ────────────────────────────────────
332
449
  const guidanceCapabilities = {
@@ -349,6 +466,7 @@ const guidanceCapabilities = {
349
466
  handler: async (params) => {
350
467
  const area = params.area;
351
468
  const format = params.format || 'summary';
469
+ const brain = getCapabilityBrain();
352
470
  if (area) {
353
471
  const v = validateIdentifier(area, 'area');
354
472
  if (!v.valid)
@@ -356,14 +474,42 @@ const guidanceCapabilities = {
356
474
  }
357
475
  if (area) {
358
476
  const cap = CAPABILITY_CATALOG[area];
359
- if (!cap) {
360
- const available = Object.keys(CAPABILITY_CATALOG).join(', ');
477
+ const brainDomain = brain.domains.find((domain) => domain.id === area);
478
+ if (!cap && !brainDomain) {
479
+ const available = [
480
+ ...Object.keys(CAPABILITY_CATALOG),
481
+ ...brain.domains.map((domain) => domain.id),
482
+ ].filter((value, index, all) => all.indexOf(value) === index).join(', ');
361
483
  return { content: [{ type: 'text', text: JSON.stringify({ error: `Unknown area: ${area}`, available }, null, 2) }], isError: true };
362
484
  }
363
- return { content: [{ type: 'text', text: JSON.stringify(cap, null, 2) }] };
485
+ return {
486
+ content: [{
487
+ type: 'text',
488
+ text: JSON.stringify({
489
+ ...(cap ?? {}),
490
+ legacyCatalogStatus: cap ? 'compatibility-only; tool names may be deprecated aliases' : undefined,
491
+ legacyToolResolution: cap ? cap.tools.map((name) => ({
492
+ name,
493
+ registered: brain.domains.some((entry) => entry.tools.some((tool) => tool.name === name)),
494
+ })) : undefined,
495
+ capabilityBrain: brainDomain,
496
+ }, null, 2),
497
+ }],
498
+ };
364
499
  }
365
500
  if (format === 'detailed') {
366
- return { content: [{ type: 'text', text: JSON.stringify(CAPABILITY_CATALOG, null, 2) }] };
501
+ return {
502
+ content: [{
503
+ type: 'text',
504
+ text: JSON.stringify({
505
+ legacyCatalog: {
506
+ status: 'compatibility-only; use capabilityBrain for live routing',
507
+ areas: CAPABILITY_CATALOG,
508
+ },
509
+ capabilityBrain: brain,
510
+ }, null, 2),
511
+ }],
512
+ };
367
513
  }
368
514
  const summary = Object.entries(CAPABILITY_CATALOG).map(([key, val]) => ({
369
515
  area: key,
@@ -374,7 +520,30 @@ const guidanceCapabilities = {
374
520
  skillCount: val.skills.length,
375
521
  whenToUse: val.whenToUse,
376
522
  }));
377
- return { content: [{ type: 'text', text: JSON.stringify({ areas: summary, totalAreas: summary.length }, null, 2) }] };
523
+ return {
524
+ content: [{
525
+ type: 'text',
526
+ text: JSON.stringify({
527
+ areas: summary,
528
+ totalAreas: summary.length,
529
+ live: {
530
+ schemaVersion: brain.schemaVersion,
531
+ registeredToolCount: brain.coverage.registeredToolCount,
532
+ classifiedToolCount: brain.coverage.classifiedToolCount,
533
+ coveragePercent: brain.coverage.coveragePercent,
534
+ fallbackClassifiedTools: brain.coverage.fallbackClassifiedTools,
535
+ domains: brain.domains.map((domain) => ({
536
+ id: domain.id,
537
+ name: domain.name,
538
+ registeredToolCount: domain.tools.length,
539
+ health: domain.health,
540
+ authority: domain.authority,
541
+ risk: domain.risk,
542
+ })),
543
+ },
544
+ }, null, 2),
545
+ }],
546
+ };
378
547
  },
379
548
  };
380
549
  const guidanceRecommend = {
@@ -397,6 +566,8 @@ const guidanceRecommend = {
397
566
  if (!v.valid)
398
567
  return { content: [{ type: 'text', text: JSON.stringify({ error: v.error }, null, 2) }], isError: true };
399
568
  }
569
+ const brain = getCapabilityBrain();
570
+ const capabilityRecommendation = recommendCapabilities(brain, task);
400
571
  const matches = [];
401
572
  for (const route of TASK_ROUTES) {
402
573
  if (route.pattern.test(task)) {
@@ -430,12 +601,14 @@ const guidanceRecommend = {
430
601
  { area: 'hooks-automation', reason: 'Use hooks for task routing and learning' },
431
602
  ],
432
603
  tip: 'Use guidance_capabilities for a full list of all capability areas.',
604
+ capabilityBrain: capabilityRecommendation,
433
605
  }, null, 2),
434
606
  }],
435
607
  };
436
608
  }
437
609
  const primaryWorkflow = recommendations[0]?.workflow;
438
610
  const template = primaryWorkflow ? WORKFLOW_TEMPLATES[primaryWorkflow] : undefined;
611
+ const liveToolNames = new Set(brain.domains.flatMap((domain) => domain.tools.map((tool) => tool.name)));
439
612
  return {
440
613
  content: [{
441
614
  type: 'text',
@@ -445,7 +618,8 @@ const guidanceRecommend = {
445
618
  area: r.area,
446
619
  name: r.capability.name,
447
620
  description: r.capability.description,
448
- tools: r.capability.tools,
621
+ tools: r.capability.tools.filter((name) => liveToolNames.has(name)),
622
+ unregisteredLegacyToolRefs: r.capability.tools.filter((name) => !liveToolNames.has(name)),
449
623
  agents: r.capability.agents,
450
624
  skills: r.capability.skills,
451
625
  })),
@@ -455,6 +629,7 @@ const guidanceRecommend = {
455
629
  agents: template.agents,
456
630
  topology: template.topology,
457
631
  } : undefined,
632
+ capabilityBrain: capabilityRecommendation,
458
633
  }, null, 2),
459
634
  }],
460
635
  };
@@ -468,7 +643,7 @@ const guidanceDiscover = {
468
643
  properties: {
469
644
  type: {
470
645
  type: 'string',
471
- enum: ['agents', 'skills', 'all'],
646
+ enum: ['agents', 'skills', 'plugins', 'packages', 'all'],
472
647
  description: 'What to discover. Default: all.',
473
648
  },
474
649
  },
@@ -484,6 +659,18 @@ const guidanceDiscover = {
484
659
  const skills = discoverSkills();
485
660
  result.skills = { count: skills.length, names: skills };
486
661
  }
662
+ if (type === 'plugins' || type === 'all') {
663
+ const plugins = discoverPlugins();
664
+ result.plugins = { count: plugins.length, entries: plugins };
665
+ }
666
+ if (type === 'packages' || type === 'all') {
667
+ const packages = discoverPackages();
668
+ result.packages = { count: packages.length, entries: packages };
669
+ }
670
+ result.capabilityBrain = {
671
+ registeredTools: getCapabilityBrain().coverage.registeredToolCount,
672
+ note: 'Filesystem discovery reports installed artifacts; it does not prove configuration, health, or authorization.',
673
+ };
487
674
  return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
488
675
  },
489
676
  };
@@ -625,10 +812,155 @@ const guidanceQuickRef = {
625
812
  return { content: [{ type: 'text', text: JSON.stringify(ref, null, 2) }] };
626
813
  },
627
814
  };
815
+ const guidanceBrain = {
816
+ name: 'guidance_brain',
817
+ description: 'Use when choosing how to execute a task with Ruflo. Queries the live capability brain, covers every registered MCP tool, separates registration from configuration/reachability/health/authorization, recommends capabilities, and returns the validated implementation loop.',
818
+ inputSchema: {
819
+ type: 'object',
820
+ properties: {
821
+ mode: {
822
+ type: 'string',
823
+ enum: ['overview', 'capabilities', 'coverage', 'ecosystem', 'recommend', 'implementation-loop'],
824
+ description: 'Brain view. Default: overview.',
825
+ },
826
+ task: {
827
+ type: 'string',
828
+ description: 'Required for recommend mode.',
829
+ },
830
+ domain: {
831
+ type: 'string',
832
+ description: 'Optional capability domain filter for capabilities mode.',
833
+ },
834
+ },
835
+ },
836
+ handler: async (params) => {
837
+ const mode = params.mode ?? 'overview';
838
+ const task = params.task;
839
+ const domain = params.domain;
840
+ const brain = getCapabilityBrain();
841
+ if (domain) {
842
+ const validation = validateIdentifier(domain, 'domain');
843
+ if (!validation.valid) {
844
+ return {
845
+ content: [{ type: 'text', text: JSON.stringify({ error: validation.error }, null, 2) }],
846
+ isError: true,
847
+ };
848
+ }
849
+ }
850
+ let result;
851
+ switch (mode) {
852
+ case 'overview':
853
+ result = {
854
+ schemaVersion: brain.schemaVersion,
855
+ generatedAt: brain.generatedAt,
856
+ truthModel: brain.truthModel,
857
+ coverage: brain.coverage,
858
+ domainCount: brain.domains.length,
859
+ cliCommandCount: brain.cliCommands.length,
860
+ cliCommands: brain.cliCommands,
861
+ registeredDomains: brain.domains
862
+ .filter((entry) => entry.health.registered)
863
+ .map((entry) => ({
864
+ id: entry.id,
865
+ name: entry.name,
866
+ toolCount: entry.tools.length,
867
+ maturity: entry.maturity,
868
+ authority: entry.authority,
869
+ risk: entry.risk,
870
+ health: entry.health,
871
+ })),
872
+ implementationLoop: brain.implementationLoop.map((step) => step.id),
873
+ };
874
+ break;
875
+ case 'capabilities': {
876
+ const capabilities = domain
877
+ ? brain.domains.filter((entry) => entry.id === domain)
878
+ : brain.domains;
879
+ if (domain && capabilities.length === 0) {
880
+ return {
881
+ content: [{
882
+ type: 'text',
883
+ text: JSON.stringify({
884
+ error: `Unknown capability domain: ${domain}`,
885
+ available: brain.domains.map((entry) => entry.id),
886
+ }, null, 2),
887
+ }],
888
+ isError: true,
889
+ };
890
+ }
891
+ result = { schemaVersion: brain.schemaVersion, truthModel: brain.truthModel, capabilities };
892
+ break;
893
+ }
894
+ case 'coverage':
895
+ result = {
896
+ schemaVersion: brain.schemaVersion,
897
+ coverage: brain.coverage,
898
+ assignments: brain.domains.map((entry) => ({
899
+ domain: entry.id,
900
+ tools: entry.tools.map((tool) => tool.name),
901
+ })),
902
+ };
903
+ break;
904
+ case 'ecosystem': {
905
+ const agents = discoverAgents();
906
+ const skills = discoverSkills();
907
+ const plugins = discoverPlugins();
908
+ const packages = discoverPackages();
909
+ result = {
910
+ schemaVersion: brain.schemaVersion,
911
+ agents: { count: agents.length, names: agents },
912
+ skills: { count: skills.length, names: skills },
913
+ plugins: { count: plugins.length, entries: plugins },
914
+ packages: { count: packages.length, entries: packages },
915
+ cliCommands: { count: brain.cliCommands.length, names: brain.cliCommands },
916
+ availabilityNote: 'Installed or catalogued artifacts are not necessarily configured, reachable, healthy, or authorized.',
917
+ };
918
+ break;
919
+ }
920
+ case 'recommend': {
921
+ const validation = validateText(task, 'task');
922
+ if (!validation.valid) {
923
+ return {
924
+ content: [{ type: 'text', text: JSON.stringify({ error: validation.error }, null, 2) }],
925
+ isError: true,
926
+ };
927
+ }
928
+ result = recommendCapabilities(brain, task);
929
+ break;
930
+ }
931
+ case 'implementation-loop':
932
+ result = {
933
+ schemaVersion: brain.schemaVersion,
934
+ steps: brain.implementationLoop,
935
+ invariants: [
936
+ 'Recall precedes implementation.',
937
+ 'Testing and validation precede optimization.',
938
+ 'Benchmarks compare a source-bound candidate with a source-bound baseline.',
939
+ 'Learning and optimization cannot authorize promotion.',
940
+ 'Publishing requires separate authorization and immutable artifact evidence.',
941
+ ],
942
+ };
943
+ break;
944
+ default:
945
+ return {
946
+ content: [{
947
+ type: 'text',
948
+ text: JSON.stringify({
949
+ error: `Unknown mode: ${mode}`,
950
+ available: ['overview', 'capabilities', 'coverage', 'ecosystem', 'recommend', 'implementation-loop'],
951
+ }, null, 2),
952
+ }],
953
+ isError: true,
954
+ };
955
+ }
956
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
957
+ },
958
+ };
628
959
  /**
629
960
  * All guidance tools
630
961
  */
631
962
  export const guidanceTools = [
963
+ guidanceBrain,
632
964
  guidanceCapabilities,
633
965
  guidanceRecommend,
634
966
  guidanceDiscover,
@@ -20,9 +20,12 @@ export { transferTools } from './transfer-tools.js';
20
20
  export { securityTools } from './security-tools.js';
21
21
  export { embeddingsTools } from './embeddings-tools.js';
22
22
  export { claimsTools } from './claims-tools.js';
23
+ export { policyTools } from './policy-tools.js';
23
24
  export { wasmAgentTools } from './wasm-agent-tools.js';
24
25
  export { ruvllmWasmTools } from './ruvllm-tools.js';
25
- export { guidanceTools } from './guidance-tools.js';
26
+ export { configureGuidanceToolProvider, guidanceTools, } from './guidance-tools.js';
27
+ export { buildCapabilityBrain, CAPABILITY_DOMAINS, classifyCapabilityTool, IMPLEMENTATION_LOOP, recommendCapabilities, RUFLO_CLI_COMMANDS, } from './capability-brain.js';
28
+ export type { AvailabilityState, CapabilityAuthority, CapabilityBrain, CapabilityDomain, CapabilityDomainDefinition, CapabilityHealth, CapabilityMaturity, CapabilityRecommendation, CapabilityRisk, CapabilityToolMetadata, ImplementationLoopStep, } from './capability-brain.js';
26
29
  export { autopilotTools } from './autopilot-tools.js';
27
30
  export { metaharnessTools } from './metaharness-tools.js';
28
31
  export { testgenTools } from './testgen-tools.js';
@@ -19,9 +19,11 @@ export { transferTools } from './transfer-tools.js';
19
19
  export { securityTools } from './security-tools.js';
20
20
  export { embeddingsTools } from './embeddings-tools.js';
21
21
  export { claimsTools } from './claims-tools.js';
22
+ export { policyTools } from './policy-tools.js';
22
23
  export { wasmAgentTools } from './wasm-agent-tools.js';
23
24
  export { ruvllmWasmTools } from './ruvllm-tools.js';
24
- export { guidanceTools } from './guidance-tools.js';
25
+ export { configureGuidanceToolProvider, guidanceTools, } from './guidance-tools.js';
26
+ export { buildCapabilityBrain, CAPABILITY_DOMAINS, classifyCapabilityTool, IMPLEMENTATION_LOOP, recommendCapabilities, RUFLO_CLI_COMMANDS, } from './capability-brain.js';
25
27
  export { autopilotTools } from './autopilot-tools.js';
26
28
  // ADR-150 — MetaHarness MCP tools (score / genome / mcp-scan / threat-model / oia-audit)
27
29
  export { metaharnessTools } from './metaharness-tools.js';