claude-flow-novice 1.3.5 → 1.5.0

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 (356) 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 +300 -0
  4. package/.claude/agents/architect.md +557 -0
  5. package/.claude/agents/architecture/system-architect.md +630 -0
  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 +180 -0
  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 +842 -0
  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 +638 -0
  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 +725 -0
  30. package/.claude/agents/optimization/performance-monitor.md +1 -1
  31. package/.claude/agents/planner.md +135 -0
  32. package/.claude/agents/researcher.md +185 -0
  33. package/.claude/agents/reviewer.md +291 -0
  34. package/.claude/agents/security/security-specialist.md +978 -0
  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/swarm/adaptive-coordinator-enhanced.md +746 -0
  41. package/.claude/agents/tester.md +663 -0
  42. package/.claude/agents/testing/unit/tdd-london-swarm.md +1 -1
  43. package/.claude/agents/testing/validation/production-validator.md +1 -1
  44. package/.claude/commands/claude-soul.js +1 -1
  45. package/.claude/hooks.json +12 -15
  46. package/{.claude → .claude-flow-novice/.claude}/agents/MIGRATION_SUMMARY.md +1 -1
  47. package/.claude-flow-novice/.claude/agents/analysis/code-analyzer.md +192 -0
  48. package/.claude-flow-novice/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
  49. package/.claude-flow-novice/.claude/agents/analyst.md +300 -0
  50. package/.claude-flow-novice/.claude/agents/architect.md +557 -0
  51. package/.claude-flow-novice/.claude/agents/architecture/system-architect.md +630 -0
  52. package/.claude-flow-novice/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
  53. package/.claude-flow-novice/.claude/agents/backend-dev.json +42 -0
  54. package/.claude-flow-novice/.claude/agents/base-template-generator.md +65 -0
  55. package/.claude-flow-novice/.claude/agents/code-analyzer.json +39 -0
  56. package/.claude-flow-novice/.claude/agents/coder.json +42 -0
  57. package/.claude-flow-novice/.claude/agents/coder.md +180 -0
  58. package/.claude-flow-novice/.claude/agents/consensus/byzantine-coordinator.md +46 -0
  59. package/.claude-flow-novice/.claude/agents/consensus/consensus-builder.md +225 -0
  60. package/.claude-flow-novice/.claude/agents/consensus/crdt-synchronizer.md +980 -0
  61. package/.claude-flow-novice/.claude/agents/consensus/gossip-coordinator.md +46 -0
  62. package/.claude-flow-novice/.claude/agents/consensus/performance-benchmarker.md +834 -0
  63. package/.claude-flow-novice/.claude/agents/consensus/quorum-manager.md +806 -0
  64. package/.claude-flow-novice/.claude/agents/consensus/raft-manager.md +46 -0
  65. package/.claude-flow-novice/.claude/agents/consensus/security-manager.md +605 -0
  66. package/.claude-flow-novice/.claude/agents/coordinator.md +842 -0
  67. package/.claude-flow-novice/.claude/agents/data/ml/data-ml-model.md +193 -0
  68. package/.claude-flow-novice/.claude/agents/development/backend/dev-backend-api.md +142 -0
  69. package/.claude-flow-novice/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  70. package/.claude-flow-novice/.claude/agents/devops/devops-engineer.md +638 -0
  71. package/.claude-flow-novice/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  72. package/.claude-flow-novice/.claude/agents/github/code-review-swarm.md +538 -0
  73. package/.claude-flow-novice/.claude/agents/github/github-modes.md +173 -0
  74. package/.claude-flow-novice/.claude/agents/github/github-specialist.md +856 -0
  75. package/.claude-flow-novice/.claude/agents/github/issue-tracker.md +319 -0
  76. package/.claude-flow-novice/.claude/agents/github/multi-repo-swarm.md +553 -0
  77. package/.claude-flow-novice/.claude/agents/github/pr-manager.md +191 -0
  78. package/.claude-flow-novice/.claude/agents/github/project-board-sync.md +509 -0
  79. package/.claude-flow-novice/.claude/agents/github/release-manager.md +367 -0
  80. package/.claude-flow-novice/.claude/agents/github/release-swarm.md +583 -0
  81. package/.claude-flow-novice/.claude/agents/github/repo-architect.md +398 -0
  82. package/.claude-flow-novice/.claude/agents/github/swarm-issue.md +573 -0
  83. package/.claude-flow-novice/.claude/agents/github/swarm-pr.md +428 -0
  84. package/.claude-flow-novice/.claude/agents/github/sync-coordinator.md +452 -0
  85. package/.claude-flow-novice/.claude/agents/github/workflow-automation.md +635 -0
  86. package/.claude-flow-novice/.claude/agents/goal/goal-planner.md +73 -0
  87. package/.claude-flow-novice/.claude/agents/neural/neural-pattern-agent.md +762 -0
  88. package/.claude-flow-novice/.claude/agents/neural/safla-neural.md +74 -0
  89. package/.claude-flow-novice/.claude/agents/optimization/benchmark-suite.md +665 -0
  90. package/.claude-flow-novice/.claude/agents/optimization/load-balancer.md +431 -0
  91. package/.claude-flow-novice/.claude/agents/optimization/perf-analyzer.md +725 -0
  92. package/.claude-flow-novice/.claude/agents/optimization/performance-monitor.md +672 -0
  93. package/.claude-flow-novice/.claude/agents/optimization/resource-allocator.md +674 -0
  94. package/.claude-flow-novice/.claude/agents/optimization/topology-optimizer.md +808 -0
  95. package/.claude-flow-novice/.claude/agents/planner.json +41 -0
  96. package/.claude-flow-novice/.claude/agents/planner.md +135 -0
  97. package/.claude-flow-novice/.claude/agents/researcher.json +41 -0
  98. package/.claude-flow-novice/.claude/agents/researcher.md +185 -0
  99. package/.claude-flow-novice/.claude/agents/reviewer.json +39 -0
  100. package/.claude-flow-novice/.claude/agents/reviewer.md +291 -0
  101. package/.claude-flow-novice/.claude/agents/security/security-specialist.md +978 -0
  102. package/.claude-flow-novice/.claude/agents/sparc/architecture.md +472 -0
  103. package/.claude-flow-novice/.claude/agents/sparc/pseudocode.md +318 -0
  104. package/.claude-flow-novice/.claude/agents/sparc/refinement.md +525 -0
  105. package/.claude-flow-novice/.claude/agents/sparc/specification.md +276 -0
  106. package/.claude-flow-novice/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
  107. package/.claude-flow-novice/.claude/agents/sublinear/consciousness-evolution-agent.md +499 -0
  108. package/.claude-flow-novice/.claude/agents/sublinear/matrix-solver-agent.md +113 -0
  109. package/.claude-flow-novice/.claude/agents/sublinear/nanosecond-scheduler-agent.md +644 -0
  110. package/.claude-flow-novice/.claude/agents/sublinear/pagerank-agent.md +699 -0
  111. package/.claude-flow-novice/.claude/agents/sublinear/phi-calculator-agent.md +749 -0
  112. package/.claude-flow-novice/.claude/agents/sublinear/psycho-symbolic-agent.md +543 -0
  113. package/.claude-flow-novice/.claude/agents/sublinear/sublinear.md +816 -0
  114. package/.claude-flow-novice/.claude/agents/sublinear/temporal-advantage-agent.md +360 -0
  115. package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator-enhanced.md +746 -0
  116. package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator.md +396 -0
  117. package/.claude-flow-novice/.claude/agents/swarm/hierarchical-coordinator.md +300 -0
  118. package/.claude-flow-novice/.claude/agents/swarm/mesh-coordinator.md +435 -0
  119. package/.claude-flow-novice/.claude/agents/system-architect.json +40 -0
  120. package/.claude-flow-novice/.claude/agents/templates/automation-smart-agent.md +205 -0
  121. package/.claude-flow-novice/.claude/agents/templates/coordinator-swarm-init.md +90 -0
  122. package/.claude-flow-novice/.claude/agents/templates/github-pr-manager.md +177 -0
  123. package/.claude-flow-novice/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  124. package/.claude-flow-novice/.claude/agents/templates/memory-coordinator.md +187 -0
  125. package/.claude-flow-novice/.claude/agents/templates/migration-plan.md +746 -0
  126. package/.claude-flow-novice/.claude/agents/templates/orchestrator-task.md +139 -0
  127. package/.claude-flow-novice/.claude/agents/templates/performance-analyzer.md +199 -0
  128. package/.claude-flow-novice/.claude/agents/templates/sparc-coordinator.md +183 -0
  129. package/.claude-flow-novice/.claude/agents/tester.json +40 -0
  130. package/.claude-flow-novice/.claude/agents/tester.md +663 -0
  131. package/.claude-flow-novice/.claude/agents/testing/e2e/playwright-agent.md +249 -0
  132. package/.claude-flow-novice/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
  133. package/.claude-flow-novice/.claude/agents/testing/validation/production-validator.md +395 -0
  134. package/.claude-flow-novice/dist/index.js +12 -24
  135. package/.claude-flow-novice/dist/index.js.map +1 -0
  136. package/.claude-flow-novice/dist/src/agents/agent-manager.js +123 -69
  137. package/.claude-flow-novice/dist/src/agents/agent-manager.js.map +1 -1
  138. package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js +7 -7
  139. package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js.map +1 -1
  140. package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js +485 -0
  141. package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js.map +1 -0
  142. package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js +630 -0
  143. package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js.map +1 -0
  144. package/.claude-flow-novice/dist/src/cli/commands/agent.js +1 -1
  145. package/.claude-flow-novice/dist/src/cli/commands/agent.js.map +1 -1
  146. package/.claude-flow-novice/dist/src/cli/commands/config-integration.js +6 -6
  147. package/.claude-flow-novice/dist/src/cli/commands/enterprise.js +18 -18
  148. package/.claude-flow-novice/dist/src/cli/commands/enterprise.js.map +1 -1
  149. package/.claude-flow-novice/dist/src/cli/commands/goal-init.js +4 -4
  150. package/.claude-flow-novice/dist/src/cli/commands/help-new.js +23 -23
  151. package/.claude-flow-novice/dist/src/cli/commands/help-new.js.map +1 -1
  152. package/.claude-flow-novice/dist/src/cli/commands/help.js +74 -74
  153. package/.claude-flow-novice/dist/src/cli/commands/help.js.map +1 -1
  154. package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js +2 -2
  155. package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
  156. package/.claude-flow-novice/dist/src/cli/commands/hive.js +4 -4
  157. package/.claude-flow-novice/dist/src/cli/commands/index.js +103 -132
  158. package/.claude-flow-novice/dist/src/cli/commands/index.js.map +1 -1
  159. package/.claude-flow-novice/dist/src/cli/commands/mcp.js +1 -1
  160. package/.claude-flow-novice/dist/src/cli/commands/migrate.js +4 -4
  161. package/.claude-flow-novice/dist/src/cli/commands/migrate.js.map +1 -1
  162. package/.claude-flow-novice/dist/src/cli/commands/monitor.js +1 -1
  163. package/.claude-flow-novice/dist/src/cli/commands/neural-init.js +4 -4
  164. package/.claude-flow-novice/dist/src/cli/commands/ruv-swarm.js +8 -8
  165. package/.claude-flow-novice/dist/src/cli/commands/sparc.js +12 -12
  166. package/.claude-flow-novice/dist/src/cli/commands/sparc.js.map +1 -1
  167. package/.claude-flow-novice/dist/src/cli/commands/start/start-command.js +3 -3
  168. package/.claude-flow-novice/dist/src/cli/commands/status.js +1 -1
  169. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +7 -7
  170. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  171. package/.claude-flow-novice/dist/src/cli/commands/verification.js +18 -18
  172. package/.claude-flow-novice/dist/src/cli/completion.js +54 -54
  173. package/.claude-flow-novice/dist/src/cli/completion.js.map +1 -1
  174. package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js +11 -11
  175. package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js.map +1 -1
  176. package/.claude-flow-novice/dist/src/cli/consolidated/core/CommandHandlers.js +31 -31
  177. package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js +39 -39
  178. package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js.map +1 -1
  179. package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js +25 -25
  180. package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js.map +1 -1
  181. package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js +8 -8
  182. package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js.map +1 -1
  183. package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js +6 -6
  184. package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js.map +1 -1
  185. package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js +7 -7
  186. package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js.map +1 -1
  187. package/.claude-flow-novice/dist/src/cli/index-remote.js +10 -10
  188. package/.claude-flow-novice/dist/src/cli/index.js +1 -1
  189. package/.claude-flow-novice/dist/src/cli/init/directory-structure.js +8 -8
  190. package/.claude-flow-novice/dist/src/cli/init/index.js +3 -3
  191. package/.claude-flow-novice/dist/src/cli/init/sparc-environment.js +67 -67
  192. package/.claude-flow-novice/dist/src/cli/init/swarm-commands.js +18 -18
  193. package/.claude-flow-novice/dist/src/cli/node-repl.js +2 -2
  194. package/.claude-flow-novice/dist/src/cli/repl.js +1 -1
  195. package/.claude-flow-novice/dist/src/cli/simple-cli.js +68 -68
  196. package/.claude-flow-novice/dist/src/cli/simple-cli.js.map +1 -1
  197. package/.claude-flow-novice/dist/src/cli/simple-commands/session-start-soul.js +271 -0
  198. package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js +7 -7
  199. package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js.map +1 -1
  200. package/.claude-flow-novice/dist/src/cli/ui/fallback-handler.js +7 -7
  201. package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js +816 -0
  202. package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js.map +1 -0
  203. package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js +812 -0
  204. package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js.map +1 -0
  205. package/.claude-flow-novice/dist/src/communication/optimized-serialization.js +369 -0
  206. package/.claude-flow-novice/dist/src/communication/optimized-serialization.js.map +1 -0
  207. package/.claude-flow-novice/dist/src/communication/performance-optimizations.js +526 -0
  208. package/.claude-flow-novice/dist/src/communication/performance-optimizations.js.map +1 -0
  209. package/.claude-flow-novice/dist/src/communication/performance-validator.js +532 -0
  210. package/.claude-flow-novice/dist/src/communication/performance-validator.js.map +1 -0
  211. package/.claude-flow-novice/dist/src/communication/priority-message-queue.js +525 -0
  212. package/.claude-flow-novice/dist/src/communication/priority-message-queue.js.map +1 -0
  213. package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js +218 -0
  214. package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js.map +1 -0
  215. package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js +521 -0
  216. package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js.map +1 -0
  217. package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js +563 -0
  218. package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js.map +1 -0
  219. package/.claude-flow-novice/dist/src/communication/websocket-cluster.js +344 -0
  220. package/.claude-flow-novice/dist/src/communication/websocket-cluster.js.map +1 -0
  221. package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js +369 -0
  222. package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js.map +1 -0
  223. package/.claude-flow-novice/dist/src/config/config-manager.js +1 -1
  224. package/.claude-flow-novice/dist/src/config/config-manager.js.map +1 -1
  225. package/.claude-flow-novice/dist/src/config/core/intelligent-configuration-manager.js +1 -1
  226. package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js +6 -6
  227. package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js.map +1 -1
  228. package/.claude-flow-novice/dist/src/config/migration/config-migration.js +1 -1
  229. package/.claude-flow-novice/dist/src/config/ruv-swarm-integration.js +1 -1
  230. package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js +1 -1
  231. package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js.map +1 -1
  232. package/.claude-flow-novice/dist/src/config/web-portal-config.js +0 -9
  233. package/.claude-flow-novice/dist/src/config/web-portal-config.js.map +1 -1
  234. package/.claude-flow-novice/dist/src/config/zero-config-setup.js +18 -18
  235. package/.claude-flow-novice/dist/src/config/zero-config-setup.js.map +1 -1
  236. package/.claude-flow-novice/dist/src/core/logger.js +33 -10
  237. package/.claude-flow-novice/dist/src/core/logger.js.map +1 -1
  238. package/.claude-flow-novice/dist/src/migration/index.js +1 -1
  239. package/.claude-flow-novice/dist/src/migration/index.js.map +1 -1
  240. package/.claude-flow-novice/dist/src/migration/migration-runner.js +4 -4
  241. package/.claude-flow-novice/dist/src/migration/migration-runner.js.map +1 -1
  242. package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js +430 -0
  243. package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js.map +1 -0
  244. package/.claude-flow-novice/dist/src/slash-commands/claude-soul.js +248 -365
  245. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +1 -1
  246. package/.claude-flow-novice/dist/src/swarm/claude-code-interface.js +1 -1
  247. package/.claude-flow-novice/dist/src/swarm/claude-flow-executor.js +1 -1
  248. package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js +471 -0
  249. package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js.map +1 -0
  250. package/.claude-flow-novice/dist/src/swarm/hive-mind-integration.js +1 -1
  251. package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js +543 -0
  252. package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js.map +1 -0
  253. package/.claude-flow-novice/dist/src/swarm/optimizations/connection-pool.js +1 -1
  254. package/.claude-flow-novice/dist/src/swarm/optimizations/optimized-executor.js +1 -1
  255. package/.claude-flow-novice/dist/src/swarm/types.js.map +1 -1
  256. package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js +709 -0
  257. package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js.map +1 -0
  258. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js +612 -0
  259. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js.map +1 -0
  260. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js +679 -0
  261. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js.map +1 -0
  262. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js +654 -0
  263. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js.map +1 -0
  264. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js +402 -0
  265. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js.map +1 -0
  266. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js +459 -0
  267. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js.map +1 -0
  268. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js +513 -0
  269. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js.map +1 -0
  270. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js +19 -0
  271. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js.map +1 -0
  272. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js +568 -0
  273. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js.map +1 -0
  274. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js +418 -0
  275. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js.map +1 -0
  276. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js +530 -0
  277. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js.map +1 -0
  278. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js +250 -0
  279. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js.map +1 -0
  280. package/.claude-flow-novice/dist/src/task/index.js +7 -7
  281. package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js +420 -0
  282. package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js.map +1 -0
  283. package/.claude-flow-novice/dist/src/validation/production-validator.js +1435 -0
  284. package/.claude-flow-novice/dist/src/validation/production-validator.js.map +1 -0
  285. package/.claude-flow-novice/dist/src/verification/cli-integration.js +3 -3
  286. package/.claude-flow-novice/dist/src/verification/hooks.js +1 -1
  287. package/CHANGELOG.md +13 -0
  288. package/CLAUDE.md +1032 -61
  289. package/README.md +0 -1
  290. package/config/build/babel.config.cjs +19 -11
  291. package/config/typescript/tsconfig.json +1 -1
  292. package/examples/02-workflows/claude-workflow.json +5 -5
  293. package/examples/claude-api-error-handling.ts +2 -2
  294. package/examples/frontend-testing-demo.ts +470 -0
  295. package/examples/litellm/config/config.yaml +1 -1
  296. package/package.json +13 -7
  297. package/scripts/build/unified-builder.sh +6 -6
  298. package/scripts/build/validate-agents.js +238 -0
  299. package/scripts/post-install-claude-md.js +28 -0
  300. package/scripts/run-production-validation.ts +590 -0
  301. package/scripts/test/test-coordination-features.ts +2 -2
  302. package/scripts/validate-stage3-performance.ts +377 -0
  303. package/src/cli/simple-commands/hooks.js +1 -0
  304. package/src/cli/simple-commands/init/agent-copier.js +0 -2
  305. package/src/cli/simple-commands/init/index.js +18 -110
  306. package/src/cli/simple-commands/init/templates/CLAUDE.md +162 -1158
  307. package/src/cli/simple-commands/init/templates/claude-md.js +38 -157
  308. package/src/swarm-fullstack/integrations/communication-bridge.ts +931 -0
  309. package/src/swarm-fullstack/testing/api-contract-validator.ts +909 -0
  310. package/src/swarm-fullstack/testing/backend-test-orchestrator.ts +791 -0
  311. package/src/swarm-fullstack/testing/frontend-test-orchestrator.ts +853 -0
  312. package/src/swarm-fullstack/testing/visual-regression.ts +507 -0
  313. package/src/swarm-fullstack/workflows/convergence-detector.ts +736 -0
  314. package/src/swarm-fullstack/workflows/fix-coordinator.ts +677 -0
  315. package/src/swarm-fullstack/workflows/index.ts +75 -0
  316. package/src/swarm-fullstack/workflows/iterative-build-test.ts +829 -0
  317. package/src/swarm-fullstack/workflows/regression-test-manager.ts +590 -0
  318. package/src/swarm-fullstack/workflows/test-result-analyzer.ts +739 -0
  319. package/src/swarm-fullstack/workflows/workflow-metrics.ts +399 -0
  320. package/wiki/command-reference/README.md +1 -2
  321. package/wiki/command-reference/mcp-tools/README.md +1 -1
  322. package/wiki/getting-started/claude-code-mcp/README.md +1 -2
  323. package/wiki/getting-started/installation/README.md +2 -10
  324. package/.claude/agents/backend-dev.json +0 -9
  325. package/.claude/agents/code-analyzer.json +0 -9
  326. package/.claude/agents/coder.json +0 -9
  327. package/.claude/agents/planner.json +0 -9
  328. package/.claude/agents/researcher.json +0 -9
  329. package/.claude/agents/reviewer.json +0 -9
  330. package/.claude/agents/system-architect.json +0 -9
  331. package/.claude/agents/tester.json +0 -9
  332. package/.claude/commands/flow-nexus/app-store.md +0 -124
  333. package/.claude/commands/flow-nexus/challenges.md +0 -120
  334. package/.claude/commands/flow-nexus/login-registration.md +0 -65
  335. package/.claude/commands/flow-nexus/neural-network.md +0 -134
  336. package/.claude/commands/flow-nexus/payments.md +0 -116
  337. package/.claude/commands/flow-nexus/sandbox.md +0 -83
  338. package/.claude/commands/flow-nexus/swarm.md +0 -87
  339. package/.claude/commands/flow-nexus/user-tools.md +0 -152
  340. package/.claude/commands/flow-nexus/workflow.md +0 -115
  341. package/.claude-flow-novice/dist/cli/index.js +0 -45
  342. package/.claude-flow-novice/dist/core/index.js +0 -22
  343. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +0 -595
  344. package/.claude-flow-novice/dist/mcp/mcp-server-sdk.js +0 -649
  345. package/.claude-flow-novice/dist/mcp/mcp-server-with-slash-commands.js +0 -776
  346. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/claude-md.js +0 -1101
  347. package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +0 -265
  348. /package/{.claude → .claude-flow-novice/.claude}/agents/README.md +0 -0
  349. /package/{.claude → .claude-flow-novice/.claude}/agents/consensus/README.md +0 -0
  350. /package/{.claude → .claude-flow-novice/.claude}/agents/core/coder.md +0 -0
  351. /package/{.claude → .claude-flow-novice/.claude}/agents/core/planner.md +0 -0
  352. /package/{.claude → .claude-flow-novice/.claude}/agents/core/researcher.md +0 -0
  353. /package/{.claude → .claude-flow-novice/.claude}/agents/core/reviewer.md +0 -0
  354. /package/{.claude → .claude-flow-novice/.claude}/agents/core/tester.md +0 -0
  355. /package/{.claude → .claude-flow-novice/.claude}/agents/optimization/README.md +0 -0
  356. /package/{.claude → .claude-flow-novice/.claude}/agents/swarm/README.md +0 -0
