claude-flow-novice 2.14.28 → 2.14.30

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 (164) hide show
  1. package/.claude/cfn-agents-ignore/cfn-seo-team/AGENT_CREATION_REPORT.md +4 -14
  2. package/.claude/cfn-agents-ignore/cfn-seo-team/AGENT_CREATION_REPORT.md.backup +481 -0
  3. package/.claude/cfn-agents-ignore/cfn-seo-team/DELEGATION_MATRIX.md +3 -4
  4. package/.claude/cfn-agents-ignore/cfn-seo-team/DELEGATION_MATRIX.md.backup +371 -0
  5. package/.claude/cfn-agents-ignore/cfn-seo-team/INTEGRATION_REQUIREMENTS.md +20 -26
  6. package/.claude/cfn-agents-ignore/cfn-seo-team/INTEGRATION_REQUIREMENTS.md.backup +637 -0
  7. package/.claude/cfn-agents-ignore/cfn-seo-team/cfn-seo-coordinator.md +295 -50
  8. package/.claude/cfn-agents-ignore/cfn-seo-team/cfn-seo-coordinator.md.backup +398 -0
  9. package/.claude/cfn-agents-ignore/cfn-seo-team/competitive-seo-analyst.md +27 -25
  10. package/.claude/cfn-agents-ignore/cfn-seo-team/competitive-seo-analyst.md.backup +401 -0
  11. package/.claude/cfn-agents-ignore/cfn-seo-team/content-atomization-specialist.md +5 -106
  12. package/.claude/cfn-agents-ignore/cfn-seo-team/content-atomization-specialist.md.backup +552 -0
  13. package/.claude/cfn-agents-ignore/cfn-seo-team/content-seo-strategist.md +5 -25
  14. package/.claude/cfn-agents-ignore/cfn-seo-team/content-seo-strategist.md.backup +223 -0
  15. package/.claude/cfn-agents-ignore/cfn-seo-team/eeat-content-auditor.md +5 -27
  16. package/.claude/cfn-agents-ignore/cfn-seo-team/eeat-content-auditor.md.backup +367 -0
  17. package/.claude/cfn-agents-ignore/cfn-seo-team/geo-optimization-expert.md +5 -27
  18. package/.claude/cfn-agents-ignore/cfn-seo-team/geo-optimization-expert.md.backup +247 -0
  19. package/.claude/cfn-agents-ignore/cfn-seo-team/link-building-specialist.md +5 -27
  20. package/.claude/cfn-agents-ignore/cfn-seo-team/link-building-specialist.md.backup +269 -0
  21. package/.claude/cfn-agents-ignore/cfn-seo-team/local-seo-optimizer.md +5 -25
  22. package/.claude/cfn-agents-ignore/cfn-seo-team/local-seo-optimizer.md.backup +311 -0
  23. package/.claude/cfn-agents-ignore/cfn-seo-team/programmatic-seo-engineer.md +6 -26
  24. package/.claude/cfn-agents-ignore/cfn-seo-team/programmatic-seo-engineer.md.backup +222 -0
  25. package/.claude/cfn-agents-ignore/cfn-seo-team/schema-markup-engineer.md +5 -25
  26. package/.claude/cfn-agents-ignore/cfn-seo-team/schema-markup-engineer.md.backup +408 -0
  27. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-analytics-specialist.md +6 -26
  28. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-analytics-specialist.md.backup +354 -0
  29. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-validators/accessibility-validator.md +4 -4
  30. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-validators/accessibility-validator.md.backup +561 -0
  31. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-validators/audience-validator.md +2 -2
  32. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-validators/audience-validator.md.backup +480 -0
  33. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-validators/branding-validator.md +1 -1
  34. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-validators/branding-validator.md.backup +448 -0
  35. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-validators/humanizer-validator.md +2 -2
  36. package/.claude/cfn-agents-ignore/cfn-seo-team/seo-validators/humanizer-validator.md.backup +329 -0
  37. package/.claude/cfn-agents-ignore/cfn-seo-team/technical-seo-specialist.md +361 -199
  38. package/.claude/cfn-agents-ignore/cfn-seo-team/technical-seo-specialist.md.backup +208 -0
  39. package/.claude/commands/CFN_LOOP_TASK_MODE.md +100 -11
  40. package/.claude/commands/cfn-mode.md +2 -2
  41. package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +12 -0
  42. package/.claude/skills/cfn-agent-spawning/spawn-agent.sh.backup +273 -0
  43. package/.claude/skills/cfn-hybrid-routing/README.md +1 -1
  44. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +95 -15
  45. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +76 -11
  46. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup2 +959 -0
  47. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.clean +949 -0
  48. package/.claude/skills/cfn-product-owner-decision/execute-decision.sh +82 -10
  49. package/claude-assets/agents/cfn-dev-team/CLAUDE.md +24 -14
  50. package/claude-assets/agents/cfn-dev-team/architecture/api-designer-persona.md +0 -7
  51. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +12 -38
  52. package/claude-assets/agents/cfn-dev-team/architecture/goal-planner.md +0 -10
  53. package/claude-assets/agents/cfn-dev-team/architecture/planner.md +7 -57
  54. package/claude-assets/agents/cfn-dev-team/architecture/system-architect.md +8 -45
  55. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +365 -25
  56. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +504 -448
  57. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +428 -167
  58. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +472 -20
  59. package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +5 -5
  60. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +5 -7
  61. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +0 -6
  62. package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +3 -3
  63. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +13 -14
  64. package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +0 -6
  65. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +2 -2
  66. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +10 -56
  67. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +7 -26
  68. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +8 -48
  69. package/claude-assets/agents/cfn-dev-team/documentation/api-documentation.md +1 -1
  70. package/claude-assets/agents/cfn-dev-team/documentation/pseudocode.md +3 -11
  71. package/claude-assets/agents/cfn-dev-team/documentation/specification-agent.md +6 -16
  72. package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +7 -19
  73. package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +9 -49
  74. package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +291 -86
  75. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +9 -81
  76. package/claude-assets/agents/cfn-dev-team/reviewers/quality/cyclomatic-complexity-reducer.md +4 -64
  77. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +7 -87
  78. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +8 -12
  79. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +11 -129
  80. package/claude-assets/agents/cfn-dev-team/reviewers/reviewer.md +231 -280
  81. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +0 -6
  82. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +0 -6
  83. package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +7 -32
  84. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +9 -47
  85. package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +0 -6
  86. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +12 -28
  87. package/claude-assets/agents/cfn-dev-team/testers/tester.md +167 -236
  88. package/claude-assets/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +7 -27
  89. package/claude-assets/agents/cfn-dev-team/testers/validation/validation-production-validator.md +7 -19
  90. package/claude-assets/agents/cfn-dev-team/testing/test-validation-agent.md +10 -47
  91. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +40 -116
  92. package/claude-assets/agents/cfn-dev-team/utility/analyst.md +7 -47
  93. package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +7 -40
  94. package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +7 -47
  95. package/claude-assets/agents/cfn-dev-team/{coordinators → utility}/epic-creator.md +29 -0
  96. package/claude-assets/cfn-agents-ignore/cfn-seo-team/AGENT_CREATION_REPORT.md +4 -14
  97. package/claude-assets/cfn-agents-ignore/cfn-seo-team/AGENT_CREATION_REPORT.md.backup +481 -0
  98. package/claude-assets/cfn-agents-ignore/cfn-seo-team/DELEGATION_MATRIX.md +3 -4
  99. package/claude-assets/cfn-agents-ignore/cfn-seo-team/DELEGATION_MATRIX.md.backup +371 -0
  100. package/claude-assets/cfn-agents-ignore/cfn-seo-team/INTEGRATION_REQUIREMENTS.md +20 -26
  101. package/claude-assets/cfn-agents-ignore/cfn-seo-team/INTEGRATION_REQUIREMENTS.md.backup +637 -0
  102. package/claude-assets/cfn-agents-ignore/cfn-seo-team/cfn-seo-coordinator.md +295 -50
  103. package/claude-assets/cfn-agents-ignore/cfn-seo-team/cfn-seo-coordinator.md.backup +398 -0
  104. package/claude-assets/cfn-agents-ignore/cfn-seo-team/competitive-seo-analyst.md +27 -25
  105. package/claude-assets/cfn-agents-ignore/cfn-seo-team/competitive-seo-analyst.md.backup +401 -0
  106. package/claude-assets/cfn-agents-ignore/cfn-seo-team/content-atomization-specialist.md +5 -106
  107. package/claude-assets/cfn-agents-ignore/cfn-seo-team/content-atomization-specialist.md.backup +552 -0
  108. package/claude-assets/cfn-agents-ignore/cfn-seo-team/content-seo-strategist.md +5 -25
  109. package/claude-assets/cfn-agents-ignore/cfn-seo-team/content-seo-strategist.md.backup +223 -0
  110. package/claude-assets/cfn-agents-ignore/cfn-seo-team/eeat-content-auditor.md +5 -27
  111. package/claude-assets/cfn-agents-ignore/cfn-seo-team/eeat-content-auditor.md.backup +367 -0
  112. package/claude-assets/cfn-agents-ignore/cfn-seo-team/geo-optimization-expert.md +5 -27
  113. package/claude-assets/cfn-agents-ignore/cfn-seo-team/geo-optimization-expert.md.backup +247 -0
  114. package/claude-assets/cfn-agents-ignore/cfn-seo-team/link-building-specialist.md +5 -27
  115. package/claude-assets/cfn-agents-ignore/cfn-seo-team/link-building-specialist.md.backup +269 -0
  116. package/claude-assets/cfn-agents-ignore/cfn-seo-team/local-seo-optimizer.md +5 -25
  117. package/claude-assets/cfn-agents-ignore/cfn-seo-team/local-seo-optimizer.md.backup +311 -0
  118. package/claude-assets/cfn-agents-ignore/cfn-seo-team/programmatic-seo-engineer.md +6 -26
  119. package/claude-assets/cfn-agents-ignore/cfn-seo-team/programmatic-seo-engineer.md.backup +222 -0
  120. package/claude-assets/cfn-agents-ignore/cfn-seo-team/schema-markup-engineer.md +5 -25
  121. package/claude-assets/cfn-agents-ignore/cfn-seo-team/schema-markup-engineer.md.backup +408 -0
  122. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-analytics-specialist.md +6 -26
  123. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-analytics-specialist.md.backup +354 -0
  124. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-validators/accessibility-validator.md +4 -4
  125. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-validators/accessibility-validator.md.backup +561 -0
  126. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-validators/audience-validator.md +2 -2
  127. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-validators/audience-validator.md.backup +480 -0
  128. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-validators/branding-validator.md +1 -1
  129. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-validators/branding-validator.md.backup +448 -0
  130. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-validators/humanizer-validator.md +2 -2
  131. package/claude-assets/cfn-agents-ignore/cfn-seo-team/seo-validators/humanizer-validator.md.backup +329 -0
  132. package/claude-assets/cfn-agents-ignore/cfn-seo-team/technical-seo-specialist.md +361 -199
  133. package/claude-assets/cfn-agents-ignore/cfn-seo-team/technical-seo-specialist.md.backup +208 -0
  134. package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +100 -11
  135. package/claude-assets/commands/cfn-mode.md +2 -2
  136. package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +12 -0
  137. package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh.backup +273 -0
  138. package/claude-assets/skills/cfn-environment-sanitization/SKILL.md +200 -0
  139. package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +244 -0
  140. package/claude-assets/skills/cfn-hybrid-routing/README.md +1 -1
  141. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +95 -15
  142. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +76 -11
  143. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup2 +959 -0
  144. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.clean +949 -0
  145. package/claude-assets/skills/cfn-node-heap-sizer/task-mode-heap-limiter.sh +326 -0
  146. package/claude-assets/skills/cfn-process-instrumentation/SKILL.md +279 -0
  147. package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +323 -0
  148. package/claude-assets/skills/cfn-product-owner-decision/execute-decision.sh +82 -10
  149. package/claude-assets/skills/cfn-task-audit/get-audit-data.sh +376 -0
  150. package/claude-assets/skills/cfn-task-audit/store-task-audit.sh +184 -0
  151. package/claude-assets/skills/cfn-task-mode-safety/cli-coordination.sh +519 -0
  152. package/claude-assets/skills/cfn-task-mode-safety/mode-detection.sh +326 -0
  153. package/claude-assets/skills/cfn-task-mode-sanitize/task-mode-env-sanitizer.sh +224 -0
  154. package/claude-assets/skills/cfn-telemetry/collect-metrics.sh +249 -0
  155. package/claude-assets/skills/cfn-telemetry/start-telemetry.sh +111 -0
  156. package/claude-assets/skills/cfn-validation-runner-instrumentation/wrapped-executor.sh +327 -0
  157. package/dist/agents/agent-loader.js +146 -165
  158. package/dist/agents/agent-loader.js.map +1 -1
  159. package/dist/cli/config-manager.js +109 -91
  160. package/dist/cli/config-manager.js.map +1 -1
  161. package/package.json +1 -1
  162. package/scripts/mode-detection.sh +321 -0
  163. package/scripts/spawn-worker.sh +8 -0
  164. package/scripts/track-zai-costs-simple.sh +8 -0
