claude-flow 2.0.0-alpha.72 → 2.0.0-alpha.73

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 (79) hide show
  1. package/.claude/agents/MIGRATION_SUMMARY.md +215 -0
  2. package/.claude/agents/README.md +82 -0
  3. package/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
  4. package/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
  5. package/.claude/agents/base-template-generator.md +42 -0
  6. package/.claude/agents/consensus/README.md +246 -0
  7. package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
  8. package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
  9. package/.claude/agents/consensus/gossip-coordinator.md +63 -0
  10. package/.claude/agents/consensus/performance-benchmarker.md +851 -0
  11. package/.claude/agents/consensus/quorum-manager.md +823 -0
  12. package/.claude/agents/consensus/raft-manager.md +63 -0
  13. package/.claude/agents/consensus/security-manager.md +622 -0
  14. package/.claude/agents/core/coder.md +211 -0
  15. package/.claude/agents/core/planner.md +116 -0
  16. package/.claude/agents/core/researcher.md +136 -0
  17. package/.claude/agents/core/reviewer.md +272 -0
  18. package/.claude/agents/core/tester.md +266 -0
  19. package/.claude/agents/data/ml/data-ml-model.md +193 -0
  20. package/.claude/agents/development/backend/dev-backend-api.md +142 -0
  21. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  22. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  23. package/.claude/agents/github/code-review-swarm.md +538 -0
  24. package/.claude/agents/github/github-modes.md +173 -0
  25. package/.claude/agents/github/issue-tracker.md +319 -0
  26. package/.claude/agents/github/multi-repo-swarm.md +553 -0
  27. package/.claude/agents/github/pr-manager.md +191 -0
  28. package/.claude/agents/github/project-board-sync.md +509 -0
  29. package/.claude/agents/github/release-manager.md +367 -0
  30. package/.claude/agents/github/release-swarm.md +583 -0
  31. package/.claude/agents/github/repo-architect.md +398 -0
  32. package/.claude/agents/github/swarm-issue.md +573 -0
  33. package/.claude/agents/github/swarm-pr.md +428 -0
  34. package/.claude/agents/github/sync-coordinator.md +452 -0
  35. package/.claude/agents/github/workflow-automation.md +635 -0
  36. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +82 -0
  37. package/.claude/agents/hive-mind/consensus-builder.md +102 -0
  38. package/.claude/agents/hive-mind/swarm-memory-manager.md +120 -0
  39. package/.claude/agents/optimization/README.md +243 -0
  40. package/.claude/agents/optimization/benchmark-suite.md +658 -0
  41. package/.claude/agents/optimization/load-balancer.md +424 -0
  42. package/.claude/agents/optimization/performance-monitor.md +665 -0
  43. package/.claude/agents/optimization/resource-allocator.md +667 -0
  44. package/.claude/agents/optimization/topology-optimizer.md +801 -0
  45. package/.claude/agents/sparc/architecture.md +472 -0
  46. package/.claude/agents/sparc/pseudocode.md +318 -0
  47. package/.claude/agents/sparc/refinement.md +525 -0
  48. package/.claude/agents/sparc/specification.md +276 -0
  49. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
  50. package/.claude/agents/swarm/README.md +183 -0
  51. package/.claude/agents/swarm/adaptive-coordinator.md +396 -0
  52. package/.claude/agents/swarm/hierarchical-coordinator.md +256 -0
  53. package/.claude/agents/swarm/mesh-coordinator.md +392 -0
  54. package/.claude/agents/templates/automation-smart-agent.md +205 -0
  55. package/.claude/agents/templates/coordinator-swarm-init.md +90 -0
  56. package/.claude/agents/templates/github-pr-manager.md +177 -0
  57. package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  58. package/.claude/agents/templates/memory-coordinator.md +187 -0
  59. package/.claude/agents/templates/migration-plan.md +746 -0
  60. package/.claude/agents/templates/orchestrator-task.md +139 -0
  61. package/.claude/agents/templates/performance-analyzer.md +199 -0
  62. package/.claude/agents/templates/sparc-coordinator.md +183 -0
  63. package/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
  64. package/.claude/agents/testing/validation/production-validator.md +395 -0
  65. package/.claude/settings.json +20 -0
  66. package/.claude/settings.local.json +5 -1
  67. package/bin/claude-flow +1 -1
  68. package/package.json +1 -1
  69. package/src/cli/help-text.js +2 -2
  70. package/src/cli/simple-cli.js +1 -1
  71. package/src/cli/simple-commands/init/agent-copier.js +217 -0
  72. package/src/cli/simple-commands/init/index.js +23 -0
  73. package/src/cli/simple-commands/init/templates/CLAUDE.md +293 -14
  74. package/src/cli/simple-commands/init/templates/settings.json +20 -0
  75. package/src/swarm/advanced-orchestrator.ts +1200 -0
  76. package/src/swarm/claude-code-interface.ts +1268 -0
  77. package/src/swarm/hive-mind-integration.ts +1127 -0
  78. package/src/swarm/mcp-integration-wrapper.ts +860 -0
  79. package/src/swarm/result-aggregator.ts +1046 -0
