claude-flow-novice 2.14.27 → 2.14.29

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 (73) hide show
  1. package/.claude/commands/CFN_LOOP_TASK_MODE.md +119 -0
  2. package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +22 -0
  3. package/.claude/skills/cfn-agent-spawning/spawn-agent.sh.backup +273 -0
  4. package/.claude/skills/cfn-hybrid-routing/README.md +1 -1
  5. package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +10 -0
  6. package/.claude/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +10 -0
  7. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +105 -15
  8. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +76 -11
  9. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup2 +959 -0
  10. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.clean +949 -0
  11. package/.claude/skills/cfn-product-owner-decision/execute-decision.sh +82 -10
  12. package/.claude/skills/cfn-redis-coordination/report-completion.sh +10 -0
  13. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +7 -33
  14. package/claude-assets/agents/cfn-dev-team/architecture/planner.md +7 -47
  15. package/claude-assets/agents/cfn-dev-team/architecture/system-architect.md +7 -33
  16. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +88 -23
  17. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +59 -23
  18. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +43 -39
  19. package/claude-assets/agents/cfn-dev-team/coordinators/epic-creator.md +69 -0
  20. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +65 -1
  21. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +7 -47
  22. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +7 -26
  23. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +7 -47
  24. package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +7 -19
  25. package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +9 -49
  26. package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +407 -22
  27. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +7 -66
  28. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +7 -76
  29. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +8 -2
  30. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +7 -66
  31. package/claude-assets/agents/cfn-dev-team/reviewers/reviewer.md +7 -78
  32. package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +7 -18
  33. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +7 -18
  34. package/claude-assets/agents/cfn-dev-team/testers/tester.md +7 -77
  35. package/claude-assets/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +7 -18
  36. package/claude-assets/agents/cfn-dev-team/testers/validation/validation-production-validator.md +7 -19
  37. package/claude-assets/agents/cfn-dev-team/testing/test-validation-agent.md +7 -44
  38. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +35 -111
  39. package/claude-assets/agents/cfn-dev-team/utility/analyst.md +7 -47
  40. package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +7 -40
  41. package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +7 -47
  42. package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +119 -0
  43. package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +22 -0
  44. package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh.backup +273 -0
  45. package/claude-assets/skills/cfn-environment-sanitization/SKILL.md +200 -0
  46. package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +244 -0
  47. package/claude-assets/skills/cfn-hybrid-routing/README.md +1 -1
  48. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus.sh +10 -0
  49. package/claude-assets/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +10 -0
  50. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +105 -15
  51. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +76 -11
  52. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup2 +959 -0
  53. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.clean +949 -0
  54. package/claude-assets/skills/cfn-node-heap-sizer/task-mode-heap-limiter.sh +326 -0
  55. package/claude-assets/skills/cfn-process-instrumentation/SKILL.md +279 -0
  56. package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +323 -0
  57. package/claude-assets/skills/cfn-product-owner-decision/execute-decision.sh +82 -10
  58. package/claude-assets/skills/cfn-redis-coordination/report-completion.sh +10 -0
  59. package/claude-assets/skills/cfn-task-audit/get-audit-data.sh +376 -0
  60. package/claude-assets/skills/cfn-task-audit/store-task-audit.sh +184 -0
  61. package/claude-assets/skills/cfn-task-mode-safety/cli-coordination.sh +519 -0
  62. package/claude-assets/skills/cfn-task-mode-safety/mode-detection.sh +326 -0
  63. package/claude-assets/skills/cfn-task-mode-sanitize/task-mode-env-sanitizer.sh +224 -0
  64. package/claude-assets/skills/cfn-telemetry/collect-metrics.sh +249 -0
  65. package/claude-assets/skills/cfn-telemetry/start-telemetry.sh +111 -0
  66. package/claude-assets/skills/cfn-validation-runner-instrumentation/wrapped-executor.sh +327 -0
  67. package/dist/agents/agent-loader.js +467 -133
  68. package/dist/agents/agent-loader.js.map +1 -1
  69. package/dist/cli/config-manager.js.map +1 -1
  70. package/package.json +1 -1
  71. package/scripts/mode-detection.sh +321 -0
  72. package/scripts/spawn-worker.sh +8 -0
  73. package/scripts/track-zai-costs-simple.sh +8 -0
@@ -77,10 +77,49 @@ echo -e "${YELLOW}📥 Retrieving Loop 2 context...${NC}"
77
77
  LOOP2_FEEDBACK=$(redis-cli HGET "swarm:${TASK_ID}:loop2:consensus" "feedback" || echo "")
78
78
  TASK_CONTEXT=$(redis-cli HGETALL "swarm:${TASK_ID}:context" || echo "")
79
79
 
