claude-flow-novice 2.14.2 → 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 (161) 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/cli/agent-prompt-builder.js +25 -0
  6. package/dist/cli/agent-prompt-builder.js.map +1 -1
  7. package/dist/cli/config-manager.js +91 -109
  8. package/package.json +1 -1
  9. package/scripts/init-project.js +1 -1
  10. package/.claude/skills/cfn-redis-coordination/HEARTBEAT.md +0 -57
  11. package/.claude/skills/cfn-redis-coordination/HEARTBEAT_MONITORING.md +0 -267
  12. package/.claude/skills/cfn-redis-coordination/LOGGING.md +0 -260
  13. package/.claude/skills/cfn-redis-coordination/README.md +0 -65
  14. package/.claude/skills/cfn-redis-coordination/SECURITY_REVIEW.md +0 -25
  15. package/.claude/skills/cfn-redis-coordination/SHUTDOWN_HANDLING.md +0 -164
  16. package/.claude/skills/cfn-redis-coordination/SKILL.md +0 -720
  17. package/.claude/skills/cfn-redis-coordination/demos/test-dlq.sh +0 -129
  18. package/.claude/skills/cfn-redis-coordination/demos/test-iteration-feedback.sh +0 -320
  19. package/.claude/skills/cfn-redis-coordination/demos/test-orchestrator.sh +0 -249
  20. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake-phase4-unix.sh +0 -148
  21. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake-phase4.sh +0 -163
  22. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake.sh +0 -138
  23. package/.claude/skills/cfn-redis-coordination/demos/test-quick-fix.sh +0 -81
  24. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-absolute.sh +0 -45
  25. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-fallback.sh +0 -68
  26. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-percentage.sh +0 -56
  27. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-with-retry.sh +0 -81
  28. package/.claude/skills/cfn-redis-coordination/demos/test-quorum.sh +0 -57
  29. package/.claude/skills/cfn-redis-coordination/demos/test-shutdown-handling.sh +0 -187
  30. package/.claude/skills/cfn-redis-coordination/demos/test-shutdown.sh +0 -160
  31. package/.claude/skills/cfn-redis-coordination/demos/test-utils-unix.sh +0 -97
  32. package/.claude/skills/cfn-redis-coordination/demos/test-utils.sh +0 -97
  33. package/.claude/skills/cfn-redis-coordination/demos/test-waiting-mode.sh +0 -59
  34. package/.claude/skills/cfn-redis-coordination/examples/README.md +0 -73
  35. package/.claude/skills/cfn-redis-coordination/examples/grafana-dashboard.json +0 -352
  36. package/.claude/skills/cfn-redis-coordination/examples/hierarchical-pattern.sh +0 -127
  37. package/.claude/skills/cfn-redis-coordination/examples/mesh-pattern.sh +0 -171
  38. package/.claude/skills/cfn-redis-coordination/examples/timeout-handling.sh +0 -227
  39. package/.claude/skills/cfn-redis-coordination/examples/waiting-mode-pattern.sh +0 -239
  40. package/.claude/skills/cfn-redis-coordination/execute-product-owner-decision.sh +0 -258
  41. package/.claude/skills/cfn-redis-coordination/get-agent-timeout.sh +0 -177
  42. package/.claude/skills/cfn-redis-coordination/heartbeat-functions.sh +0 -137
  43. package/.claude/skills/cfn-redis-coordination/heartbeat-protocol.md +0 -106
  44. package/.claude/skills/cfn-redis-coordination/heartbeat.sh +0 -126
  45. package/.claude/skills/cfn-redis-coordination/init-swarm.sh +0 -148
  46. package/.claude/skills/cfn-redis-coordination/invoke-redis-pattern.sh +0 -220
  47. package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +0 -283
  48. package/.claude/skills/cfn-redis-coordination/list-active-swarms.sh +0 -147
  49. package/.claude/skills/cfn-redis-coordination/log-event.sh +0 -109
  50. package/.claude/skills/cfn-redis-coordination/metrics-export.sh +0 -674
  51. package/.claude/skills/cfn-redis-coordination/metrics-schema.json +0 -66
  52. package/.claude/skills/cfn-redis-coordination/metrics-storage.md +0 -31
  53. package/.claude/skills/cfn-redis-coordination/monitor-cfn-violations.sh +0 -391
  54. package/.claude/skills/cfn-redis-coordination/monitor-heartbeats.sh +0 -101
  55. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop-v3.sh +0 -141
  56. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh +0 -31
  57. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
  58. package/.claude/skills/cfn-redis-coordination/priority-wake-mechanism.md +0 -75
  59. package/.claude/skills/cfn-redis-coordination/priority_wake.py +0 -134
  60. package/.claude/skills/cfn-redis-coordination/query-dlq.sh +0 -162
  61. package/.claude/skills/cfn-redis-coordination/query-logs.sh +0 -103
  62. package/.claude/skills/cfn-redis-coordination/redis-pattern.sh +0 -619
  63. package/.claude/skills/cfn-redis-coordination/retrieve-context.sh +0 -58
  64. package/.claude/skills/cfn-redis-coordination/select-specialist-agent.sh +0 -371
  65. package/.claude/skills/cfn-redis-coordination/semantic-match-tfidf.py +0 -252
  66. package/.claude/skills/cfn-redis-coordination/send-heartbeat.sh +0 -165
  67. package/.claude/skills/cfn-redis-coordination/signal.sh +0 -38
  68. package/.claude/skills/cfn-redis-coordination/store-context.sh +0 -86
  69. package/.claude/skills/cfn-redis-coordination/store-epic-context.sh +0 -123
  70. package/.claude/skills/cfn-redis-coordination/test-context-injection.sh +0 -354
  71. package/.claude/skills/cfn-redis-coordination/test-timeout-enforcement.sh +0 -513
  72. package/.claude/skills/cfn-redis-coordination/tests/convert-line-endings.sh +0 -15
  73. package/.claude/skills/cfn-redis-coordination/tests/dlq-functionality-test.sh +0 -102
  74. package/.claude/skills/cfn-redis-coordination/tests/edge-cases-test.sh +0 -99
  75. package/.claude/skills/cfn-redis-coordination/tests/integration-test.sh +0 -170
  76. package/.claude/skills/cfn-redis-coordination/tests/retry-mechanism-test.sh +0 -82
  77. package/.claude/skills/cfn-redis-coordination/tests/run-test-suite.sh +0 -92
  78. package/.claude/skills/cfn-redis-coordination/tests/run-tests.sh +0 -4
  79. package/.claude/skills/cfn-redis-coordination/tests/test-heartbeat-monitoring.sh +0 -418
  80. package/.claude/skills/cfn-redis-coordination/tests/test-heartbeat-simple.sh +0 -124
  81. package/.claude/skills/cfn-redis-coordination/tests/test-primitives.sh +0 -166
  82. package/.claude/skills/cfn-redis-coordination/tests/test-utils.sh +0 -54
  83. package/.claude/skills/cfn-redis-coordination/tests/test_utils.sh +0 -49
  84. package/.claude/skills/cfn-redis-coordination/v2_modularization/core_orchestration.sh +0 -76
  85. package/.claude/skills/cfn-redis-coordination/validate-parameters.sh +0 -492
  86. package/claude-assets/skills/cfn-redis-coordination/HEARTBEAT.md +0 -57
  87. package/claude-assets/skills/cfn-redis-coordination/HEARTBEAT_MONITORING.md +0 -267
  88. package/claude-assets/skills/cfn-redis-coordination/LOGGING.md +0 -260
  89. package/claude-assets/skills/cfn-redis-coordination/README.md +0 -65
  90. package/claude-assets/skills/cfn-redis-coordination/SECURITY_REVIEW.md +0 -25
  91. package/claude-assets/skills/cfn-redis-coordination/SHUTDOWN_HANDLING.md +0 -164
  92. package/claude-assets/skills/cfn-redis-coordination/SKILL.md +0 -720
  93. package/claude-assets/skills/cfn-redis-coordination/demos/test-dlq.sh +0 -129
  94. package/claude-assets/skills/cfn-redis-coordination/demos/test-iteration-feedback.sh +0 -320
  95. package/claude-assets/skills/cfn-redis-coordination/demos/test-orchestrator.sh +0 -249
  96. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake-phase4-unix.sh +0 -148
  97. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake-phase4.sh +0 -163
  98. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake.sh +0 -138
  99. package/claude-assets/skills/cfn-redis-coordination/demos/test-quick-fix.sh +0 -81
  100. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-absolute.sh +0 -45
  101. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-fallback.sh +0 -68
  102. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-percentage.sh +0 -56
  103. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-with-retry.sh +0 -81
  104. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum.sh +0 -57
  105. package/claude-assets/skills/cfn-redis-coordination/demos/test-shutdown-handling.sh +0 -187
  106. package/claude-assets/skills/cfn-redis-coordination/demos/test-shutdown.sh +0 -160
  107. package/claude-assets/skills/cfn-redis-coordination/demos/test-utils-unix.sh +0 -97
  108. package/claude-assets/skills/cfn-redis-coordination/demos/test-utils.sh +0 -97
  109. package/claude-assets/skills/cfn-redis-coordination/demos/test-waiting-mode.sh +0 -59
  110. package/claude-assets/skills/cfn-redis-coordination/examples/README.md +0 -73
  111. package/claude-assets/skills/cfn-redis-coordination/examples/grafana-dashboard.json +0 -352
  112. package/claude-assets/skills/cfn-redis-coordination/examples/hierarchical-pattern.sh +0 -127
  113. package/claude-assets/skills/cfn-redis-coordination/examples/mesh-pattern.sh +0 -171
  114. package/claude-assets/skills/cfn-redis-coordination/examples/timeout-handling.sh +0 -227
  115. package/claude-assets/skills/cfn-redis-coordination/examples/waiting-mode-pattern.sh +0 -239
  116. package/claude-assets/skills/cfn-redis-coordination/execute-product-owner-decision.sh +0 -258
  117. package/claude-assets/skills/cfn-redis-coordination/get-agent-timeout.sh +0 -177
  118. package/claude-assets/skills/cfn-redis-coordination/heartbeat-functions.sh +0 -137
  119. package/claude-assets/skills/cfn-redis-coordination/heartbeat-protocol.md +0 -106
  120. package/claude-assets/skills/cfn-redis-coordination/heartbeat.sh +0 -126
  121. package/claude-assets/skills/cfn-redis-coordination/init-swarm.sh +0 -148
  122. package/claude-assets/skills/cfn-redis-coordination/invoke-redis-pattern.sh +0 -220
  123. package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +0 -283
  124. package/claude-assets/skills/cfn-redis-coordination/list-active-swarms.sh +0 -147
  125. package/claude-assets/skills/cfn-redis-coordination/log-event.sh +0 -109
  126. package/claude-assets/skills/cfn-redis-coordination/metrics-export.sh +0 -674
  127. package/claude-assets/skills/cfn-redis-coordination/metrics-schema.json +0 -66
  128. package/claude-assets/skills/cfn-redis-coordination/metrics-storage.md +0 -31
  129. package/claude-assets/skills/cfn-redis-coordination/monitor-cfn-violations.sh +0 -391
  130. package/claude-assets/skills/cfn-redis-coordination/monitor-heartbeats.sh +0 -101
  131. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop-v3.sh +0 -141
  132. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh +0 -31
  133. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
  134. package/claude-assets/skills/cfn-redis-coordination/priority-wake-mechanism.md +0 -75
  135. package/claude-assets/skills/cfn-redis-coordination/priority_wake.py +0 -134
  136. package/claude-assets/skills/cfn-redis-coordination/query-dlq.sh +0 -162
  137. package/claude-assets/skills/cfn-redis-coordination/query-logs.sh +0 -103
  138. package/claude-assets/skills/cfn-redis-coordination/redis-pattern.sh +0 -619
  139. package/claude-assets/skills/cfn-redis-coordination/retrieve-context.sh +0 -58
  140. package/claude-assets/skills/cfn-redis-coordination/select-specialist-agent.sh +0 -371
  141. package/claude-assets/skills/cfn-redis-coordination/semantic-match-tfidf.py +0 -252
  142. package/claude-assets/skills/cfn-redis-coordination/send-heartbeat.sh +0 -165
  143. package/claude-assets/skills/cfn-redis-coordination/signal.sh +0 -38
  144. package/claude-assets/skills/cfn-redis-coordination/store-context.sh +0 -86
  145. package/claude-assets/skills/cfn-redis-coordination/store-epic-context.sh +0 -123
  146. package/claude-assets/skills/cfn-redis-coordination/test-context-injection.sh +0 -354
  147. package/claude-assets/skills/cfn-redis-coordination/test-timeout-enforcement.sh +0 -513
  148. package/claude-assets/skills/cfn-redis-coordination/tests/convert-line-endings.sh +0 -15
  149. package/claude-assets/skills/cfn-redis-coordination/tests/dlq-functionality-test.sh +0 -102
  150. package/claude-assets/skills/cfn-redis-coordination/tests/edge-cases-test.sh +0 -99
  151. package/claude-assets/skills/cfn-redis-coordination/tests/integration-test.sh +0 -170
  152. package/claude-assets/skills/cfn-redis-coordination/tests/retry-mechanism-test.sh +0 -82
  153. package/claude-assets/skills/cfn-redis-coordination/tests/run-test-suite.sh +0 -92
  154. package/claude-assets/skills/cfn-redis-coordination/tests/run-tests.sh +0 -4
  155. package/claude-assets/skills/cfn-redis-coordination/tests/test-heartbeat-monitoring.sh +0 -418
  156. package/claude-assets/skills/cfn-redis-coordination/tests/test-heartbeat-simple.sh +0 -124
  157. package/claude-assets/skills/cfn-redis-coordination/tests/test-primitives.sh +0 -166
  158. package/claude-assets/skills/cfn-redis-coordination/tests/test-utils.sh +0 -54
  159. package/claude-assets/skills/cfn-redis-coordination/tests/test_utils.sh +0 -49
  160. package/claude-assets/skills/cfn-redis-coordination/v2_modularization/core_orchestration.sh +0 -76
  161. package/claude-assets/skills/cfn-redis-coordination/validate-parameters.sh +0 -492
