claude-flow-novice 2.18.39 → 2.18.40

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.
@@ -1,359 +1,295 @@
1
1
  ---
2
2
  description: "Execute CFN Loop in Task Mode with direct agent spawning (visible in main chat)"
3
- argument-hint: "<task description> [--mode=mvp|standard|enterprise] [--max-iterations=n] [--ace-reflect]"
4
- allowed-tools: ["Task", "TodoWrite", "Read", "Bash", "SlashCommand"]
3
+ argument-hint: "<task description> [--mode=mvp|standard|enterprise] [--max-iterations=n]"
4
+ allowed-tools: ["Task", "TodoWrite", "Read", "Bash", "Grep", "Glob"]
5
5
  ---
6
6
 
7
- # CFN Loop Task Mode - Direct Agent Spawning
7
+ # CFN Loop Task Mode
8
8
 
9
- **Version:** 1.4.0 | **Date:** 2025-12-25 | **Status:** Production Ready
9
+ **You are the coordinator. You MUST execute this loop until PROCEED or max iterations.**
10
10
 
11
- ## Quick Overview
11
+ ---
12
12
 
13
- Task Mode spawns agents directly in main chat with full visibility. Uses test-driven gate validation (not confidence scores).
13
+ ## MANDATORY: Initialize State Tracking
14
14
 
15
- ### Autonomous Progression (MANDATORY)
15
+ **IMMEDIATELY create this todo list using TodoWrite:**
16
16
 
17
- **Keep moving forward. Only pause for critical issues.**
17
+ ```
18
+ 1. [pending] Parse arguments and initialize task
19
+ 2. [pending] LOOP 3: Spawn implementation agents
20
+ 3. [pending] GATE CHECK: Run tests and validate pass rate
21
+ 4. [pending] LOOP 2: Spawn validator agents (ONLY if gate passed)
22
+ 5. [pending] PRODUCT OWNER: Review validator feedback, filter out-of-scope, decide
23
+ ```
18
24
 
19
- - **AUTO-PROGRESS:** After each step completes, immediately spawn agents for the next step
20
- - **NO WAITING:** Do not wait for user confirmation between iterations or steps
21
- - **KEEP SPAWNING:** Gate fail → spawn Loop 3 again. Gate pass → spawn validators. Validators pass → spawn next task.
25
+ **You MUST update todo status as you complete each phase. Do NOT skip phases.**
22
26
 
23
- **STOP FOR USER FEEDBACK ONLY WHEN:**
24
- 1. **Corruption/rollback needed** - Commits broke the codebase beyond repair, need git rollback
25
- 2. **Architectural mismatch** - RCA identifies fundamental design conflicts that require rewrite
26
- 3. **Critical security issue** - Credentials exposed, injection vulnerabilities found
27
- 4. **External system failure** - CI/CD down, package registry unavailable, API deprecated
27
+ ---
28
28
 