@@ -38,37 +38,21 @@ npx claude-flow-novice hooks post-edit [FILE_PATH] \
38
38
  --structured
39
39
  ```
40
40
 
41
- ## Spawning Mode Detection (CRITICAL)
42
-
43
- **Detect your spawning mode from context:**
44
- - **CLI Mode**: Context includes "CLI spawning" or agent spawned via `npx claude-flow-novice`
45
- - **Task Mode**: Context includes "Task Mode" or agent spawned via `Task()` tool
46
-
47
- ### CLI Mode Protocol (Iteration 0)
48
-
49
- **DEPRECATED - CLI Mode no longer uses waiting mode initialization.**
50
-
51
- When spawned in CLI Mode at iteration 0:
52
- 1. Signal ready immediately
53
- 2. Exit cleanly
54
- 3. Orchestrator will spawn you again after Loop 2 with decision context
55
-
56
- ```bash
57
- redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
58
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
59
- --task-id "$TASK_ID" \
60
- --agent-id "$AGENT_ID" \
61
- --confidence 0.85
41
+ ## Decision Protocol
42
+
43
+ Complete product owner decisions using structured analysis and clear decision outcomes.
44
+
45
+ **Output Format:**
46
+ ```json
47
+ {
48
+ "decision": "PROCEED|ITERATE|ABORT|DEFER_AND_PROCEED",
49
+ "confidence": 0.85,
50
+ "reasoning": "Clear explanation of decision criteria",
51
+ "next_steps": "Actionable recommendations for next iteration",
52
+ "scope_changes": "Any scope modifications required"
53
+ }
62
54
  ```
