claude-flow-novice 2.13.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 (88) 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-cli.md +13 -2
  27. package/claude-assets/commands/cfn/cfn-loop-epic.md +478 -0
  28. package/claude-assets/commands/cfn/cfn-loop-single.md +256 -0
  29. package/claude-assets/commands/cfn/cfn-loop-sprints.md +396 -0
  30. package/claude-assets/commands/cfn/cfn-loop-task.md +27 -9
  31. package/claude-assets/commands/cfn/cfn-loop.md +518 -0
  32. package/claude-assets/commands/cfn/claude-md.md +64 -0
  33. package/claude-assets/commands/cfn/claude-soul.md +22 -0
  34. package/claude-assets/commands/cfn/cost-savings-off.md +35 -0
  35. package/claude-assets/commands/cfn/cost-savings-on.md +35 -0
  36. package/claude-assets/commands/cfn/cost-savings-status.md +34 -0
  37. package/claude-assets/commands/cfn/custom-routing-activate.md +55 -0
  38. package/claude-assets/commands/cfn/custom-routing-deactivate.md +46 -0
  39. package/claude-assets/commands/cfn/dependency-recommendations.md +171 -0
  40. package/claude-assets/commands/cfn/fullstack.md +179 -0
  41. package/claude-assets/commands/cfn/github.md +221 -0
  42. package/claude-assets/commands/cfn/hooks.md +38 -0
  43. package/claude-assets/commands/cfn/metrics-summary.md +58 -0
  44. package/claude-assets/commands/cfn/neural.md +39 -0
  45. package/claude-assets/commands/cfn/parse-epic.md +357 -0
  46. package/claude-assets/commands/cfn/performance.md +41 -0
  47. package/claude-assets/commands/cfn/sparc.md +46 -0
  48. package/claude-assets/commands/cfn/suggest-improvements.md +95 -0
  49. package/claude-assets/commands/cfn/suggest-templates.md +147 -0
  50. package/claude-assets/commands/cfn/swarm.md +24 -0
  51. package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +126 -233
  52. package/claude-assets/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
  53. package/claude-assets/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
  54. package/claude-assets/skills/cfn-changelog-management/bulk-import.sh +268 -0
  55. package/claude-assets/skills/cfn-changelog-management/lib/README.md +212 -0
  56. package/claude-assets/skills/cfn-changelog-management/lib/validation.sh +72 -0
  57. package/claude-assets/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
  58. package/claude-assets/skills/cfn-task-config-init/SKILL.md +204 -0
  59. package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -0
  60. package/dist/agents/agent-loader.js +165 -146
  61. package/dist/agents/agent-loader.js.map +1 -1
  62. package/package.json +2 -2
  63. package/.claude/commands/README.md +0 -205
  64. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
  65. package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
  66. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
  67. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
  68. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
  69. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
  70. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
  71. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
  72. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
  73. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
  74. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
  75. package/.claude/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
  76. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
  77. package/claude-assets/skills/cfn-loop2-output-processing/execute-and-extract.sh.backup +0 -36
  78. package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
  79. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
  80. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
  81. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
  82. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
  83. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
  84. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
  85. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
  86. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
  87. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
  88. package/claude-assets/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