29
- **DO NOT STOP FOR:**
30
- - Test regressions (loop fixes them - keep iterating)
31
- - Test pass rate drops (keep iterating, RCA will analyze)
32
- - Coverage gaps (keep iterating)
33
- - Single file conflicts (RCA handles it)
34
- - Validator rejections (incorporate feedback and continue)
35
- - Max iterations reached (report results but don't block)
29
+ ## THE LOOP (Execute Until Done)
36
30
 
37
- ### When to Use Task Mode
38
- - **Debugging** - Need to see agent thought process
39
- - **Learning** - Understanding how agents work
40
- - **Complex coordination** - Require custom agent interactions
31
+ ```
32
+ ┌─────────────────────────────────────────────────────────────┐
33
+ │ ITERATION = 1 │
34
+ │ │
35
+ │ WHILE iteration <= MAX_ITERATIONS: │
36
+ │ ├── LOOP 3: Spawn implementation agents │
37
+ │ ├── GATE CHECK: Run npm test, calculate pass rate │
38
+ │ │ ├── IF pass_rate < threshold: iteration++, CONTINUE│
39
+ │ │ └── IF pass_rate >= threshold: PROCEED to Loop 2 │
40
+ │ ├── LOOP 2: Spawn validator agents │
41
+ │ ├── PRODUCT OWNER: Review validator feedback │
42
+ │ │ ├── Filter out-of-scope validator requirements │
43
+ │ │ ├── PROCEED: In-scope work complete, EXIT │
44
+ │ │ ├── ITERATE: In-scope issues remain, CONTINUE │
45
+ │ │ └── ABORT: Corruption/security only, EXIT │
46
+ │ └── END WHILE │
47
+ │ │
48
+ │ MAX_ITERATIONS reached: Report and EXIT │
49
+ └─────────────────────────────────────────────────────────────┘
50
+ ```
41
51
 
42
52
  ---
43
53
 
44
- ## TDD Gate Enforcement (MANDATORY)
54
+ ## PHASE 1: Parse Arguments
45
55
 
46
- **Gate checks are based on TEST PASS RATES, not confidence scores.**
56
+ **Mark todo #1 as in_progress, then execute:**
47
57
 
48
- After Loop 3 agents complete, run gate validation:
49
58
  ```bash
50
- # Get test results
51
- TEST_OUTPUT=$(npm test 2>&1 || true)
52
- PASS_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+(?= passed)' | head -1 || echo "0")
53
- TOTAL_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+(?= total)' | head -1 || echo "1")
54
-
55
- # Calculate pass rate
56
- if [ "$TOTAL_COUNT" -gt 0 ]; then
57
- PASS_RATE=$(echo "scale=4; $PASS_COUNT / $TOTAL_COUNT" | bc)
58
- else
59
- PASS_RATE="0"
60
- fi
61
-
62
- # Validate gate
63
- npx ts-node .claude/skills/cfn-loop-orchestration-v2/lib/orchestrator/src/helpers/gate-check.ts \
64
- --pass-rate "$PASS_RATE" \
65
- --mode "$MODE"
59
+ # Parse from $ARGUMENTS
60
+ MODE="standard" # or mvp, enterprise
61
+ MAX_ITERATIONS=10
62
+ TASK_ID="cfn-task-$(date +%s)-${RANDOM}"
63
+ ITERATION=1
66
64
  ```
67
65
 
68
- ### Gate Thresholds
69
- | Mode | Pass Rate Threshold |
70
- |------|-------------------|
71
- | MVP | 70% |
72
- | Standard | 95% |
73
- | Enterprise | 98% |
66
+ | Mode | Gate Threshold | Consensus Threshold |
67
+ |------|----------------|---------------------|
68
+ | mvp | 70% | 80% |
69
+ | standard | 95% | 90% |
70
+ | enterprise | 98% | 95% |
74
71
 
75
- **CRITICAL:** Validators MUST NOT start until gate check passes.
72
+ **Mark todo #1 as completed. Proceed to Phase 2.**
76
73
 
77
74
  ---
78
75
 
79
- ## Post-Edit Pipeline (MANDATORY)
76
+ ## PHASE 2: LOOP 3 - Implementation Agents
77
+
78
+ **Mark todo #2 as in_progress.**
79
+
80
+ **Spawn using Task tool with subagent_type="backend-developer":**
80
81
 
81
- After ANY file modification, run:
82
- ```bash
83
- ./.claude/hooks/cfn-invoke-post-edit.sh "$FILE_PATH" --agent-id "$AGENT_ID"
84
82
  ```
83
+ TASK: Implement for iteration ${ITERATION}: ${TASK_DESCRIPTION}
85
84
 
86
- Or if using project-local pipeline:
87
- ```bash
88
- node config/hooks/post-edit-pipeline.js "$FILE" --agent-id "${AGENT_ID:-hook}"
85
+ REQUIREMENTS:
86
+ 1. Write tests FIRST (TDD)
87
+ 2. Implement to make tests pass
88
+ 3. Run: npm test
89
+ 4. Report: { "tests_passed": N, "tests_total": M, "files_modified": [...] }
90
+
91
+ AGENT_ID: loop3-impl-${TASK_ID}-iter${ITERATION}
89
92
  ```
90
93
 
94
+ **WAIT for agent to complete and return results.**
95
+
96
+ **Mark todo #2 as completed. Proceed to Phase 3.**
97
+
91
98
  ---
92
99
 
93
- ## Execution Instructions (AUTO-EXECUTE)
100
+ ## PHASE 3: GATE CHECK (Mandatory Before Loop 2)
101
+
102
+ **Mark todo #3 as in_progress.**
103
+
104
+ **YOU MUST RUN THIS - DO NOT SKIP:**
94
105
 
95
- **Step 1: Parse Arguments**
96
106
  ```bash
97
- TASK_DESCRIPTION="$ARGUMENTS"
98
- TASK_DESCRIPTION=$(echo "$TASK_DESCRIPTION" | sed 's/--mode[[:space:]]*[a-zA-Z]*//' | sed 's/--max-iterations[[:space:]]*[0-9]*//' | xargs)
107
+ # Run tests
108
+ npm test 2>&1 | tee /tmp/test-output-${TASK_ID}.txt
99
109
 
100
- MODE="standard"
101
- MAX_ITERATIONS=10
110
+ # Parse results (adjust grep pattern for your test runner)
111
+ PASS_COUNT=$(grep -oP '\d+(?= pass)' /tmp/test-output-${TASK_ID}.txt | head -1 || echo 0)
112
+ TOTAL_COUNT=$(grep -oP '\d+(?= (test|spec))' /tmp/test-output-${TASK_ID}.txt | head -1 || echo 1)
113
+ PASS_RATE=$(echo "scale=2; $PASS_COUNT / $TOTAL_COUNT" | bc)
102
114
 
103
- for arg in $ARGUMENTS; do
104
- case $arg in
105
- --mode=*) MODE="${arg#*=}" ;;
106
- --max-iterations=*) MAX_ITERATIONS="${arg#*=}" ;;
107
- esac
108
- done
115
+ echo "Gate Check: ${PASS_COUNT}/${TOTAL_COUNT} = ${PASS_RATE}"
116
+ ```
109
117
 
110
- if [[ ! "$MODE" =~ ^(mvp|standard|enterprise)$ ]]; then
111
- echo "ERROR: Invalid mode '$MODE'. Must be: mvp, standard, enterprise"
112
- exit 1
113
- fi
118
+ **DECISION POINT:**
114
119
 
115
- TASK_ID="cfn-task-$(date +%s%N | tail -c 7)-${RANDOM}"
116
- echo "Task ID: $TASK_ID | Mode: $MODE | Max Iterations: $MAX_ITERATIONS"
120
+ ```
121
+ IF pass_rate >= threshold:
122
+ → Mark todo #3 completed
123
+ → PROCEED to Phase 4 (Loop 2)
124
+
125
+ IF pass_rate < threshold:
126
+ → Log: "Gate FAILED (${PASS_RATE} < ${THRESHOLD}). Iterating..."
127
+ → ITERATION = ITERATION + 1
128
+ → IF iteration > MAX_ITERATIONS: Report failure and EXIT
129
+ → Reset todo #2 to pending, mark #3 as pending
130
+ → GO BACK TO PHASE 2 (spawn Loop 3 again with failure context)
117
131
  ```
118
132
 
119
- **Step 2: Spawn Loop 3 Agents (Implementation)**
120
- ```bash
121
- case $MODE in
122
- "mvp")
123
- Task("backend-developer", `
124
- AGENT_ID="backend-dev-${TASK_ID}"
125
-
126
- TASK: Implement MVP for: ${TASK_DESCRIPTION}
127
-
128
- TDD REQUIREMENTS (MANDATORY):
129
- 1. Write tests BEFORE implementation (Red phase)
130
- 2. Implement to make tests pass (Green phase)
131
- 3. Refactor while keeping tests green
132
- 4. Run: npm test -- --reporter=json after implementation
133
- 5. Report actual pass/fail counts, NOT confidence scores
134
-
135
- POST-EDIT (MANDATORY):
136
- After each file edit, run:
137
- ./.claude/hooks/cfn-invoke-post-edit.sh "$FILE_PATH" --agent-id "$AGENT_ID"
138
-
139
- RETURN FORMAT:
140
- {
141
- "tests_passed": <number>,
142
- "tests_total": <number>,
143
- "pass_rate": <0.0-1.0>,
144
- "files_created": [...],
145
- "files_modified": [...]
146
- }
147
- `)
148
- ;;
149
-
150
- "standard"|"enterprise")
151
- Task("backend-developer", `
152
- AGENT_ID="backend-dev-${TASK_ID}"
153
-
154
- TASK: Implement production solution for: ${TASK_DESCRIPTION}
155
-
156
- TDD REQUIREMENTS (MANDATORY - London School):
157
- 1. Write unit tests with mocks FIRST
158
- 2. Write integration tests for component interactions
159
- 3. Implement to make all tests pass
160
- 4. Achieve ${MODE === 'standard' ? '80' : '95'}% coverage minimum
161
- 5. Run: npm test -- --reporter=json after implementation
162
- 6. Report actual pass/fail counts, NOT confidence scores
163
-
164
- POST-EDIT (MANDATORY):
165
- After each file edit, run:
166
- ./.claude/hooks/cfn-invoke-post-edit.sh "$FILE_PATH" --agent-id "$AGENT_ID"
167
-
168
- RETURN FORMAT:
169
- {
170
- "tests_passed": <number>,
171
- "tests_total": <number>,
172
- "pass_rate": <0.0-1.0>,
173
- "coverage_percent": <number>,
174
- "files_created": [...],
175
- "files_modified": [...]
176
- }
177
- `)
178
- ;;
179
- esac
133
+ **DO NOT proceed to Loop 2 if gate failed. ITERATE.**
134
+
135
+ ---
136
+
137
+ ## PHASE 4: LOOP 2 - Validator Agents
138
+
139
+ **Mark todo #4 as in_progress.**
140
+
141
+ **ONLY execute this phase if Gate Check passed.**
142
+
143
+ **Spawn validators in parallel using Task tool:**
144
+
145
+ **Validator 1: code-reviewer**
180
146
  ```
147
+ TASK: Review implementation for: ${TASK_DESCRIPTION}
181
148
 
182
- **Step 3: Run Gate Check (BEFORE validators)**
183
- ```bash
184
- echo "Running gate check..."
149
+ CHECKLIST:
150
+ - [ ] Tests exist and pass
151
+ - [ ] No hardcoded secrets
152
+ - [ ] Code follows project patterns
185
153
 
186
- # HARD CAP: Max 10 iterations regardless of mode
187
- MAX_ITERATIONS=10
154
+ Return: PASS or FAIL with findings
155
+ AGENT_ID: loop2-reviewer-${TASK_ID}
156
+ ```
188
157
 
189
- # Parse agent output for test results
190
- TESTS_PASSED=${LOOP3_RESULT.tests_passed:-0}
191
- TESTS_TOTAL=${LOOP3_RESULT.tests_total:-1}
192
- PASS_RATE=$(echo "scale=4; $TESTS_PASSED / $TESTS_TOTAL" | bc)
193
-
194
- # Run gate validation
195
- GATE_RESULT=$(npx ts-node .claude/skills/cfn-loop-orchestration-v2/lib/orchestrator/src/helpers/gate-check.ts \
196
- --pass-rate "$PASS_RATE" \
197
- --mode "$MODE" 2>&1)
198
-
199
- if echo "$GATE_RESULT" | grep -q '"passed": false'; then
200
- echo "GATE FAILED - Iterating Loop 3"
201
- ITERATION=$((ITERATION + 1))
202
-
203
- # Test regressions are NOT a stop condition - the loop fixes them
204
- # Only stop for: corruption needing rollback, architectural mismatch, security issues
205
- echo "Pass rate: ${PASS_RATE} - Loop will continue iterating to fix"
206
-
207
- # After 3 failed iterations, invoke root cause analysis
208
- if [ $ITERATION -eq 3 ]; then
209
- echo "3 iterations failed - Spawning root cause analyst..."
210
-
211
- Task("root-cause-analyst", `
212
- AGENT_ID="rca-${TASK_ID}"
213
-
214
- TASK: Analyze why Loop 3 implementation keeps failing for: ${TASK_DESCRIPTION}
215
-
216
- INVESTIGATION SCOPE:
217
- 1. Review test failures from previous iterations
218
- 2. Identify blocking patterns (missing dependencies, architectural issues, incorrect assumptions)
219
- 3. Check for circular dependencies or integration conflicts
220
- 4. Analyze error logs and stack traces
221
-
222
- REQUIRED OUTPUT:
223
- {
224
- "root_causes": [
225
- {"issue": "<description>", "severity": "critical|high|medium", "fix": "<specific solution>"}
226
- ],
227
- "recommended_approach": "<concrete implementation strategy>",
228
- "files_to_modify": [...],
229
- "tests_to_add": [...],
230
- "blockers_to_remove": [...]
231
- }
232
-
233
- This analysis will be passed to the next Loop 3 iteration to prevent repeated failures.
234
- `)
235
-
236
- # Store RCA findings for next iteration
237
- RCA_FINDINGS=${RCA_RESULT}
238
- echo "Root cause analysis complete. Findings will guide next iteration."
239
- fi
240
-
241
- if [ $ITERATION -lt $MAX_ITERATIONS ]; then
242
- # Spawn Loop 3 again with failure context (and RCA findings if available)
243
- if [ -n "$RCA_FINDINGS" ]; then
244
- echo "Re-running Loop 3 with root cause analysis guidance..."
245
- # RCA_FINDINGS passed to Loop 3 agents in next iteration
246
- fi
247
- continue
248
- else
249
- echo "Max iterations (10) reached. Gate still failing."
250
- exit 1
251
- fi
252
- fi
253
-
254
- echo "GATE PASSED - Proceeding to validators"
158
+ **Validator 2: tester**
255
159
  ```
160
+ TASK: Validate test coverage for: ${TASK_DESCRIPTION}
256
161
 
257
- **Step 4: Spawn Loop 2 Validators (ONLY after gate passes)**
258
- ```bash
259
- Task("code-reviewer", `
260
- AGENT_ID="reviewer-${TASK_ID}"
162
+ Execute: npm test -- --coverage
163
+ Return: { "pass": true/false, "coverage": N%, "findings": [...] }
164
+ AGENT_ID: loop2-tester-${TASK_ID}
165
+ ```
261
166
 
262
- TASK: Validate implementation for: ${TASK_DESCRIPTION}
167
+ **Collect results from both validators.**
263
168
 
264
- VALIDATION CHECKLIST:
265
- - [ ] Tests exist for all new code
266
- - [ ] Tests follow TDD pattern (written before implementation)
267
- - [ ] Coverage meets threshold for ${MODE} mode
268
- - [ ] No hardcoded secrets or credentials
269
- - [ ] Post-edit hooks were invoked
169
+ **Mark todo #4 as completed. Proceed to Phase 5.**
270
170
 
271
- Return: PASS or FAIL with specific findings
272
- `)
171
+ ---
273
172
 
274
- Task("tester", `
275
- AGENT_ID="tester-${TASK_ID}"
173
+ ## PHASE 5: Product Owner Decision
276
174
 
277
- TASK: Run comprehensive tests for: ${TASK_DESCRIPTION}
175
+ **Mark todo #5 as in_progress.**
278
176
 
279
- Execute:
280
- 1. npm test -- --coverage
281
- 2. Report pass/fail counts
282
- 3. Report coverage percentages
177
+ **Spawn Product Owner agent using Task tool with subagent_type="product-owner":**
283
178
 
284
- Return: Test report with actual metrics, not estimates
285
- `)
179
+ ```
180
+ TASK: Review validator feedback and make scope-aware decision
181
+
182
+ CONTEXT:
183
+ - Task: ${TASK_DESCRIPTION}
184
+ - Mode: ${MODE}
185
+ - Iteration: ${ITERATION}
186
+ - Gate pass rate: ${PASS_RATE}
187
+
188
+ VALIDATOR FEEDBACK:
189
+ ${VALIDATOR_1_FEEDBACK}
190
+ ${VALIDATOR_2_FEEDBACK}
191
+
192
+ YOUR RESPONSIBILITIES:
193
+ 1. Review each validator finding
194
+ 2. Classify each finding as IN-SCOPE or OUT-OF-SCOPE
195
+ 3. OUT-OF-SCOPE items: Log for backlog, do NOT require iteration
196
+ 4. IN-SCOPE items: Determine if they block PROCEED
197
+
198
+ DECISION CRITERIA:
199
+ - PROCEED: All in-scope requirements met, tests pass, no blocking issues
200
+ - ITERATE: In-scope issues remain that need fixing
201
+ - ABORT: Only for corruption, security vulnerabilities, or architectural dead-ends
202
+
203
+ RETURN FORMAT:
204
+ {
205
+ "decision": "PROCEED" | "ITERATE" | "ABORT",
206
+ "in_scope_findings": [...],
207
+ "out_of_scope_findings": [...],
208
+ "reasoning": "...",
209
+ "iteration_guidance": "..." (if ITERATE)
210
+ }
211
+
212
+ AGENT_ID: product-owner-${TASK_ID}-iter${ITERATION}
286
213
  ```
287
214
 
288
- **Step 5: Product Owner Decision**
289
- ```bash
290
- # Collect validator results
291
- VALIDATOR_PASS_COUNT=0
292
- VALIDATOR_TOTAL=2
293
-
294
- for result in "${VALIDATOR_RESULTS[@]}"; do
295
- if echo "$result" | grep -qi "PASS"; then
296
- VALIDATOR_PASS_COUNT=$((VALIDATOR_PASS_COUNT + 1))
297
- fi
298
- done
299
-
300
- CONSENSUS_RATE=$(echo "scale=2; $VALIDATOR_PASS_COUNT / $VALIDATOR_TOTAL" | bc)
301
-
302
- # Mode-specific consensus thresholds
303
- case $MODE in
304
- "mvp") CONSENSUS_THRESHOLD="0.80" ;;
305
- "standard") CONSENSUS_THRESHOLD="0.90" ;;
306
- "enterprise") CONSENSUS_THRESHOLD="0.95" ;;
307
- esac
308
-
309
- # AUTONOMOUS PROGRESSION: Default to ITERATE, rarely ABORT
310
- if (( $(echo "$CONSENSUS_RATE >= $CONSENSUS_THRESHOLD" | bc -l) )); then
311
- echo "PROCEED - Consensus reached ($CONSENSUS_RATE >= $CONSENSUS_THRESHOLD)"
312
- # Immediately spawn next task if queued
313
- else
314
- echo "ITERATE - Consensus not met ($CONSENSUS_RATE < $CONSENSUS_THRESHOLD)"
315
- # Auto-continue to next iteration - DO NOT STOP
316
- # Loop back to Step 2 immediately
317
- fi
318
-
319
- # ABORT CONDITIONS (RARE - only use when truly unrecoverable):
320
- # - Fundamental architectural mismatch that RCA confirms cannot be fixed
321
- # - Security vulnerability that cannot be patched without full rewrite
322
- # - External dependency completely unavailable (API deprecated, package removed)
323
- #
324
- # DO NOT ABORT FOR:
325
- # - Test failures (iterate)
326
- # - Coverage gaps (iterate)
327
- # - Validator rejections (iterate with feedback)
328
- # - Performance issues (iterate with optimization)
215
+ **WAIT for Product Owner agent to return decision.**
216
+
217
+ **Handle Decision:**
218
+
219
+ ```
220
+ IF decision == "PROCEED":
221
+ Mark todo #5 completed
222
+ Report success: "Task complete. Out-of-scope items logged to backlog."
223
+ EXIT
224
+
225
+ IF decision == "ITERATE":
226
+ → Log: "PO requested iteration. In-scope issues: ${IN_SCOPE_FINDINGS}"
227
+ ITERATION = ITERATION + 1
228
+ → IF iteration > MAX_ITERATIONS: Report and EXIT
229
+ → Reset todos #2-#5 to pending
230
+ Include PO's iteration_guidance in next Loop 3 context
231
+ GO BACK TO PHASE 2
232
+
233
+ IF decision == "ABORT":
234
+ → Log: "PO aborted: ${REASONING}"
235
+ → Report failure with reasoning
236
+ EXIT
237
+ ```
238
+
239
+ **The Product Owner is the ONLY agent that can approve PROCEED or request ABORT.**
240
+
241
+ ---
242
+
243
+ ## Iteration Context Injection
244
+
245
+ **When iterating, include this context for Loop 3 agents:**
246
+
247
+ ```
248
+ PREVIOUS ITERATION FAILED:
249
+ - Iteration: ${ITERATION - 1}
250
+ - Gate pass rate: ${PASS_RATE}
251
+ - Validator feedback: ${FEEDBACK}
252
+ - Files with issues: ${PROBLEM_FILES}
253
+
254
+ FIX THESE SPECIFIC ISSUES before re-running tests.
255
+ ```
256
+
257
+ **After 3 failed iterations, spawn root-cause-analyst before next Loop 3:**
258
+ ```
259
+ Task(subagent_type="root-cause-analyst", prompt="Analyze repeated failures...")
329
260
  ```
