claude-flow-novice 2.14.0 → 2.14.1

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 (86) hide show
  1. package/.claude/commands/cfn/README.md +177 -129
  2. package/.claude/commands/cfn/cfn-loop-cli.md +279 -0
  3. package/.claude/commands/cfn/cfn-loop-document.md +20 -1
  4. package/.claude/commands/cfn/cfn-loop-frontend.md +17 -2
  5. package/.claude/commands/cfn/cfn-loop-task.md +460 -0
  6. package/.claude/commands/cfn/context-curate.md +27 -38
  7. package/.claude/commands/cfn/context-inject.md +14 -25
  8. package/.claude/commands/cfn/context-query.md +40 -45
  9. package/.claude/commands/cfn/context-reflect.md +40 -38
  10. package/.claude/commands/cfn/context-stats.md +13 -38
  11. package/.claude/commands/cfn/launch-web-dashboard.md +0 -295
  12. package/.claude/commands/cfn/list-agents-rebuild.md +18 -18
  13. package/.claude/commands/cfn/write-plan.md +246 -75
  14. package/.claude/root-claude-distribute/CFN-CLAUDE.md +126 -233
  15. package/.claude/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
  16. package/.claude/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
  17. package/.claude/skills/cfn-changelog-management/bulk-import.sh +268 -0
  18. package/.claude/skills/cfn-changelog-management/lib/README.md +212 -0
  19. package/.claude/skills/cfn-changelog-management/lib/validation.sh +72 -0
  20. package/.claude/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
  21. package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +259 -0
  22. package/claude-assets/agents/cfn-dev-team/reviewers/reviewer.md +45 -6
  23. package/claude-assets/agents/cfn-dev-team/testers/tester.md +59 -0
  24. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +4 -4
  25. package/claude-assets/commands/cfn/auto-compact.md +80 -0
  26. package/claude-assets/commands/cfn/cfn-loop-epic.md +478 -0
  27. package/claude-assets/commands/cfn/cfn-loop-single.md +256 -0
  28. package/claude-assets/commands/cfn/cfn-loop-sprints.md +396 -0
  29. package/claude-assets/commands/cfn/cfn-loop.md +518 -0
  30. package/claude-assets/commands/cfn/claude-md.md +64 -0
  31. package/claude-assets/commands/cfn/claude-soul.md +22 -0
  32. package/claude-assets/commands/cfn/cost-savings-off.md +35 -0
  33. package/claude-assets/commands/cfn/cost-savings-on.md +35 -0
  34. package/claude-assets/commands/cfn/cost-savings-status.md +34 -0
  35. package/claude-assets/commands/cfn/custom-routing-activate.md +55 -0
  36. package/claude-assets/commands/cfn/custom-routing-deactivate.md +46 -0
  37. package/claude-assets/commands/cfn/dependency-recommendations.md +171 -0
  38. package/claude-assets/commands/cfn/fullstack.md +179 -0
  39. package/claude-assets/commands/cfn/github.md +221 -0
  40. package/claude-assets/commands/cfn/hooks.md +38 -0
  41. package/claude-assets/commands/cfn/metrics-summary.md +58 -0
  42. package/claude-assets/commands/cfn/neural.md +39 -0
  43. package/claude-assets/commands/cfn/parse-epic.md +357 -0
  44. package/claude-assets/commands/cfn/performance.md +41 -0
  45. package/claude-assets/commands/cfn/sparc.md +46 -0
  46. package/claude-assets/commands/cfn/suggest-improvements.md +95 -0
  47. package/claude-assets/commands/cfn/suggest-templates.md +147 -0
  48. package/claude-assets/commands/cfn/swarm.md +24 -0
  49. package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +126 -233
  50. package/claude-assets/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
  51. package/claude-assets/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
  52. package/claude-assets/skills/cfn-changelog-management/bulk-import.sh +268 -0
  53. package/claude-assets/skills/cfn-changelog-management/lib/README.md +212 -0
  54. package/claude-assets/skills/cfn-changelog-management/lib/validation.sh +72 -0
  55. package/claude-assets/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
  56. package/claude-assets/skills/cfn-task-config-init/SKILL.md +204 -0
  57. package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -0
  58. package/dist/cli/config-manager.js +109 -91
  59. package/dist/cli/config-manager.js.map +1 -1
  60. package/package.json +2 -2
  61. package/.claude/commands/README.md +0 -205
  62. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
  63. package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
  64. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
  65. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
  66. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
  67. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
  68. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
  69. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
  70. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
  71. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
  72. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
  73. package/.claude/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
  74. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
  75. package/claude-assets/skills/cfn-loop2-output-processing/execute-and-extract.sh.backup +0 -36
  76. package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
  77. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
  78. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
  79. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
  80. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
  81. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
  82. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
  83. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
  84. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
  85. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
  86. package/claude-assets/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
