claude-flow 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 (400) hide show
  1. package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
  2. package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
  3. package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
  4. package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
  5. package/node_modules/@claude-flow/codex/README.md +1044 -0
  6. package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
  7. package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
  8. package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
  9. package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
  10. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
  11. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
  12. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
  13. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
  14. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
  15. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
  16. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
  17. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
  18. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
  19. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
  20. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
  21. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
  22. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
  23. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
  24. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
  25. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
  26. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
  27. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
  28. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
  29. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
  30. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
  31. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
  32. package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
  33. package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
  34. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
  35. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
  36. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
  37. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
  38. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
  39. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
  40. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
  41. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
  42. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
  43. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
  44. package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
  45. package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
  46. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
  47. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
  48. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
  49. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
  50. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
  51. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
  52. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
  53. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
  54. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
  55. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
  56. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
  57. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
  58. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
  59. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
  60. package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
  61. package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
  62. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
  63. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
  64. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
  65. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
  66. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
  67. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
  68. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
  69. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
  70. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
  71. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
  72. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
  73. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
  74. package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
  75. package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
  76. package/node_modules/@claude-flow/codex/dist/index.js +54 -0
  77. package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
  78. package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
  79. package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
  80. package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
  81. package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
  82. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
  83. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
  84. package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
  85. package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
  86. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
  87. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
  88. package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
  89. package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
  90. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
  91. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
  92. package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
  93. package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
  94. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
  95. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
  96. package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
  97. package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
  98. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
  99. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
  100. package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
  101. package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
  102. package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
  103. package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
  104. package/node_modules/@claude-flow/codex/dist/types.js +8 -0
  105. package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
  106. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
  107. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
  108. package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
  109. package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
  110. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
  111. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
  112. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
  113. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
  114. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
  115. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
  116. package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
  117. package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
  118. package/node_modules/@claude-flow/codex/package.json +122 -0
  119. package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
  120. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
  121. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
  122. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
  123. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
  124. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
  125. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
  126. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
  127. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
  128. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
  129. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
  130. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
  131. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
  132. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
  133. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
  134. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
  135. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
  136. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
  137. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
  138. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
  139. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
  140. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
  141. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
  142. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
  143. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
  144. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
  145. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
  146. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
  147. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
  148. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
  149. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
  150. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
  151. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
  152. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
  153. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
  154. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
  155. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
  156. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
  157. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
  158. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
  159. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
  160. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
  161. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
  162. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
  163. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
  164. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
  165. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
  166. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
  167. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
  168. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
  169. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
  170. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
  171. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
  172. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
  173. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
  174. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
  175. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
  176. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
  177. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
  178. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
  179. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
  180. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
  181. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
  182. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
  183. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
  184. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
  185. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
  186. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
  187. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
  188. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
  189. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
  190. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
  191. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
  192. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
  193. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
  194. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
  195. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
  196. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
  197. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
  198. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
  199. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
  200. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
  201. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
  202. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
  203. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
  204. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
  205. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
  206. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
  207. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
  208. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
  209. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
  210. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
  211. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
  212. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
  213. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
  214. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
  215. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
  216. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
  217. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
  218. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
  219. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
  220. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
  221. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
  222. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
  223. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
  224. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
  225. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
  226. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
  227. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
  228. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
  229. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
  230. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
  231. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
  232. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
  233. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
  234. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
  235. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
  236. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
  237. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
  238. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
  239. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
  240. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
  241. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
  242. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
  243. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
  244. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
  245. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
  246. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
  247. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
  248. package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
  249. package/node_modules/@claude-flow/security/README.md +292 -0
  250. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
  251. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
  252. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
  253. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
  254. package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
  255. package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
  256. package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
  257. package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
  258. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
  259. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
  260. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
  261. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
  262. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
  263. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
  264. package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
  265. package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
  266. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
  267. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
  268. package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
  269. package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
  270. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
  271. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
  272. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
  273. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
  274. package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
  275. package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
  276. package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
  277. package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
  278. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
  279. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
  280. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
  281. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
  282. package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
  283. package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
  284. package/node_modules/@claude-flow/security/dist/index.js +176 -0
  285. package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
  286. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
  287. package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
  288. package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
  289. package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
  290. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
  291. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
  292. package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
  293. package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
  294. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
  295. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
  296. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
  297. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
  298. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
  299. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
  300. package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
  301. package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
  302. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
  303. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
  304. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
  305. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
  306. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
  307. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
  308. package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
  309. package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
  310. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
  311. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
  312. package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
  313. package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
  314. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
  315. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
  316. package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
  317. package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
  318. package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
  319. package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
  320. package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
  321. package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
  322. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
  323. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
  324. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
  325. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
  326. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
  327. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
  328. package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
  329. package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
  330. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
  331. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
  332. package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
  333. package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
  334. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
  335. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
  336. package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
  337. package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
  338. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
  339. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
  340. package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
  341. package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
  342. package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
  343. package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
  344. package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
  345. package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
  346. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
  347. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
  348. package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
  349. package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
  350. package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
  351. package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
  352. package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
  353. package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
  354. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
  355. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
  356. package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
  357. package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
  358. package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
  359. package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
  360. package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
  361. package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
  362. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
  363. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
  364. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
  365. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
  366. package/node_modules/@claude-flow/security/package.json +44 -0
  367. package/package.json +30 -8
  368. package/v3/@claude-flow/cli/catalog-manifest.json +4 -4
  369. package/v3/@claude-flow/cli/dist/src/commands/index.d.ts +1 -0
  370. package/v3/@claude-flow/cli/dist/src/commands/index.js +5 -3
  371. package/v3/@claude-flow/cli/dist/src/commands/memory.js +49 -5
  372. package/v3/@claude-flow/cli/dist/src/commands/metaharness.js +25 -5
  373. package/v3/@claude-flow/cli/dist/src/commands/policy.d.ts +4 -0
  374. package/v3/@claude-flow/cli/dist/src/commands/policy.js +107 -0
  375. package/v3/@claude-flow/cli/dist/src/index.js +18 -0
  376. package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.js +53 -2
  377. package/v3/@claude-flow/cli/dist/src/mcp-client.js +25 -1
  378. package/v3/@claude-flow/cli/dist/src/mcp-tools/capability-brain.d.ts +134 -0
  379. package/v3/@claude-flow/cli/dist/src/mcp-tools/capability-brain.js +697 -0
  380. package/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.d.ts +2 -0
  381. package/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.js +369 -37
  382. package/v3/@claude-flow/cli/dist/src/mcp-tools/index.d.ts +4 -1
  383. package/v3/@claude-flow/cli/dist/src/mcp-tools/index.js +3 -1
  384. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +26 -0
  385. package/v3/@claude-flow/cli/dist/src/mcp-tools/metaharness-tools.js +27 -1
  386. package/v3/@claude-flow/cli/dist/src/mcp-tools/policy-tools.d.ts +3 -0
  387. package/v3/@claude-flow/cli/dist/src/mcp-tools/policy-tools.js +121 -0
  388. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +11 -0
  389. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +100 -21
  390. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +22 -1
  391. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +184 -39
  392. package/v3/@claude-flow/cli/dist/src/services/bounded-worker-pool.d.ts +28 -0
  393. package/v3/@claude-flow/cli/dist/src/services/bounded-worker-pool.js +90 -0
  394. package/v3/@claude-flow/cli/dist/src/services/harness-flywheel-runtime.d.ts +2 -0
  395. package/v3/@claude-flow/cli/dist/src/services/harness-flywheel-runtime.js +18 -0
  396. package/v3/@claude-flow/cli/dist/src/services/harness-flywheel.d.ts +4 -1
  397. package/v3/@claude-flow/cli/dist/src/services/harness-flywheel.js +27 -6
  398. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.d.ts +38 -0
  399. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +340 -0
  400. package/v3/@claude-flow/cli/package.json +44 -12
