claude-flow-novice 2.12.0 → 2.13.0

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 (40) hide show
  1. package/.claude/commands/README.md +177 -129
  2. package/claude-assets/commands/cfn/README.md +177 -129
  3. package/claude-assets/commands/cfn/cfn-loop-cli.md +268 -0
  4. package/claude-assets/commands/cfn/cfn-loop-document.md +20 -1
  5. package/claude-assets/commands/cfn/cfn-loop-frontend.md +17 -2
  6. package/claude-assets/commands/cfn/cfn-loop-task.md +442 -0
  7. package/claude-assets/commands/cfn/context-curate.md +27 -38
  8. package/claude-assets/commands/cfn/context-inject.md +14 -25
  9. package/claude-assets/commands/cfn/context-query.md +40 -45
  10. package/claude-assets/commands/cfn/context-reflect.md +40 -38
  11. package/claude-assets/commands/cfn/context-stats.md +13 -38
  12. package/claude-assets/commands/cfn/launch-web-dashboard.md +0 -295
  13. package/claude-assets/commands/cfn/list-agents-rebuild.md +18 -18
  14. package/claude-assets/commands/cfn/write-plan.md +246 -75
  15. package/dist/cli/config-manager.js +109 -91
  16. package/package.json +1 -1
  17. package/claude-assets/commands/cfn/auto-compact.md +0 -80
  18. package/claude-assets/commands/cfn/cfn-loop-epic.md +0 -478
  19. package/claude-assets/commands/cfn/cfn-loop-single.md +0 -256
  20. package/claude-assets/commands/cfn/cfn-loop-sprints.md +0 -396
  21. package/claude-assets/commands/cfn/cfn-loop.md +0 -518
  22. package/claude-assets/commands/cfn/claude-md.md +0 -64
  23. package/claude-assets/commands/cfn/claude-soul.md +0 -22
  24. package/claude-assets/commands/cfn/cost-savings-off.md +0 -35
  25. package/claude-assets/commands/cfn/cost-savings-on.md +0 -35
  26. package/claude-assets/commands/cfn/cost-savings-status.md +0 -34
  27. package/claude-assets/commands/cfn/custom-routing-activate.md +0 -55
  28. package/claude-assets/commands/cfn/custom-routing-deactivate.md +0 -46
  29. package/claude-assets/commands/cfn/dependency-recommendations.md +0 -171
  30. package/claude-assets/commands/cfn/fullstack.md +0 -179
  31. package/claude-assets/commands/cfn/github.md +0 -221
  32. package/claude-assets/commands/cfn/hooks.md +0 -38
  33. package/claude-assets/commands/cfn/metrics-summary.md +0 -58
  34. package/claude-assets/commands/cfn/neural.md +0 -39
  35. package/claude-assets/commands/cfn/parse-epic.md +0 -357
  36. package/claude-assets/commands/cfn/performance.md +0 -41
  37. package/claude-assets/commands/cfn/sparc.md +0 -46
  38. package/claude-assets/commands/cfn/suggest-improvements.md +0 -95
  39. package/claude-assets/commands/cfn/suggest-templates.md +0 -147
  40. package/claude-assets/commands/cfn/swarm.md +0 -24
