claude-flow 2.5.0-alpha.141 → 2.7.0-alpha

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 (149) hide show
  1. package/.claude/agents/reasoning/README.md +171 -0
  2. package/.claude/agents/reasoning/agent.md +816 -0
  3. package/.claude/agents/reasoning/example-reasoning-agent-template.md +362 -0
  4. package/.claude/agents/reasoning/goal-planner.md +73 -0
  5. package/.claude/commands/coordination/README.md +9 -0
  6. package/.claude/commands/memory/README.md +9 -0
  7. package/.claude/settings.json +3 -3
  8. package/.claude/sparc-modes.json +108 -0
  9. package/README.md +1 -6
  10. package/bin/claude-flow +1 -1
  11. package/dist/src/cli/command-registry.js +70 -6
  12. package/dist/src/cli/command-registry.js.map +1 -1
  13. package/dist/src/cli/help-formatter.js +0 -3
  14. package/dist/src/cli/help-formatter.js.map +1 -1
  15. package/dist/src/cli/help-text.js +53 -5
  16. package/dist/src/cli/help-text.js.map +1 -1
  17. package/dist/src/cli/simple-cli.js +182 -172
  18. package/dist/src/cli/simple-cli.js.map +1 -1
  19. package/dist/src/cli/simple-commands/agent-booster.js +415 -0
  20. package/dist/src/cli/simple-commands/agent-booster.js.map +1 -0
  21. package/dist/src/cli/simple-commands/agent.js +856 -13
  22. package/dist/src/cli/simple-commands/agent.js.map +1 -1
  23. package/dist/src/cli/simple-commands/env-template.js +180 -0
  24. package/dist/src/cli/simple-commands/env-template.js.map +1 -0
  25. package/dist/src/cli/simple-commands/init/help.js +23 -0
  26. package/dist/src/cli/simple-commands/init/help.js.map +1 -1
  27. package/dist/src/cli/simple-commands/init/index.js +63 -0
  28. package/dist/src/cli/simple-commands/init/index.js.map +1 -1
  29. package/dist/src/cli/simple-commands/memory.js +307 -16
  30. package/dist/src/cli/simple-commands/memory.js.map +1 -1
  31. package/dist/src/cli/simple-commands/proxy.js +304 -0
  32. package/dist/src/cli/simple-commands/proxy.js.map +1 -0
  33. package/dist/src/cli/simple-commands/sparc.js +16 -19
  34. package/dist/src/cli/simple-commands/sparc.js.map +1 -1
  35. package/dist/src/cli/validation-helper.js.map +1 -1
  36. package/dist/src/core/version.js +1 -1
  37. package/dist/src/execution/agent-executor.js +181 -0
  38. package/dist/src/execution/agent-executor.js.map +1 -0
  39. package/dist/src/execution/index.js +12 -0
  40. package/dist/src/execution/index.js.map +1 -0
  41. package/dist/src/execution/provider-manager.js +110 -0
  42. package/dist/src/execution/provider-manager.js.map +1 -0
  43. package/dist/src/hooks/redaction-hook.js +89 -0
  44. package/dist/src/hooks/redaction-hook.js.map +1 -0
  45. package/dist/src/memory/swarm-memory.js +340 -421
  46. package/dist/src/memory/swarm-memory.js.map +1 -1
  47. package/dist/src/utils/key-redactor.js +108 -0
  48. package/dist/src/utils/key-redactor.js.map +1 -0
  49. package/dist/src/utils/metrics-reader.js +37 -39
  50. package/dist/src/utils/metrics-reader.js.map +1 -1
  51. package/docs/AGENT-BOOSTER-INTEGRATION.md +407 -0
  52. package/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md +753 -0
  53. package/docs/AGENTIC_FLOW_EXECUTION_FIX_REPORT.md +474 -0
  54. package/docs/AGENTIC_FLOW_INTEGRATION_STATUS.md +143 -0
  55. package/docs/AGENTIC_FLOW_MVP_COMPLETE.md +367 -0
  56. package/docs/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +369 -0
  57. package/docs/COMMAND-VERIFICATION-REPORT.md +441 -0
  58. package/docs/COMMIT_SUMMARY.md +247 -0
  59. package/docs/DEEP_REVIEW_COMPREHENSIVE_REPORT.md +922 -0
  60. package/docs/DOCKER-VALIDATION-REPORT.md +281 -0
  61. package/docs/ENV-SETUP-GUIDE.md +270 -0
  62. package/docs/FINAL_PRE_PUBLISH_VALIDATION.md +823 -0
  63. package/docs/FINAL_VALIDATION_REPORT.md +165 -0
  64. package/docs/HOOKS-V2-MODIFICATION.md +146 -0
  65. package/docs/INDEX.md +568 -0
  66. package/docs/INTEGRATION_COMPLETE.md +414 -0
  67. package/docs/MEMORY_REDACTION_TEST_REPORT.md +300 -0
  68. package/docs/PERFORMANCE-SYSTEMS-STATUS.md +340 -0
  69. package/docs/PRE_RELEASE_FIXES_REPORT.md +435 -0
  70. package/docs/README.md +35 -0
  71. package/docs/REASONING-AGENTS.md +482 -0
  72. package/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md +813 -0
  73. package/docs/REASONINGBANK-ANALYSIS-COMPLETE.md +479 -0
  74. package/docs/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
  75. package/docs/REASONINGBANK-BENCHMARK.md +396 -0
  76. package/docs/REASONINGBANK-CLI-INTEGRATION.md +455 -0
  77. package/docs/REASONINGBANK-CORE-INTEGRATION.md +658 -0
  78. package/docs/REASONINGBANK-COST-OPTIMIZATION.md +329 -0
  79. package/docs/REASONINGBANK-DEMO.md +419 -0
  80. package/docs/REASONINGBANK-INTEGRATION-COMPLETE.md +249 -0
  81. package/docs/REASONINGBANK-VALIDATION.md +532 -0
  82. package/docs/REASONINGBANK_ARCHITECTURE.md +475 -0
  83. package/docs/REASONINGBANK_INTEGRATION_COMPLETE.md +558 -0
  84. package/docs/REASONINGBANK_INTEGRATION_PLAN.md +1188 -0
  85. package/docs/REGRESSION-ANALYSIS-REPORT.md +500 -0
  86. package/docs/RELEASE_v2.6.0-alpha.2.md +658 -0
  87. package/docs/api/API_DOCUMENTATION.md +721 -0
  88. package/docs/architecture/ARCHITECTURE.md +1690 -0
  89. package/docs/ci-cd/README.md +368 -0
  90. package/docs/development/DEPLOYMENT.md +2348 -0
  91. package/docs/development/DEVELOPMENT_WORKFLOW.md +1333 -0
  92. package/docs/development/build-analysis-report.md +252 -0
  93. package/docs/development/pair-optimization.md +156 -0
  94. package/docs/development/token-tracking-status.md +103 -0
  95. package/docs/development/training-pipeline-demo.md +163 -0
  96. package/docs/development/training-pipeline-real-only.md +196 -0
  97. package/docs/epic-sdk-integration.md +1269 -0
  98. package/docs/experimental/RIEMANN_HYPOTHESIS_PROOF.md +124 -0
  99. package/docs/experimental/computational_verification.py +436 -0
  100. package/docs/experimental/novel_approaches.md +560 -0
  101. package/docs/experimental/riemann_hypothesis_analysis.md +263 -0
  102. package/docs/experimental/riemann_proof_attempt.md +124 -0
  103. package/docs/experimental/riemann_synthesis.md +277 -0
  104. package/docs/experimental/verification_results.json +12 -0
  105. package/docs/experimental/visualization_insights.md +720 -0
  106. package/docs/guides/USER_GUIDE.md +1138 -0
  107. package/docs/guides/token-tracking-guide.md +291 -0
  108. package/docs/reference/AGENTS.md +1011 -0
  109. package/docs/reference/MCP_TOOLS.md +2188 -0
  110. package/docs/reference/SPARC.md +717 -0
  111. package/docs/reference/SWARM.md +2000 -0
  112. package/docs/sdk/CLAUDE-CODE-SDK-DEEP-ANALYSIS.md +649 -0
  113. package/docs/sdk/CLAUDE-FLOW-SDK-INTEGRATION-ANALYSIS.md +242 -0
  114. package/docs/sdk/INTEGRATION-ROADMAP.md +420 -0
  115. package/docs/sdk/MCP-TOOLS-UPDATE.md +270 -0
  116. package/docs/sdk/SDK-ADVANCED-FEATURES-INTEGRATION.md +723 -0
  117. package/docs/sdk/SDK-ALL-FEATURES-INTEGRATION-MATRIX.md +612 -0
  118. package/docs/sdk/SDK-INTEGRATION-COMPLETE.md +358 -0
  119. package/docs/sdk/SDK-INTEGRATION-PHASES-V2.5.md +750 -0
  120. package/docs/sdk/SDK-LEVERAGE-REAL-FEATURES.md +676 -0
  121. package/docs/sdk/SDK-VALIDATION-RESULTS.md +400 -0
  122. package/docs/sdk/epic-sdk-integration.md +1269 -0
  123. package/docs/setup/remote-setup.md +93 -0
  124. package/docs/validation/final-validation-summary.md +220 -0
  125. package/docs/validation/verification-integration.md +190 -0
  126. package/docs/validation/verification-validation.md +349 -0
  127. package/docs/wiki/background-commands.md +1213 -0
  128. package/docs/wiki/session-persistence.md +342 -0
  129. package/docs/wiki/stream-chain-command.md +537 -0
  130. package/package.json +4 -2
  131. package/src/cli/command-registry.js +70 -5
  132. package/src/cli/help-text.js +26 -5
  133. package/src/cli/simple-cli.ts +18 -7
  134. package/src/cli/simple-commands/agent-booster.js +515 -0
  135. package/src/cli/simple-commands/agent.js +1001 -12
  136. package/src/cli/simple-commands/agent.ts +137 -0
  137. package/src/cli/simple-commands/config.ts +127 -0
  138. package/src/cli/simple-commands/env-template.js +190 -0
  139. package/src/cli/simple-commands/init/help.js +23 -0
  140. package/src/cli/simple-commands/init/index.js +84 -6
  141. package/src/cli/simple-commands/memory.js +363 -16
  142. package/src/cli/simple-commands/proxy.js +384 -0
  143. package/src/cli/simple-commands/sparc.js +16 -19
  144. package/src/execution/agent-executor.ts +306 -0
  145. package/src/execution/index.ts +19 -0
  146. package/src/execution/provider-manager.ts +187 -0
  147. package/src/hooks/redaction-hook.ts +115 -0
  148. package/src/utils/key-redactor.js +178 -0
  149. package/src/utils/key-redactor.ts +184 -0