@@ -40,6 +40,7 @@ import { join, dirname, resolve } from 'path';
40
40
  import { fileURLToPath } from 'url';
41
41
  import { runFlywheelWorker } from '../services/harness-flywheel-runtime.js';
42
42
  import { listFlywheelReceipts, promoteFlywheelCandidate, readFlywheelTransactionState, verifyFlywheelLedger, } from '../services/flywheel-transaction.js';
43
+ import { evaluatePolicyRequest } from '../services/policy-runtime.js';
43
44
  const __dirname = dirname(fileURLToPath(import.meta.url));
44
45
  // Subcommand → plugin script filename
45
46
  const SUBCOMMANDS = {
@@ -99,6 +100,8 @@ async function dispatchFlywheel(operation, positional, flags) {
99
100
  proposer: String(flywheelFlag(flags, 'proposer', 'auto')),
100
101
  receiptPrivateKeyPem: privateKeyPath ? readFileSync(resolve(privateKeyPath), 'utf8') : undefined,
101
102
  receiptPublicKeyPem: publicKeyPath ? readFileSync(resolve(publicKeyPath), 'utf8') : undefined,
103
+ maxConcurrency: Number(flywheelFlag(flags, 'maxConcurrency', 2)),
104
+ evaluationTimeoutMs: Number(flywheelFlag(flags, 'timeoutMs', 120_000)),
102
105
  });