@@ -0,0 +1,460 @@
1
+ ---
2
+ description: "Execute CFN Loop in Task mode (debugging, full visibility, Main Chat coordination)"
3
+ argument-hint: "<task description> [--mode=mvp|standard|enterprise] [--max-iterations=n] [--ace-reflect]"
4
+ allowed-tools: ["Task", "TodoWrite", "Read", "Write", "Edit", "Bash", "Glob", "Grep"]
5
+ ---
6
+
7
+ # 🚨 TASK MODE INSTRUCTIONS FOR MAIN CHAT
8
+
9
+ **YOU are executing this CFN Loop. These are YOUR instructions.**
10
+
11
+ **Task to execute**: $ARGUMENTS
12
+
13
+ ## MODE: Task Mode (Full Visibility, Direct Coordination)
14
+
15
+ **CRITICAL RULES:**
16
+ 1. ❌ **DO NOT spawn cfn-v3-coordinator** - that's for CLI mode
17
+ 2. ❌ **DO NOT ask user "which mode?"** - they already chose Task mode
18
+ 3. ❌ **DO NOT offer options** - execute these instructions directly
19
+ 4. ✅ **YOU spawn all agents** using Task() tool
20
+ 5. ✅ **YOU coordinate the entire workflow** step by step
21
+ 6. ✅ **Follow the 9-step workflow below** exactly
22
+
23
+ ## What is Task Mode?
24
+
25
+ **Task Mode Architecture:**
26
+ - Main Chat coordinates **entire workflow directly**
27
+ - **NO coordinator agent** spawned
28
+ - Main Chat spawns **all agents via Task()**
29
+ - All agents use **Anthropic provider** (Main Chat provider)
30
+ - **Full visibility** in Main Chat (every agent output visible)
31
+ - **Simplified workflow** for debugging and learning
32
+
33
+ **Cost Breakdown:**
34
+ ```
35
+ ┌─────────────────────┬──────────────┬────────────┐
36
+ │ Component │ Provider │ Cost/Call │
37
+ ├─────────────────────┼──────────────┼────────────┤
38
+ │ Main Chat │ Anthropic │ $0.015 │
39
+ │ Loop 3 Agents │ Anthropic │ $0.015 ea │
40
+ │ Loop 2 Agents │ Anthropic │ $0.015 ea │
41
+ │ Product Owner │ Anthropic │ $0.015 │
42
+ └─────────────────────┴──────────────┴────────────┘
43
+
44
+ Total per iteration: ~$0.150 (vs $0.054 CLI mode)
45
+ Cost: 3x CLI mode, but full visibility for debugging
46
+ ```
47
+
48
+ ## When to Use Task Mode
49
+
50
+ **Use Task Mode for:**
51
+ - ✅ Debugging CFN Loop issues
52
+ - ✅ Learning CFN Loop workflow
53
+ - ✅ Understanding agent interactions
54
+ - ✅ Prototyping new agent configurations
55
+ - ✅ Short tasks (<5 min)
56
+
57
+ **Use CLI Mode for:**
58
+ - Production features
59
+ - Long-running tasks (>10 min)
60
+ - Multi-iteration workflows
61
+ - Cost-sensitive projects
62
+
63
+ ## Command Options
64
+
65
+ ```bash
66
+ # Standard mode (recommended)
67
+ /cfn-loop-task "Implement JWT authentication"
68
+
69
+ # MVP mode (fast, lower quality gates)
70
+ /cfn-loop-task "Build prototype feature" --mode=mvp
71
+
72
+ # Enterprise mode with ACE reflection
73
+ /cfn-loop-task "Production security feature" --mode=enterprise --ace-reflect
74
+
75
+ # Custom iteration limits
76
+ /cfn-loop-task "Refactor API" --mode=standard --max-iterations=15
77
+ ```
78
+
79
+ **Options:**
80
+ - `--mode=<mvp|standard|enterprise>`: Quality mode (default: standard)
81
+ - `--max-iterations=<n>`: Max iterations per loop (default: 10)
82
+ - `--ace-reflect`: Enable ACE reflection after sprint (captures lessons learned)
83
+
84
+ ## Mode Comparison
85
+
86
+ | Mode | Gate | Consensus | Iterations | Validators | Use Case |
87
+ |------|------|-----------|------------|------------|----------|
88
+ | MVP | ≥0.70 | ≥0.80 | 5 | 2 | Prototypes, proof-of-concept |
89
+ | Standard | ≥0.75 | ≥0.90 | 10 | 3-4 | Production features |
90
+ | Enterprise | ≥0.85 | ≥0.95 | 15 | 5 | Security, compliance, critical systems |
91
+
92
+ ## 🚨 CRITICAL EXECUTION INSTRUCTIONS
93
+
94
+ **YOU ARE MAIN CHAT. YOU COORDINATE THIS ENTIRE WORKFLOW.**
95
+
96
+ **DO NOT spawn cfn-v3-coordinator or any coordinator agent.**
97
+ **DO NOT ask user which mode to use.**
98
+ **DO NOT offer options.**
99
+
100
+ You must execute this CFN Loop directly using the Task() tool to spawn agents.
101
+
102
+ ---
103
+
104
+ ### Step 1: Read Task Mode Guide
105
+
106
+ Read the complete Task Mode guide for detailed workflow:
107
+
108
+ ```
109
+ Read('.claude/commands/cfn/CFN_LOOP_TASK_MODE.md')
110
+ ```
111
+
112
+ **Expected output:** Complete guide with agent selection, workflow steps, helper scripts
113
+
114
+ ### Step 2: Analyze Task Complexity
115
+
116
+ ```javascript
117
+ // Estimate complexity to scale validators
118
+ const complexity = {
119
+ files: estimateFileCount(), // From task description
120
+ loc: estimateLOC(), // Estimated lines of code
121
+ keywords: extractKeywords() // Security, performance, frontend, etc.
122
+ };
123
+
124
+ // Complexity scoring (from guide)
125
+ let score = 0;
126
+ score += (complexity.files <= 2) ? 10 : (complexity.files <= 5) ? 30 : 60;
127
+ score += (complexity.loc <= 200) ? 10 : (complexity.loc <= 500) ? 30 : 60;
128
+ if (complexity.keywords.match(/auth|payment|token/i)) score += 40; // Security
129
+ if (complexity.keywords.match(/performance|cache/i)) score += 30; // Performance
130
+ if (complexity.keywords.match(/frontend|ui|react/i)) score += 20; // Accessibility
131
+
132
+ // Category: simple (≤50), standard (≤100), complex (>100)
133
+ const category = score <= 50 ? 'simple' : score <= 100 ? 'standard' : 'complex';
134
+ ```
135
+
136
+ ### Step 3: Select Agents (Adaptive Scaling)
137
+
138
+ ```javascript
139
+ // Loop 3 Agents (Implementation) - Based on task type
140
+ const loop3Agents = selectImplementers({
141
+ taskType: extractTaskType(), // backend, fullstack, mobile, infra
142
+ keywords: complexity.keywords
143
+ });
144
+
145
+ // Examples:
146
+ // Backend API: ['backend-dev', 'researcher', 'devops']
147
+ // Full-Stack: ['backend-dev', 'react-frontend-engineer', 'devops']
148
+ // Mobile: ['mobile-dev', 'backend-dev', 'researcher']
149
+ // Infrastructure: ['devops', 'rust-developer', 'researcher']
150
+
151
+ // Loop 2 Agents (Validation) - Adaptive scaling by complexity
152
+ let loop2Agents = ['reviewer', 'tester']; // Base (simple)
153
+
154
+ if (category === 'standard') {
155
+ loop2Agents.push('architect', 'security-specialist');
156
+ }
157
+
158
+ if (category === 'complex') {
159
+ loop2Agents.push('code-analyzer');
160
+ if (complexity.keywords.match(/performance|cache/i)) {
161
+ loop2Agents.push('performance-benchmarker');
162
+ }
163
+ if (complexity.keywords.match(/frontend|ui|react/i)) {
164
+ loop2Agents.push('accessibility-advocate-persona');
165
+ }
166
+ }
167
+
168
+ // Max 6 validators
169
+ loop2Agents = loop2Agents.slice(0, 6);
170
+ ```
171
+
172
+ ### Step 4: Loop 3 - Implementation
173
+
174
+ ```javascript
175
+ let iteration = 1;
176
+ let loop3Confidence = 0;
177
+ const maxIterations = extractFlag('--max-iterations') || 10;
178
+ const mode = extractFlag('--mode') || 'standard';
179
+ const gateThreshold = mode === 'enterprise' ? 0.85 : mode === 'standard' ? 0.75 : 0.70;
180
+
181
+ do {
182
+ console.log(`\n━━━ Loop 3 Iteration ${iteration}/${maxIterations} ━━━`);
183
+
184
+ // Spawn Loop 3 agents in parallel
185
+ const loop3Results = await Promise.all(
186
+ loop3Agents.map(agent =>
187
+ Task(agent, `
188
+ Implement: $ARGUMENTS (iteration ${iteration})
189
+
190
+ ${iteration > 1 ? `Previous iteration feedback:\n${previousFeedback}` : ''}
191
+
192
+ Requirements:
193
+ - Core functionality implemented
194
+ - Tests written (>80% coverage)
195
+ - Security considerations addressed
196
+ - Documentation included
197
+
198
+ Report confidence score (0.0-1.0) when complete.
199
+ `)
200
+ )
201
+ );
202
+
203
+ // Calculate average confidence
204
+ loop3Confidence = average(loop3Results.map(r => parseConfidence(r.output)));
205
+
206
+ console.log(`Loop 3 confidence: ${loop3Confidence} (threshold: ${gateThreshold})`);
207
+
208
+ if (loop3Confidence >= gateThreshold) {
209
+ console.log('✅ Loop 3 gate PASSED, proceeding to Loop 2');
210
+ break;
211
+ } else {
212
+ console.log(`⚠️ Loop 3 gate FAILED, iteration ${iteration + 1}`);
213
+ previousFeedback = generateFeedback(loop3Results);
214
+ iteration++;
215
+ }
216
+ } while (iteration <= maxIterations);
217
+ ```
218
+
219
+ ### Step 5: Loop 2 - Validation
220
+
221
+ ```javascript
222
+ console.log(`\n━━━ Loop 2 Validation ━━━`);
223
+
224
+ const consensusThreshold = mode === 'enterprise' ? 0.95 : mode === 'standard' ? 0.90 : 0.80;
225
+
226
+ // Spawn Loop 2 validators in parallel
227
+ const loop2Results = await Promise.all(
228
+ loop2Agents.map(validator =>
229
+ Task(validator, `
230
+ Review implementation from Loop 3.
231
+
232
+ Files modified: $(git diff --name-only HEAD)
233
+
234
+ Validation focus:
235
+ - Code quality and best practices
236
+ - Test coverage and quality
237
+ - Security vulnerabilities
238
+ - Architecture consistency
239
+ ${validator === 'accessibility-advocate-persona' ? '- WCAG AA compliance' : ''}
240
+ ${validator === 'performance-benchmarker' ? '- Performance optimization' : ''}
241
+
242
+ Report consensus score (0.0-1.0) when complete.
243
+ `)
244
+ )
245
+ );
246
+
247
+ const consensus = average(loop2Results.map(r => parseConfidence(r.output)));
248
+
249
+ console.log(`Loop 2 consensus: ${consensus} (threshold: ${consensusThreshold})`);
250
+ ```
251
+
252
+ ### Step 6: Product Owner Decision
253
+
254
+ ```javascript
255
+ // Build context for Product Owner
256
+ const poContext = `
257
+ CFN Loop Task Mode - Iteration ${iteration} Complete
258
+
259
+ Task: $ARGUMENTS
260
+ Mode: ${mode.toUpperCase()}
261
+
262
+ Results:
263
+ - Loop 3 confidence: ${loop3Confidence} (gate: ${gateThreshold})
264
+ - Loop 2 consensus: ${consensus} (threshold: ${consensusThreshold})
265
+ - Iterations completed: ${iteration}/${maxIterations}
266
+
267
+ Deliverables:
268
+ $(git diff --name-status HEAD)
269
+
270
+ Decision Framework:
271
+ - PROCEED: Consensus >= ${consensusThreshold} AND deliverables verified
272
+ - ITERATE: Consensus < ${consensusThreshold} AND iteration < ${maxIterations}
273
+ - ABORT: Max iterations reached OR critical blocker
274
+
275
+ Output format (REQUIRED):
276
+ DECISION: PROCEED|ITERATE|ABORT
277
+ REASONING: [why]
278
+ `;
279
+
280
+ // Spawn Product Owner via Task()
281
+ const poOutput = await Task('product-owner', poContext);
282
+
283
+ // Parse decision using helper script
284
+ const decision = Bash(`./.claude/skills/cfn-product-owner-decision/parse-decision.sh --output "${poOutput}"`);
285
+
286
+ console.log(`Product Owner decision: ${decision}`);
287
+ ```
288
+
289
+ ### Step 7: Validate Deliverables
290
+
291
+ ```javascript
292
+ // Prevent "consensus on vapor" (high consensus, zero deliverables)
293
+ const deliverableStatus = Bash(`./.claude/skills/cfn-product-owner-decision/validate-deliverables.sh --task-id "task-mode-${Date.now()}"`);
294
+
295
+ if (deliverableStatus === 'FAILED' && taskRequiresImplementation($ARGUMENTS)) {
296
+ console.log('⚠️ No deliverables created - overriding PROCEED to ITERATE');
297
+ decision = 'ITERATE';
298
+ }
299
+ ```
300
+
301
+ ### Step 8: Execute Decision
302
+
303
+ ```javascript
304
+ if (decision === 'PROCEED') {
305
+ console.log('✅ Product Owner approved - committing changes');
306
+
307
+ // Git commit and push
308
+ Bash(`git add . && git commit -m "$(cat <<'EOF'
309
+ feat: $ARGUMENTS
310
+
311
+ Deliverables:
312
+ $(git diff --name-only HEAD | sed 's/^/- /')
313
+
314
+ Validation:
315
+ - Loop 3 confidence: ${loop3Confidence}
316
+ - Loop 2 consensus: ${consensus}
317
+ - Iterations: ${iteration}
318
+
319
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
320
+ Co-Authored-By: Claude <noreply@anthropic.com>
321
+ EOF
322
+ )" && git push origin main`);
323
+
324
+ // Generate sprint summary
325
+ Write(`docs/SPRINT_${iteration}_COMPLETE.md`, `
326
+ # Sprint ${iteration} Complete
327
+
328
+ **Date:** $(date +%Y-%m-%d) | **Consensus:** ${consensus}
329
+
330
+ ## Deliverables
331
+ $(git diff HEAD~1 --name-status | awk '{print "- "$2}')
332
+
333
+ ## Validation
334
+ - Loop 3 iterations: ${iteration}
335
+ - Loop 2 consensus: ${consensus}
336
+ - Decision: PROCEED
337
+ `);
338
+
339
+ console.log('✅ Sprint complete - changes committed and pushed');
340
+
341
+ } else if (decision === 'ITERATE') {
342
+ console.log('🔄 Iterating with feedback...');
343
+ // Repeat from Step 4 with validator feedback
344
+
345
+ } else {
346
+ console.log('❌ Max iterations reached or critical blocker - aborting');
347
+ }
348
+ ```
349
+
350
+ ### Step 9: ACE Reflection (Optional)
351
+
352
+ ```javascript
353
+ // Only if --ace-reflect flag enabled
354
+ const aceReflectEnabled = extractFlag('--ace-reflect') === true;
355
+
356
+ if (aceReflectEnabled && decision === 'PROCEED') {
357
+ console.log('📊 Capturing ACE reflection...');
358
+
359
+ Bash(`./.claude/skills/cfn-ace-system/invoke-context-reflect.sh \\
360
+ --task-id "task-mode-${Date.now()}" \\
361
+ --sprint-id "${iteration}" \\
362
+ --consensus "${consensus}" \\
363
+ --iterations-loop3 "${iteration}" \\
364
+ --iterations-loop2 "1" \\
365
+ --deliverables "$(git diff HEAD~1 --name-only | tr '\n' ',')"`);
366
+
367
+ console.log('✅ ACE reflection captured');
368
+ }
369
+ ```
370
+
371
+ ## Task Mode Benefits
372
+
373
+ **Full Visibility:**
374
+ - Every agent output visible in Main Chat
375
+ - Easy to debug agent behavior
376
+ - Clear understanding of iteration flow
377
+ - Immediate feedback on issues
378
+
379
+ **Simplified Workflow:**
380
+ - No coordinator abstraction layer
381
+ - Direct Task() spawning
382
+ - Easier to modify and experiment
383
+ - Better for learning CFN Loop
384
+
385
+ **Debugging Features:**
386
+ - See exact confidence scores
387
+ - View validator feedback in real-time
388
+ - Understand Product Owner reasoning
389
+ - Trace decision-making logic
390
+
391
+ ## Task Mode Limitations
392
+
393
+ **Cost:**
394
+ - 3x more expensive than CLI mode
395
+ - All agents use Anthropic provider
396
+ - No Z.ai cost savings
397
+
398
+ **Performance:**
399
+ - Sequential iteration cycles (no background processing)
400
+ - Main Chat must stay active (no crash recovery)
401
+ - No Redis state persistence
402
+
403
+ **Scalability:**
404
+ - Limited to 10-15 agents (visibility bottleneck)
405
+ - Long tasks may timeout (10-min Bash limit)
406
+
407
+ ## Autonomous Execution Rules
408
+
409
+ **YOU ARE FORBIDDEN FROM:**
410
+ - ❌ Asking "Should I retry?" (ALWAYS retry if iterations < max)
411
+ - ❌ Asking "Proceed to next step?" (AUTO-PROCEED based on thresholds)
412
+ - ❌ Waiting for approval during CFN Loop cycles
413
+ - ❌ Spawning a coordinator agent (Main Chat coordinates directly)
414
+
415
+ **YOU MUST:**
416
+ - ✅ IMMEDIATELY retry Loop 3 on gate failure (iteration < max)
417
+ - ✅ IMMEDIATELY retry Loop 2 on consensus failure (iteration < max)
418
+ - ✅ AUTOMATICALLY execute Product Owner decision
419
+ - ✅ ONLY escalate when truly blocked (max iterations or critical error)
420
+
421
+ ## Helper Scripts (Task Mode)
422
+
423
+ **DO NOT use execute-decision.sh (it spawns PO via CLI):**
424
+ ```bash
425
+ # ❌ WRONG - spawns duplicate Product Owner
426
+ ./.claude/skills/cfn-product-owner-decision/execute-decision.sh
427
+
428
+ # ✅ CORRECT - Main Chat spawns PO via Task(), then parses output
429
+ Task('product-owner', context)
430
+ parse-decision.sh --output "$PO_OUTPUT"
431
+ ```
432
+
433
+ **DO use these helper scripts:**
434
+ ```bash
435
+ # Parse Product Owner decision
436
+ ./.claude/skills/cfn-product-owner-decision/parse-decision.sh --output "$OUTPUT"
437
+
438
+ # Validate deliverables exist
439
+ ./.claude/skills/cfn-product-owner-decision/validate-deliverables.sh --task-id "$TASK_ID"
440
+
441
+ # Multi-pattern confidence parsing
442
+ ./.claude/skills/cfn-loop3-output-processing/parse-confidence.sh --output "$AGENT_OUTPUT"
443
+ ```
444
+
445
+ ## Related Commands
446
+
447
+ - **CLI Mode**: `/cfn-loop-cli` (production, cost-optimized)
448
+ - **Frontend**: `/cfn-loop-frontend` (visual iteration workflow)
449
+ - **Documentation**: `/cfn-loop-document` (generate docs)
450
+
451
+ ## Related Documentation
452
+
453
+ - **Task Mode Guide**: `.claude/commands/cfn/CFN_LOOP_TASK_MODE.md` (complete reference)
454
+ - Coordinator Parameters: `.claude/commands/cfn/CFN_COORDINATOR_PARAMETERS.md`
455
+ - Agent Output Standards: `docs/AGENT_OUTPUT_STANDARDS.md`
456
+ - ACE System: `.claude/skills/cfn-ace-system/SKILL.md`
457
+
458
+ ---
459
+
460
+ **Version:** 1.0.0 (2025-10-31) - Task mode: debugging, full visibility, Main Chat coordination
@@ -98,16 +98,18 @@ if (similarity > threshold) {
98
98
  }
99
99
  ```
