claude-flow-novice 1.5.9 → 1.5.11

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.
@@ -2,24 +2,62 @@
2
2
 
3
3
  ## Core Orchestration Patterns
4
4
 
5
- ## 🚨 CRITICAL: CONCURRENT EXECUTION & FILE MANAGEMENT
5
+ ## 🚨 CRITICAL: MANDATORY AGENT-BASED EXECUTION
6
6
 
7
+ **YOU MUST USE AGENTS FOR ALL NON-TRIVIAL WORK - NO EXCEPTIONS**
7
8
 
8
9
  **ABSOLUTE RULES**:
9
- 1. ALL operations MUST be concurrent/parallel in a single message
10
- 2. **NEVER save working files, text/mds and tests to the root folder**
11
- 3. ALWAYS organize files in appropriate subdirectories
12
- 4. **USE CLAUDE CODE'S TASK TOOL** for spawning agents concurrently, not just MCP
10
+ 1. **ALWAYS USE AGENTS** - Tasks requiring >3 steps MUST use agent coordination
11
+ 2. **ALWAYS INITIALIZE SWARM** - ANY multi-agent task requires swarm_init FIRST
12
+ 3. **ALWAYS RUN POST-EDIT HOOKS** - After EVERY file edit without exception
13
+ 4. **ALWAYS BATCH OPERATIONS** - 1 MESSAGE = ALL RELATED OPERATIONS
14
+ 5. **NEVER WORK SOLO** - Spawn multiple agents in parallel for ALL significant tasks
15
+ 6. **NEVER SAVE TO ROOT** - Organize files in appropriate subdirectories
16
+ 7. **USE CLAUDE CODE'S TASK TOOL** - For spawning agents concurrently, not just MCP
17
+
18
+ ### 🚫 WHEN YOU MUST USE AGENTS (MANDATORY)
19
+
20
+ **TRIGGER CONDITIONS - If ANY apply, you MUST spawn agents:**
21
+ - Task requires >3 distinct steps
22
+ - Multiple files need to be created or modified
23
+ - Need research + implementation + testing
24
+ - Architecture or design decisions required
25
+ - Code review or quality validation needed
26
+ - Security, performance, or compliance concerns
27
+ - Integration across multiple systems/components
28
+ - Documentation generation needed
29
+ - Refactoring or optimization work
30
+ - ANY feature development (even "simple" ones)
31
+
32
+ ### Agent Requirements by Task Complexity
33
+
34
+ | Task Size | Steps | Agent Count | Example Team Composition |
35
+ |-----------|-------|-------------|--------------------------|
36
+ | **Simple** | 3-5 | 2-3 agents | coder + tester + reviewer |
37
+ | **Medium** | 6-10 | 4-6 agents | + researcher + architect + security-specialist |
38
+ | **Complex** | 11-20 | 8-12 agents | Full specialist team with domain experts |
39
+ | **Enterprise** | 20+ | 15-20 agents | + devops + api-docs + perf-analyzer + coordinators |
13
40
 
14
41
  ### ⚡ GOLDEN RULE: "1 MESSAGE = ALL RELATED OPERATIONS"
15
42
 
16
43
  **MANDATORY PATTERNS:**
44
+ - **Agent Spawning**: ALWAYS spawn ALL required agents in ONE message using Task tool
17
45
  - **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ todos minimum)
18
46
  - **Task tool (Claude Code)**: ALWAYS spawn ALL agents in ONE message with full instructions
19
47
  - **File operations**: ALWAYS batch ALL reads/writes/edits in ONE message
20
48
  - **Bash commands**: ALWAYS batch ALL terminal operations in ONE message
21
49
  - **Memory operations**: ALWAYS batch ALL memory store/retrieve in ONE message
22
50
 