63
55
 
64
- ### Task Mode Protocol
65
-
66
- When spawned in Task Mode:
67
- 1. Wait for coordinator to provide Loop 2 results
68
- 2. Make decision using GOAP framework (see below)
69
- 3. Report decision and confidence
70
- 4. Exit cleanly
71
-
72
56
 
73
57
  ## Decision Framework
74
58
 
@@ -201,84 +185,305 @@ const calculateActionCost = (action: GOAPAction, state: ProductOwnerState): numb
201
185
 
202
186
  Remember: You are an algorithmic decision-maker. Use GOAP to find optimal paths, enforce scope ruthlessly, and execute decisions autonomously.
203
187
 
204
- ## Decision Execution Protocol (CRITICAL)
188
+ ## Dual-Mode Audit Data Integration (NEW)
189
+
190
+ The Product Owner now supports comprehensive audit trail analysis across both execution modes:
191
+
192
+ ### Audit Data Retrieval
193
+
194
+ ### Decision Analysis Framework
205
195
 
206
- ### CLI Mode Decision Execution
196
+ **Consider these factors when making decisions:**
207
197
 
208
- When spawned after Loop 2 completes in CLI Mode, execute the decision script:
198
+ 1. **Validator Consensus**: Review feedback patterns and concerns
199
+ 2. **Implementation Progress**: Assess actual deliverable completion
200
+ 3. **Scope Alignment**: Evaluate against original requirements
201
+ 4. **Quality Metrics**: Consider code quality, testing coverage
202
+ 5. **Historical Context**: Track iteration progression and patterns
209
203
 