103
106
  }
104
107
  }
@@ -124,11 +127,28 @@ async function dispatchFlywheel(operation, positional, flags) {
124
127
  data = { success: false, reason: 'promote requires <receipt-id> and --public-key <PEM path>' };
125
128
  }
126
129
  else {
127
- const publicKey = readFileSync(resolve(publicKeyPath), 'utf8');
128
- data = await promoteFlywheelCandidate(projectRoot, receiptId, {
129
- confirm: flywheelFlag(flags, 'confirm', false) === true,
130
- trustedPublicKeys: new Set([publicKey]),
131
- });
130
+ const policy = await evaluatePolicyRequest({
131
+ identity: { id: process.env.CLAUDE_FLOW_PRINCIPAL_ID ?? 'metaharness-local', type: 'agent', roles: ['optimizer'] },
132
+ action: {
133
+ type: 'metaharness.candidate.promote',
134
+ resource: receiptId,
135
+ environment: 'production',
136
+ destructive: true,
137
+ },
138
+ context: {
139
+ approvalIds: String(flywheelFlag(flags, 'approvalId', '')).split(',').filter(Boolean),
140
+ },
141
+ }, projectRoot);
142
+ if (policy.enforcedOutcome !== 'allowed') {
143
+ data = { success: false, reason: `policy-${policy.enforcedOutcome}:${policy.reason}`, policyReceiptId: policy.receiptId };
144
+ }
145
+ else {
146
+ const publicKey = readFileSync(resolve(publicKeyPath), 'utf8');
147
+ data = await promoteFlywheelCandidate(projectRoot, receiptId, {
148
+ confirm: flywheelFlag(flags, 'confirm', false) === true,
149
+ trustedPublicKeys: new Set([publicKey]),
150
+ });
151
+ }
132
152
  }
133
153
  }