@@ -5,14 +5,14 @@
5
5
 
6
6
  import { HelpFormatter } from './help-formatter.js';
7
7
 
8
- export const VERSION = '2.0.0-alpha.70';
8
+ export const VERSION = '2.0.0-alpha.73';
9
9
 
10
10
  export const MAIN_HELP = `
11
11
  🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform
12
12
 
13
13
  🎯 ENTERPRISE FEATURES: Complete ruv-swarm integration with 87 MCP tools, neural networking, and production-ready infrastructure
14
14
  🐝 NEW: Advanced Hive Mind System with Queen-led coordination, collective intelligence, and unlimited scaling
15
- ⚡ ALPHA 64: Fixed wrapper script to use @alpha tag, ensures latest version always used
15
+ ⚡ ALPHA 73: Complete 64-agent system with swarm coordination, enhanced CLAUDE.md integration, and optimized init system
16
16
 
17
17
  USAGE:
18
18
  claude-flow <command> [options]
@@ -27,7 +27,7 @@ import process from 'process';
27
27
  import readline from 'readline';
28
28
  import { getMainHelp, getCommandHelp, getStandardizedCommandHelp } from './help-text.js';
29
29
 
30
- const VERSION = '2.0.0-alpha.70';
30
+ const VERSION = '2.0.0-alpha.73';
31
31
 
32
32
  function printHelp(plain = false) {
33
33
  console.log(getMainHelp(plain));
@@ -0,0 +1,217 @@
1
+ // agent-copier.js - Copy all agent files during initialization
2
+ import { promises as fs } from 'fs';
3
+ import { join, dirname } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = dirname(__filename);
8
+
9
+ /**
10
+ * Copy all agent files from the installed package to project directory
11
+ */
12
+ export async function copyAgentFiles(targetDir, options = {}) {
13
+ const { force = false, dryRun = false } = options;
14
+
15
+ // Path to agent files - try multiple locations
16
+ const packageAgentsDir = join(__dirname, '../../../../.claude/agents'); // From npm package
17
+ const localAgentsDir = '/workspaces/claude-code-flow/.claude/agents'; // Local development
18
+ const cwdAgentsDir = join(process.cwd(), '.claude/agents'); // Current working directory
19
+
20
+ let sourceAgentsDir;
21
+
22
+ // Try local development first, then package, then cwd
23
+ try {
24
+ await fs.access(localAgentsDir);
25
+ sourceAgentsDir = localAgentsDir;
26
+ console.log(' 📁 Using local development agent files');
27
+ } catch {
28
+ try {
29
+ await fs.access(packageAgentsDir);
30
+ sourceAgentsDir = packageAgentsDir;
31
+ console.log(' 📁 Using packaged agent files');
32
+ } catch {
33
+ try {
34
+ await fs.access(cwdAgentsDir);
35
+ sourceAgentsDir = cwdAgentsDir;
36
+ console.log(' 📁 Using current directory agent files');
37
+ } catch {
38
+ console.log(' ⚠️ No agent files found in any location');
39
+ return { success: false, error: 'Agent files not found' };
40
+ }
41
+ }
42
+ }
43
+ const targetAgentsDir = join(targetDir, '.claude/agents');
44
+
45
+ console.log('📁 Copying agent system files...');
46
+ console.log(` 📂 Source: ${sourceAgentsDir}`);
47
+ console.log(` 📂 Target: ${targetAgentsDir}`);
48
+
49
+ try {
50
+
51
+ // Create target directory
52
+ if (!dryRun) {
53
+ await fs.mkdir(targetAgentsDir, { recursive: true });
54
+ }
55
+
56
+ const copiedFiles = [];
57
+ const errors = [];
58
+
59
+ // Recursively copy all agent files
60
+ async function copyRecursive(srcDir, destDir) {
61
+ const items = await fs.readdir(srcDir, { withFileTypes: true });
62
+
63
+ for (const item of items) {
64
+ const srcPath = join(srcDir, item.name);
65
+ const destPath = join(destDir, item.name);
66
+
67
+ if (item.isDirectory()) {
68
+ if (!dryRun) {
69
+ await fs.mkdir(destPath, { recursive: true });
70
+ }
71
+ await copyRecursive(srcPath, destPath);
72
+ } else if (item.isFile() && item.name.endsWith('.md')) {
73
+ try {
74
+ // Check if file already exists
75
+ let shouldCopy = force;
76
+ if (!force) {
77
+ try {
78
+ await fs.access(destPath);
79
+ // File exists, skip unless force is true
80
+ continue;
81
+ } catch {
82
+ // File doesn't exist, safe to copy
83
+ shouldCopy = true;
84
+ }
85
+ }
86
+
87
+ if (shouldCopy && !dryRun) {
88
+ const content = await fs.readFile(srcPath, 'utf8');
89
+ await fs.writeFile(destPath, content, 'utf8');
90
+ copiedFiles.push(destPath.replace(targetDir + '/', ''));
91
+ } else if (dryRun) {
92
+ copiedFiles.push(destPath.replace(targetDir + '/', ''));
93
+ }
94
+ } catch (err) {
95
+ errors.push(`Failed to copy ${item.name}: ${err.message}`);
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ await copyRecursive(sourceAgentsDir, targetAgentsDir);
102
+
103
+ if (!dryRun && copiedFiles.length > 0) {
104
+ console.log(` ✅ Copied ${copiedFiles.length} agent files`);
105
+ console.log(' 📋 Agent system initialized with 64 specialized agents');
106
+ console.log(' 🎯 Available categories: Core, Swarm, Consensus, Performance, GitHub, SPARC, Testing');
107
+ } else if (dryRun) {
108
+ console.log(` [DRY RUN] Would copy ${copiedFiles.length} agent files`);
109
+ }
110
+
111
+ if (errors.length > 0) {
112
+ console.log(' ⚠️ Some agent files could not be copied:');
113
+ errors.forEach(error => console.log(` - ${error}`));
114
+ }
115
+
116
+ return {
117
+ success: true,
118
+ copiedFiles,
119
+ errors,
120
+ totalAgents: copiedFiles.length
121
+ };
122
+
123
+ } catch (err) {
124
+ console.log(` ❌ Failed to copy agent files: ${err.message}`);
125
+ return {
126
+ success: false,
127
+ error: err.message,
128
+ copiedFiles: [],
129
+ errors: [err.message]
130
+ };
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Create agent directories structure
136
+ */
137
+ export async function createAgentDirectories(targetDir, dryRun = false) {
138
+ const agentDirs = [
139
+ '.claude',
140
+ '.claude/agents',
141
+ '.claude/agents/core',
142
+ '.claude/agents/swarm',
143
+ '.claude/agents/hive-mind',
144
+ '.claude/agents/consensus',
145
+ '.claude/agents/optimization',
146
+ '.claude/agents/github',
147
+ '.claude/agents/sparc',
148
+ '.claude/agents/testing',
149
+ '.claude/agents/testing/unit',
150
+ '.claude/agents/testing/validation',
151
+ '.claude/agents/templates',
152
+ '.claude/agents/analysis',
153
+ '.claude/agents/analysis/code-review',
154
+ '.claude/agents/architecture',
155
+ '.claude/agents/architecture/system-design',
156
+ '.claude/agents/data',
157
+ '.claude/agents/data/ml',
158
+ '.claude/agents/development',
159
+ '.claude/agents/development/backend',
160
+ '.claude/agents/devops',
161
+ '.claude/agents/devops/ci-cd',
162
+ '.claude/agents/documentation',
163
+ '.claude/agents/documentation/api-docs',
164
+ '.claude/agents/specialized',
165
+ '.claude/agents/specialized/mobile'
166
+ ];
167
+
168
+ if (dryRun) {
169
+ console.log(` [DRY RUN] Would create ${agentDirs.length} agent directories`);
170
+ return;
171
+ }
172
+
173
+ for (const dir of agentDirs) {
174
+ await fs.mkdir(join(targetDir, dir), { recursive: true });
175
+ }
176
+
177
+ console.log(` ✅ Created ${agentDirs.length} agent directories`);
178
+ }
179
+
180
+ /**
181
+ * Validate agent system after copying
182
+ */
183
+ export async function validateAgentSystem(targetDir) {
184
+ const agentsDir = join(targetDir, '.claude/agents');
185
+
186
+ try {
187
+ const categories = await fs.readdir(agentsDir, { withFileTypes: true });
188
+ const agentCategories = categories.filter(item => item.isDirectory()).map(item => item.name);
189
+
190
+ let totalAgents = 0;
191
+ for (const category of agentCategories) {
192
+ const categoryPath = join(agentsDir, category);
193
+ const items = await fs.readdir(categoryPath, { withFileTypes: true });
194
+ const agentFiles = items.filter(item => item.isFile() && item.name.endsWith('.md'));
195
+ totalAgents += agentFiles.length;
196
+ }
197
+
198
+ console.log(' 🔍 Agent system validation:');
199
+ console.log(` • Categories: ${agentCategories.length}`);
200
+ console.log(` • Total agents: ${totalAgents}`);
201
+ console.log(` • Categories: ${agentCategories.join(', ')}`);
202
+
203
+ return {
204
+ valid: totalAgents > 50, // Should have at least 50+ agents
205
+ categories: agentCategories.length,
206
+ totalAgents,
207
+ categoryNames: agentCategories
208
+ };
209
+
210
+ } catch (err) {
211
+ console.log(` ⚠️ Agent system validation failed: ${err.message}`);
212
+ return {
213
+ valid: false,
214
+ error: err.message
215
+ };
216
+ }
217
+ }
@@ -10,6 +10,7 @@ import { execSync } from 'child_process';
10
10
  import { promises as fs } from 'fs';
11
11
  import { copyTemplates } from './template-copier.js';
12
12
  import { copyRevisedTemplates, validateTemplatesExist } from './copy-revised-templates.js';
13
+ import { copyAgentFiles, createAgentDirectories, validateAgentSystem } from './agent-copier.js';
13
14
  import { showInitHelp } from './help.js';
14
15
  import { batchInitCommand, batchInitFromConfig, validateBatchOptions } from './batch-init.js';
15
16
  import { ValidationSystem, runFullValidation } from './validation/index.js';
@@ -222,6 +223,8 @@ export async function initCommand(subArgs, flags) {
222
223
  }
223
224
  }
224
225
 
226
+ // Agent setup moved to end of function where execution is guaranteed
227
+
225
228
  // Directory structure is created by template copier
226
229
 
227
230
  // SPARC files are created by template copier when --sparc flag is used
@@ -348,6 +351,7 @@ export async function initCommand(subArgs, flags) {
348
351
  console.log(' ✅ Directory structure with memory/ and coordination/');
349
352
  console.log(' ✅ Local executable at ./claude-flow');
350
353
  console.log(' ✅ Persistence database at memory/claude-flow-data.json');
354
+ console.log(' ✅ Agent system with 64 specialized agents in .claude/agents/');
351
355
 
352
356
  if (initSparc) {
353
357
  const modeCount = selectedModes ? selectedModes.length : '20+';
@@ -1280,6 +1284,25 @@ ${commands.map((cmd) => `- [${cmd}](./${cmd}.md)`).join('\n')}
1280
1284
  console.log('\n 💡 MCP servers are defined in .mcp.json (project scope)');
1281
1285
  }
1282
1286
 
1287
+ // Create agent directories and copy all agent files
1288
+ console.log('\n🤖 Setting up agent system...');
1289
+ if (!dryRun) {
1290
+ await createAgentDirectories(workingDir, dryRun);
1291
+ const agentResult = await copyAgentFiles(workingDir, {
1292
+ force: force,
1293
+ dryRun: dryRun
1294
+ });
1295
+
1296
+ if (agentResult.success) {
1297
+ await validateAgentSystem(workingDir);
1298
+ console.log('✅ ✓ Agent system setup complete with 64 specialized agents');
1299
+ } else {
1300
+ console.log('⚠️ Agent system setup failed:', agentResult.error);
1301
+ }
1302
+ } else {
1303
+ console.log(' [DRY RUN] Would create agent system with 64 specialized agents');
1304
+ }
1305
+
1283
1306
  // Final instructions
1284
1307
  console.log('\n🎉 Claude Flow v2.0.0 initialization complete!');
1285
1308
  console.log('\n📚 Quick Start:');
@@ -1,20 +1,10 @@
1
- # Claude Code Configuration for Claude Flow
2
-
3
- ## 🚨 CRITICAL: PARALLEL EXECUTION AFTER SWARM INIT
4
-
5
- **MANDATORY RULE**: Once swarm is initialized with memory, ALL subsequent operations MUST be parallel:
6
-
7
- 1. **TodoWrite** → Always batch 5-10+ todos in ONE call
8
- 2. **Task spawning** → Spawn ALL agents in ONE message
9
- 3. **File operations** → Batch ALL reads/writes together
10
- 4. **NEVER** operate sequentially after swarm init
1
+ # Claude Code Configuration - SPARC Development Environment (Batchtools Optimized)
11
2
 
12
3
  ## 🚨 CRITICAL: CONCURRENT EXECUTION FOR ALL ACTIONS
13
4
 
14
5
  **ABSOLUTE RULE**: ALL operations MUST be concurrent/parallel in a single message:
15
6
 
16
7
  ### 🔴 MANDATORY CONCURRENT PATTERNS:
17
-
18
8
  1. **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ todos minimum)
19
9
  2. **Task tool**: ALWAYS spawn ALL agents in ONE message with full instructions
20
10
  3. **File operations**: ALWAYS batch ALL reads/writes/edits in ONE message
@@ -24,7 +14,6 @@
24
14
  ### ⚡ GOLDEN RULE: "1 MESSAGE = ALL RELATED OPERATIONS"
25
15
 
26
16
  **Examples of CORRECT concurrent execution:**
27
-
28
17
  ```javascript