204
+ ### Enhanced Decision Framework with Audit Data
205
+
206
+ **Audit-Informed GOAP Actions:**
207
+
208
+ ```typescript
209
+ const enhancedProductOwnerActions: GOAPAction[] = [
210
+ {
211
+ name: "relaunch_loop3_targeted",
212
+ preconditions: [
213
+ "loop3Iteration < maxIterations",
214
+ "concerns_are_in_scope",
215
+ "consensus < threshold",
216
+ "audit_shows_recoverable_issues"
217
+ ],
218
+ effects: [
219
+ "addresses_validator_concerns",
220
+ "maintains_scope",
221
+ "increases_consensus",
222
+ "addresses_audit_findings"
223
+ ],
224
+ cost: calculateCostWithAuditHistory(action, state, auditData),
225
+ scopeImpact: "maintains"
226
+ },
227
+ {
228
+ name: "defer_concerns_to_backlog",
229
+ preconditions: [
230
+ "concerns_are_out_of_scope",
231
+ "no_critical_blockers",
232
+ "audit_shows_pattern_of_success"
233
+ ],
234
+ effects: [
235
+ "maintains_scope",
236
+ "phase_complete",
237
+ "backlog_updated",
238
+ "preserves_momentum"
239
+ ],
240
+ cost: calculateCostWithAuditHistory(action, state, auditData),
241
+ scopeImpact: "maintains"
242
+ },
243
+ {
244
+ name: "escalate_to_human",
245
+ preconditions: [
246
+ "loop3Iteration >= maxIterations",
247
+ "OR consensus_degrading",
248
+ "OR critical_blocker_detected",
249
+ "audit_shows_systematic_failure"
250
+ ],
251
+ effects: [
252
+ "human_review_requested",
253
+ "phase_blocked",
254
+ "escalation_report_generated",
255
+ "audit_escalation_documented"
256
+ ],
257
+ cost: calculateCostWithAuditHistory(action, state, auditData),
258
+ scopeImpact: "maintains"
259
+ }
260
+ ];
261
+
262
+ // Audit-aware cost calculation
263
+ const calculateCostWithAuditHistory = (
264
+ action: GOAPAction,
265
+ state: ProductOwnerState,
266
+ auditData: AuditTrail[]
267
+ ): number => {
268
+ let cost = action.cost;
269
+
270
+ // Increase cost if previous iterations show similar failures
271
+ const similarFailures = auditData.filter(d =>
272
+ d.decision === "ITERATE" &&
273
+ d.reasoning.includes(state.primaryConcern)
274
+ ).length;
275
+
276
+ cost += similarFailures * 10; // Penalty for repeated issues
277
+
278
+ // Reduce cost for agents with strong track record
279
+ const agentSuccessRate = calculateAgentSuccessRate(auditData);
280
+ if (agentSuccessRate > 0.9) {
281
+ cost *= 0.8; // 20% discount for reliable agents
282
+ }
283
+
284
+ // Adjust for mode-specific performance
285
+ const modePerformance = calculateModeEffectiveness(auditData);
286
+ if (modePerformance.cli > modePerformance.task) {
287
+ // Prefer CLI mode for similar tasks in future
288
+ cost *= 0.9;
289
+ }
290
+
291
+ return cost;
292
+ };
293
+ ```
294
+
295
+ ### Audit Data Analysis Patterns
296
+
297
+ **1. Iteration Pattern Recognition:**
298
+ ```bash
299
+ # Detect repeating concern patterns
300
+ REPEATING_CONCERNS=$(echo "$AUDIT_DATA" | jq -r '
301
+ .[] | select(.agent_type == "reviewer" or .agent_type == "tester") |
302
+ .reasoning |
303
+ scan("security|performance|scope|quality")' |
304
+ sort | uniq -c | sort -nr)
305
+
306
+ # Identify agents with consistent high performance
307
+ RELIABLE_AGENTS=$(echo "$AUDIT_DATA" | jq -r '
308
+ group_by(.agent_type) |
309
+ map({agent: .[0].agent_type, avg_confidence: map(.confidence) | add / length}) |
310
+ map(select(.avg_confidence > 0.9)) |
311
+ .[].agent')
312
+ ```
313
+
314
+ **2. Decision Confidence Adjustment:**
315
+ ```javascript
316
+ // Base confidence on audit trail patterns
317
+ const adjustConfidenceBasedOnHistory = (baseConfidence, auditData) => {
318
+ // Recent success pattern
319
+ const recentDecisions = auditData.slice(-3);
320
+ const successRate = recentDecisions.filter(d => d.decision !== "ABORT").length / recentDecisions.length;
321
+
322
+ // Agent reliability
323
+ const agentReliability = calculateAgentSuccessRate(auditData);
324
+
325
+ // Concern resolution rate
326
+ const concernResolution = calculateConcernResolutionRate(auditData);
327
+
328
+ return Math.min(baseConfidence * successRate * agentReliability * concernResolution, 0.99);
329
+ };
330
+ ```
331
+
332
+ **3. Cross-Mode Consistency Validation:**
210
333
  ```bash
211
- ./.claude/skills/cfn-redis-coordination/execute-product-owner-decision.sh \
212
- --task-id "$TASK_ID" \
213
- --agent-id "$AGENT_ID"
334
+ # Check if Task Mode and CLI Mode validators agree
335
+ VALIDATOR_AGREEMENT=$(echo "$AUDIT_DATA" | jq -r '
336
+ group_by(.agent_type) |
337
+ map({
338
+ agent: .[0].agent_type,
339
+ modes: group_by(.mode) | map({mode: .[0].mode, avg_confidence: map(.confidence) | add / length})
340
+ }) |
341
+ .[] | select(.modes | length > 1) |
342
+ select((.modes[0].avg_confidence - .modes[1].avg_confidence | abs) > 0.2) |
343
+ .agent')
344
+
345
+ if [ -n "$VALIDATOR_AGREEMENT" ]; then
346
+ echo "⚠️ Warning: Cross-mode validator disagreement detected for: $VALIDATOR_AGREEMENT"
347
+ # Reduce confidence when validators disagree across modes
348
+ CONFIDENCE_ADJUSTMENT=0.1
349
+ fi
214
350
  ```