@@ -164,7 +164,7 @@ EOF
164
164
  ### 5. Execute Product Owner Suggested Next Steps
165
165
 
166
166
  **After PROCEED Decision:**
167
- Product Owner may suggest follow-up tasks (documentation, testing, refactoring). Coordinator (main chat) spawns specialized agents to execute these tasks:
167
+ Product Owner may suggest follow-up tasks (documentation, testing, refactoring). Coordinator (main chat) must proceed by spawning specialized agents to execute these tasks:
168
168
 
169
169
  ```javascript
170
170
  // Parse PO feedback for suggested next steps
@@ -272,7 +272,7 @@ fi
272
272
  ```
273
273
 
274
274
  ### Prioritization
275
- - **P1**: Critical, blocks progress → process immediately
275
+ - **P1**: Critical, blocks progress → process immediately by launching agents for loop 3
276
276
  - **P2**: High value → next sprint
277
277
  - **P3**: Nice to have → background worker
278
278
 
@@ -305,7 +305,7 @@ threshold = Math.min(threshold, 0.98); // Cap at 0.98
305
305
  ## Background Backlog Worker
306
306
 
307
307
  ### Architecture
308
- - **Main Chat**: Spawns Task() coordinator for Sprint N (foreground)
308
+ - **Main Chat**: Spawns Task() agents for Sprint N (foreground)
309
309
  - **Background CLI**: Processes P3 backlog items (detached process)
