claude-flow-novice 1.3.6 → 1.5.1

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 (347) hide show
  1. package/.claude/agents/analysis/code-analyzer.md +3 -20
  2. package/.claude/agents/analysis/code-review/analyze-code-quality.md +1 -1
  3. package/.claude/agents/analyst.md +208 -550
  4. package/.claude/agents/architect.md +136 -469
  5. package/.claude/agents/architecture/system-architect.md +20 -1
  6. package/.claude/agents/architecture/system-design/arch-system-design.md +1 -1
  7. package/.claude/agents/base-template-generator.md +24 -1
  8. package/.claude/agents/coder.md +87 -303
  9. package/.claude/agents/consensus/byzantine-coordinator.md +4 -21
  10. package/.claude/agents/consensus/consensus-builder.md +3 -20
  11. package/.claude/agents/consensus/crdt-synchronizer.md +4 -21
  12. package/.claude/agents/consensus/gossip-coordinator.md +4 -21
  13. package/.claude/agents/consensus/performance-benchmarker.md +4 -21
  14. package/.claude/agents/consensus/quorum-manager.md +4 -21
  15. package/.claude/agents/consensus/raft-manager.md +4 -21
  16. package/.claude/agents/consensus/security-manager.md +4 -21
  17. package/.claude/agents/coordinator.md +22 -11
  18. package/.claude/agents/data/ml/data-ml-model.md +2 -2
  19. package/.claude/agents/development/backend/dev-backend-api.md +2 -2
  20. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +2 -2
  21. package/.claude/agents/devops/devops-engineer.md +134 -402
  22. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +2 -2
  23. package/.claude/agents/github/code-review-swarm.md +1 -1
  24. package/.claude/agents/github/github-specialist.md +856 -0
  25. package/.claude/agents/github/pr-manager.md +1 -1
  26. package/.claude/agents/github/release-manager.md +1 -1
  27. package/.claude/agents/neural/neural-pattern-agent.md +762 -0
  28. package/.claude/agents/optimization/benchmark-suite.md +1 -1
  29. package/.claude/agents/optimization/perf-analyzer.md +1 -1
  30. package/.claude/agents/optimization/performance-monitor.md +1 -1
  31. package/.claude/agents/planner.md +135 -0
  32. package/.claude/agents/researcher.md +22 -9
  33. package/.claude/agents/reviewer.md +291 -0
  34. package/.claude/agents/security/security-specialist.md +1 -1
  35. package/.claude/agents/sparc/architecture.md +1 -1
  36. package/.claude/agents/sparc/pseudocode.md +1 -1
  37. package/.claude/agents/sparc/refinement.md +1 -1
  38. package/.claude/agents/sparc/specification.md +1 -1
  39. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +2 -2
  40. package/.claude/agents/tester.md +21 -11
  41. package/.claude/agents/testing/unit/tdd-london-swarm.md +1 -1
  42. package/.claude/agents/testing/validation/production-validator.md +1 -1
  43. package/.claude/commands/claude-soul.js +1 -1
  44. package/.claude/commands/fullstack.md +134 -0
  45. package/.claude/commands/index.js +4 -0
  46. package/.claude/hooks.json +12 -15
  47. package/{.claude → .claude-flow-novice/.claude}/agents/MIGRATION_SUMMARY.md +1 -1
  48. package/.claude-flow-novice/.claude/agents/analysis/code-analyzer.md +192 -0
  49. package/.claude-flow-novice/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
  50. package/.claude-flow-novice/.claude/agents/analyst.md +300 -0
  51. package/.claude-flow-novice/.claude/agents/architect.md +557 -0
  52. package/.claude-flow-novice/.claude/agents/architecture/system-architect.md +630 -0
  53. package/.claude-flow-novice/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
  54. package/.claude-flow-novice/.claude/agents/base-template-generator.md +65 -0
  55. package/.claude-flow-novice/.claude/agents/coder.md +180 -0
  56. package/.claude-flow-novice/.claude/agents/consensus/byzantine-coordinator.md +46 -0
  57. package/.claude-flow-novice/.claude/agents/consensus/consensus-builder.md +225 -0
  58. package/.claude-flow-novice/.claude/agents/consensus/crdt-synchronizer.md +980 -0
  59. package/.claude-flow-novice/.claude/agents/consensus/gossip-coordinator.md +46 -0
  60. package/.claude-flow-novice/.claude/agents/consensus/performance-benchmarker.md +834 -0
  61. package/.claude-flow-novice/.claude/agents/consensus/quorum-manager.md +806 -0
  62. package/.claude-flow-novice/.claude/agents/consensus/raft-manager.md +46 -0
  63. package/.claude-flow-novice/.claude/agents/consensus/security-manager.md +605 -0
  64. package/.claude-flow-novice/.claude/agents/coordinator.md +842 -0
  65. package/.claude-flow-novice/.claude/agents/data/ml/data-ml-model.md +193 -0
  66. package/.claude-flow-novice/.claude/agents/development/backend/dev-backend-api.md +142 -0
  67. package/.claude-flow-novice/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  68. package/.claude-flow-novice/.claude/agents/devops/devops-engineer.md +638 -0
  69. package/.claude-flow-novice/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  70. package/.claude-flow-novice/.claude/agents/github/code-review-swarm.md +538 -0
  71. package/.claude-flow-novice/.claude/agents/github/github-modes.md +173 -0
  72. package/.claude-flow-novice/.claude/agents/github/github-specialist.md +856 -0
  73. package/.claude-flow-novice/.claude/agents/github/issue-tracker.md +319 -0
  74. package/.claude-flow-novice/.claude/agents/github/multi-repo-swarm.md +553 -0
  75. package/.claude-flow-novice/.claude/agents/github/pr-manager.md +191 -0
  76. package/.claude-flow-novice/.claude/agents/github/project-board-sync.md +509 -0
  77. package/.claude-flow-novice/.claude/agents/github/release-manager.md +367 -0
  78. package/.claude-flow-novice/.claude/agents/github/release-swarm.md +583 -0
  79. package/.claude-flow-novice/.claude/agents/github/repo-architect.md +398 -0
  80. package/.claude-flow-novice/.claude/agents/github/swarm-issue.md +573 -0
  81. package/.claude-flow-novice/.claude/agents/github/swarm-pr.md +428 -0
  82. package/.claude-flow-novice/.claude/agents/github/sync-coordinator.md +452 -0
  83. package/.claude-flow-novice/.claude/agents/github/workflow-automation.md +635 -0
  84. package/.claude-flow-novice/.claude/agents/goal/goal-planner.md +73 -0
  85. package/.claude-flow-novice/.claude/agents/neural/neural-pattern-agent.md +762 -0
  86. package/.claude-flow-novice/.claude/agents/neural/safla-neural.md +74 -0
  87. package/.claude-flow-novice/.claude/agents/optimization/benchmark-suite.md +665 -0
  88. package/.claude-flow-novice/.claude/agents/optimization/load-balancer.md +431 -0
  89. package/.claude-flow-novice/.claude/agents/optimization/perf-analyzer.md +725 -0
  90. package/.claude-flow-novice/.claude/agents/optimization/performance-monitor.md +672 -0
  91. package/.claude-flow-novice/.claude/agents/optimization/resource-allocator.md +674 -0
  92. package/.claude-flow-novice/.claude/agents/optimization/topology-optimizer.md +808 -0
  93. package/.claude-flow-novice/.claude/agents/planner.md +135 -0
  94. package/.claude-flow-novice/.claude/agents/researcher.md +185 -0
  95. package/.claude-flow-novice/.claude/agents/reviewer.md +291 -0
  96. package/.claude-flow-novice/.claude/agents/security/security-specialist.md +978 -0
  97. package/.claude-flow-novice/.claude/agents/sparc/architecture.md +472 -0
  98. package/.claude-flow-novice/.claude/agents/sparc/pseudocode.md +318 -0
  99. package/.claude-flow-novice/.claude/agents/sparc/refinement.md +525 -0
  100. package/.claude-flow-novice/.claude/agents/sparc/specification.md +276 -0
  101. package/.claude-flow-novice/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
  102. package/.claude-flow-novice/.claude/agents/sublinear/consciousness-evolution-agent.md +499 -0
  103. package/.claude-flow-novice/.claude/agents/sublinear/matrix-solver-agent.md +113 -0
  104. package/.claude-flow-novice/.claude/agents/sublinear/nanosecond-scheduler-agent.md +644 -0
  105. package/.claude-flow-novice/.claude/agents/sublinear/pagerank-agent.md +699 -0
  106. package/.claude-flow-novice/.claude/agents/sublinear/phi-calculator-agent.md +749 -0
  107. package/.claude-flow-novice/.claude/agents/sublinear/psycho-symbolic-agent.md +543 -0
  108. package/.claude-flow-novice/.claude/agents/sublinear/sublinear.md +816 -0
  109. package/.claude-flow-novice/.claude/agents/sublinear/temporal-advantage-agent.md +360 -0
  110. package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator-enhanced.md +746 -0
  111. package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator.md +396 -0
  112. package/.claude-flow-novice/.claude/agents/swarm/hierarchical-coordinator.md +300 -0
  113. package/.claude-flow-novice/.claude/agents/swarm/mesh-coordinator.md +435 -0
  114. package/.claude-flow-novice/.claude/agents/templates/automation-smart-agent.md +205 -0
  115. package/.claude-flow-novice/.claude/agents/templates/coordinator-swarm-init.md +90 -0
  116. package/.claude-flow-novice/.claude/agents/templates/github-pr-manager.md +177 -0
  117. package/.claude-flow-novice/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  118. package/.claude-flow-novice/.claude/agents/templates/memory-coordinator.md +187 -0
  119. package/.claude-flow-novice/.claude/agents/templates/migration-plan.md +746 -0
  120. package/.claude-flow-novice/.claude/agents/templates/orchestrator-task.md +139 -0
  121. package/.claude-flow-novice/.claude/agents/templates/performance-analyzer.md +199 -0
  122. package/.claude-flow-novice/.claude/agents/templates/sparc-coordinator.md +183 -0
  123. package/.claude-flow-novice/.claude/agents/tester.md +663 -0
  124. package/.claude-flow-novice/.claude/agents/testing/e2e/playwright-agent.md +249 -0
  125. package/.claude-flow-novice/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
  126. package/.claude-flow-novice/.claude/agents/testing/validation/production-validator.md +395 -0
  127. package/.claude-flow-novice/dist/index.js +12 -24
  128. package/.claude-flow-novice/dist/index.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/agents/agent-manager.js +123 -69
  130. package/.claude-flow-novice/dist/src/agents/agent-manager.js.map +1 -1
  131. package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js +7 -7
  132. package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js.map +1 -1
  133. package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js +485 -0
  134. package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js +630 -0
  136. package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js.map +1 -0
  137. package/.claude-flow-novice/dist/src/cli/commands/agent.js +1 -1
  138. package/.claude-flow-novice/dist/src/cli/commands/agent.js.map +1 -1
  139. package/.claude-flow-novice/dist/src/cli/commands/config-integration.js +6 -6
  140. package/.claude-flow-novice/dist/src/cli/commands/enterprise.js +18 -18
  141. package/.claude-flow-novice/dist/src/cli/commands/enterprise.js.map +1 -1
  142. package/.claude-flow-novice/dist/src/cli/commands/goal-init.js +4 -4
  143. package/.claude-flow-novice/dist/src/cli/commands/help-new.js +23 -23
  144. package/.claude-flow-novice/dist/src/cli/commands/help-new.js.map +1 -1
  145. package/.claude-flow-novice/dist/src/cli/commands/help.js +74 -74
  146. package/.claude-flow-novice/dist/src/cli/commands/help.js.map +1 -1
  147. package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js +2 -2
  148. package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
  149. package/.claude-flow-novice/dist/src/cli/commands/hive.js +4 -4
  150. package/.claude-flow-novice/dist/src/cli/commands/index.js +103 -132
  151. package/.claude-flow-novice/dist/src/cli/commands/index.js.map +1 -1
  152. package/.claude-flow-novice/dist/src/cli/commands/mcp.js +1 -1
  153. package/.claude-flow-novice/dist/src/cli/commands/migrate.js +4 -4
  154. package/.claude-flow-novice/dist/src/cli/commands/migrate.js.map +1 -1
  155. package/.claude-flow-novice/dist/src/cli/commands/monitor.js +1 -1
  156. package/.claude-flow-novice/dist/src/cli/commands/neural-init.js +4 -4
  157. package/.claude-flow-novice/dist/src/cli/commands/ruv-swarm.js +8 -8
  158. package/.claude-flow-novice/dist/src/cli/commands/sparc.js +12 -12
  159. package/.claude-flow-novice/dist/src/cli/commands/sparc.js.map +1 -1
  160. package/.claude-flow-novice/dist/src/cli/commands/start/start-command.js +3 -3
  161. package/.claude-flow-novice/dist/src/cli/commands/status.js +1 -1
  162. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +7 -7
  163. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  164. package/.claude-flow-novice/dist/src/cli/commands/verification.js +18 -18
  165. package/.claude-flow-novice/dist/src/cli/completion.js +54 -54
  166. package/.claude-flow-novice/dist/src/cli/completion.js.map +1 -1
  167. package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js +11 -11
  168. package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js.map +1 -1
  169. package/.claude-flow-novice/dist/src/cli/consolidated/core/CommandHandlers.js +31 -31
  170. package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js +39 -39
  171. package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js.map +1 -1
  172. package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js +25 -25
  173. package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js.map +1 -1
  174. package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js +8 -8
  175. package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js.map +1 -1
  176. package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js +6 -6
  177. package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js.map +1 -1
  178. package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js +7 -7
  179. package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js.map +1 -1
  180. package/.claude-flow-novice/dist/src/cli/index-remote.js +10 -10
  181. package/.claude-flow-novice/dist/src/cli/index.js +1 -1
  182. package/.claude-flow-novice/dist/src/cli/init/directory-structure.js +8 -8
  183. package/.claude-flow-novice/dist/src/cli/init/index.js +3 -3
  184. package/.claude-flow-novice/dist/src/cli/init/sparc-environment.js +67 -67
  185. package/.claude-flow-novice/dist/src/cli/init/swarm-commands.js +18 -18
  186. package/.claude-flow-novice/dist/src/cli/node-repl.js +2 -2
  187. package/.claude-flow-novice/dist/src/cli/repl.js +1 -1
  188. package/.claude-flow-novice/dist/src/cli/simple-cli.js +68 -68
  189. package/.claude-flow-novice/dist/src/cli/simple-cli.js.map +1 -1
  190. package/.claude-flow-novice/dist/src/cli/simple-commands/session-start-soul.js +271 -0
  191. package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js +7 -7
  192. package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js.map +1 -1
  193. package/.claude-flow-novice/dist/src/cli/ui/fallback-handler.js +7 -7
  194. package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js +816 -0
  195. package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js +812 -0
  197. package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js.map +1 -0
  198. package/.claude-flow-novice/dist/src/communication/optimized-serialization.js +369 -0
  199. package/.claude-flow-novice/dist/src/communication/optimized-serialization.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/communication/performance-optimizations.js +526 -0
  201. package/.claude-flow-novice/dist/src/communication/performance-optimizations.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/communication/performance-validator.js +532 -0
  203. package/.claude-flow-novice/dist/src/communication/performance-validator.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/communication/priority-message-queue.js +525 -0
  205. package/.claude-flow-novice/dist/src/communication/priority-message-queue.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js +218 -0
  207. package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js +521 -0
  209. package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js +563 -0
  211. package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/communication/websocket-cluster.js +344 -0
  213. package/.claude-flow-novice/dist/src/communication/websocket-cluster.js.map +1 -0
  214. package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js +369 -0
  215. package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js.map +1 -0
  216. package/.claude-flow-novice/dist/src/config/config-manager.js +1 -1
  217. package/.claude-flow-novice/dist/src/config/config-manager.js.map +1 -1
  218. package/.claude-flow-novice/dist/src/config/core/intelligent-configuration-manager.js +1 -1
  219. package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js +6 -6
  220. package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js.map +1 -1
  221. package/.claude-flow-novice/dist/src/config/migration/config-migration.js +1 -1
  222. package/.claude-flow-novice/dist/src/config/ruv-swarm-integration.js +1 -1
  223. package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js +1 -1
  224. package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js.map +1 -1
  225. package/.claude-flow-novice/dist/src/config/web-portal-config.js +0 -9
  226. package/.claude-flow-novice/dist/src/config/web-portal-config.js.map +1 -1
  227. package/.claude-flow-novice/dist/src/config/zero-config-setup.js +18 -18
  228. package/.claude-flow-novice/dist/src/config/zero-config-setup.js.map +1 -1
  229. package/.claude-flow-novice/dist/src/core/logger.js +33 -10
  230. package/.claude-flow-novice/dist/src/core/logger.js.map +1 -1
  231. package/.claude-flow-novice/dist/src/migration/index.js +1 -1
  232. package/.claude-flow-novice/dist/src/migration/index.js.map +1 -1
  233. package/.claude-flow-novice/dist/src/migration/migration-runner.js +4 -4
  234. package/.claude-flow-novice/dist/src/migration/migration-runner.js.map +1 -1
  235. package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js +430 -0
  236. package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js.map +1 -0
  237. package/.claude-flow-novice/dist/src/slash-commands/claude-soul.js +248 -365
  238. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +1 -1
  239. package/.claude-flow-novice/dist/src/swarm/claude-code-interface.js +1 -1
  240. package/.claude-flow-novice/dist/src/swarm/claude-flow-executor.js +1 -1
  241. package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js +471 -0
  242. package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js.map +1 -0
  243. package/.claude-flow-novice/dist/src/swarm/hive-mind-integration.js +1 -1
  244. package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js +543 -0
  245. package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js.map +1 -0
  246. package/.claude-flow-novice/dist/src/swarm/optimizations/connection-pool.js +1 -1
  247. package/.claude-flow-novice/dist/src/swarm/optimizations/optimized-executor.js +1 -1
  248. package/.claude-flow-novice/dist/src/swarm/types.js.map +1 -1
  249. package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js +709 -0
  250. package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js.map +1 -0
  251. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js +612 -0
  252. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js.map +1 -0
  253. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js +679 -0
  254. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js.map +1 -0
  255. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js +654 -0
  256. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js.map +1 -0
  257. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js +402 -0
  258. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js.map +1 -0
  259. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js +459 -0
  260. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js.map +1 -0
  261. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js +513 -0
  262. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js.map +1 -0
  263. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js +19 -0
  264. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js.map +1 -0
  265. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js +568 -0
  266. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js.map +1 -0
  267. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js +418 -0
  268. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js.map +1 -0
  269. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js +530 -0
  270. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js.map +1 -0
  271. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js +250 -0
  272. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js.map +1 -0
  273. package/.claude-flow-novice/dist/src/task/index.js +7 -7
  274. package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js +420 -0
  275. package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js.map +1 -0
  276. package/.claude-flow-novice/dist/src/validation/production-validator.js +1435 -0
  277. package/.claude-flow-novice/dist/src/validation/production-validator.js.map +1 -0
  278. package/.claude-flow-novice/dist/src/verification/cli-integration.js +3 -3
  279. package/.claude-flow-novice/dist/src/verification/hooks.js +1 -1
  280. package/CHANGELOG.md +26 -0
  281. package/CLAUDE.md +1967 -68
  282. package/README.md +0 -1
  283. package/config/build/babel.config.cjs +19 -11
  284. package/config/typescript/tsconfig.json +1 -1
  285. package/examples/claude-api-error-handling.ts +2 -2
  286. package/examples/frontend-testing-demo.ts +470 -0
  287. package/examples/litellm/config/config.yaml +1 -1
  288. package/package.json +13 -7
  289. package/scripts/build/unified-builder.sh +6 -6
  290. package/scripts/build/validate-agents.js +238 -0
  291. package/scripts/run-production-validation.ts +590 -0
  292. package/scripts/test/test-coordination-features.ts +2 -2
  293. package/scripts/validate-stage3-performance.ts +377 -0
  294. package/src/cli/simple-commands/hooks.js +1 -0
  295. package/src/cli/simple-commands/init/agent-copier.js +0 -2
  296. package/src/cli/simple-commands/init/index.js +5 -97
  297. package/src/cli/simple-commands/init/templates/CLAUDE.md +163 -1158
  298. package/src/cli/simple-commands/init/templates/claude-md.js +38 -157
  299. package/src/swarm-fullstack/integrations/communication-bridge.ts +931 -0
  300. package/src/swarm-fullstack/testing/api-contract-validator.ts +909 -0
  301. package/src/swarm-fullstack/testing/backend-test-orchestrator.ts +791 -0
  302. package/src/swarm-fullstack/testing/frontend-test-orchestrator.ts +853 -0
  303. package/src/swarm-fullstack/testing/visual-regression.ts +507 -0
  304. package/src/swarm-fullstack/workflows/convergence-detector.ts +736 -0
  305. package/src/swarm-fullstack/workflows/fix-coordinator.ts +677 -0
  306. package/src/swarm-fullstack/workflows/index.ts +75 -0
  307. package/src/swarm-fullstack/workflows/iterative-build-test.ts +829 -0
  308. package/src/swarm-fullstack/workflows/regression-test-manager.ts +590 -0
  309. package/src/swarm-fullstack/workflows/test-result-analyzer.ts +739 -0
  310. package/src/swarm-fullstack/workflows/workflow-metrics.ts +399 -0
  311. package/wiki/command-reference/README.md +1 -2
  312. package/wiki/command-reference/mcp-tools/README.md +1 -1
  313. package/wiki/getting-started/claude-code-mcp/README.md +1 -2
  314. package/wiki/getting-started/installation/README.md +2 -10
  315. package/.claude/commands/flow-nexus/app-store.md +0 -124
  316. package/.claude/commands/flow-nexus/challenges.md +0 -120
  317. package/.claude/commands/flow-nexus/login-registration.md +0 -65
  318. package/.claude/commands/flow-nexus/neural-network.md +0 -134
  319. package/.claude/commands/flow-nexus/payments.md +0 -116
  320. package/.claude/commands/flow-nexus/sandbox.md +0 -83
  321. package/.claude/commands/flow-nexus/swarm.md +0 -87
  322. package/.claude/commands/flow-nexus/user-tools.md +0 -152
  323. package/.claude/commands/flow-nexus/workflow.md +0 -115
  324. package/.claude-flow-novice/dist/cli/index.js +0 -45
  325. package/.claude-flow-novice/dist/core/index.js +0 -22
  326. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +0 -595
  327. package/.claude-flow-novice/dist/mcp/mcp-server-sdk.js +0 -649
  328. package/.claude-flow-novice/dist/mcp/mcp-server-with-slash-commands.js +0 -776
  329. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/claude-md.js +0 -1101
  330. package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +0 -265
  331. /package/{.claude → .claude-flow-novice/.claude}/agents/README.md +0 -0
  332. /package/{.claude → .claude-flow-novice/.claude}/agents/backend-dev.json +0 -0
  333. /package/{.claude → .claude-flow-novice/.claude}/agents/code-analyzer.json +0 -0
  334. /package/{.claude → .claude-flow-novice/.claude}/agents/coder.json +0 -0
  335. /package/{.claude → .claude-flow-novice/.claude}/agents/consensus/README.md +0 -0
  336. /package/{.claude → .claude-flow-novice/.claude}/agents/core/coder.md +0 -0
  337. /package/{.claude → .claude-flow-novice/.claude}/agents/core/planner.md +0 -0
  338. /package/{.claude → .claude-flow-novice/.claude}/agents/core/researcher.md +0 -0
  339. /package/{.claude → .claude-flow-novice/.claude}/agents/core/reviewer.md +0 -0
  340. /package/{.claude → .claude-flow-novice/.claude}/agents/core/tester.md +0 -0
  341. /package/{.claude → .claude-flow-novice/.claude}/agents/optimization/README.md +0 -0
  342. /package/{.claude → .claude-flow-novice/.claude}/agents/planner.json +0 -0
  343. /package/{.claude → .claude-flow-novice/.claude}/agents/researcher.json +0 -0
  344. /package/{.claude → .claude-flow-novice/.claude}/agents/reviewer.json +0 -0
  345. /package/{.claude → .claude-flow-novice/.claude}/agents/swarm/README.md +0 -0
  346. /package/{.claude → .claude-flow-novice/.claude}/agents/system-architect.json +0 -0
  347. /package/{.claude → .claude-flow-novice/.claude}/agents/tester.json +0 -0