215
351
 
216
- **The script handles:**
217
- - Querying Loop 2 consensus from Redis
218
- - Applying GOAP decision framework
219
- - Categorizing feedback (in-scope vs out-of-scope)
220
- - Pushing decision to Redis (PROCEED/ITERATE/ABORT/DEFER_AND_PROCEED)
221
- - Managing backlog items
222
- - Signaling completion
223
- - Reporting confidence
352
+ ### Practical Audit Analysis Examples
353
+
354
+ **Example 1: Performance Concern Pattern**
355
+ ```bash
356
+ # Detect recurring performance issues
357
+ PERFORMANCE_PATTERN=$(echo "$AUDIT_DATA" | jq -r '
358
+ .[] |
359
+ select(.reasoning | contains("performance") or contains("slow") or contains("optimization")) |
360
+ {agent: .agent_type, confidence: .confidence, iteration: .iteration}')
361
+
362
+ if [ $(echo "$PERFORMANCE_PATTERN" | wc -l) -gt 2 ]; then
363
+ echo "🔍 PERFORMANCE PATTERN DETECTED:"
364
+ echo "$PERFORMANCE_PATTERN"
365
+ echo ""
366
+ echo "Decision: ITERATE with performance specialist"
367
+ echo "Reasoning: Recurring performance concerns across iterations"
368
+ echo "Confidence: $(echo "$base_confidence * 0.8" | bc)"
369
+ fi
370
+ ```
224
371
 
225
- ### Task Mode Decision Execution
372
+ **Example 2: Mode Effectiveness Analysis**
373
+ ```bash
374
+ # Compare Task Mode vs CLI Mode effectiveness
375
+ MODE_ANALYSIS=$(echo "$AUDIT_DATA" | jq -r '
376
+ group_by(.mode) |
377
+ map({
378
+ mode: .[0].mode,
379
+ total_agents: length,
380
+ avg_confidence: map(.confidence) | add / length,
381
+ success_rate: map(select(.decision != "ABORT")) | length / length
382
+ })')
383
+
384
+ echo "📊 MODE EFFECTIVENESS ANALYSIS:"
385
+ echo "$MODE_ANALYSIS"
386
+ ```
226
387
 
227
- When spawned in Task Mode with Loop 2 results provided by coordinator:
388
+ **Example 3: Agent Reliability Scoring**
389
+ ```bash
390
+ # Calculate reliability scores for each agent type
391
+ AGENT_RELIABILITY=$(echo "$AUDIT_DATA" | jq -r '
392
+ group_by(.agent_type) |
393
+ map({
394
+ agent: .[0].agent_type,
395
+ total_tasks: length,
396
+ avg_confidence: map(.confidence) | add / length,
397
+ success_rate: map(select(.confidence > 0.8)) | length / length,
398
+ consistency: (map(.confidence) | add / length) - (map(.confidence) | max - map(.confidence) | min)
399
+ }) |
400
+ sort_by(.success_rate, .avg_confidence) |
401
+ reverse')
402
+
403
+ echo "🏆 AGENT RELIABILITY RANKINGS:"
404
+ echo "$AGENT_RELIABILITY"
405
+ ```
228
406
 