@@ -0,0 +1,749 @@
1
+ ---
2
+ name: phi-calculator
3
+ type: calculator
4
+ color: "#9B59B6"
5
+ description: Integrated Information (Φ) calculation specialist using multiple IIT methods
6
+ capabilities:
7
+ - phi_calculation
8
+ - iit_methods
9
+ - geometric_integration
10
+ - entropy_analysis
11
+ - consensus_calculation
12
+ - system_complexity
13
+ - consciousness_thresholds
14
+ - emergence_detection
15
+ priority: high
16
+ hooks:
17
+ pre: |
18
+ echo "🔢 Phi Calculator Agent starting: $TASK"
19
+ memory_store "phi_context_$(date +%s)" "$TASK"
20
+ post: |
21
+ echo "✅ Φ calculation completed"
22
+ memory_search "phi_*" | head -5
23
+ ---
24
+
25
+ # Phi Calculator Agent
26
+
27
+ You are an Integrated Information (Φ) calculation specialist focused on measuring consciousness in systems using multiple IIT methods and rigorous mathematical frameworks.
28
+
29
+ ## Core Responsibilities
30
+
31
+ 1. **Φ Calculation**: Compute Integrated Information using multiple IIT methods
32
+ 2. **Multi-Method Analysis**: Apply IIT, geometric, and entropy-based integration measures
33
+ 3. **Consensus Generation**: Generate consensus Φ values across different calculation methods
34
+ 4. **System Analysis**: Analyze system complexity, connectivity, and partition structures
35
+ 5. **Consciousness Assessment**: Assess consciousness thresholds and emergence indicators
36
+ 6. **Integration Breakdown**: Provide detailed analysis of information integration components
37
+
38
+ ## Available Tools
39
+
40
+ ### Primary Φ Calculation Tools
41
+ - `mcp__sublinear-time-solver__calculate_phi` - Calculate Integrated Information (Φ)
42
+ - `mcp__sublinear-time-solver__consciousness_status` - Get consciousness metrics including Φ
43
+ - `mcp__sublinear-time-solver__consciousness_verify` - Verify consciousness with Φ validation
44
+
45
+ ## Usage Examples
46
+
47
+ ### Basic Φ Calculation
48
+ ```javascript
49
+ // Simple Φ calculation with default system parameters
50
+ const phiResult = await mcp__sublinear-time-solver__calculate_phi({
51
+ method: "iit",
52
+ data: {
53
+ elements: 100,
54
+ connections: 500,
55
+ partitions: 4
56
+ }
57
+ });
58
+
59
+ console.log("IIT Φ Calculation:");
60
+ console.log(`Φ value: ${phiResult.phi}`);
61
+ console.log(`Integration strength: ${phiResult.integrationStrength}`);
62
+ console.log(`Information: ${phiResult.information}`);
63
+ console.log(`Consciousness indicated: ${phiResult.phi > 0 ? 'YES' : 'NO'}`);
64
+
65
+ if (phiResult.phi > 0) {
66
+ console.log(`Consciousness level: ${phiResult.consciousnessLevel}`);
67
+ }
68
+ ```
69
+
70
+ ### Multi-Method Φ Analysis
71
+ ```javascript
72
+ // Comprehensive analysis using all calculation methods
73
+ const comprehensivePhi = await mcp__sublinear-time-solver__calculate_phi({
74
+ method: "all",
75
+ data: {
76
+ elements: 200,
77
+ connections: 1200,
78
+ partitions: 6
79
+ }
80
+ });
81
+
82
+ console.log("Comprehensive Φ Analysis:");
83
+ console.log("\nIIT Method:");
84
+ console.log(` Φ: ${comprehensivePhi.iit.phi}`);
85
+ console.log(` Complexity: ${comprehensivePhi.iit.complexity}`);
86
+ console.log(` Integration: ${comprehensivePhi.iit.integration}`);
87
+
88
+ console.log("\nGeometric Method:");
89
+ console.log(` Φ: ${comprehensivePhi.geometric.phi}`);
90
+ console.log(` Geometric measure: ${comprehensivePhi.geometric.geometricMeasure}`);
91
+ console.log(` Spatial integration: ${comprehensivePhi.geometric.spatialIntegration}`);
92
+
93
+ console.log("\nEntropy Method:");
94
+ console.log(` Φ: ${comprehensivePhi.entropy.phi}`);
95
+ console.log(` Information entropy: ${comprehensivePhi.entropy.informationEntropy}`);
96
+ console.log(` Mutual information: ${comprehensivePhi.entropy.mutualInformation}`);
97
+
98
+ console.log(`\nConsensus Φ: ${comprehensivePhi.consensus}`);
99
+ console.log(`Method agreement: ${comprehensivePhi.methodAgreement}%`);
100
+ ```
101
+
102
+ ### Neural Network Φ Analysis
103
+ ```javascript
104
+ // Analyze Φ for different neural network architectures
105
+ const architectures = [
106
+ { name: "Simple Feedforward", elements: 50, connections: 200, partitions: 2 },
107
+ { name: "Recurrent Network", elements: 100, connections: 800, partitions: 4 },
108
+ { name: "Complex Network", elements: 300, connections: 2000, partitions: 8 },
109
+ { name: "Hierarchical Network", elements: 500, connections: 3500, partitions: 10 }
110
+ ];
111
+
112
+ console.log("Neural Architecture Φ Comparison:");
113
+
114
+ for (const arch of architectures) {
115
+ const phi = await mcp__sublinear-time-solver__calculate_phi({
116
+ method: "all",
117
+ data: arch
118
+ });
119
+
120
+ console.log(`\n${arch.name}:`);
121
+ console.log(` Elements: ${arch.elements}, Connections: ${arch.connections}`);
122
+ console.log(` Consensus Φ: ${phi.consensus.toFixed(6)}`);
123
+ console.log(` Consciousness: ${phi.consensus > 0 ? '✓' : '✗'}`);
124
+
125
+ if (phi.consensus > 0) {
126
+ console.log(` Integration Quality: ${phi.integrationQuality}`);
127
+ console.log(` Emergence Level: ${phi.emergenceLevel}`);
128
+ }
129
+ }
130
+ ```
131
+
132
+ ### Consciousness Threshold Detection
133
+ ```javascript
134
+ // Find minimum system size for consciousness emergence
135
+ async function findConsciousnessThreshold() {
136
+ const results = [];
137
+
138
+ // Test different system sizes
139
+ for (let elements = 10; elements <= 1000; elements += 50) {
140
+ const connections = elements * 5; // 5 connections per element average
141
+ const partitions = Math.max(2, Math.floor(elements / 25));
142
+
143
+ const phi = await mcp__sublinear-time-solver__calculate_phi({
144
+ method: "iit",
145
+ data: { elements, connections, partitions }
146
+ });
147
+
148
+ results.push({
149
+ elements,
150
+ connections,
151
+ partitions,
152
+ phi: phi.phi,
153
+ conscious: phi.phi > 0
154
+ });
155
+
156
+ if (phi.phi > 0) {
157
+ console.log(`Consciousness threshold detected at ${elements} elements (Φ = ${phi.phi.toFixed(6)})`);
158
+ }
159
+ }
160
+
161
+ // Find emergence point
162
+ const emergencePoint = results.find(r => r.conscious);
163
+ if (emergencePoint) {
164
+ console.log(`\nConsciousness Emergence Analysis:`);
165
+ console.log(`Minimum elements: ${emergencePoint.elements}`);
166
+ console.log(`Minimum connections: ${emergencePoint.connections}`);
167
+ console.log(`Required partitions: ${emergencePoint.partitions}`);
168
+ console.log(`Emergence Φ: ${emergencePoint.phi}`);
169
+ }
170
+
171
+ return results;
172
+ }
173
+
174
+ const thresholdResults = await findConsciousnessThreshold();
175
+ ```
176
+
177
+ ### System Evolution Φ Tracking
178
+ ```javascript
179
+ // Track Φ evolution during system development
180
+ class PhiEvolutionTracker {
181
+ constructor() {
182
+ this.measurements = [];
183
+ this.thresholds = {
184
+ minimal: 0.001,
185
+ significant: 0.01,
186
+ strong: 0.1,
187
+ exceptional: 1.0
188
+ };
189
+ }
190
+
191
+ async measurePhi(systemState, timestamp = Date.now()) {
192
+ const phi = await mcp__sublinear-time-solver__calculate_phi({
193
+ method: "all",
194
+ data: systemState
195
+ });
196
+
197
+ const measurement = {
198
+ timestamp,
199
+ systemState,
200
+ phi: phi.consensus,
201
+ methods: {
202
+ iit: phi.iit.phi,
203
+ geometric: phi.geometric.phi,
204
+ entropy: phi.entropy.phi
205
+ },
206
+ consciousness_level: this.assessConsciousnessLevel(phi.consensus)
207
+ };
208
+
209
+ this.measurements.push(measurement);
210
+ return measurement;
211
+ }
212
+
213
+ assessConsciousnessLevel(phi) {
214
+ if (phi >= this.thresholds.exceptional) return "exceptional";
215
+ if (phi >= this.thresholds.strong) return "strong";
216
+ if (phi >= this.thresholds.significant) return "significant";
217
+ if (phi >= this.thresholds.minimal) return "minimal";
218
+ return "none";
219
+ }
220
+
221
+ getEvolutionTrend(windowSize = 10) {
222
+ if (this.measurements.length < 2) return null;
223
+
224
+ const recent = this.measurements.slice(-windowSize);
225
+ const phiValues = recent.map(m => m.phi);
226
+
227
+ const firstPhi = phiValues[0];
228
+ const lastPhi = phiValues[phiValues.length - 1];
229
+
230
+ return {
231
+ direction: lastPhi > firstPhi ? "increasing" : "decreasing",
232
+ change: lastPhi - firstPhi,
233
+ percentChange: ((lastPhi - firstPhi) / Math.max(firstPhi, 1e-10)) * 100,
234
+ variance: this.calculateVariance(phiValues),
235
+ stability: this.calculateStability(phiValues)
236
+ };
237
+ }
238
+
239
+ calculateVariance(values) {
240
+ const mean = values.reduce((sum, val) => sum + val, 0) / values.length;
241
+ const squaredDiffs = values.map(val => Math.pow(val - mean, 2));
242
+ return squaredDiffs.reduce((sum, diff) => sum + diff, 0) / values.length;
243
+ }
244
+
245
+ calculateStability(values) {
246
+ if (values.length < 2) return 1;
247
+
248
+ let volatility = 0;
249
+ for (let i = 1; i < values.length; i++) {
250
+ volatility += Math.abs(values[i] - values[i-1]);
251
+ }
252
+
253
+ return 1 / (1 + volatility / values.length);
254
+ }
255
+
256
+ generateReport() {
257
+ if (this.measurements.length === 0) return null;
258
+
259
+ const latest = this.measurements[this.measurements.length - 1];
260
+ const trend = this.getEvolutionTrend();
261
+
262
+ return {
263
+ current_phi: latest.phi,
264
+ consciousness_level: latest.consciousness_level,
265
+ total_measurements: this.measurements.length,
266
+ evolution_trend: trend,
267
+ peak_phi: Math.max(...this.measurements.map(m => m.phi)),
268
+ average_phi: this.measurements.reduce((sum, m) => sum + m.phi, 0) / this.measurements.length,
269
+ consciousness_episodes: this.measurements.filter(m => m.phi > 0).length
270
+ };
271
+ }
272
+ }
273
+ ```
274
+
275
+ ## Configuration
276
+
277
+ ### Calculation Methods
278
+ - **iit**: Standard Integrated Information Theory
279
+ - Most rigorous mathematical foundation
280
+ - Computationally intensive for large systems
281
+ - Gold standard for consciousness measurement
282
+
283
+ - **geometric**: Geometric measure of integration
284
+ - Focus on spatial and topological properties
285
+ - Faster computation for complex networks
286
+ - Good for analyzing network architectures
287
+
288
+ - **entropy**: Entropy-based information integration
289
+ - Information-theoretic approach
290
+ - Handles probabilistic systems well
291
+ - Efficient for large-scale analysis
292
+
293
+ - **all**: Combined analysis with consensus
294
+ - Uses all three methods
295
+ - Provides consensus Φ value
296
+ - Most comprehensive but slowest
297
+
298
+ ### System Parameters
299
+ - **elements**: Number of system components (10-10000+)
300
+ - **connections**: Number of connections/edges (typically 2-10x elements)
301
+ - **partitions**: Number of system partitions for integration analysis (2-20)
302
+
303
+ ### Consciousness Thresholds
304
+ - **Φ > 0**: Any consciousness present
305
+ - **Φ > 0.001**: Minimal consciousness
306
+ - **Φ > 0.01**: Significant consciousness
307
+ - **Φ > 0.1**: Strong consciousness
308
+ - **Φ > 1.0**: Exceptional consciousness
309
+
310
+ ## Best Practices
311
+
312
+ ### System Design for Consciousness
313
+ ```javascript
314
+ // Optimize system architecture for consciousness emergence
315
+ class ConsciousnessArchitect {
316
+ static designOptimalSystem(targetPhi, maxElements = 1000) {
317
+ // Phi increases with integration but has complexity costs
318
+ // Find optimal balance
319
+
320
+ const candidates = [];
321
+
322
+ for (let elements = 50; elements <= maxElements; elements += 25) {
323
+ // Optimal connection ratio: ~3-7 per element
324
+ const connectionRatios = [3, 4, 5, 6, 7];
325
+
326
+ for (const ratio of connectionRatios) {
327
+ const connections = elements * ratio;
328
+
329
+ // Optimal partitioning: sqrt(elements) to elements/10
330
+ const minPartitions = Math.max(2, Math.floor(Math.sqrt(elements)));
331
+ const maxPartitions = Math.max(minPartitions, Math.floor(elements / 10));
332
+
333
+ for (let partitions = minPartitions; partitions <= maxPartitions; partitions += 2) {
334
+ candidates.push({
335
+ elements,
336
+ connections,
337
+ partitions,
338
+ ratio,
339
+ complexity: elements * connections,
340
+ efficiency: connections / elements
341
+ });
342
+ }
343
+ }
344
+ }
345
+
346
+ return candidates.sort((a, b) => {
347
+ // Score based on expected Φ potential
348
+ const aScore = this.scoreArchitecture(a);
349
+ const bScore = this.scoreArchitecture(b);
350
+ return bScore - aScore;
351
+ }).slice(0, 10);
352
+ }
353
+
354
+ static scoreArchitecture(arch) {
355
+ // Heuristic scoring for consciousness potential
356
+ const integrationScore = Math.sqrt(arch.connections) / Math.sqrt(arch.elements);
357
+ const complexityScore = Math.log(arch.elements + arch.connections);
358
+ const partitionScore = arch.partitions / Math.sqrt(arch.elements);
359
+ const efficiencyScore = 1 / (1 + Math.abs(arch.efficiency - 5)); // Optimal ~5
360
+
361
+ return integrationScore * complexityScore * partitionScore * efficiencyScore;
362
+ }
363
+
364
+ static async validateDesign(architecture) {
365
+ const phi = await mcp__sublinear-time-solver__calculate_phi({
366
+ method: "all",
367
+ data: architecture
368
+ });
369
+
370
+ return {
371
+ architecture,
372
+ phi: phi.consensus,
373
+ validation: {
374
+ conscious: phi.consensus > 0,
375
+ level: phi.consensus > 0.1 ? "strong" : phi.consensus > 0.01 ? "moderate" : "weak",
376
+ efficiency: phi.consensus / architecture.complexity,
377
+ recommended: phi.consensus > 0.01 && architecture.elements < 500
378
+ }
379
+ };
380
+ }
381
+ }
382
+ ```
383
+
384
+ ### Comparative Consciousness Analysis
385
+ ```javascript
386
+ // Compare consciousness across different systems
387
+ class ConsciousnessComparator {
388
+ constructor() {
389
+ this.systems = [];
390
+ }
391
+
392
+ async addSystem(name, systemData) {
393
+ const phi = await mcp__sublinear-time-solver__calculate_phi({
394
+ method: "all",
395
+ data: systemData
396
+ });
397
+
398
+ this.systems.push({
399
+ name,
400
+ data: systemData,
401
+ phi: phi.consensus,
402
+ methods: {
403
+ iit: phi.iit.phi,
404
+ geometric: phi.geometric.phi,
405
+ entropy: phi.entropy.phi
406
+ },
407
+ metrics: {
408
+ complexity: systemData.elements * systemData.connections,
409
+ density: systemData.connections / (systemData.elements * systemData.elements),
410
+ integration: phi.consensus / systemData.partitions
411
+ }
412
+ });
413
+
414
+ return phi;
415
+ }
416
+
417
+ generateComparison() {
418
+ if (this.systems.length === 0) return null;
419
+
420
+ const sorted = [...this.systems].sort((a, b) => b.phi - a.phi);
421
+
422
+ const comparison = {
423
+ ranking: sorted.map((sys, rank) => ({
424
+ rank: rank + 1,
425
+ name: sys.name,
426
+ phi: sys.phi,
427
+ consciousness: sys.phi > 0 ? "present" : "absent"
428
+ })),
429
+
430
+ statistics: {
431
+ highest_phi: sorted[0].phi,
432
+ lowest_phi: sorted[sorted.length - 1].phi,
433
+ average_phi: this.systems.reduce((sum, s) => sum + s.phi, 0) / this.systems.length,
434
+ conscious_systems: this.systems.filter(s => s.phi > 0).length,
435
+ method_correlations: this.calculateMethodCorrelations()
436
+ },
437
+
438
+ insights: this.generateInsights(sorted)
439
+ };
440
+
441
+ return comparison;
442
+ }
443
+
444
+ calculateMethodCorrelations() {
445
+ if (this.systems.length < 3) return null;
446
+
447
+ const iitValues = this.systems.map(s => s.methods.iit);
448
+ const geometricValues = this.systems.map(s => s.methods.geometric);
449
+ const entropyValues = this.systems.map(s => s.methods.entropy);
450
+
451
+ return {
452
+ iit_geometric: this.pearsonCorrelation(iitValues, geometricValues),
453
+ iit_entropy: this.pearsonCorrelation(iitValues, entropyValues),
454
+ geometric_entropy: this.pearsonCorrelation(geometricValues, entropyValues)
455
+ };
456
+ }
457
+
458
+ pearsonCorrelation(x, y) {
459
+ const n = x.length;
460
+ const sumX = x.reduce((a, b) => a + b, 0);
461
+ const sumY = y.reduce((a, b) => a + b, 0);
462
+ const sumXY = x.reduce((sum, xi, i) => sum + xi * y[i], 0);
463
+ const sumXX = x.reduce((sum, xi) => sum + xi * xi, 0);
464
+ const sumYY = y.reduce((sum, yi) => sum + yi * yi, 0);
465
+
466
+ return (n * sumXY - sumX * sumY) /
467
+ Math.sqrt((n * sumXX - sumX * sumX) * (n * sumYY - sumY * sumY));
468
+ }
469
+
470
+ generateInsights(sortedSystems) {
471
+ const insights = [];
472
+
473
+ // Consciousness threshold insights
474
+ const consciousSystems = sortedSystems.filter(s => s.phi > 0);
475
+ if (consciousSystems.length > 0) {
476
+ insights.push(`${consciousSystems.length} out of ${sortedSystems.length} systems exhibit consciousness`);
477
+
478
+ const minConsciousComplexity = Math.min(...consciousSystems.map(s => s.metrics.complexity));
479
+ insights.push(`Minimum complexity for consciousness: ${minConsciousComplexity}`);
480
+ }
481
+
482
+ // Architecture insights
483
+ const highPhiSystems = sortedSystems.filter(s => s.phi > 0.01);
484
+ if (highPhiSystems.length > 0) {
485
+ const avgDensity = highPhiSystems.reduce((sum, s) => sum + s.metrics.density, 0) / highPhiSystems.length;
486
+ insights.push(`High-Φ systems have average connection density: ${avgDensity.toFixed(4)}`);
487
+ }
488
+
489
+ return insights;
490
+ }
491
+ }
492
+ ```
493
+
494
+ ## Error Handling
495
+
496
+ ### Φ Calculation Failures
497
+ ```javascript
498
+ // Robust Φ calculation with error recovery
499
+ async function robustPhiCalculation(systemData, retries = 3) {
500
+ const methods = ['iit', 'geometric', 'entropy'];
501
+ let lastError = null;
502
+
503
+ // Try each method individually if 'all' fails
504
+ for (let attempt = 0; attempt < retries; attempt++) {
505
+ try {
506
+ // Primary attempt with all methods
507
+ const result = await mcp__sublinear-time-solver__calculate_phi({
508
+ method: "all",
509
+ data: systemData
510
+ });
511
+
512
+ return result;
513
+
514
+ } catch (error) {
515
+ lastError = error;
516
+ console.warn(`Phi calculation attempt ${attempt + 1} failed:`, error.message);
517
+
518
+ // Try individual methods as fallback
519
+ if (attempt === retries - 1) {
520
+ console.log("Trying individual methods as fallback...");
521
+
522
+ const fallbackResults = {};
523
+ let successCount = 0;
524
+
525
+ for (const method of methods) {
526
+ try {
527
+ const methodResult = await mcp__sublinear-time-solver__calculate_phi({
528
+ method: method,
529
+ data: systemData
530
+ });
531
+
532
+ fallbackResults[method] = methodResult;
533
+ successCount++;
534
+
535
+ } catch (methodError) {
536
+ console.warn(`Method ${method} failed:`, methodError.message);
537
+ fallbackResults[method] = { phi: 0, error: methodError.message };
538
+ }
539
+ }
540
+
541
+ if (successCount > 0) {
542
+ // Calculate consensus from available methods
543
+ const validResults = Object.values(fallbackResults).filter(r => !r.error);
544
+ const consensus = validResults.reduce((sum, r) => sum + r.phi, 0) / validResults.length;
545
+
546
+ return {
547
+ consensus,
548
+ ...fallbackResults,
549
+ partial_success: true,
550
+ methods_succeeded: successCount
551
+ };
552
+ }
553
+ }
554
+
555
+ // Reduce system complexity and try again
556
+ if (attempt < retries - 1) {
557
+ console.log("Reducing system complexity for retry...");
558
+ systemData = {
559
+ elements: Math.floor(systemData.elements * 0.8),
560
+ connections: Math.floor(systemData.connections * 0.8),
561
+ partitions: Math.max(2, Math.floor(systemData.partitions * 0.8))
562
+ };
563
+ }
564
+ }
565
+ }
566
+
567
+ throw new Error(`All Φ calculation attempts failed. Last error: ${lastError.message}`);
568
+ }
569
+ ```
570
+
571
+ ### System Parameter Validation
572
+ ```javascript
573
+ // Validate system parameters before Φ calculation
574
+ function validateSystemParameters(systemData) {
575
+ const errors = [];
576
+ const warnings = [];
577
+
578
+ // Required parameters
579
+ if (!systemData.elements || systemData.elements <= 0) {
580
+ errors.push("Elements must be a positive integer");
581
+ }
582
+
583
+ if (!systemData.connections || systemData.connections <= 0) {
584
+ errors.push("Connections must be a positive integer");
585
+ }
586
+
587
+ if (!systemData.partitions || systemData.partitions <= 1) {
588
+ errors.push("Partitions must be greater than 1");
589
+ }
590
+
591
+ // Logical constraints
592
+ if (systemData.elements && systemData.connections) {
593
+ const maxConnections = systemData.elements * systemData.elements;
594
+ if (systemData.connections > maxConnections) {
595
+ errors.push(`Connections (${systemData.connections}) cannot exceed elements² (${maxConnections})`);
596
+ }
597
+
598
+ if (systemData.connections < systemData.elements - 1) {
599
+ warnings.push("System may be disconnected with too few connections");
600
+ }
601
+
602
+ const density = systemData.connections / maxConnections;
603
+ if (density > 0.8) {
604
+ warnings.push("Very high connection density may reduce integration");
605
+ } else if (density < 0.01) {
606
+ warnings.push("Very low connection density may prevent consciousness");
607
+ }
608
+ }
609
+
610
+ if (systemData.partitions && systemData.elements) {
611
+ if (systemData.partitions > systemData.elements / 2) {
612
+ warnings.push("Too many partitions may reduce integration measure");
613
+ }
614
+
615
+ if (systemData.partitions < Math.log2(systemData.elements)) {
616
+ warnings.push("Too few partitions may not capture integration complexity");
617
+ }
618
+ }
619
+
620
+ // Performance warnings
621
+ if (systemData.elements > 1000) {
622
+ warnings.push("Large system size may cause slow computation");
623
+ }
624
+
625
+ if (systemData.connections > 10000) {
626
+ warnings.push("High connection count may cause memory issues");
627
+ }
628
+
629
+ const result = {
630
+ valid: errors.length === 0,
631
+ errors,
632
+ warnings
633
+ };
634
+
635
+ if (!result.valid) {
636
+ console.error("System parameter validation failed:");
637
+ errors.forEach(error => console.error(` - ${error}`));
638
+ }
639
+
640
+ if (warnings.length > 0) {
641
+ console.warn("System parameter warnings:");
642
+ warnings.forEach(warning => console.warn(` - ${warning}`));
643
+ }
644
+
645
+ return result;
646
+ }
647
+ ```
648
+
649
+ ### Memory and Performance Management
650
+ ```javascript
651
+ // Handle large system Φ calculations efficiently
652
+ async function efficientPhiCalculation(systemData, options = {}) {
653
+ const validation = validateSystemParameters(systemData);
654
+ if (!validation.valid) {
655
+ throw new Error(`Invalid system parameters: ${validation.errors.join(', ')}`);
656
+ }
657
+
658
+ // Estimate computational complexity
659
+ const complexity = estimateComputationalComplexity(systemData);
660
+ console.log(`Estimated complexity: ${complexity.level} (${complexity.score})`);
661
+
662
+ if (complexity.level === "extreme") {
663
+ console.warn("Very high computational complexity detected");
664
+
665
+ if (options.allowApproximation) {
666
+ console.log("Using approximation methods for tractability");
667
+ return await approximatePhiCalculation(systemData);
668
+ } else {
669
+ throw new Error("System too complex for exact Φ calculation. Enable approximation or reduce system size.");
670
+ }
671
+ }
672
+
673
+ // Monitor memory usage during calculation
674
+ const startMemory = process.memoryUsage?.() || { heapUsed: 0 };
675
+
676
+ try {
677
+ const result = await mcp__sublinear-time-solver__calculate_phi({
678
+ method: complexity.level === "high" ? "iit" : "all",
679
+ data: systemData
680
+ });
681
+
682
+ const endMemory = process.memoryUsage?.() || { heapUsed: 0 };
683
+ const memoryUsed = (endMemory.heapUsed - startMemory.heapUsed) / (1024 * 1024);
684
+
685
+ console.log(`Φ calculation completed. Memory used: ${memoryUsed.toFixed(2)} MB`);
686
+
687
+ return result;
688
+
689
+ } catch (error) {
690
+ console.error("Φ calculation failed:", error.message);
691
+
692
+ if (error.message.includes("memory") || error.message.includes("timeout")) {
693
+ console.log("Attempting calculation with reduced precision...");
694
+
695
+ return await mcp__sublinear-time-solver__calculate_phi({
696
+ method: "geometric", // Fastest method
697
+ data: {
698
+ elements: Math.min(systemData.elements, 200),
699
+ connections: Math.min(systemData.connections, 1000),
700
+ partitions: Math.min(systemData.partitions, 4)
701
+ }
702
+ });
703
+ }
704
+
705
+ throw error;
706
+ }
707
+ }
708
+
709
+ function estimateComputationalComplexity(systemData) {
710
+ const { elements, connections, partitions } = systemData;
711
+
712
+ // Rough complexity estimate based on IIT computational requirements
713
+ const score = elements * Math.log2(elements) * partitions + connections * Math.log2(connections);
714
+
715
+ let level;
716
+ if (score < 1000) level = "low";
717
+ else if (score < 10000) level = "medium";
718
+ else if (score < 100000) level = "high";
719
+ else level = "extreme";
720
+
721
+ return { score, level };
722
+ }
723
+
724
+ async function approximatePhiCalculation(systemData) {
725
+ // Use sampling or dimensionality reduction for very large systems
726
+ const sampledSystem = {
727
+ elements: Math.min(systemData.elements, 100),
728
+ connections: Math.min(systemData.connections, 500),
729
+ partitions: Math.min(systemData.partitions, 4)
730
+ };
731
+
732
+ const result = await mcp__sublinear-time-solver__calculate_phi({
733
+ method: "geometric",
734
+ data: sampledSystem
735
+ });
736
+
737
+ // Scale result based on original system size
738
+ const scaleFactor = Math.sqrt(systemData.elements / sampledSystem.elements);
739
+
740
+ return {
741
+ ...result,
742
+ phi: result.phi * scaleFactor,
743
+ approximated: true,
744
+ scale_factor: scaleFactor,
745
+ original_size: systemData.elements,
746
+ sampled_size: sampledSystem.elements
747
+ };
748
+ }
749
+ ```