@@ -0,0 +1,806 @@
1
+ ---
2
+ name: quorum-manager
3
+ description: Use this agent when you need dynamic quorum adjustment and intelligent membership management for distributed consensus protocols. This agent excels at optimizing quorum configurations based on network conditions, performance requirements, and fault tolerance needs. Examples - Dynamic quorum calculation, Membership management, Network monitoring, Weighted voting systems, Fault tolerance optimization, Consensus protocol optimization, Node health assessment, Distributed coordination
4
+ tools: Read, Write, Edit, Bash, Grep, Glob, TodoWrite
5
+ model: sonnet
6
+ color: purple
7
+ ---
8
+
9
+ # Quorum Manager
10
+
11
+ Implements dynamic quorum adjustment and intelligent membership management for distributed consensus protocols.
12
+
13
+ ## Core Responsibilities
14
+
15
+ 1. **Dynamic Quorum Calculation**: Adapt quorum requirements based on real-time network conditions
16
+ 2. **Membership Management**: Handle seamless node addition, removal, and failure scenarios
17
+ 3. **Network Monitoring**: Assess connectivity, latency, and partition detection
18
+ 4. **Weighted Voting**: Implement capability-based voting weight assignments
19
+ 5. **Fault Tolerance Optimization**: Balance availability and consistency guarantees
20
+
21
+ ## Technical Implementation
22
+
23
+ ### Core Quorum Management System
24
+ ```javascript
25
+ class QuorumManager {
26
+ constructor(nodeId, consensusProtocol) {
27
+ this.nodeId = nodeId;
28
+ this.protocol = consensusProtocol;
29
+ this.currentQuorum = new Map(); // nodeId -> QuorumNode
30
+ this.quorumHistory = [];
31
+ this.networkMonitor = new NetworkConditionMonitor();
32
+ this.membershipTracker = new MembershipTracker();
33
+ this.faultToleranceCalculator = new FaultToleranceCalculator();
34
+ this.adjustmentStrategies = new Map();
35
+
36
+ this.initializeStrategies();
37
+ }
38
+
39
+ // Initialize quorum adjustment strategies
40
+ initializeStrategies() {
41
+ this.adjustmentStrategies.set('NETWORK_BASED', new NetworkBasedStrategy());
42
+ this.adjustmentStrategies.set('PERFORMANCE_BASED', new PerformanceBasedStrategy());
43
+ this.adjustmentStrategies.set('FAULT_TOLERANCE_BASED', new FaultToleranceStrategy());
44
+ this.adjustmentStrategies.set('HYBRID', new HybridStrategy());
45
+ }
46
+
47
+ // Calculate optimal quorum size based on current conditions
48
+ async calculateOptimalQuorum(context = {}) {
49
+ const networkConditions = await this.networkMonitor.getCurrentConditions();
50
+ const membershipStatus = await this.membershipTracker.getMembershipStatus();
51
+ const performanceMetrics = context.performanceMetrics || await this.getPerformanceMetrics();
52
+
53
+ const analysisInput = {
54
+ networkConditions: networkConditions,
55
+ membershipStatus: membershipStatus,
56
+ performanceMetrics: performanceMetrics,
57
+ currentQuorum: this.currentQuorum,
58
+ protocol: this.protocol,
59
+ faultToleranceRequirements: context.faultToleranceRequirements || this.getDefaultFaultTolerance()
60
+ };
61
+
62
+ // Apply multiple strategies and select optimal result
63
+ const strategyResults = new Map();
64
+
65
+ for (const [strategyName, strategy] of this.adjustmentStrategies) {
66
+ try {
67
+ const result = await strategy.calculateQuorum(analysisInput);
68
+ strategyResults.set(strategyName, result);
69
+ } catch (error) {
70
+ console.warn(`Strategy ${strategyName} failed:`, error);
71
+ }
72
+ }
73
+
74
+ // Select best strategy result
75
+ const optimalResult = this.selectOptimalStrategy(strategyResults, analysisInput);
76
+
77
+ return {
78
+ recommendedQuorum: optimalResult.quorum,
79
+ strategy: optimalResult.strategy,
80
+ confidence: optimalResult.confidence,
81
+ reasoning: optimalResult.reasoning,
82
+ expectedImpact: optimalResult.expectedImpact
83
+ };
84
+ }
85
+
86
+ // Apply quorum changes with validation and rollback capability
87
+ async adjustQuorum(newQuorumConfig, options = {}) {
88
+ const adjustmentId = `adjustment_${Date.now()}`;
89
+
90
+ try {
91
+ // Validate new quorum configuration
92
+ await this.validateQuorumConfiguration(newQuorumConfig);
93
+
94
+ // Create adjustment plan
95
+ const adjustmentPlan = await this.createAdjustmentPlan(
96
+ this.currentQuorum, newQuorumConfig
97
+ );
98
+
99
+ // Execute adjustment with monitoring
100
+ const adjustmentResult = await this.executeQuorumAdjustment(
101
+ adjustmentPlan, adjustmentId, options
102
+ );
103
+
104
+ // Verify adjustment success
105
+ await this.verifyQuorumAdjustment(adjustmentResult);
106
+
107
+ // Update current quorum
108
+ this.currentQuorum = newQuorumConfig.quorum;
109
+
110
+ // Record successful adjustment
111
+ this.recordQuorumChange(adjustmentId, adjustmentResult);
112
+
113
+ return {
114
+ success: true,
115
+ adjustmentId: adjustmentId,
116
+ previousQuorum: adjustmentPlan.previousQuorum,
117
+ newQuorum: this.currentQuorum,
118
+ impact: adjustmentResult.impact
119
+ };
120
+
121
+ } catch (error) {
122
+ console.error(`Quorum adjustment failed:`, error);
123
+
124
+ // Attempt rollback
125
+ await this.rollbackQuorumAdjustment(adjustmentId);
126
+
127
+ throw error;
128
+ }
129
+ }
130
+
131
+ async executeQuorumAdjustment(adjustmentPlan, adjustmentId, options) {
132
+ const startTime = Date.now();
133
+
134
+ // Phase 1: Prepare nodes for quorum change
135
+ await this.prepareNodesForAdjustment(adjustmentPlan.affectedNodes);
136
+
137
+ // Phase 2: Execute membership changes
138
+ const membershipChanges = await this.executeMembershipChanges(
139
+ adjustmentPlan.membershipChanges
140
+ );
141
+
142
+ // Phase 3: Update voting weights if needed
143
+ if (adjustmentPlan.weightChanges.length > 0) {
144
+ await this.updateVotingWeights(adjustmentPlan.weightChanges);
145
+ }
146
+
147
+ // Phase 4: Reconfigure consensus protocol
148
+ await this.reconfigureConsensusProtocol(adjustmentPlan.protocolChanges);
149
+
150
+ // Phase 5: Verify new quorum is operational
151
+ const verificationResult = await this.verifyQuorumOperational(adjustmentPlan.newQuorum);
152
+
153
+ const endTime = Date.now();
154
+
155
+ return {
156
+ adjustmentId: adjustmentId,
157
+ duration: endTime - startTime,
158
+ membershipChanges: membershipChanges,
159
+ verificationResult: verificationResult,
160
+ impact: await this.measureAdjustmentImpact(startTime, endTime)
161
+ };
162
+ }
163
+ }
164
+ ```
165
+
166
+ ### Network-Based Quorum Strategy
167
+ ```javascript
168
+ class NetworkBasedStrategy {
169
+ constructor() {
170
+ this.networkAnalyzer = new NetworkAnalyzer();
171
+ this.connectivityMatrix = new ConnectivityMatrix();
172
+ this.partitionPredictor = new PartitionPredictor();
173
+ }
174
+
175
+ async calculateQuorum(analysisInput) {
176
+ const { networkConditions, membershipStatus, currentQuorum } = analysisInput;
177
+
178
+ // Analyze network topology and connectivity
179
+ const topologyAnalysis = await this.analyzeNetworkTopology(membershipStatus.activeNodes);
180
+
181
+ // Predict potential network partitions
182
+ const partitionRisk = await this.assessPartitionRisk(networkConditions, topologyAnalysis);
183
+
184
+ // Calculate minimum quorum for fault tolerance
185
+ const minQuorum = this.calculateMinimumQuorum(
186
+ membershipStatus.activeNodes.length,
187
+ partitionRisk.maxPartitionSize
188
+ );
189
+
190
+ // Optimize for network conditions
191
+ const optimizedQuorum = await this.optimizeForNetworkConditions(
192
+ minQuorum,
193
+ networkConditions,
194
+ topologyAnalysis
195
+ );
196
+
197
+ return {
198
+ quorum: optimizedQuorum,
199
+ strategy: 'NETWORK_BASED',
200
+ confidence: this.calculateConfidence(networkConditions, topologyAnalysis),
201
+ reasoning: this.generateReasoning(optimizedQuorum, partitionRisk, networkConditions),
202
+ expectedImpact: {
203
+ availability: this.estimateAvailabilityImpact(optimizedQuorum),
204
+ performance: this.estimatePerformanceImpact(optimizedQuorum, networkConditions)
205
+ }
206
+ };
207
+ }
208
+
209
+ async analyzeNetworkTopology(activeNodes) {
210
+ const topology = {
211
+ nodes: activeNodes.length,
212
+ edges: 0,
213
+ clusters: [],
214
+ diameter: 0,
215
+ connectivity: new Map()
216
+ };
217
+
218
+ // Build connectivity matrix
219
+ for (const node of activeNodes) {
220
+ const connections = await this.getNodeConnections(node);
221
+ topology.connectivity.set(node.id, connections);
222
+ topology.edges += connections.length;
223
+ }
224
+
225
+ // Identify network clusters
226
+ topology.clusters = await this.identifyNetworkClusters(topology.connectivity);
227
+
228
+ // Calculate network diameter
229
+ topology.diameter = await this.calculateNetworkDiameter(topology.connectivity);
230
+
231
+ return topology;
232
+ }
233
+
234
+ async assessPartitionRisk(networkConditions, topologyAnalysis) {
235
+ const riskFactors = {
236
+ connectivityReliability: this.assessConnectivityReliability(networkConditions),
237
+ geographicDistribution: this.assessGeographicRisk(topologyAnalysis),
238
+ networkLatency: this.assessLatencyRisk(networkConditions),
239
+ historicalPartitions: await this.getHistoricalPartitionData()
240
+ };
241
+
242
+ // Calculate overall partition risk
243
+ const overallRisk = this.calculateOverallPartitionRisk(riskFactors);
244
+
245
+ // Estimate maximum partition size
246
+ const maxPartitionSize = this.estimateMaxPartitionSize(
247
+ topologyAnalysis,
248
+ riskFactors
249
+ );
250
+
251
+ return {
252
+ overallRisk: overallRisk,
253
+ maxPartitionSize: maxPartitionSize,
254
+ riskFactors: riskFactors,
255
+ mitigationStrategies: this.suggestMitigationStrategies(riskFactors)
256
+ };
257
+ }
258
+
259
+ calculateMinimumQuorum(totalNodes, maxPartitionSize) {
260
+ // For Byzantine fault tolerance: need > 2/3 of total nodes
261
+ const byzantineMinimum = Math.floor(2 * totalNodes / 3) + 1;
262
+
263
+ // For network partition tolerance: need > 1/2 of largest connected component
264
+ const partitionMinimum = Math.floor((totalNodes - maxPartitionSize) / 2) + 1;
265
+
266
+ // Use the more restrictive requirement
267
+ return Math.max(byzantineMinimum, partitionMinimum);
268
+ }
269
+
270
+ async optimizeForNetworkConditions(minQuorum, networkConditions, topologyAnalysis) {
271
+ const optimization = {
272
+ baseQuorum: minQuorum,
273
+ nodes: new Map(),
274
+ totalWeight: 0
275
+ };
276
+
277
+ // Select nodes for quorum based on network position and reliability
278
+ const nodeScores = await this.scoreNodesForQuorum(networkConditions, topologyAnalysis);
279
+
280
+ // Sort nodes by score (higher is better)
281
+ const sortedNodes = Array.from(nodeScores.entries())
282
+ .sort(([,scoreA], [,scoreB]) => scoreB - scoreA);
283
+
284
+ // Select top nodes for quorum
285
+ let selectedCount = 0;
286
+ for (const [nodeId, score] of sortedNodes) {
287
+ if (selectedCount < minQuorum) {
288
+ const weight = this.calculateNodeWeight(nodeId, score, networkConditions);
289
+ optimization.nodes.set(nodeId, {
290
+ weight: weight,
291
+ score: score,
292
+ role: selectedCount === 0 ? 'primary' : 'secondary'
293
+ });
294
+ optimization.totalWeight += weight;
295
+ selectedCount++;
296
+ }
297
+ }
298
+
299
+ return optimization;
300
+ }
301
+
302
+ async scoreNodesForQuorum(networkConditions, topologyAnalysis) {
303
+ const scores = new Map();
304
+
305
+ for (const [nodeId, connections] of topologyAnalysis.connectivity) {
306
+ let score = 0;
307
+
308
+ // Connectivity score (more connections = higher score)
309
+ score += (connections.length / topologyAnalysis.nodes) * 30;
310
+
311
+ // Network position score (central nodes get higher scores)
312
+ const centrality = this.calculateCentrality(nodeId, topologyAnalysis);
313
+ score += centrality * 25;
314
+
315
+ // Reliability score based on network conditions
316
+ const reliability = await this.getNodeReliability(nodeId, networkConditions);
317
+ score += reliability * 25;
318
+
319
+ // Geographic diversity score
320
+ const geoScore = await this.getGeographicDiversityScore(nodeId, topologyAnalysis);
321
+ score += geoScore * 20;
322
+
323
+ scores.set(nodeId, score);
324
+ }
325
+
326
+ return scores;
327
+ }
328
+
329
+ calculateNodeWeight(nodeId, score, networkConditions) {
330
+ // Base weight of 1, adjusted by score and conditions
331
+ let weight = 1.0;
332
+
333
+ // Adjust based on normalized score (0-1)
334
+ const normalizedScore = score / 100;
335
+ weight *= (0.5 + normalizedScore);
336
+
337
+ // Adjust based on network latency
338
+ const nodeLatency = networkConditions.nodeLatencies.get(nodeId) || 100;
339
+ const latencyFactor = Math.max(0.1, 1.0 - (nodeLatency / 1000)); // Lower latency = higher weight
340
+ weight *= latencyFactor;
341
+
342
+ // Ensure minimum weight
343
+ return Math.max(0.1, Math.min(2.0, weight));
344
+ }
345
+ }
346
+ ```
347
+
348
+ ### Performance-Based Quorum Strategy
349
+ ```javascript
350
+ class PerformanceBasedStrategy {
351
+ constructor() {
352
+ this.performanceAnalyzer = new PerformanceAnalyzer();
353
+ this.throughputOptimizer = new ThroughputOptimizer();
354
+ this.latencyOptimizer = new LatencyOptimizer();
355
+ }
356
+
357
+ async calculateQuorum(analysisInput) {
358
+ const { performanceMetrics, membershipStatus, protocol } = analysisInput;
359
+
360
+ // Analyze current performance bottlenecks
361
+ const bottlenecks = await this.identifyPerformanceBottlenecks(performanceMetrics);
362
+
363
+ // Calculate throughput-optimal quorum size
364
+ const throughputOptimal = await this.calculateThroughputOptimalQuorum(
365
+ performanceMetrics, membershipStatus.activeNodes
366
+ );
367
+
368
+ // Calculate latency-optimal quorum size
369
+ const latencyOptimal = await this.calculateLatencyOptimalQuorum(
370
+ performanceMetrics, membershipStatus.activeNodes
371
+ );
372
+
373
+ // Balance throughput and latency requirements
374
+ const balancedQuorum = await this.balanceThroughputAndLatency(
375
+ throughputOptimal, latencyOptimal, performanceMetrics.requirements
376
+ );
377
+
378
+ return {
379
+ quorum: balancedQuorum,
380
+ strategy: 'PERFORMANCE_BASED',
381
+ confidence: this.calculatePerformanceConfidence(performanceMetrics),
382
+ reasoning: this.generatePerformanceReasoning(
383
+ balancedQuorum, throughputOptimal, latencyOptimal, bottlenecks
384
+ ),
385
+ expectedImpact: {
386
+ throughputImprovement: this.estimateThroughputImpact(balancedQuorum),
387
+ latencyImprovement: this.estimateLatencyImpact(balancedQuorum)
388
+ }
389
+ };
390
+ }
391
+
392
+ async calculateThroughputOptimalQuorum(performanceMetrics, activeNodes) {
393
+ const currentThroughput = performanceMetrics.throughput;
394
+ const targetThroughput = performanceMetrics.requirements.targetThroughput;
395
+
396
+ // Analyze relationship between quorum size and throughput
397
+ const throughputCurve = await this.analyzeThroughputCurve(activeNodes);
398
+
399
+ // Find quorum size that maximizes throughput while meeting requirements
400
+ let optimalSize = Math.ceil(activeNodes.length / 2) + 1; // Minimum viable quorum
401
+ let maxThroughput = 0;
402
+
403
+ for (let size = optimalSize; size <= activeNodes.length; size++) {
404
+ const projectedThroughput = this.projectThroughput(size, throughputCurve);
405
+
406
+ if (projectedThroughput > maxThroughput && projectedThroughput >= targetThroughput) {
407
+ maxThroughput = projectedThroughput;
408
+ optimalSize = size;
409
+ } else if (projectedThroughput < maxThroughput * 0.9) {
410
+ // Stop if throughput starts decreasing significantly
411
+ break;
412
+ }
413
+ }
414
+
415
+ return await this.selectOptimalNodes(activeNodes, optimalSize, 'THROUGHPUT');
416
+ }
417
+
418
+ async calculateLatencyOptimalQuorum(performanceMetrics, activeNodes) {
419
+ const currentLatency = performanceMetrics.latency;
420
+ const targetLatency = performanceMetrics.requirements.maxLatency;
421
+
422
+ // Analyze relationship between quorum size and latency
423
+ const latencyCurve = await this.analyzeLatencyCurve(activeNodes);
424
+
425
+ // Find minimum quorum size that meets latency requirements
426
+ const minViableQuorum = Math.ceil(activeNodes.length / 2) + 1;
427
+
428
+ for (let size = minViableQuorum; size <= activeNodes.length; size++) {
429
+ const projectedLatency = this.projectLatency(size, latencyCurve);
430
+
431
+ if (projectedLatency <= targetLatency) {
432
+ return await this.selectOptimalNodes(activeNodes, size, 'LATENCY');
433
+ }
434
+ }
435
+
436
+ // If no size meets requirements, return minimum viable with warning
437
+ console.warn('No quorum size meets latency requirements');
438
+ return await this.selectOptimalNodes(activeNodes, minViableQuorum, 'LATENCY');
439
+ }
440
+
441
+ async selectOptimalNodes(availableNodes, targetSize, optimizationTarget) {
442
+ const nodeScores = new Map();
443
+
444
+ // Score nodes based on optimization target
445
+ for (const node of availableNodes) {
446
+ let score = 0;
447
+
448
+ if (optimizationTarget === 'THROUGHPUT') {
449
+ score = await this.scoreThroughputCapability(node);
450
+ } else if (optimizationTarget === 'LATENCY') {
451
+ score = await this.scoreLatencyPerformance(node);
452
+ }
453
+
454
+ nodeScores.set(node.id, score);
455
+ }
456
+
457
+ // Select top-scoring nodes
458
+ const sortedNodes = availableNodes.sort((a, b) =>
459
+ nodeScores.get(b.id) - nodeScores.get(a.id)
460
+ );
461
+
462
+ const selectedNodes = new Map();
463
+
464
+ for (let i = 0; i < Math.min(targetSize, sortedNodes.length); i++) {
465
+ const node = sortedNodes[i];
466
+ selectedNodes.set(node.id, {
467
+ weight: this.calculatePerformanceWeight(node, nodeScores.get(node.id)),
468
+ score: nodeScores.get(node.id),
469
+ role: i === 0 ? 'primary' : 'secondary',
470
+ optimizationTarget: optimizationTarget
471
+ });
472
+ }
473
+
474
+ return {
475
+ nodes: selectedNodes,
476
+ totalWeight: Array.from(selectedNodes.values())
477
+ .reduce((sum, node) => sum + node.weight, 0),
478
+ optimizationTarget: optimizationTarget
479
+ };
480
+ }
481
+
482
+ async scoreThroughputCapability(node) {
483
+ let score = 0;
484
+
485
+ // CPU capacity score
486
+ const cpuCapacity = await this.getNodeCPUCapacity(node);
487
+ score += (cpuCapacity / 100) * 30; // 30% weight for CPU
488
+
489
+ // Network bandwidth score
490
+ const bandwidth = await this.getNodeBandwidth(node);
491
+ score += (bandwidth / 1000) * 25; // 25% weight for bandwidth (Mbps)
492
+
493
+ // Memory capacity score
494
+ const memory = await this.getNodeMemory(node);
495
+ score += (memory / 8192) * 20; // 20% weight for memory (MB)
496
+
497
+ // Historical throughput performance
498
+ const historicalPerformance = await this.getHistoricalThroughput(node);
499
+ score += (historicalPerformance / 1000) * 25; // 25% weight for historical performance
500
+
501
+ return Math.min(100, score); // Normalize to 0-100
502
+ }
503
+
504
+ async scoreLatencyPerformance(node) {
505
+ let score = 100; // Start with perfect score, subtract penalties
506
+
507
+ // Network latency penalty
508
+ const avgLatency = await this.getAverageNodeLatency(node);
509
+ score -= (avgLatency / 10); // Subtract 1 point per 10ms latency
510
+
511
+ // CPU load penalty
512
+ const cpuLoad = await this.getNodeCPULoad(node);
513
+ score -= (cpuLoad / 2); // Subtract 0.5 points per 1% CPU load
514
+
515
+ // Geographic distance penalty (for distributed networks)
516
+ const geoLatency = await this.getGeographicLatency(node);
517
+ score -= (geoLatency / 20); // Subtract 1 point per 20ms geo latency
518
+
519
+ // Consistency penalty (nodes with inconsistent performance)
520
+ const consistencyScore = await this.getPerformanceConsistency(node);
521
+ score *= consistencyScore; // Multiply by consistency factor (0-1)
522
+
523
+ return Math.max(0, score);
524
+ }
525
+ }
526
+ ```
527
+
528
+ ### Fault Tolerance Strategy
529
+ ```javascript
530
+ class FaultToleranceStrategy {
531
+ constructor() {
532
+ this.faultAnalyzer = new FaultAnalyzer();
533
+ this.reliabilityCalculator = new ReliabilityCalculator();
534
+ this.redundancyOptimizer = new RedundancyOptimizer();
535
+ }
536
+
537
+ async calculateQuorum(analysisInput) {
538
+ const { membershipStatus, faultToleranceRequirements, networkConditions } = analysisInput;
539
+
540
+ // Analyze fault scenarios
541
+ const faultScenarios = await this.analyzeFaultScenarios(
542
+ membershipStatus.activeNodes, networkConditions
543
+ );
544
+
545
+ // Calculate minimum quorum for fault tolerance requirements
546
+ const minQuorum = this.calculateFaultTolerantQuorum(
547
+ faultScenarios, faultToleranceRequirements
548
+ );
549
+
550
+ // Optimize node selection for maximum fault tolerance
551
+ const faultTolerantQuorum = await this.optimizeForFaultTolerance(
552
+ membershipStatus.activeNodes, minQuorum, faultScenarios
553
+ );
554
+
555
+ return {
556
+ quorum: faultTolerantQuorum,
557
+ strategy: 'FAULT_TOLERANCE_BASED',
558
+ confidence: this.calculateFaultConfidence(faultScenarios),
559
+ reasoning: this.generateFaultToleranceReasoning(
560
+ faultTolerantQuorum, faultScenarios, faultToleranceRequirements
561
+ ),
562
+ expectedImpact: {
563
+ availability: this.estimateAvailabilityImprovement(faultTolerantQuorum),
564
+ resilience: this.estimateResilienceImprovement(faultTolerantQuorum)
565
+ }
566
+ };
567
+ }
568
+
569
+ async analyzeFaultScenarios(activeNodes, networkConditions) {
570
+ const scenarios = [];
571
+
572
+ // Single node failure scenarios
573
+ for (const node of activeNodes) {
574
+ const scenario = await this.analyzeSingleNodeFailure(node, activeNodes, networkConditions);
575
+ scenarios.push(scenario);
576
+ }
577
+
578
+ // Multiple node failure scenarios
579
+ const multiFailureScenarios = await this.analyzeMultipleNodeFailures(
580
+ activeNodes, networkConditions
581
+ );
582
+ scenarios.push(...multiFailureScenarios);
583
+
584
+ // Network partition scenarios
585
+ const partitionScenarios = await this.analyzeNetworkPartitionScenarios(
586
+ activeNodes, networkConditions
587
+ );
588
+ scenarios.push(...partitionScenarios);
589
+
590
+ // Correlated failure scenarios
591
+ const correlatedFailureScenarios = await this.analyzeCorrelatedFailures(
592
+ activeNodes, networkConditions
593
+ );
594
+ scenarios.push(...correlatedFailureScenarios);
595
+
596
+ return this.prioritizeScenariosByLikelihood(scenarios);
597
+ }
598
+
599
+ calculateFaultTolerantQuorum(faultScenarios, requirements) {
600
+ let maxRequiredQuorum = 0;
601
+
602
+ for (const scenario of faultScenarios) {
603
+ if (scenario.likelihood >= requirements.minLikelihoodToConsider) {
604
+ const requiredQuorum = this.calculateQuorumForScenario(scenario, requirements);
605
+ maxRequiredQuorum = Math.max(maxRequiredQuorum, requiredQuorum);
606
+ }
607
+ }
608
+
609
+ return maxRequiredQuorum;
610
+ }
611
+
612
+ calculateQuorumForScenario(scenario, requirements) {
613
+ const totalNodes = scenario.totalNodes;
614
+ const failedNodes = scenario.failedNodes;
615
+ const availableNodes = totalNodes - failedNodes;
616
+
617
+ // For Byzantine fault tolerance
618
+ if (requirements.byzantineFaultTolerance) {
619
+ const maxByzantineNodes = Math.floor((totalNodes - 1) / 3);
620
+ return Math.floor(2 * totalNodes / 3) + 1;
621
+ }
622
+
623
+ // For crash fault tolerance
624
+ return Math.floor(availableNodes / 2) + 1;
625
+ }
626
+
627
+ async optimizeForFaultTolerance(activeNodes, minQuorum, faultScenarios) {
628
+ const optimizedQuorum = {
629
+ nodes: new Map(),
630
+ totalWeight: 0,
631
+ faultTolerance: {
632
+ singleNodeFailures: 0,
633
+ multipleNodeFailures: 0,
634
+ networkPartitions: 0
635
+ }
636
+ };
637
+
638
+ // Score nodes based on fault tolerance contribution
639
+ const nodeScores = await this.scoreFaultToleranceContribution(
640
+ activeNodes, faultScenarios
641
+ );
642
+
643
+ // Select nodes to maximize fault tolerance coverage
644
+ const selectedNodes = this.selectFaultTolerantNodes(
645
+ activeNodes, minQuorum, nodeScores, faultScenarios
646
+ );
647
+
648
+ for (const [nodeId, nodeData] of selectedNodes) {
649
+ optimizedQuorum.nodes.set(nodeId, {
650
+ weight: nodeData.weight,
651
+ score: nodeData.score,
652
+ role: nodeData.role,
653
+ faultToleranceContribution: nodeData.faultToleranceContribution
654
+ });
655
+ optimizedQuorum.totalWeight += nodeData.weight;
656
+ }
657
+
658
+ // Calculate fault tolerance metrics for selected quorum
659
+ optimizedQuorum.faultTolerance = await this.calculateFaultToleranceMetrics(
660
+ selectedNodes, faultScenarios
661
+ );
662
+
663
+ return optimizedQuorum;
664
+ }
665
+
666
+ async scoreFaultToleranceContribution(activeNodes, faultScenarios) {
667
+ const scores = new Map();
668
+
669
+ for (const node of activeNodes) {
670
+ let score = 0;
671
+
672
+ // Independence score (nodes in different failure domains get higher scores)
673
+ const independenceScore = await this.calculateIndependenceScore(node, activeNodes);
674
+ score += independenceScore * 40;
675
+
676
+ // Reliability score (historical uptime and performance)
677
+ const reliabilityScore = await this.calculateReliabilityScore(node);
678
+ score += reliabilityScore * 30;
679
+
680
+ // Geographic diversity score
681
+ const diversityScore = await this.calculateDiversityScore(node, activeNodes);
682
+ score += diversityScore * 20;
683
+
684
+ // Recovery capability score
685
+ const recoveryScore = await this.calculateRecoveryScore(node);
686
+ score += recoveryScore * 10;
687
+
688
+ scores.set(node.id, score);
689
+ }
690
+
691
+ return scores;
692
+ }
693
+
694
+ selectFaultTolerantNodes(activeNodes, minQuorum, nodeScores, faultScenarios) {
695
+ const selectedNodes = new Map();
696
+ const remainingNodes = [...activeNodes];
697
+
698
+ // Greedy selection to maximize fault tolerance coverage
699
+ while (selectedNodes.size < minQuorum && remainingNodes.length > 0) {
700
+ let bestNode = null;
701
+ let bestScore = -1;
702
+ let bestIndex = -1;
703
+
704
+ for (let i = 0; i < remainingNodes.length; i++) {
705
+ const node = remainingNodes[i];
706
+ const additionalCoverage = this.calculateAdditionalFaultCoverage(
707
+ node, selectedNodes, faultScenarios
708
+ );
709
+
710
+ const combinedScore = nodeScores.get(node.id) + (additionalCoverage * 50);
711
+
712
+ if (combinedScore > bestScore) {
713
+ bestScore = combinedScore;
714
+ bestNode = node;
715
+ bestIndex = i;
716
+ }
717
+ }
718
+
719
+ if (bestNode) {
720
+ selectedNodes.set(bestNode.id, {
721
+ weight: this.calculateFaultToleranceWeight(bestNode, nodeScores.get(bestNode.id)),
722
+ score: nodeScores.get(bestNode.id),
723
+ role: selectedNodes.size === 0 ? 'primary' : 'secondary',
724
+ faultToleranceContribution: this.calculateFaultToleranceContribution(bestNode)
725
+ });
726
+
727
+ remainingNodes.splice(bestIndex, 1);
728
+ } else {
729
+ break; // No more beneficial nodes
730
+ }
731
+ }
732
+
733
+ return selectedNodes;
734
+ }
735
+ }
736
+ ```
737
+
738
+ ## MCP Integration Hooks
739
+
740
+ ### Quorum State Management
741
+ ```javascript
742
+ // Store quorum configuration and history
743
+ await this.mcpTools.memory_usage({
744
+ action: 'store',
745
+ key: `quorum_config_${this.nodeId}`,
746
+ value: JSON.stringify({
747
+ currentQuorum: Array.from(this.currentQuorum.entries()),
748
+ strategy: this.activeStrategy,
749
+ networkConditions: this.lastNetworkAnalysis,
750
+ adjustmentHistory: this.quorumHistory.slice(-10)
751
+ }),
752
+ namespace: 'quorum_management',
753
+ ttl: 3600000 // 1 hour
754
+ });
755
+
756
+ // Coordinate with swarm for membership changes
757
+ const swarmStatus = await this.mcpTools.swarm_status({
758
+ swarmId: this.swarmId
759
+ });
760
+
761
+ await this.mcpTools.coordination_sync({
762
+ swarmId: this.swarmId
763
+ });
764
+ ```
765
+
766
+ ### Performance Monitoring Integration
767
+ ```javascript
768
+ // Track quorum adjustment performance
769
+ await this.mcpTools.metrics_collect({
770
+ components: [
771
+ 'quorum_adjustment_latency',
772
+ 'consensus_availability',
773
+ 'fault_tolerance_coverage',
774
+ 'network_partition_recovery_time'
775
+ ]
776
+ });
777
+
778
+ // Neural learning for quorum optimization
779
+ await this.mcpTools.neural_patterns({
780
+ action: 'learn',
781
+ operation: 'quorum_optimization',
782
+ outcome: JSON.stringify({
783
+ adjustmentType: adjustment.strategy,
784
+ performanceImpact: measurementResults,
785
+ networkConditions: currentNetworkState,
786
+ faultToleranceImprovement: faultToleranceMetrics
787
+ })
788
+ });
789
+ ```
790
+
791
+ ### Task Orchestration for Quorum Changes
792
+ ```javascript
793
+ // Orchestrate complex quorum adjustments
794
+ await this.mcpTools.task_orchestrate({
795
+ task: 'quorum_adjustment',
796
+ strategy: 'sequential',
797
+ priority: 'high',
798
+ dependencies: [
799
+ 'network_analysis',
800
+ 'membership_validation',
801
+ 'performance_assessment'
802
+ ]
803
+ });
804
+ ```
805
+
806
+ This Quorum Manager provides intelligent, adaptive quorum management that optimizes for network conditions, performance requirements, and fault tolerance needs while maintaining the safety and liveness properties of distributed consensus protocols.