claude-flow-novice 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/.claude/agents/cfn-loop/product-owner.md +54 -4
  2. package/.claude/commands/cfn-claude-sync.md +303 -0
  3. package/.claude/commands/cfn-loop-epic.md +290 -0
  4. package/.claude/commands/cfn-loop-single.md +168 -0
  5. package/.claude/commands/cfn-loop-sprints.md +384 -0
  6. package/.claude/commands/cfn-loop.md +180 -0
  7. package/.claude/commands/metrics-summary.md +58 -0
  8. package/.claude/commands/parse-epic.md +357 -0
  9. package/.claude/settings.json +4 -4
  10. package/.claude/settings.local.json +9 -2
  11. package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
  12. package/.claude-flow-novice/dist/mcp/server.js +21 -2
  13. package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
  14. package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
  15. package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
  16. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
  17. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
  18. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
  19. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  20. package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
  21. package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
  22. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
  23. package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
  24. package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
  25. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
  26. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
  27. package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
  28. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
  29. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
  30. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
  31. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
  32. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
  33. package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
  34. package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
  35. package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
  36. package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
  37. package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
  38. package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
  39. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
  40. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
  41. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
  42. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
  43. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
  44. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  45. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
  46. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  47. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
  48. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
  49. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
  50. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  51. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
  52. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
  53. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
  54. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
  55. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
  56. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  57. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
  58. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
  59. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
  60. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
  61. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
  62. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
  63. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
  64. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
  65. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
  66. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
  67. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
  68. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
  69. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
  70. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
  71. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
  72. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
  73. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
  74. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
  75. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
  76. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
  77. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
  78. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
  79. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
  80. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
  81. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
  82. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
  83. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
  84. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
  85. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
  86. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
  87. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
  88. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
  89. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
  90. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
  91. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
  92. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
  93. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
  94. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
  95. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
  96. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
  97. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
  98. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
  99. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
  100. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
  101. package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
  102. package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
  103. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
  104. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
  105. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
  106. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
  107. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
  108. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  109. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
  110. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
  111. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
  112. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
  113. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
  114. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
  115. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
  116. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
  117. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
  118. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
  119. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
  120. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
  121. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
  122. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
  123. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
  124. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
  125. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
  126. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
  127. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
  128. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
  130. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
  131. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
  132. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
  133. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
  134. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
  136. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
  137. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
  138. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
  139. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
  140. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
  141. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
  142. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
  143. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
  144. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
  145. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
  146. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
  147. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
  148. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
  149. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
  150. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
  151. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
  152. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
  153. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
  154. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
  155. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
  156. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
  157. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
  158. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
  159. package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
  160. package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
  161. package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
  162. package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
  163. package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
  164. package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
  165. package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
  166. package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
  167. package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
  168. package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
  169. package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
  170. package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
  171. package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
  172. package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
  173. package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
  174. package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
  175. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
  176. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
  177. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
  178. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
  179. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
  180. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
  181. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
  182. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
  183. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
  184. package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
  185. package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
  186. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
  187. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
  188. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
  189. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
  190. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
  191. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
  192. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
  193. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
  194. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
  195. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
  197. package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
  198. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
  199. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
  201. package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
  203. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
  205. package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
  207. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
  209. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
  211. package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
  213. package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
  214. package/.claude-flow-novice/metrics.db +0 -0
  215. package/.claude-flow-novice/metrics.db-shm +0 -0
  216. package/.claude-flow-novice/metrics.db-wal +0 -0
  217. package/CLAUDE.md +29 -0
  218. package/README.md +27 -0
  219. package/config/hooks/post-edit-pipeline.js +36 -2
  220. package/examples/metrics-counter-demo.ts +106 -0
  221. package/examples/persistent-metrics-demo.ts +83 -0
  222. package/examples/phase-5-multi-level-control.ts +282 -0
  223. package/examples/session-pool-optimizer-example.ts +311 -0
  224. package/package.json +15 -3
  225. package/scripts/check-routing-stats.cjs +122 -0
  226. package/scripts/pre-publish-validation.cjs +212 -0
  227. package/scripts/test-provider-routing.cjs +228 -0
  228. package/scripts/test-routing-telemetry.cjs +147 -0
  229. package/scripts/test-zai-10k.cjs +81 -0
  230. package/scripts/test-zai-api.cjs +191 -0
  231. package/scripts/test-zai-diagnostic.cjs +151 -0
  232. package/scripts/test-zai-final.cjs +128 -0
  233. package/scripts/test-zai-with-env.cjs +85 -0
  234. package/scripts/validate-coordination-cli.js +69 -0
  235. package/scripts/validate-coordination-toggle-integration.cjs +501 -0
  236. package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
  237. package/src/observability/metrics-counter.ts +347 -0
  238. package/src/observability/metrics-storage.ts +356 -0
  239. package/src/observability/telemetry.ts +658 -0
  240. package/src/slash-commands/cfn-claude-sync.js +533 -0
  241. package/src/slash-commands/index.js +5 -0
  242. package/src/slash-commands/metrics-summary-class.js +74 -0
  243. package/src/slash-commands/metrics-summary.js +335 -0
  244. package/src/slash-commands/register-all-commands.js +12 -0