@@ -1,157 +1,205 @@
1
- # CLAUDE.md Slash Command System
1
+ # CFN Loop Commands - Quick Reference
2
2
 
3
- ## 🎯 Simple, Focused CLAUDE.md Generation
3
+ ## Workflows vs Skills vs Playbooks - When to Use What
4
4
 
5
- A lightweight slash command system for generating CLAUDE.md files with NPX protection.
5
+ ### Skills (Most Common) - Building Blocks
6
+ **What:** Single-purpose bash scripts in `.claude/skills/`
7
+ **When:** Most tasks - they're the building blocks
8
+ **Example:** `cfn-redis-coordination`, `cfn-agent-spawning`, `cfn-loop-validation`
6
9
 
7
- ## 📋 Features
8
-
9
- ### ✅ **Simple Slash Command**
10
10
  ```bash
11
- /claude-md # Generate CLAUDE.md for current project
12
- /claude-md --preview # Show what would be generated
13
- /claude-md --force # Overwrite without confirmation
14
- /claude-md --detect # Auto-detect project and show recommendations
15
- /claude-md --no-backup # Skip backup creation
11
+ # Direct skill invocation
12
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh enter \
13
+ --task-id "task-123" \
14
+ --agent-id "coder-1"
16
15
  ```
17
16
 
18
- ### 🛡️ **NPX Protection System**
19
- - **Problem**: NPX installs overwrite customized CLAUDE.md files
20
- - **Solution**: Generate `claude-copy-to-main.md` when existing CLAUDE.md detected
21
- - **Benefit**: User customizations are never lost
17
+ **Use skills when:**
18
+ - Single, focused operation needed
19
+ - Called by agents or coordinators
20
+ - Part of larger workflow
21
+ - Reusable across different tasks
22
+
23
+ ### Playbooks (Not Currently Used) - Pre-Configured Sequences
24
+ **What:** JSON files defining skill sequences for common patterns
25
+ **When:** Repeating the same skill sequence often
26
+ **Status:** Not implemented yet, use skills directly
27
+
28
+ ### Workflows - Complex Automation
29
+ **What:** Event-driven, multi-step automation with conditions/branching
30
+ **When:** Complex sequences with conditional logic
31
+ **Example:** CI/CD pipelines, feature development workflows
32
+
33
+ ```yaml
34
+ name: "feature-development"
35
+ trigger: "branch-created"
36
+ steps:
37
+ - name: "analyze"
38
+ agent: "researcher"
39
+
40
+ - name: "implement"
41
+ agent: "backend-dev"
42
+ depends: ["analyze"]
43
+ parallel: true # Multiple agents in parallel
44
+
45
+ - name: "test"
46
+ agent: "tester"
47
+ depends: ["implement"]
48
+ condition: "if tests_exist" # Conditional execution
49
+ ```
22
50
 
23
- ### 🔄 **Integration Flow**
51
+ **Use workflows when:**
52
+ - Event-driven automation (git hooks, CI/CD)
53
+ - Conditional branching logic needed
54
+ - Multi-agent parallel execution
55
+ - Long-running background processes
56
+ - Integration with external systems
24
57
 
25
- **Normal Usage (Slash Command):**
26
- 1. User runs `/claude-md`
27
- 2. System detects project type
28
- 3. Generates appropriate CLAUDE.md
29
- 4. Creates backup if file exists
58
+ ## Decision Tree
30
59
 
31
- **NPX Install Protection:**
32
- 1. NPX installs claude-flow-novice
33
- 2. `postinstall` script runs
34
- 3. Detects existing CLAUDE.md
35
- 4. Creates `claude-copy-to-main.md` instead
36
- 5. User manually merges desired changes
60
+ ```
61
+ Need to automate something?
62
+ ├─ Single operation?
63
+ │ └─ Use SKILL directly
64
+ ├─ Complex logic (conditionals, events, parallel)?
65
+ │ └─ Create WORKFLOW (YAML via /workflow)
66
+ └─ CFN Loop execution?
67
+ ├─ Planning first? → /write-plan then /cfn-loop-cli
68
+ ├─ Production? → /cfn-loop-cli
69
+ ├─ Debugging? → /cfn-loop-task
70
+ └─ Frontend? → /cfn-loop-frontend
71
+ ```
37
72
 
