claude-flow-novice 2.14.0 → 2.14.1

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 (86) hide show
  1. package/.claude/commands/cfn/README.md +177 -129
  2. package/.claude/commands/cfn/cfn-loop-cli.md +279 -0
  3. package/.claude/commands/cfn/cfn-loop-document.md +20 -1
  4. package/.claude/commands/cfn/cfn-loop-frontend.md +17 -2
  5. package/.claude/commands/cfn/cfn-loop-task.md +460 -0
  6. package/.claude/commands/cfn/context-curate.md +27 -38
  7. package/.claude/commands/cfn/context-inject.md +14 -25
  8. package/.claude/commands/cfn/context-query.md +40 -45
  9. package/.claude/commands/cfn/context-reflect.md +40 -38
  10. package/.claude/commands/cfn/context-stats.md +13 -38
  11. package/.claude/commands/cfn/launch-web-dashboard.md +0 -295
  12. package/.claude/commands/cfn/list-agents-rebuild.md +18 -18
  13. package/.claude/commands/cfn/write-plan.md +246 -75
  14. package/.claude/root-claude-distribute/CFN-CLAUDE.md +126 -233
  15. package/.claude/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
  16. package/.claude/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
  17. package/.claude/skills/cfn-changelog-management/bulk-import.sh +268 -0
  18. package/.claude/skills/cfn-changelog-management/lib/README.md +212 -0
  19. package/.claude/skills/cfn-changelog-management/lib/validation.sh +72 -0
  20. package/.claude/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
  21. package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +259 -0
  22. package/claude-assets/agents/cfn-dev-team/reviewers/reviewer.md +45 -6
  23. package/claude-assets/agents/cfn-dev-team/testers/tester.md +59 -0
  24. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +4 -4
  25. package/claude-assets/commands/cfn/auto-compact.md +80 -0
  26. package/claude-assets/commands/cfn/cfn-loop-epic.md +478 -0
  27. package/claude-assets/commands/cfn/cfn-loop-single.md +256 -0
  28. package/claude-assets/commands/cfn/cfn-loop-sprints.md +396 -0
  29. package/claude-assets/commands/cfn/cfn-loop.md +518 -0
  30. package/claude-assets/commands/cfn/claude-md.md +64 -0
  31. package/claude-assets/commands/cfn/claude-soul.md +22 -0
  32. package/claude-assets/commands/cfn/cost-savings-off.md +35 -0
  33. package/claude-assets/commands/cfn/cost-savings-on.md +35 -0
  34. package/claude-assets/commands/cfn/cost-savings-status.md +34 -0
  35. package/claude-assets/commands/cfn/custom-routing-activate.md +55 -0
  36. package/claude-assets/commands/cfn/custom-routing-deactivate.md +46 -0
  37. package/claude-assets/commands/cfn/dependency-recommendations.md +171 -0
  38. package/claude-assets/commands/cfn/fullstack.md +179 -0
  39. package/claude-assets/commands/cfn/github.md +221 -0
  40. package/claude-assets/commands/cfn/hooks.md +38 -0
  41. package/claude-assets/commands/cfn/metrics-summary.md +58 -0
  42. package/claude-assets/commands/cfn/neural.md +39 -0
  43. package/claude-assets/commands/cfn/parse-epic.md +357 -0
  44. package/claude-assets/commands/cfn/performance.md +41 -0
  45. package/claude-assets/commands/cfn/sparc.md +46 -0
  46. package/claude-assets/commands/cfn/suggest-improvements.md +95 -0
  47. package/claude-assets/commands/cfn/suggest-templates.md +147 -0
  48. package/claude-assets/commands/cfn/swarm.md +24 -0
  49. package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +126 -233
  50. package/claude-assets/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
  51. package/claude-assets/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
  52. package/claude-assets/skills/cfn-changelog-management/bulk-import.sh +268 -0
  53. package/claude-assets/skills/cfn-changelog-management/lib/README.md +212 -0
  54. package/claude-assets/skills/cfn-changelog-management/lib/validation.sh +72 -0
  55. package/claude-assets/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
  56. package/claude-assets/skills/cfn-task-config-init/SKILL.md +204 -0
  57. package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -0
  58. package/dist/cli/config-manager.js +109 -91
  59. package/dist/cli/config-manager.js.map +1 -1
  60. package/package.json +2 -2
  61. package/.claude/commands/README.md +0 -205
  62. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
  63. package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
  64. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
  65. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
  66. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
  67. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
  68. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
  69. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
  70. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
  71. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
  72. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
  73. package/.claude/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
  74. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
  75. package/claude-assets/skills/cfn-loop2-output-processing/execute-and-extract.sh.backup +0 -36
  76. package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
  77. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
  78. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
  79. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
  80. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
  81. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
  82. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
  83. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
  84. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
  85. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
  86. package/claude-assets/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