@@ -0,0 +1,384 @@
1
+ ---
2
+ description: "Execute single phase with multiple sprints using CFN Loop autonomous coordination"
3
+ argument-hint: "<phase description>"
4
+ allowed-tools: ["Task", "TodoWrite", "Read", "Write", "Edit", "Bash", "Glob", "Grep"]
5
+ ---
6
+
7
+ # CFN Loop Sprints - Single Phase, Multiple Sprints
8
+
9
+ Execute a single phase broken into multiple sprints using CFN Loop autonomous coordination.
10
+
11
+ 🚨 **AUTONOMOUS SPRINT-BASED SELF-LOOPING PROCESS**
12
+
13
+ **Phase Goal**: $ARGUMENTS
14
+
15
+ ## CFN Loop Structure (4 Loops)
16
+
17
+ ```
18
+ LOOP 0: Epic/Sprint Orchestration (THIS COMMAND - sprint level)
19
+ ├─ Sprint 1 → Sprint 2 → Sprint 3 → ... → Sprint N
20
+
21
+ LOOP 1: Phase Execution (single phase with multiple sprints)
22
+
23
+ LOOP 2: Consensus Validation (≥90% Byzantine consensus per sprint)
24
+
25
+ LOOP 3: Primary Swarm Execution (implementation with confidence scores)
26
+ ```
27
+
28
+ ## Sprint Planning (Loop 0)
29
+
30
+ ### Step 1: Parse Phase into Sprints
31
+ ```javascript
32
+ const sprintPlan = {
33
+ phase_name: "User Authentication",
34
+ sprints: [
35
+ {
36
+ sprint_id: "1.1",
37
+ name: "Core Login API",
38
+ deliverables: [
39
+ "POST /auth/login endpoint",
40
+ "JWT token generation",
41
+ "Password validation"
42
+ ],
43
+ estimated_agents: 3,
44
+ dependencies: []
45
+ },
46
+ {
47
+ sprint_id: "1.2",
48
+ name: "Password Security",
49
+ deliverables: [
50
+ "bcrypt password hashing",
51
+ "Salt generation",
52
+ "Hash verification"
53
+ ],
54
+ estimated_agents: 2,
55
+ dependencies: ["1.1"]
56
+ },
57
+ {
58
+ sprint_id: "1.3",
59
+ name: "Token Management",
60
+ deliverables: [
61
+ "Token refresh endpoint",
62
+ "Token expiration handling",
63
+ "Token blacklisting"
64
+ ],
65
+ estimated_agents: 4,
66
+ dependencies: ["1.1", "1.2"]
67
+ }
68
+ ]
69
+ }
70
+ ```
71
+
72
+ ### Step 2: Store Scope Boundaries (Per Sprint)
73
+ ```javascript
74
+ mcp__claude-flow-novice__memory_usage({
75
+ action: "store",
76
+ namespace: "scope-control",
77
+ key: "sprint-boundaries",
78
+ value: JSON.stringify({
79
+ primary_goal: "User Authentication Phase",
80
+ sprint_scope: {
81
+ "1.1": {
82
+ in_scope: ["Login API", "JWT generation", "Basic validation"],
83
+ out_of_scope: ["OAuth", "MFA", "Password reset"]
84
+ },
85
+ "1.2": {
86
+ in_scope: ["bcrypt hashing", "Salt generation"],
87
+ out_of_scope: ["Argon2", "Key derivation functions"]
88
+ },
89
+ "1.3": {
90
+ in_scope: ["Refresh tokens", "Expiration", "Blacklist"],
91
+ out_of_scope: ["Sliding sessions", "Device tracking"]
92
+ }
93
+ },
94
+ risk_profile: "public-facing-medium-risk"
95
+ })
96
+ })
97
+ ```
98
+
99
+ ## Sprint Execution (Loop 1)
100
+
101
+ For EACH sprint in phase:
102
+
103
+ ### Sprint Initialization
104
+ ```javascript
105
+ // SPRINT 1.1: Core Login API
106
+ console.log(`Sprint ${sprintId}: ${sprintName}`);
107
+
108
+ // Initialize swarm for sprint
109
+ mcp__claude-flow-novice__swarm_init({
110
+ topology: "mesh", // Use mesh for smaller sprint teams (2-7 agents)
111
+ maxAgents: 3,
112
+ strategy: "balanced"
113
+ })
114
+
115
+ // Execute Loop 3 (Primary Swarm)
116
+ Task("Backend Dev 1", `
117
+ Implement POST /auth/login endpoint
118
+
119
+ Requirements:
120
+ - Accept email/password in request body
121
+ - Validate credentials against database
122
+ - Generate JWT on successful auth
123
+ - Return 401 on failure
124
+
125
+ MANDATORY: After EVERY file edit:
126
+ node config/hooks/post-edit-pipeline.js "[FILE_PATH]" --memory-key "swarm/sprint-1.1/backend-1"
127
+
128
+ Report confidence score when complete.
129
+ `, "backend-dev")
130
+
131
+ Task("Tester 1", `
132
+ Create tests for login endpoint...
133
+
134
+ MANDATORY: Run post-edit hook after each test file.
135
+
136
+ Report confidence score.
137
+ `, "tester")
138
+
139
+ Task("Security 1", `
140
+ Review login security...
141
+
142
+ Report confidence score.
143
+ `, "security-specialist")
144
+ ```
145
+
146
+ ### Sprint Self-Assessment Gate
147
+ ```javascript
148
+ // Collect confidence scores
149
+ const sprintConfidence = {
150
+ "backend-1": 0.88,
151
+ "tester-1": 0.82,
152
+ "security-1": 0.79
153
+ }
154
+
155
+ // Gate logic
156
+ if (allAgents >= 0.75) {
157
+ // PROCEED to Loop 2 (Consensus)
158
+ console.log("Sprint ${sprintId} gate PASSED. Proceeding to consensus...");
159
+ } else {
160
+ // RELAUNCH Loop 3 (autonomous retry)
161
+ console.log("Sprint ${sprintId} gate FAILED. Relaunching Loop 3 with feedback...");
162
+ }
163
+ ```
164
+
165
+ ### Sprint Consensus Validation
166
+ ```javascript
167
+ // MESSAGE 2: Validators (AFTER sprint implementation complete)
168
+ mcp__claude-flow-novice__swarm_init({
169
+ topology: "mesh",
170
+ maxAgents: 2,
171
+ strategy: "balanced"
172
+ })
173
+
174
+ Task("Reviewer 1", `
175
+ Review completed Sprint ${sprintId} work:
176
+ - Files: [list specific files]
177
+ - Deliverables: ${JSON.stringify(deliverables)}
178
+
179
+ Validate code quality, test coverage, security.
180
+ Report consensus score.
181
+ `, "reviewer")
182
+
183
+ Task("Architect 1", `
184
+ Validate Sprint ${sprintId} architecture:
185
+ - API design consistency
186
+ - Integration patterns
187
+ - Scalability considerations
188
+
189
+ Report consensus score.
190
+ `, "architect")
191
+ ```
192
+
193
+ ### Sprint Product Owner Decision
194
+ ```javascript
195
+ Task("Product Owner", `
196
+ GOAP DECISION - Sprint ${sprintId} Complete
197
+
198
+ CURRENT STATE:
199
+ - Sprint ${sprintId} consensus: ${consensusScore}
200
+ - Remaining sprints: ${remainingSprints}
201
+ - Validator concerns: ${concerns}
202
+
203
+ RETRIEVE SPRINT SCOPE:
204
+ mcp__claude-flow-novice__memory_usage({
205
+ action: "retrieve",
206
+ namespace: "scope-control",
207
+ key: "sprint-boundaries"
208
+ })
209
+
210
+ EXECUTE GOAP A* SEARCH:
211
+ 1. Classify concerns by sprint scope
212
+ 2. Calculate cost: in-scope fix vs defer to backlog
213
+ 3. A* pathfinding for optimal decision
214
+ 4. Make autonomous decision
215
+
216
+ DECISION OPTIONS:
217
+ - PROCEED_NEXT_SPRINT (dependencies satisfied, scope intact)
218
+ - RELAUNCH_SPRINT (in-scope blockers remain)
219
+ - DEFER_CONCERNS (out-of-scope, save to backlog)
220
+
221
+ OUTPUT: {decision: "...", next_action: "..."}
222
+ `, "product-owner")
223
+ ```
224
+
225
+ ### Sprint Transition Logic
226
+ ```javascript
227
+ // Product Owner decision outcomes
228
+ switch (decision) {
229
+ case "PROCEED_NEXT_SPRINT":
230
+ // Store sprint results
231
+ mcp__claude-flow-novice__memory_usage({
232
+ action: "store",
233
+ namespace: "sprint-progress",
234
+ key: `sprint-${sprintId}-results`,
235
+ value: JSON.stringify({
236
+ consensus: consensusScore,
237
+ deliverables: completedDeliverables,
238
+ timestamp: Date.now()
239
+ })
240
+ })
241
+
242
+ // Check next sprint dependencies
243
+ const nextSprint = sprintPlan.sprints[currentSprintIndex + 1];
244
+ if (dependenciesSatisfied(nextSprint)) {
245
+ // IMMEDIATELY transition (NO approval needed)
246
+ console.log(`IMMEDIATELY transitioning to Sprint ${nextSprint.sprint_id}...`);
247
+ executeSprint(nextSprint);
248
+ }
249
+ break;
250
+
251
+ case "RELAUNCH_SPRINT":
252
+ // IMMEDIATELY relaunch Loop 3 with targeted agents (NO approval)
253
+ console.log(`Relaunching Sprint ${sprintId} Loop 3 with targeted agents...`);
254
+ break;
255
+
256
+ case "DEFER_CONCERNS":
257
+ // Save to backlog, proceed to next sprint
258
+ console.log(`Deferred out-of-scope items. Proceeding to next sprint...`);
259
+ break;
260
+ }
261
+ ```
262
+
263
+ ## Autonomous Sprint Execution
264
+
265
+ **FORBIDDEN PATTERNS:**
266
+ - ❌ "Sprint 1.1 complete. Proceed to Sprint 1.2?" (AUTO-PROCEED)
267
+ - ❌ "Should I continue with sprints?" (ALWAYS continue until all sprints done)
268
+ - ❌ Waiting for approval between sprints (AUTONOMOUS TRANSITION)
269
+
270
+ **REQUIRED PATTERNS:**
271
+ ```
272
+ Sprint 1.1 consensus: 93% ✅
273
+ Dependencies for Sprint 1.2 satisfied.
274
+ IMMEDIATELY transitioning to Sprint 1.2...
275
+
276
+ Sprint 1.2: Password Security
277
+ [Spawning agents autonomously - no permission needed]
278
+ ```
279
+
280
+ ## Iteration Limits (Per Sprint)
281
+ - **Loop 2** (Consensus): 10 iterations max per sprint
282
+ - **Loop 3** (Primary Swarm): 10 iterations max per sprint
283
+ - **Loop 1** (Sprints): Unlimited (continues until all sprints complete)
284
+
285
+ ## Sprint Progress Tracking
286
+
287
+ ```javascript
288
+ // Query sprint progress
289
+ mcp__claude-flow-novice__memory_usage({
290
+ action: "list",
291
+ namespace: "sprint-progress"
292
+ })
293
+
294
+ // Output:
295
+ {
296
+ "sprint-1.1-results": {consensus: 0.93, deliverables: [...]},
297
+ "sprint-1.2-results": {consensus: 0.88, deliverables: [...]},
298
+ "sprint-1.3-results": null // Current sprint in progress
299
+ }
300
+ ```
301
+
302
+ ## Example Sprint Execution
303
+
304
+ ```
305
+ [Turn 1] Phase: User Authentication (3 sprints)
306
+ → Sprint scope boundaries stored
307
+ → Sprint 1.1: Core Login API
308
+
309
+ [Turn 2-3] Sprint 1.1 Execution
310
+ → Loop 3 (backend-dev, tester, security)
311
+ → Gate PASSES (all ≥75%)
312
+ → Loop 2 consensus: 93% ✅
313
+ → Product Owner: PROCEED_NEXT_SPRINT
314
+
315
+ [Turn 4] AUTONOMOUS TRANSITION
316
+ → Dependencies for Sprint 1.2 satisfied
317
+ → IMMEDIATELY starting Sprint 1.2: Password Security
318
+
319
+ [Turn 5-6] Sprint 1.2 Execution
320
+ → Loop 3 (2 agents - smaller scope)
321
+ → Consensus: 88% ✅
322
+ → Product Owner: DEFER (Argon2 out-of-scope)
323
+
324
+ [Turn 7] AUTONOMOUS TRANSITION
325
+ → Sprint 1.3: Token Management
326
+
327
+ [Turn 8-10] Sprint 1.3 Execution
328
+ → Final sprint completion
329
+ → Phase COMPLETE ✅
330
+ ```
331
+
332
+ ## Output Format
333
+
334
+ ```
335
+ Phase: User Authentication (3 sprints)
336
+ Sprint 1.1/1.3: Core Login API
337
+
338
+ Loop 3 Iteration 1/10 - Confidence: 87% avg ✅
339
+ Loop 2 Iteration 1/10 - Consensus: 93% ✅
340
+
341
+ Sprint 1.1 COMPLETE
342
+ Dependencies satisfied for Sprint 1.2.
343
+ IMMEDIATELY transitioning to Sprint 1.2...
344
+
345
+ ─────────────────────────────────
346
+ Sprint 1.2/1.3: Password Security
347
+ [Executing autonomously - no permission needed]
348
+ ```
349
+
350
+ ## Phase Completion
351
+
352
+ When final sprint achieves ≥90% consensus:
353
+ ```
354
+ Sprint 1.3 COMPLETE - Consensus: 91% ✅
355
+
356
+ Phase: User Authentication - ALL SPRINTS COMPLETE ✅
357
+ - Sprint 1.1: Core Login API (93%)
358
+ - Sprint 1.2: Password Security (88%)
359
+ - Sprint 1.3: Token Management (91%)
360
+
361
+ Deferred items saved to backlog:
362
+ - OAuth integration (out-of-scope)
363
+ - Argon2 hashing (out-of-scope)
364
+ - Sliding session windows (out-of-scope)
365
+
366
+ Phase execution complete. Self-looping terminated.
367
+ ```
368
+
369
+ ## Integration with Epic
370
+
371
+ If this phase is part of a larger epic, results are stored for epic-level tracking:
372
+ ```javascript
373
+ mcp__claude-flow-novice__memory_usage({
374
+ action: "store",
375
+ namespace: "epic-progress",
376
+ key: "phase-1-results",
377
+ value: JSON.stringify({
378
+ phase_name: "User Authentication",
379
+ sprints_completed: ["1.1", "1.2", "1.3"],
380
+ overall_consensus: 0.91,
381
+ ready_for_next_phase: true
382
+ })
383
+ })
384
+ ```
@@ -0,0 +1,180 @@
1
+ ---
2
+ description: "Execute autonomous 3-loop self-correcting CFN workflow with automatic retry and consensus validation"
3
+ argument-hint: "<task description> [--phase=name] [--max-loop2=10] [--max-loop3=10]"
4
+ allowed-tools: ["Task", "TodoWrite", "Read", "Write", "Edit", "Bash", "Glob", "Grep"]
5
+ ---
6
+
7
+ # CFN Loop - Autonomous 3-Loop Self-Correcting Workflow
8
+
9
+ Execute task through autonomous 3-loop CFN structure with automatic retry and consensus validation.
10
+
11
+ 🚨 **AUTONOMOUS SELF-LOOPING PROCESS**
12
+
13
+ **Task**: $ARGUMENTS
14
+
15
+ ## CFN Loop Structure (3 Loops)
16
+
17
+ ```
18
+ LOOP 1: Phase Completion or Escalation
19
+
20
+ LOOP 2: Consensus Validation (≥90% Byzantine consensus)
21
+
22
+ LOOP 3: Primary Swarm Execution with subtask iterations
23
+ ```
24
+
25
+ ## Command Options
26
+
27
+ ```bash
28
+ /cfn-loop "Implement JWT authentication" --phase=implementation
29
+ /cfn-loop "Fix security vulnerabilities" --phase=security-audit --max-loop2=10
30
+ /cfn-loop "Refactor API layer" --max-loop3=15
31
+ /cfn-loop "Add test coverage for auth module" --phase=testing --max-loop2=10
32
+ ```
33
+
34
+ **Options:**
35
+ - `--phase=<name>`: Optional phase name for tracking
36
+ - `--max-loop2=<n>`: Max consensus iterations (default: 10)
37
+ - `--max-loop3=<n>`: Max primary swarm iterations (default: 10)
38
+
39
+ ## Execution Pattern
40
+
41
+ ### Step 1: Initialize Swarm (MANDATORY)
42
+ ```javascript
43
+ mcp__claude-flow-novice__swarm_init({
44
+ topology: "mesh", // mesh for 2-7, hierarchical for 8+
45
+ maxAgents: 5,
46
+ strategy: "balanced"
47
+ })
48
+ ```
49
+
50
+ ### Step 2: Execute - Primary Swarm (Loop 3)
51
+ ```javascript
52
+ Task("Agent 1", `
53
+ Implementation task...
54
+
55
+ MANDATORY: After EVERY file edit:
56
+ node config/hooks/post-edit-pipeline.js "[FILE_PATH]" --memory-key "swarm/agent-1/step-1"
57
+
58
+ Report confidence score when complete.
59
+ `, "agent-type")
60
+ ```
61
+
62
+ ### Step 3: Self-Assessment Gate
63
+ - ALL agents ≥75% → Proceed to Loop 2
64
+ - ANY agent <75% → IMMEDIATELY relaunch Loop 3 (NO approval)
65
+
66
+ ### Step 4: Consensus Validation (Loop 2)
67
+ **CRITICAL**: Spawn validators in SEPARATE message AFTER implementation:
68
+
69
+ ```javascript
70
+ // MESSAGE 2: Validators only
71
+ mcp__claude-flow-novice__swarm_init({
72
+ topology: "mesh",
73
+ maxAgents: 3,
74
+ strategy: "balanced"
75
+ })
76
+
77
+ Task("Reviewer", "Review completed work", "reviewer")
78
+ Task("Security", "Security audit", "security-specialist")
79
+ Task("Architect", "Architecture validation", "architect")
80
+ ```
81
+
82
+ ### Step 5: Product Owner Decision (GOAP)
83
+ ```javascript
84
+ Task("Product Owner", `
85
+ GOAP DECISION EXECUTION
86
+
87
+ CURRENT STATE:
88
+ - Consensus: ${consensusScore} (target: ≥0.90)
89
+ - Validator concerns: ${concerns}
90
+ - Loop iteration: ${iteration}/10
91
+
92
+ EXECUTE GOAP A* SEARCH:
93
+ 1. Classify concerns (in-scope vs out-of-scope)
94
+ 2. Calculate action costs
95
+ 3. Find optimal decision path
96
+ 4. Make autonomous decision (NO approval needed)
97
+
98
+ OUTPUT: {decision: "PROCEED|DEFER|ESCALATE", ...}
99
+ `, "product-owner")
100
+ ```
101
+
102
+ **Decision Outcomes:**
103
+ - **PROCEED** → IMMEDIATELY relaunch Loop 3 with targeted agents
104
+ - **DEFER** → Save to backlog, complete phase
105
+ - **ESCALATE** → Generate alternatives (rare)
106
+
107
+ ### Step 6: Loop 1 Phase Completion
108
+ - Consensus ≥90% → Phase COMPLETE
109
+ - Max iterations reached → Escalate with diagnostics
110
+
111
+ ## Autonomous Execution Rules
112
+
113
+ **FORBIDDEN:**
114
+ - ❌ "Should I retry?" (ALWAYS retry if iterations < max)
115
+ - ❌ "Proceed to consensus?" (AUTO-PROCEED when gate passes)
116
+ - ❌ Waiting for approval during CFN Loop cycles
117
+
118
+ **REQUIRED:**
119
+ - ✅ IMMEDIATE Loop 3 relaunch on low confidence (iteration < max)
120
+ - ✅ IMMEDIATE Loop 3 relaunch on consensus failure (iteration < max)
121
+ - ✅ AUTOMATIC better agent selection based on failure analysis
122
+ - ✅ ONLY escalate when truly blocked (critical error or max iterations)
123
+
124
+ ## Iteration Limits
125
+ - **Loop 2** (Consensus): Configurable via `--max-loop2` (default: 10)
126
+ - **Loop 3** (Primary Swarm): Configurable via `--max-loop3` (default: 10)
127
+
128
+ ## Circuit Breaker Protection
129
+
130
+ Automatic timeout protection prevents infinite loops:
131
+ - Loop 2 timeout: 30 minutes
132
+ - Loop 3 timeout: 20 minutes
133
+ - Escalates on timeout with diagnostic report
134
+
135
+ ## Example Execution
136
+
137
+ ```
138
+ [Turn 1] /cfn-loop "Implement JWT auth" --phase=auth
139
+ → Loop 3 Iteration 1/10
140
+ → Swarm: backend-dev, tester, security
141
+ → Confidence: 72%, 68%, 85%
142
+ → Gate FAILS → IMMEDIATE retry
143
+
144
+ [Turn 2] Loop 3 Iteration 2/10
145
+ → Swarm with feedback
146
+ → Confidence: 85%, 82%, 88%
147
+ → Gate PASSES → Proceed to Loop 2
148
+
149
+ [Turn 3] Loop 2 Iteration 1/10
150
+ → Consensus validators spawned
151
+ → Consensus: 87% (below 90%)
152
+ → Product Owner: PROCEED (in-scope issues)
153
+ → IMMEDIATE Loop 3 relaunch
154
+
155
+ [Turn 4] Loop 3 Iteration 3/10
156
+ → Targeted agents (backend-dev, security)
157
+ → Consensus achieved: 93% ✅
158
+ → Phase COMPLETE
159
+ ```
160
+
161
+ ## Output Format
162
+
163
+ ```
164
+ Loop 3 Iteration 2/10 - Confidence: 85% avg ✅
165
+ Proceeding to Loop 2 (Consensus)...
166
+
167
+ Loop 2 Iteration 1/10 - Consensus: 87% ❌
168
+ Product Owner: PROCEED (3 in-scope blockers)
169
+ IMMEDIATELY relaunching Loop 3 with:
170
+ - backend-dev (fix validation logic)
171
+ - security-specialist (review auth flow)
172
+ [Executing autonomously - no permission needed]
173
+ ```
174
+
175
+ ## Integration with Other CFN Commands
176
+
177
+ - **Single task**: Use `/cfn-loop` (this command)
178
+ - **Multiple sprints**: Use `/cfn-loop-sprints`
179
+ - **Multi-phase epic**: Use `/cfn-loop-epic`
180
+ - **Direct single task**: Use `/cfn-loop-single`
@@ -0,0 +1,58 @@
1
+ # Metrics Summary
2
+
3
+ Display aggregated metrics statistics with configurable time frame and manage metrics tracking.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ # Display metrics summary
9
+ /metrics-summary [--minutes=60] [--provider=all] [--model=all]
10
+
11
+ # Manage tracking
12
+ /metrics-summary --enable # Enable metrics tracking
13
+ /metrics-summary --disable # Disable metrics tracking
14
+ /metrics-summary --status # Check tracking status
15
+ ```
16
+
17
+ ## Parameters
18
+
19
+ ### Display Metrics
20
+ - `--minutes` - Time frame in minutes (default: 60 = last hour)
21
+ - Examples: 60 (1 hour), 1440 (24 hours), 10080 (7 days)
22
+ - `--provider` - Filter by provider: `all`, `anthropic`, `z.ai` (default: all)
23
+ - `--model` - Filter by model name (default: all)
24
+
25
+ ### Manage Tracking
26
+ - `--enable` - Enable metrics tracking
27
+ - `--disable` - Disable metrics tracking
28
+ - `--status` - Check current tracking status
29
+
30
+ ## Examples
31
+
32
+ ```bash
33
+ # Last hour stats (all providers)
34
+ /metrics-summary
35
+
36
+ # Last 24 hours
37
+ /metrics-summary --minutes=1440
38
+
39
+ # Last hour Z.ai only
40
+ /metrics-summary --minutes=60 --provider=z.ai
41
+
42
+ # Last 7 days GLM-4.6 only
43
+ /metrics-summary --minutes=10080 --model=glm-4.6
44
+
45
+ # Enable/disable tracking
46
+ /metrics-summary --enable
47
+ /metrics-summary --disable
48
+ /metrics-summary --status
49
+ ```
50
+
51
+ ## Output
52
+
53
+ - **API Requests**: Total count by provider
54
+ - **Token Usage**: Input/Output/Total by provider and model
55
+ - **Error Rate**: Success vs error percentage
56
+ - **Cost Breakdown**: Estimated costs by provider (if pricing available)
57
+ - **Top Models**: Most used models in time frame
58
+ - **Performance**: Average API duration by provider