@@ -0,0 +1,717 @@
1
+ # SPARC Methodology Documentation
2
+
3
+ ## Overview
4
+
5
+ SPARC (Specification → Pseudocode → Architecture → Refinement → Code) is a systematic development methodology that provides structured, mode-based development environments for different software development tasks. This comprehensive approach ensures consistent, high-quality results across all phases of development.
6
+
7
+ ### Core Philosophy
8
+
9
+ SPARC transforms development from ad-hoc coding to systematic engineering by:
10
+
11
+ 1. **Specification First**: Define what needs to be built before building it
12
+ 2. **Pseudocode Planning**: Think through the logic before implementation
13
+ 3. **Architecture Design**: Plan the system structure and relationships
14
+ 4. **Refinement Process**: Iteratively improve design and implementation
15
+ 5. **Code Implementation**: Execute with clear direction and validated approach
16
+
17
+ ### Key Benefits
18
+
19
+ - **Systematic Approach**: Reduces errors through structured methodology
20
+ - **Mode Specialization**: Each development task has an optimized execution environment
21
+ - **Memory Integration**: Persistent context across development sessions
22
+ - **Parallel Execution**: Multiple modes can work concurrently using BatchTool
23
+ - **Quality Assurance**: Built-in best practices and validation steps
24
+
25
+ ## SPARC Modes Reference
26
+
27
+ ### Core Development Modes
28
+
29
+ #### 1. **orchestrator** - Multi-Agent Task Orchestration
30
+ - **Purpose**: Coordinates complex development tasks across multiple agents
31
+ - **Best For**: Large projects requiring multiple specialists
32
+ - **Tools**: TodoWrite, TodoRead, Task, Memory, Bash
33
+ - **Usage Pattern**: Central coordination with distributed execution
34
+ - **Best Practices**:
35
+ - Use batch operations for multiple file operations
36
+ - Store intermediate results in Memory for team coordination
37
+ - Enable parallel execution for independent tasks
38
+ - Monitor resource usage during intensive operations
39
+ - Leverage centralized coordination for team management
40
+
41
+ #### 2. **coder** - Autonomous Code Generation
42
+ - **Purpose**: Implementation and code generation with best practices
43
+ - **Best For**: Feature development, bug fixes, code refactoring
44
+ - **Tools**: Read, Write, Edit, MultiEdit, Bash, TodoWrite
45
+ - **Usage Pattern**: Direct implementation with testing validation
46
+ - **Best Practices**:
47
+ - Follow existing code patterns and conventions
48
+ - Write comprehensive tests for new code
49
+ - Use batch file operations for efficiency
50
+ - Implement proper error handling
51
+ - Add meaningful comments and documentation
52
+
53
+ #### 3. **architect** - System Design and Architecture
54
+ - **Purpose**: High-level system design and architectural planning
55
+ - **Best For**: System architecture, technology decisions, design patterns
56
+ - **Tools**: Write, Memory, TodoWrite, Read
57
+ - **Usage Pattern**: Analysis → Design → Documentation → Validation
58
+ - **Best Practices**:
59
+ - Design for scalability and maintainability
60
+ - Document architectural decisions
61
+ - Create clear component boundaries
62
+ - Plan for future extensibility
63
+ - Consider performance implications
64
+
65
+ #### 4. **tdd** - Test-Driven Development
66
+ - **Purpose**: London School TDD methodology implementation
67
+ - **Best For**: Feature development with comprehensive test coverage
68
+ - **Tools**: Write, Edit, Bash, TodoWrite, Read
69
+ - **Usage Pattern**: Red → Green → Refactor cycle
70
+ - **Best Practices**:
71
+ - Write tests before implementation
72
+ - Follow red-green-refactor cycle
73
+ - Aim for comprehensive test coverage
74
+ - Test edge cases and error conditions
75
+ - Keep tests simple and focused
76
+
77
+ ### Analysis and Research Modes
78
+
79
+ #### 5. **researcher** - Deep Research and Analysis
80
+ - **Purpose**: Comprehensive research and information gathering
81
+ - **Best For**: Technology evaluation, market research, requirements gathering
82
+ - **Tools**: WebSearch, WebFetch, Read, Memory, TodoWrite
83
+ - **Usage Pattern**: Search → Analysis → Documentation → Synthesis
84
+ - **Best Practices**:
85
+ - Verify information from multiple sources
86
+ - Store findings in Memory for later reference
87
+ - Create structured research reports
88
+ - Cross-reference and validate data
89
+ - Document sources and methodology
90
+
91
+ #### 6. **analyst** - Code and Data Analysis
92
+ - **Purpose**: Deep analysis of codebases, performance, and patterns
93
+ - **Best For**: Code reviews, performance analysis, technical debt assessment
94
+ - **Tools**: Read, Grep, Glob, Memory, TodoWrite
95
+ - **Usage Pattern**: Discovery → Analysis → Insights → Recommendations
96
+ - **Best Practices**:
97
+ - Use efficient search patterns
98
+ - Analyze code metrics
99
+ - Identify patterns and anomalies
100
+ - Store analysis results
101
+ - Create actionable insights
102
+
103
+ ### Quality Assurance Modes
104
+
105
+ #### 7. **reviewer** - Code Review and Quality Optimization
106
+ - **Purpose**: Comprehensive code review and quality improvement
107
+ - **Best For**: Pull request reviews, code quality audits
108
+ - **Tools**: Read, Edit, TodoWrite, Memory
109
+ - **Usage Pattern**: Review → Analysis → Feedback → Validation
110
+ - **Best Practices**:
111
+ - Check for security vulnerabilities
112
+ - Verify code follows conventions
113
+ - Suggest performance improvements
114
+ - Ensure proper error handling
115
+ - Validate test coverage
116
+
117
+ #### 8. **tester** - Comprehensive Testing and Validation
118
+ - **Purpose**: Test creation, execution, and validation
119
+ - **Best For**: Test suite development, QA validation, regression testing
120
+ - **Tools**: Write, Bash, Read, TodoWrite
121
+ - **Usage Pattern**: Planning → Implementation → Execution → Reporting
122
+ - **Best Practices**:
123
+ - Test all code paths
124
+ - Include edge cases
125
+ - Verify error handling
126
+ - Test performance characteristics
127
+ - Automate test execution
128
+
129
+ #### 9. **security-review** - Security Analysis and Hardening
130
+ - **Purpose**: Security vulnerability analysis and remediation
131
+ - **Best For**: Security audits, penetration testing, compliance validation
132
+ - **Tools**: Read, Grep, Bash, Write, TodoWrite
133
+ - **Usage Pattern**: Assessment → Analysis → Remediation → Validation
134
+ - **Best Practices**:
135
+ - Follow OWASP guidelines
136
+ - Check for common vulnerabilities
137
+ - Validate input sanitization
138
+ - Review authentication mechanisms
139
+ - Test authorization controls
140
+
141
+ ### Development Support Modes
142
+
143
+ #### 10. **debugger** - Systematic Debugging
144
+ - **Purpose**: Debug and fix issues with systematic approach
145
+ - **Best For**: Bug investigation, error resolution, performance issues
146
+ - **Tools**: Read, Edit, Bash, TodoWrite
147
+ - **Usage Pattern**: Reproduction → Analysis → Resolution → Validation
148
+ - **Best Practices**:
149
+ - Reproduce issues consistently
150
+ - Use systematic debugging approach
151
+ - Add diagnostic logging
152
+ - Fix root causes not symptoms
153
+ - Write tests to prevent regression
154
+
155
+ #### 11. **optimizer** - Performance Optimization
156
+ - **Purpose**: Performance analysis and optimization
157
+ - **Best For**: Performance bottlenecks, resource optimization, scalability
158
+ - **Tools**: Read, Edit, Bash, Memory, TodoWrite
159
+ - **Usage Pattern**: Profiling → Analysis → Optimization → Validation
160
+ - **Best Practices**:
161
+ - Profile before optimizing
162
+ - Focus on bottlenecks
163
+ - Measure improvements
164
+ - Balance readability and performance
165
+ - Document optimization rationale
166
+
167
+ #### 12. **documenter** - Documentation Generation
168
+ - **Purpose**: Technical documentation creation and maintenance
169
+ - **Best For**: API docs, user guides, technical specifications
170
+ - **Tools**: Write, Read, TodoWrite
171
+ - **Usage Pattern**: Analysis → Structure → Content → Review
172
+ - **Best Practices**:
173
+ - Keep documentation current
174
+ - Include examples
175
+ - Document APIs thoroughly
176
+ - Use clear language
177
+ - Organize logically
178
+
179
+ ### Specialized Modes
180
+
181
+ #### 13. **devops** - DevOps and Infrastructure
182
+ - **Purpose**: Infrastructure, CI/CD, deployment automation
183
+ - **Best For**: Pipeline setup, containerization, infrastructure as code
184
+ - **Tools**: Write, Bash, Read, TodoWrite
185
+ - **Usage Pattern**: Planning → Configuration → Automation → Monitoring
186
+ - **Best Practices**:
187
+ - Automate repetitive tasks
188
+ - Use infrastructure as code
189
+ - Implement proper monitoring
190
+ - Ensure security best practices
191
+ - Document deployment procedures
192
+
193
+ #### 14. **integration** - System Integration
194
+ - **Purpose**: API integration, service communication, data flow
195
+ - **Best For**: Third-party integrations, microservices communication
196
+ - **Tools**: Read, Write, Bash, WebFetch, TodoWrite
197
+ - **Usage Pattern**: Analysis → Design → Implementation → Testing
198
+ - **Best Practices**:
199
+ - Handle integration failures gracefully
200
+ - Implement proper retry mechanisms
201
+ - Monitor integration health
202
+ - Document API contracts
203
+ - Test integration scenarios
204
+
205
+ #### 15. **mcp** - MCP Tool Development
206
+ - **Purpose**: Model Context Protocol tool development and integration
207
+ - **Best For**: Claude integration, tool development, protocol implementation
208
+ - **Tools**: Write, Read, Bash, TodoWrite
209
+ - **Usage Pattern**: Specification → Implementation → Testing → Integration
210
+ - **Best Practices**:
211
+ - Follow MCP specification
212
+ - Implement proper error handling
213
+ - Test tool interactions
214
+ - Document tool capabilities
215
+ - Validate protocol compliance
216
+
217
+ #### 16. **ask** - Requirements Analysis
218
+ - **Purpose**: Requirement gathering and clarification
219
+ - **Best For**: Project scoping, stakeholder communication, requirement validation
220
+ - **Tools**: WebSearch, Memory, TodoWrite, Read
221
+ - **Usage Pattern**: Discovery → Analysis → Clarification → Documentation
222
+ - **Best Practices**:
223
+ - Ask clarifying questions
224
+ - Document assumptions
225
+ - Validate understanding
226
+ - Identify edge cases
227
+ - Prioritize requirements
228
+
229
+ #### 17. **tutorial** - Educational Content Creation
230
+ - **Purpose**: Tutorial and learning content development
231
+ - **Best For**: Documentation, training materials, educational resources
232
+ - **Tools**: Write, Read, TodoWrite, WebSearch
233
+ - **Usage Pattern**: Planning → Content → Examples → Review
234
+ - **Best Practices**:
235
+ - Structure content logically
236
+ - Include practical examples
237
+ - Test all code examples
238
+ - Consider different skill levels
239
+ - Provide clear next steps
240
+
241
+ ## Command Syntax and Options
242
+
243
+ ### Basic Commands
244
+
245
+ ```bash
246
+ # List all available SPARC modes
247
+ npx claude-flow@alpha sparc modes [--verbose]
248
+
249
+ # Get detailed information about a specific mode
250
+ npx claude-flow@alpha sparc info <mode-slug>
251
+
252
+ # Execute a task in a specific SPARC mode
253
+ npx claude-flow@alpha sparc run <mode> "<task-description>"
254
+
255
+ # Run Test-Driven Development workflow
256
+ npx claude-flow@alpha sparc tdd "<feature-description>"
257
+ ```
258
+
259
+ ### Command Options
260
+
261
+ #### Global Flags
262
+ - `--help, -h` - Show help information
263
+ - `--verbose, -v` - Enable detailed output
264
+ - `--dry-run, -d` - Show configuration without executing
265
+ - `--non-interactive, -n` - Run without user prompts
266
+ - `--namespace <name>` - Use custom memory namespace
267
+
268
+ #### Permission Control
269
+ - `--enable-permissions` - Enable permission prompts (default: auto-skip)
270
+ - `--dangerously-skip-permissions` - Skip all permission prompts (automatically applied)
271
+
272
+ #### Configuration
273
+ - `--config <path>` - Use custom MCP configuration file
274
+ - `--interactive, -i` - Enable interactive mode (for TDD workflow)
275
+
276
+ ### Advanced Usage Examples
277
+
278
+ #### Single Mode Execution
279
+ ```bash
280
+ # Code implementation with custom namespace
281
+ npx claude-flow@alpha sparc run code "implement user authentication" --namespace auth_system
282
+
283
+ # Architecture planning with verbose output
284
+ npx claude-flow@alpha sparc run architect "design microservices architecture" --verbose
285
+
286
+ # Test-driven development for payment system
287
+ npx claude-flow@alpha sparc run tdd "payment processing with validation" --namespace payments
288
+
289
+ # Security review of existing codebase
290
+ npx claude-flow@alpha sparc run security-review "audit authentication system" --verbose
291
+
292
+ # Performance optimization with non-interactive mode
293
+ npx claude-flow@alpha sparc run optimizer "optimize database queries" --non-interactive
294
+ ```
295
+
296
+ #### TDD Workflow
297
+ ```bash
298
+ # Interactive TDD workflow (step-by-step)
299
+ npx claude-flow@alpha sparc tdd "user registration system" --interactive
300
+
301
+ # Automated TDD workflow
302
+ npx claude-flow@alpha sparc tdd "shopping cart functionality" --namespace ecommerce
303
+
304
+ # TDD with custom configuration
305
+ npx claude-flow@alpha sparc tdd "payment gateway integration" --config ./custom-mcp.json
306
+ ```
307
+
308
+ ## Pipeline and Batch Execution
309
+
310
+ ### BatchTool Integration
311
+
312
+ SPARC modes can be orchestrated using BatchTool for parallel and sequential execution:
313
+
314
+ #### Parallel Execution
315
+ ```bash
316
+ # Run multiple modes concurrently
317
+ batchtool run --parallel \
318
+ "npx claude-flow@alpha sparc run architect 'system design' --non-interactive" \
319
+ "npx claude-flow@alpha sparc run security-review 'security requirements' --non-interactive" \
320
+ "npx claude-flow@alpha sparc run researcher 'technology evaluation' --non-interactive"
321
+ ```
322
+
323
+ #### Sequential Pipeline
324
+ ```bash
325
+ # Sequential execution with result chaining
326
+ batchtool pipeline \
327
+ --stage1 "npx claude-flow@alpha sparc run ask 'gather requirements' --non-interactive" \
328
+ --stage2 "npx claude-flow@alpha sparc run architect 'design system' --non-interactive" \
329
+ --stage3 "npx claude-flow@alpha sparc run code 'implement features' --non-interactive" \
330
+ --stage4 "npx claude-flow@alpha sparc run tdd 'create test suite' --non-interactive"
331
+ ```
332
+
333
+ #### Boomerang Pattern
334
+ ```bash
335
+ # Iterative development with feedback loops
336
+ batchtool orchestrate --boomerang \
337
+ --research "npx claude-flow@alpha sparc run researcher 'best practices' --non-interactive" \
338
+ --design "npx claude-flow@alpha sparc run architect 'system design' --non-interactive" \
339
+ --implement "npx claude-flow@alpha sparc run code 'feature implementation' --non-interactive" \
340
+ --test "npx claude-flow@alpha sparc run tdd 'validation suite' --non-interactive" \
341
+ --refine "npx claude-flow@alpha sparc run optimizer 'performance tuning' --non-interactive"
342
+ ```
343
+
344
+ ### Full Development Pipeline
345
+
346
+ #### Complete Feature Development
347
+ ```bash
348
+ # End-to-end feature development pipeline
349
+ npx claude-flow@alpha sparc pipeline "user authentication system" \
350
+ --phases "ask,architect,security-review,code,tdd,optimizer,documenter" \
351
+ --namespace "auth_feature" \
352
+ --parallel-compatible "ask,security-review,documenter"
353
+ ```
354
+
355
+ #### Microservices Development
356
+ ```bash
357
+ # Parallel microservices development
358
+ batchtool run --max-parallel 3 \
359
+ "npx claude-flow@alpha sparc run code 'user service' --namespace users --non-interactive" \
360
+ "npx claude-flow@alpha sparc run code 'order service' --namespace orders --non-interactive" \
361
+ "npx claude-flow@alpha sparc run code 'payment service' --namespace payments --non-interactive" \
362
+ "npx claude-flow@alpha sparc run integration 'service communication' --namespace integration --non-interactive"
363
+ ```
364
+
365
+ ## TDD Workflow Integration
366
+
367
+ ### London School TDD Methodology
368
+
369
+ The SPARC TDD mode implements London School TDD with the following phases:
370
+
371
+ #### 1. Test Planning & Analysis (10 mins)
372
+ - Analyze requirements and existing architecture
373
+ - Define test boundaries and acceptance criteria
374
+ - Plan test structure (unit, integration, e2e)
375
+ - Identify test doubles needed (mocks, stubs, spies)
376
+
377
+ #### 2. Red Phase - Write Failing Tests (20 mins)
378
+ - Create comprehensive test structure
379
+ - Write tests following London School TDD principles
380
+ - Focus on behavior/contract tests with test doubles
381
+ - Ensure all tests fail with meaningful messages
382
+
383
+ #### 3. Green Phase - Minimal Implementation (20 mins)
384
+ - Implement only enough code to pass tests
385
+ - Make one test pass at a time
386
+ - Maintain modularity and proper error handling
387
+ - Track coverage as you progress
388
+
389
+ #### 4. Refactor Phase - Optimize & Clean (15 mins)
390
+ - Refactor while keeping tests green
391
+ - Extract common patterns and improve clarity
392
+ - Optimize algorithms and reduce duplication
393
+ - Improve test maintainability
394
+
395
+ #### 5. Documentation & Validation (10 mins)
396
+ - Generate coverage reports
397
+ - Document test scenarios and execution guide
398
+ - Set up CI/CD test configuration
399
+ - Validate against acceptance criteria
400
+
401
+ ### TDD Command Examples
402
+
403
+ ```bash
404
+ # Start interactive TDD workflow
405
+ npx claude-flow@alpha sparc tdd "shopping cart with discounts" --interactive
406
+
407
+ # Automated TDD with custom namespace
408
+ npx claude-flow@alpha sparc tdd "payment validation system" --namespace payments
409
+
410
+ # TDD with integration testing focus
411
+ npx claude-flow@alpha sparc run tdd "API endpoint with database" --namespace api_tests
412
+ ```
413
+
414
+ ## Memory Namespace Usage
415
+
416
+ ### Namespace Strategy
417
+
418
+ Memory namespaces organize context and enable coordination between modes:
419
+
420
+ #### Namespace Patterns
421
+ - `feature_<name>` - Feature development context
422
+ - `bug_<id>` - Bug fix tracking
423
+ - `arch_<system>` - Architecture planning
424
+ - `test_<suite>` - Test development
425
+ - `integration_<service>` - Integration work
426
+
427
+ #### Memory Operations
428
+ ```bash
429
+ # Store progress and context
430
+ npx claude-flow@alpha memory store <namespace>_progress "Current implementation status"
431
+ npx claude-flow@alpha memory store <namespace>_decisions "Key architectural decisions"
432
+ npx claude-flow@alpha memory store <namespace>_blockers "Current impediments"
433
+
434
+ # Query previous work and context
435
+ npx claude-flow@alpha memory query <namespace>
436
+ npx claude-flow@alpha memory query <namespace>_architecture
437
+ npx claude-flow@alpha memory query <namespace>_requirements
438
+
439
+ # List all namespaces
440
+ npx claude-flow@alpha memory list
441
+ ```
442
+
443
+ ### Cross-Mode Coordination
444
+
445
+ #### Shared Context Example
446
+ ```bash
447
+ # Architect stores system design
448
+ npx claude-flow@alpha sparc run architect "design user system" --namespace user_feature
449
+
450
+ # Coder implements based on architect's design
451
+ npx claude-flow@alpha sparc run code "implement user CRUD" --namespace user_feature
452
+
453
+ # Tester validates implementation
454
+ npx claude-flow@alpha sparc run tdd "test user operations" --namespace user_feature
455
+
456
+ # All modes share the user_feature namespace for context
457
+ ```
458
+
459
+ ## Practical Examples
460
+
461
+ ### Web Application Development
462
+
463
+ #### Full-Stack Development Pipeline
464
+ ```bash
465
+ # 1. Requirements and research
466
+ npx claude-flow@alpha sparc run ask "e-commerce requirements" --namespace ecommerce
467
+
468
+ # 2. System architecture
469
+ npx claude-flow@alpha sparc run architect "microservices design" --namespace ecommerce
470
+
471
+ # 3. Parallel service development
472
+ batchtool run --parallel \
473
+ "npx claude-flow@alpha sparc run code 'user service API' --namespace ecommerce_users --non-interactive" \
474
+ "npx claude-flow@alpha sparc run code 'product catalog API' --namespace ecommerce_products --non-interactive" \
475
+ "npx claude-flow@alpha sparc run code 'order processing API' --namespace ecommerce_orders --non-interactive"
476
+
477
+ # 4. Integration and testing
478
+ npx claude-flow@alpha sparc run integration "service communication" --namespace ecommerce
479
+ npx claude-flow@alpha sparc run tdd "end-to-end testing" --namespace ecommerce
480
+
481
+ # 5. Security and optimization
482
+ batchtool run --parallel \
483
+ "npx claude-flow@alpha sparc run security-review 'security audit' --namespace ecommerce --non-interactive" \
484
+ "npx claude-flow@alpha sparc run optimizer 'performance tuning' --namespace ecommerce --non-interactive"
485
+ ```
486
+
487
+ ### API Development
488
+
489
+ #### RESTful API with TDD
490
+ ```bash
491
+ # Test-driven API development
492
+ npx claude-flow@alpha sparc tdd "RESTful user management API" --namespace user_api
493
+
494
+ # Add authentication layer
495
+ npx claude-flow@alpha sparc run security-review "API authentication" --namespace user_api
496
+
497
+ # Performance optimization
498
+ npx claude-flow@alpha sparc run optimizer "API response times" --namespace user_api
499
+
500
+ # Documentation generation
501
+ npx claude-flow@alpha sparc run documenter "API documentation" --namespace user_api
502
+ ```
503
+
504
+ ### Bug Fix Workflow
505
+
506
+ #### Systematic Bug Resolution
507
+ ```bash
508
+ # 1. Research and reproduction
509
+ npx claude-flow@alpha sparc run debugger "investigate login failures" --namespace bug_1234
510
+
511
+ # 2. Root cause analysis
512
+ npx claude-flow@alpha sparc run analyst "analyze authentication flow" --namespace bug_1234
513
+
514
+ # 3. Fix implementation with tests
515
+ npx claude-flow@alpha sparc run tdd "fix and test authentication" --namespace bug_1234
516
+
517
+ # 4. Security validation
518
+ npx claude-flow@alpha sparc run security-review "validate auth fix" --namespace bug_1234
519
+ ```
520
+
521
+ ### DevOps and Infrastructure
522
+
523
+ #### CI/CD Pipeline Setup
524
+ ```bash
525
+ # Infrastructure planning
526
+ npx claude-flow@alpha sparc run architect "CI/CD architecture" --namespace devops
527
+
528
+ # Pipeline implementation
529
+ npx claude-flow@alpha sparc run devops "GitHub Actions workflow" --namespace devops
530
+
531
+ # Monitoring and alerts
532
+ npx claude-flow@alpha sparc run devops "application monitoring" --namespace devops
533
+
534
+ # Documentation
535
+ npx claude-flow@alpha sparc run documenter "deployment guide" --namespace devops
536
+ ```
537
+
538
+ ### Research and Analysis
539
+
540
+ #### Technology Evaluation
541
+ ```bash
542
+ # Research phase
543
+ npx claude-flow@alpha sparc run researcher "JavaScript framework comparison" --namespace tech_eval
544
+
545
+ # Architecture implications
546
+ npx claude-flow@alpha sparc run architect "framework integration design" --namespace tech_eval
547
+
548
+ # Prototype development
549
+ npx claude-flow@alpha sparc run code "proof of concept" --namespace tech_eval
550
+
551
+ # Analysis and recommendation
552
+ npx claude-flow@alpha sparc run analyst "framework recommendation" --namespace tech_eval
553
+ ```
554
+
555
+ ## Best Practices and Tips
556
+
557
+ ### Development Workflow
558
+
559
+ #### 1. Start with Specification
560
+ - Always begin with `ask` mode to clarify requirements
561
+ - Document assumptions and constraints
562
+ - Validate understanding before implementation
563
+
564
+ #### 2. Use Memory Effectively
565
+ - Create meaningful namespace hierarchies
566
+ - Store key decisions and context
567
+ - Query previous work before starting new tasks
568
+
569
+ #### 3. Leverage Parallel Execution
570
+ - Identify independent tasks for parallel execution
571
+ - Use BatchTool for concurrent mode execution
572
+ - Coordinate results through shared namespaces
573
+
574
+ #### 4. Follow TDD Principles
575
+ - Write tests before implementation when applicable
576
+ - Maintain high test coverage
577
+ - Use TDD mode for feature development
578
+
579
+ #### 5. Optimize Performance
580
+ - Profile before optimizing
581
+ - Use optimizer mode for performance improvements
582
+ - Balance readability with performance
583
+
584
+ ### Quality Assurance
585
+
586
+ #### 1. Security First
587
+ - Always run security-review for sensitive features
588
+ - Follow OWASP guidelines
589
+ - Validate input and sanitize output
590
+
591
+ #### 2. Code Quality
592
+ - Use reviewer mode for code quality checks
593
+ - Follow established coding conventions
594
+ - Maintain documentation alongside code
595
+
596
+ #### 3. Testing Strategy
597
+ - Use comprehensive testing approach (unit, integration, e2e)
598
+ - Test edge cases and error conditions
599
+ - Automate test execution in CI/CD
600
+
601
+ ### Collaboration and Documentation
602
+
603
+ #### 1. Cross-Mode Coordination
604
+ - Share context through memory namespaces
605
+ - Use consistent naming conventions
606
+ - Document inter-mode dependencies
607
+
608
+ #### 2. Documentation Maintenance
609
+ - Keep documentation current with code changes
610
+ - Use documenter mode for comprehensive docs
611
+ - Include examples and usage patterns
612
+
613
+ #### 3. Progress Tracking
614
+ - Store progress updates in memory
615
+ - Use meaningful commit messages
616
+ - Track blockers and resolutions
617
+
618
+ ### Common Patterns
619
+
620
+ #### 1. Boomerang Development
621
+ Research → Design → Implement → Test → Optimize → Loop back
622
+
623
+ #### 2. Parallel Feature Development
624
+ Multiple features developed concurrently with coordination
625
+
626
+ #### 3. Pipeline Development
627
+ Sequential phases with hand-off between specialized modes
628
+
629
+ #### 4. Iterative Refinement
630
+ Continuous improvement through multiple optimization cycles
631
+
632
+ ### Performance Optimization
633
+
634
+ #### 1. Batch Operations
635
+ - Use batch file operations when possible
636
+ - Minimize context switching between modes
637
+ - Leverage parallel execution for independent tasks
638
+
639
+ #### 2. Memory Management
640
+ - Use focused memory namespaces
641
+ - Clean up obsolete context
642
+ - Share common context efficiently
643
+
644
+ #### 3. Resource Utilization
645
+ - Monitor resource usage during intensive operations
646
+ - Use non-interactive mode for automation
647
+ - Balance parallelism with resource constraints
648
+
649
+ ### Troubleshooting
650
+
651
+ #### Common Issues and Solutions
652
+
653
+ 1. **Mode Not Found**
654
+ - Ensure `.roomodes` file exists in project directory
655
+ - Run `npx claude-flow@alpha init --sparc` to set up SPARC environment
656
+
657
+ 2. **Permission Issues**
658
+ - Use `--enable-permissions` for manual control
659
+ - Default behavior uses `--dangerously-skip-permissions` for efficiency
660
+
661
+ 3. **Memory Namespace Conflicts**
662
+ - Use unique namespace names
663
+ - Query existing namespaces with `npx claude-flow@alpha memory list`
664
+
665
+ 4. **BatchTool Integration**
666
+ - Ensure BatchTool is installed and configured
667
+ - Use `--non-interactive` flag for parallel execution
668
+
669
+ 5. **Performance Issues**
670
+ - Use `--verbose` flag for debugging
671
+ - Monitor resource usage
672
+ - Consider reducing parallelism
673
+
674
+ ### Advanced Configuration
675
+
676
+ #### Custom Mode Development
677
+ Create custom SPARC modes by extending the `.roomodes` configuration:
678
+
679
+ ```json
680
+ {
681
+ "customModes": [
682
+ {
683
+ "name": "Custom Mode",
684
+ "slug": "custom",
685
+ "roleDefinition": "Custom role description",
686
+ "customInstructions": "Specific instructions",
687
+ "groups": ["read", "edit", "command"],
688
+ "source": "custom"
689
+ }
690
+ ]
691
+ }
692
+ ```
693
+
694
+ #### Integration with IDEs
695
+ - Configure IDE to recognize SPARC commands
696
+ - Set up keyboard shortcuts for common operations
697
+ - Integrate with IDE task runners
698
+
699
+ #### CI/CD Integration
700
+ - Use SPARC modes in automated pipelines
701
+ - Configure parallel execution for build processes
702
+ - Integrate memory persistence for context sharing
703
+
704
+ ---
705
+
706
+ ## Summary
707
+
708
+ SPARC provides a comprehensive, mode-based development methodology that transforms ad-hoc coding into systematic engineering. By leveraging specialized modes, memory persistence, and parallel execution capabilities, SPARC enables efficient, high-quality software development at scale.
709
+
710
+ Key advantages:
711
+ - **Systematic Approach**: Structured methodology reduces errors
712
+ - **Mode Specialization**: Optimized environments for specific tasks
713
+ - **Parallel Execution**: Concurrent development with BatchTool integration
714
+ - **Memory Persistence**: Context sharing across development sessions
715
+ - **Quality Assurance**: Built-in best practices and validation
716
+
717
+ Start with `npx claude-flow@alpha sparc modes` to explore available modes, and use `npx claude-flow@alpha sparc run <mode> "<task>"` to begin systematic development with SPARC.