@@ -22,12 +22,15 @@
22
22
  * **ALL agent communication MUST use Redis pub/sub** - no direct file coordination
23
23
  * **NEVER HARDCODE API KEYS**
24
24
  * **sleep on repeat** when monitoring a background process. sleep x minutes, check progress, sleep, repeat
25
+ * **USE GREP INSTEAD OF FIND** - it's less resource intensive in our WSL2 instances
25
26
 
26
27
  **Agent Output Standards:**
27
28
  * **Bug documentation**: `docs/BUG_#_*.md` (investigation, fix summary, validation)
28
29
  * **Test scripts**: `tests/test-*.sh` (persistent, version controlled)
29
30
  * **Feature documentation**: `docs/FEATURE_NAME.md` (architecture, process docs)
30
31
  * **Temporary files ONLY**: `/tmp/` (ephemeral test fixtures, scratch data)
32
+ * **Backlog items**: Use `.claude/skills/cfn-backlog-management/add-backlog-item.sh` when deferring work (requires: item, why, solution)
33
+ * **Changelog entries**: Use `.claude/skills/cfn-changelog-management/add-changelog-entry.sh` after feature/bugfix/breaking change (10-100 char summary, sparse impact)
31
34
  * **Full guidelines**: `docs/AGENT_OUTPUT_STANDARDS.md`
32
35
 
33
36
  **Consensus thresholds:**
@@ -85,55 +88,55 @@ npx cfn-init # Copy namespace-isolated files
85
88
  * Delegate ALL coordination to skills
86
89
  * Use skill-specific configuration for complex workflows
87
90
 
88
- ### Cost-Savings Mode (CLI Spawning)
91
+ ### CFN Loop Execution Modes
89
92
 
90
- **All CFN Loop slash commands automatically use cost-optimized coordinators.** No manual configuration needed.
93
+ **User selects mode. Main Chat executes the specified slash command.**
91
94
 