80
- # Build Product Owner context
80
+ # Retrieve comprehensive audit trail data
81
+ echo -e "${YELLOW}🔍 Retrieving audit trail data for informed decision-making...${NC}"
82
+ set +e
83
+ AUDIT_DATA=$(./.claude/skills/cfn-task-audit/get-audit-data.sh \
84
+ --task-id "$TASK_ID" \
85
+ --mode combined \
86
+ --format json 2>/dev/null || echo "[]")
87
+
88
+ AUDIT_SUMMARY=$(./.claude/skills/cfn-task-audit/get-audit-data.sh \
89
+ --task-id "$TASK_ID" \
90
+ --mode combined \
91
+ --format summary 2>/dev/null || echo "No audit data available")
92
+ set -e
93
+
94
+ # Analyze audit data for patterns
95
+ AUDIT_INSIGHTS=""
96
+ if [ "$AUDIT_DATA" != "[]" ]; then
97
+ # Extract key patterns from audit data
98
+ PREVIOUS_DECISIONS=$(echo "$AUDIT_DATA" | jq -r '.[] | select(.agent_type == "product-owner") | .decision' 2>/dev/null | tr '\n' ', ' | sed 's/,$//' || echo "None")
99
+ AGENT_PERFORMANCE=$(echo "$AUDIT_DATA" | jq -r 'group_by(.agent_type) | map({agent: .[0].agent_type, avg_confidence: map(.confidence) | add / length}) | sort_by(.avg_confidence) | reverse | .[0:3] | .[] | "\(.agent): \(.avg_confidence)"' 2>/dev/null || echo "No performance data")
100
+
101
+ # Check for repeating concerns
102
+ REPEATING_CONCERNS=$(echo "$AUDIT_DATA" | jq -r '.[] | select(.agent_type == "reviewer" or .agent_type == "tester") | .reasoning | scan("security|performance|scope|quality|bug")' 2>/dev/null | sort | uniq -c | sort -nr | head -3 | awk '{print $2 " (" $1 "x)"}' | tr '\n' ', ' | sed 's/,$//' || echo "No repeating concerns")
103
+
104
+ AUDIT_INSIGHTS="
105
+ AUDIT TRAIL INSIGHTS:
106
+ - Previous Product Owner Decisions: $PREVIOUS_DECISIONS
107
+ - Top Performing Agents: $AGENT_PERFORMANCE
108
+ - Repeating Concerns: $REPEATING_CONCERNS
109
+ - Total Audit Records: $(echo "$AUDIT_DATA" | jq '. | length' 2>/dev/null || echo "0")
110
+
111
+ Audit Summary:
112
+ $AUDIT_SUMMARY
113
+ "
114
+ else
115
+ AUDIT_INSIGHTS="AUDIT TRAIL: No historical data available for this task."
116
+ fi
117
+
118
+ # Build enhanced Product Owner context with audit insights
81
119
  PO_CONTEXT="
82
120
  You are the Product Owner making a strategic decision for CFN Loop iteration $ITERATION of $MAX_ITERATIONS.
83
121
 
122
+ CURRENT ITERATION DATA:
84
123
  Loop 2 Consensus: $CONSENSUS
85
124
  Threshold: $THRESHOLD
86
125
  Success Criteria: ${SUCCESS_CRITERIA:-"Not specified"}
@@ -91,15 +130,26 @@ $LOOP2_FEEDBACK
91
130
  Task Context:
92
131
  $TASK_CONTEXT
93
132
 
94
- Make a strategic decision:
95
- - PROCEED: Quality threshold met, deliverables complete
96
- - ITERATE: Improvements needed, iterations remaining
97
- - ABORT: Max iterations reached or unrecoverable failure
133
+ $AUDIT_INSIGHTS
134
+
135
+ ENHANCED DECISION FRAMEWORK:
136
+ Use the audit trail insights to inform your decision. Consider:
137
+ - Are there repeating concerns that suggest systematic issues?
138
+ - Which agents have performed well on similar tasks?
139
+ - Do previous decisions show a pattern of success or failure?
140
+ - Are there cross-mode inconsistencies that need attention?
141
+
142
+ DECISION OPTIONS:
143
+ - PROCEED: Quality threshold met, deliverables complete, audit shows positive trajectory
144
+ - ITERATE: Improvements needed, iterations remaining, audit shows recoverable issues
145
+ - ABORT: Max iterations reached, systematic failure, or audit shows insurmountable barriers
98
146
 
99
147
  Output format:
100
148
  Decision: PROCEED|ITERATE|ABORT
101
- Reasoning: [your explanation]
149
+ Reasoning: [your explanation + audit insights]
102
150
  Confidence: [0.0-1.0]