310
310
 
311
311
  ### Launch Background Worker
@@ -339,52 +339,9 @@ kill $(cat /tmp/backlog-worker.pid) # Stop worker
339
339
 
340
340
  ---
341
341
 
342
- ## Task Mode Examples
342
+ ### Background Backlog Example
343
343
 
344
- ### Example 1: Simple Backend API
345
344
  ```javascript
346
- Task("cfn-v3-coordinator", `
347
- CFN LOOP TASK MODE - User Profile API
348
-
349
- Complexity: Simple (2 files, ~150 LOC)
350
- Loop 3: backend-dev
351
- Loop 2: reviewer, tester
352
- Consensus: 0.85
353
-
354
- Acceptance:
355
- - [ ] GET /profile/:id works
356
- - [ ] PUT /profile/:id works
357
- - [ ] Tests pass (>80%)
358
-
359
- On Complete: git commit + push + generate docs/SPRINT_1_COMPLETE.md
360
- `)
361
- ```
362
-
363
- ### Example 2: Complex Full-Stack
364
- ```javascript
365
- Task("cfn-v3-coordinator", `
366
- CFN LOOP TASK MODE - JWT Authentication
367
-
368
- Complexity: Complex (8 files, ~800 LOC, security-critical)
369
- Loop 3: backend-dev, react-frontend-engineer, devops
370
- Loop 2: reviewer, tester, architect, security-specialist
371
- Consensus: 0.92
372
-
373
- Acceptance:
374
- - [ ] JWT generation/validation working
375
- - [ ] Refresh token rotation
376
- - [ ] Security audit passed
377
-
378
- Backlog: Auto-defer OAuth/MFA as P2
379
- On Complete: Security scan + git commit + push + sprint summary
380
- `)
381
- ```
382
-
383
- ### Example 3: Background Backlog
384
- ```javascript
385
- // Foreground: Sprint 2
386
- Task("cfn-v3-coordinator", `Sprint 2: Authorization & RBAC`)
387
-
388
345
  // Background: Process P3 backlog
389
346
  Bash(`