330
261
 
331
262
  ---
332
263
 
333
- ## Validation Flow Summary
264
+ ## Quick Reference
334
265
 
335
- 1. **Loop 3 Gate:** Test pass rate must meet mode threshold before validators start
336
- 2. **Root Cause Analysis:** After 3 failed iterations, `root-cause-analyst` agent investigates blockers
337
- 3. **Loop 2 Validators:** Need access to Loop 3 outputs, tests, and logs
338
- 4. **Product Owner Decision:** Auto-progress; ABORT is rare (corruption/rollback only)
339
- 5. **Gate Failure:** Auto-iterate Loop 3 (max 10 iterations) - test regressions are NOT a stop condition
340
- 6. **Gate Pass:** Auto-proceed to validators
341
- 7. **Decision Outcomes:** PROCEED (done), ITERATE (auto-repeat), ABORT (rare - corruption/security only)
266
+ | Phase | What Happens | Next If Success | Next If Fail |
267
+ |-------|--------------|-----------------|--------------|
268
+ | 1. Parse | Initialize vars | Phase 2 | N/A |
269
+ | 2. Loop 3 | Implementation agents | Phase 3 | Retry |
270
+ | 3. Gate | Test pass rate check | Phase 4 | Phase 2 (iterate) |
271
+ | 4. Loop 2 | Validator agents | → Phase 5 | Retry |
272
+ | 5. PO | Scope filter + decision | EXIT (PROCEED) | Phase 2 (iterate) |
342
273
 