100
100
 
101
- **Implementation:**
101
+ **Curation Prompt Template:**
102
+ ```
103
+ You are a Context Curator for the ACE (Adaptive Context Extension) system.
102
104
 
103
- Spawn the `context-curator` agent:
105
+ **Pending Reflection:**
106
+ {reflection_data}
104
107
 
105
- ```javascript
106
- Task("context-curator", `
107
- You are a Context Curator for the ACE system.
108
+ **Existing Bullets (Semantic Neighbors):**
109
+ {similar_bullets}
108
110
 
109
111
  **Your Mission:**
110
- Merge pending reflections into adaptive_context table. For each reflection:
112
+ For each extracted lesson in the reflection:
111
113
 
112
114
  1. **Check for semantic similarity**:
113
115
  - Compare with existing bullets
@@ -129,38 +131,25 @@ Merge pending reflections into adaptive_context table. For each reflection:
129
131
  - Medium (5-7): Optimization tips, domain insights
130
132
  - Low (1-4): Edge cases, situational patterns
131
133
 
132
- 5. Update counters (helpful/harmful)
133
-
134
- **Steps:**
135
- 1. Query pending reflections:
136
- \`\`\`bash
137
- ./.claude/skills/cfn-ace-system/query-reflections.sh --status pending --limit 10
138
- \`\`\`
139
-
140
- 2. For each reflection, check for similar bullets:
141
- \`\`\`bash
142
- sqlite3 ./.artifacts/database/swarm-memory.db "
143
- SELECT bullet_id, content, confidence_score
144
- FROM adaptive_context
145
- WHERE is_active = 1 AND category = '\${CATEGORY}'
146
- LIMIT 10;
147
- "
148
- \`\`\`
149
-
150
- 3. Decide action and execute:
151
- - **New bullet**: Use add-bullet.sh
152
- - **Increment helpful**: Update helpful_count
153
- - **Merge similar**: Create new version, archive old
154
-
155
- 4. Update reflection status:
156
- \`\`\`bash
157
- ./.claude/skills/cfn-ace-system/update-reflection.sh \\
158
- --reflection-id \${REFL_ID} \\
159
- --status merged
160
- \`\`\`
161
-
162
- 5. Report actions taken
163
- `, "context-curator");
134
+ 5. **Update counters**:
135
+ - Identify helpful_existing_bullets → increment their helpful_count
136
+ - Identify harmful_existing_bullets → increment their harmful_count
137
+
138
+ **Output Format (JSON):**
139
+ {
140
+ "curation_actions": [
141
+ {
142
+ "action": "new_bullet|increment_helpful|increment_harmful|merge_similar|archive",
143
+ "bullet_id": "STRAT-042",
144
+ "target_bullet_id": "STRAT-001", // For increment/merge actions
145
+ "similarity_score": 0.92,
146
+ "reasoning": "Why this action is appropriate",
147
+ "merged_content": "New merged content (if merge action)"
148
+ }
149
+ ],
150
+ "validation_required": ["STRAT-042"], // Bullets needing human review
151
+ "summary": "Curated 5 lessons: 2 new, 3 reinforced existing"
152
+ }
164
153
  ```
165
154
 
166
155
  **Post-Curation:**
@@ -139,7 +139,7 @@ Inject bullets relevant to specific agent types:
139
139
 
140
140
  ```bash