38
- ## 🏗️ Architecture
73
+ ## Examples
39
74
 
40
- ### **Files:**
41
- - `claude-md.js` - Core slash command implementation
42
- - `register-claude-md.js` - Slash command registration
43
- - `../npx/claude-md-protection.js` - NPX protection logic
44
- - `../../scripts/post-install-claude-md.js` - Post-install hook
75
+ ### Example 1: Simple Task (Use Skill)
76
+ **Goal:** Enter waiting mode for agent
45
77
 
46
- ### **Integration Points:**
47
- - **Existing Generator**: Uses `../language/claude-md-generator.js`
48
- - **Language Detection**: Uses `../language/language-detector.js`
49
- - **Preferences**: Reads `.claude-flow-novice/preferences/generation.json`
50
- - **Package.json**: `postinstall` script triggers protection
78
+ ```bash
79
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh enter \
80
+ --task-id "task-123" --agent-id "coder-1"
81
+ ```
51
82
 
52
- ## 🎮 Usage Examples
83
+ ### Example 2: CFN Loop Execution
84
+ **Goal:** Implement JWT authentication
53
85
 
54
- ### **Basic Generation:**
86
+ **Option 1: Plan First (Recommended for Complex Tasks)**
55
87
  ```bash
56
- # Generate CLAUDE.md for current project
57
- /claude-md
88
+ # Step 1: Generate plan
89
+ /write-plan "Implement JWT authentication" --mode=standard
90
+ # Reviews: planning/PLAN_jwt_authentication.md
58
91
 
59
- # Output:
60
- # 🚀 Generating CLAUDE.md...
61
- # ✅ CLAUDE.md generated successfully
92
+ # Step 2: Execute
93
+ /cfn-loop-cli "Implement JWT authentication" --mode=standard
62
94
  ```
63
95
 
64
- ### **Preview Mode:**
96
+ **Option 2: Direct Execution (Simple Tasks)**
65
97
  ```bash
66
- # See what would be generated
67
- /claude-md --preview
68
-
69
- # Output:
70
- # 📄 CLAUDE.md Preview:
71
- # ══════════════════════════════════════════════════
72
- # # Claude Code Configuration - JavaScript Project
73
- # ...
74
- # ══════════════════════════════════════════════════
75
- # 📊 Total length: 2,847 characters
98
+ # Production execution (cost-optimized)
99
+ /cfn-loop-cli "Implement JWT authentication" --mode=standard
100
+
101
+ # OR debugging (full visibility)
102
+ /cfn-loop-task "Implement JWT authentication" --mode=standard
76
103
  ```
77
104
 
78
- ### **NPX Protection:**
105
+ ### Example 3: Complex Automation (Use Workflow)
106
+ **Goal:** Full feature development (analyze → implement → test → deploy)
107
+
79
108
  ```bash
80
- # When NPX detects existing CLAUDE.md
81
- npm install claude-flow-novice
82
-
83
- # Output:
84
- # 🛡️ NPX Protection Activated
85
- # 📄 Generated: claude-copy-to-main.md
86
- # 💡 Your existing CLAUDE.md is protected from overwrite
87
- # 🔄 Review and merge changes manually as needed
88
- ```
109
+ # Create workflow (via /workflow)
110
+ /workflow create feature-pipeline
89
111
 
90
- ## 🧠 Smart Detection
91
-
92
- ### **Project Type Detection:**
93
- - Analyzes `package.json`, file patterns, and directory structure
94
- - Detects frameworks (React, Express, Django, etc.)
95
- - Suggests appropriate CLAUDE.md configurations
96
-
97
- ### **Confidence Levels:**
98
- - **High (>70%)**: Automatic generation recommended
99
- - **Medium (30-70%)**: Generate with user confirmation
100
- - **Low (<30%)**: Manual review suggested
101
-
102
- ## 🔧 Configuration
103
-
104
- ### **Generation Preferences:**
105
- `.claude-flow-novice/preferences/generation.json`:
106
- ```json
107
- {
108
- "autoGenerate": true,
109
- "includeFrameworkSpecific": true,
110
- "includeBestPractices": true,
111
- "backupExisting": true,
112
- "confidenceThreshold": 0.3
113
- }
112
+ # Execute workflow
113
+ /workflow execute feature-pipeline
114
114
  ```