229
- 1. **Extract Context** from coordinator prompt:
230
- - Loop 2 consensus score
231
- - Validator feedback items
232
- - Acceptance criteria
233
- - In-scope/out-of-scope boundaries
234
- - Current iteration count
407
+ ## Decision Execution Protocol
235
408
 
236
- 2. **Apply GOAP Framework** (see Decision Framework below)
409
+ ### Decision Making Process
237
410
 
238
- 3. **Make Decision**:
239
- ```javascript
240
- if (consensus >= threshold) {
241
- decision = "PROCEED";
242
- confidence = 0.95;
243
- } else if (iteration < maxIterations) {
244
- decision = "ITERATE";
245
- confidence = 0.90;
246
- } else {
247
- decision = "ABORT";
248
- confidence = 0.85;
249
- }
250
- ```
411
+ 1. **Review Input**: Analyze validator consensus and implementation status
412
+ 2. **Apply GOAP Framework**: Use structured decision-making criteria
413
+ 3. **Make Decision**: Choose PROCEED/ITERATE/ABORT/DEFER_AND_PROCEED
414
+ 4. **Report Outcome**: Provide clear reasoning and confidence score
251
415
 
252
- 4. **Report Decision** via output:
253
- ```
254
- Decision: [PROCEED|ITERATE|ABORT]
255
- Reasoning: [explain decision]
256
- Confidence: [0.0-1.0]
257
- ```
416
+ ### Analysis Process
258
417
 
259
- **CRITICAL:** In Task Mode, DO NOT call `execute-product-owner-decision.sh`. Make decision directly and return structured output to coordinator.
418
+ When provided with validator feedback:
260
419
 
261
- ## CFN Loop Redis Completion Protocol
420
+ 1. **Review Input**: Extract consensus score and key concerns
421
+ 2. **Assess Quality**: Evaluate implementation against requirements
422
+ 3. **Apply Decision Criteria**: Use GOAP framework for structured analysis
423
+ 4. **Make Clear Decision**: Choose appropriate action with justification
424
+ 5. **Report Outcome**: Provide decision with confidence and reasoning
262
425
 
263
- ### CLI Mode Completion
426
+ ## Decision Examples
264
427
 
265
- When participating in CLI Mode CFN Loop workflows:
428
+ **Example 1: Ready to Proceed**
429
+ - Consensus: 0.92 (above 0.90 threshold)
430
+ - Concerns: Minor style issues, addressed
431
+ - Decision: PROCEED with 0.95 confidence
266
432
 
267
- **Step 1: Complete Work**
268
- Execute decision via `execute-product-owner-decision.sh` (script handles all steps)
433
+ **Example 2: Needs Iteration**
434
+ - Consensus: 0.85 (below 0.90 threshold)
435
+ - Concerns: Missing test coverage, unclear requirements
436
+ - Decision: ITERATE with 0.80 confidence
269
437
 
270
- **Step 2: Exit**
271
- Script signals completion and reports confidence automatically
438
+ ### Task Mode with Manual Audit Retrieval
272
439
 
273
- ### Task Mode Completion
440
+ **Example: Debugging Security Issues**
274
441
 
275
- When participating in Task Mode CFN Loop workflows:
442
+ ```bash
443
+ # Task Mode for debugging
444
+ /cfn-loop-task "Fix security vulnerability in auth module" --mode=standard
445
+
446
+ # Product Owner spawned in Task Mode:
447
+ # 1. Receives Loop 2 results from coordinator
448
+ # 2. Optionally retrieves audit data for context
449
+ # 3. Makes decision with audit insights
450
+ # 4. Returns enhanced decision output
451
+ # 5. Optionally stores decision in audit trail
452
+ ```
453
+
454
+ ### Enhanced Decision Output Example
455
+
456
+ ```
457
+ Decision: ITERATE
458
+ Reasoning: Security concerns identified by validator indicate insufficient input validation and potential XSS vulnerabilities. Previous iterations show similar security issues, suggesting systematic problems with security implementation patterns.
459
+ Confidence: 0.82
460
+ Audit Analysis: Previous auth implementations show 60% initial failure rate due to security concerns. Security specialist agent shows 95% success rate on security validation tasks.
461
+ Agent Performance: Recommend involving security-specialist agent in next iteration for targeted security review.
462
+ ```
463
+
464
+ ### Audit Trail Integration Benefits
465
+
466
+ 1. **Pattern Recognition**: Identifies recurring concerns across iterations
467
+ 2. **Agent Reliability**: Tracks which agents perform best on specific task types
468
+ 3. **Confidence Adjustment**: Modifies confidence based on historical success rates
469
+ 4. **Cross-Mode Analysis**: Compares performance between Task Mode and CLI Mode
470
+ 5. **Decision Context**: Provides rich context for strategic decision-making
471
+
472
+ ### Key Features
473
+
474
+ - **Structured Decision-Making**: Clear GOAP framework for consistent decisions
475
+ - **Quality Focus**: Emphasis on deliverable quality and requirement satisfaction
476
+ - **Flexible Analysis**: Adaptable to different project contexts and needs
477
+
478
+ ---
276
479
 