141
141
  # For security specialist agents
142
- /context-inject --agent-type=security-specialist --target=./.claude/agents/cfn-dev-team/security-specialist.md
142
+ /context-inject --agent-type=security-specialist --target=./.claude/agents/security-specialist.md
143
143
 
144
144
  # For coder agents
145
145
  /context-inject --agent-type=coder --category=pattern --min-helpful=5
@@ -162,7 +162,7 @@ async function preAgentSpawnContext(agentType, taskContext) {
162
162
  });
163
163
 
164
164
  // Inject into agent's instruction file
165
- const agentFile = `./.claude/agents/cfn-dev-team/${agentType}.md`;
165
+ const agentFile = `./.claude/agents/${agentType}.md`;
166
166
  await injectBullets(agentFile, bullets, { mode: 'merge' });
167
167
 
168
168
  // Log usage
@@ -172,29 +172,18 @@ async function preAgentSpawnContext(agentType, taskContext) {
172
172
  }
173
173
  ```
174
174
 
175
- **Dynamic Injection:**
175
+ **Dynamic Injection During Execution:**
176
176
 
177
- ```bash
178
- # Query top bullets for current task
179
- BULLETS=$(sqlite3 ./.artifacts/database/swarm-memory.db "
180
- SELECT '**[' || bullet_id || ']** ' || content || ' (confidence: ' || confidence_score || ')'
181
- FROM adaptive_context
182
- WHERE is_active = 1
183
- AND (tags LIKE '%auth%' OR tags LIKE '%security%')
184
- AND confidence_score >= 0.7
185
- ORDER BY helpful_count DESC, confidence_score DESC
186
- LIMIT 5;
187
- ")
188
-
189
- # Inject into agent prompt
190
- Task("coder-1", "
191
- Implement authentication system.
192
-
193
- Before you start, review these proven patterns:
194
- $BULLETS
195
-
196
- Follow these patterns to avoid common pitfalls.
197
- ", "coder");
177
+ ```javascript
178
+ // During CFN Loop 3, inject relevant optimization bullets
179
+ Task("coder-1", `
180
+ Implement authentication system.
181
+
182
+ Before you start, check these adaptive context bullets:
183
+ ${await contextInject({ tags: 'auth,security', limit: 5, format: 'inline' })}
184
+
185
+ Follow these proven patterns to avoid common pitfalls.
186
+ `, "coder");
198
187
  ```
199
188
 
200
189
  **Validation & Safety:**
@@ -221,7 +210,7 @@ rules:
221
210
  action: context-inject
222
211
  params:
223
212
  agent-type: ${agent_type}
224
- target: ./.claude/agents/cfn-dev-team/${agent_type}.md
213
+ target: ./.claude/agents/${agent_type}.md
225
214
  limit: 10
226
215
 
227
216
  - trigger: task-start