343
- **Stop conditions:** Corruption needing rollback, architectural mismatch requiring rewrite, security issues, external system failures. Test failures/regressions are handled by the loop.
274
+ **Product Owner Role:**
275
+ - Filters validator feedback into IN-SCOPE vs OUT-OF-SCOPE
276
+ - OUT-OF-SCOPE items go to backlog, don't block PROCEED
277
+ - Only IN-SCOPE issues can trigger ITERATE
278
+ - ABORT is rare (corruption, security, dead-end architecture)
344
279
 
345
280
  ---
346
281
 
347
- ## Related Documentation
282
+ ## Reminders
348
283
 
349
- - **Full Task Mode Guide**: `.claude/commands/cfn-loop/cfn-loop-task.md`
350
- - **CLI Mode Guide**: `.claude/commands/cfn-loop/cfn-loop-cli.md`
351
- - **Gate Check Implementation**: `.claude/skills/cfn-loop-orchestration-v2/lib/orchestrator/src/helpers/gate-check.ts`
284
+ - **DO NOT skip Gate Check** - Phase 3 is mandatory after every Loop 3
285
+ - **DO NOT spawn Loop 2 if gate failed** - Iterate Loop 3 instead
286
+ - **DO NOT skip Product Owner** - Only PO can approve PROCEED
287
+ - **DO NOT iterate on out-of-scope items** - PO filters these to backlog
288
+ - **DO NOT stop on test failures** - That's what iteration fixes
289
+ - **DO update todos** - This tracks your state as coordinator
290
+ - **DO pass validator feedback to PO** - PO needs full context to decide
291
+ - **DO inject PO guidance into next iteration** - Use iteration_guidance from PO
352
292
 
353
293
  ---
354
294
 
355
- **Version History:**
356
- - v1.4.0 (2025-12-25) - Hard cap 10 iterations for all modes; root cause analyst after 3 failures
357
- - v1.3.0 (2025-12-14) - Fixed to use test-based gate checks, not confidence scores
358
- - v1.2.0 (2025-12-08) - Added TDD enforcement
359
- - v1.1.0 (2025-12-01) - Added RuVector integration
295
+ **Version:** 2.0.0 | **Date:** 2026-01-09 | Restructured with enforced state tracking + Product Owner scope filtering
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow-novice",
3
- "version": "2.18.39",
3
+ "version": "2.18.40",
4
4
  "description": "Claude Flow Novice - Advanced orchestration platform for multi-agent AI workflows with CFN Loop architecture\n\nIncludes Local RuVector Accelerator and all CFN skills for complete functionality.",
5
5
  "main": "index.js",
6
6
  "type": "module",