151
+ Audit Analysis: [brief summary of how audit data influenced your decision]
152
+ Agent Performance: [any observations about agent reliability from audit trail]
103
153
  "
104
154
 
105
155
  # Spawn Product Owner agent
@@ -144,6 +194,12 @@ else
144
194
 
145
195
  # Parse confidence
146
196
  CONFIDENCE=$(echo "$PO_OUTPUT" | grep -oE "Confidence:\s*[0-9]+\.?[0-9]*" | grep -oE "[0-9]+\.?[0-9]*" || echo "0.85")
197
+
198
+ # Parse audit analysis (enhanced output)
199
+ AUDIT_ANALYSIS=$(echo "$PO_OUTPUT" | grep -oiE "Audit Analysis:\s*.*" | sed 's/Audit Analysis:\s*//' || echo "No audit analysis provided")
200
+
201
+ # Parse agent performance observations
202
+ AGENT_PERFORMANCE_OBSERVATIONS=$(echo "$PO_OUTPUT" | grep -oiE "Agent Performance:\s*.*" | sed 's/Agent Performance:\s*//' || echo "No agent performance observations")
147
203
  else
148
204
  echo -e "${RED}❌ ERROR: Product Owner output file missing or empty${NC}"
149
205
  echo "Expected: $PO_OUTPUT_FILE"
@@ -167,6 +223,11 @@ fi
167
223
  echo -e "${GREEN}✅ Product Owner Decision: $DECISION_TYPE${NC}"
168
224
  echo "Reasoning: $REASONING"
169
225
  echo "Confidence: $CONFIDENCE"
226
+ if [ "$AUDIT_DATA" != "[]" ]; then
227
+ echo -e "${BLUE}📊 Audit Analysis: $AUDIT_ANALYSIS${NC}"
228
+ echo -e "${BLUE}🏆 Agent Performance: $AGENT_PERFORMANCE_OBSERVATIONS${NC}"
229
+ echo -e "${BLUE}📈 Audit Records Analyzed: $(echo "$AUDIT_DATA" | jq '. | length' 2>/dev/null || echo "0")${NC}"
230
+ fi
170
231
 
171
232
  # Deliverable verification for PROCEED decisions
172
233
  if [ "$DECISION_TYPE" = "PROCEED" ]; then
@@ -254,7 +315,7 @@ else
254
315
  echo -e "${GREEN}No deferred items detected in Product Owner output${NC}"
255
316
  fi
256
317
 
