claude-flow-novice 2.14.3 → 2.14.4

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 (162) hide show
  1. package/.claude/commands/CFN_LOOP_TASK_MODE.md +4 -47
  2. package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -276
  3. package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +4 -47
  4. package/claude-assets/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -276
  5. package/dist/agents/agent-loader.js +165 -146
  6. package/dist/agents/agent-loader.js.map +1 -1
  7. package/dist/cli/agent-prompt-builder.js +25 -0
  8. package/dist/cli/agent-prompt-builder.js.map +1 -1
  9. package/dist/cli/config-manager.js +91 -109
  10. package/package.json +1 -1
  11. package/.claude/skills/cfn-redis-coordination/HEARTBEAT.md +0 -57
  12. package/.claude/skills/cfn-redis-coordination/HEARTBEAT_MONITORING.md +0 -267
  13. package/.claude/skills/cfn-redis-coordination/LOGGING.md +0 -260
  14. package/.claude/skills/cfn-redis-coordination/README.md +0 -65
  15. package/.claude/skills/cfn-redis-coordination/SECURITY_REVIEW.md +0 -25
  16. package/.claude/skills/cfn-redis-coordination/SHUTDOWN_HANDLING.md +0 -164
  17. package/.claude/skills/cfn-redis-coordination/SKILL.md +0 -720
  18. package/.claude/skills/cfn-redis-coordination/demos/test-dlq.sh +0 -129
  19. package/.claude/skills/cfn-redis-coordination/demos/test-iteration-feedback.sh +0 -320
  20. package/.claude/skills/cfn-redis-coordination/demos/test-orchestrator.sh +0 -249
  21. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake-phase4-unix.sh +0 -148
  22. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake-phase4.sh +0 -163
  23. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake.sh +0 -138
  24. package/.claude/skills/cfn-redis-coordination/demos/test-quick-fix.sh +0 -81
  25. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-absolute.sh +0 -45
  26. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-fallback.sh +0 -68
  27. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-percentage.sh +0 -56
  28. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-with-retry.sh +0 -81
  29. package/.claude/skills/cfn-redis-coordination/demos/test-quorum.sh +0 -57
  30. package/.claude/skills/cfn-redis-coordination/demos/test-shutdown-handling.sh +0 -187
  31. package/.claude/skills/cfn-redis-coordination/demos/test-shutdown.sh +0 -160
  32. package/.claude/skills/cfn-redis-coordination/demos/test-utils-unix.sh +0 -97
  33. package/.claude/skills/cfn-redis-coordination/demos/test-utils.sh +0 -97
  34. package/.claude/skills/cfn-redis-coordination/demos/test-waiting-mode.sh +0 -59
  35. package/.claude/skills/cfn-redis-coordination/examples/README.md +0 -73
  36. package/.claude/skills/cfn-redis-coordination/examples/grafana-dashboard.json +0 -352
  37. package/.claude/skills/cfn-redis-coordination/examples/hierarchical-pattern.sh +0 -127
  38. package/.claude/skills/cfn-redis-coordination/examples/mesh-pattern.sh +0 -171
  39. package/.claude/skills/cfn-redis-coordination/examples/timeout-handling.sh +0 -227
  40. package/.claude/skills/cfn-redis-coordination/examples/waiting-mode-pattern.sh +0 -239
  41. package/.claude/skills/cfn-redis-coordination/execute-product-owner-decision.sh +0 -258
  42. package/.claude/skills/cfn-redis-coordination/get-agent-timeout.sh +0 -177
  43. package/.claude/skills/cfn-redis-coordination/heartbeat-functions.sh +0 -137
  44. package/.claude/skills/cfn-redis-coordination/heartbeat-protocol.md +0 -106
  45. package/.claude/skills/cfn-redis-coordination/heartbeat.sh +0 -126
  46. package/.claude/skills/cfn-redis-coordination/init-swarm.sh +0 -148
  47. package/.claude/skills/cfn-redis-coordination/invoke-redis-pattern.sh +0 -220
  48. package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +0 -283
  49. package/.claude/skills/cfn-redis-coordination/list-active-swarms.sh +0 -147
  50. package/.claude/skills/cfn-redis-coordination/log-event.sh +0 -109
  51. package/.claude/skills/cfn-redis-coordination/metrics-export.sh +0 -674
  52. package/.claude/skills/cfn-redis-coordination/metrics-schema.json +0 -66
  53. package/.claude/skills/cfn-redis-coordination/metrics-storage.md +0 -31
  54. package/.claude/skills/cfn-redis-coordination/monitor-cfn-violations.sh +0 -391
  55. package/.claude/skills/cfn-redis-coordination/monitor-heartbeats.sh +0 -101
  56. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop-v3.sh +0 -141
  57. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh +0 -31
  58. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
  59. package/.claude/skills/cfn-redis-coordination/priority-wake-mechanism.md +0 -75
  60. package/.claude/skills/cfn-redis-coordination/priority_wake.py +0 -134
  61. package/.claude/skills/cfn-redis-coordination/query-dlq.sh +0 -162
  62. package/.claude/skills/cfn-redis-coordination/query-logs.sh +0 -103
  63. package/.claude/skills/cfn-redis-coordination/redis-pattern.sh +0 -619
  64. package/.claude/skills/cfn-redis-coordination/retrieve-context.sh +0 -58
  65. package/.claude/skills/cfn-redis-coordination/select-specialist-agent.sh +0 -371
  66. package/.claude/skills/cfn-redis-coordination/semantic-match-tfidf.py +0 -252
  67. package/.claude/skills/cfn-redis-coordination/send-heartbeat.sh +0 -165
  68. package/.claude/skills/cfn-redis-coordination/signal.sh +0 -38
  69. package/.claude/skills/cfn-redis-coordination/store-context.sh +0 -86
  70. package/.claude/skills/cfn-redis-coordination/store-epic-context.sh +0 -123
  71. package/.claude/skills/cfn-redis-coordination/test-context-injection.sh +0 -354
  72. package/.claude/skills/cfn-redis-coordination/test-timeout-enforcement.sh +0 -513
  73. package/.claude/skills/cfn-redis-coordination/tests/convert-line-endings.sh +0 -15
  74. package/.claude/skills/cfn-redis-coordination/tests/dlq-functionality-test.sh +0 -102
  75. package/.claude/skills/cfn-redis-coordination/tests/edge-cases-test.sh +0 -99
  76. package/.claude/skills/cfn-redis-coordination/tests/integration-test.sh +0 -170
  77. package/.claude/skills/cfn-redis-coordination/tests/retry-mechanism-test.sh +0 -82
  78. package/.claude/skills/cfn-redis-coordination/tests/run-test-suite.sh +0 -92
  79. package/.claude/skills/cfn-redis-coordination/tests/run-tests.sh +0 -4
  80. package/.claude/skills/cfn-redis-coordination/tests/test-heartbeat-monitoring.sh +0 -418
  81. package/.claude/skills/cfn-redis-coordination/tests/test-heartbeat-simple.sh +0 -124
  82. package/.claude/skills/cfn-redis-coordination/tests/test-primitives.sh +0 -166
  83. package/.claude/skills/cfn-redis-coordination/tests/test-utils.sh +0 -54
  84. package/.claude/skills/cfn-redis-coordination/tests/test_utils.sh +0 -49
  85. package/.claude/skills/cfn-redis-coordination/v2_modularization/core_orchestration.sh +0 -76
  86. package/.claude/skills/cfn-redis-coordination/validate-parameters.sh +0 -492
  87. package/claude-assets/skills/cfn-redis-coordination/HEARTBEAT.md +0 -57
  88. package/claude-assets/skills/cfn-redis-coordination/HEARTBEAT_MONITORING.md +0 -267
  89. package/claude-assets/skills/cfn-redis-coordination/LOGGING.md +0 -260
  90. package/claude-assets/skills/cfn-redis-coordination/README.md +0 -65
  91. package/claude-assets/skills/cfn-redis-coordination/SECURITY_REVIEW.md +0 -25
  92. package/claude-assets/skills/cfn-redis-coordination/SHUTDOWN_HANDLING.md +0 -164
  93. package/claude-assets/skills/cfn-redis-coordination/SKILL.md +0 -720
  94. package/claude-assets/skills/cfn-redis-coordination/demos/test-dlq.sh +0 -129
  95. package/claude-assets/skills/cfn-redis-coordination/demos/test-iteration-feedback.sh +0 -320
  96. package/claude-assets/skills/cfn-redis-coordination/demos/test-orchestrator.sh +0 -249
  97. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake-phase4-unix.sh +0 -148
  98. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake-phase4.sh +0 -163
  99. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake.sh +0 -138
  100. package/claude-assets/skills/cfn-redis-coordination/demos/test-quick-fix.sh +0 -81
  101. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-absolute.sh +0 -45
  102. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-fallback.sh +0 -68
  103. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-percentage.sh +0 -56
  104. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-with-retry.sh +0 -81
  105. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum.sh +0 -57
  106. package/claude-assets/skills/cfn-redis-coordination/demos/test-shutdown-handling.sh +0 -187
  107. package/claude-assets/skills/cfn-redis-coordination/demos/test-shutdown.sh +0 -160
  108. package/claude-assets/skills/cfn-redis-coordination/demos/test-utils-unix.sh +0 -97
  109. package/claude-assets/skills/cfn-redis-coordination/demos/test-utils.sh +0 -97
  110. package/claude-assets/skills/cfn-redis-coordination/demos/test-waiting-mode.sh +0 -59
  111. package/claude-assets/skills/cfn-redis-coordination/examples/README.md +0 -73
  112. package/claude-assets/skills/cfn-redis-coordination/examples/grafana-dashboard.json +0 -352
  113. package/claude-assets/skills/cfn-redis-coordination/examples/hierarchical-pattern.sh +0 -127
  114. package/claude-assets/skills/cfn-redis-coordination/examples/mesh-pattern.sh +0 -171
  115. package/claude-assets/skills/cfn-redis-coordination/examples/timeout-handling.sh +0 -227
  116. package/claude-assets/skills/cfn-redis-coordination/examples/waiting-mode-pattern.sh +0 -239
  117. package/claude-assets/skills/cfn-redis-coordination/execute-product-owner-decision.sh +0 -258
  118. package/claude-assets/skills/cfn-redis-coordination/get-agent-timeout.sh +0 -177
  119. package/claude-assets/skills/cfn-redis-coordination/heartbeat-functions.sh +0 -137
  120. package/claude-assets/skills/cfn-redis-coordination/heartbeat-protocol.md +0 -106
  121. package/claude-assets/skills/cfn-redis-coordination/heartbeat.sh +0 -126
  122. package/claude-assets/skills/cfn-redis-coordination/init-swarm.sh +0 -148
  123. package/claude-assets/skills/cfn-redis-coordination/invoke-redis-pattern.sh +0 -220
  124. package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +0 -283
  125. package/claude-assets/skills/cfn-redis-coordination/list-active-swarms.sh +0 -147
  126. package/claude-assets/skills/cfn-redis-coordination/log-event.sh +0 -109
  127. package/claude-assets/skills/cfn-redis-coordination/metrics-export.sh +0 -674
  128. package/claude-assets/skills/cfn-redis-coordination/metrics-schema.json +0 -66
  129. package/claude-assets/skills/cfn-redis-coordination/metrics-storage.md +0 -31
  130. package/claude-assets/skills/cfn-redis-coordination/monitor-cfn-violations.sh +0 -391
  131. package/claude-assets/skills/cfn-redis-coordination/monitor-heartbeats.sh +0 -101
  132. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop-v3.sh +0 -141
  133. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh +0 -31
  134. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
  135. package/claude-assets/skills/cfn-redis-coordination/priority-wake-mechanism.md +0 -75
  136. package/claude-assets/skills/cfn-redis-coordination/priority_wake.py +0 -134
  137. package/claude-assets/skills/cfn-redis-coordination/query-dlq.sh +0 -162
  138. package/claude-assets/skills/cfn-redis-coordination/query-logs.sh +0 -103
  139. package/claude-assets/skills/cfn-redis-coordination/redis-pattern.sh +0 -619
  140. package/claude-assets/skills/cfn-redis-coordination/retrieve-context.sh +0 -58
  141. package/claude-assets/skills/cfn-redis-coordination/select-specialist-agent.sh +0 -371
  142. package/claude-assets/skills/cfn-redis-coordination/semantic-match-tfidf.py +0 -252
  143. package/claude-assets/skills/cfn-redis-coordination/send-heartbeat.sh +0 -165
  144. package/claude-assets/skills/cfn-redis-coordination/signal.sh +0 -38
  145. package/claude-assets/skills/cfn-redis-coordination/store-context.sh +0 -86
  146. package/claude-assets/skills/cfn-redis-coordination/store-epic-context.sh +0 -123
  147. package/claude-assets/skills/cfn-redis-coordination/test-context-injection.sh +0 -354
  148. package/claude-assets/skills/cfn-redis-coordination/test-timeout-enforcement.sh +0 -513
  149. package/claude-assets/skills/cfn-redis-coordination/tests/convert-line-endings.sh +0 -15
  150. package/claude-assets/skills/cfn-redis-coordination/tests/dlq-functionality-test.sh +0 -102
  151. package/claude-assets/skills/cfn-redis-coordination/tests/edge-cases-test.sh +0 -99
  152. package/claude-assets/skills/cfn-redis-coordination/tests/integration-test.sh +0 -170
  153. package/claude-assets/skills/cfn-redis-coordination/tests/retry-mechanism-test.sh +0 -82
  154. package/claude-assets/skills/cfn-redis-coordination/tests/run-test-suite.sh +0 -92
  155. package/claude-assets/skills/cfn-redis-coordination/tests/run-tests.sh +0 -4
  156. package/claude-assets/skills/cfn-redis-coordination/tests/test-heartbeat-monitoring.sh +0 -418
  157. package/claude-assets/skills/cfn-redis-coordination/tests/test-heartbeat-simple.sh +0 -124
  158. package/claude-assets/skills/cfn-redis-coordination/tests/test-primitives.sh +0 -166
  159. package/claude-assets/skills/cfn-redis-coordination/tests/test-utils.sh +0 -54
  160. package/claude-assets/skills/cfn-redis-coordination/tests/test_utils.sh +0 -49
  161. package/claude-assets/skills/cfn-redis-coordination/v2_modularization/core_orchestration.sh +0 -76
  162. package/claude-assets/skills/cfn-redis-coordination/validate-parameters.sh +0 -492
