claude-flow 1.0.59 → 1.0.62

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 (136) hide show
  1. package/CLAUDE.md +268 -0
  2. package/SWARM_DOCUMENTATION.md +401 -0
  3. package/benchmark/IMPLEMENTATION_SUMMARY.md +226 -0
  4. package/benchmark/README.md +112 -0
  5. package/benchmark/compare_optimizations.py +172 -0
  6. package/benchmark/demo_comprehensive.py +229 -0
  7. package/benchmark/demo_reports/benchmark_summary.json +89 -0
  8. package/benchmark/demo_reports/demo-analysis-mesh_826e8b63-4f5e-4aea-bd83-04b4496cfc4e.json +129 -0
  9. package/benchmark/demo_reports/demo-analysis-mesh_bdb0f91c-4de0-4459-aacd-702df5b8dd3d.json +129 -0
  10. package/benchmark/demo_reports/demo-auto-centralized_0ccd161d-5c63-4117-a8b2-59db5a9dda48.json +131 -0
  11. package/benchmark/demo_reports/demo-auto-centralized_b7e1dad2-453d-4983-8f6f-14f7be7dc716.json +131 -0
  12. package/benchmark/demo_reports/demo-development-hierarchical_6611c450-c58b-4e9c-badd-7c5aaf89f4fd.json +131 -0
  13. package/benchmark/demo_reports/demo-development-hierarchical_e723cdc5-93b9-4480-b136-281f9990ef3e.json +131 -0
  14. package/benchmark/demo_reports/demo-maintenance-centralized_14cf0a3f-11f8-4297-8250-619a7c57d8b2.json +129 -0
  15. package/benchmark/demo_reports/demo-maintenance-centralized_9afe8bb8-143d-429b-9da1-ed6722d18dd3.json +129 -0
  16. package/benchmark/demo_reports/demo-optimization-hybrid_20e5e971-c1aa-411f-a4c1-bd9c831d468a.json +129 -0
  17. package/benchmark/demo_reports/demo-optimization-hybrid_e81f77c8-485f-449c-9160-4639ecff6741.json +129 -0
  18. package/benchmark/demo_reports/demo-research-distributed_02e44433-4487-4983-8cb5-dfd39be0e393.json +129 -0
  19. package/benchmark/demo_reports/demo-research-distributed_7f0d6c07-159e-4956-bbfa-c80906c87c97.json +129 -0
  20. package/benchmark/demo_reports/demo-testing-distributed_c88872a5-d0bd-4d5f-9bfd-39904d4000bd.json +126 -0
  21. package/benchmark/demo_reports/demo-testing-distributed_c941e576-5936-4044-9133-f6aa6d292a3e.json +126 -0
  22. package/benchmark/docs/README.md +79 -0
  23. package/benchmark/docs/analysis.md +540 -0
  24. package/benchmark/docs/basic-usage.md +545 -0
  25. package/benchmark/docs/best-practices.md +654 -0
  26. package/benchmark/docs/cli-reference.md +641 -0
  27. package/benchmark/docs/coordination-modes.md +407 -0
  28. package/benchmark/docs/optimization-guide.md +368 -0
  29. package/benchmark/docs/quick-start.md +110 -0
  30. package/benchmark/docs/strategies.md +371 -0
  31. package/benchmark/optimization_results/optimization_comparison_20250614_200237.json +52 -0
  32. package/benchmark/plans/architecture-design.md +355 -0
  33. package/benchmark/plans/deployment-guide.md +648 -0
  34. package/benchmark/plans/implementation-plan.md +185 -0
  35. package/benchmark/plans/testing-strategy.md +398 -0
  36. package/benchmark/reports/benchmark-analysis-centralized_595fb042-57aa-4126-a3d8-d5a3099f6922.json +129 -0
  37. package/benchmark/reports/benchmark-analysis-hierarchical_870a421a-414b-4a8b-9de7-9c90fc4cb8d7.json +129 -0
  38. package/benchmark/reports/benchmark-analysis-hierarchical_940f1fc1-fd46-48d6-9bd5-ab0822f51370.json +129 -0
  39. package/benchmark/reports/benchmark-auto-centralized_12f5df02-e130-4d98-b9e4-038b95ac2a10.json +126 -0
  40. package/benchmark/reports/benchmark-development-centralized_aeaaa661-524f-4d88-aad8-9d9652e507ec.json +131 -0
  41. package/benchmark/reports/benchmark-development-centralized_bd1018c1-3a32-45b5-88f7-bce8929e7bfa.json +131 -0
  42. package/benchmark/reports/benchmark-development-distributed_00c2b747-d359-4212-a69b-c3ba54e49b90.json +131 -0
  43. package/benchmark/reports/benchmark-development-distributed_fd70541e-7d12-4909-b2ce-462b2f54450f.json +131 -0
  44. package/benchmark/reports/benchmark-development-mesh_39298fb1-c907-4387-9377-992f6647567c.json +131 -0
  45. package/benchmark/reports/benchmark-optimization-hybrid_8645e972-c0a5-4cba-8b33-caa28af64ff8.json +129 -0
  46. package/benchmark/reports/benchmark-optimization-mesh_2008ba15-5b5d-41e2-b396-28e4aabff057.json +129 -0
  47. package/benchmark/reports/benchmark-optimization-mesh_2efec067-4437-4347-aedc-b022edd84090.json +129 -0
  48. package/benchmark/reports/benchmark-research-centralized_55723718-a42b-4a0d-96e4-9294223aa6c0.json +129 -0
  49. package/benchmark/reports/benchmark-research-distributed_15bc1f4e-cb57-43a0-9e4f-bc9e8225c3fc.json +129 -0
  50. package/benchmark/reports/benchmark-research-distributed_67f5a2f5-2e06-4594-9768-4701e8d6f777.json +129 -0
  51. package/benchmark/requirements-dev.txt +9 -0
  52. package/benchmark/requirements.txt +10 -0
  53. package/benchmark/setup.py +55 -0
  54. package/benchmark/src/swarm_benchmark/__init__.py +22 -0
  55. package/benchmark/src/swarm_benchmark/__main__.py +7 -0
  56. package/benchmark/src/swarm_benchmark/__pycache__/__init__.cpython-312.pyc +0 -0
  57. package/benchmark/src/swarm_benchmark/__pycache__/__main__.cpython-312.pyc +0 -0
  58. package/benchmark/src/swarm_benchmark/cli/__init__.py +5 -0
  59. package/benchmark/src/swarm_benchmark/cli/__pycache__/__init__.cpython-312.pyc +0 -0
  60. package/benchmark/src/swarm_benchmark/cli/__pycache__/main.cpython-312.pyc +0 -0
  61. package/benchmark/src/swarm_benchmark/cli/main.py +270 -0
  62. package/benchmark/src/swarm_benchmark/core/__init__.py +38 -0
  63. package/benchmark/src/swarm_benchmark/core/__pycache__/__init__.cpython-312.pyc +0 -0
  64. package/benchmark/src/swarm_benchmark/core/__pycache__/benchmark_engine.cpython-312.pyc +0 -0
  65. package/benchmark/src/swarm_benchmark/core/__pycache__/models.cpython-312.pyc +0 -0
  66. package/benchmark/src/swarm_benchmark/core/__pycache__/optimized_benchmark_engine.cpython-312.pyc +0 -0
  67. package/benchmark/src/swarm_benchmark/core/__pycache__/result_aggregator.cpython-312.pyc +0 -0
  68. package/benchmark/src/swarm_benchmark/core/__pycache__/task_scheduler.cpython-312.pyc +0 -0
  69. package/benchmark/src/swarm_benchmark/core/benchmark_engine.py +144 -0
  70. package/benchmark/src/swarm_benchmark/core/models.py +323 -0
  71. package/benchmark/src/swarm_benchmark/core/optimized_benchmark_engine.py +334 -0
  72. package/benchmark/src/swarm_benchmark/core/result_aggregator.py +17 -0
  73. package/benchmark/src/swarm_benchmark/core/task_scheduler.py +17 -0
  74. package/benchmark/src/swarm_benchmark/modes/__init__.py +40 -0
  75. package/benchmark/src/swarm_benchmark/modes/base_mode.py +99 -0
  76. package/benchmark/src/swarm_benchmark/modes/centralized_mode.py +230 -0
  77. package/benchmark/src/swarm_benchmark/modes/distributed_mode.py +317 -0
  78. package/benchmark/src/swarm_benchmark/modes/hierarchical_mode.py +243 -0
  79. package/benchmark/src/swarm_benchmark/modes/hybrid_mode.py +290 -0
  80. package/benchmark/src/swarm_benchmark/modes/mesh_mode.py +311 -0
  81. package/benchmark/src/swarm_benchmark/output/__init__.py +6 -0
  82. package/benchmark/src/swarm_benchmark/output/__pycache__/__init__.cpython-312.pyc +0 -0
  83. package/benchmark/src/swarm_benchmark/output/__pycache__/json_writer.cpython-312.pyc +0 -0
  84. package/benchmark/src/swarm_benchmark/output/__pycache__/sqlite_manager.cpython-312.pyc +0 -0
  85. package/benchmark/src/swarm_benchmark/output/json_writer.py +171 -0
  86. package/benchmark/src/swarm_benchmark/output/sqlite_manager.py +330 -0
  87. package/benchmark/src/swarm_benchmark/strategies/__init__.py +64 -0
  88. package/benchmark/src/swarm_benchmark/strategies/__pycache__/__init__.cpython-312.pyc +0 -0
  89. package/benchmark/src/swarm_benchmark/strategies/__pycache__/analysis_strategy.cpython-312.pyc +0 -0
  90. package/benchmark/src/swarm_benchmark/strategies/__pycache__/auto_strategy.cpython-312.pyc +0 -0
  91. package/benchmark/src/swarm_benchmark/strategies/__pycache__/base_strategy.cpython-312.pyc +0 -0
  92. package/benchmark/src/swarm_benchmark/strategies/__pycache__/development_strategy.cpython-312.pyc +0 -0
  93. package/benchmark/src/swarm_benchmark/strategies/__pycache__/maintenance_strategy.cpython-312.pyc +0 -0
  94. package/benchmark/src/swarm_benchmark/strategies/__pycache__/optimization_strategy.cpython-312.pyc +0 -0
  95. package/benchmark/src/swarm_benchmark/strategies/__pycache__/research_strategy.cpython-312.pyc +0 -0
  96. package/benchmark/src/swarm_benchmark/strategies/__pycache__/testing_strategy.cpython-312.pyc +0 -0
  97. package/benchmark/src/swarm_benchmark/strategies/analysis_strategy.py +63 -0
  98. package/benchmark/src/swarm_benchmark/strategies/auto_strategy.py +135 -0
  99. package/benchmark/src/swarm_benchmark/strategies/base_strategy.py +66 -0
  100. package/benchmark/src/swarm_benchmark/strategies/development_strategy.py +164 -0
  101. package/benchmark/src/swarm_benchmark/strategies/maintenance_strategy.py +63 -0
  102. package/benchmark/src/swarm_benchmark/strategies/optimization_strategy.py +63 -0
  103. package/benchmark/src/swarm_benchmark/strategies/research_strategy.py +151 -0
  104. package/benchmark/src/swarm_benchmark/strategies/testing_strategy.py +64 -0
  105. package/benchmark/src/swarm_benchmark.egg-info/PKG-INFO +162 -0
  106. package/benchmark/src/swarm_benchmark.egg-info/SOURCES.txt +37 -0
  107. package/benchmark/src/swarm_benchmark.egg-info/dependency_links.txt +1 -0
  108. package/benchmark/src/swarm_benchmark.egg-info/entry_points.txt +3 -0
  109. package/benchmark/src/swarm_benchmark.egg-info/not-zip-safe +1 -0
  110. package/benchmark/src/swarm_benchmark.egg-info/requires.txt +20 -0
  111. package/benchmark/src/swarm_benchmark.egg-info/top_level.txt +1 -0
  112. package/benchmark/test_output/Simple Test_7263107f-9031-4403-901c-9db6e3fc96c6.json +131 -0
  113. package/benchmark/test_simple_run.py +30 -0
  114. package/benchmark/tests/unit/__pycache__/test_benchmark_engine.cpython-312-pytest-8.4.0.pyc +0 -0
  115. package/benchmark/tests/unit/__pycache__/test_comprehensive_models.cpython-312-pytest-8.4.0.pyc +0 -0
  116. package/benchmark/tests/unit/__pycache__/test_models.cpython-312-pytest-8.4.0.pyc +0 -0
  117. package/benchmark/tests/unit/__pycache__/test_strategies.cpython-312-pytest-8.4.0.pyc +0 -0
  118. package/benchmark/tests/unit/test_benchmark_engine.py +147 -0
  119. package/benchmark/tests/unit/test_comprehensive_models.py +398 -0
  120. package/benchmark/tests/unit/test_models.py +272 -0
  121. package/benchmark/tests/unit/test_strategies.py +195 -0
  122. package/bin/claude-flow-prod +24 -0
  123. package/bin/claude-flow-swarm-background +78 -0
  124. package/bin/claude-flow-swarm-bg +71 -0
  125. package/bin/swarm +78 -0
  126. package/package.json +9 -3
  127. package/scripts/install.js +59 -1
  128. package/src/adapters/node-adapter.js +489 -0
  129. package/src/cli/command-registry.js +11 -3
  130. package/src/cli/commands/swarm-new.ts +11 -0
  131. package/src/cli/simple-cli.js +13 -8
  132. package/src/cli/simple-commands/init.js +112 -24
  133. package/src/cli/simple-commands/swarm-executor-node.js +719 -0
  134. package/src/cli/simple-commands/swarm-executor.js +439 -0
  135. package/src/cli/simple-commands/swarm.js +71 -16
  136. package/bin/claude-flow +0 -58
