claude-flow-novice 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/.claude-flow-novice/preferences/generation.json +147 -0
  2. package/.claude-flow-novice/preferences/language-configs/javascript.json +51 -0
  3. package/.claude-flow-novice/preferences/language-configs/python.json +50 -0
  4. package/.claude-flow-novice/preferences/language-configs/rust.json +237 -0
  5. package/.claude-flow-novice/preferences/language-configs/typescript.json +54 -0
  6. package/.claude-flow-novice/preferences/project-local.json +91 -0
  7. package/.claude-flow-novice/preferences/resource-delegation.json +120 -0
  8. package/.claude-flow-novice/preferences/team-shared.json +195 -0
  9. package/.claude-flow-novice/preferences/user-global.json +247 -0
  10. package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-JAVASCRIPT.md +769 -0
  11. package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-PYTHON.md +1214 -0
  12. package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-RUST.md +475 -0
  13. package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-TYPESCRIPT.md +851 -0
  14. package/.claude-flow-novice/templates/claude-md-templates/README.md +263 -0
  15. package/CLAUDE.md +81 -0
  16. package/README-NPM.md +0 -0
  17. package/package.json +11 -7
  18. package/scripts/build/README.md +167 -0
  19. package/scripts/build/build-config.js +27 -0
  20. package/scripts/build/build-prompt-copier.sh +30 -0
  21. package/scripts/build/performance-monitor.js +869 -0
  22. package/scripts/build/prepare-publish.js +150 -0
  23. package/scripts/build/typescript-fixer.js +621 -0
  24. package/scripts/build/unified-builder.sh +428 -0
  25. package/scripts/build/update-bin-version.js +32 -0
  26. package/scripts/dev/README.md +264 -0
  27. package/scripts/dev/claude-flow-wrapper.sh +35 -0
  28. package/scripts/dev/claude-monitor.py +419 -0
  29. package/scripts/dev/claude-sparc.sh +562 -0
  30. package/scripts/dev/claude-wrapper.sh +17 -0
  31. package/scripts/dev/demo-phase3-compliance.js +172 -0
  32. package/scripts/dev/demo-task-system.ts +224 -0
  33. package/scripts/dev/deployment-validator.js +315 -0
  34. package/scripts/dev/spawn-claude-terminal.sh +32 -0
  35. package/scripts/dev/start-portal.sh +506 -0
  36. package/scripts/dev/start-web-ui.js +15 -0
  37. package/scripts/dev/stop-portal.sh +311 -0
  38. package/scripts/dev/validate-examples.ts +288 -0
  39. package/scripts/dev/validate-phase2.cjs +451 -0
  40. package/scripts/dev/validate-phase2.js +785 -0
  41. package/scripts/dev/validate-phase3.cjs +208 -0
  42. package/scripts/dev/validate-security-remediation.js +1 -0
  43. package/scripts/legacy/README.md +272 -0
  44. package/scripts/legacy/batch-fix-ts.sh +54 -0
  45. package/scripts/legacy/build-migration.sh +105 -0
  46. package/scripts/legacy/build-monitor.js +209 -0
  47. package/scripts/legacy/build-with-filter.sh +84 -0
  48. package/scripts/legacy/build-workaround.sh +71 -0
  49. package/scripts/legacy/fix-ts-advanced.js +358 -0
  50. package/scripts/legacy/fix-ts-final.sh +50 -0
  51. package/scripts/legacy/fix-ts-targeted.sh +49 -0
  52. package/scripts/legacy/fix-typescript-errors.js +305 -0
  53. package/scripts/legacy/force-build.sh +63 -0
  54. package/scripts/legacy/optimize-performance.js +400 -0
  55. package/scripts/legacy/performance-monitor.js +263 -0
  56. package/scripts/legacy/performance-monitoring.js +532 -0
  57. package/scripts/legacy/performance-test-runner.js +645 -0
  58. package/scripts/legacy/quick-fix-ts.js +281 -0
  59. package/scripts/legacy/safe-build.sh +63 -0
  60. package/scripts/migration/README.md +434 -0
  61. package/scripts/migration/install-arm64.js +78 -0
  62. package/scripts/migration/install.js +83 -0
  63. package/scripts/migration/migrate-hooks.js +173 -0
  64. package/scripts/migration/migration-examples.ts +318 -0
  65. package/scripts/optimization/build-optimizer.js +438 -0
  66. package/scripts/optimization/config-validator.js +761 -0
  67. package/scripts/optimization/test-optimization.js +432 -0
  68. package/scripts/optimization/unified-activation.js +839 -0
  69. package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
  70. package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
  71. package/scripts/performance/test-enhanced-backend.sh +504 -0
  72. package/scripts/performance-test-runner.js +698 -0
  73. package/scripts/security/README.md +339 -0
  74. package/scripts/security/install-git-hooks.sh +132 -0
  75. package/scripts/security/ruv-swarm-safe.js +74 -0
  76. package/scripts/test/README.md +236 -0
  77. package/scripts/test/check-links.ts +274 -0
  78. package/scripts/test/check-performance-regression.ts +168 -0
  79. package/scripts/test/coverage-report.ts +692 -0
  80. package/scripts/test/generate-swarm-tests.js +633 -0
  81. package/scripts/test/integration-test-validation.cjs +253 -0
  82. package/scripts/test/load-test-swarm.js +576 -0
  83. package/scripts/test/run-phase3-compliance-tests.js +427 -0
  84. package/scripts/test/test-batch-tasks.ts +29 -0
  85. package/scripts/test/test-byzantine-resolution.js +246 -0
  86. package/scripts/test/test-claude-spawn-options.sh +63 -0
  87. package/scripts/test/test-cli-wizard.js +331 -0
  88. package/scripts/test/test-comprehensive.js +401 -0
  89. package/scripts/test/test-coordination-features.ts +238 -0
  90. package/scripts/test/test-fallback-systems.js +276 -0
  91. package/scripts/test/test-init-command.ts +302 -0
  92. package/scripts/test/test-mcp.ts +251 -0
  93. package/scripts/test/test-runner.ts +568 -0
  94. package/scripts/test/test-swarm-integration.sh +92 -0
  95. package/scripts/test/test-swarm.ts +142 -0
  96. package/scripts/test/validation-summary.ts +408 -0
  97. package/scripts/utils/README.md +261 -0
  98. package/scripts/utils/clean-build-artifacts.sh +94 -0
  99. package/scripts/utils/cleanup-root.sh +69 -0
  100. package/scripts/utils/fix-cliffy-imports.js +307 -0
  101. package/scripts/utils/fix-duplicate-imports.js +114 -0
  102. package/scripts/utils/fix-error-handling.cjs +70 -0
  103. package/scripts/utils/fix-import-paths.js +104 -0
  104. package/scripts/utils/fix-imports.js +116 -0
  105. package/scripts/utils/fix-shebang.js +78 -0
  106. package/scripts/utils/fix-test-modules.js +27 -0
  107. package/scripts/utils/fix-timezone-issue-246.js +200 -0
  108. package/scripts/utils/fix-ts-comprehensive.py +182 -0
  109. package/scripts/utils/fix-ts-targeted-batch.js +250 -0
  110. package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
  111. package/scripts/utils/simple-test-fixer.js +190 -0
  112. package/scripts/utils/validate-metrics-structure.cjs +144 -0
  113. package/scripts/verify-mcp-server.js +86 -0
  114. package/src/cli/simple-commands/__tests__/agent.test.js +291 -0
  115. package/src/cli/simple-commands/__tests__/memory.test.js +8 -0
  116. package/src/cli/simple-commands/__tests__/swarm.test.js +371 -0
  117. package/src/cli/simple-commands/__tests__/task.test.js +8 -0
  118. package/src/cli/simple-commands/agent.js +216 -0
  119. package/src/cli/simple-commands/analysis.js +570 -0
  120. package/src/cli/simple-commands/automation-executor.js +1603 -0
  121. package/src/cli/simple-commands/automation.js +627 -0
  122. package/src/cli/simple-commands/batch-manager.js +338 -0
  123. package/src/cli/simple-commands/claude-telemetry.js +311 -0
  124. package/src/cli/simple-commands/claude-track.js +102 -0
  125. package/src/cli/simple-commands/concurrent-display.js +348 -0
  126. package/src/cli/simple-commands/config.js +319 -0
  127. package/src/cli/simple-commands/coordination.js +307 -0
  128. package/src/cli/simple-commands/enhanced-ui-views.js +654 -0
  129. package/src/cli/simple-commands/enhanced-webui-complete.js +1038 -0
  130. package/src/cli/simple-commands/fix-hook-variables.js +363 -0
  131. package/src/cli/simple-commands/github/gh-coordinator.js +605 -0
  132. package/src/cli/simple-commands/github/github-api.js +624 -0
  133. package/src/cli/simple-commands/github/init.js +543 -0
  134. package/src/cli/simple-commands/github.js +377 -0
  135. package/src/cli/simple-commands/goal.js +145 -0
  136. package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +311 -0
  137. package/src/cli/simple-commands/hive-mind/communication.js +740 -0
  138. package/src/cli/simple-commands/hive-mind/core.js +1031 -0
  139. package/src/cli/simple-commands/hive-mind/db-optimizer.js +872 -0
  140. package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1364 -0
  141. package/src/cli/simple-commands/hive-mind/memory.js +1292 -0
  142. package/src/cli/simple-commands/hive-mind/performance-optimizer.js +618 -0
  143. package/src/cli/simple-commands/hive-mind/performance-test.js +373 -0
  144. package/src/cli/simple-commands/hive-mind/queen.js +809 -0
  145. package/src/cli/simple-commands/hive-mind/session-manager.js +1223 -0
  146. package/src/cli/simple-commands/hive-mind-optimize.js +361 -0
  147. package/src/cli/simple-commands/hive-mind-wizard.js +281 -0
  148. package/src/cli/simple-commands/hive-mind.js +3112 -0
  149. package/src/cli/simple-commands/hive.js +140 -0
  150. package/src/cli/simple-commands/hook-safety.js +671 -0
  151. package/src/cli/simple-commands/hooks.js +1268 -0
  152. package/src/cli/simple-commands/init/.claude/checkpoints/1756224542.json +7 -0
  153. package/src/cli/simple-commands/init/.claude/checkpoints/1756224544.json +8 -0
  154. package/src/cli/simple-commands/init/README.md +106 -0
  155. package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +488 -0
  156. package/src/cli/simple-commands/init/agent-copier.js +347 -0
  157. package/src/cli/simple-commands/init/batch-init.js +663 -0
  158. package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +438 -0
  159. package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +876 -0
  160. package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +356 -0
  161. package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +501 -0
  162. package/src/cli/simple-commands/init/claude-commands/slash-commands.js +57 -0
  163. package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +296 -0
  164. package/src/cli/simple-commands/init/copy-revised-templates.js +175 -0
  165. package/src/cli/simple-commands/init/executable-wrapper.js +122 -0
  166. package/src/cli/simple-commands/init/gitignore-updater.js +137 -0
  167. package/src/cli/simple-commands/init/help.js +110 -0
  168. package/src/cli/simple-commands/init/hive-mind-init.js +749 -0
  169. package/src/cli/simple-commands/init/index.js +1953 -0
  170. package/src/cli/simple-commands/init/performance-monitor.js +344 -0
  171. package/src/cli/simple-commands/init/rollback/backup-manager.js +542 -0
  172. package/src/cli/simple-commands/init/rollback/index.js +399 -0
  173. package/src/cli/simple-commands/init/rollback/recovery-manager.js +778 -0
  174. package/src/cli/simple-commands/init/rollback/rollback-executor.js +521 -0
  175. package/src/cli/simple-commands/init/rollback/state-tracker.js +486 -0
  176. package/src/cli/simple-commands/init/sparc/roo-readme.js +61 -0
  177. package/src/cli/simple-commands/init/sparc/roomodes-config.js +102 -0
  178. package/src/cli/simple-commands/init/sparc/workflows.js +40 -0
  179. package/src/cli/simple-commands/init/sparc-structure.js +68 -0
  180. package/src/cli/simple-commands/init/template-copier.js +640 -0
  181. package/src/cli/simple-commands/init/templates/CLAUDE.md +1185 -0
  182. package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +265 -0
  183. package/src/cli/simple-commands/init/templates/claude-flow-universal +81 -0
  184. package/src/cli/simple-commands/init/templates/claude-flow.bat +18 -0
  185. package/src/cli/simple-commands/init/templates/claude-flow.ps1 +24 -0
  186. package/src/cli/simple-commands/init/templates/claude-md.js +1101 -0
  187. package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +162 -0
  188. package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +122 -0
  189. package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +85 -0
  190. package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +121 -0
  191. package/src/cli/simple-commands/init/templates/commands/helpers/standard-checkpoint-hooks.sh +179 -0
  192. package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +113 -0
  193. package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +116 -0
  194. package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +117 -0
  195. package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +112 -0
  196. package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +113 -0
  197. package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +113 -0
  198. package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +112 -0
  199. package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +111 -0
  200. package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +118 -0
  201. package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +118 -0
  202. package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +117 -0
  203. package/src/cli/simple-commands/init/templates/coordination-md.js +340 -0
  204. package/src/cli/simple-commands/init/templates/coordination.md +16 -0
  205. package/src/cli/simple-commands/init/templates/enhanced-templates.js +2347 -0
  206. package/src/cli/simple-commands/init/templates/github-safe-enhanced.js +331 -0
  207. package/src/cli/simple-commands/init/templates/github-safe.js +106 -0
  208. package/src/cli/simple-commands/init/templates/memory-bank-md.js +259 -0
  209. package/src/cli/simple-commands/init/templates/memory-bank.md +16 -0
  210. package/src/cli/simple-commands/init/templates/readme-files.js +72 -0
  211. package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +430 -0
  212. package/src/cli/simple-commands/init/templates/settings.json +109 -0
  213. package/src/cli/simple-commands/init/templates/settings.json.enhanced +35 -0
  214. package/src/cli/simple-commands/init/templates/sparc-modes.js +1401 -0
  215. package/src/cli/simple-commands/init/templates/verification-claude-md.js +432 -0
  216. package/src/cli/simple-commands/init/validation/config-validator.js +354 -0
  217. package/src/cli/simple-commands/init/validation/health-checker.js +599 -0
  218. package/src/cli/simple-commands/init/validation/index.js +388 -0
  219. package/src/cli/simple-commands/init/validation/mode-validator.js +387 -0
  220. package/src/cli/simple-commands/init/validation/post-init-validator.js +390 -0
  221. package/src/cli/simple-commands/init/validation/pre-init-validator.js +290 -0
  222. package/src/cli/simple-commands/init/validation/test-runner.js +488 -0
  223. package/src/cli/simple-commands/init.js +4 -0
  224. package/src/cli/simple-commands/mcp-health.js +163 -0
  225. package/src/cli/simple-commands/mcp-integration-layer.js +689 -0
  226. package/src/cli/simple-commands/mcp.js +420 -0
  227. package/src/cli/simple-commands/memory-consolidation.js +631 -0
  228. package/src/cli/simple-commands/memory.js +345 -0
  229. package/src/cli/simple-commands/migrate-hooks.js +63 -0
  230. package/src/cli/simple-commands/monitor.js +417 -0
  231. package/src/cli/simple-commands/neural.js +148 -0
  232. package/src/cli/simple-commands/pair-autofix-only.js +755 -0
  233. package/src/cli/simple-commands/pair-basic.js +751 -0
  234. package/src/cli/simple-commands/pair-old.js +623 -0
  235. package/src/cli/simple-commands/pair-working.js +849 -0
  236. package/src/cli/simple-commands/pair.js +849 -0
  237. package/src/cli/simple-commands/performance-hooks.js +149 -0
  238. package/src/cli/simple-commands/performance-metrics.js +601 -0
  239. package/src/cli/simple-commands/process-ui-enhanced.js +821 -0
  240. package/src/cli/simple-commands/process-ui.js +274 -0
  241. package/src/cli/simple-commands/realtime-update-system.js +659 -0
  242. package/src/cli/simple-commands/sparc/architecture.js +1750 -0
  243. package/src/cli/simple-commands/sparc/commands.js +575 -0
  244. package/src/cli/simple-commands/sparc/completion.js +1831 -0
  245. package/src/cli/simple-commands/sparc/coordinator.js +1045 -0
  246. package/src/cli/simple-commands/sparc/index.js +321 -0
  247. package/src/cli/simple-commands/sparc/phase-base.js +430 -0
  248. package/src/cli/simple-commands/sparc/pseudocode.js +984 -0
  249. package/src/cli/simple-commands/sparc/refinement.js +1856 -0
  250. package/src/cli/simple-commands/sparc/specification.js +736 -0
  251. package/src/cli/simple-commands/sparc-modes/architect.js +125 -0
  252. package/src/cli/simple-commands/sparc-modes/ask.js +126 -0
  253. package/src/cli/simple-commands/sparc-modes/code.js +148 -0
  254. package/src/cli/simple-commands/sparc-modes/debug.js +112 -0
  255. package/src/cli/simple-commands/sparc-modes/devops.js +137 -0
  256. package/src/cli/simple-commands/sparc-modes/docs-writer.js +38 -0
  257. package/src/cli/simple-commands/sparc-modes/generic.js +34 -0
  258. package/src/cli/simple-commands/sparc-modes/index.js +201 -0
  259. package/src/cli/simple-commands/sparc-modes/integration.js +55 -0
  260. package/src/cli/simple-commands/sparc-modes/mcp.js +38 -0
  261. package/src/cli/simple-commands/sparc-modes/monitoring.js +38 -0
  262. package/src/cli/simple-commands/sparc-modes/optimization.js +38 -0
  263. package/src/cli/simple-commands/sparc-modes/security-review.js +130 -0
  264. package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +167 -0
  265. package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +38 -0
  266. package/src/cli/simple-commands/sparc-modes/supabase-admin.js +149 -0
  267. package/src/cli/simple-commands/sparc-modes/swarm.js +436 -0
  268. package/src/cli/simple-commands/sparc-modes/tdd.js +112 -0
  269. package/src/cli/simple-commands/sparc-modes/tutorial.js +277 -0
  270. package/src/cli/simple-commands/sparc.js +530 -0
  271. package/src/cli/simple-commands/start-ui.js +147 -0
  272. package/src/cli/simple-commands/start-wrapper.js +285 -0
  273. package/src/cli/simple-commands/start.js +2 -0
  274. package/src/cli/simple-commands/status.js +303 -0
  275. package/src/cli/simple-commands/stream-chain-clean.js +221 -0
  276. package/src/cli/simple-commands/stream-chain-fixed.js +89 -0
  277. package/src/cli/simple-commands/stream-chain-real.js +408 -0
  278. package/src/cli/simple-commands/stream-chain-working.js +323 -0
  279. package/src/cli/simple-commands/stream-chain.js +491 -0
  280. package/src/cli/simple-commands/stream-processor.js +340 -0
  281. package/src/cli/simple-commands/swarm-executor.js +253 -0
  282. package/src/cli/simple-commands/swarm-metrics-integration.js +371 -0
  283. package/src/cli/simple-commands/swarm-ui.js +741 -0
  284. package/src/cli/simple-commands/swarm-webui-integration.js +311 -0
  285. package/src/cli/simple-commands/swarm.js +2277 -0
  286. package/src/cli/simple-commands/task.js +228 -0
  287. package/src/cli/simple-commands/templates/mle-star-workflow.json +294 -0
  288. package/src/cli/simple-commands/timestamp-fix.js +104 -0
  289. package/src/cli/simple-commands/token-tracker.js +372 -0
  290. package/src/cli/simple-commands/tool-execution-framework.js +555 -0
  291. package/src/cli/simple-commands/train-and-stream.js +354 -0
  292. package/src/cli/simple-commands/training-pipeline.js +874 -0
  293. package/src/cli/simple-commands/training.js +288 -0
  294. package/src/cli/simple-commands/verification-hooks.js +336 -0
  295. package/src/cli/simple-commands/verification-integration.js +464 -0
  296. package/src/cli/simple-commands/verification-training-integration.js +646 -0
  297. package/src/cli/simple-commands/verification.js +551 -0
  298. package/src/cli/simple-commands/web-server.js +929 -0
  299. package/src/cli/simple-commands/webui-validator.js +136 -0
  300. package/src/language/README.md +503 -0
  301. package/src/language/claude-md-generator.js +618 -0
  302. package/src/language/cli.js +422 -0
  303. package/src/language/example.js +347 -0
  304. package/src/language/integration-system.js +619 -0
  305. package/src/language/language-detector.js +581 -0