@@ -1,239 +0,0 @@
1
- #!/bin/bash
2
- # Waiting Mode + Coordinator Wake-Up Pattern
3
- # Agents enter waiting mode, coordinator/peers wake them for iterations/fixes
4
-
5
- set -euo pipefail
6
-
7
- # Configuration
8
- TASK_ID="auth-system"
9
- ITERATION=1
10
- MAX_ITERATIONS=10
11
- CONSENSUS_THRESHOLD=0.90
12
-
13
- echo "========================================="
14
- echo "Waiting Mode + Coordinator Wake-Up Demo"
15
- echo "========================================="
16
- echo ""
17
-
18
- # Simulate coordinator spawning agents in waiting mode
19
- echo "Step 1: Coordinator spawns agents in waiting mode"
20
- echo " Task: agent-coder, agent-reviewer, agent-tester, agent-security"
21
- echo ""
22
-
23
- # Agent Pattern: Enter waiting mode immediately after spawn
24
- agent_enter_waiting_mode() {
25
- local agent_id=$1
26
- local context=$2
27
-
28
- echo "[$agent_id] Entering waiting mode..."
29
- redis-cli lpush "swarm:$TASK_ID:$agent_id:ready" "{
30
- \"status\": \"waiting\",
31
- \"context\": \"$context\",
32
- \"timestamp\": $(date +%s)
33
- }" > /dev/null
34
-
35
- echo "[$agent_id] Blocked on swarm:$TASK_ID:$agent_id:wake (infinite timeout)"
36
- echo "[$agent_id] Zero token cost while waiting..."
37
- }
38
-
39
- # Simulate 4 agents entering waiting mode
40
- agent_enter_waiting_mode "agent-coder" "iteration-1"
41
- agent_enter_waiting_mode "agent-reviewer" "iteration-1"
42
- agent_enter_waiting_mode "agent-tester" "iteration-1"
43
- agent_enter_waiting_mode "agent-security" "iteration-1"
44
-
45
- echo ""
46
- echo "========================================="
47
- echo "CFN Loop Iteration 1: Wake agents"
48
- echo "========================================="
49
- echo ""
50
-
51
- # Coordinator wakes agents for first iteration
52
- wake_agent() {
53
- local agent_id=$1
54
- local iteration=$2
55
- local task=$3
56
-
57
- echo "[Coordinator] Waking $agent_id for iteration $iteration..."
58
- redis-cli lpush "swarm:$TASK_ID:$agent_id:wake" "{
59
- \"reason\": \"cfn_loop_iteration\",
60
- \"iteration\": $iteration,
61
- \"task\": \"$task\",
62
- \"timestamp\": $(date +%s)
63
- }" > /dev/null
64
-
65
- echo "[Coordinator] Wake signal sent to $agent_id"
66
- }
67
-
68
- # Wake all agents for iteration 1
69
- wake_agent "agent-coder" $ITERATION "Implement authentication logic"
70
- wake_agent "agent-reviewer" $ITERATION "Review code quality"
71
- wake_agent "agent-tester" $ITERATION "Write and run tests"
72
- wake_agent "agent-security" $ITERATION "Security audit"
73
-
74
- echo ""
75
- echo "Agents process tasks..."
76
- sleep 2
77
-
78
- # Simulate agents reporting back
79
- echo ""
80
- echo "Agents report confidence and return to waiting mode:"
81
- redis-cli lpush "swarm:$TASK_ID:agent-coder:result" '{"confidence":0.75,"iteration":1,"status":"needs_improvement"}' > /dev/null
82
- echo " [agent-coder] Confidence: 0.75 (needs improvement)"
83
-
84
- redis-cli lpush "swarm:$TASK_ID:agent-reviewer:result" '{"confidence":0.80,"iteration":1,"issues":["Missing error handling"]}' > /dev/null
85
- echo " [agent-reviewer] Confidence: 0.80 (issues found)"
86
-
87
- redis-cli lpush "swarm:$TASK_ID:agent-tester:result" '{"confidence":0.72,"iteration":1,"coverage":0.65}' > /dev/null
88
- echo " [agent-tester] Confidence: 0.72 (low coverage)"
89
-
90
- redis-cli lpush "swarm:$TASK_ID:agent-security:result" '{"confidence":0.85,"iteration":1}' > /dev/null
91
- echo " [agent-security] Confidence: 0.85"
92
-
93
- # Calculate consensus
94
- echo ""
95
- echo "[Coordinator] Calculating consensus..."
96
- CONSENSUS=$(echo "scale=2; (0.75 + 0.80 + 0.72 + 0.85) / 4" | bc)
97
- echo "[Coordinator] Iteration $ITERATION Consensus: $CONSENSUS"
98
- echo "[Coordinator] Threshold: $CONSENSUS_THRESHOLD"
99
-
100
- if (( $(echo "$CONSENSUS < $CONSENSUS_THRESHOLD" | bc -l) )); then
101
- echo "[Coordinator] ⚠️ Consensus below threshold - triggering iteration 2"
102
-
103
- # Agents automatically return to waiting mode
104
- echo ""
105
- echo "Agents return to waiting mode (context preserved):"
106
- agent_enter_waiting_mode "agent-coder" "iteration-2"
107
- agent_enter_waiting_mode "agent-reviewer" "iteration-2"
108
- agent_enter_waiting_mode "agent-tester" "iteration-2"
109
- agent_enter_waiting_mode "agent-security" "iteration-2"
110
-
111
- echo ""
112
- echo "========================================="
113
- echo "CFN Loop Iteration 2: Wake with feedback"
114
- echo "========================================="
115
- echo ""
116
-
117
- # Wake agents with feedback from previous iteration
118
- echo "[Coordinator] Waking agents with feedback from iteration 1..."
119
-
120
- redis-cli lpush "swarm:$TASK_ID:agent-coder:wake" "{
121
- \"reason\": \"cfn_loop_iteration\",
122
- \"iteration\": 2,
123
- \"previous_consensus\": $CONSENSUS,
124
- \"feedback\": [\"Add error handling\", \"Improve test coverage\"],
125
- \"context_from_iteration_1\": \"maintained\"
126
- }" > /dev/null
127
- echo " [agent-coder] Woke with feedback: Add error handling"
128
-
129
- redis-cli lpush "swarm:$TASK_ID:agent-reviewer:wake" "{
130
- \"reason\": \"cfn_loop_iteration\",
131
- \"iteration\": 2,
132
- \"previous_consensus\": $CONSENSUS,
133
- \"feedback\": [\"Validate error handling fixes\"]
134
- }" > /dev/null
135
- echo " [agent-reviewer] Woke with feedback: Validate fixes"
136
-
137
- redis-cli lpush "swarm:$TASK_ID:agent-tester:wake" "{
138
- \"reason\": \"cfn_loop_iteration\",
139
- \"iteration\": 2,
140
- \"previous_consensus\": $CONSENSUS,
141
- \"feedback\": [\"Increase coverage to 85%\"]
142
- }" > /dev/null
143
- echo " [agent-tester] Woke with feedback: Increase coverage"
144
-
145
- redis-cli lpush "swarm:$TASK_ID:agent-security:wake" "{
146
- \"reason\": \"cfn_loop_iteration\",
147
- \"iteration\": 2,
148
- \"previous_consensus\": $CONSENSUS
149
- }" > /dev/null
150
- echo " [agent-security] Woke for re-validation"
151
-
152
- echo ""
153
- echo "Agents process iteration 2 tasks (with context from iteration 1)..."
154
- sleep 2
155
-
156
- # Simulate improved results
157
- echo ""
158
- echo "Agents report improved confidence:"
159
- redis-cli lpush "swarm:$TASK_ID:agent-coder:result" '{"confidence":0.90,"iteration":2}' > /dev/null
160
- echo " [agent-coder] Confidence: 0.90 ✅"
161
-
162
- redis-cli lpush "swarm:$TASK_ID:agent-reviewer:result" '{"confidence":0.92,"iteration":2}' > /dev/null
163
- echo " [agent-reviewer] Confidence: 0.92 ✅"
164
-
165
- redis-cli lpush "swarm:$TASK_ID:agent-tester:result" '{"confidence":0.88,"iteration":2,"coverage":0.87}' > /dev/null
166
- echo " [agent-tester] Confidence: 0.88 ✅"
167
-
168
- redis-cli lpush "swarm:$TASK_ID:agent-security:result" '{"confidence":0.94,"iteration":2}' > /dev/null
169
- echo " [agent-security] Confidence: 0.94 ✅"
170
-
171
- CONSENSUS=$(echo "scale=2; (0.90 + 0.92 + 0.88 + 0.94) / 4" | bc)
172
- echo ""
173
- echo "[Coordinator] Iteration 2 Consensus: $CONSENSUS"
174
- echo "[Coordinator] ✅ Consensus >= threshold - PROCEED"
175
- fi
176
-
177
- echo ""
178
- echo "========================================="
179
- echo "Example 2: Incomplete Work Wake-Up"
180
- echo "========================================="
181
- echo ""
182
-
183
- # Simulate incomplete work detection
184
- echo "[Coordinator] Detected incomplete work in agent-coder..."
185
- redis-cli lpush "swarm:$TASK_ID:agent-coder:wake" '{
186
- "reason": "incomplete_work",
187
- "issues": ["Missing test coverage", "Type errors in auth.ts"],
188
- "priority": "high"
189
- }' > /dev/null
190
-
191
- echo "[Coordinator] Woke agent-coder to fix issues"
192
- echo " Issues: Missing test coverage, Type errors"
193
- echo ""
194
-
195
- echo "========================================="
196
- echo "Example 3: Agent-to-Agent Clarification"
197
- echo "========================================="
198
- echo ""
199
-
200
- # Simulate peer-to-peer clarification
201
- echo "[agent-reviewer] Has question for agent-coder..."
202
- redis-cli lpush "swarm:$TASK_ID:agent-coder:wake" '{
203
- "reason": "clarification",
204
- "from_agent": "reviewer",
205
- "question": "Should we use JWT or session cookies for auth?",
206
- "urgent": false
207
- }' > /dev/null
208
-
209
- echo "[agent-reviewer] Sent clarification question to agent-coder"
210
- echo " Question: JWT or session cookies?"
211
- echo ""
212
-
213
- echo "========================================="
214
- echo "Benefits Summary"
215
- echo "========================================="
216
- echo ""
217
- echo "✅ Zero token cost while agents wait (BLPOP blocks, no API calls)"
218
- echo "✅ Context preserved across iterations (agents remember previous work)"
219
- echo "✅ Instant wake-up (<100ms latency)"
220
- echo "✅ Scalable (10+ agents can cycle indefinitely)"
221
- echo "✅ CFN Loop native (agents maintain state across consensus cycles)"
222
- echo ""
223
-
224
- # Cleanup
225
- echo "Cleaning up Redis keys..."
226
- redis-cli del "swarm:$TASK_ID:agent-coder:ready" > /dev/null
227
- redis-cli del "swarm:$TASK_ID:agent-coder:wake" > /dev/null
228
- redis-cli del "swarm:$TASK_ID:agent-coder:result" > /dev/null
229
- redis-cli del "swarm:$TASK_ID:agent-reviewer:ready" > /dev/null
230
- redis-cli del "swarm:$TASK_ID:agent-reviewer:wake" > /dev/null
231
- redis-cli del "swarm:$TASK_ID:agent-reviewer:result" > /dev/null
232
- redis-cli del "swarm:$TASK_ID:agent-tester:ready" > /dev/null
233
- redis-cli del "swarm:$TASK_ID:agent-tester:wake" > /dev/null
234
- redis-cli del "swarm:$TASK_ID:agent-tester:result" > /dev/null
235
- redis-cli del "swarm:$TASK_ID:agent-security:ready" > /dev/null
236
- redis-cli del "swarm:$TASK_ID:agent-security:wake" > /dev/null
237
- redis-cli del "swarm:$TASK_ID:agent-security:result" > /dev/null
238
-
239
- echo "Demo complete!"
@@ -1,258 +0,0 @@
1
- #!/bin/bash
2
- ##############################################################################
3
- # Product Owner Decision Execution Script
4
- #
5
- # Handles the complete Product Owner decision protocol:
6
- # 1. Query Loop 2 consensus from Redis
7
- # 2. Apply GOAP decision framework
8
- # 3. Push decision to Redis
9
- # 4. Signal completion
10
- # 5. Report confidence
11
- #
12
- # Usage:
13
- # ./execute-product-owner-decision.sh --task-id <task> --agent-id <agent>
14
- ##############################################################################
15
-
16
- set -euo pipefail
17
-
18
- # Parse arguments
19
- TASK_ID=""
20
- AGENT_ID=""
21
-
22
- while [[ $# -gt 0 ]]; do
23
- case $1 in
24
- --task-id)
25
- TASK_ID="$2"
26
- shift 2
27
- ;;
28
- --agent-id)
29
- AGENT_ID="$2"
30
- shift 2
31
- ;;
32
- *)
33
- echo "Unknown option: $1"
34
- echo "Usage: $0 --task-id <task> --agent-id <agent>"
35
- exit 1
36
- ;;
37
- esac
38
- done
39
-
40
- if [ -z "$TASK_ID" ] || [ -z "$AGENT_ID" ]; then
41
- echo "Error: --task-id and --agent-id are required"
42
- exit 1
43
- fi
44
-
45
- echo "[Product Owner] Starting decision execution for task: $TASK_ID"
46
- echo ""
47
-
48
- # Step 1: Query Loop 2 consensus and context
49
- echo "[Step 1] Querying Loop 2 consensus and context from Redis..."
50
- CONSENSUS=$(redis-cli lindex "swarm:${TASK_ID}:metrics:loop2_consensus" 0 | jq -r '.consensus')
51
- ITERATION=$(redis-cli lindex "swarm:${TASK_ID}:metrics:loop2_consensus" 0 | jq -r '.iteration')
52
-
53
- # Get feedback from validators
54
- FEEDBACK_JSON=$(redis-cli lrange "swarm:${TASK_ID}:loop2:feedback" 0 -1 | jq -s '.')
55
-
56
- # Get acceptance criteria and scope
57
- ACCEPTANCE_CRITERIA=$(redis-cli get "swarm:${TASK_ID}:success-criteria" | jq -r '.acceptanceCriteria // []')
58
- EPIC_CONTEXT=$(redis-cli get "swarm:${TASK_ID}:epic-context")
59
- IN_SCOPE=$(echo "$EPIC_CONTEXT" | jq -r '.inScope // []')
60
- OUT_OF_SCOPE=$(echo "$EPIC_CONTEXT" | jq -r '.outOfScope // []')
61
- EPIC_GOAL=$(echo "$EPIC_CONTEXT" | jq -r '.epicGoal // ""')
62
-
63
- echo " Loop 2 Consensus: $CONSENSUS"
64
- echo " Iteration: $ITERATION"
65
- echo " Validator Feedback Items: $(echo "$FEEDBACK_JSON" | jq 'length')"
66
- echo ""
67
-
68
- # Step 2: Apply scope categorization
69
- echo "[Step 2] Categorizing validator feedback by scope..."
70
-
71
- # Initialize arrays
72
- IN_SCOPE_ITEMS="[]"
73
- OUT_OF_SCOPE_ITEMS="[]"
74
- IN_SCOPE_CONSENSUS=0
75
- OUT_OF_SCOPE_CONSENSUS=0
76
-
77
- # Process feedback if available
78
- if [ "$FEEDBACK_JSON" != "null" ] && [ "$FEEDBACK_JSON" != "[]" ]; then
79
- # Categorize each feedback item
80
- for feedback_item in $(echo "$FEEDBACK_JSON" | jq -r '.[] | @base64'); do
81
- _jq() {
82
- echo "$feedback_item" | base64 --decode | jq -r "$1"
83
- }
84
-
85
- FEEDBACK_TEXT=$(_jq '.')
86
- IS_IN_SCOPE="false"
87
-
88
- # Check if feedback relates to acceptance criteria or inScope items
89
- for criterion in $(echo "$ACCEPTANCE_CRITERIA" | jq -r '.[] | @base64'); do
90
- CRITERION_TEXT=$(echo "$criterion" | base64 --decode)
91
- if echo "$FEEDBACK_TEXT" | grep -iq "$(echo "$CRITERION_TEXT" | head -c 20)"; then
92
- IS_IN_SCOPE="true"
93
- break
94
- fi
95
- done
96
-
97
- # Add to appropriate category
98
- if [ "$IS_IN_SCOPE" = "true" ]; then
99
- IN_SCOPE_ITEMS=$(echo "$IN_SCOPE_ITEMS" | jq --arg item "$FEEDBACK_TEXT" '. + [$item]')
100
- else
101
- OUT_OF_SCOPE_ITEMS=$(echo "$OUT_OF_SCOPE_ITEMS" | jq --arg item "$FEEDBACK_TEXT" '. + [$item]')
102
- fi
103
- done
104
-
105
- # Calculate in-scope consensus (consensus weighted by in-scope ratio)
106
- TOTAL_ITEMS=$(echo "$FEEDBACK_JSON" | jq 'length')
107
- IN_SCOPE_COUNT=$(echo "$IN_SCOPE_ITEMS" | jq 'length')
108
-
109
- if [ "$TOTAL_ITEMS" -gt 0 ]; then
110
- # If there's feedback, weight consensus by in-scope ratio
111
- IN_SCOPE_CONSENSUS=$(echo "scale=2; $CONSENSUS * $IN_SCOPE_COUNT / $TOTAL_ITEMS" | bc -l)
112
- else
113
- # No feedback means validators had no concerns - use full consensus
114
- IN_SCOPE_CONSENSUS=$CONSENSUS
115
- fi
116
- else
117
- # No feedback at all - use full consensus as in-scope
118
- IN_SCOPE_CONSENSUS=$CONSENSUS
119
- fi
120
-
121
- echo " In-Scope Items: $(echo "$IN_SCOPE_ITEMS" | jq 'length')"
122
- echo " Out-of-Scope Items: $(echo "$OUT_OF_SCOPE_ITEMS" | jq 'length')"
123
- echo " In-Scope Consensus: $IN_SCOPE_CONSENSUS"
124
- echo ""
125
-
126
- # Step 3: Apply GOAP decision framework with scope enforcement
127
- echo "[Step 3] Applying GOAP decision framework with scope enforcement..."
128
-
129
- # Default threshold (standard mode)
130
- CONSENSUS_THRESHOLD=0.90
131
- MAX_ITERATIONS=10
132
-
133
- # Determine decision based on scope-aware consensus
134
- DECISION_TYPE=""
135
- DECISION_REASONING=""
136
- DECISION_CONFIDENCE=0
137
- BACKLOG_ITEMS="[]"
138
-
139
- if (( $(echo "$CONSENSUS >= $CONSENSUS_THRESHOLD" | bc -l) )); then
140
- # High consensus - check if there are out-of-scope items
141
- OUT_OF_SCOPE_COUNT=$(echo "$OUT_OF_SCOPE_ITEMS" | jq 'length')
142
-
143
- if [ "$OUT_OF_SCOPE_COUNT" -gt 0 ]; then
144
- DECISION_TYPE="DEFER_AND_PROCEED"
145
- DECISION_REASONING="In-scope work complete (consensus $CONSENSUS >= $CONSENSUS_THRESHOLD). Deferring $OUT_OF_SCOPE_COUNT out-of-scope items to backlog."
146
- DECISION_CONFIDENCE=0.92
147
- BACKLOG_ITEMS="$OUT_OF_SCOPE_ITEMS"
148
- echo " Decision: DEFER_AND_PROCEED (moving out-of-scope items to backlog)"
149
- else
150
- DECISION_TYPE="PROCEED"
151
- DECISION_REASONING="All work complete, consensus threshold met ($CONSENSUS >= $CONSENSUS_THRESHOLD)"
152
- DECISION_CONFIDENCE=0.95
153
- echo " Decision: PROCEED (consensus exceeds threshold, no out-of-scope items)"
154
- fi
155
- elif [ "$ITERATION" -lt "$MAX_ITERATIONS" ]; then
156
- # Below consensus - check if in-scope consensus would meet threshold
157
- if (( $(echo "$IN_SCOPE_CONSENSUS >= $CONSENSUS_THRESHOLD" | bc -l) )); then
158
- # In-scope work is good, out-of-scope items preventing consensus
159
- DECISION_TYPE="DEFER_AND_PROCEED"
160
- DECISION_REASONING="In-scope consensus met ($IN_SCOPE_CONSENSUS >= $CONSENSUS_THRESHOLD). Out-of-scope items preventing overall consensus - deferring to backlog."
161
- DECISION_CONFIDENCE=0.88
162
- BACKLOG_ITEMS="$OUT_OF_SCOPE_ITEMS"
163
- echo " Decision: DEFER_AND_PROCEED (in-scope work complete, deferring out-of-scope blockers)"
164
- else
165
- # In-scope work needs improvement
166
- DECISION_TYPE="ITERATE"
167
- DECISION_REASONING="In-scope consensus below threshold ($IN_SCOPE_CONSENSUS < $CONSENSUS_THRESHOLD), targeted improvements needed"
168
- DECISION_CONFIDENCE=0.90
169
- BACKLOG_ITEMS="$OUT_OF_SCOPE_ITEMS"
170
- echo " Decision: ITERATE (in-scope work needs improvement, iteration $ITERATION/$MAX_ITERATIONS)"
171
- fi
172
- else
173
- DECISION_TYPE="ABORT"
174
- DECISION_REASONING="Max iterations reached ($ITERATION >= $MAX_ITERATIONS) without meeting in-scope consensus threshold"
175
- DECISION_CONFIDENCE=0.85
176
- echo " Decision: ABORT (max iterations reached)"
177
- fi
178
-
179
- echo ""
180
-
181
- # Build structured decision JSON with scope analysis
182
- DECISION=$(jq -n \
183
- --arg decision "$DECISION_TYPE" \
184
- --arg reasoning "$DECISION_REASONING" \
185
- --arg confidence "$DECISION_CONFIDENCE" \
186
- --argjson in_scope_items "$IN_SCOPE_ITEMS" \
187
- --argjson out_of_scope_items "$OUT_OF_SCOPE_ITEMS" \
188
- --arg in_scope_consensus "$IN_SCOPE_CONSENSUS" \
189
- --argjson backlog_items "$BACKLOG_ITEMS" \
190
- '{
191
- decision: $decision,
192
- reasoning: $reasoning,
193
- confidence: ($confidence | tonumber),
194
- scope_analysis: {
195
- in_scope_consensus: ($in_scope_consensus | tonumber),
196
- in_scope_items: $in_scope_items,
197
- out_of_scope_items: $out_of_scope_items
198
- },
199
- backlog_items: $backlog_items
200
- }')
201
-
202
- echo "[Step 4] Managing backlog items..."
203
- if [ "$(echo "$BACKLOG_ITEMS" | jq 'length')" -gt 0 ]; then
204
- # Store backlog items in Redis
205
- BACKLOG_KEY="swarm:${TASK_ID}:backlog"
206
- echo "$BACKLOG_ITEMS" | redis-cli -x LPUSH "$BACKLOG_KEY" >/dev/null
207
- echo " ✓ Stored $(echo "$BACKLOG_ITEMS" | jq 'length') backlog items in Redis: $BACKLOG_KEY"
208
-
209
- # Persist backlog to file for human review
210
- BACKLOG_FILE=".claude/cfn-data/backlog/${TASK_ID}.json"
211
- mkdir -p "$(dirname "$BACKLOG_FILE")"
212
-
213
- BACKLOG_RECORD=$(jq -n \
214
- --arg task_id "$TASK_ID" \
215
- --arg timestamp "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
216
- --arg epic_goal "$EPIC_GOAL" \
217
- --argjson items "$BACKLOG_ITEMS" \
218
- '{
219
- task_id: $task_id,
220
- timestamp: $timestamp,
221
- epic_goal: $epic_goal,
222
- deferred_items: $items,
223
- status: "pending_review"
224
- }')
225
-
226
- echo "$BACKLOG_RECORD" > "$BACKLOG_FILE"
227
- echo " ✓ Backlog persisted to: $BACKLOG_FILE"
228
- else
229
- echo " No backlog items to store"
230
- fi
231
- echo ""
232
-
233
- echo "[Step 5] Pushing decision to Redis..."
234
- DECISION_KEY="swarm:${TASK_ID}:${AGENT_ID}:decision"
235
- echo "$DECISION" | redis-cli -x LPUSH "$DECISION_KEY" >/dev/null
236
- echo " ✓ Decision pushed to: $DECISION_KEY"
237
- echo " Content: $DECISION"
238
- echo ""
239
-
240
- # Step 6: Signal completion
241
- echo "[Step 6] Signaling completion..."
242
- DONE_KEY="swarm:${TASK_ID}:${AGENT_ID}:done"
243
- redis-cli LPUSH "$DONE_KEY" "complete" >/dev/null
244
- echo " ✓ Completion signaled"
245
- echo ""
246
-
247
- # Step 7: Report confidence
248
- echo "[Step 7] Reporting confidence..."
249
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
250
- --task-id "$TASK_ID" \
251
- --agent-id "$AGENT_ID" \
252
- --confidence "$DECISION_CONFIDENCE"
253
-
254
- echo ""
255
- echo "🎉 Product Owner decision execution complete!"
256
- echo " Decision: $DECISION_TYPE"
257
- echo " Consensus: $CONSENSUS"
258
- echo " Iteration: $ITERATION"
@@ -1,177 +0,0 @@
1
- #!/bin/bash
2
- # get-agent-timeout.sh - Get agent timeout from swarm metadata with intelligent fallback
3
- # Part of Redis Coordination Skill
4
- # Usage: ./get-agent-timeout.sh --task-id <id> --agent-id <id>
5
- #
6
- # Returns agent-specific timeout from swarm metadata with fallback order:
7
- # 1. agentTimeouts[agent-id] (exact match from swarm metadata)
8
- # 2. roleTimeouts[agent-role] (role-based from swarm metadata)
9
- # 3. agentTimeouts.default (fallback from swarm metadata)
10
- # 4. Role-based hardcoded defaults (researcher=7200, backend-dev=3600, etc.)
11
- # 5. 3600 (hardcoded default: 1 hour)
12
- #
13
- # Version: 1.1.0
14
- # Last Updated: 2025-10-19
15
-
16
- set -euo pipefail
17
-
18
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
- REDIS_HOST="${REDIS_HOST:-localhost}"
20
- REDIS_PORT="${REDIS_PORT:-6379}"
21
- DEFAULT_TIMEOUT=3600 # 60 minutes default
22
-
23
- # Parse arguments
24
- TASK_ID=""
25
- AGENT_ID=""
26
-
27
- while [[ $# -gt 0 ]]; do
28
- case $1 in
29
- --task-id)
30
- TASK_ID="$2"
31
- shift 2
32
- ;;
33
- --agent-id)
34
- AGENT_ID="$2"
35
- shift 2
36
- ;;
37
- *)
38
- echo "❌ Unknown argument: $1" >&2
39
- echo "Usage: $0 --task-id <id> --agent-id <id>" >&2
40
- exit 1
41
- ;;
42
- esac
43
- done
44
-
45
- # Validate required arguments
46
- if [[ -z "$TASK_ID" || -z "$AGENT_ID" ]]; then
47
- echo "❌ Missing required arguments" >&2
48
- echo "Usage: $0 --task-id <id> --agent-id <id>" >&2
49
- exit 1
50
- fi
51
-
52
- # Function to extract role from agent-id
53
- extract_role_from_agent_id() {
54
- local agent_id="$1"
55
-
56
- # Extract role prefix (everything before last hyphen and number)
57
- # Examples:
58
- # "researcher-1" -> "researcher"
59
- # "backend-dev-6" -> "backend-dev"
60
- # "reviewer" -> "reviewer"
61
- if [[ "$agent_id" =~ ^(.+)-[0-9]+$ ]]; then
62
- echo "${BASH_REMATCH[1]}"
63
- else
64
- echo "$agent_id"
65
- fi
66
- }
67
-
68
- # Function to get role-based hardcoded timeout defaults (fallback layer 4)
69
- get_hardcoded_role_timeout() {
70
- local role="$1"
71
-
72
- case "$role" in
73
- researcher)
74
- echo "7200" # 2 hours - research takes longer
75
- ;;
76
- backend-dev|coder|frontend-dev)
77
- echo "3600" # 1 hour - development work
78
- ;;
79
- reviewer|tester|security)
80
- echo "1800" # 30 minutes - validation/review
81
- ;;
82
- coordinator|orchestrator|product-owner)
83
- echo "900" # 15 minutes - coordination tasks
84
- ;;
85
- devops|architect)
86
- echo "5400" # 90 minutes - infrastructure/architecture
87
- ;;
88
- *)
89
- echo "3600" # 1 hour - default fallback
90
- ;;
91
- esac
92
- }
93
-
94
- # Function to extract timeout from JSON using jq or fallback parsing
95
- extract_timeout_from_json() {
96
- local json="$1"
97
- local key="$2"
98
-
99
- if [[ -z "$json" || "$json" == "(nil)" ]]; then
100
- echo ""
101
- return
102
- fi
103
-
104
- # Use jq if available
105
- if command -v jq &>/dev/null; then
106
- local result
107
- result=$(echo "$json" | jq -r --arg k "$key" '.[$k] // empty' 2>/dev/null || echo "")
108
- echo "$result"
109
- else
110
- # Fallback: simple pattern matching for "key": value
111
- echo "$json" | grep -oP "\"$key\"\s*:\s*\K\d+" 2>/dev/null || echo ""
112
- fi
113
- }
114
-
115
- # Get swarm ID from task mapping
116
- SWARM_ID=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
117
- GET "task:${TASK_ID}:swarm" 2>/dev/null || echo "")
118
-
119
- if [[ -z "$SWARM_ID" || "$SWARM_ID" == "(nil)" ]]; then
120
- # Fallback: assume task-id is swarm-id for backwards compatibility
121
- SWARM_ID="$TASK_ID"
122
- fi
123
-
124
- # Read swarm metadata from Redis
125
- METADATA=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
126
- HGETALL "swarm:${SWARM_ID}:metadata" 2>/dev/null || echo "")
127
-
128
- # Extract role from agent ID
129
- ROLE=$(extract_role_from_agent_id "$AGENT_ID")
130
-
131
- # Parse metadata and extract timeout configurations
132
- TIMEOUT=""
133
-
134
- if [[ -n "$METADATA" && "$METADATA" != "(nil)" ]]; then
135
- # Parse metadata into associative array
136
- declare -A META
137
- while IFS= read -r key && IFS= read -r value; do
138
- META["$key"]="$value"
139
- done <<< "$METADATA"
140
-
141
- AGENT_TIMEOUTS_JSON="${META[agentTimeouts]:-}"
142
- ROLE_TIMEOUTS_JSON="${META[roleTimeouts]:-}"
143
-
144
- # Fallback order 1: agentTimeouts[agent-id] (exact match)
145
- if [[ -n "$AGENT_TIMEOUTS_JSON" ]]; then
146
- TIMEOUT=$(extract_timeout_from_json "$AGENT_TIMEOUTS_JSON" "$AGENT_ID")
147
- fi
148
-
149
- # Fallback order 2: roleTimeouts[agent-role] (role-based)
150
- if [[ -z "$TIMEOUT" && -n "$ROLE_TIMEOUTS_JSON" ]]; then
151
- TIMEOUT=$(extract_timeout_from_json "$ROLE_TIMEOUTS_JSON" "$ROLE")
152
- fi
153
-
154
- # Fallback order 3: agentTimeouts.default
155
- if [[ -z "$TIMEOUT" && -n "$AGENT_TIMEOUTS_JSON" ]]; then
156
- TIMEOUT=$(extract_timeout_from_json "$AGENT_TIMEOUTS_JSON" "default")
157
- fi
158
- fi
159
-
160
- # Fallback order 4: Role-based hardcoded defaults
161
- if [[ -z "$TIMEOUT" ]]; then
162
- TIMEOUT=$(get_hardcoded_role_timeout "$ROLE")
163
- fi
164
-
165
- # Fallback order 5: Hardcoded default (3600s)
166
- if [[ -z "$TIMEOUT" ]]; then
167
- TIMEOUT="$DEFAULT_TIMEOUT"
168
- fi
169
-
170
- # Validate timeout is numeric
171
- if ! [[ "$TIMEOUT" =~ ^[0-9]+$ ]]; then
172
- echo "⚠️ Invalid timeout value: $TIMEOUT, using default: ${DEFAULT_TIMEOUT}s" >&2
173
- TIMEOUT="$DEFAULT_TIMEOUT"
174
- fi
175
-
176
- # Return timeout value
177
- echo "$TIMEOUT"