51
+ ### ⚠️ PROHIBITED SOLO WORK
52
+
53
+ **YOU ARE FORBIDDEN FROM:**
54
+ - ❌ Working alone on multi-step tasks
55
+ - ❌ Implementing features without agent coordination
56
+ - ❌ Skipping agent spawning because "it's simple"
57
+ - ❌ Writing code without a tester agent
58
+ - ❌ Making architectural decisions without an architect agent
59
+ - ❌ Deploying without security review from security-specialist agent
60
+
23
61
  ## 🎯 Claude Code vs MCP Tools
24
62
 
25
63
  ### Claude Code Handles ALL EXECUTION:
@@ -144,26 +182,157 @@ npx enhanced-hooks post-edit "src/lib.rs" --memory-key "backend/rust" --minimum-
144
182
  # Generate summaries and persist state
145
183
  npx claude-flow-novice hooks session-end --generate-summary true --persist-state true --export-metrics true
146
184
  ```
147
- **Claude Code's Task tool is the PRIMARY way to spawn agents:**
185
+ ### 🎯 Swarm Initialization (MANDATORY for ALL Multi-Agent Tasks)
186
+
187
+ **CRITICAL**: You MUST initialize swarm BEFORE spawning ANY multiple agents:
188
+
148
189
  ```javascript
149
- // ✅ CORRECT: Use Claude Code's Task tool for parallel agent execution
150
190
  [Single Message]:
151
- Task("Research agent", "Analyze requirements and patterns...", "researcher")
152
- Task("Coder agent", "Implement core features...", "coder")
153
- Task("Tester agent", "Create comprehensive tests...", "tester")
154
- Task("Reviewer agent", "Review code quality...", "reviewer")
155
- Task("Architect agent", "Design system architecture...", "system-architect")
191
+ // Step 1: ALWAYS initialize swarm first
192
+ mcp__claude-flow-novice__swarm_init({
193
+ topology: "mesh", // mesh (2-7 agents), hierarchical (8+)
194
+ maxAgents: 3, // Match your actual agent count
195
+ strategy: "balanced" // ensures agents coordinate and stay consistent
196
+ })
197
+
198
+ // Step 2: Spawn working agents via Task tool
199
+ Task("Agent 1", "Specific instructions...", "type")
200
+ Task("Agent 2", "Specific instructions...", "type")
201
+ Task("Agent 3", "Specific instructions...", "type")
156
202
  ```
157
203
 
158
- **MCP tools are ONLY for coordination setup:**
159
- ### MCP Integration
160
- **TRIGGER WORDS: SWARM, SPAWN, COORDINATE, TEAM**
161
- - `mcp__claude-flow-novice__swarm_init` - Initialize coordination topology
162
- - `mcp__claude-flow-novice__agent_spawn` - Define agent types for coordination
204
+ **WHY THIS MATTERS:**
205
+ - **Prevents inconsistency**: Without swarm, 3 agents fixing JWT secrets will use 3 different methods
206
+ - ✅ **Ensures coordination**: Agents share findings and agree on approach
207
+ - **Memory coordination**: Agents access shared context via SwarmMemory
208
+ - **Byzantine consensus**: Final validation ensures all agents agree
209
+
210
+ **TOPOLOGY SELECTION:**
211
+ - **2-7 agents**: Use `topology: "mesh"` (peer-to-peer, equal collaboration)
212
+ - **8+ agents**: Use `topology: "hierarchical"` (coordinator-led structure)
213
+
214
+ **MCP Integration Tools:**
215
+ - `mcp__claude-flow-novice__swarm_init` - Initialize swarm topology (REQUIRED for ALL multi-agent tasks)
216
+ - `mcp__claude-flow-novice__agent_spawn` - Spawn coordination agents (recommended for consistency)
163
217
  - `mcp__claude-flow-novice__task_orchestrate` - Orchestrate high-level workflows
164
218
  - **Monitoring**: `swarm_status`, `agent_metrics`, `task_results`
165
219
  - **Memory**: `memory_usage`, `memory_search`
166
220
 
221
+ ---
222
+
223
+ ## 📋 EXAMPLE AGENT SPAWNING PATTERNS
224
+
225
+ **⚠️ IMPORTANT**: These are **ILLUSTRATIVE EXAMPLES** demonstrating coordination patterns.
226
+ **YOU MUST adapt agent types, counts, and roles to YOUR specific task requirements.**
227
+
228
+ **Key Principles Shown:**
229
+ - How to structure swarm initialization before agent spawning
230
+ - How to spawn agents concurrently in one message
231
+ - How to coordinate multiple agent types effectively
232
+ - Topology selection based on team size
233
+
234
+ **These patterns are starting points - not rigid templates. Analyze your task and customize accordingly.**
235
+
236
+ ---
237
+
238
+ ### Example 1: Simple Task Pattern (2-3 agents)
239
+ **Illustrative pattern for basic feature implementation with coordinated validation.**
240
+
241
+ ```javascript
242
+ [Single Message]:
243
+ // Initialize swarm coordination
244
+ mcp__claude-flow-novice__swarm_init({
245
+ topology: "mesh",
246
+ maxAgents: 3,
247
+ strategy: "balanced"
248
+ })
249
+
250
+ // Spawn coordinated agents (customize to your needs)
251
+ Task("Coder", "Implement feature with TDD approach", "coder")
252
+ Task("Tester", "Create comprehensive test suite", "tester")
253
+ Task("Reviewer", "Review code quality and security", "reviewer")
254
+ ```
255
+
256
+ ### Example 2: Medium Task Pattern (4-6 agents)
257
+ **Illustrative pattern for multi-component features requiring research and architecture.**
258
+
259
+ ```javascript
260
+ [Single Message]:
261
+ // Initialize swarm coordination
262
+ mcp__claude-flow-novice__swarm_init({
263
+ topology: "mesh",
264
+ maxAgents: 6,
265
+ strategy: "balanced"
266
+ })
267
+
268
+ // Spawn coordinated specialists (adapt to your task)
269
+ Task("Researcher", "Analyze requirements and existing patterns", "researcher")
270
+ Task("Architect", "Design system architecture", "system-architect")
271
+ Task("Coder", "Implement core functionality with TDD", "coder")
272
+ Task("Tester", "Create unit, integration, and E2E tests", "tester")
273
+ Task("Security Reviewer", "Perform security audit", "security-specialist")
274
+ Task("Reviewer", "Final quality review", "reviewer")
275
+ ```
276
+
277
+ ### Example 3: Complex Task Pattern (8-12 agents)
278
+ **Illustrative pattern for full-scale features requiring hierarchical coordination.**
279
+
280
+ ```javascript
281
+ [Single Message]:
282
+ // Initialize hierarchical swarm for larger teams
283
+ mcp__claude-flow-novice__swarm_init({
284
+ topology: "hierarchical",
285
+ maxAgents: 12,
286
+ strategy: "adaptive"
287
+ })
288
+
289
+ // Spawn full specialist team (customize roles to your project)
290
+ Task("Product Owner", "Define requirements", "planner")
291
+ Task("System Architect", "Design architecture", "system-architect")
292
+ Task("Backend Developer", "Implement backend services", "backend-dev")
293
+ Task("Frontend Developer", "Create UI components", "coder")
294
+ Task("Tester", "Comprehensive testing", "tester")
295
+ Task("Security Specialist", "Security review", "security-specialist")
296
+ Task("Performance Analyst", "Performance optimization", "perf-analyzer")
297
+ Task("DevOps Engineer", "CI/CD setup", "cicd-engineer")
298
+ Task("API Documenter", "API documentation", "api-docs")
299
+ Task("Reviewer", "Final quality gate", "reviewer")
300
+ ```
301
+
302
+ ---
303
+
304
+ ### ⚠️ Real-World Example: Why Swarm Coordination Matters
305
+
306
+ **WITHOUT swarm_init (problematic):**
307
+ ```javascript
308
+ // ❌ BAD: Agents work independently with no coordination
309
+ [Single Message]:
310
+ Task("Agent 1", "Fix JWT secret issue", "coder")
311
+ Task("Agent 2", "Fix JWT secret issue", "coder")
312
+ Task("Agent 3", "Fix JWT secret issue", "coder")
313
+
314
+ // Result: 3 different solutions - environment variable, config file, hardcoded
315
+ // Problem: Inconsistent approach, wasted effort, integration conflicts
316
+ ```
317
+
318
+ **WITH swarm_init (correct):**
319
+ ```javascript
320
+ // ✅ GOOD: Agents coordinate through swarm
321
+ [Single Message]:
322
+ mcp__claude-flow-novice__swarm_init({
323
+ topology: "mesh",
324
+ maxAgents: 3,
325
+ strategy: "balanced"
326
+ })
327
+
328
+ Task("Agent 1", "Fix JWT secret issue", "coder")
329
+ Task("Agent 2", "Fix JWT secret issue", "coder")
330
+ Task("Agent 3", "Fix JWT secret issue", "coder")
331
+
332
+ // Result: All 3 agents agree on environment variable approach
333
+ // Benefit: Consistent solution, shared context, coordinated implementation
334
+ ```
335
+
167
336
  ## File Organization
168
337
  - **Never save working files to root**
169
338
 
@@ -177,12 +346,118 @@ claude mcp add claude-flow-novice npx claude-flow-novice mcp start
177
346
  - `/fullstack "goal"` - Launch full-stack development team with consensus validation
178
347
  - `/swarm`, `/sparc`, `/hooks` - Other slash commands (auto-discovered)
179
348
 
180
- ## DEVELOPMENT FLOW LOOP
181
- 1. Execute - Primary swarm (3-8 agents) produces deliverables with confidence score. Each agent MUST be using the enhanced post edit pipeline after file edits.
182
- 2. When the swarm believes its done with all tasks, move to step 4
183
- 3. If swarm does not believe it's done (confidence scores < 75%, relaunch agents for step 1)
184
- 4. Verify - Consensus swarm (2-4 validators) runs comprehensive checks with Byzantine voting
185
- 5. Decision - PASS (≥90% agreement + critical criteria) OR FAIL
186
- 6. Action -
187
- - PASS Store results Move to next task
188
- - FAIL → Round++ → If <10: inject feedback → Relaunch swarm on step 1 | If ≥10: Escalate to human
349
+ ## 🔄 MANDATORY DEVELOPMENT FLOW LOOP
350
+
351
+ **YOU MUST FOLLOW THIS LOOP FOR ALL NON-TRIVIAL WORK:**
352
+
353
+ ### Step 1: Initialize Swarm (ALWAYS for multi-agent tasks)
354
+ ```javascript
355
+ [Single Message]:
356
+ // ALWAYS initialize swarm when spawning multiple agents
357
+ mcp__claude-flow-novice__swarm_init({
358
+ topology: "mesh", // mesh for 2-7, hierarchical for 8+
359
+ maxAgents: 3, // match your actual agent count
360
+ strategy: "balanced" // ensures coordination and consistency
361
+ })
362
+
363
+ // Then spawn all agents - they will coordinate via swarm
364
+ Task("Agent 1", "Specific instructions", "type")
365
+ Task("Agent 2", "Specific instructions", "type")
366
+ Task("Agent 3", "Specific instructions", "type")
367
+ ```
368
+
369
+ **CRITICAL**: Without swarm_init, agents work independently and produce inconsistent results!
370
+
371
+ ### Step 2: Execute - Primary Swarm (3-20 agents)
372
+ - **Primary swarm** (3-8 agents minimum) produces deliverables with confidence scores
373
+ - **Self-validation**: Each agent validates own work (confidence threshold: 0.75)
374
+ - **Cross-agent coordination**: Agents share findings via SwarmMemory
375
+
376
+ ### Step 3: Self-Assessment Gate
377
+ - **If confidence scores ≥75%** → Proceed to Step 4 (Consensus Verification)
378
+ - **If confidence scores <75%** → Relaunch agents for Step 2 with feedback
379
+ - **Maximum iterations**: 3 attempts before escalation
380
+
381
+ ### Step 4: Verify - Consensus Swarm (2-4 validators REQUIRED)
382
+ ```javascript
383
+ // MANDATORY: Spawn consensus validation swarm
384
+ [Single Message]:
385
+ Task("Validator 1", "Comprehensive quality review", "reviewer")
386
+ Task("Validator 2", "Security and performance audit", "security-specialist")
387
+ Task("Validator 3", "Architecture validation", "system-architect")
388
+ Task("Validator 4", "Integration testing", "tester")
389
+ ```
390
+ - **Byzantine consensus voting** across all validators
391
+ - **Multi-dimensional checks**: quality, security, performance, tests, docs
392
+
393
+ ### Step 5: Decision Gate
394
+ - **PASS**: ≥90% validator agreement + all critical criteria met
395
+ - **FAIL**: <90% agreement OR any critical criterion failed
396
+
397
+ ### Step 6: Action Based on Decision
398
+ - **PASS** →
399
+ 1. Store results in SwarmMemory
400
+ 2. Update documentation
401
+ 3. Move to next task
402
+
403
+ - **FAIL** →
404
+ 1. Round counter++
405
+ 2. If Round < 10: Inject validator feedback → Return to Step 2
406
+ 3. If Round ≥ 10: Escalate to human with comprehensive report
407
+
408
+ ### 🚨 ENFORCEMENT CHECKPOINTS
409
+
410
+ **MANDATORY before proceeding:**
411
+ 1. ✅ Agents spawned (minimum count met for task complexity)
412
+ 2. ✅ Each file edit followed by enhanced post-edit hook
413
+ 3. ✅ Self-validation confidence scores recorded
414
+ 4. ✅ Consensus swarm spawned for verification
415
+ 5. ✅ Byzantine voting completed
416
+ 6. ✅ Results stored in SwarmMemory
417
+
418
+ ---
419
+
420
+ ## 🎯 MANDATORY: NEXT STEPS GUIDANCE
421
+
422
+ **After completing ANY task, you MUST provide:**
423
+
424
+ 1. **✅ What was completed**: Brief summary of delivered work
425
+ 2. **📊 Validation results**: Confidence scores, test coverage, consensus approval
426
+ 3. **🔍 Identified issues**: Any technical debt, warnings, or concerns discovered
427
+ 4. **💡 Recommended next steps**: Prioritized suggestions for logical continuation
428
+
429
+ ### Next Steps Template
430
+
431
+ ```markdown
432
+ ## Task Completion Summary
433
+
434
+ **✅ Completed**: [What was delivered]
435
+ **📊 Validation**:
436
+ - Confidence: X%
437
+ - Coverage: Y%
438
+ - Consensus: Z%
439
+
440
+ **⚠️ Identified Concerns**:
441
+ - [Issue 1] - Severity: [High/Medium/Low]
442
+ - [Issue 2] - Severity: [High/Medium/Low]
443
+
444
+ **💡 Recommended Next Steps** (in priority order):
445
+
446
+ 1. **[High Priority]**: [Action item]
447
+ - Why: [Business/technical rationale]
448
+ - Effort: [Estimated time/complexity]
449
+
450
+ 2. **[Medium Priority]**: [Action item]
451
+ - Why: [Value proposition]
452
+ - Effort: [Estimated time/complexity]
453
+
454
+ 3. **[Low Priority]**: [Enhancement opportunity]
455
+ - Why: [Long-term benefit]
456
+ - Effort: [Estimated time/complexity]
457
+
458
+ **🤔 Questions for User**:
459
+ - [Decision point requiring clarification]?
460
+ - [Alternative approach consideration]?
461
+ ```
462
+
463
+ **Rationale**: Proactive next steps ensure continuous progress, prevent workflow dead-ends, and help users understand logical task progression without requiring them to determine next actions.
@@ -19,8 +19,7 @@ const loadTemplate = (filename) => {
19
19
  export function createEnhancedClaudeMd() {
20
20
  const template = loadTemplate('CLAUDE.md');
21
21
  if (!template) {
22
- // Fallback to hardcoded if template file not found
23
- return createEnhancedClaudeMdFallback();
22
+ throw new Error('CLAUDE.md template file not found! Templates must be included in build.');
24
23
  }
25
24
  return template;
26
25
  }
@@ -2180,45 +2179,9 @@ if (Test-Path "$scriptPath\\package.json") {
2180
2179
  return '';
2181
2180
  }
2182
2181
 
2183
- // Fallback functions for when templates can't be loaded
2182
+ // DEPRECATED: Fallback functions removed - use template files only
2184
2183
  function createEnhancedClaudeMdFallback() {
2185
- // Read from the actual template file we created
2186
- try {
2187
- return readFileSync(join(__dirname, 'CLAUDE.md'), 'utf8');
2188
- } catch (error) {
2189
- // If that fails, return a minimal version
2190
- return `# Claude Code Configuration for Claude Flow
2191
-
2192
- ## 🚀 IMPORTANT: Claude Flow AI-Driven Development
2193
-
2194
- ### Claude Code Handles:
2195
- - ✅ **ALL file operations** (Read, Write, Edit, MultiEdit)
2196
- - ✅ **ALL code generation** and development tasks
2197
- - ✅ **ALL bash commands** and system operations
2198
- - ✅ **ALL actual implementation** work
2199
- - ✅ **Project navigation** and code analysis
2200
-
2201
- ### Claude Flow MCP Tools Handle:
2202
- - 🧠 **Coordination only** - Orchestrating Claude Code's actions
2203
- - 💾 **Memory management** - Persistent state across sessions
2204
- - 🤖 **Neural features** - Cognitive patterns and learning
2205
- - 📊 **Performance tracking** - Monitoring and metrics
2206
- - 🐝 **Swarm orchestration** - Multi-agent coordination
2207
- - 🔗 **GitHub integration** - Advanced repository management
2208
-
2209
- ### ⚠️ Key Principle:
2210
- **MCP tools DO NOT create content or write code.** They coordinate and enhance Claude Code's native capabilities.
2211
-
2212
- ## Quick Start
2213
-
2214
- 1. Add MCP server: \`claude mcp add claude-flow-novice npx claude-flow-novice mcp start\`
2215
- 2. Initialize swarm: \`mcp__claude-flow__swarm_init { topology: "hierarchical" }\`
2216
- 3. Spawn agents: \`mcp__claude-flow__agent_spawn { type: "coder" }\`
2217
- 4. Orchestrate: \`mcp__claude-flow__task_orchestrate { task: "Build feature" }\`
2218
-
2219
- See full documentation in \`.claude/commands/\`
2220
- `;
2221
- }
2184
+ throw new Error('Template-only approach: createEnhancedClaudeMdFallback() is deprecated and removed.');
2222
2185
  }
2223
2186
 
2224
2187
  function createEnhancedSettingsJsonFallback() {
@@ -68,7 +68,8 @@ async function startMcpServer(subArgs, flags) {
68
68
 
69
69
  const __filename = fileURLToPath(import.meta.url);
70
70
  const __dirname = path.dirname(__filename);
71
- const mcpServerPath = path.join(__dirname, '../../mcp/mcp-server.js');
71
+ // Use the SDK-based MCP server from dist directory
72
+ const mcpServerPath = path.join(__dirname, '../../mcp/mcp-server-sdk.js');
72
73
 
73
74
  // Check if the file exists, and log the path for debugging
74
75
  const fs = await import('fs');