390
347
  npx claude-flow-novice agent backlog-worker \
@@ -1,276 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- ##############################################################################
4
- # Test Cancel Swarm - Validates graceful shutdown functionality
5
- #
6
- # Tests:
7
- # 1. Cancel active swarm (success path)
8
- # 2. Cancel with custom reason and initiator
9
- # 3. Cancel non-existent swarm (error handling)
10
- # 4. Verify shutdown signals delivered to all agents
11
- # 5. Verify swarm metadata updated correctly
12
- # 6. Test force flag (skip confirmation)
13
- ##############################################################################
14
-
15
- # Disable strict error handling for tests
16
- set -uo pipefail
17
-
18
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
- TEST_TASK_ID="test-cancel-$(date +%s)"
20
- FAILED_TESTS=0
21
- PASSED_TESTS=0
22
-
23
- # Colors for output
24
- RED='\033[0;31m'
25
- GREEN='\033[0;32m'
26
- YELLOW='\033[1;33m'
27
- NC='\033[0m' # No Color
28
-
29
- log_test() {
30
- echo ""
31
- echo "========================================="
32
- echo "TEST: $1"
33
- echo "========================================="
34
- }
35
-
36
- log_pass() {
37
- echo -e "${GREEN}✓ PASS:${NC} $1"
38
- ((PASSED_TESTS++))
39
- }
40
-
41
- log_fail() {
42
- echo -e "${RED}✗ FAIL:${NC} $1"
43
- ((FAILED_TESTS++))
44
- }
45
-
46
- log_info() {
47
- echo -e "${YELLOW}ℹ INFO:${NC} $1"
48
- }
49
-
50
- cleanup() {
51
- log_info "Cleaning up test data..."
52
-
53
- # Delete test keys matching patterns
54
- KEYS=$(redis-cli --scan --pattern "swarm:${TEST_TASK_ID}*" 2>/dev/null || true)
55
- if [ -n "$KEYS" ]; then
56
- echo "$KEYS" | while read -r KEY; do
57
- redis-cli del "$KEY" > /dev/null 2>&1 || true
58
- done
59
- fi
60
-
61
- KEYS=$(redis-cli --scan --pattern "swarm:test-cancel-*" 2>/dev/null || true)
62
- if [ -n "$KEYS" ]; then
63
- echo "$KEYS" | while read -r KEY; do
64
- redis-cli del "$KEY" > /dev/null 2>&1 || true
65
- done
66
- fi
67
- }
68
-
69
- # Cleanup on exit
70
- trap cleanup EXIT
71
-
72
- echo "========================================="
73
- echo "Cancel Swarm Test Suite"
74
- echo "========================================="
75
- echo "Test Task ID: $TEST_TASK_ID"
76
- echo ""
77
-
78
- # =============================================================================
79
- # Test 1: Cancel active swarm (success path)
80
- # =============================================================================
81
- log_test "Cancel Active Swarm"
82
-
83
- # Initialize test swarm
84
- SWARM_ID="${TEST_TASK_ID}-swarm1"
85
- AGENTS="coder-1,reviewer-1,tester-1"
86
-
87
- "$SCRIPT_DIR/init-swarm.sh" \
88
- --swarm-id "$SWARM_ID" \
89
- --task-id "$TEST_TASK_ID" \
90
- --agents "$AGENTS" > /dev/null
91
-
92
- log_info "Swarm initialized: $SWARM_ID"
93
-
94
- # Cancel swarm with force flag (skip confirmation)
95
- OUTPUT=$("$SCRIPT_DIR/cancel-swarm.sh" \
96
- --task-id "$TEST_TASK_ID" \
97
- --force 2>&1 || true)
98
-
99
- # Verify status updated
100
- STATUS=$(redis-cli hget "swarm:${SWARM_ID}:metadata" status)
101
- if [ "$STATUS" = "cancelled" ]; then
102
- log_pass "Swarm status updated to 'cancelled'"
103
- else
104
- log_fail "Expected status 'cancelled', got: $STATUS"
105
- fi
106
-
107
- # Verify agents_notified count
108
- NOTIFIED=$(redis-cli hget "swarm:${SWARM_ID}:metadata" agents_notified)
109
- if [ "$NOTIFIED" = "3" ]; then
110
- log_pass "All 3 agents notified"
111
- else
112
- log_fail "Expected 3 agents notified, got: $NOTIFIED"
113
- fi
114
-
115
- # Verify shutdown signal broadcasted
116
- SHUTDOWN_KEY="swarm:${TEST_TASK_ID}:shutdown"
117
- SHUTDOWN_MSG=$(redis-cli --raw lindex "$SHUTDOWN_KEY" 0 2>/dev/null || echo "{}")
118
-
119
- if [ -n "$SHUTDOWN_MSG" ] && [ "$SHUTDOWN_MSG" != "(nil)" ]; then
120
- log_pass "Shutdown signal broadcasted to $SHUTDOWN_KEY"
121
-
122
- # Verify message content
123
- REASON=$(echo "$SHUTDOWN_MSG" | jq -r '.reason // empty')
124
- INITIATOR=$(echo "$SHUTDOWN_MSG" | jq -r '.initiator // empty')
125
-
126
- if [ "$REASON" = "user_requested_cancellation" ]; then
127
- log_pass "Shutdown signal has correct reason"
128
- else
129
- log_fail "Expected reason 'user_requested_cancellation', got: $REASON"
130
- fi
131
-
132
- if [ "$INITIATOR" = "main-chat" ]; then
133
- log_pass "Shutdown signal has correct initiator"
134
- else
135
- log_fail "Expected initiator 'main-chat', got: $INITIATOR"
136
- fi
137
- else
138
- log_fail "No shutdown signal found"
139
- fi
140
-
141
- # =============================================================================
142
- # Test 2: Cancel with custom reason and initiator
143
- # =============================================================================
144
- log_test "Cancel with Custom Reason and Initiator"
145
-
146
- SWARM_ID2="${TEST_TASK_ID}-swarm2"
147
- "$SCRIPT_DIR/init-swarm.sh" \
148
- --swarm-id "$SWARM_ID2" \
149
- --task-id "${TEST_TASK_ID}-custom" \
150
- --agents "backend-dev-1" > /dev/null
151
-
152
- OUTPUT=$("$SCRIPT_DIR/cancel-swarm.sh" \
153
- --task-id "${TEST_TASK_ID}-custom" \
154
- --reason "integration_test_timeout" \
155
- --initiator "test-runner" \
156
- --force 2>&1 || true)
157
-
158
- CANCEL_REASON=$(redis-cli hget "swarm:${SWARM_ID2}:metadata" cancellation_reason)
159
- CANCEL_INIT=$(redis-cli hget "swarm:${SWARM_ID2}:metadata" cancellation_initiator)
160
-
161
- if [ "$CANCEL_REASON" = "integration_test_timeout" ]; then
162
- log_pass "Custom cancellation reason recorded"
163
- else
164
- log_fail "Expected reason 'integration_test_timeout', got: $CANCEL_REASON"
165
- fi
166
-
167
- if [ "$CANCEL_INIT" = "test-runner" ]; then
168
- log_pass "Custom initiator recorded"
169
- else
170
- log_fail "Expected initiator 'test-runner', got: $CANCEL_INIT"
171
- fi
172
-
173
- # =============================================================================
174
- # Test 3: Cancel non-existent swarm (error handling)
175
- # =============================================================================
176
- log_test "Cancel Non-Existent Swarm (Error Handling)"
177
-
178
- OUTPUT=$("$SCRIPT_DIR/cancel-swarm.sh" \
179
- --task-id "non-existent-task-id-12345" \
180
- --force 2>&1 || true)
181
-
182
- if echo "$OUTPUT" | grep -q "No swarm found"; then
183
- log_pass "Error message displayed for non-existent swarm"
184
- else
185
- log_fail "Expected error message, got: $OUTPUT"
186
- fi
187
-
188
- # =============================================================================
189
- # Test 4: Verify shutdown message format
190
- # =============================================================================
191
- log_test "Verify Shutdown Message Format"
192
-
193
- SWARM_ID3="${TEST_TASK_ID}-swarm3"
194
- "$SCRIPT_DIR/init-swarm.sh" \
195
- --swarm-id "$SWARM_ID3" \
196
- --task-id "${TEST_TASK_ID}-format" \
197
- --agents "security-1" > /dev/null
198
-
199
- "$SCRIPT_DIR/cancel-swarm.sh" \
200
- --task-id "${TEST_TASK_ID}-format" \
201
- --reason "test_message_format" \
202
- --initiator "validator" \
203
- --force > /dev/null 2>&1
204
-
205
- SHUTDOWN_KEY="swarm:${TEST_TASK_ID}-format:shutdown"
206
- MSG=$(redis-cli --raw lindex "$SHUTDOWN_KEY" 0 2>/dev/null || echo "{}")
207
-
208
- # Validate JSON structure
209
- REASON=$(echo "$MSG" | jq -r '.reason // empty')
210
- TIMESTAMP=$(echo "$MSG" | jq -r '.timestamp // empty')
211
- INITIATOR=$(echo "$MSG" | jq -r '.initiator // empty')
212
-
213
- if [ "$REASON" = "test_message_format" ] && \
214
- [ -n "$TIMESTAMP" ] && \
215
- [ "$INITIATOR" = "validator" ]; then
216
- log_pass "Shutdown message has correct format"
217
- else
218
- log_fail "Shutdown message format incorrect: $MSG"
219
- fi
220
-
221
- # =============================================================================
222
- # Test 5: Verify cancelled_at timestamp
223
- # =============================================================================
224
- log_test "Verify Cancelled Timestamp"
225
-
226
- CANCELLED_AT=$(redis-cli hget "swarm:${SWARM_ID3}:metadata" cancelled_at)
227
-
228
- if [[ "$CANCELLED_AT" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$ ]]; then
229
- log_pass "Cancelled timestamp in ISO 8601 format: $CANCELLED_AT"
230
- else
231
- log_fail "Invalid timestamp format: $CANCELLED_AT"
232
- fi
233
-
234
- # =============================================================================
235
- # Test 6: Empty agent list handling
236
- # =============================================================================
237
- log_test "Handle Swarm with Empty Agent List"
238
-
239
- SWARM_ID4="${TEST_TASK_ID}-swarm4"
240
- redis-cli hset "swarm:${SWARM_ID4}:metadata" \
241
- swarm_id "$SWARM_ID4" \
242
- task_id "${TEST_TASK_ID}-empty" \
243
- agents "" \
244
- status "in_progress" > /dev/null
245
-
246
- OUTPUT=$("$SCRIPT_DIR/cancel-swarm.sh" \
247
- --task-id "${TEST_TASK_ID}-empty" \
248
- --force 2>&1 || true)
249
-
250
- STATUS=$(redis-cli hget "swarm:${SWARM_ID4}:metadata" status)
251
- NOTIFIED=$(redis-cli hget "swarm:${SWARM_ID4}:metadata" agents_notified)
252
-
253
- if [ "$STATUS" = "cancelled" ] && [ "$NOTIFIED" = "0" ]; then
254
- log_pass "Empty agent list handled correctly"
255
- else
256
- log_fail "Empty agent list handling failed (status: $STATUS, notified: $NOTIFIED)"
257
- fi
258
-
259
- # =============================================================================
260
- # Summary
261
- # =============================================================================
262
- echo ""
263
- echo "========================================="
264
- echo "Test Summary"
265
- echo "========================================="
266
- echo -e "${GREEN}Passed:${NC} $PASSED_TESTS"
267
- echo -e "${RED}Failed:${NC} $FAILED_TESTS"
268
- echo "========================================="
269
-
270
- if [ $FAILED_TESTS -eq 0 ]; then
271
- echo -e "${GREEN}✓ All tests passed!${NC}"
272
- exit 0
273
- else
274
- echo -e "${RED}✗ Some tests failed${NC}"
275
- exit 1
276
- fi
@@ -164,7 +164,7 @@ EOF
164
164
  ### 5. Execute Product Owner Suggested Next Steps