257
- # Build decision JSON
318
+ # Build enhanced decision JSON with audit insights
258
319
  DECISION_JSON=$(cat <<EOF
259
320
  {
260
321
  "decision": "$DECISION_TYPE",
@@ -263,17 +324,25 @@ DECISION_JSON=$(cat <<EOF
263
324
  "iteration": $ITERATION,
264
325
  "consensus": $CONSENSUS,
265
326
  "threshold": $THRESHOLD,
266
- "timestamp": $(date +%s)
327
+ "timestamp": $(date +%s),
328
+ "audit_analysis": "$AUDIT_ANALYSIS",
329
+ "agent_performance_observations": "$AGENT_PERFORMANCE_OBSERVATIONS",
330
+ "audit_records_analyzed": $(echo "$AUDIT_DATA" | jq '. | length' 2>/dev/null || echo "0"),
331
+ "audit_informed": $(if [ "$AUDIT_DATA" != "[]" ]; then echo "true"; else echo "false"; fi)
267
332
  }
268
333
  EOF
269
334
  )
270
335
 
271
- # Store decision in Redis
272
- echo -e "${YELLOW}💾 Storing decision in Redis...${NC}"
336
+ # Store decision in Redis with audit context
337
+ echo -e "${YELLOW}💾 Storing decision in Redis with audit context...${NC}"
273
338
  redis-cli LPUSH "swarm:${TASK_ID}:decision" "$DECISION_TYPE"
274
339
  redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "decision" "$DECISION_TYPE"
275
340
  redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "reasoning" "$REASONING"
276
341
  redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "confidence" "$CONFIDENCE"
342
+ redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "audit_analysis" "$AUDIT_ANALYSIS"
343
+ redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "agent_performance_observations" "$AGENT_PERFORMANCE_OBSERVATIONS"
344
+ redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "audit_records_analyzed" "$(echo "$AUDIT_DATA" | jq '. | length' 2>/dev/null || echo "0")"
345
+ redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "audit_informed" "$(if [ "$AUDIT_DATA" != "[]" ]; then echo "true"; else echo "false"; fi)"
277
346
 
278
347
  # Store in metrics
279
348
  redis-cli LPUSH "swarm:${TASK_ID}:metrics:product_owner_decisions" "$DECISION_JSON"
@@ -293,3 +362,6 @@ redis-cli LPUSH "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
293
362
  echo "$DECISION_JSON"
294
363
 
295
364
  echo -e "${GREEN}✅ Product Owner decision execution complete${NC}"
365
+ if [ "$AUDIT_DATA" != "[]" ]; then
366
+ echo -e "${BLUE}📊 Decision was informed by audit trail analysis${NC}"
367
+ fi
@@ -42,6 +42,16 @@ while [[ $# -gt 0 ]]; do
42
42
  esac
43
43
  done
44
44
 
45
+ # ⚠️ ANTI-023 MEMORY LEAK PROTECTION: Block Task Mode agents
46
+ # Task Mode agents spawn via Task() tool and should NOT use Redis coordination
47
+ if [[ -z "${TASK_ID:-}" || -z "${AGENT_ID:-}" ]]; then
48
+ echo "❌ TASK MODE DETECTED - Redis coordination forbidden" >&2
49
+ echo "🚨 ANTI-023: This script is for CLI-spawned agents only" >&2
50
+ echo "💡 Task Mode agents should return JSON directly to Main Chat" >&2
51
+ echo "🔧 Agent spawned via Task() tool - use structured JSON output instead" >&2
52
+ exit 1
53
+ fi
54
+
45
55
  # Validate required parameters
46
56
  if [ -z "$TASK_ID" ] || [ -z "$AGENT_ID" ] || [ -z "$CONFIDENCE" ]; then
47
57
  echo "Error: Missing required parameters" >&2
@@ -145,38 +145,12 @@ Quality standards:
145
145
 
146
146
  When generating templates, always consider the broader project context, existing patterns, and future extensibility needs. Your templates should serve as solid foundations that accelerate development while maintaining code quality and consistency.
147
147
 
148
- ## CFN Loop Redis Completion Protocol
148
+ ## Completion Protocol
149
149
 
150
- When participating in CFN Loop workflows, agents MUST follow this protocol:
150
+ Complete your work and provide a structured response with:
151
+ - Confidence score (0.0-1.0) based on work quality
152
+ - Summary of analysis/review completed
153
+ - List of findings or deliverables
154
+ - Any recommendations made
151
155
 
152
- ### Step 1: Complete Work
153
- Execute assigned task (template generation, boilerplate code creation, project scaffolding)
154
-
155
- ### Step 2: Signal Completion
156
- ```bash
157
- redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
158
- ```
159
-
160
- ### Step 3: Report Confidence Score and Exit
161
- ```bash
162
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
163
- --task-id "$TASK_ID" \
164
- --agent-id "$AGENT_ID" \
165
- --confidence [0.0-1.0] \
166
- --iteration 1
167
- ```
168
-
169
- **After reporting, exit cleanly. Do NOT enter waiting mode.**
170
-
171
- **Why This Matters:**
172
- - Orchestrator collects confidence/consensus scores from Redis
173
- - Enables adaptive agent specialization for next iteration
174
- - Prevents orchestrator blocking on wait $PID
175
- - Coordinator spawns appropriate specialist based on feedback type
176
-
177
- **Context Variables:**
178
- - `TASK_ID`: Provided by orchestrator/coordinator
179
- - `AGENT_ID`: Your unique agent identifier (e.g., "base-template-generator-1")
180
- - Confidence: Your self-assessment score (0.0-1.0)
181
-
182
- See: `.claude/skills/redis-coordination/SKILL.md` for full protocol details
156
+ **Note:** Coordination instructions are provided when spawned via CLI.
@@ -127,53 +127,13 @@ plan:
127
127
 
128
128
  Remember: A good plan executed now is better than a perfect plan executed never. Focus on creating actionable, practical plans that drive progress.
129
129
 
130
- ## CFN Loop Redis Completion Protocol
130
+ ## Completion Protocol
131
131
 
132
- When participating in CFN Loop workflows, agents MUST follow this protocol:
132
+ Complete your work and provide a structured response with:
133
+ - Confidence score (0.0-1.0) based on work quality
134
+ - Summary of analysis/review completed
135
+ - List of findings or deliverables
136
+ - Any recommendations made
133
137
 
134
- ### Step 1: Complete Work
135
- Execute assigned task (task planning, dependency mapping, resource allocation, risk assessment)
136
-
137
- ### Step 2: Signal Completion
138
- ```bash
139
- redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
140
- ```
141
-
142
- ### Step 3: Report Confidence Score
143
- ```bash
144
- ./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
145
-
146
- **After reporting, exit cleanly. Do NOT enter waiting mode.**
147
-
148
- **Why This Matters:**
149
- - Orchestrator collects confidence/consensus scores from Redis
150
- - Enables adaptive agent specialization for next iteration
151
- - Prevents orchestrator blocking on wait $PID
152
- - Coordinator spawns appropriate specialist based on feedback type
153
-
154
- --task-id "$TASK_ID" \
155
- --agent-id "$AGENT_ID" \
156
- --confidence [0.0-1.0] \
157
- --iteration 1
158
- ```
159
-
160
- ### Step 4: Enter Waiting Mode (for potential iteration)
161
- ```bash
162
- --task-id "$TASK_ID" \
163
- --agent-id "$AGENT_ID" \
164
- --context "iteration-complete"
165
- ```
166
-
167
- **Why This Matters:**
168
- - Zero-token blocking coordination (BLPOP waits without API calls)
169
- - Orchestrator collects confidence/consensus scores automatically
170
- - Supports autonomous iteration based on quality gates
171
- - Agent woken instantly (<100ms) if iteration needed
172
-
173
- **Context Variables:**
174
- - `TASK_ID`: Provided by orchestrator/coordinator
175
- - `AGENT_ID`: Your unique agent identifier (e.g., "planner-1")
176
- - Confidence: Your self-assessment score (0.0-1.0)
177
-
178
- See: `.claude/skills/redis-coordination/SKILL.md` for full protocol details
138
+ **Note:** Coordination instructions are provided when spawned via CLI.
179
139
 
@@ -122,38 +122,12 @@ await sqlite.memoryAdapter.set(
122
122
  ```
123
123
 
124
124
  **Core Insight:** Great architecture balances technical excellence with business needs, making informed trade-offs that enable long-term system health and adaptability.
125
- ## CFN Loop Redis Completion Protocol
125
+ ## Completion Protocol
126
126
 
127
- When participating in CFN Loop workflows, agents MUST follow this protocol:
127
+ Complete your architectural work and provide a structured response with:
128
+ - Confidence score (0.0-1.0) based on architectural quality
129
+ - Summary of design decisions made
130
+ - List of deliverables created
131
+ - Any assumptions or constraints identified
128
132
 
129
- ### Step 1: Complete Work
130
- Execute assigned task (system architecture design, technical strategy, infrastructure planning)
131
-
132
- ### Step 2: Signal Completion
133
- ```bash
134
- redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
135
- ```
136
-
137
- ### Step 3: Report Confidence Score and Exit
138
- ```bash
139
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
140
- --task-id "$TASK_ID" \
141
- --agent-id "$AGENT_ID" \
142
- --confidence [0.0-1.0] \
143
- --iteration 1
144
- ```
145
-
146
- **After reporting, exit cleanly. Do NOT enter waiting mode.**
147
-
148
- **Why This Matters:**
149
- - Orchestrator collects confidence/consensus scores from Redis
150
- - Enables adaptive agent specialization for next iteration
151
- - Prevents orchestrator blocking on wait $PID
152
- - Coordinator spawns appropriate specialist based on feedback type
153
-
154
- **Context Variables:**
155
- - `TASK_ID`: Provided by orchestrator/coordinator
156
- - `AGENT_ID`: Your unique agent identifier (e.g., "system-architect-1")
157
- - Confidence: Self-assessment score based on architectural design quality and comprehensiveness (0.0-1.0)
158
-
159
- See: `.claude/skills/cfn-redis-coordination/SKILL.md` for full protocol details
133
+ **Note:** Coordination instructions are provided when spawned via CLI.
@@ -62,14 +62,21 @@ fs.writeFileSync('.claude/brand-guidelines.json', JSON.stringify(brandGuidelines
62
62
 
63
63
  If brand guidelines provided, use those directly.
64
64
 
65
- **Step 4: Store Context in Redis**
65
+ **Step 4: Store Context for Agent Reference**
66
+ Store brand guidelines and context in Redis for agent coordination:
66
67
  ```bash
67
- # Store epic/phase context
68
- redis-cli hset "cfn_loop:task:${TASK_ID}:context" \
69
- "mockupPath" "${MOCKUP_PATH}" \
70
- "brandGuidelines" "$(cat .claude/brand-guidelines.json)" \
71
- "visualThreshold" "85" \
72
- "mode" "${MODE}"
68
+ # Store brand guidelines in Redis for agents
69
+ redis-cli HSET "cfn_loop:task:$TASK_ID:frontend" \
70
+ "brand_guidelines" "${BRAND_GUIDELINES}" \
71
+ "mockup_path" "${MOCKUP_PATH}" \
72
+ "mode" "${MODE}" \
73
+ "component_name" "${COMPONENT_NAME}" \
74
+ "visual_threshold" "85"
75
+
76
+ # Store brand guidelines file for reference
77
+ echo "${BRAND_GUIDELINES}" > .claude/frontend-brand-guidelines.json
78
+ echo "${MOCKUP_PATH}" > .claude/frontend-mockup-path.txt
79
+ echo "${MODE}" > .claude/frontend-mode.txt
73
80
  ```
74
81
 
75
82
  ### Phase 1: Loop 3 - Implementation with Visual Context
@@ -208,9 +215,8 @@ if (overallScore >= 85) {
208
215
  ]
209
216
  };
210
217
 
211
- // Store feedback in Redis for next iteration
212
- redis-cli hset "cfn_loop:task:${TASK_ID}:feedback" \
213
- "iteration_${iteration}" "$(echo "$visualFeedback" | jq -c .)"
218
+ // Store feedback for next iteration
219
+ echo "$visualFeedback" | jq -c . > .claude/frontend-feedback-iteration-${iteration}.json
214
220
  }
215
221
  ```
216
222
 
@@ -221,6 +227,12 @@ if [ "$overallScore" -lt 85 ] && [ "$iteration" -lt "$MAX_ITERATIONS" ]; then
221
227
 
222
228
  echo "Starting iteration $iteration with visual feedback..."
223
229
 
230
+ # Store iteration context in Redis
231
+ redis-cli HSET "cfn_loop:task:$TASK_ID:iteration" \
232
+ "current_iteration" "$iteration" \
233
+ "previous_score" "$overallScore" \
234
+ "visual_feedback" "$(echo "$visualFeedback" | jq -c .)"
235
+
224
236
  # Spawn fresh Loop 3 agents for next iteration with feedback
225
237
  for agent in "${loop3Agents[@]}"; do
226
238
  npx claude-flow-novice agent-spawn "$agent" \
@@ -242,6 +254,11 @@ EOF
242
254
  # Repeat Phase 1 → Phase 2
243
255
  else
244
256
  echo "Visual validation complete or max iterations reached"
257
+ # Store completion in Redis
258
+ redis-cli HSET "cfn_loop:task:$TASK_ID:visual" \
259
+ "validation_complete" "true" \
260
+ "final_score" "$overallScore" \
261
+ "total_iterations" "$iteration"
245
262
  # Proceed to Phase 3
246
263
  fi
247
264
  ```
@@ -292,12 +309,21 @@ wait "${VALIDATOR_PIDS[@]}"
292
309
  ```
293
310
 
294
311
  **Collect Consensus:**
312
+ Gather validator feedback and calculate consensus score from their outputs:
295
313
  ```bash
296
- CONSENSUS=$(./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh collect \
297
- --task-id "$TASK_ID" \
298
- --agent-ids "$(IFS=,; echo "${loop2Agents[*]}")")
299
-
300
- echo "Loop 2 consensus: $CONSENSUS"
314
+ # Store validator context in Redis
315
+ redis-cli HSET "cfn_loop:task:$TASK_ID:validation" \
316
+ "loop2_agents" "$(echo "${loop2Agents[@]}" | tr ' ' ',')" \
317
+ "validation_start" "$(date +%s)"
318
+
319
+ # Collect validator outputs and calculate consensus
320
+ CONSENSUS_SCORE=$(calculate-consensus-from-outputs.sh "${VALIDATOR_OUTPUTS[@]}")
321
+ echo "Loop 2 consensus: $CONSENSUS_SCORE"
322
+
323
+ # Store consensus result
324
+ redis-cli HSET "cfn_loop:task:$TASK_ID:validation" \
325
+ "consensus_score" "$CONSENSUS_SCORE" \
326
+ "validation_complete" "true"
301
327
  ```
302
328
 
303
329
  ### Phase 4: Loop 4 - Product Owner Decision
@@ -318,7 +344,7 @@ Deliverables:
318
344
  $(git diff --name-only HEAD | grep -E '\.(tsx?|jsx?|css)$')
319
345
 
320
346
  Validation results:
321
- $(redis-cli hget "cfn_loop:task:${TASK_ID}:validation" "loop2_results")
347
+ $(cat .claude/frontend-validation-results.json 2>/dev/null || echo "Validation results pending")
322
348
 
323
349
  DECISION CRITERIA:
324
350
  - Visual + interaction score ≥85%
@@ -339,6 +365,14 @@ EOF
339
365
  DECISION=$(./.claude/skills/cfn-product-owner-decision/parse-decision.sh \
340
366
  --output "$PO_OUTPUT")
341
367
 
368
+ # Store decision in Redis
369
+ redis-cli HSET "cfn_loop:task:$TASK_ID:decision" \
370
+ "decision" "$DECISION" \
371
+ "decision_time" "$(date +%s)" \
372
+ "final_score" "$overallScore" \
373
+ "consensus" "$CONSENSUS" \
374
+ "iterations" "$iteration"
375
+
342
376
  if [ "$DECISION" = "PROCEED" ]; then
343
377
  echo "✅ Product Owner approved - committing changes"
344
378
 
@@ -361,6 +395,12 @@ Co-Authored-By: Claude <noreply@anthropic.com>"
361
395
 
362
396
  git push origin main
363
397
 
398
+ # Mark epic complete in Redis
399
+ redis-cli HSET "cfn_loop:task:$TASK_ID:status" \
400
+ "status" "complete" \
401
+ "completion_time" "$(date +%s)" \
402
+ "git_commit" "$(git rev-parse HEAD)"
403
+
364
404
  # Generate component documentation
365
405
  cat > "docs/${COMPONENT_NAME}_IMPLEMENTATION.md" <<EOF
366
406
  # ${COMPONENT_NAME} Implementation
@@ -390,6 +430,7 @@ elif [ "$DECISION" = "ITERATE" ]; then
390
430
 
391
431
  if [ "$iteration" -ge "$MAX_ITERATIONS" ]; then
392
432
  echo "❌ Max iterations reached, aborting"
433
+ redis-cli HSET "cfn_loop:task:$TASK_ID:status" "status" "aborted_max_iterations"
393
434
  exit 1
394
435
  fi
395
436
 
@@ -398,6 +439,7 @@ elif [ "$DECISION" = "ITERATE" ]; then
398
439
 
399
440
  else
400
441
  echo "❌ Product Owner aborted"
442
+ redis-cli HSET "cfn_loop:task:$TASK_ID:status" "status" "aborted_by_product_owner"
401
443
  exit 1
402
444
  fi
403
445
  ```
@@ -407,13 +449,12 @@ fi
407
449
  **You MUST use the orchestrator script for dependency enforcement:**
408
450
 
409
451
  ```bash
410
- # Store all context in Redis first
411
- redis-cli hset "cfn_loop:task:${TASK_ID}:context" \
412
- "mockupPath" "${MOCKUP_PATH}" \
413
- "brandGuidelines" "$(cat .claude/brand-guidelines.json)" \
414
- "visualThreshold" "85" \
415
- "componentName" "${COMPONENT_NAME}" \
416
- "taskDescription" "${TASK_DESCRIPTION}"
452
+ # Store all context for orchestrator
453
+ echo "${MOCKUP_PATH}" > .claude/frontend-mockup-path.txt
454
+ cat .claude/brand-guidelines.json > .claude/frontend-brand-guidelines.json
455
+ echo "85" > .claude/frontend-visual-threshold.txt
456
+ echo "${COMPONENT_NAME}" > .claude/frontend-component-name.txt
457
+ echo "${TASK_DESCRIPTION}" > .claude/frontend-task-description.txt
417
458
 
418
459
  # Invoke orchestrator (handles all spawning + dependency coordination)
419
460
  ./.claude/skills/cfn-loop-orchestration/cfn-orchestrate.sh \
@@ -528,9 +569,33 @@ if ! command -v playwright &> /dev/null; then
528
569
  fi
529
570
  ```
530
571
 
572
+ ## CFN Loop Redis Completion Protocol
573
+
574
+ When participating in CFN Loop workflows, agents MUST follow this protocol:
575
+
576
+ ### Step 1: Complete Work
577
+ Execute assigned coordination tasks
578
+
579
+ ### Step 2: Signal Completion
580
+ ```bash
581
+ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
582
+ ```
583
+
584
+ ### Step 3: Report Confidence Score and Exit
585
+ ```bash
586
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
587
+ --task-id "$TASK_ID" \
588
+ --agent-id "$AGENT_ID" \
589
+ --confidence [0.0-1.0] \
590
+ --iteration 1
591
+ ```
592
+
593
+ **After reporting, exit cleanly. Do NOT enter waiting mode.**
594
+
531
595
  ## Related Documentation
532
596
 
533
597
  - Guide: `.claude/commands/cfn/CFN_LOOP_FRONTEND.md`
534
598
  - Task Mode Guide: `.claude/commands/cfn/CFN_LOOP_TASK_MODE.md`
535
599
  - Coordinator Parameters: `.claude/commands/cfn/CFN_COORDINATOR_PARAMETERS.md`
536
600
  - Standard CFN Loop: `.claude/commands/cfn/cfn-loop.md`
601
+ - Redis Coordination: `.claude/skills/cfn-redis-coordination/SKILL.md`
@@ -334,24 +334,37 @@ If you need Task Mode, use the slash command, not this agent.
334
334
 
335
335
  ### Redis Context Storage
336
336
 
337
+ Store task configuration in Redis for agent coordination:
337
338
  ```bash
338
- # Redis key structure for task context
339
- KEY="cfn_loop:task:${TASK_ID}:context"
340
-
341
- # Store task configuration
342
- redis-cli HMSET "$KEY" \
343
- task_type "$TASK_TYPE" \
344
- loop3_agents "$(jq -c '.loop3_agents' <<< "$CONFIG")" \
345
- loop2_agents "$(jq -c '.loop2_agents' <<< "$CONFIG")" \
346
- validation_criteria "$(jq -c '.validation_criteria' <<< "$CONFIG")" \
347
- deliverables "$(jq -c '.deliverables' <<< "$CONFIG")" \
348
- gate_threshold "$GATE_THRESHOLD" \
349
- consensus_threshold "$CONSENSUS_THRESHOLD" \
350
- max_iterations "$MAX_ITERATIONS" \
351
- complexity "$COMPLEXITY" \
352
- reasoning "$REASONING"
353
-
354
- # Redis context supports zero-token agent coordination
339
+ # Store epic context
340
+ redis-cli HSET "cfn_loop:task:$TASK_ID:context" \
341
+ "task_type" "$TASK_TYPE" \
342
+ "loop3_agents" "$(jq -c '.loop3_agents' <<< "$CONFIG")" \
343
+ "loop2_agents" "$(jq -c '.loop2_agents' <<< "$CONFIG")" \
344
+ "validation_criteria" "$(jq -c '.validation_criteria' <<< "$CONFIG")" \
345
+ "deliverables" "$(jq -c '.deliverables' <<< "$CONFIG")" \
346
+ "gate_threshold" "$GATE_THRESHOLD" \
347
+ "consensus_threshold" "$CONSENSUS_THRESHOLD" \
348
+ "max_iterations" "$MAX_ITERATIONS" \
349
+ "complexity" "$COMPLEXITY" \
350
+ "reasoning" "$REASONING"
351
+
352
+ # Store phase context
353
+ redis-cli HSET "cfn_loop:task:$TASK_ID:phase" \
354
+ "current_phase" "1" \
355
+ "total_phases" "1" \
356
+ "phase_name" "Implementation"
357
+ ```
358
+
359
+ ### Context Retrieval
360
+
361
+ Agents retrieve context from Redis:
362
+ ```bash
363
+ # Get task context
364
+ redis-cli HGETALL "cfn_loop:task:$TASK_ID:context"
365
+
366
+ # Get current phase
367
+ redis-cli HGET "cfn_loop:task:$TASK_ID:phase" "current_phase"
355
368
  ```
356
369
 
357
370
  ### Routing & Z.ai Provider Integration
@@ -427,22 +440,45 @@ Mode: task
427
440
  - Validation criteria appropriate for task
428
441
  - Deliverables are realistic file paths
429
442
  - Reasoning explains key decisions
430
- - Redis context storage successful
443
+ - Context files created successfully
431
444
  - Correct routing based on mode
432
445
 
433
- ### Redis Coordination Validation
446
+ ### Context Validation
434
447
 
435
448
  ```bash
436
449
  # Verify context stored correctly
437
- STORED_CONTEXT=$(redis-cli HGETALL "cfn_loop:task:${TASK_ID}:context")
450
+ STORED_CONTEXT=$(cat .claude/cfn-context/task-${TASK_ID}.json)
438
451
  echo "$STORED_CONTEXT" | jq .
439
452
  ```
440
453
 
454
+ ## CFN Loop Redis Completion Protocol
455
+
456
+ When participating in CFN Loop workflows, agents MUST follow this protocol:
457
+
458
+ ### Step 1: Complete Work
459
+ Execute assigned coordination tasks
460
+
461
+ ### Step 2: Signal Completion
462
+ ```bash
463
+ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
464
+ ```
465
+
466
+ ### Step 3: Report Confidence Score and Exit
467
+ ```bash
468
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
469
+ --task-id "$TASK_ID" \
470
+ --agent-id "$AGENT_ID" \
471
+ --confidence [0.0-1.0] \
472
+ --iteration 1
473
+ ```
474
+
475
+ **After reporting, exit cleanly. Do NOT enter waiting mode.**
476
+
441
477
  ### Coordinator Post-Processing
442
478
 
443
479
  Coordinator checks:
444
- 1. Redis context populated
445
- 2. Routing mode confirmed
480
+ 1. Redis context stored
481
+ 2. Orchestrator invoked
446
482
  3. Agent selection validated ✅
447
483
 
448
- Remember: You are a configuration generator and context manager. Analyze tasks, generate recommendations, coordinate Redis context, enable zero-token agent workflows.
484
+ Remember: You are a configuration generator and context manager. Analyze tasks, generate recommendations, coordinate Redis context storage, enable efficient agent workflows.