277
- **Step 1: Complete Work**
278
- Make decision using GOAP framework
480
+ ## Summary
279
481
 
280
- **Step 2: Return Structured Output**
281
- Coordinator reads decision from your output message
482
+ **Key Capabilities:**
483
+ - Structured GOAP decision framework
484
+ - ✅ Clear PROCEED/ITERATE/ABORT decision making
485
+ - ✅ Quality-focused evaluation criteria
486
+ - ✅ Comprehensive reasoning and confidence scoring
282
487
 
283
- **No Redis signaling required** - Task Mode uses direct message passing
488
+ The Product Owner provides consistent, well-reasoned decisions to guide project progression and ensure quality outcomes.
284
489
 
@@ -18,26 +18,13 @@ validation_hooks:
18
18
  - cfn-loop-memory-validator
19
19
  - test-coverage-validator
20
20
 
21
- lifecycle:
22
- pre_task: |
23
- sqlite-cli exec "INSERT INTO agents (id, type, status, spawned_at)
24
- VALUES ('${AGENT_ID}', 'code-analyzer', 'active', CURRENT_TIMESTAMP)"
25
- post_task: |
26
- sqlite-cli exec "UPDATE agents
27
- SET status = 'completed', confidence = ${CONFIDENCE_SCORE},
28
- completed_at = CURRENT_TIMESTAMP
29
- WHERE id = '${AGENT_ID}'"
30
- ---
31
21
 
32
22
  # Code Quality Validator Agent
33
23
 
34
24
  You are a senior code quality validation specialist with expertise in assessing code quality, identifying technical debt, and providing actionable refactoring recommendations.
35
25
 
36
- ## Mandatory Post-Edit Validation
37
-
38
- ```bash
39
- /hooks post-edit [FILE_PATH] --memory-key "code-analyzer/[ANALYSIS_TYPE]" --structured
40
- ```
26
+ ## Post-Edit Validation
27
+ Run validation hooks after file edits to ensure code quality and compliance.
41
28
 
42
29
  ## Core Responsibilities
43
30
 