package/CLAUDE.md ADDED
@@ -0,0 +1,268 @@
1
+ # Claude Code Configuration - SPARC Development Environment
2
+
3
+ ## Project Overview
4
+ This project uses the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology for systematic Test-Driven Development with AI assistance through Claude-Flow orchestration.
5
+
6
+ ## SPARC Development Commands
7
+
8
+ ### Core SPARC Commands
9
+ - `npx claude-flow sparc modes`: List all available SPARC development modes
10
+ - `npx claude-flow sparc run <mode> "<task>"`: Execute specific SPARC mode for a task
11
+ - `npx claude-flow sparc tdd "<feature>"`: Run complete TDD workflow using SPARC methodology
12
+ - `npx claude-flow sparc info <mode>`: Get detailed information about a specific mode
13
+
14
+ ### Standard Build Commands
15
+ - `npm run build`: Build the project
16
+ - `npm run test`: Run the test suite
17
+ - `npm run lint`: Run linter and format checks
18
+ - `npm run typecheck`: Run TypeScript type checking
19
+
20
+ ## SPARC Methodology Workflow
21
+
22
+ ### 1. Specification Phase
23
+ ```bash
24
+ # Create detailed specifications and requirements
25
+ npx claude-flow sparc run spec-pseudocode "Define user authentication requirements"
26
+ ```
27
+ - Define clear functional requirements
28
+ - Document edge cases and constraints
29
+ - Create user stories and acceptance criteria
30
+ - Establish non-functional requirements
31
+
32
+ ### 2. Pseudocode Phase
33
+ ```bash
34
+ # Develop algorithmic logic and data flows
35
+ npx claude-flow sparc run spec-pseudocode "Create authentication flow pseudocode"
36
+ ```
37
+ - Break down complex logic into steps
38
+ - Define data structures and interfaces
39
+ - Plan error handling and edge cases
40
+ - Create modular, testable components
41
+
42
+ ### 3. Architecture Phase
43
+ ```bash
44
+ # Design system architecture and component structure
45
+ npx claude-flow sparc run architect "Design authentication service architecture"
46
+ ```
47
+ - Create system diagrams and component relationships
48
+ - Define API contracts and interfaces
49
+ - Plan database schemas and data flows
50
+ - Establish security and scalability patterns
51
+
52
+ ### 4. Refinement Phase (TDD Implementation)
53
+ ```bash
54
+ # Execute Test-Driven Development cycle
55
+ npx claude-flow sparc tdd "implement user authentication system"
56
+ ```
57
+
58
+ **TDD Cycle:**
59
+ 1. **Red**: Write failing tests first
60
+ 2. **Green**: Implement minimal code to pass tests
61
+ 3. **Refactor**: Optimize and clean up code
62
+ 4. **Repeat**: Continue until feature is complete
63
+
64
+ ### 5. Completion Phase
65
+ ```bash
66
+ # Integration, documentation, and validation
67
+ npx claude-flow sparc run integration "integrate authentication with user management"
68
+ ```
69
+ - Integrate all components
70
+ - Perform end-to-end testing
71
+ - Create comprehensive documentation
72
+ - Validate against original requirements
73
+
74
+ ## SPARC Mode Reference
75
+
76
+ ### Development Modes
77
+ - **`architect`**: System design and architecture planning
78
+ - **`code`**: Clean, modular code implementation
79
+ - **`tdd`**: Test-driven development and testing
80
+ - **`spec-pseudocode`**: Requirements and algorithmic planning
81
+ - **`integration`**: System integration and coordination
82
+
83
+ ### Quality Assurance Modes
84
+ - **`debug`**: Troubleshooting and bug resolution
85
+ - **`security-review`**: Security analysis and vulnerability assessment
86
+ - **`refinement-optimization-mode`**: Performance optimization and refactoring
87
+
88
+ ### Support Modes
89
+ - **`docs-writer`**: Documentation creation and maintenance
90
+ - **`devops`**: Deployment and infrastructure management
91
+ - **`mcp`**: External service integration
92
+ - **`swarm`**: Multi-agent coordination for complex tasks
93
+
94
+ ## Claude Code Slash Commands
95
+
96
+ Claude Code slash commands are available in `.claude/commands/`:
97
+
98
+ ### Project Commands
99
+ - `/sparc`: Execute SPARC methodology workflows
100
+ - `/sparc-<mode>`: Run specific SPARC mode (e.g., /sparc-architect)
101
+ - `/claude-flow-help`: Show all Claude-Flow commands
102
+ - `/claude-flow-memory`: Interact with memory system
103
+ - `/claude-flow-swarm`: Coordinate multi-agent swarms
104
+
105
+ ### Using Slash Commands
106
+ 1. Type `/` in Claude Code to see available commands
107
+ 2. Select a command or type its name
108
+ 3. Commands are context-aware and project-specific
109
+ 4. Custom commands can be added to `.claude/commands/`
110
+
111
+ ## Code Style and Best Practices
112
+
113
+ ### SPARC Development Principles
114
+ - **Modular Design**: Keep files under 500 lines, break into logical components
115
+ - **Environment Safety**: Never hardcode secrets or environment-specific values
116
+ - **Test-First**: Always write tests before implementation (Red-Green-Refactor)
117
+ - **Clean Architecture**: Separate concerns, use dependency injection
118
+ - **Documentation**: Maintain clear, up-to-date documentation
119
+
120
+ ### Coding Standards
121
+ - Use TypeScript for type safety and better tooling
122
+ - Follow consistent naming conventions (camelCase for variables, PascalCase for classes)
123
+ - Implement proper error handling and logging
124
+ - Use async/await for asynchronous operations
125
+ - Prefer composition over inheritance
126
+
127
+ ### Memory and State Management
128
+ - Use claude-flow memory system for persistent state across sessions
129
+ - Store progress and findings using namespaced keys
130
+ - Query previous work before starting new tasks
131
+ - Export/import memory for backup and sharing
132
+
133
+ ## SPARC Memory Integration
134
+
135
+ ### Memory Commands for SPARC Development
136
+ ```bash
137
+ # Store project specifications
138
+ npx claude-flow memory store spec_auth "User authentication requirements and constraints"
139
+
140
+ # Store architectural decisions
141
+ npx claude-flow memory store arch_decisions "Database schema and API design choices"
142
+
143
+ # Store test results and coverage
144
+ npx claude-flow memory store test_coverage "Authentication module: 95% coverage, all tests passing"
145
+
146
+ # Query previous work
147
+ npx claude-flow memory query auth_implementation
148
+
149
+ # Export project memory
150
+ npx claude-flow memory export project_backup.json
151
+ ```
152
+
153
+ ### Memory Namespaces
154
+ - **`spec`**: Requirements and specifications
155
+ - **`arch`**: Architecture and design decisions
156
+ - **`impl`**: Implementation notes and code patterns
157
+ - **`test`**: Test results and coverage reports
158
+ - **`debug`**: Bug reports and resolution notes
159
+
160
+ ## Workflow Examples
161
+
162
+ ### Feature Development Workflow
163
+ ```bash
164
+ # 1. Start with specification
165
+ npx claude-flow sparc run spec-pseudocode "User profile management feature"
166
+
167
+ # 2. Design architecture
168
+ npx claude-flow sparc run architect "Profile service architecture with data validation"
169
+
170
+ # 3. Implement with TDD
171
+ npx claude-flow sparc tdd "user profile CRUD operations"
172
+
173
+ # 4. Security review
174
+ npx claude-flow sparc run security-review "profile data access and validation"
175
+
176
+ # 5. Integration testing
177
+ npx claude-flow sparc run integration "profile service with authentication system"
178
+
179
+ # 6. Documentation
180
+ npx claude-flow sparc run docs-writer "profile service API documentation"
181
+ ```
182
+
183
+ ### Bug Fix Workflow
184
+ ```bash
185
+ # 1. Debug and analyze
186
+ npx claude-flow sparc run debug "authentication token expiration issue"
187
+
188
+ # 2. Write regression tests
189
+ npx claude-flow sparc run tdd "token refresh mechanism tests"
190
+
191
+ # 3. Implement fix
192
+ npx claude-flow sparc run code "fix token refresh in authentication service"
193
+
194
+ # 4. Security review
195
+ npx claude-flow sparc run security-review "token handling security implications"
196
+ ```
197
+
198
+ ## Configuration Files
199
+
200
+ ### Claude Code Integration
201
+ - **`.claude/commands/`**: Claude Code slash commands for all SPARC modes
202
+ - **`.claude/logs/`**: Conversation and session logs
203
+
204
+ ### SPARC Configuration
205
+ - **`.roomodes`**: SPARC mode definitions and configurations (auto-generated)
206
+ - **`.roo/`**: SPARC templates and workflows (auto-generated)
207
+
208
+ ### Claude-Flow Configuration
209
+ - **`memory/`**: Persistent memory and session data
210
+ - **`coordination/`**: Multi-agent coordination settings
211
+ - **`CLAUDE.md`**: Project instructions for Claude Code
212
+
213
+ ## Git Workflow Integration
214
+
215
+ ### Commit Strategy with SPARC
216
+ - **Specification commits**: After completing requirements analysis
217
+ - **Architecture commits**: After design phase completion
218
+ - **TDD commits**: After each Red-Green-Refactor cycle
219
+ - **Integration commits**: After successful component integration
220
+ - **Documentation commits**: After completing documentation updates
221
+
222
+ ### Branch Strategy
223
+ - **`feature/sparc-<feature-name>`**: Feature development with SPARC methodology
224
+ - **`hotfix/sparc-<issue>`**: Bug fixes using SPARC debugging workflow
225
+ - **`refactor/sparc-<component>`**: Refactoring using optimization mode
226
+
227
+ ## Troubleshooting
228
+
229
+ ### Common SPARC Issues
230
+ - **Mode not found**: Check `.roomodes` file exists and is valid JSON
231
+ - **Memory persistence**: Ensure `memory/` directory has write permissions
232
+ - **Tool access**: Verify required tools are available for the selected mode
233
+ - **Namespace conflicts**: Use unique memory namespaces for different features
234
+
235
+ ### Debug Commands
236
+ ```bash
237
+ # Check SPARC configuration
238
+ npx claude-flow sparc modes
239
+
240
+ # Verify memory system
241
+ npx claude-flow memory stats
242
+
243
+ # Check system status
244
+ npx claude-flow status
245
+
246
+ # View detailed mode information
247
+ npx claude-flow sparc info <mode-name>
248
+ ```
249
+
250
+ ## Project Architecture
251
+
252
+ This SPARC-enabled project follows a systematic development approach:
253
+ - **Clear separation of concerns** through modular design
254
+ - **Test-driven development** ensuring reliability and maintainability
255
+ - **Iterative refinement** for continuous improvement
256
+ - **Comprehensive documentation** for team collaboration
257
+ - **AI-assisted development** through specialized SPARC modes
258
+
259
+ ## Important Notes
260
+
261
+ - Always run tests before committing (`npm run test`)
262
+ - Use SPARC memory system to maintain context across sessions
263
+ - Follow the Red-Green-Refactor cycle during TDD phases
264
+ - Document architectural decisions in memory for future reference
265
+ - Regular security reviews for any authentication or data handling code
266
+ - Claude Code slash commands provide quick access to SPARC modes
267
+
268
+ For more information about SPARC methodology, see: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
@@ -0,0 +1,401 @@
1
+ # Claude-Flow Swarm System Documentation
2
+
3
+ ## Overview
4
+
5
+ The Claude-Flow Swarm System is an advanced multi-agent orchestration platform that enables intelligent task decomposition, parallel execution, and collaborative problem-solving. With the integration of SPARC methodology and enhanced monitoring capabilities, it provides a production-ready solution for complex development tasks.
6
+
7
+ ## Key Features
8
+
9
+ ### 🤖 Intelligent Agent Management
10
+ - **Agent Types**: coordinator, researcher, developer, analyzer, reviewer, tester, documenter, monitor, specialist
11
+ - **Capability-Based Selection**: Agents are chosen based on their capabilities matching task requirements
12
+ - **Dynamic Scaling**: Automatic agent spawning and termination based on workload
13
+ - **Health Monitoring**: Continuous health checks and automatic recovery
14
+
15
+ ### ⚡ Advanced Task Execution
16
+ - **Timeout-Free Operation**: Background mode enables long-running tasks without timeouts
17
+ - **Task Decomposition**: Automatic breaking down of complex objectives into manageable subtasks
18
+ - **Parallel Execution**: Concurrent task processing with intelligent scheduling
19
+ - **Work Stealing**: Dynamic load balancing for optimal resource utilization
20
+
21
+ ### 🧠 Distributed Memory System
22
+ - **Cross-Agent Sharing**: Agents can share knowledge and context
23
+ - **Namespace Isolation**: Organized memory spaces for different concerns
24
+ - **Persistence**: State maintained across sessions
25
+ - **CRDT-Based Sync**: Conflict-free replicated data types for consistency
26
+
27
+ ### 📊 Comprehensive Monitoring
28
+ - **Real-Time Progress**: Live updates on task execution
29
+ - **Metrics Collection**: Performance, resource usage, and quality metrics
30
+ - **Progress Files**: Human-readable progress tracking in `swarm-runs/<id>/progress.txt`
31
+ - **Task Status**: Individual task files in `swarm-runs/<id>/tasks/`
32
+
33
+ ### 🔬 SPARC Integration
34
+ - **Specification Phase**: Clear requirements definition
35
+ - **Pseudocode Planning**: Algorithmic design before implementation
36
+ - **Architecture Design**: System structure planning
37
+ - **TDD Implementation**: Red-Green-Refactor cycle enforcement
38
+ - **Completion Validation**: Integration testing and requirements verification
39
+
40
+ ## Usage
41
+
42
+ ### Basic Command Structure
43
+ ```bash
44
+ claude-flow swarm <objective> [options]
45
+ ```
46
+
47
+ ### Common Examples
48
+
49
+ #### Create a REST API
50
+ ```bash
51
+ claude-flow swarm "Build a REST API for user management" --strategy development
52
+ ```
53
+
54
+ #### Research Task
55
+ ```bash
56
+ claude-flow swarm "Research best practices for microservices" --strategy research --max-agents 3
57
+ ```
58
+
59
+ #### Analysis with Monitoring
60
+ ```bash
61
+ claude-flow swarm "Analyze performance bottlenecks" --strategy analysis --monitor
62
+ ```
63
+
64
+ #### Background Execution
65
+ ```bash
66
+ claude-flow swarm "Generate comprehensive documentation" --background --timeout 120
67
+ ```
68
+
69
+ #### With SPARC Methodology
70
+ ```bash
71
+ claude-flow swarm "Build e-commerce platform" --sparc --strategy development --testing --review
72
+ ```
73
+
74
+ ## Strategies
75
+
76
+ ### `auto` (Default)
77
+ Automatically determines the best approach based on objective analysis.
78
+
79
+ ### `research`
80
+ - Focuses on information gathering and synthesis
81
+ - Agent types: researcher, analyzer, documenter
82
+ - Best for: Market research, technology evaluation, best practices
83
+
84
+ ### `development`
85
+ - Software creation with quality assurance
86
+ - Agent types: developer, tester, reviewer, documenter
87
+ - Best for: Building applications, APIs, libraries
88
+
89
+ ### `analysis`
90
+ - Data processing and insight generation
91
+ - Agent types: analyzer, researcher, documenter
92
+ - Best for: Performance analysis, data mining, trend identification
93
+
94
+ ### `testing`
95
+ - Comprehensive quality assurance
96
+ - Agent types: tester, developer, reviewer
97
+ - Best for: Test suite creation, security audits, validation
98
+
99
+ ### `optimization`
100
+ - Performance improvement and refactoring
101
+ - Agent types: analyzer, developer, monitor
102
+ - Best for: Code optimization, resource efficiency, bottleneck resolution
103
+
104
+ ### `maintenance`
105
+ - System updates and bug fixes
106
+ - Agent types: developer, monitor, tester
107
+ - Best for: Bug fixes, dependency updates, system maintenance
108
+
109
+ ## Coordination Modes
110
+
111
+ ### `centralized` (Default)
112
+ - Single coordinator manages all agents
113
+ - Best for: Simple to medium complexity tasks
114
+ - Lower overhead, easier debugging
115
+
116
+ ### `distributed`
117
+ - Multiple coordinators share management duties
118
+ - Best for: Large-scale projects, high agent counts
119
+ - Better fault tolerance, scalable
120
+
121
+ ### `hierarchical`
122
+ - Tree structure with nested coordination
123
+ - Best for: Complex projects with clear sub-components
124
+ - Clear delegation, organized structure
125
+
126
+ ### `mesh`
127
+ - Peer-to-peer agent collaboration
128
+ - Best for: Research tasks, creative problems
129
+ - Maximum flexibility, emergent solutions
130
+
131
+ ### `hybrid`
132
+ - Mixed coordination strategies
133
+ - Best for: Complex scenarios requiring different approaches
134
+ - Adaptive, optimized for specific needs
135
+
136
+ ## Options
137
+
138
+ ### Execution Options
139
+ - `--strategy <type>`: Execution strategy (default: auto)
140
+ - `--mode <type>`: Coordination mode (default: centralized)
141
+ - `--max-agents <n>`: Maximum concurrent agents (default: 5)
142
+ - `--timeout <minutes>`: Overall timeout in minutes (default: 60)
143
+ - `--task-timeout-minutes <n>`: Individual task timeout (default: 59)
144
+ - `--parallel`: Enable parallel task execution
145
+ - `--background`: Run in background mode
146
+ - `--distributed`: Enable distributed coordination
147
+
148
+ ### Quality Options
149
+ - `--sparc`: Enable SPARC methodology (enabled by default)
150
+ - `--review`: Enable peer review process
151
+ - `--testing`: Enable automated testing
152
+ - `--quality-threshold <n>`: Quality threshold 0-1 (default: 0.8)
153
+
154
+ ### Monitoring Options
155
+ - `--monitor`: Enable real-time monitoring
156
+ - `--verbose`: Enable detailed logging
157
+ - `--ui`: Launch terminal UI interface (if available)
158
+
159
+ ### Advanced Options
160
+ - `--memory-namespace <name>`: Memory namespace (default: swarm)
161
+ - `--agent-selection <type>`: Agent selection strategy
162
+ - `--task-scheduling <type>`: Task scheduling algorithm
163
+ - `--load-balancing <type>`: Load balancing method
164
+ - `--fault-tolerance <type>`: Fault tolerance strategy
165
+
166
+ ## File Generation
167
+
168
+ The swarm system can create actual working applications including:
169
+
170
+ ### REST APIs
171
+ - Express.js server with full CRUD operations
172
+ - Test suite with Jest and Supertest
173
+ - Package.json with all dependencies
174
+ - README with usage instructions
175
+ - .gitignore for version control
176
+
177
+ ### Applications
178
+ - Main application file with proper structure
179
+ - Configuration management
180
+ - Package.json with scripts
181
+ - Documentation
182
+
183
+ ### Project Structure
184
+ ```
185
+ output/
186
+ ├── server.js # Main application file
187
+ ├── package.json # Dependencies and scripts
188
+ ├── server.test.js # Test suite
189
+ ├── README.md # Documentation
190
+ ├── .gitignore # Version control config
191
+ └── config.json # Application configuration
192
+ ```
193
+
194
+ ## Monitoring and Results
195
+
196
+ ### Swarm Run Directory
197
+ Each swarm execution creates a tracking directory:
198
+ ```
199
+ swarm-runs/
200
+ └── swarm_<id>/
201
+ ├── config.json # Swarm configuration
202
+ ├── progress.txt # Human-readable progress
203
+ ├── tasks/ # Individual task status
204
+ │ ├── task-1.json
205
+ │ ├── task-2.json
206
+ │ └── ...
207
+ └── results.json # Final results (when complete)
208
+ ```
209
+
210
+ ### Progress Tracking
211
+ Monitor swarm progress in real-time:
212
+ ```bash
213
+ tail -f swarm-runs/swarm_*/progress.txt
214
+ ```
215
+
216
+ ### Task Status
217
+ Each task file contains:
218
+ - Task ID and name
219
+ - Current status (pending, in_progress, completed, failed)
220
+ - Timestamps
221
+ - Error messages (if any)
222
+
223
+ ## Integration with Claude
224
+
225
+ When Claude is available, the swarm system can leverage Claude's capabilities for:
226
+ - Natural language understanding
227
+ - Code generation
228
+ - Complex reasoning
229
+ - Tool usage
230
+
231
+ ### Using with Claude
232
+ ```bash
233
+ # Auto-approve permissions for smoother execution
234
+ claude-flow swarm "Build app" --auto
235
+ ```
236
+
237
+ ## Best Practices
238
+
239
+ ### 1. Choose the Right Strategy
240
+ - Use `development` for building new features
241
+ - Use `research` for gathering information
242
+ - Use `analysis` for data processing
243
+ - Let `auto` decide for general tasks
244
+
245
+ ### 2. Enable Monitoring for Long Tasks
246
+ ```bash
247
+ claude-flow swarm "Complex task" --monitor --background
248
+ ```
249
+
250
+ ### 3. Use SPARC for Quality
251
+ SPARC methodology ensures systematic development:
252
+ ```bash
253
+ claude-flow swarm "Build API" --sparc --testing --review
254
+ ```
255
+
256
+ ### 4. Leverage Parallel Execution
257
+ For independent subtasks:
258
+ ```bash
259
+ claude-flow swarm "Process multiple datasets" --parallel --max-agents 8
260
+ ```
261
+
262
+ ### 5. Set Appropriate Timeouts
263
+ For long-running tasks:
264
+ ```bash
265
+ claude-flow swarm "Large analysis" --timeout 180 --task-timeout-minutes 30
266
+ ```
267
+
268
+ ## Troubleshooting
269
+
270
+ ### Common Issues
271
+
272
+ #### "Swarm executor not found"
273
+ - Ensure claude-flow is properly installed
274
+ - Try: `npm install -g claude-flow@latest`
275
+
276
+ #### "Task timeout"
277
+ - Increase timeout: `--task-timeout-minutes 120`
278
+ - Use background mode: `--background`
279
+
280
+ #### "Memory errors"
281
+ - Check available disk space
282
+ - Clear old swarm runs: `rm -rf swarm-runs/swarm_*`
283
+
284
+ #### "Agent failures"
285
+ - Check system resources
286
+ - Reduce max agents: `--max-agents 3`
287
+ - Enable verbose logging: `--verbose`
288
+
289
+ ### Debug Mode
290
+ Enable detailed logging:
291
+ ```bash
292
+ claude-flow swarm "Debug task" --verbose --monitor
293
+ ```
294
+
295
+ ## Advanced Usage
296
+
297
+ ### Custom Agent Configuration
298
+ Create specialized agent setups:
299
+ ```bash
300
+ claude-flow swarm "Special task" \
301
+ --agent-selection skill-based \
302
+ --max-agents 10 \
303
+ --coordination hierarchical
304
+ ```
305
+
306
+ ### Distributed Execution
307
+ For large-scale projects:
308
+ ```bash
309
+ claude-flow swarm "Enterprise project" \
310
+ --distributed \
311
+ --mode mesh \
312
+ --max-agents 20 \
313
+ --parallel
314
+ ```
315
+
316
+ ### Quality-Focused Development
317
+ Maximum quality assurance:
318
+ ```bash
319
+ claude-flow swarm "Critical system" \
320
+ --sparc \
321
+ --testing \
322
+ --review \
323
+ --quality-threshold 0.95
324
+ ```
325
+
326
+ ## Architecture
327
+
328
+ ### System Components
329
+ 1. **Swarm Coordinator**: Orchestrates agents and tasks
330
+ 2. **Task Executor**: Manages individual task execution
331
+ 3. **Memory Manager**: Handles distributed state
332
+ 4. **Agent Registry**: Tracks agent capabilities and status
333
+ 5. **Event Bus**: Enables component communication
334
+ 6. **Monitor Service**: Collects and reports metrics
335
+
336
+ ### Data Flow
337
+ 1. Objective → Coordinator
338
+ 2. Coordinator → Task Decomposition
339
+ 3. Tasks → Agent Assignment
340
+ 4. Agents → Task Execution
341
+ 5. Results → Aggregation
342
+ 6. Aggregation → Final Output
343
+
344
+ ## Performance Optimization
345
+
346
+ ### Benchmarking
347
+ The system includes a comprehensive benchmark suite:
348
+ ```bash
349
+ cd benchmark
350
+ python -m swarm_benchmark.demo
351
+ ```
352
+
353
+ ### Optimization Tips
354
+ 1. Use appropriate agent counts
355
+ 2. Enable caching for repeated operations
356
+ 3. Use background mode for long tasks
357
+ 4. Monitor resource usage
358
+ 5. Clean up old swarm runs regularly
359
+
360
+ ## Security Considerations
361
+
362
+ ### Data Protection
363
+ - Memory encryption available with `--encryption`
364
+ - Namespace isolation prevents data leaks
365
+ - Audit logging for compliance
366
+
367
+ ### Best Practices
368
+ 1. Use unique namespaces for sensitive data
369
+ 2. Enable encryption for production use
370
+ 3. Regular cleanup of temporary files
371
+ 4. Monitor agent activities
372
+
373
+ ## Future Enhancements
374
+
375
+ ### Planned Features
376
+ - GPU acceleration for ML tasks
377
+ - Cloud provider integrations
378
+ - Advanced visualization dashboard
379
+ - Plugin system for custom agents
380
+ - Workflow templates
381
+
382
+ ### Experimental Features
383
+ - Quantum-inspired optimization
384
+ - Self-modifying agent behaviors
385
+ - Predictive task scheduling
386
+ - Cross-swarm collaboration
387
+
388
+ ## Contributing
389
+
390
+ The swarm system is designed to be extensible:
391
+ 1. Custom strategies in `strategies/`
392
+ 2. New agent types in `agents/`
393
+ 3. Coordination modes in `modes/`
394
+ 4. Memory backends in `memory/`
395
+
396
+ ## Support
397
+
398
+ For issues and questions:
399
+ - GitHub Issues: https://github.com/ruvnet/claude-code-flow/issues
400
+ - Documentation: https://github.com/ruvnet/claude-code-flow/docs
401
+ - Examples: https://github.com/ruvnet/claude-code-flow/examples