115
115
 
116
- ### **NPX Detection:**
117
- - Environment variables (`NPX_INSTALL=true`)
118
- - Temporary directory patterns (`/.npm/_npx/`)
119
- - Package.json analysis (fresh installs)
120
-
121
- ## 🎯 Design Principles
122
-
123
- ### **Keep It Simple:**
124
- - Single focused command
125
- - Minimal configuration
126
- - Clear user feedback
127
- - No feature bloat
128
-
129
- ### **Protect User Work:**
130
- - Never overwrite without permission
131
- - Always offer backup options
132
- - Provide clear merge instructions
133
- - Preserve customizations
134
-
135
- ### **Smart Defaults:**
136
- - Auto-detect project type
137
- - Use appropriate templates
138
- - Respect user preferences
139
- - Fail safely
140
-
141
- ## 🚀 Future Enhancements
142
-
143
- ### **Potential Improvements (If Needed):**
144
- - Interactive confirmation prompts
145
- - Template customization options
146
- - Multi-project detection
147
- - Advanced merge assistance
148
-
149
- ### **Not Planned (Avoiding Bloat):**
150
- - SQLite analysis integration
151
- - Multi-file scaffolding
152
- - Complex workflow automation
153
- - Enterprise features
116
+ ## Quick Reference Table
117
+
118
+ | Type | Files | Complexity | Conditional Logic | Parallel Execution | Event-Driven |
119
+ |------|-------|------------|-------------------|-------------------|--------------|
120
+ | **Skill** | `.sh` scripts | Low | No | No | No |
121
+ | **CFN Loop** | Slash commands | Medium | Yes (built-in) | Yes (agents) | No |
122
+ | **Workflow** | `.yaml` definitions | High | Yes | Yes | Yes |
123
+
124
+ ---
125
+
126
+ ## CFN Loop Commands (Current)
127
+
128
+ ### Execution Commands
129
+ - `/cfn-loop-task` - Task mode (debugging, full visibility, Main Chat coordinates)
130
+ - `/cfn-loop-cli` - CLI mode (production, cost-optimized, coordinator spawns CLI agents)
131
+ - `/cfn-loop-frontend` - Visual iteration (screenshot + video validation, supports both modes)
132
+
133
+ ### Planning & Documentation
134
+ - `/write-plan` - Pre-planning phase (generates TDD implementation plan)
135
+ - `/cfn-loop-document` - Documentation generation (updates `/readme`)
136
+
137
+ ### Configuration
138
+ - `/cfn-mode` - Toggle CLI vs Task spawning mode
139
+ - `/cfn-optimize-agents` - Agent optimization settings
140
+ - `/cfn-claude-sync` - Sync rules from CLAUDE.md to commands
141
+
142
+ ### Infrastructure
143
+ - `/switch-api` - Switch between Z.ai and Anthropic providers
144
+
145
+ ### Automation
146
+ - `/workflow` - Event-driven workflow automation (complex multi-step)
147
+
148
+ ### Testing & Utilities
149
+ - `/hello-world-tests` - CFN coordination validation tests (4 layers)
150
+ - `/github-commit` - Git commit with CI/CD monitoring
151
+ - `/launch-web-dashboard` - Start web portal (http://localhost:3000)
152
+ - `/list-agents-rebuild` - Regenerate agent list from discovery
153
+
154
+ ### Adaptive Context (ACE System)
155
+ - `/context-stats` - View adaptive context statistics
156
+ - `/context-reflect` - Extract lessons from task execution
157
+ - `/context-query` - Query context bullets by category/tags
158
+ - `/context-inject` - Inject context into CLAUDE.md dynamically
159
+ - `/context-curate` - Merge reflection deltas with deduplication
160
+
161
+ ---
162
+
163
+ ## When to Use Each Command
164
+
165
+ ### /write-plan (Pre-Planning)
166
+ **Use before complex CFN Loop tasks:**
167
+ - Security-critical features
168
+ - Complex architecture decisions
169
+ - Team collaboration (plan review)
170
+ - Learning CFN Loop workflow
171
+
172
+ ### /cfn-loop-cli (Production)
173
+ **Use for:**
174
+ - Production features
175
+ - Long-running tasks (>10 min)
176
+ - Multi-iteration workflows
177
+ - Cost-sensitive projects
178
+ - **Cost:** $0.054/iteration with Z.ai routing
179
+
180
+ ### /cfn-loop-task (Debugging)
181
+ **Use for:**
182
+ - Debugging CFN Loop issues
183
+ - Learning agent interactions
184
+ - Prototyping configurations
185
+ - Short tasks (<5 min)
186
+ - **Cost:** $0.150/iteration (3x CLI, but full visibility)
187
+
188
+ ### /cfn-loop-frontend (Visual Iteration)
189
+ **Use for:**
190
+ - React/Vue/Angular components
191
+ - UI implementation with mockups
192
+ - Accessibility validation
193
+ - Visual regression testing
194
+ - **Supports:** Both CLI and Task modes
195
+
196
+ ### /workflow (Complex Automation)
197
+ **Use for:**
198
+ - CI/CD pipelines
199
+ - Event-driven automation
200
+ - Multi-step with conditionals
201
+ - External system integration
154
202
 
155
203
  ---
156
204
 
157
- **Simple, focused, and protective - exactly what CLAUDE.md generation should be!** 🎯
205
+ **Version:** 3.0.0 (2025-10-31) - Consolidated command structure with workflows/skills guide
@@ -0,0 +1,279 @@
1
+ ---
2
+ description: "Execute CFN Loop in CLI mode (production, cost-optimized, 95-98% savings)"
3
+ argument-hint: "<task description> [--mode=mvp|standard|enterprise] [--max-iterations=n]"
4
+ allowed-tools: ["Task", "TodoWrite", "Read", "Bash"]
5
+ ---
6
+
7
+ # CFN Loop CLI Mode - Production Execution
8
+
9
+ Execute CFN Loop using CLI spawning for maximum cost savings (95-98% vs Task tool).
10
+
11
+ 🚨 **CLI MODE: Production, Cost-Optimized, Background Execution**
12
+
13
+ **Task**: $ARGUMENTS
14
+
15
+ ## What is CLI Mode?
16
+
17
+ **CLI Mode Architecture:**
18
+ - Main Chat spawns **single coordinator agent** via Task()
19
+ - Coordinator spawns **all workers via CLI** (`npx claude-flow-novice`)
20
+ - CLI agents use **Z.ai custom routing** (when enabled)
21
+ - Background execution with **Redis monitoring**
22
+ - **95-98% cost savings** vs Task tool spawning
23
+
24
+ **Cost Breakdown:**
25
+ ```
26
+ ┌─────────────────────┬──────────────┬────────────┐
27
+ │ Component │ Provider │ Cost/Call │
28
+ ├─────────────────────┼──────────────┼────────────┤
29
+ │ Main Chat │ Anthropic │ $0.015 │
30
+ │ Coordinator (Task) │ Anthropic │ $0.015 │
31
+ │ Loop 3 Agents (CLI) │ Z.ai │ $0.003 ea │
32
+ │ Loop 2 Agents (CLI) │ Z.ai │ $0.003 ea │
33
+ │ Product Owner (CLI) │ Z.ai │ $0.003 │
34
+ └─────────────────────┴──────────────┴────────────┘
35
+
36
+ Total per iteration: ~$0.054 (vs $0.150 Task mode)
37
+ Savings: 64% with custom routing, 95-98% vs all-Task
38
+ ```
39
+
40
+ ## Prerequisites
41
+
42
+ **Enable Z.ai Custom Routing (One-Time Setup):**
43
+ ```bash
44
+ /switch-api zai
45
+ ```
46
+
47
+ **Verify Status:**
48
+ ```bash
49
+ /switch-api status
50
+ # Expected: Main Chat=Anthropic, Task=Anthropic, CLI=Z.ai
51
+ ```
52
+
53
+ ## Command Options
54
+
55
+ ```bash
56
+ # Standard mode (recommended)
57
+ /cfn-loop-cli "Implement JWT authentication"
58
+
59
+ # MVP mode (fast, lower quality gates)
60
+ /cfn-loop-cli "Build prototype feature" --mode=mvp
61
+
62
+ # Enterprise mode (high quality, more validators)
63
+ /cfn-loop-cli "Production security feature" --mode=enterprise --max-iterations=15
64
+ ```
65
+
66
+ **Options:**
67
+ - `--mode=<mvp|standard|enterprise>`: Quality mode (default: standard)
68
+ - `--max-iterations=<n>`: Max iterations per loop (default: 10)
69
+
70
+ ## Mode Comparison
71
+
72
+ | Mode | Gate | Consensus | Iterations | Validators | Use Case |
73
+ |------|------|-----------|------------|------------|----------|
74
+ | MVP | ≥0.70 | ≥0.80 | 5 | 2 | Prototypes, proof-of-concept |
75
+ | Standard | ≥0.75 | ≥0.90 | 10 | 3-4 | Production features |
76
+ | Enterprise | ≥0.85 | ≥0.95 | 15 | 5 | Security, compliance, critical systems |
77
+
78
+ ## 🚨 CRITICAL EXECUTION INSTRUCTIONS
79
+
80
+ **YOU ARE MAIN CHAT. YOU SPAWN ONLY ONE AGENT: cfn-v3-coordinator**
81
+
82
+ **DO NOT spawn Loop 3 agents (backend-dev, researcher, etc.)**
83
+ **DO NOT spawn Loop 2 agents (reviewer, tester, etc.)**
84
+ **DO NOT spawn product-owner**
85
+ **DO NOT ask user which agents to use**
86
+
87
+ The coordinator handles ALL agent spawning internally via CLI.
88
+
89
+ ---
90
+
91
+ ### Execute This Task() Call:
92
+
93
+ ```javascript
94
+ Task("cfn-v3-coordinator", `
95
+ CFN LOOP CLI MODE - PRODUCTION EXECUTION
96
+
97
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
98
+ TASK SPECIFICATION
99
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
100
+
101
+ Task Description: $ARGUMENTS
102
+ Task ID: cfn-cli-$(date +%s)
103
+ Mode: ${mode.toUpperCase()}
104
+
105
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
106
+ SUCCESS CRITERIA
107
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
108
+
109
+ Acceptance Criteria:
110
+ - [ ] Core functionality implemented
111
+ - [ ] All tests pass with >80% coverage
112
+ - [ ] Security review completed
113
+ - [ ] Documentation updated
114
+ - [ ] No regression in existing features
115
+
116
+ Quality Gates (${mode.toUpperCase()} MODE):
117
+ - Loop 3 Gate Threshold: ${mode === 'enterprise' ? 0.85 : mode === 'standard' ? 0.75 : 0.70}
118
+ - Loop 2 Consensus Threshold: ${mode === 'enterprise' ? 0.95 : mode === 'standard' ? 0.90 : 0.80}
119
+ - Max Iterations: ${maxIterations}
120
+
121
+ Definition of Done:
122
+ - Consensus ≥ threshold achieved
123
+ - All acceptance criteria met
124
+ - Product Owner approval received
125
+
126
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
127
+ ORCHESTRATION CONFIGURATION
128
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
129
+
130
+ Mode: ${mode.toUpperCase()}
131
+
132
+ Loop 3 Agents (Implementation) - SELECT BASED ON TASK:
133
+ Examples:
134
+ - Backend API: backend-dev, researcher, devops
135
+ - Full-Stack: backend-dev, react-frontend-engineer, devops
136
+ - Infrastructure: devops, rust-developer, researcher
137
+ - Security: security-specialist, backend-dev, researcher
138
+
139
+ Loop 2 Agents (Validation) - SCALE BY COMPLEXITY:
140
+ Simple (1-2 files): reviewer, tester
141
+ Standard (3-5 files): reviewer, tester, architect, security-specialist
142
+ Complex (>5 files): +code-analyzer, +performance-benchmarker
143
+
144
+ Product Owner: product-owner
145
+
146
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
147
+ EXECUTION INSTRUCTIONS
148
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
149
+
150
+ 1. INVOKE ORCHESTRATOR (CLI spawning):
151
+
152
+ TASK_ID="cfn-cli-$(date +%s)"
153
+ MODE="${mode}"
154
+ LOOP3_AGENTS="backend-dev,researcher,devops" # Customize for task
155
+ LOOP2_AGENTS="reviewer,tester,architect,security-specialist" # Scale by complexity
156
+
157
+ ./.claude/skills/cfn-loop-orchestration/orchestrate.sh \\
158
+ --task-id "$TASK_ID" \\
159
+ --mode "$MODE" \\
160
+ --loop3-agents "$LOOP3_AGENTS" \\
161
+ --loop2-agents "$LOOP2_AGENTS" \\
162
+ --product-owner "product-owner" \\
163
+ --max-iterations ${maxIterations}
164
+
165
+ 2. ORCHESTRATOR HANDLES:
166
+ - Spawns all agents via CLI (background)
167
+ - Loop 3: Gate check (≥threshold) → PASS/ITERATE
168
+ - Loop 2: Consensus check (≥threshold) → COMPLETE/ITERATE
169
+ - Product Owner: PROCEED/ITERATE/ABORT decision
170
+ - Git commit/push on PROCEED
171
+ - Returns structured result to Main Chat
172
+
173
+ 3. RETURN STRUCTURED RESULT:
174
+ {
175
+ "taskId": "cfn-cli-XXXXX",
176
+ "status": "complete|failed",
177
+ "iterations": {"loop3": N, "loop2": M},
178
+ "finalConsensus": 0.XX,
179
+ "acceptanceCriteria": {
180
+ "met": [...],
181
+ "pending": [...]
182
+ },
183
+ "deliverables": [...],
184
+ "recommendations": [...]
185
+ }
186
+
187
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
188
+ CRITICAL RULES
189
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
190
+
191
+ - DO NOT spawn agents with Task() - orchestrator uses CLI
192
+ - ALL agents run in background via npx claude-flow-novice
193
+ - USE Redis BLPOP for loop dependencies
194
+ - AGENTS use Z.ai routing automatically (when enabled)
195
+ - RETURN structured result when complete
196
+ `, "cfn-v3-coordinator")
197
+ ```
198
+
199
+ ## Autonomous Execution Rules
200
+
201
+ **YOU ARE FORBIDDEN FROM:**
202
+ - ❌ Asking "Should I retry?" (coordinator handles automatically)
203
+ - ❌ Asking "Proceed to consensus?" (orchestrator decides)
204
+ - ❌ Waiting for approval during CFN Loop cycles
205
+ - ❌ Spawning workers with Task() (use coordinator only)
206
+
207
+ **YOU MUST:**
208
+ - ✅ ALWAYS spawn single coordinator agent
209
+ - ✅ LET coordinator invoke orchestrator internally
210
+ - ✅ COORDINATOR handles all loop execution autonomously
211
+ - ✅ ONLY return to chat when complete or blocked
212
+
213
+ ## CLI Mode Benefits
214
+
215
+ **Cost Savings:**
216
+ - 64% savings with Z.ai routing vs all-Anthropic
217
+ - 95-98% savings vs Task tool spawning
218
+ - Scales linearly with iterations (Task mode scales exponentially)
219
+
220
+ **Production Features:**
221
+ - Background execution (no timeout issues)
222
+ - Redis state persistence (crash recovery)
223
+ - Zero-token waiting (BLPOP blocks without API calls)
224
+ - Web portal visibility (http://localhost:3000)
225
+
226
+ **Performance:**
227
+ - Parallel agent spawning (no sequential bottleneck)
228
+ - Instant wake-up (<100ms latency)
229
+ - Scalable (10+ agents, indefinite cycles)
230
+
231
+ ## When to Use CLI Mode
232
+
233
+ **Use CLI Mode for:**
234
+ - ✅ Production features
235
+ - ✅ Long-running tasks (>10 min)
236
+ - ✅ Multi-iteration workflows
237
+ - ✅ Cost-sensitive projects
238
+ - ✅ Background execution
239
+
240
+ **Use Task Mode for:**
241
+ - Debugging (full visibility needed)
242
+ - Learning CFN Loop workflow
243
+ - Short prototypes (<5 min)
244
+ - Single-iteration tasks
245
+
246
+ ## Troubleshooting
247
+
248
+ **Custom routing not working:**
249
+ ```bash
250
+ /switch-api status # Check current provider
251
+ /switch-api zai # Enable Z.ai routing
252
+ ```
253
+
254
+ **Coordinator timeout:**
255
+ - Expected for long tasks (>10 min)
256
+ - Check web portal for progress: http://localhost:3000
257
+ - Query Redis: `redis-cli HGETALL "cfn_loop:task:$TASK_ID:context"`
258
+
259
+ **No deliverables created:**
260
+ - Orchestrator validates deliverables before PROCEED
261
+ - Will force ITERATE if git diff shows zero changes
262
+ - Check coordinator output for validation failures
263
+
264
+ ## Related Commands
265
+
266
+ - **Task Mode**: `/cfn-loop-task` (debugging, full visibility)
267
+ - **Frontend**: `/cfn-loop-frontend` (visual iteration workflow)
268
+ - **Documentation**: `/cfn-loop-document` (generate docs)
269
+
270
+ ## Related Documentation
271
+
272
+ - Task Mode Guide: `.claude/commands/cfn/CFN_LOOP_TASK_MODE.md`
273
+ - Coordinator Parameters: `.claude/commands/cfn/CFN_COORDINATOR_PARAMETERS.md`
274
+ - Redis Coordination: `.claude/skills/cfn-redis-coordination/SKILL.md`
275
+ - Orchestration: `.claude/skills/cfn-loop-orchestration/SKILL.md`
276
+
277
+ ---
278
+
279
+ **Version:** 1.0.0 (2025-10-31) - CLI mode: production execution, cost-optimized, background processing
@@ -398,13 +398,32 @@ Validating documentation...
398
398
  Documentation update complete.
399
399
  ```
400
400
 
401
+ ## CFN Loop Command Structure (v3.0)
402
+
403
+ **Current Commands (as of 2025-10-31):**
404
+ 1. `/cfn-loop-task` - Task mode (debugging, full visibility)
405
+ 2. `/cfn-loop-cli` - CLI mode (production, cost-optimized)
406
+ 3. `/cfn-loop-frontend` - Visual iteration (screenshot + video validation)
407
+ 4. `/cfn-loop-document` - Documentation generation (this command)
408
+
409
+ **Removed Commands (deprecated 2025-10-31):**
410
+ - ❌ `/cfn-loop` (replaced by `/cfn-loop-cli` or `/cfn-loop-task`)
411
+ - ❌ `/cfn-loop-single` (replaced by `/cfn-loop-cli`)
412
+ - ❌ `/cfn-loop-epic` (use multiple `/cfn-loop-cli` executions)
413
+ - ❌ `/cfn-loop-sprints` (use `/cfn-loop-cli` per sprint)
414
+
415
+ **When documenting CFN Loop features:**
416
+ - Reference correct command names (task/cli/frontend/document)
417
+ - Update examples to use new commands
418
+ - Mark deprecated commands clearly in changelog
419
+ - Maintain backward compatibility notes
420
+
401
421
  ## Integration with CFN Loop
402
422
 
403
423
  ### Auto-Trigger Conditions
404
424
  ```javascript
405
425
  // Automatically trigger documentation after:
406
426
  if (
407
- epicComplete || // Epic completion
408
427
  sprintComplete || // Sprint completion
409
428
  majorPhaseComplete || // Major phase completion
410
429
  newSlashCommandAdded || // New slash command
@@ -94,7 +94,7 @@ npm install -D @playwright/test
94
94
 
95
95
  ## Execution Pattern
96
96
 
97
- ### Step 1: Parse Command Arguments
97
+ ### Step 1: Parse Command Arguments & Determine Mode
98
98
 
99
99
  ```javascript
100
100
  const params = {
@@ -107,9 +107,24 @@ const params = {
107
107
  };
108
108
 
109
109
  console.log(`Frontend CFN Loop: ${params.mode} mode, ${params.spawnMode} spawning`);
110
+
111
+ // MODE DETECTION: Inject mode-specific instructions
112
+ if (params.spawnMode === 'cli') {
113
+ console.log('━━━ CLI MODE INSTRUCTIONS ━━━');
114
+ console.log('Main Chat spawns ONLY cfn-frontend-coordinator');
115
+ console.log('Coordinator handles all visual iteration internally');
116
+ console.log('CLI agents use Z.ai routing (when enabled)');
117
+ console.log('Background execution with Redis monitoring');
118
+ } else {
119
+ console.log('━━━ TASK MODE INSTRUCTIONS ━━━');
120
+ console.log('Main Chat coordinates entire visual iteration workflow');
121
+ console.log('NO coordinator agent spawned');
122
+ console.log('Main Chat spawns all agents via Task()');
123
+ console.log('Full visibility in Main Chat');
124
+ }
110
125
  ```
111
126
 
112
- ### Step 2: Mode Selection
127
+ ### Step 2: Execute Based on Mode
113
128
 
114
129
  #### CLI Mode (Default) - Spawn Frontend Coordinator
115
130