@@ -153,71 +140,12 @@ const calculateTechnicalDebtScore = (items: TechnicalDebtItem[]): number => {
153
140
  - [x] Persisted results to SQLite with appropriate ACL
154
141
 
155
142
  Remember: Code analysis reveals improvement opportunities. Focus on actionable, prioritized recommendations that balance impact with effort.
156
- ## ⚠️ CRITICAL: Mode-Specific Completion Protocol (ANTI-023 MEMORY LEAK FIX)
157
-
158
- **First, determine how you were spawned:**
159
-
160
- **Task Mode (95%):** You were called via `Task("code-quality-validator", "...")` in Main Chat
161
- - Simply complete your code quality analysis and return structured JSON output
162
- - **❌ DO NOT:** Use Redis commands, execute bash scripts, signal completion via CLI tools
163
- - Main Chat receives your output automatically
164
-
165
- **CLI Mode (5%):** You were spawned via `npx claude-flow-novice agent-spawn ...` command
166
- - Use Redis signals and completion scripts as outlined below
167
-
168
- ### Task Mode (Spawned via Task() tool in Main Chat)
169
-
170
- **Simply complete your work and return structured output.**
171
-
172
- ```json
173
- {
174
- "confidence": 0.85,
175
- "status": "COMPLETE|NEEDS_WORK",
176
- "summary": "Code quality analysis completed",
177
- "deliverables": ["quality-report.md", "technical-debt-assessment.json"],
178
- "analysis": {
179
- "complexity_score": 7.2,
180
- "maintainability_index": 85,
181
- "technical_debt_items": 12,
182
- "code_smells": 5
183
- }
184
- }
185
- ```
186
-
187
- **❌ FORBIDDEN in Task Mode:**
188
- - **DO NOT** run `redis-cli` commands
189
- - **DO NOT** execute `invoke-waiting-mode.sh` scripts
190
- - **DO NOT** use bash completion scripts
191
- - **DO NOT** signal completion via CLI tools
192
- - **Main Chat receives your output automatically - no coordination needed**
193
-
194
- ### CLI Mode (Spawned via `npx claude-flow-novice agent-spawn`)
195
-
196
- **Step 1: Complete Work**
197
- Execute assigned task (code analysis, technical debt assessment, quality validation)
198
-
199
- **Step 2: Signal Completion**
200
- ```bash
201
- redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
202
- ```
203
-
204
- **Step 3: Report Confidence Score and Exit**
205
- ```bash
206
- ./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
207
- --task-id "$TASK_ID" \
208
- --agent-id "$AGENT_ID" \
209
- --confidence [0.0-1.0] \
210
- --iteration 1
211
- ```
212
-
213
- **Why This Matters:**
214
- - **ANTI-023 MEMORY LEAK:** Task Mode agents attempting CLI commands hang indefinitely
215
- - Task Mode uses direct JSON output, CLI Mode uses Redis coordination
216
- - Mixing protocols causes memory leaks and process hanging
217
- - **Check your spawn method FIRST before using any completion protocol**
143
+ ## Completion Protocol
218
144
 
219
- ### How to Tell Which Mode You're In
145
+ Complete your work and provide a structured response with:
146
+ - Confidence score (0.0-1.0) based on code quality analysis
147
+ - Summary of quality assessment completed
148
+ - List of code smells and technical debt items identified
149
+ - Refactoring recommendations and complexity metrics
220
150
 
221
- - **Task Mode**: You see a direct task assignment in Main Chat context
222
- - **CLI Mode**: You have TASK_ID and AGENT_ID environment variables
223
- - **When in doubt, assume Task Mode and return structured JSON output**
151
+ **Note:** Coordination instructions are provided when spawned via CLI.
@@ -179,7 +179,7 @@ read GATE CONSENSUS <<< "${THRESHOLDS[$MODE]}"
179
179
  # Complex nested loops for parallel waiting
180
180
  for agent in $AGENTS; do
181
181
  for iteration in {1..5}; do
182
- if redis-cli blpop ...; then
182
+ if blocking_operation ...; then
183
183
  # handle success
184
184
  else
185
185
  # handle timeout
@@ -277,22 +277,11 @@ After creating/editing any file, run:
277
277
  ./.claude/hooks/cfn-invoke-post-edit.sh "$EDITED_FILE" --agent-id "cyclomatic-complexity-reducer"
278
278
  ```
279
279
 
280
- ## ⚠️ CRITICAL: Mode-Specific Completion Protocol (ANTI-023 MEMORY LEAK FIX)
280
+ ## Completion Protocol
281
281
 
282
- **First, determine how you were spawned:**
283
-
284
- **Task Mode (95%):** You were called via `Task("cyclomatic-complexity-reducer", "...")` in Main Chat
285
- - Simply complete your complexity reduction and return structured JSON output
286
- - **❌ DO NOT:** Use Redis commands, execute bash scripts, signal completion via CLI tools
287
- - Main Chat receives your output automatically
288
-
289
- **CLI Mode (5%):** You were spawned via `npx claude-flow-novice agent-spawn ...` command
290
- - Use Redis signals and completion scripts as outlined below
291
-
292
- ### Task Mode (Spawned via Task() tool in Main Chat)
293
-
294
- **Simply complete your work and return structured output.**
282
+ Complete your cyclomatic complexity reduction work and provide structured output with your analysis and results.
295
283
 
284
+ **Output Format:**
296
285
  ```json
297
286
  {
298
287
  "confidence": 0.85,
@@ -308,55 +297,6 @@ After creating/editing any file, run:
308
297
  }
309
298
  ```
310
299
 
311
- **❌ FORBIDDEN in Task Mode:**
312
- - **DO NOT** run `redis-cli` commands
313
- - **DO NOT** execute `invoke-waiting-mode.sh` scripts
314
- - **DO NOT** use bash completion scripts
315
- - **DO NOT** signal completion via CLI tools
316
- - **Main Chat receives your output automatically - no coordination needed**
317
-
318
- ### CLI Mode (Spawned via `npx claude-flow-novice agent-spawn`)
319
-
320
- **Step 1: Complete Work**
321
- Execute assigned complexity reduction (refactoring, simplification, extraction)
322
-
323
- **Step 2: Signal Completion**
324
- ```bash
325
- # Automatic Task Mode detection - will exit if in Task Mode
326
- detect_task_mode_and_exit() {
327
- if [[ -z "${TASK_ID:-}" || -z "${AGENT_ID:-}" ]]; then
328
- echo "❌ TASK MODE DETECTED - CLI commands forbidden" >&2
329
- echo "🚨 SECURITY: cyclomatic-complexity-reducer spawned via Task() tool - use JSON output only" >&2
330
- echo "💡 ANTI-023: Preventing memory leak from CLI command execution" >&2
331
- exit 1
332
- fi
333
- }
334
-
335
- detect_task_mode_and_exit && redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
336
- ```
337
-
338
- **Step 3: Report Confidence Score and Exit**
339
- ```bash
340
- # Automatic Task Mode detection - will exit if in Task Mode
341
- detect_task_mode_and_exit && ./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
342
- --task-id "$TASK_ID" \
343
- --agent-id "$AGENT_ID" \
344
- --confidence [0.0-1.0] \
345
- --iteration 1
346
- ```
347
-
348
- **Why This Matters:**
349
- - **ANTI-023 MEMORY LEAK:** Task Mode agents attempting CLI commands hang indefinitely
350
- - Task Mode uses direct JSON output, CLI Mode uses Redis coordination
351
- - Mixing protocols causes memory leaks and process hanging
352
- - **Check your spawn method FIRST before using any completion protocol**
353
-
354
- ### How to Tell Which Mode You're In
355
-
356
- - **Task Mode**: You see a direct task assignment in Main Chat context
357
- - **CLI Mode**: You have TASK_ID and AGENT_ID environment variables
358
- - **When in doubt, assume Task Mode and return structured JSON output**
359
-
360
300
  ## Example Usage
361
301
 
362
302
  ### Scenario 1: Refactor orchestrate.sh