134
154
  else {
@@ -0,0 +1,4 @@
1
+ import type { Command } from '../types.js';
2
+ export declare const policyCommand: Command;
3
+ export default policyCommand;
4
+ //# sourceMappingURL=policy.d.ts.map
@@ -0,0 +1,107 @@
1
+ import { output } from '../output.js';
2
+ import { autoMigratePolicyStateIfNeeded, evaluatePolicyRequest, loadPolicyState, revokePolicyApproval, setPolicyBudget, setPolicyMode, upsertPolicyRule, verifyPolicyLedger, } from '../services/policy-runtime.js';
3
+ function argJson(value, label) {
4
+ if (!value)
5
+ throw new Error(`${label} requires a JSON argument`);
6
+ try {
7
+ return JSON.parse(value);
8
+ }
9
+ catch {
10
+ throw new Error(`${label} must be valid JSON`);
11
+ }
12
+ }
13
+ function print(data) {
14
+ output.writeln(JSON.stringify(data, null, 2));
15
+ return { success: true, exitCode: 0, data };
16
+ }
17
+ function requireInteractiveAdministrator() {
18
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
19
+ throw new Error('policy administration requires an interactive local terminal');
20
+ }
21
+ }
22
+ export const policyCommand = {
23
+ name: 'policy',
24
+ description: 'Agentic policy engine — evaluate actions, manage rules/approvals, and verify the decision ledger (ADR-324)',
25
+ options: [
26
+ { name: 'mode', type: 'string', description: 'Policy mode: legacy | observe | enforce' },
27
+ { name: 'project-root', type: 'string', description: 'Project root containing .claude-flow/policy' },
28
+ ],
29
+ async action(context) {
30
+ const args = context.args ?? [];
31
+ const flags = context.flags ?? {};
32
+ const root = String(flags.projectRoot ?? process.cwd());
33
+ const operation = args[0] ?? 'status';
34
+ try {
35
+ if (operation === 'init' || operation === 'migrate') {
36
+ if (flags.mode || args[1])
37
+ requireInteractiveAdministrator();
38
+ const migration = await autoMigratePolicyStateIfNeeded(root);
39
+ const mode = String(flags.mode ?? args[1] ?? '');
40
+ if (mode) {
41
+ if (!['legacy', 'observe', 'enforce'].includes(mode))
42
+ throw new Error('mode must be legacy, observe, or enforce');
43
+ await setPolicyMode(mode, root);
44
+ }
45
+ return print({ ...migration, state: loadPolicyState(root) });
46
+ }
47
+ if (operation === 'status') {
48
+ const state = loadPolicyState(root);
49
+ return print({
50
+ version: state.version,
51
+ mode: state.mode,
52
+ migratedFrom: state.migratedFrom,
53
+ rules: state.rules.length,
54
+ budgets: state.budgets.length,
55
+ approvals: state.approvals.length,
56
+ receipts: state.receipts.length,
57
+ ledger: await verifyPolicyLedger(root),
58
+ });
59
+ }
60
+ if (operation === 'evaluate') {
61
+ return print(await evaluatePolicyRequest(argJson(args[1], 'evaluate'), root));
62
+ }
63
+ if (operation === 'rule' && args[1] === 'add') {
64
+ requireInteractiveAdministrator();
65
+ const rule = argJson(args[2], 'rule add');
66
+ await upsertPolicyRule(rule, root);
67
+ return print({ success: true, ruleId: rule.id });
68
+ }
69
+ if (operation === 'budget' && args[1] === 'set') {
70
+ requireInteractiveAdministrator();
71
+ const budget = argJson(args[2], 'budget set');
72
+ await setPolicyBudget(budget, root);
73
+ return print({ success: true, budgetId: budget.id });
74
+ }
75
+ if (operation === 'approve') {
76
+ throw new Error('approval issuance requires an authenticated human identity adapter; '
77
+ + 'the local TTY is not an identity credential');
78
+ }
79
+ if (operation === 'revoke') {
80
+ requireInteractiveAdministrator();
81
+ if (!args[1])
82
+ throw new Error('revoke requires an approval id');
83
+ return print({ success: await revokePolicyApproval(args[1], root), approvalId: args[1] });
84
+ }
85
+ if (operation === 'audit') {
86
+ const state = loadPolicyState(root);
87
+ return print({ receipts: state.receipts });
88
+ }
89
+ if (operation === 'verify')
90
+ return print(await verifyPolicyLedger(root));
91
+ throw new Error(`unknown policy operation: ${operation}`);
92
+ }
93
+ catch (error) {
94
+ const message = error instanceof Error ? error.message : String(error);
95
+ output.printError(message);
96
+ return { success: false, exitCode: 1, data: { error: message } };
97
+ }
98
+ },
99
+ examples: [
100
+ { command: 'ruflo policy status', description: 'Show policy mode and ledger health' },
101
+ { command: 'ruflo policy init --mode observe', description: 'Migrate an existing install without blocking legacy actions' },
102
+ { command: 'ruflo policy budget set \'{"id":"daily-model","action":"model.call","maxCostUsd":10,"periodMs":86400000}\'', description: 'Set an atomic policy budget ceiling' },
103
+ { command: 'ruflo policy evaluate \'{"identity":{"id":"agent-1","type":"agent"},"action":{"type":"deploy","environment":"production"}}\'', description: 'Evaluate an action and write a decision receipt' },
104
+ ],
105
+ };
106
+ export default policyCommand;
107
+ //# sourceMappingURL=policy.js.map
@@ -120,6 +120,24 @@ export class CLI {
120
120
  // stamp read + string compare (sub-ms), and the copy runs at most once per
121
121
  // version bump. Best-effort + silent — never blocks or fails a command.
122
122
  if (commandPath[0] !== 'init' && commandPath[0] !== 'update') {
123
+ // ADR-324: existing installations acquire a versioned policy state on
124
+ // first use. Migration is additive and starts in legacy mode, so older
125
+ // AgentDB, MCP, hooks, and swarm workflows keep their exact behavior.
126
+ try {
127
+ const { autoMigratePolicyStateIfNeeded } = await import('./services/policy-runtime.js');
128
+ const migration = await autoMigratePolicyStateIfNeeded(process.cwd());
129
+ if (migration.migrated && this.output.isVerbose()) {
130
+ this.output.printDebug(`Initialized agentic policy compatibility state (${migration.mode})`);
131
+ }
132
+ }
133
+ catch (error) {
134
+ // Legacy compatibility requires startup to remain available if the
135
+ // policy state cannot be initialized. Enforce-mode actions still
136
+ // fail at their authoritative dispatcher when state is unreadable.
137
+ if (this.output.isVerbose()) {
138
+ this.output.printDebug(`Policy compatibility migration skipped: ${error instanceof Error ? error.message : String(error)}`);
139
+ }
140
+ }
123
141
  try {
124
142
  const { autoRefreshHelpersIfStale } = await import('./init/helper-refresh.js');
125
143
  // alsoRefreshGlobal:true — refresh ~/.claude/helpers too, not just
@@ -19,6 +19,49 @@ function behavioralRules() {
19
19
  - Keep files under 500 lines
20
20
  - Validate input at system boundaries`;
21
21
  }
22
+ function policyGovernedWorkflow() {
23
+ return `## Ruflo Capability Brain & Implementation Loop
24
+
25
+ Ruflo is the coordination ledger and policy decision point. Claude Code is the
26
+ executor: after a Ruflo coordination call, continue implementing the task.
27
+
28
+ When it is registered, call
29
+ \`guidance_brain({ mode: "recommend", task: "..." })\` before complex Ruflo
30
+ work. Use its live registry instead of guessing tool names. Treat
31
+ \`registered\`, \`configured\`, \`reachable\`, \`healthy\`, and \`authorized\`
32
+ as separate facts. If the brain is unavailable, continue with the compatible
33
+ \`guidance_recommend\` tool, CLI discovery, and repository instructions.
34
+
35
+ Follow the returned loop:
36
+
37
+ 1. Recall memory and ADR constraints.
38
+ 2. Inspect source, runtime, dependencies, policy, and health.
39
+ 3. Route to the smallest capable topology, agents, skills, and tools.
40
+ 4. Plan acceptance criteria, safety envelope, ownership, and validation.
41
+ 5. Execute in isolated scopes; the coding agent performs the work.
42
+ 6. Test focused, regression, and failure paths.
43
+ 7. Validate types, security, policy, compatibility, and artifacts.
44
+ 8. Benchmark a source-bound candidate against a source-bound baseline.
45
+ 9. Optimize measured bottlenecks without weakening safety.
46
+ 10. Bind claims and evidence to exact source/build receipts.
47
+ 11. Reconcile concurrent handoffs and disclose limitations.
48
+ 12. Publish only through a separately authorized release gate.
49
+
50
+ ### Concurrency and authority
51
+
52
+ - Never allow two writers in one worktree; give each writing agent an isolated
53
+ worktree and explicit file ownership.
54
+ - Read-only research may run concurrently and report findings to the owner.
55
+ - Only the integration owner edits shared manifests and lockfiles or reconciles
56
+ overlapping changes.
57
+ - A child may drop capabilities but cannot add tools, network, secrets, spend,
58
+ concurrency, namespaces, or delegation depth.
59
+ - A lease or claim coordinates ownership; it does not authorize a side effect.
60
+ - Darwin, Flywheel, MetaHarness, memory, and neural systems may propose or
61
+ evaluate candidates but cannot self-promote or expand their SafetyEnvelope.
62
+ - Bind tests, benchmarks, policy decisions, and release evidence to an exact
63
+ commit or immutable dirty-worktree snapshot.`;
64
+ }
22
65
  function agentComms() {
23
66
  return `## Agent Comms (SendMessage-First Coordination)
24
67
 
@@ -61,8 +104,10 @@ SendMessage({ to: "researcher", summary: "Start", message: "[task context]" })
61
104
  - ALWAYS name agents — \`name: "role"\` makes them addressable
62
105
  - ALWAYS include comms instructions in prompts — who to message, what to send
63
106
  - Spawn ALL agents in ONE message with \`run_in_background: true\`
64
- - After spawning: STOP, tell user what's running, wait for results
65
- - NEVER poll status — agents message back or complete automatically`;
107
+ - After spawning, continue independent local work; wait only when a dependency
108
+ genuinely blocks progress
109
+ - Do not poll repeatedly — agents message back or complete automatically
110
+ - Give every writing agent an isolated worktree and a non-overlapping file scope`;
66
111
  }
67
112
  function swarmConfig(options) {
68
113
  return `## Swarm & Routing
@@ -283,6 +328,7 @@ CLAUDE_FLOW_MEMORY_PATH=./data/memory
283
328
  const TEMPLATE_SECTIONS = {
284
329
  minimal: [
285
330
  behavioralRules,
331
+ (_opts) => policyGovernedWorkflow(),
286
332
  (_opts) => agentComms(),
287
333
  swarmConfig,
288
334
  (_opts) => buildAndTest(),
@@ -291,6 +337,7 @@ const TEMPLATE_SECTIONS = {
291
337
  ],
292
338
  standard: [
293
339
  behavioralRules,
340
+ (_opts) => policyGovernedWorkflow(),
294
341
  (_opts) => agentComms(),
295
342
  swarmConfig,
296
343
  (_opts) => memoryAndLearning(),
@@ -301,6 +348,7 @@ const TEMPLATE_SECTIONS = {
301
348
  ],
302
349
  full: [
303
350
  behavioralRules,
351
+ (_opts) => policyGovernedWorkflow(),
304
352
  (_opts) => agentComms(),
305
353
  swarmConfig,
306
354
  (_opts) => memoryAndLearning(),
@@ -315,6 +363,7 @@ const TEMPLATE_SECTIONS = {
315
363
  ],
316
364
  security: [
317
365
  behavioralRules,
366
+ (_opts) => policyGovernedWorkflow(),
318
367
  (_opts) => agentComms(),
319
368
  swarmConfig,
320
369
  (_opts) => securitySection(),
@@ -326,6 +375,7 @@ const TEMPLATE_SECTIONS = {
326
375
  ],
327
376
  performance: [
328
377
  behavioralRules,
378
+ (_opts) => policyGovernedWorkflow(),
329
379
  (_opts) => agentComms(),
330
380
  swarmConfig,
331
381
  (_opts) => performanceSection(),
@@ -338,6 +388,7 @@ const TEMPLATE_SECTIONS = {
338
388
  ],
339
389
  solo: [
340
390
  behavioralRules,
391
+ (_opts) => policyGovernedWorkflow(),
341
392
  (_opts) => agentComms(),
342
393
  (_opts) => memoryAndLearning(),
343
394
  (_opts) => buildAndTest(),
@@ -21,6 +21,8 @@ import { analyzeTools } from './mcp-tools/analyze-tools.js';
21
21
  import { progressTools } from './mcp-tools/progress-tools.js';
22
22
  import { embeddingsTools } from './mcp-tools/embeddings-tools.js';
23
23
  import { claimsTools } from './mcp-tools/claims-tools.js';
24
+ import { policyTools } from './mcp-tools/policy-tools.js';
25
+ import { authorizeMcpTool, classifyMcpTool } from './services/policy-runtime.js';
24
26
  import { securityTools } from './mcp-tools/security-tools.js';
25
27
  import { transferTools } from './mcp-tools/transfer-tools.js';
26
28
  // V2 Compatibility tools
@@ -47,7 +49,7 @@ import { wasmAgentTools } from './mcp-tools/wasm-agent-tools.js';
47
49
  // the local WASM-sandboxed `wasm_agent_*` (rvagent) tools. Lives in the
48
50
  // `ruflo-agent` plugin.
49
51
  import { managedAgentTools } from './mcp-tools/managed-agent-tools.js';
50
- import { guidanceTools } from './mcp-tools/guidance-tools.js';
52
+ import { configureGuidanceToolProvider, guidanceTools, } from './mcp-tools/guidance-tools.js';
51
53
  import { autopilotTools } from './mcp-tools/autopilot-tools.js';
52
54
  // ADR-150 — MetaHarness MCP tools (score / genome / mcp-scan / threat-model / oia-audit)
53
55
  import { metaharnessTools } from './mcp-tools/metaharness-tools.js';
@@ -127,6 +129,10 @@ registerTools([
127
129
  ...progressTools,
128
130
  ...embeddingsTools,
129
131
  ...claimsTools,
132
+ // Remote MCP exposes evaluation/status only. Administrative mutation is a
133
+ // local CLI bootstrap/recovery operation until the server has authenticated
134
+ // human identity propagation.
135
+ ...policyTools.filter((tool) => ['policy_evaluate', 'policy_status'].includes(tool.name)),
130
136
  ...securityTools,
131
137
  ...transferTools,
132
138
  // V2 Compatibility tools
@@ -167,6 +173,15 @@ registerTools([
167
173
  // ADR-164 Phase 4 §5.1.8 — http_fetch (1 tool, secure-by-default HTTP probe)
168
174
  ...httpFetchTools,
169
175
  ]);
176
+ // The capability brain consumes the completed live registry. This is injected
177
+ // after registration to keep guidance honest and avoid a registry import cycle.
178
+ configureGuidanceToolProvider(() => Array.from(TOOL_REGISTRY.values()).map((tool) => ({
179
+ name: tool.name,
180
+ description: tool.description,
181
+ category: tool.category,
182
+ tags: tool.tags,
183
+ version: tool.version,
184
+ })));
170
185
  /**
171
186
  * MCP Client Error
172
187
  */
@@ -211,6 +226,15 @@ export async function callMCPTool(toolName, input = {}, context) {
211
226
  throw new MCPClientError(`MCP tool not found: ${toolName}`, toolName);
212
227
  }
213
228
  try {
229
+ // ADR-324: one policy chokepoint for every local CLI/MCP invocation.
230
+ // Policy administration is not exempt: authorization calls the engine
231
+ // directly, so there is no recursive MCP dispatch. In enforce mode an
232
+ // administrator must explicitly allow policy.* actions or use the local
233
+ // CLI bootstrap path.
234
+ const decision = await authorizeMcpTool(toolName, input, context, classifyMcpTool(toolName));
235
+ if (decision.enforcedOutcome !== 'allowed') {
236
+ throw new Error(`policy-${decision.enforcedOutcome}:${decision.reason}; receipt=${decision.receiptId}`);
237
+ }
214
238
  // Call the tool handler
215
239
  const result = await tool.handler(input, context);
216
240
  // ADR-146 P2: scan every tool result for indirect-injection before it
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Ruflo capability brain.
3
+ *
4
+ * This module is deliberately data-only: it describes the complete MCP surface
5
+ * without importing the MCP registry. The registry injects its live tool list
6
+ * into guidance-tools after registration, which avoids a circular dependency
7
+ * and prevents documentation from being mistaken for runtime availability.
8
+ */
9
+ export type CapabilityMaturity = 'stable' | 'experimental' | 'compatibility';
10
+ export type CapabilityAuthority = 'advisory' | 'capability-plane' | 'control-plane';
11
+ export type CapabilityRisk = 'read-only' | 'reversible' | 'privileged';
12
+ export type AvailabilityState = boolean | 'unknown';
13
+ export type CapabilityRiskFlag = 'read' | 'local-write' | 'memory-poisoning' | 'process-exec' | 'network' | 'credential-pii' | 'spend' | 'concurrency' | 'destructive' | 'approval' | 'promotion';
14
+ export interface CapabilityToolMetadata {
15
+ name: string;
16
+ description?: string;
17
+ category?: string;
18
+ tags?: string[];
19
+ version?: string;
20
+ }
21
+ export interface CapabilityHealth {
22
+ /** Present in this running MCP server's registry. */
23
+ registered: boolean;
24
+ /** Requires an operator/provider configuration check. */
25
+ configured: AvailabilityState;
26
+ /** Requires a non-mutating dependency probe. */
27
+ reachable: AvailabilityState;
28
+ /** Requires a service-specific health check. */
29
+ healthy: AvailabilityState;
30
+ /** Requires a policy evaluation for the current subject and action. */
31
+ authorized: AvailabilityState;
32
+ }
33
+ export interface CapabilityDomainDefinition {
34
+ id: string;
35
+ name: string;
36
+ description: string;
37
+ prefixes: string[];
38
+ exactTools?: string[];
39
+ taskSignals: string[];
40
+ commands: string[];
41
+ skills: string[];
42
+ agents: string[];
43
+ maturity: CapabilityMaturity;
44
+ authority: CapabilityAuthority;
45
+ risk: CapabilityRisk;
46
+ optionalRuntime?: boolean;
47
+ packageOwners?: string[];
48
+ pluginOwners?: string[];
49
+ availabilityMode?: 'always-local' | 'conditional-registration' | 'registered-degraded' | 'configured-remote' | 'policy-filtered';
50
+ /**
51
+ * Conservative union of effects possible anywhere in this domain.
52
+ * Individual tool descriptors may narrow or expand this reviewed profile.
53
+ */
54
+ riskFlags?: CapabilityRiskFlag[];
55
+ loopPhases?: Array<'discover' | 'recall' | 'authorize-claim' | 'route-plan' | 'branch-propose' | 'execute' | 'validate-critique' | 'commit-validated' | 'observe' | 'publish'>;
56
+ useWhen: string;
57
+ verifyBeforeUse: string[];
58
+ }
59
+ export interface CapabilityDomain extends CapabilityDomainDefinition {
60
+ packageOwners: string[];
61
+ pluginOwners: string[];
62
+ availabilityMode: NonNullable<CapabilityDomainDefinition['availabilityMode']>;
63
+ riskFlags: NonNullable<CapabilityDomainDefinition['riskFlags']>;
64
+ loopPhases: NonNullable<CapabilityDomainDefinition['loopPhases']>;
65
+ tools: Array<CapabilityToolMetadata & {
66
+ domain: string;
67
+ packageOwner: string;
68
+ pluginOwner?: string;
69
+ availabilityMode: NonNullable<CapabilityDomainDefinition['availabilityMode']>;
70
+ authority: CapabilityAuthority;
71
+ risk: CapabilityRisk;
72
+ riskFlags: NonNullable<CapabilityDomainDefinition['riskFlags']>;
73
+ loopPhases: NonNullable<CapabilityDomainDefinition['loopPhases']>;
74
+ }>;
75
+ health: CapabilityHealth;
76
+ }
77
+ export interface CapabilityBrain {
78
+ schemaVersion: 'ruflo.capability-brain/v1';
79
+ generatedAt: string;
80
+ truthModel: {
81
+ catalogued: string;
82
+ registered: string;
83
+ configured: string;
84
+ reachable: string;
85
+ healthy: string;
86
+ authorized: string;
87
+ };
88
+ domains: CapabilityDomain[];
89
+ cliCommands: string[];
90
+ implementationLoop: ImplementationLoopStep[];
91
+ coverage: {
92
+ registeredToolCount: number;
93
+ classifiedToolCount: number;
94
+ coveragePercent: number;
95
+ fallbackClassifiedTools: string[];
96
+ duplicateToolNames: string[];
97
+ };
98
+ }
99
+ /** Top-level commands from the CLI command loader. Kept as a checked manifest. */
100
+ export declare const RUFLO_CLI_COMMANDS: readonly ["init", "start", "status", "task", "session", "agent", "swarm", "memory", "mcp", "config", "migrate", "hooks", "workflow", "hive-mind", "process", "daemon", "version", "neural", "security", "performance", "providers", "plugins", "deployment", "claims", "policy", "embeddings", "completions", "doctor", "verify", "analyze", "route", "progress", "issues", "update", "ruvector", "benchmark", "guidance", "appliance", "appliance-advanced", "transfer-store", "cleanup", "autopilot", "gaia-bench", "metaharness", "eject", "funnel", "settings", "auth", "proxy", "advisor", "spinner", "announcements"];
101
+ export interface ImplementationLoopStep {
102
+ id: string;
103
+ name: string;
104
+ purpose: string;
105
+ preferredTools: string[];
106
+ requiredEvidence: string;
107
+ mutation: 'none' | 'workspace' | 'external';
108
+ }
109
+ export declare const IMPLEMENTATION_LOOP: readonly ImplementationLoopStep[];
110
+ /**
111
+ * Domain order is significant: narrow/specialized matches precede broad
112
+ * compatibility prefixes. Every registered tool is eventually classified by
113
+ * the final runtime-services domain, but fallback classifications are reported.
114
+ */
115
+ export declare const CAPABILITY_DOMAINS: readonly CapabilityDomainDefinition[];
116
+ export declare function classifyCapabilityTool(tool: CapabilityToolMetadata): CapabilityDomainDefinition;
117
+ export declare function buildCapabilityBrain(registeredTools: readonly CapabilityToolMetadata[], now?: Date): CapabilityBrain;
118
+ export interface CapabilityRecommendation {
119
+ task: string;
120
+ domains: Array<{
121
+ id: string;
122
+ name: string;
123
+ score: number;
124
+ registeredTools: string[];
125
+ health: CapabilityHealth;
126
+ authority: CapabilityAuthority;
127
+ risk: CapabilityRisk;
128
+ verifyBeforeUse: string[];
129
+ }>;
130
+ implementationLoop: ImplementationLoopStep[];
131
+ guardrails: string[];
132
+ }
133
+ export declare function recommendCapabilities(brain: CapabilityBrain, task: string): CapabilityRecommendation;
134
+ //# sourceMappingURL=capability-brain.d.ts.map