165
165
 
166
166
  **After PROCEED Decision:**
167
- Product Owner may suggest follow-up tasks (documentation, testing, refactoring). Coordinator (main chat) spawns specialized agents to execute these tasks:
167
+ Product Owner may suggest follow-up tasks (documentation, testing, refactoring). Coordinator (main chat) must proceed by spawning specialized agents to execute these tasks:
168
168
 
169
169
  ```javascript
170
170
  // Parse PO feedback for suggested next steps
@@ -272,7 +272,7 @@ fi
272
272
  ```
273
273
 
274
274
  ### Prioritization
275
- - **P1**: Critical, blocks progress → process immediately
275
+ - **P1**: Critical, blocks progress → process immediately by launching agents for loop 3
276
276
  - **P2**: High value → next sprint
277
277
  - **P3**: Nice to have → background worker
278
278
 
@@ -305,7 +305,7 @@ threshold = Math.min(threshold, 0.98); // Cap at 0.98
305
305
  ## Background Backlog Worker
306
306
 
307
307
  ### Architecture
308
- - **Main Chat**: Spawns Task() coordinator for Sprint N (foreground)
308
+ - **Main Chat**: Spawns Task() agents for Sprint N (foreground)
309
309
  - **Background CLI**: Processes P3 backlog items (detached process)