@@ -0,0 +1,436 @@
1
+ #!/usr/bin/env -S deno run --allow-all
2
+ /**
3
+ * SPARC Mode: Swarm
4
+ * Advanced multi-agent coordination with timeout-free execution
5
+ */
6
+
7
+ const SWARM_MODE = {
8
+ name: 'swarm',
9
+ description: 'Advanced multi-agent coordination with timeout-free execution for complex tasks',
10
+ icon: '🐝',
11
+ category: 'coordination',
12
+ difficulty: 'expert',
13
+ estimatedTime: '30-120+ minutes',
14
+
15
+ // Core capabilities
16
+ capabilities: [
17
+ 'Multi-agent coordination',
18
+ 'Timeout-free execution',
19
+ 'Distributed memory sharing',
20
+ 'Intelligent load balancing',
21
+ 'Background task processing',
22
+ 'Real-time monitoring',
23
+ 'Fault tolerance',
24
+ 'Cross-agent collaboration',
25
+ ],
26
+
27
+ // When to use this mode
28
+ useCases: [
29
+ 'Complex multi-step projects requiring parallel processing',
30
+ 'Large-scale development tasks that might timeout',
31
+ 'Research projects needing multiple specialized agents',
32
+ 'Long-running optimization and refactoring tasks',
33
+ 'Comprehensive testing and quality assurance workflows',
34
+ 'Documentation and analysis projects with multiple components',
35
+ ],
36
+
37
+ // Prerequisites
38
+ prerequisites: [
39
+ 'Claude-Flow initialized with --sparc flag',
40
+ 'Understanding of agent types and coordination strategies',
41
+ 'Basic familiarity with swarm concepts',
42
+ 'Project structure suitable for parallel processing',
43
+ ],
44
+
45
+ // Swarm strategies available
46
+ strategies: {
47
+ development: {
48
+ name: 'Development',
49
+ agents: ['developer', 'tester', 'reviewer', 'documenter'],
50
+ focus: 'Code implementation with quality assurance',
51
+ parallel: true,
52
+ },
53
+ research: {
54
+ name: 'Research',
55
+ agents: ['researcher', 'analyzer', 'documenter'],
56
+ focus: 'Information gathering and analysis',
57
+ parallel: true,
58
+ },
59
+ analysis: {
60
+ name: 'Analysis',
61
+ agents: ['analyzer', 'researcher', 'documenter'],
62
+ focus: 'Data analysis and insights generation',
63
+ parallel: false,
64
+ },
65
+ testing: {
66
+ name: 'Testing',
67
+ agents: ['tester', 'developer', 'reviewer'],
68
+ focus: 'Comprehensive testing and quality assurance',
69
+ parallel: true,
70
+ },
71
+ optimization: {
72
+ name: 'Optimization',
73
+ agents: ['analyzer', 'developer', 'monitor'],
74
+ focus: 'Performance optimization and monitoring',
75
+ parallel: false,
76
+ },
77
+ maintenance: {
78
+ name: 'Maintenance',
79
+ agents: ['developer', 'monitor', 'tester'],
80
+ focus: 'System maintenance and updates',
81
+ parallel: false,
82
+ },
83
+ },
84
+ };
85
+
86
+ export const prompt = `
87
+ You are operating in SPARC Swarm Mode 🐝 - Advanced multi-agent coordination with timeout-free execution.
88
+
89
+ ## 🎯 MISSION
90
+ Coordinate multiple AI agents to accomplish complex tasks that would be difficult or impossible for a single agent due to scope, complexity, or timeout constraints.
91
+
92
+ ## 🐝 SWARM CAPABILITIES
93
+ You have access to the advanced Claude-Flow swarm system with the following capabilities:
94
+
95
+ ### 🤖 Agent Types Available:
96
+ - **Coordinator**: Plans and delegates tasks to other agents
97
+ - **Developer**: Writes code and implements solutions
98
+ - **Researcher**: Gathers and analyzes information
99
+ - **Analyzer**: Identifies patterns and generates insights
100
+ - **Tester**: Creates and runs tests for quality assurance
101
+ - **Reviewer**: Performs code and design reviews
102
+ - **Documenter**: Creates documentation and guides
103
+ - **Monitor**: Tracks performance and system health
104
+ - **Specialist**: Domain-specific expert agents
105
+
106
+ ### 🔄 Coordination Modes:
107
+ - **Centralized**: Single coordinator manages all agents (recommended for start)
108
+ - **Distributed**: Multiple coordinators share management
109
+ - **Hierarchical**: Tree structure with nested coordination
110
+ - **Mesh**: Peer-to-peer agent collaboration
111
+ - **Hybrid**: Mixed coordination strategies
112
+
113
+ ## 🛠️ SWARM COMMANDS
114
+
115
+ ### Basic Swarm Execution:
116
+ \`\`\`bash
117
+ # Start a development swarm for complex implementation
118
+ npx claude-flow swarm "Build a complete REST API with authentication" --strategy development --monitor
119
+
120
+ # Research swarm with distributed coordination
121
+ npx claude-flow swarm "Research and analyze blockchain technologies" --strategy research --distributed --ui
122
+
123
+ # Background optimization swarm (for long-running tasks)
124
+ npx claude-flow swarm "Optimize application performance across all modules" --strategy optimization --background --monitor
125
+ \`\`\`
126
+
127
+ ### Advanced Swarm Configuration:
128
+ \`\`\`bash
129
+ # Full-featured swarm with all enterprise features
130
+ npx claude-flow swarm "Complex enterprise application development" \\
131
+ --strategy development \\
132
+ --mode distributed \\
133
+ --max-agents 10 \\
134
+ --parallel \\
135
+ --monitor \\
136
+ --review \\
137
+ --testing \\
138
+ --encryption \\
139
+ --verbose
140
+
141
+ # Dry run to see configuration before execution
142
+ npx claude-flow swarm "Your complex task" --dry-run --strategy development
143
+ \`\`\`
144
+
145
+ ### 🔍 Monitoring and Management:
146
+ \`\`\`bash
147
+ # Real-time swarm monitoring
148
+ npx claude-flow monitor
149
+
150
+ # Check swarm status
151
+ npx claude-flow status
152
+
153
+ # Memory operations for cross-agent sharing
154
+ npx claude-flow memory store "key" "value" --namespace swarm
155
+ npx claude-flow memory query "search-term" --namespace swarm
156
+ \`\`\`
157
+
158
+ ## 🎯 SWARM METHODOLOGY
159
+
160
+ ### 1. **Task Analysis & Decomposition**
161
+ - Break complex objectives into manageable components
162
+ - Identify parallelizable vs sequential tasks
163
+ - Determine optimal agent types for each component
164
+ - Estimate resource requirements and timeline
165
+
166
+ ### 2. **Swarm Strategy Selection**
167
+ Choose the appropriate strategy based on task type:
168
+ - **Development**: Code implementation with quality checks
169
+ - **Research**: Information gathering and analysis
170
+ - **Analysis**: Data processing and insights
171
+ - **Testing**: Comprehensive quality assurance
172
+ - **Optimization**: Performance improvements
173
+ - **Maintenance**: System updates and fixes
174
+
175
+ ### 3. **Execution Planning**
176
+ - Select coordination mode (centralized recommended for beginners)
177
+ - Determine if background execution is needed for long tasks
178
+ - Configure monitoring and review requirements
179
+ - Set up memory sharing for cross-agent collaboration
180
+
181
+ ### 4. **Launch and Monitor**
182
+ - Execute swarm command with appropriate flags
183
+ - Monitor progress through real-time interface
184
+ - Use memory system for coordination between agents
185
+ - Review and validate results
186
+
187
+ ## ⚠️ TIMEOUT PREVENTION
188
+
189
+ The swarm system is specifically designed to handle complex, long-running tasks without timeout issues:
190
+
191
+ ### 🌙 Background Execution:
192
+ - Use \`--background\` flag for tasks that might take over 60 minutes
193
+ - Background swarms run independently and save results
194
+ - Monitor progress with \`npx claude-flow status\`
195
+
196
+ ### 🔄 Task Splitting:
197
+ - Large tasks are automatically decomposed into smaller chunks
198
+ - Each agent handles manageable portions
199
+ - Results are aggregated through distributed memory
200
+
201
+ ### 💾 State Persistence:
202
+ - All progress is saved continuously
203
+ - Swarms can be resumed if interrupted
204
+ - Memory system maintains context across sessions
205
+
206
+ ## 🚀 EXAMPLE WORKFLOWS
207
+
208
+ ### Complex Development Project:
209
+ \`\`\`bash
210
+ # 1. Start comprehensive development swarm
211
+ npx claude-flow swarm "Build microservices e-commerce platform" \\
212
+ --strategy development --parallel --monitor --review --testing
213
+
214
+ # 2. Monitor progress in real-time
215
+ npx claude-flow monitor
216
+
217
+ # 3. Check specific swarm status
218
+ npx claude-flow status
219
+ \`\`\`
220
+
221
+ ### Research and Analysis:
222
+ \`\`\`bash
223
+ # 1. Launch research swarm with UI
224
+ npx claude-flow swarm "Comprehensive AI/ML market analysis" \\
225
+ --strategy research --distributed --ui --verbose
226
+
227
+ # 2. Store findings for cross-agent access
228
+ npx claude-flow memory store "research-findings" "key insights" --namespace swarm
229
+ \`\`\`
230
+
231
+ ### Long-Running Optimization:
232
+ \`\`\`bash
233
+ # 1. Background optimization swarm
234
+ npx claude-flow swarm "Optimize entire codebase performance" \\
235
+ --strategy optimization --background --testing --encryption
236
+
237
+ # 2. Check background progress
238
+ npx claude-flow status
239
+ \`\`\`
240
+
241
+ ## 🔧 TROUBLESHOOTING
242
+
243
+ ### Common Issues:
244
+ 1. **Swarm fails to start**: Check if Claude-Flow is initialized with \`npx claude-flow init --sparc\`
245
+ 2. **Agents not coordinating**: Ensure memory namespace is consistent
246
+ 3. **Timeout concerns**: Use \`--background\` flag for long tasks
247
+ 4. **Performance issues**: Reduce \`--max-agents\` or use \`--monitor\` for insights
248
+
249
+ ### Best Practices:
250
+ - Start with centralized coordination mode
251
+ - Use dry-run first to validate configuration
252
+ - Monitor resource usage with \`--monitor\` flag
253
+ - Store important findings in memory for cross-agent access
254
+ - Use background mode for tasks over 30 minutes
255
+
256
+ ## 🎯 SUCCESS METRICS
257
+
258
+ Your swarm execution is successful when:
259
+ - [ ] Complex task is decomposed effectively
260
+ - [ ] Appropriate agents are coordinated
261
+ - [ ] No timeout issues occur
262
+ - [ ] Quality standards are maintained
263
+ - [ ] Results are properly aggregated
264
+ - [ ] Documentation is comprehensive
265
+ - [ ] All components integrate properly
266
+
267
+ Remember: The swarm system excels at handling complexity that would overwhelm individual agents. Use it for tasks requiring multiple perspectives, long execution times, or parallel processing capabilities.
268
+
269
+ Now, let's coordinate your swarm to accomplish your complex objective efficiently! 🐝🚀
270
+ `;
271
+
272
+ /**
273
+ * Get the swarm orchestration template
274
+ * @param {string} taskDescription - The task description
275
+ * @param {string} memoryNamespace - The memory namespace
276
+ * @returns {string} The orchestration template
277
+ */
278
+ export function getSwarmOrchestration(taskDescription, memoryNamespace) {
279
+ return `
280
+ ## 🐝 SWARM ORCHESTRATION PLAN
281
+
282
+ ### Phase 1: Swarm Analysis & Planning (5-10 minutes)
283
+ 1. **Task Decomposition**
284
+ - Analyze the complexity and scope of: "${taskDescription}"
285
+ - Break down into parallel and sequential components
286
+ - Identify optimal agent types needed
287
+ - Estimate timeline and resource requirements
288
+
289
+ 2. **Strategy Selection**
290
+ - Choose appropriate swarm strategy based on task type:
291
+ * Development: For code implementation tasks
292
+ * Research: For information gathering and analysis
293
+ * Analysis: For data processing and insights
294
+ * Testing: For quality assurance workflows
295
+ * Optimization: For performance improvements
296
+ * Maintenance: For system updates and fixes
297
+
298
+ 3. **Coordination Planning**
299
+ - Determine if task requires background execution (>30 minutes)
300
+ - Select coordination mode (centralized recommended for start)
301
+ - Plan memory sharing strategy for cross-agent collaboration
302
+ - Configure monitoring and review requirements
303
+
304
+ ### Phase 2: Swarm Configuration (2-5 minutes)
305
+ 4. **Environment Preparation**
306
+ \`\`\`bash
307
+ # Ensure Claude-Flow is properly initialized
308
+ npx claude-flow status
309
+
310
+ # Check memory system
311
+ npx claude-flow memory stats
312
+ \`\`\`
313
+
314
+ 5. **Dry Run Validation**
315
+ \`\`\`bash
316
+ # Test swarm configuration before execution
317
+ npx claude-flow swarm "${taskDescription}" --dry-run --strategy <selected-strategy>
318
+ \`\`\`
319
+
320
+ ### Phase 3: Swarm Execution (Variable)
321
+ 6. **Launch Swarm**
322
+ Choose appropriate execution method:
323
+
324
+ **For Standard Tasks (< 30 minutes):**
325
+ \`\`\`bash
326
+ npx claude-flow swarm "${taskDescription}" --strategy <strategy> --monitor --verbose
327
+ \`\`\`
328
+
329
+ **For Complex Tasks (30-60 minutes):**
330
+ \`\`\`bash
331
+ npx claude-flow swarm "${taskDescription}" --strategy <strategy> --parallel --monitor --review
332
+ \`\`\`
333
+
334
+ **For Long-Running Tasks (> 60 minutes):**
335
+ \`\`\`bash
336
+ npx claude-flow swarm "${taskDescription}" --strategy <strategy> --background --monitor --testing
337
+ \`\`\`
338
+
339
+ **For Enterprise Tasks (Multiple hours):**
340
+ \`\`\`bash
341
+ npx claude-flow swarm "${taskDescription}" \\
342
+ --strategy <strategy> \\
343
+ --mode distributed \\
344
+ --max-agents 10 \\
345
+ --background \\
346
+ --parallel \\
347
+ --monitor \\
348
+ --review \\
349
+ --testing \\
350
+ --encryption \\
351
+ --verbose
352
+ \`\`\`
353
+
354
+ ### Phase 4: Monitoring & Coordination (Ongoing)
355
+ 7. **Real-Time Monitoring**
356
+ \`\`\`bash
357
+ # Monitor swarm progress
358
+ npx claude-flow monitor
359
+
360
+ # Check specific swarm status
361
+ npx claude-flow status
362
+
363
+ # View agent activities
364
+ npx claude-flow agent list
365
+ \`\`\`
366
+
367
+ 8. **Cross-Agent Memory Sharing**
368
+ \`\`\`bash
369
+ # Store important findings for all agents
370
+ npx claude-flow memory store "${memoryNamespace}_findings" "key insights and decisions"
371
+
372
+ # Store progress updates
373
+ npx claude-flow memory store "${memoryNamespace}_progress" "current completion status"
374
+
375
+ # Store blockers or issues
376
+ npx claude-flow memory store "${memoryNamespace}_blockers" "any impediments or questions"
377
+
378
+ # Query shared knowledge
379
+ npx claude-flow memory query "${memoryNamespace}" --limit 10
380
+ \`\`\`
381
+
382
+ ### Phase 5: Results Integration (5-15 minutes)
383
+ 9. **Collect and Validate Results**
384
+ - Review outputs from all agents
385
+ - Validate integration between components
386
+ - Check quality standards and completeness
387
+ - Document final outcomes
388
+
389
+ 10. **Memory Documentation**
390
+ \`\`\`bash
391
+ # Store final results
392
+ npx claude-flow memory store "${memoryNamespace}_final" "completed task summary and results"
393
+
394
+ # Store lessons learned
395
+ npx claude-flow memory store "${memoryNamespace}_lessons" "insights for future similar tasks"
396
+ \`\`\`
397
+
398
+ ## 🎯 SWARM SUCCESS CRITERIA
399
+
400
+ Your swarm execution is successful when:
401
+ - [ ] Task is properly decomposed for parallel processing
402
+ - [ ] Appropriate swarm strategy is selected and configured
403
+ - [ ] All agents are coordinated effectively
404
+ - [ ] No timeout issues occur during execution
405
+ - [ ] Quality standards are maintained across all outputs
406
+ - [ ] Results from different agents integrate properly
407
+ - [ ] Comprehensive documentation is provided
408
+ - [ ] Cross-agent learning is captured in memory
409
+
410
+ ## ⚠️ TIMEOUT PREVENTION STRATEGY
411
+
412
+ **Critical Guidelines for Long Tasks:**
413
+ 1. **Use Background Mode**: For any task estimated over 30 minutes, use \`--background\` flag
414
+ 2. **Enable Monitoring**: Always use \`--monitor\` to track progress
415
+ 3. **Memory Persistence**: Store progress regularly for resumability
416
+ 4. **Task Chunking**: Break large tasks into smaller, manageable pieces
417
+ 5. **Agent Distribution**: Use multiple agents to parallelize work
418
+ 6. **State Saving**: Ensure all intermediate results are saved
419
+
420
+ **Background Execution Benefits:**
421
+ - Processes run independently of your session
422
+ - No risk of timeout or disconnection
423
+ - Continuous progress saving
424
+ - Real-time monitoring available
425
+ - Results accessible when complete
426
+
427
+ Remember: The swarm system is specifically designed to handle complexity and duration that would overwhelm individual agents. Use it confidently for your most challenging tasks!
428
+ `;
429
+ }
430
+
431
+ // Export mode configuration
432
+ export default SWARM_MODE;
433
+
434
+ if (import.meta.main) {
435
+ console.log(prompt);
436
+ }
@@ -0,0 +1,112 @@
1
+ // tdd.js - Test-Driven Development mode orchestration template
2
+ export function getTddOrchestration(taskDescription, memoryNamespace) {
3
+ return `
4
+ ## Task Orchestration Steps - London School TDD
5
+
6
+ 1. **Test Planning & Analysis** (10 mins)
7
+ - Analyze requirements: "${taskDescription}"
8
+ - Query existing code and architecture:
9
+ \\\`\\\`\\\`bash
10
+ npx claude-flow memory query ${memoryNamespace}_architecture
11
+ npx claude-flow memory query ${memoryNamespace}_implementation
12
+ npx claude-flow memory query ${memoryNamespace}_tech_specs
13
+ \\\`\\\`\\\`
14
+ - Define test boundaries and acceptance criteria
15
+ - Plan test structure (unit, integration, e2e)
16
+ - Identify test doubles needed (mocks, stubs, spies)
17
+ - Store plan: \`npx claude-flow memory store ${memoryNamespace}_test_plan "Test strategy: Unit tests for domain logic, integration for APIs, e2e for workflows. Mocking: External services, database. Coverage target: 95%."\`
18
+
19
+ 2. **Red Phase - Write Failing Tests** (20 mins)
20
+ - Create comprehensive test structure:
21
+ \\\`\\\`\\\`
22
+ tests/
23
+ ├── unit/ # Isolated component tests
24
+ ├── integration/ # Component interaction tests
25
+ ├── e2e/ # End-to-end workflow tests
26
+ └── fixtures/ # Test data and mocks
27
+ \\\`\\\`\\\`
28
+ - Write tests following London School TDD:
29
+ - Start with behavior/contract tests
30
+ - Use test doubles for dependencies
31
+ - Focus on interactions, not state
32
+ - Ensure NO hardcoded values in tests
33
+ - Create parameterized tests for edge cases
34
+ - Verify all tests fail with meaningful messages
35
+ - Store status: \`npx claude-flow memory store ${memoryNamespace}_red_phase "Written: 25 unit tests (all failing), 10 integration tests (all failing), 5 e2e tests (all failing). Coverage: 0%."\`
36
+
37
+ 3. **Green Phase - Minimal Implementation** (20 mins)
38
+ - Implement ONLY enough code to pass tests:
39
+ - Start with the simplest implementation
40
+ - Make one test pass at a time
41
+ - Don't add unrequested functionality
42
+ - Maintain modularity (files < 500 lines)
43
+ - Use dependency injection for testability
44
+ - Implement proper error handling
45
+ - Track coverage as you progress
46
+ - Store progress: \`npx claude-flow memory store ${memoryNamespace}_green_phase "Progress: 20/25 unit tests passing, 8/10 integration tests passing. Current coverage: 75%. Remaining: Complex edge cases."\`
47
+
48
+ 4. **Refactor Phase - Optimize & Clean** (15 mins)
49
+ - Refactor while keeping tests green:
50
+ - Extract common patterns into utilities
51
+ - Improve naming and code clarity
52
+ - Optimize algorithms and data structures
53
+ - Reduce duplication (DRY principle)
54
+ - Ensure files remain under 500 lines
55
+ - Add performance tests if needed
56
+ - Improve test maintainability
57
+ - Document complex test scenarios
58
+ - Store refactoring: \`npx claude-flow memory store ${memoryNamespace}_refactor "Extracted 3 common utilities, optimized database queries, improved test readability. All tests green. Coverage: 95%."\`
59
+
60
+ 5. **Test Documentation & Validation** (10 mins)
61
+ - Generate coverage reports
62
+ - Document test scenarios and edge cases
63
+ - Create test execution guide
64
+ - Set up CI/CD test configuration
65
+ - Validate against acceptance criteria
66
+ - Store completion: \`npx claude-flow memory store ${memoryNamespace}_tdd_complete "TDD cycle complete. Coverage: 95%. All acceptance criteria met. Tests documented. CI/CD ready."\`
67
+
68
+ ## Directory Safety
69
+ - **IMPORTANT**: All test files should be created in the current working directory
70
+ - **DO NOT** create files in system directories or node_modules
71
+ - For named projects, create a subdirectory: \\\`mkdir project-name && cd project-name\\\`
72
+ - Use relative paths from your working directory
73
+ - Test files should follow project structure:
74
+ \\\`\\\`\\\`
75
+ ./ (current directory)
76
+ ├── tests/
77
+ │ ├── unit/
78
+ │ ├── integration/
79
+ │ └── e2e/
80
+ ├── coverage/
81
+ └── docs/
82
+ \\\`\\\`\\\`
83
+
84
+ ## Deliverables
85
+ - tests/
86
+ - unit/ (isolated component tests)
87
+ - integration/ (interaction tests)
88
+ - e2e/ (workflow tests)
89
+ - fixtures/ (test data, no hardcoded values)
90
+ - helpers/ (test utilities)
91
+ - coverage/
92
+ - coverage report (HTML + JSON)
93
+ - coverage badge
94
+ - docs/
95
+ - TEST_GUIDE.md (how to run tests)
96
+ - TEST_SCENARIOS.md (test case documentation)
97
+ - .github/workflows/ or .gitlab-ci.yml (CI configuration)
98
+
99
+ ## Testing Best Practices
100
+ - NO hardcoded secrets or environment values in tests
101
+ - Use test fixtures and factories for test data
102
+ - Mock external dependencies at boundaries
103
+ - Test behavior, not implementation details
104
+ - Maintain test independence (no shared state)
105
+ - Use descriptive test names that document behavior
106
+
107
+ ## Next Steps
108
+ After TDD cycle completes:
109
+ - \`npx claude-flow sparc run debug "Investigate any failing edge cases" --non-interactive\`
110
+ - \`npx claude-flow sparc run refinement-optimization-mode "Optimize performance bottlenecks" --non-interactive\`
111
+ - \`npx claude-flow sparc run docs-writer "Create user documentation" --non-interactive\``;
112
+ }