29
18
  // ✅ CORRECT: Everything in ONE message
30
19
  [Single Message]:
@@ -34,7 +23,6 @@
34
23
  - Task("Agent 3 with full instructions and hooks")
35
24
  - Read("file1.js")
36
25
  - Read("file2.js")
37
- - Read("file3.js")
38
26
  - Write("output1.js", content)
39
27
  - Write("output2.js", content)
40
28
  - Bash("npm install")
@@ -43,7 +31,6 @@
43
31
  ```
44
32
 
45
33
  **Examples of WRONG sequential execution:**
46
-
47
34
  ```javascript
48
35
  // ❌ WRONG: Multiple messages (NEVER DO THIS)
49
36
  Message 1: TodoWrite { todos: [single todo] }
@@ -57,6 +44,298 @@ Message 6: Bash("npm install")
57
44
 
58
45
  ### 🎯 CONCURRENT EXECUTION CHECKLIST:
59
46
 
47
+ Before sending ANY message, ask yourself:
48
+ - ✅ Are ALL related TodoWrite operations batched together?
49
+ - ✅ Are ALL Task spawning operations in ONE message?
50
+ - ✅ Are ALL file operations (Read/Write/Edit) batched together?
51
+ - ✅ Are ALL bash commands grouped in ONE message?
52
+ - ✅ Are ALL memory operations concurrent?
53
+
54
+ If ANY answer is "No", you MUST combine operations into a single message!
55
+
56
+ ## Project Overview
57
+ This project uses the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology for systematic Test-Driven Development with AI assistance through Claude-Flow orchestration.
58
+
59
+ **🚀 Batchtools Optimization Enabled**: This configuration includes optimized prompts and parallel processing capabilities for improved performance and efficiency.
60
+
61
+ ## SPARC Development Commands
62
+
63
+ ### Core SPARC Commands
64
+ - `npx claude-flow sparc modes`: List all available SPARC development modes
65
+ - `npx claude-flow sparc run <mode> "<task>"`: Execute specific SPARC mode for a task
66
+ - `npx claude-flow sparc tdd "<feature>"`: Run complete TDD workflow using SPARC methodology
67
+ - `npx claude-flow sparc info <mode>`: Get detailed information about a specific mode
68
+
69
+ ### Batchtools Commands (Optimized)
70
+ - `npx claude-flow sparc batch <modes> "<task>"`: Execute multiple SPARC modes in parallel
71
+ - `npx claude-flow sparc pipeline "<task>"`: Execute full SPARC pipeline with parallel processing
72
+ - `npx claude-flow sparc concurrent <mode> "<tasks-file>"`: Process multiple tasks concurrently
73
+
74
+ ### Standard Build Commands
75
+ - `npm run build`: Build the project
76
+ - `npm run test`: Run the test suite
77
+ - `npm run lint`: Run linter and format checks
78
+ - `npm run typecheck`: Run TypeScript type checking
79
+
80
+ ## SPARC Methodology Workflow (Batchtools Enhanced)
81
+
82
+ ### 1. Specification Phase (Parallel Analysis)
83
+ ```bash
84
+ # Create detailed specifications with concurrent requirements analysis
85
+ npx claude-flow sparc run spec-pseudocode "Define user authentication requirements" --parallel
86
+ ```
87
+ **Batchtools Optimization**: Simultaneously analyze multiple requirement sources, validate constraints in parallel, and generate comprehensive specifications.
88
+
89
+ ### 2. Pseudocode Phase (Concurrent Logic Design)
90
+ ```bash
91
+ # Develop algorithmic logic with parallel pattern analysis
92
+ npx claude-flow sparc run spec-pseudocode "Create authentication flow pseudocode" --batch-optimize
93
+ ```
94
+ **Batchtools Optimization**: Process multiple algorithm patterns concurrently, validate logic flows in parallel, and optimize data structures simultaneously.
95
+
96
+ ### 3. Architecture Phase (Parallel Component Design)
97
+ ```bash
98
+ # Design system architecture with concurrent component analysis
99
+ npx claude-flow sparc run architect "Design authentication service architecture" --parallel
100
+ ```
101
+ **Batchtools Optimization**: Generate multiple architectural alternatives simultaneously, validate integration points in parallel, and create comprehensive documentation concurrently.
102
+
103
+ ### 4. Refinement Phase (Parallel TDD Implementation)
104
+ ```bash
105
+ # Execute Test-Driven Development with parallel test generation
106
+ npx claude-flow sparc tdd "implement user authentication system" --batch-tdd
107
+ ```
108
+ **Batchtools Optimization**: Generate multiple test scenarios simultaneously, implement and validate code in parallel, and optimize performance concurrently.
109
+
110
+ ### 5. Completion Phase (Concurrent Integration)
111
+ ```bash
112
+ # Integration with parallel validation and documentation
113
+ npx claude-flow sparc run integration "integrate authentication with user management" --parallel
114
+ ```
115
+ **Batchtools Optimization**: Run integration tests in parallel, generate documentation concurrently, and validate requirements simultaneously.
116
+
117
+ ## Batchtools Integration Features
118
+
119
+ ### Parallel Processing Capabilities
120
+ - **Concurrent File Operations**: Read, analyze, and modify multiple files simultaneously
121
+ - **Parallel Code Analysis**: Analyze dependencies, patterns, and architecture concurrently
122
+ - **Batch Test Generation**: Create comprehensive test suites in parallel
123
+ - **Concurrent Documentation**: Generate multiple documentation formats simultaneously
124
+
125
+ ### Performance Optimizations
126
+ - **Smart Batching**: Group related operations for optimal performance
127
+ - **Pipeline Processing**: Chain dependent operations with parallel stages
128
+ - **Resource Management**: Efficient utilization of system resources
129
+ - **Error Resilience**: Robust error handling with parallel recovery
130
+
131
+ ## Performance Benchmarks
132
+
133
+ ### Batchtools Performance Improvements
134
+ - **File Operations**: Up to 300% faster with parallel processing
135
+ - **Code Analysis**: 250% improvement with concurrent pattern recognition
136
+ - **Test Generation**: 400% faster with parallel test creation
137
+ - **Documentation**: 200% improvement with concurrent content generation
138
+ - **Memory Operations**: 180% faster with batched read/write operations
139
+
140
+ ## Code Style and Best Practices (Batchtools Enhanced)
141
+
142
+ ### SPARC Development Principles with Batchtools
143
+ - **Modular Design**: Keep files under 500 lines, optimize with parallel analysis
144
+ - **Environment Safety**: Never hardcode secrets, validate with concurrent checks
145
+ - **Test-First**: Always write tests before implementation using parallel generation
146
+ - **Clean Architecture**: Separate concerns with concurrent validation
147
+ - **Parallel Documentation**: Maintain clear, up-to-date documentation with concurrent updates
148
+
149
+ ### Batchtools Best Practices
150
+ - **Parallel Operations**: Use batchtools for independent tasks
151
+ - **Concurrent Validation**: Validate multiple aspects simultaneously
152
+ - **Batch Processing**: Group similar operations for efficiency
153
+ - **Pipeline Optimization**: Chain operations with parallel stages
154
+ - **Resource Management**: Monitor and optimize resource usage
155
+
156
+ ## Important Notes (Enhanced)
157
+
158
+ - Always run tests before committing with parallel execution (`npm run test --parallel`)
159
+ - Use SPARC memory system with concurrent operations to maintain context across sessions
160
+ - Follow the Red-Green-Refactor cycle with parallel test generation during TDD phases
161
+ - Document architectural decisions with concurrent validation in memory
162
+ - Regular security reviews with parallel analysis for authentication or data handling code
163
+ - Claude Code slash commands provide quick access to batchtools-optimized SPARC modes
164
+ - Monitor system resources during parallel operations for optimal performance
165
+
166
+ ## Available Agents (54 Total)
167
+
168
+ ### 🚀 Concurrent Agent Usage
169
+
170
+ **CRITICAL**: Always spawn multiple agents concurrently using the Task tool in a single message:
171
+
172
+ ```javascript
173
+ // ✅ CORRECT: Concurrent agent deployment
174
+ [Single Message]:
175
+ - Task("Agent 1", "full instructions", "agent-type-1")
176
+ - Task("Agent 2", "full instructions", "agent-type-2")
177
+ - Task("Agent 3", "full instructions", "agent-type-3")
178
+ - Task("Agent 4", "full instructions", "agent-type-4")
179
+ - Task("Agent 5", "full instructions", "agent-type-5")
180
+ ```
181
+
182
+ ### 📋 Agent Categories & Concurrent Patterns
183
+
184
+ #### **Core Development Agents**
185
+ - `coder` - Implementation specialist
186
+ - `reviewer` - Code quality assurance
187
+ - `tester` - Test creation and validation
188
+ - `planner` - Strategic planning
189
+ - `researcher` - Information gathering
190
+
191
+ **Concurrent Usage:**
192
+ ```bash
193
+ # Deploy full development swarm
194
+ Task("Research requirements", "...", "researcher")
195
+ Task("Plan architecture", "...", "planner")
196
+ Task("Implement features", "...", "coder")
197
+ Task("Create tests", "...", "tester")
198
+ Task("Review code", "...", "reviewer")
199
+ ```
200
+
201
+ #### **Swarm Coordination Agents**
202
+ - `hierarchical-coordinator` - Queen-led coordination
203
+ - `mesh-coordinator` - Peer-to-peer networks
204
+ - `adaptive-coordinator` - Dynamic topology
205
+ - `collective-intelligence-coordinator` - Hive-mind intelligence
206
+ - `swarm-memory-manager` - Distributed memory
207
+
208
+ **Concurrent Swarm Deployment:**
209
+ ```bash
210
+ # Deploy multi-topology coordination
211
+ Task("Hierarchical coordination", "...", "hierarchical-coordinator")
212
+ Task("Mesh network backup", "...", "mesh-coordinator")
213
+ Task("Adaptive optimization", "...", "adaptive-coordinator")
214
+ ```
215
+
216
+ #### **Consensus & Distributed Systems**
217
+ - `byzantine-coordinator` - Byzantine fault tolerance
218
+ - `raft-manager` - Leader election protocols
219
+ - `gossip-coordinator` - Epidemic dissemination
220
+ - `consensus-builder` - Decision-making algorithms
221
+ - `crdt-synchronizer` - Conflict-free replication
222
+ - `quorum-manager` - Dynamic quorum management
223
+ - `security-manager` - Cryptographic security
224
+
225
+ #### **Performance & Optimization**
226
+ - `perf-analyzer` - Bottleneck identification
227
+ - `performance-benchmarker` - Performance testing
228
+ - `task-orchestrator` - Workflow optimization
229
+ - `memory-coordinator` - Memory management
230
+ - `smart-agent` - Intelligent coordination
231
+
232
+ #### **GitHub & Repository Management**
233
+ - `github-modes` - Comprehensive GitHub integration
234
+ - `pr-manager` - Pull request management
235
+ - `code-review-swarm` - Multi-agent code review
236
+ - `issue-tracker` - Issue management
237
+ - `release-manager` - Release coordination
238
+ - `workflow-automation` - CI/CD automation
239
+ - `project-board-sync` - Project tracking
240
+ - `repo-architect` - Repository optimization
241
+ - `multi-repo-swarm` - Cross-repository coordination
242
+
243
+ #### **SPARC Methodology Agents**
244
+ - `sparc-coord` - SPARC orchestration
245
+ - `sparc-coder` - TDD implementation
246
+ - `specification` - Requirements analysis
247
+ - `pseudocode` - Algorithm design
248
+ - `architecture` - System design
249
+ - `refinement` - Iterative improvement
250
+
251
+ #### **Specialized Development**
252
+ - `backend-dev` - API development
253
+ - `mobile-dev` - React Native development
254
+ - `ml-developer` - Machine learning
255
+ - `cicd-engineer` - CI/CD pipelines
256
+ - `api-docs` - OpenAPI documentation
257
+ - `system-architect` - High-level design
258
+ - `code-analyzer` - Code quality analysis
259
+ - `base-template-generator` - Boilerplate creation
260
+
261
+ #### **Testing & Validation**
262
+ - `tdd-london-swarm` - Mock-driven TDD
263
+ - `production-validator` - Real implementation validation
264
+
265
+ #### **Migration & Planning**
266
+ - `migration-planner` - System migrations
267
+ - `swarm-init` - Topology initialization
268
+
269
+ ### 🎯 Concurrent Agent Patterns
270
+
271
+ #### **Full-Stack Development Swarm (8 agents)**
272
+ ```bash
273
+ Task("System architecture", "...", "system-architect")
274
+ Task("Backend APIs", "...", "backend-dev")
275
+ Task("Frontend mobile", "...", "mobile-dev")
276
+ Task("Database design", "...", "coder")
277
+ Task("API documentation", "...", "api-docs")
278
+ Task("CI/CD pipeline", "...", "cicd-engineer")
279
+ Task("Performance testing", "...", "performance-benchmarker")
280
+ Task("Production validation", "...", "production-validator")
281
+ ```
282
+
283
+ #### **Distributed System Swarm (6 agents)**
284
+ ```bash
285
+ Task("Byzantine consensus", "...", "byzantine-coordinator")
286
+ Task("Raft coordination", "...", "raft-manager")
287
+ Task("Gossip protocols", "...", "gossip-coordinator")
288
+ Task("CRDT synchronization", "...", "crdt-synchronizer")
289
+ Task("Security management", "...", "security-manager")
290
+ Task("Performance monitoring", "...", "perf-analyzer")
291
+ ```
292
+
293
+ #### **GitHub Workflow Swarm (5 agents)**
294
+ ```bash
295
+ Task("PR management", "...", "pr-manager")
296
+ Task("Code review", "...", "code-review-swarm")
297
+ Task("Issue tracking", "...", "issue-tracker")
298
+ Task("Release coordination", "...", "release-manager")
299
+ Task("Workflow automation", "...", "workflow-automation")
300
+ ```
301
+
302
+ #### **SPARC TDD Swarm (7 agents)**
303
+ ```bash
304
+ Task("Requirements spec", "...", "specification")
305
+ Task("Algorithm design", "...", "pseudocode")
306
+ Task("System architecture", "...", "architecture")
307
+ Task("TDD implementation", "...", "sparc-coder")
308
+ Task("London school tests", "...", "tdd-london-swarm")
309
+ Task("Iterative refinement", "...", "refinement")
310
+ Task("Production validation", "...", "production-validator")
311
+ ```
312
+
313
+ ### ⚡ Performance Optimization
314
+
315
+ **Agent Selection Strategy:**
316
+ - **High Priority**: Use 3-5 agents max for critical path
317
+ - **Medium Priority**: Use 5-8 agents for complex features
318
+ - **Large Projects**: Use 8+ agents with proper coordination
319
+
320
+ **Memory Management:**
321
+ - Use `memory-coordinator` for cross-agent state
322
+ - Implement `swarm-memory-manager` for distributed coordination
323
+ - Apply `collective-intelligence-coordinator` for decision-making
324
+
325
+ For more information about SPARC methodology and batchtools optimization, see:
326
+ - SPARC Guide: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
327
+ - Batchtools Documentation: https://github.com/ruvnet/claude-code-flow/docs/batchtools.md
328
+
329
+ # important-instruction-reminders
330
+ Message 3: Task("Agent 2")
331
+ Message 4: Read("file1.js")
332
+ Message 5: Write("output1.js")
333
+ Message 6: Bash("npm install")
334
+ // This is 6x slower and breaks coordination!
335
+ ```
336
+
337
+ ### 🎯 CONCURRENT EXECUTION CHECKLIST:
338
+
60
339
  Before sending ANY message, ask yourself:
61
340
 
62
341
  - ✅ Are ALL related TodoWrite operations batched together?
@@ -74,6 +74,26 @@
74
74
  ]
75
75
  }
76
76
  ],
77
+ "PreCompact": [
78
+ {
79
+ "matcher": "manual",
80
+ "hooks": [
81
+ {
82
+ "type": "command",
83
+ "command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \\\"\\\"\"); echo \"🔄 PreCompact Guidance:\"; echo \"📋 IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" • 54 available agents and concurrent usage patterns\"; echo \" • Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" • SPARC methodology workflows with batchtools optimization\"; echo \" • Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"✅ Ready for compact operation\"'"
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "matcher": "auto",
89
+ "hooks": [
90
+ {
91
+ "type": "command",
92
+ "command": "/bin/bash -c 'echo \"🔄 Auto-Compact Guidance (Context Window Full):\"; echo \"📋 CRITICAL: Before compacting, ensure you understand:\"; echo \" • All 54 agents available in .claude/agents/ directory\"; echo \" • Concurrent execution patterns from CLAUDE.md\"; echo \" • Batchtools optimization for 300% performance gains\"; echo \" • Swarm coordination strategies for complex tasks\"; echo \"⚡ Apply GOLDEN RULE: Always batch operations in single messages\"; echo \"✅ Auto-compact proceeding with full agent context\"'"
93
+ }
94
+ ]
95
+ }
96
+ ],
77
97
  "Stop": [
78
98
  {
79
99
  "hooks": [