310
310
 
311
311
  ### Launch Background Worker
@@ -339,52 +339,9 @@ kill $(cat /tmp/backlog-worker.pid) # Stop worker
339
339
 
340
340
  ---
341
341
 
342
- ## Task Mode Examples
342
+ ### Background Backlog Example
343
343
 
344
- ### Example 1: Simple Backend API
345
344
  ```javascript
346
- Task("cfn-v3-coordinator", `
347
- CFN LOOP TASK MODE - User Profile API
348
-
349
- Complexity: Simple (2 files, ~150 LOC)
350
- Loop 3: backend-dev
351
- Loop 2: reviewer, tester
352
- Consensus: 0.85
353
-
354
- Acceptance:
355
- - [ ] GET /profile/:id works
356
- - [ ] PUT /profile/:id works
357
- - [ ] Tests pass (>80%)
358
-
359
- On Complete: git commit + push + generate docs/SPRINT_1_COMPLETE.md
360
- `)
361
- ```
362
-
363
- ### Example 2: Complex Full-Stack
364
- ```javascript
365
- Task("cfn-v3-coordinator", `
366
- CFN LOOP TASK MODE - JWT Authentication
367
-
368
- Complexity: Complex (8 files, ~800 LOC, security-critical)
369
- Loop 3: backend-dev, react-frontend-engineer, devops
370
- Loop 2: reviewer, tester, architect, security-specialist
371
- Consensus: 0.92
372
-
373
- Acceptance:
374
- - [ ] JWT generation/validation working
375
- - [ ] Refresh token rotation
376
- - [ ] Security audit passed
377
-
378
- Backlog: Auto-defer OAuth/MFA as P2
379
- On Complete: Security scan + git commit + push + sprint summary
380
- `)
381
- ```
382
-
383
- ### Example 3: Background Backlog
384
- ```javascript
385
- // Foreground: Sprint 2
386
- Task("cfn-v3-coordinator", `Sprint 2: Authorization & RBAC`)
387
-
388
345
  // Background: Process P3 backlog
389
346
  Bash(`
390
347
  npx claude-flow-novice agent backlog-worker \