92
- **Recommended Usage:**
93
- ```bash
94
- # Use slash commands (automatically cost-optimized)
95
- /cfn-loop "Implement feature" --mode=standard
96
- /cfn-loop-single "Fix bug"
97
- /cfn-loop-epic "Build system"
98
- ```
99
-
100
- **Core Coordinators:**
101
-
102
- | Coordinator | Spawning Method | Cost Savings | Use Case |
103
- |-------------|----------------|--------------|----------|
104
- | `cfn-v3-coordinator` | CLI | 95-98% | CFN Loops |
105
- | `cost-savings-coordinator` | CLI | 95-98% | General tasks |
95
+ **Default: Task Mode** (if user doesn't specify mode)
106
96
 
107
- **Architecture:**
108
- Main Chat → Single coordinator agent → Coordinator spawns workers via CLI → 95-98% cost savings
97
+ **Available modes:**
109
98
 
110
- ## CFN v3 Dual-Mode Architecture
111
-
112
- **Two spawning modes:**
113
- 1. **CLI Mode** (default): Cost-optimized, Redis context, Z.ai routing
114
- 2. **Task Mode**: Simplified, direct injection, Anthropic routing
115
-
116
- **Mode Selection:**
99
+ **1. Task Mode (Default):**
117
100
  ```bash
118
- # Default: CLI mode (95-98% savings)
119
- /cfn-loop "Task description"
101
+ /cfn-loop-task "Task description" --mode=standard
102
+ ```
103
+ - Main Chat spawns ALL agents via Task()
104
+ - NO coordinator agent
105
+ - Cost: $0.150/iteration
106
+ - Full visibility in Main Chat
107
+ - Use: Debugging, learning, short tasks (<5 min)
120
108
 
121
- # Explicit Task mode (full visibility)
122
- /cfn-loop "Task description" --spawn-mode=task
109
+ **2. CLI Mode (Production):**
110
+ ```bash
111
+ /cfn-loop-cli "Task description" --mode=standard
123
112
  ```
113
+ - Main Chat spawns ONLY cfn-v3-coordinator
114
+ - Coordinator spawns workers via CLI (background)
115
+ - Cost: $0.054/iteration (64% savings vs Task)
116
+ - Use: Production, long tasks, cost-sensitive
117
+
118
+ **Mode selection guidance for users:**
119
+ - "execute cfn loop on X" → `/cfn-loop-task` (default)
120
+ - "use task mode on X" → `/cfn-loop-task`
121
+ - "use cli mode on X" → `/cfn-loop-cli`
122
+ - "production cfn loop on X" → `/cfn-loop-cli`
123
+
124
+ **Architecture patterns:**
125
+ - CLI: Main Chat → cfn-v3-coordinator → orchestrate.sh → CLI workers (background)
126
+ - Task: Main Chat → Task() agents (no coordinator, full visibility)
124
127
 
125
- **Key Differences:**
126
- - CLI mode: Main Chat → Coordinator → cfn-loop-orchestration/orchestrate.sh CLI agents
127
- - Task mode: Main Chat Coordinator → JSON → Main Chat spawns Task() agents
128
- - CLI agents use Z.ai routing automatically
129
- - Redis context enables swarm recovery (CLI mode)
128
+ **Cost breakdown:**
129
+ - CLI mode: $0.054/iteration (Z.ai routing for workers)
130
+ - Task mode: $0.150/iteration (Anthropic for all agents)
130
131
 
131
132
  **Context Storage:**
132
- - Both modes store context in Redis
133
+ - CLI mode: Coordinator stores context in Redis for agents to retrieve
134
+ - Task mode: Main Chat passes context directly to each Task() spawn (no Redis needed)
133
135
  - CLI agents read from Redis: `redis-cli HGETALL "cfn_loop:task:$TASK_ID:context"`
134
- - Task mode: Main Chat injects directly but also stores in Redis
135
136
 
136
- **Reference:** See `planning/cfn-v3/DUAL_MODE_IMPLEMENTATION.md`
137
+ **Reference:**
138
+ - Implementation details: `planning/cfn-v3/DUAL_MODE_IMPLEMENTATION.md`
139
+ - **Task Mode guide**: `.claude/commands/cfn/CFN_LOOP_TASK_MODE.md` (agent specialization, sprint workflow, backlog management)
137
140
 
138
141
  ### Custom Routing (Z.ai Provider Integration)
139
142
 
@@ -192,13 +195,32 @@ Task("cfn-v3-coordinator", `
192
195
  ```
193
196
 
194
197
  **Why This Pattern:**
195
- - Coordinator controls spawn timing via .claude/skills/cfn-loop-orchestration/orchestrate.sh and CLI (no timeout issues)
198
+ - Coordinator controls spawn timing via orchestrate.sh (no timeout issues)
196
199
  - 95-98% cost savings vs Task() spawning
197
- - Zero-token waiting between iterations (Redis BLPOP)
200
+ - Fresh agents spawned for each iteration (adaptive specialization)
198
201
  - Sequential CLI spawning is safe (coordinator manages order)
199
202
  - Clean separation: Main Chat → Coordinator → Workers
200
203
 
201
- ### Post-Edit Validation (REQUIRED for all Edit/Write operations on any file type)
204
+ ### Pre-Edit Backup (REQUIRED before all Edit/Write operations)
205
+ **Before ANY Edit/Write/MultiEdit operation, agents MUST create backup:**
206
+ ```bash
207
+ BACKUP_PATH=$(./.claude/hooks/cfn-invoke-pre-edit.sh "$FILE_TO_EDIT" --agent-id "$AGENT_ID")
208
+ ```
209
+
210
+ **Why:** Enables safe file revert without git operations during parallel sessions.
211
+ **Location:** `.backups/[agent-id]/[timestamp]_[hash]/`
212
+ **Retention:** 24h TTL (configurable)
213
+
214
+ **Revert Instead of Git:**
215
+ ```bash
216
+ # ❌ FORBIDDEN - git operations cause parallel session issues
217
+ git checkout -- file.ts
218
+
219
+ # ✅ REQUIRED - use backup system
220
+ ./.claude/skills/pre-edit-backup/revert-file.sh "$FILE_PATH" --agent-id "$AGENT_ID"
221
+ ```
222
+
223
+ ### Post-Edit Validation (REQUIRED after all Edit/Write operations on any file type)
202
224
  **After ANY Edit/Write/MultiEdit operation on all file types, agents MUST run:**
203
225
  ```bash
204
226
  ./.claude/hooks/cfn-invoke-post-edit.sh "$EDITED_FILE" --agent-id "$AGENT_ID"
@@ -208,6 +230,23 @@ Task("cfn-v3-coordinator", `
208
230
  **Config:** `.claude/hooks/post-edit.config.json`
209
231
  **Skill:** `.claude/skills/hook-pipeline/SKILL.md`
210
232
 
233
+ ### Complete Edit Workflow (Pre-Edit + Edit + Post-Edit)
234
+ ```bash
235
+ # 1. Pre-Edit: Create backup
236
+ BACKUP_PATH=$(./.claude/hooks/cfn-invoke-pre-edit.sh "src/file.ts" --agent-id "$AGENT_ID")
237
+
238
+ # 2. Edit: Perform file modification
239
+ Edit: file_path="src/file.ts" old_string="..." new_string="..."
240
+
241
+ # 3. Post-Edit: Validate changes
242
+ ./.claude/hooks/cfn-invoke-post-edit.sh "src/file.ts" --agent-id "$AGENT_ID"
243
+
244
+ # 4. (Optional) Revert if validation fails
245
+ if [ $? -ne 0 ]; then
246
+ ./.claude/skills/pre-edit-backup/revert-file.sh "src/file.ts" --agent-id "$AGENT_ID"
247
+ fi
248
+ ```
249
+
211
250
  ## 2) When Agents Are Mandatory (Triggers)
212
251
 
213
252
  If **any** apply, spawn agents:
@@ -252,133 +291,8 @@ Refer to `.claude/skills/cfn-redis-coordination/SKILL.md` for:
252
291
  - Simple Chain Coordination
253
292
  - Hierarchical Broadcast
254
293
  - Mesh Hybrid Patterns
255
- - **Waiting Mode + Wake-Up** ( Operational)
256
-
257
- ### Redis Waiting Mode (Zero-Token Agent Coordination)
258
-
259
- **Use Case:** CFN Loop iterations, long-running tasks, multi-agent consensus
260
-
261
- **Agent enters waiting mode:**
262
- ```bash
263
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh enter \
264
- --task-id "$TASK_ID" \
265
- --agent-id "$AGENT_ID" \
266
- --context "iteration-1"
267
- ```
268
-
269
- **Coordinator wakes agent:**
270
- ```bash
271
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh wake \
272
- --task-id "$TASK_ID" \
273
- --agent-id "$AGENT_ID" \
274
- --reason cfn_loop_iteration \
275
- --iteration 2 \
276
- --feedback "Add error handling,Improve test coverage"
277
- ```
278
-
279
- **Agent reports result:**
280
- ```bash
281
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
282
- --task-id "$TASK_ID" \
283
- --agent-id "$AGENT_ID" \
284
- --confidence 0.92 \
285
- --iteration 2
286
- ```
287
-
288
- **Coordinator collects results:**
289
- ```bash
290
- CONSENSUS=$(./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh collect \
291
- --task-id "$TASK_ID" \
292
- --agent-ids "coder-1,reviewer-1,tester-1,security-1")
293
-
294
- if (( $(echo "$CONSENSUS >= 0.90" | bc -l) )); then
295
- echo "✅ Consensus reached: $CONSENSUS"
296
- fi
297
- ```
298
-
299
- **Benefits:**
300
- - 🚀 Zero token cost while waiting (BLPOP blocks, no API calls)
301
- - 🔄 Context preserved across iterations
302
- - ⚡ Instant wake-up (<100ms latency)
303
- - 📈 Scalable (10+ agents, indefinite cycles)
304
-
305
- **Key Pattern (STRAT-002):**
306
- Use zero-token blocking mechanisms (like Redis BLPOP) to create efficient, low-overhead synchronization between agents without incurring API call costs. Validated by 8/8 passing tests in orchestrator test suite.
307
-
308
- ### ⚠️ Waiting Mode Without Coordinator (CRITICAL)
309
-
310
- **Problem:** Agents entering waiting mode without a coordinator will block indefinitely.
311
-
312
- **Why This Happens:**
313
- - `invoke-waiting-mode.sh enter` uses `BLPOP` with timeout=0 (infinite)
314
- - Agent blocks waiting for wake signal that never arrives
315
- - No coordinator = no wake signal = agent stuck forever
316
- - Shell/terminal timeout (typically 2min) may terminate the session
317
-
318
- **When This Occurs:**
319
- 1. **Manual agent spawning** without orchestrator (testing, debugging)
320
- 2. **Epic execution** where Main Chat spawns agents directly
321
- 3. **Incomplete orchestration** where coordinator crashes mid-execution
322
-
323
- **Solutions:**
324
-
325
- **Option 1: Always Use Full Orchestration (RECOMMENDED)**
326
- ```bash
327
- # CORRECT: Use orchestrator for all multi-agent workflows
328
- ./.claude/skills/cfn-loop-orchestration/cfn-orchestrate.sh \
329
- --task-id "$TASK_ID" \
330
- --mode standard \
331
- --loop3-agents "coder-1,researcher-1" \
332
- --loop2-agents "reviewer-1,tester-1" \
333
- --product-owner "product-owner-1"
334
- ```
335
-
336
- **Option 2: Manual Coordination (For Testing Only)**
337
- ```bash
338
- # 1. Spawn agents (they enter waiting mode)
339
- # 2. Collect confidence scores
340
- CONSENSUS=$(./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh collect \
341
- --task-id "$TASK_ID" --agent-ids "coder-1,researcher-1")
342
-
343
- # 3. Check consensus
344
- if (( $(echo "$CONSENSUS >= 0.90" | bc -l) )); then
345
- echo "✅ Complete - no iteration needed"
346
- # Agents stay in waiting mode (expected, will timeout)
347
- else
348
- # 4. Wake agents for iteration 2
349
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh wake \
350
- --task-id "$TASK_ID" \
351
- --agent-id "coder-1" \
352
- --reason "improve_quality" \
353
- --iteration 2
354
- fi
355
- ```
356
-
357
- **Option 3: Skip Waiting Mode (Quick Testing)**
358
- ```bash
359
- # Agent completion without waiting mode
360
- redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
361
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
362
- --task-id "$TASK_ID" \
363
- --agent-id "$AGENT_ID" \
364
- --confidence 0.85
365
-
366
- # Skip step 4 (enter waiting mode) - agent exits immediately
367
- ```
368
-
369
- **Best Practice (STRAT-006):**
370
- **Always spawn coordinator + agents together.** Never spawn agents in waiting mode without a coordinator unless you explicitly plan to wake them manually or accept timeout behavior.
371
-
372
- ```bash
373
- # FORBIDDEN PATTERN:
374
- Task("backend-dev", "Task with waiting mode...") # No coordinator!
375
-
376
- # REQUIRED PATTERN:
377
- Task("cfn-loop-coordinator", "Execute CFN Loop with orchestrator...")
378
- # Coordinator spawns and manages all agents automatically
379
- ```
380
-
381
- **Validation:** Agent timeouts during epic execution (Phases 1-3) were expected behavior - agents correctly entered waiting mode but no coordinator was present to wake them. This is acceptable for single-iteration phases where iteration is not needed.
294
+ - Agent completion signaling (Redis LPUSH)
295
+ - Consensus collection (invoke-waiting-mode.sh collect)
382
296
 
383
297
  ## 4) CFN Loop Overview
384
298
 
@@ -396,79 +310,50 @@ Task("cfn-loop-coordinator", "Execute CFN Loop with orchestrator...")
396
310
  | Standard | ≥0.75 | ≥0.90 | 10 | 3-4 |
397
311
  | Enterprise | ≥0.85 | ≥0.95 | 15 | 5 |
398
312
 
399
- ### CFN Loop Dependency Enforcement (MANDATORY)
313
+ ### CFN Loop Orchestration Pattern
400
314
 
401
- **All CFN loops use single coordinator pattern (v2):**
315
+ **CLI Mode (Production):**
316
+ Main Chat spawns cfn-v3-coordinator → Coordinator spawns workers via CLI → Workers exit after reporting confidence
402
317
 
403
- **1. Main Chat spawns coordinator:**
404
- ```javascript
405
- Task("cfn-v3-coordinator", `
406
- Execute CFN Loop for: Implement authentication system
318
+ **Task Mode (Debugging):**
319
+ Main Chat spawns all agents directly via Task() → No coordinator → Full visibility
407
320
 
408
- Use orchestrator for dependency enforcement.
409
- Report structured result when complete.
410
- `)
411
- ```
412
-
413
- **2. Coordinator invokes orchestrator internally:**
414
- ```bash
415
- # Coordinator runs this script (NOT Main Chat)
416
- ./.claude/skills/cfn-loop-orchestration/cfn-orchestrate.sh \
417
- --task-id "unique-task-id" \
418
- --mode standard \
419
- --loop3-agents "researcher,backend-dev,devops" \
420
- --loop2-agents "reviewer,architect,tester" \
421
- --product-owner "product-owner" \
422
- --max-iterations 10 \
423
- --phase-id "phase-2" \
424
- --epic-context '{"epicGoal":"Build feature X","inScope":["A","B"]}' \
425
- --phase-context '{"currentPhase":"Phase 2","deliverables":["Component 1","Component 2"]}' \
426
- --success-criteria '{"acceptanceCriteria":["Tests pass","Coverage >80%"],"gateThreshold":0.75}'
427
-
428
- # CFN v3 UPDATE: Modular orchestrator (78% code reduction)
429
- # - Helper scripts for context injection, agent spawning, validation
430
- # - Stateless context retrieval from Redis
431
- # - Better agent ID tracking (no BLPOP hangs)
432
- ```
433
-
434
- **3. Orchestrator spawns all agents via CLI:**
321
+ **Orchestrator:**
435
322
  ```bash
436
- # Orchestrator spawns each agent
437
- npx cfn-spawn agent researcher --task-id "$TASK_ID"
438
- npx cfn-spawn agent backend-dev --task-id "$TASK_ID"
439
- # ... etc
323
+ ./.claude/skills/cfn-loop-orchestration/orchestrate.sh
440
324
  ```
325
+ - Spawns Loop 3 agents (implementers)
326
+ - Collects confidence scores
327
+ - Gate check: spawn Loop 2 if ≥threshold
328
+ - Spawns Loop 2 agents (validators)
329
+ - Collects consensus
330
+ - Spawns Product Owner for decision
331
+ - Manages iterations based on PROCEED/ITERATE/ABORT
441
332
 
442
- **4. Coordinator manages iterations and returns result to Main Chat**
443
-
444
- **Why Orchestration is Mandatory:**
445
- - ✅ Loop 2 validators BLOCKED until Loop 3 complete (BLPOP)
446
- - ✅ Product Owner BLOCKED until Loop 2 complete (BLPOP)
447
- - ✅ Prevents premature consensus collection
448
- - ✅ Automatic iteration management
449
- - ✅ Zero-token waiting between loops
450
- - ✅ Coordinator controls entire flow from single agent
451
-
452
- **Agent Completion Protocol:**
453
- Each agent MUST signal completion before entering waiting mode:
333
+ **Agent Completion Protocol (Mode-Specific):**
454
334
 
335
+ **CLI Mode** (spawned via `npx claude-flow-novice agent-spawn`):
455
336
  ```bash
456
337
  # 1. Complete work
457
338
  # 2. Signal done
458
339
  redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
459
340
 
460
- # 3. Report confidence
341
+ # 3. Report confidence and exit
461
342
  ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
462
343
  --task-id "$TASK_ID" \
463
344
  --agent-id "$AGENT_ID" \
464
345
  --confidence 0.85 \
465
346
  --iteration 1
466
347
 
467
- # 4. Enter waiting mode
468
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh enter \
469
- --task-id "$TASK_ID" \
470
- --agent-id "$AGENT_ID" \
471
- --context "iteration-complete"
348
+ # Agent exits cleanly (no waiting mode)
349
+ ```
350
+
351
+ **Task Mode** (spawned via Task() tool in Main Chat):
352
+ ```bash
353
+ # Simply complete work and return output
354
+ # Main Chat receives output automatically
355
+ # NO Redis signals required
356
+ # NO explicit completion protocol needed
472
357
  ```
473
358
 
474
359
  **Orchestration Flow (CORRECTED - Self-Validation Pattern):**
@@ -492,17 +377,13 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
492
377
 
493
378
  **Recommended: Use slash commands for CFN Loop execution**
494
379
 
495
- Main Chat should use these commands instead of manually spawning coordinators:
380
+ Main Chat should use these commands instead of manually spawning coordinators.
381
+ **IMPORTANT** Subagents must NOT use these these slash commands
496
382
 
497
383
  **Single Task:**
498
384
  ```bash
499
- /cfn-loop "Implement JWT authentication" --mode=standard
500
- /cfn-loop-single "Fix security bug in auth module"
501
- ```
502
-
503
- **Multi-Phase Epic:**
504
- ```bash
505
- /cfn-loop-epic "Build complete authentication system"
385
+ /cfn-loop-cli "Implement JWT authentication" --mode=standard
386
+ /cfn-loop-task "Fix security bug in auth module" --mode=standard
506
387
  ```
507
388
 
508
389
  **What These Commands Do:**
@@ -540,6 +421,10 @@ Implement comprehensive test suites that validate both functional requirements a
540
421
  - Agent Spawning: `.claude/skills/cfn-agent-spawning/SKILL.md`
541
422
  - CFN Loop Validation: `.claude/skills/cfn-loop-validation/SKILL.md`
542
423
 
424
+ **CFN Loop Documentation:**
425
+ - **Task Mode Guide**: `.claude/commands/cfn/CFN_LOOP_TASK_MODE.md` (agent specialization, sprint workflow, backlog management, adaptive validator scaling)
426
+ - Coordinator Parameters: `.claude/commands/cfn/CFN_COORDINATOR_PARAMETERS.md`
427
+
543
428
  **Maintenance Plans:**
544
429
  - Rollback Strategy: `planning/skills/ROLLBACK_PLAN.md`
545
430
  - Maintenance Schedule: `planning/skills/MAINTENANCE_SCHEDULE.md`
@@ -640,10 +525,10 @@ See `.artifacts/analytics/context-reduction-report.json`
640
525
  - **Confidence**: 0.87
641
526
  - **Priority**: 8/10
642
527
 
643
- #### PATTERN-022: Agent Lifecycle - Exit vs Waiting Mode
528
+ #### PATTERN-022: Agent Lifecycle - Clean Exit Protocol
644
529
  - **Context**: CFN Loop Agent Management
645
- - **Insight**: When agents enter waiting mode after reporting confidence, they block orchestrator's wait $PID indefinitely. Solution: Remove waiting mode from CFN protocol Step 3, let agents exit cleanly. Enables adaptive agent specialization - orchestrator can spawn different specialist (security-specialist for security issues, not original coder) for next iteration based on feedback type. Pattern validated by BUG #18 fix.
646
- - **Tags**: waiting-mode, agent-lifecycle, adaptive-specialization, orchestrator-blocking
530
+ - **Insight**: Agents must exit cleanly after reporting confidence. Pattern: (1) Signal done via Redis LPUSH, (2) Report confidence score, (3) Exit immediately. Enables adaptive agent specialization - orchestrator spawns different specialist (security-specialist for security issues) for next iteration based on feedback type. Prevents orchestrator blocking.
531
+ - **Tags**: agent-lifecycle, clean-exit, adaptive-specialization, orchestrator
647
532
  - **Confidence**: 0.89
648
533
  - **Priority**: 8/10
649
534
 
@@ -663,6 +548,14 @@ See `.artifacts/analytics/context-reduction-report.json`
663
548
  - **Confidence**: 0.91
664
549
  - **Priority**: 9/10
665
550
 
551
+ #### ANTI-023: Task-Spawned Validators Without Completion Protocol
552
+ - **Context**: Loop 2 Validation (Task Mode)
553
+ - **Insight**: Main Chat spawns validators via Task() without clear scope boundaries or mode-aware completion protocols. Anti-pattern: Validators see CLI-mode completion instructions (Redis signals, `invoke-waiting-mode.sh report`) and attempt to comply using wrong tools (slash commands via Bash, nested CFN Loop spawning). Result: Agents hang indefinitely trying to execute `/cfn-loop-cli` as bash command, memory leak from blocked processes. Task-spawned validators should simply return structured output - Main Chat receives it automatically, no Redis signals needed.
554
+ - **Tags**: task-spawning, validation, completion-protocol, scope-boundaries, memory-leak
555
+ - **Confidence**: 0.95
556
+ - **Priority**: 10/10
557
+ - **Fix**: Mode-specific completion protocols in CLAUDE.md:333-357 and validator agents (reviewer.md:200-258, tester.md:160-217). Explicit scope boundaries prevent nested CFN Loop spawning.
558
+
666
559
  ### Edge Cases & Testing
667
560
 
668
561
  #### EDGE-020: Comparative Agent Spawn Testing
@@ -4,6 +4,10 @@ set -e
4
4
  # cfn-backlog-management/add-backlog-item.sh
5
5
  # Adds structured backlog items to readme/BACKLOG.md
6
6
 
7
+ # Source shared validation utilities
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+ source "/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-changelog-management/lib/validation.sh"
10
+
7
11
  # Default values
8
12
  PRIORITY="P2"
9
13
  CATEGORY="Technical-Debt"
@@ -12,6 +16,7 @@ TAGS=""
12
16
  ITEM=""
13
17
  WHY=""
14
18
  SOLUTION=""
19
+ FORCE=false
15
20
 
16
21
  # Parse arguments
17
22
  while [[ $# -gt 0 ]]; do
@@ -44,6 +49,10 @@ while [[ $# -gt 0 ]]; do
44
49
  CATEGORY="$2"
45
50
  shift 2
46
51
  ;;
52
+ --force)
53
+ FORCE=true
54
+ shift
55
+ ;;
47
56
  *)
48
57
  echo "Unknown argument: $1" >&2
49
58
  exit 1
@@ -67,30 +76,14 @@ if [[ -z "$SOLUTION" ]]; then
67
76
  exit 1
68
77
  fi
69
78
 
70
- # Validate item length
71
- ITEM_LENGTH=${#ITEM}
72
- if (( ITEM_LENGTH < 10 )); then
73
- echo "Error: --item must be at least 10 characters (got $ITEM_LENGTH)" >&2
74
- exit 1
75
- fi
79
+ # Validate item length using shared validation
80
+ validate_string_length "$ITEM" 10 500 "item" || exit 1
76
81
 
77
- if (( ITEM_LENGTH > 500 )); then
78
- echo "Error: --item must be at most 500 characters (got $ITEM_LENGTH)" >&2
79
- exit 1
80
- fi
82
+ # Validate priority using shared enum validation
83
+ validate_enum "$PRIORITY" "priority" "P0|P1|P2|P3" || exit 1
81
84
 
82
- # Validate priority
83
- if [[ ! "$PRIORITY" =~ ^P[0-3]$ ]]; then
84
- echo "Error: --priority must be P0, P1, P2, or P3 (got: $PRIORITY)" >&2
85
- exit 1
86
- fi
87
-
88
- # Validate category
89
- VALID_CATEGORIES="Feature|Bug|Technical-Debt|Optimization"
90
- if [[ ! "$CATEGORY" =~ ^($VALID_CATEGORIES)$ ]]; then
91
- echo "Error: --category must be one of: Feature, Bug, Technical-Debt, Optimization (got: $CATEGORY)" >&2
92
- exit 1
93
- fi
85
+ # Validate category using shared enum validation
86
+ validate_enum "$CATEGORY" "category" "Feature|Bug|Technical-Debt|Optimization" || exit 1
94
87
 
95
88
  # Path to backlog file
96
89
  BACKLOG_FILE="readme/BACKLOG.md"
@@ -139,11 +132,16 @@ if grep -qi "$ITEM" "$BACKLOG_PATH" 2>/dev/null; then
139
132
  echo "Warning: Similar item may already exist in backlog" >&2
140
133
  echo "Existing matches:" >&2
141
134
  grep -i "$ITEM" "$BACKLOG_PATH" | head -3 >&2
142
- read -p "Continue anyway? (y/n) " -n 1 -r
143
- echo
144
- if [[ ! $REPLY =~ ^[Yy]$ ]]; then
145
- echo "Aborted" >&2
146
- exit 1
135
+
136
+ if [[ "$FORCE" != "true" ]]; then
137
+ read -p "Continue anyway? (y/n) " -n 1 -r
138
+ echo
139
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
140
+ echo "Aborted" >&2
141
+ exit 1
142
+ fi
143
+ else
144
+ echo "Force mode enabled, proceeding with duplicate item" >&2
147
145
  fi
148
146
  fi
149
147
 
@@ -4,6 +4,10 @@ set -e
4
4
  # cfn-changelog-management/add-changelog-entry.sh
5
5
  # Adds sparse, structured entries to readme/CHANGELOG.md
6
6
 
7
+ # Source shared validation utilities
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+ source "$SCRIPT_DIR/lib/validation.sh"
10
+
7
11
  # Default values
8
12
  TYPE=""
9
13
  SUMMARY=""
@@ -12,6 +16,7 @@ VERSION=""
12
16
  ISSUE=""
13
17
  FILES=""
14
18
  MIGRATION=""
19
+ CUSTOM_DATE=""
15
20
 
16
21
  # Parse arguments
17
22
  while [[ $# -gt 0 ]]; do
@@ -44,6 +49,10 @@ while [[ $# -gt 0 ]]; do
44
49
  MIGRATION="$2"
45
50
  shift 2
46
51
  ;;
52
+ --date)
53
+ CUSTOM_DATE="$2"
54
+ shift 2
55
+ ;;
47
56
  *)
48
57
  echo "Unknown argument: $1" >&2
49
58
  exit 1
@@ -68,24 +77,11 @@ if [[ -z "$IMPACT" ]]; then
68
77
  exit 1
69
78
  fi
70
79
 
71
- # Validate type
72
- VALID_TYPES="feature|bugfix|breaking|dependency|architecture|performance|security"
73
- if [[ ! "$TYPE" =~ ^($VALID_TYPES)$ ]]; then
74
- echo "Error: --type must be one of: feature, bugfix, breaking, dependency, architecture, performance, security (got: $TYPE)" >&2
75
- exit 1
76
- fi
80
+ # Validate type using shared enum validation
81
+ validate_enum "$TYPE" "type" "feature|bugfix|breaking|dependency|architecture|performance|security" || exit 1
77
82
 
78
- # Validate summary length
79
- SUMMARY_LENGTH=${#SUMMARY}
80
- if (( SUMMARY_LENGTH < 10 )); then
81
- echo "Error: --summary must be at least 10 characters (got $SUMMARY_LENGTH)" >&2
82
- exit 1
83
- fi
84
-
85
- if (( SUMMARY_LENGTH > 100 )); then
86
- echo "Error: --summary must be at most 100 characters (got $SUMMARY_LENGTH)" >&2
87
- exit 1
88
- fi
83
+ # Validate summary length using shared validation
84
+ validate_string_length "$SUMMARY" 10 100 "summary" || exit 1
89
85
 
90
86
  # Validate file limit
91
87
  if [[ -n "$FILES" ]]; then
@@ -133,8 +129,14 @@ case "$TYPE" in
133
129
  ;;
134
130
  esac
135
131
 
136
- # Current date
137
- CURRENT_DATE=$(date +%Y-%m-%d)
132
+ # Current date (use custom date if provided)
133
+ if [[ -n "$CUSTOM_DATE" ]]; then
134
+ # Validate date using shared validation
135
+ validate_date "$CUSTOM_DATE" || exit 1
136
+ CURRENT_DATE="$CUSTOM_DATE"
137
+ else
138
+ CURRENT_DATE=$(date +%Y-%m-%d)
139
+ fi
138
140
 
139
141
  # Build entry
140
142
  ENTRY="- $SUMMARY ($CURRENT_DATE)"