@@ -0,0 +1,442 @@
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
+ # CFN Loop Task Mode - Debugging & Learning
8
+
9
+ Execute CFN Loop using Task() spawning for full visibility and debugging.
10
+
11
+ 🚨 **TASK MODE: Debugging, Learning, Full Transparency**
12
+
13
+ **Task**: $ARGUMENTS
14
+
15
+ ## What is Task Mode?
16
+
17
+ **Task Mode Architecture:**
18
+ - Main Chat coordinates **entire workflow directly**
19
+ - **NO coordinator agent** spawned
20
+ - Main Chat spawns **all agents via Task()**
21
+ - All agents use **Anthropic provider** (Main Chat provider)
22
+ - **Full visibility** in Main Chat (every agent output visible)
23
+ - **Simplified workflow** for debugging and learning
24
+
25
+ **Cost Breakdown:**
26
+ ```
27
+ ┌─────────────────────┬──────────────┬────────────┐
28
+ │ Component │ Provider │ Cost/Call │
29
+ ├─────────────────────┼──────────────┼────────────┤
30
+ │ Main Chat │ Anthropic │ $0.015 │
31
+ │ Loop 3 Agents │ Anthropic │ $0.015 ea │
32
+ │ Loop 2 Agents │ Anthropic │ $0.015 ea │
33
+ │ Product Owner │ Anthropic │ $0.015 │
34
+ └─────────────────────┴──────────────┴────────────┘
35
+
36
+ Total per iteration: ~$0.150 (vs $0.054 CLI mode)
37
+ Cost: 3x CLI mode, but full visibility for debugging
38
+ ```
39
+
40
+ ## When to Use Task Mode
41
+
42
+ **Use Task Mode for:**
43
+ - ✅ Debugging CFN Loop issues
44
+ - ✅ Learning CFN Loop workflow
45
+ - ✅ Understanding agent interactions
46
+ - ✅ Prototyping new agent configurations
47
+ - ✅ Short tasks (<5 min)
48
+
49
+ **Use CLI Mode for:**
50
+ - Production features
51
+ - Long-running tasks (>10 min)
52
+ - Multi-iteration workflows
53
+ - Cost-sensitive projects
54
+
55
+ ## Command Options
56
+
57
+ ```bash
58
+ # Standard mode (recommended)
59
+ /cfn-loop-task "Implement JWT authentication"
60
+
61
+ # MVP mode (fast, lower quality gates)
62
+ /cfn-loop-task "Build prototype feature" --mode=mvp
63
+
64
+ # Enterprise mode with ACE reflection
65
+ /cfn-loop-task "Production security feature" --mode=enterprise --ace-reflect
66
+
67
+ # Custom iteration limits
68
+ /cfn-loop-task "Refactor API" --mode=standard --max-iterations=15
69
+ ```
70
+
71
+ **Options:**
72
+ - `--mode=<mvp|standard|enterprise>`: Quality mode (default: standard)
73
+ - `--max-iterations=<n>`: Max iterations per loop (default: 10)
74
+ - `--ace-reflect`: Enable ACE reflection after sprint (captures lessons learned)
75
+
76
+ ## Mode Comparison
77
+
78
+ | Mode | Gate | Consensus | Iterations | Validators | Use Case |
79
+ |------|------|-----------|------------|------------|----------|
80
+ | MVP | ≥0.70 | ≥0.80 | 5 | 2 | Prototypes, proof-of-concept |
81
+ | Standard | ≥0.75 | ≥0.90 | 10 | 3-4 | Production features |
82
+ | Enterprise | ≥0.85 | ≥0.95 | 15 | 5 | Security, compliance, critical systems |
83
+
84
+ ## Execution Instructions
85
+
86
+ **Main Chat coordinates directly. NO coordinator agent spawned.**
87
+
88
+ ### Step 1: Read Task Mode Guide
89
+
90
+ ```javascript
91
+ const guide = Read('.claude/commands/cfn/CFN_LOOP_TASK_MODE.md');
92
+
93
+ console.log('Task Mode: Main Chat coordinating CFN Loop directly');
94
+ ```
95
+
96
+ ### Step 2: Analyze Task Complexity
97
+
98
+ ```javascript
99
+ // Estimate complexity to scale validators
100
+ const complexity = {
101
+ files: estimateFileCount(), // From task description
102
+ loc: estimateLOC(), // Estimated lines of code
103
+ keywords: extractKeywords() // Security, performance, frontend, etc.
104
+ };
105
+
106
+ // Complexity scoring (from guide)
107
+ let score = 0;
108
+ score += (complexity.files <= 2) ? 10 : (complexity.files <= 5) ? 30 : 60;
109
+ score += (complexity.loc <= 200) ? 10 : (complexity.loc <= 500) ? 30 : 60;
110
+ if (complexity.keywords.match(/auth|payment|token/i)) score += 40; // Security
111
+ if (complexity.keywords.match(/performance|cache/i)) score += 30; // Performance
112
+ if (complexity.keywords.match(/frontend|ui|react/i)) score += 20; // Accessibility
113
+
114
+ // Category: simple (≤50), standard (≤100), complex (>100)
115
+ const category = score <= 50 ? 'simple' : score <= 100 ? 'standard' : 'complex';
116
+ ```
117
+
118
+ ### Step 3: Select Agents (Adaptive Scaling)
119
+
120
+ ```javascript
121
+ // Loop 3 Agents (Implementation) - Based on task type
122
+ const loop3Agents = selectImplementers({
123
+ taskType: extractTaskType(), // backend, fullstack, mobile, infra
124
+ keywords: complexity.keywords
125
+ });
126
+
127
+ // Examples:
128
+ // Backend API: ['backend-dev', 'researcher', 'devops']
129
+ // Full-Stack: ['backend-dev', 'react-frontend-engineer', 'devops']
130
+ // Mobile: ['mobile-dev', 'backend-dev', 'researcher']
131
+ // Infrastructure: ['devops', 'rust-developer', 'researcher']
132
+
133
+ // Loop 2 Agents (Validation) - Adaptive scaling by complexity
134
+ let loop2Agents = ['reviewer', 'tester']; // Base (simple)
135
+
136
+ if (category === 'standard') {
137
+ loop2Agents.push('architect', 'security-specialist');
138
+ }
139
+
140
+ if (category === 'complex') {
141
+ loop2Agents.push('code-analyzer');
142
+ if (complexity.keywords.match(/performance|cache/i)) {
143
+ loop2Agents.push('performance-benchmarker');
144
+ }
145
+ if (complexity.keywords.match(/frontend|ui|react/i)) {
146
+ loop2Agents.push('accessibility-advocate-persona');
147
+ }
148
+ }
149
+
150
+ // Max 6 validators
151
+ loop2Agents = loop2Agents.slice(0, 6);
152
+ ```
153
+
154
+ ### Step 4: Loop 3 - Implementation
155
+
156
+ ```javascript
157
+ let iteration = 1;
158
+ let loop3Confidence = 0;
159
+ const maxIterations = extractFlag('--max-iterations') || 10;
160
+ const mode = extractFlag('--mode') || 'standard';
161
+ const gateThreshold = mode === 'enterprise' ? 0.85 : mode === 'standard' ? 0.75 : 0.70;
162
+
163
+ do {
164
+ console.log(`\n━━━ Loop 3 Iteration ${iteration}/${maxIterations} ━━━`);
165
+
166
+ // Spawn Loop 3 agents in parallel
167
+ const loop3Results = await Promise.all(
168
+ loop3Agents.map(agent =>
169
+ Task(agent, `
170
+ Implement: $ARGUMENTS (iteration ${iteration})
171
+
172
+ ${iteration > 1 ? `Previous iteration feedback:\n${previousFeedback}` : ''}
173
+
174
+ Requirements:
175
+ - Core functionality implemented
176
+ - Tests written (>80% coverage)
177
+ - Security considerations addressed
178
+ - Documentation included
179
+
180
+ Report confidence score (0.0-1.0) when complete.
181
+ `)
182
+ )
183
+ );
184
+
185
+ // Calculate average confidence
186
+ loop3Confidence = average(loop3Results.map(r => parseConfidence(r.output)));
187
+
188
+ console.log(`Loop 3 confidence: ${loop3Confidence} (threshold: ${gateThreshold})`);
189
+
190
+ if (loop3Confidence >= gateThreshold) {
191
+ console.log('✅ Loop 3 gate PASSED, proceeding to Loop 2');
192
+ break;
193
+ } else {
194
+ console.log(`⚠️ Loop 3 gate FAILED, iteration ${iteration + 1}`);
195
+ previousFeedback = generateFeedback(loop3Results);
196
+ iteration++;
197
+ }
198
+ } while (iteration <= maxIterations);
199
+ ```
200
+
201
+ ### Step 5: Loop 2 - Validation
202
+
203
+ ```javascript
204
+ console.log(`\n━━━ Loop 2 Validation ━━━`);
205
+
206
+ const consensusThreshold = mode === 'enterprise' ? 0.95 : mode === 'standard' ? 0.90 : 0.80;
207
+
208
+ // Spawn Loop 2 validators in parallel
209
+ const loop2Results = await Promise.all(
210
+ loop2Agents.map(validator =>
211
+ Task(validator, `
212
+ Review implementation from Loop 3.
213
+
214
+ Files modified: $(git diff --name-only HEAD)
215
+
216
+ Validation focus:
217
+ - Code quality and best practices
218
+ - Test coverage and quality
219
+ - Security vulnerabilities
220
+ - Architecture consistency
221
+ ${validator === 'accessibility-advocate-persona' ? '- WCAG AA compliance' : ''}
222
+ ${validator === 'performance-benchmarker' ? '- Performance optimization' : ''}
223
+
224
+ Report consensus score (0.0-1.0) when complete.
225
+ `)
226
+ )
227
+ );
228
+
229
+ const consensus = average(loop2Results.map(r => parseConfidence(r.output)));
230
+
231
+ console.log(`Loop 2 consensus: ${consensus} (threshold: ${consensusThreshold})`);
232
+ ```
233
+
234
+ ### Step 6: Product Owner Decision
235
+
236
+ ```javascript
237
+ // Build context for Product Owner
238
+ const poContext = `
239
+ CFN Loop Task Mode - Iteration ${iteration} Complete
240
+
241
+ Task: $ARGUMENTS
242
+ Mode: ${mode.toUpperCase()}
243
+
244
+ Results:
245
+ - Loop 3 confidence: ${loop3Confidence} (gate: ${gateThreshold})
246
+ - Loop 2 consensus: ${consensus} (threshold: ${consensusThreshold})
247
+ - Iterations completed: ${iteration}/${maxIterations}
248
+
249
+ Deliverables:
250
+ $(git diff --name-status HEAD)
251
+
252
+ Decision Framework:
253
+ - PROCEED: Consensus >= ${consensusThreshold} AND deliverables verified
254
+ - ITERATE: Consensus < ${consensusThreshold} AND iteration < ${maxIterations}
255
+ - ABORT: Max iterations reached OR critical blocker
256
+
257
+ Output format (REQUIRED):
258
+ DECISION: PROCEED|ITERATE|ABORT
259
+ REASONING: [why]
260
+ `;
261
+
262
+ // Spawn Product Owner via Task()
263
+ const poOutput = await Task('product-owner', poContext);
264
+
265
+ // Parse decision using helper script
266
+ const decision = Bash(`./.claude/skills/cfn-product-owner-decision/parse-decision.sh --output "${poOutput}"`);
267
+
268
+ console.log(`Product Owner decision: ${decision}`);
269
+ ```
270
+
271
+ ### Step 7: Validate Deliverables
272
+
273
+ ```javascript
274
+ // Prevent "consensus on vapor" (high consensus, zero deliverables)
275
+ const deliverableStatus = Bash(`./.claude/skills/cfn-product-owner-decision/validate-deliverables.sh --task-id "task-mode-${Date.now()}"`);
276
+
277
+ if (deliverableStatus === 'FAILED' && taskRequiresImplementation($ARGUMENTS)) {
278
+ console.log('⚠️ No deliverables created - overriding PROCEED to ITERATE');
279
+ decision = 'ITERATE';
280
+ }
281
+ ```
282
+
283
+ ### Step 8: Execute Decision
284
+
285
+ ```javascript
286
+ if (decision === 'PROCEED') {
287
+ console.log('✅ Product Owner approved - committing changes');
288
+
289
+ // Git commit and push
290
+ Bash(`git add . && git commit -m "$(cat <<'EOF'
291
+ feat: $ARGUMENTS
292
+
293
+ Deliverables:
294
+ $(git diff --name-only HEAD | sed 's/^/- /')
295
+
296
+ Validation:
297
+ - Loop 3 confidence: ${loop3Confidence}
298
+ - Loop 2 consensus: ${consensus}
299
+ - Iterations: ${iteration}
300
+
301
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
302
+ Co-Authored-By: Claude <noreply@anthropic.com>
303
+ EOF
304
+ )" && git push origin main`);
305
+
306
+ // Generate sprint summary
307
+ Write(`docs/SPRINT_${iteration}_COMPLETE.md`, `
308
+ # Sprint ${iteration} Complete
309
+
310
+ **Date:** $(date +%Y-%m-%d) | **Consensus:** ${consensus}
311
+
312
+ ## Deliverables
313
+ $(git diff HEAD~1 --name-status | awk '{print "- "$2}')
314
+
315
+ ## Validation
316
+ - Loop 3 iterations: ${iteration}
317
+ - Loop 2 consensus: ${consensus}
318
+ - Decision: PROCEED
319
+ `);
320
+
321
+ console.log('✅ Sprint complete - changes committed and pushed');
322
+
323
+ } else if (decision === 'ITERATE') {
324
+ console.log('🔄 Iterating with feedback...');
325
+ // Repeat from Step 4 with validator feedback
326
+
327
+ } else {
328
+ console.log('❌ Max iterations reached or critical blocker - aborting');
329
+ }
330
+ ```
331
+
332
+ ### Step 9: ACE Reflection (Optional)
333
+
334
+ ```javascript
335
+ // Only if --ace-reflect flag enabled
336
+ const aceReflectEnabled = extractFlag('--ace-reflect') === true;
337
+
338
+ if (aceReflectEnabled && decision === 'PROCEED') {
339
+ console.log('📊 Capturing ACE reflection...');
340
+
341
+ Bash(`./.claude/skills/cfn-ace-system/invoke-context-reflect.sh \\
342
+ --task-id "task-mode-${Date.now()}" \\
343
+ --sprint-id "${iteration}" \\
344
+ --consensus "${consensus}" \\
345
+ --iterations-loop3 "${iteration}" \\
346
+ --iterations-loop2 "1" \\
347
+ --deliverables "$(git diff HEAD~1 --name-only | tr '\n' ',')"`);
348
+
349
+ console.log('✅ ACE reflection captured');
350
+ }
351
+ ```
352
+
353
+ ## Task Mode Benefits
354
+
355
+ **Full Visibility:**
356
+ - Every agent output visible in Main Chat
357
+ - Easy to debug agent behavior
358
+ - Clear understanding of iteration flow
359
+ - Immediate feedback on issues
360
+
361
+ **Simplified Workflow:**
362
+ - No coordinator abstraction layer
363
+ - Direct Task() spawning
364
+ - Easier to modify and experiment
365
+ - Better for learning CFN Loop
366
+
367
+ **Debugging Features:**
368
+ - See exact confidence scores
369
+ - View validator feedback in real-time
370
+ - Understand Product Owner reasoning
371
+ - Trace decision-making logic
372
+
373
+ ## Task Mode Limitations
374
+
375
+ **Cost:**
376
+ - 3x more expensive than CLI mode
377
+ - All agents use Anthropic provider
378
+ - No Z.ai cost savings
379
+
380
+ **Performance:**
381
+ - Sequential iteration cycles (no background processing)
382
+ - Main Chat must stay active (no crash recovery)
383
+ - No Redis state persistence
384
+
385
+ **Scalability:**
386
+ - Limited to 10-15 agents (visibility bottleneck)
387
+ - Long tasks may timeout (10-min Bash limit)
388
+
389
+ ## Autonomous Execution Rules
390
+
391
+ **YOU ARE FORBIDDEN FROM:**
392
+ - ❌ Asking "Should I retry?" (ALWAYS retry if iterations < max)
393
+ - ❌ Asking "Proceed to next step?" (AUTO-PROCEED based on thresholds)
394
+ - ❌ Waiting for approval during CFN Loop cycles
395
+ - ❌ Spawning a coordinator agent (Main Chat coordinates directly)
396
+
397
+ **YOU MUST:**
398
+ - ✅ IMMEDIATELY retry Loop 3 on gate failure (iteration < max)
399
+ - ✅ IMMEDIATELY retry Loop 2 on consensus failure (iteration < max)
400
+ - ✅ AUTOMATICALLY execute Product Owner decision
401
+ - ✅ ONLY escalate when truly blocked (max iterations or critical error)
402
+
403
+ ## Helper Scripts (Task Mode)
404
+
405
+ **DO NOT use execute-decision.sh (it spawns PO via CLI):**
406
+ ```bash
407
+ # ❌ WRONG - spawns duplicate Product Owner
408
+ ./.claude/skills/cfn-product-owner-decision/execute-decision.sh
409
+
410
+ # ✅ CORRECT - Main Chat spawns PO via Task(), then parses output
411
+ Task('product-owner', context)
412
+ parse-decision.sh --output "$PO_OUTPUT"
413
+ ```
414
+
415
+ **DO use these helper scripts:**
416
+ ```bash
417
+ # Parse Product Owner decision
418
+ ./.claude/skills/cfn-product-owner-decision/parse-decision.sh --output "$OUTPUT"
419
+
420
+ # Validate deliverables exist
421
+ ./.claude/skills/cfn-product-owner-decision/validate-deliverables.sh --task-id "$TASK_ID"
422
+
423
+ # Multi-pattern confidence parsing
424
+ ./.claude/skills/cfn-loop3-output-processing/parse-confidence.sh --output "$AGENT_OUTPUT"
425
+ ```
426
+
427
+ ## Related Commands
428
+
429
+ - **CLI Mode**: `/cfn-loop-cli` (production, cost-optimized)
430
+ - **Frontend**: `/cfn-loop-frontend` (visual iteration workflow)
431
+ - **Documentation**: `/cfn-loop-document` (generate docs)
432
+
433
+ ## Related Documentation
434
+
435
+ - **Task Mode Guide**: `.claude/commands/cfn/CFN_LOOP_TASK_MODE.md` (complete reference)
436
+ - Coordinator Parameters: `.claude/commands/cfn/CFN_COORDINATOR_PARAMETERS.md`
437
+ - Agent Output Standards: `docs/AGENT_OUTPUT_STANDARDS.md`
438
+ - ACE System: `.claude/skills/cfn-ace-system/SKILL.md`
439
+
440
+ ---
441
+
442
+ **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