claude-flow-novice 2.4.1 → 2.4.3
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.
- package/.claude/agents/core-agents/coordinator-hybrid.md +2 -2
- package/.claude/agents/core-agents/coordinator.md +2 -2
- package/.claude/agents/examples/blocking-coordinator-example.md +2 -2
- package/.claude/agents-ignore/cfn-coordinator-enterprise.md +2 -2
- package/.claude/agents-ignore/cfn-coordinator-mvp.md +2 -2
- package/.claude/agents-ignore/cfn-coordinator-standard.md +2 -2
- package/.claude/cfn-mode-patterns.md +9 -9
- package/.claude/commands/cost-savings-off.md +1 -1
- package/.claude/commands/cost-savings-on.md +2 -2
- package/.claude/commands/cost-savings-status.md +1 -1
- package/.claude/commands/launch-web-dashboard.md +1 -1
- package/.claude/commands/list-agents-rebuild.md +6 -6
- package/.claude/coordinator-feedback-pattern.md +1 -1
- package/.claude/templates/agent-optimization-plan.md +1 -1
- package/CLAUDE.md +346 -0
- package/SYNC_USAGE.md +14 -0
- package/package.json +17 -3
|
@@ -35,7 +35,7 @@ lifecycle:
|
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
# Spawn workers with explicit typed agents
|
|
38
|
-
|
|
38
|
+
npx claude-flow-spawn \
|
|
39
39
|
"Implement authentication system" \
|
|
40
40
|
--agents=coder,security-specialist,coder \
|
|
41
41
|
--provider zai --redis-channel swarm:auth
|
|
@@ -111,7 +111,7 @@ const tasks = decomposePhase(phaseObjective);
|
|
|
111
111
|
const agentTypes = tasks.map(t => t.agentType).join(',');
|
|
112
112
|
|
|
113
113
|
await Bash(`
|
|
114
|
-
|
|
114
|
+
npx claude-flow-spawn
|
|
115
115
|
"${taskDescription}"
|
|
116
116
|
--agents=${agentTypes}
|
|
117
117
|
--provider zai
|
|
@@ -63,7 +63,7 @@ You are a senior project management and orchestration expert specializing in com
|
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
# ✅ CORRECT: Production CLI spawning
|
|
66
|
-
|
|
66
|
+
npx claude-flow-spawn \
|
|
67
67
|
"Remove forbidden patterns from /readme docs" \
|
|
68
68
|
--agents=coder,coder,coder \
|
|
69
69
|
--provider zai --redis-channel swarm:doc-cleanup
|
|
@@ -85,7 +85,7 @@ Remove forbidden patterns from documentation:
|
|
|
85
85
|
`;
|
|
86
86
|
|
|
87
87
|
// 3. Delegate via CLI
|
|
88
|
-
await Bash(`
|
|
88
|
+
await Bash(`npx claude-flow-spawn "${taskDescription}" --max-agents 3 --provider zai`);
|
|
89
89
|
|
|
90
90
|
// 4. Monitor via Redis
|
|
91
91
|
const results = await monitorRedisCompletions("swarm:*:complete", 3);
|
|
@@ -663,10 +663,10 @@ See `scripts/validate-agent-hooks.js` for hook validation:
|
|
|
663
663
|
|
|
664
664
|
```bash
|
|
665
665
|
# Validate all agent profiles
|
|
666
|
-
|
|
666
|
+
npx claude-flow-validate-hooks --all
|
|
667
667
|
|
|
668
668
|
# Validate specific profile
|
|
669
|
-
|
|
669
|
+
npx claude-flow-validate-hooks .claude/agents/examples/blocking-coordinator-example.md
|
|
670
670
|
```
|
|
671
671
|
|
|
672
672
|
## Debugging Hooks
|
|
@@ -105,13 +105,13 @@ Each phase follows the complete Loop 1 pattern:
|
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
107
|
# Enterprise worker spawning with comprehensive validation (REQUIRED: --agents flag with explicit types)
|
|
108
|
-
|
|
108
|
+
npx claude-flow-spawn \
|
|
109
109
|
"Implement [feature] for Enterprise: production-ready, security-hardened, compliance-validated" \
|
|
110
110
|
--agents=analyst,architect,coder,coder,security-specialist,tester,reviewer,compliance-specialist \
|
|
111
111
|
--provider zai --redis-channel swarm:enterprise-phase
|
|
112
112
|
|
|
113
113
|
# Mission-critical spawning with security focus
|
|
114
|
-
|
|
114
|
+
npx claude-flow-spawn \
|
|
115
115
|
"Build Enterprise version of [component] with zero-defect tolerance, compliance validation" \
|
|
116
116
|
--agents=analyst,coder,coder,security-specialist,tester,reviewer \
|
|
117
117
|
--provider zai --redis-channel swarm:enterprise-phase \
|
|
@@ -101,13 +101,13 @@ Each phase follows the complete Loop 1 pattern:
|
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
103
|
# Basic MVP worker spawning (REQUIRED: --agents flag with explicit types)
|
|
104
|
-
|
|
104
|
+
npx claude-flow-spawn \
|
|
105
105
|
"Implement [feature] for MVP: rapid development focus on core functionality" \
|
|
106
106
|
--agents=coder,coder,tester \
|
|
107
107
|
--provider zai --redis-channel swarm:mvp-phase
|
|
108
108
|
|
|
109
109
|
# Cost-optimized spawning (MVP priority)
|
|
110
|
-
|
|
110
|
+
npx claude-flow-spawn \
|
|
111
111
|
"Build MVP version of [component] with essential features only" \
|
|
112
112
|
--agents=coder,coder \
|
|
113
113
|
--provider zai --redis-channel swarm:mvp-phase \
|
|
@@ -101,13 +101,13 @@ Each phase follows the complete Loop 1 pattern:
|
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
103
|
# Standard worker spawning with comprehensive testing (REQUIRED: --agents flag with explicit types)
|
|
104
|
-
|
|
104
|
+
npx claude-flow-spawn \
|
|
105
105
|
"Implement [feature] for Standard: comprehensive testing, edge cases, documentation" \
|
|
106
106
|
--agents=analyst,coder,coder,tester,reviewer \
|
|
107
107
|
--provider zai --redis-channel swarm:standard-phase
|
|
108
108
|
|
|
109
109
|
# Quality-focused spawning
|
|
110
|
-
|
|
110
|
+
npx claude-flow-spawn \
|
|
111
111
|
"Build Standard version of [component] with full test suite and documentation" \
|
|
112
112
|
--agents=coder,coder,tester,reviewer \
|
|
113
113
|
--provider zai --redis-channel swarm:standard-phase \
|
|
@@ -53,7 +53,7 @@ swarm:cfn:mvp:${PHASE_ID}:loop3:complete
|
|
|
53
53
|
|
|
54
54
|
**Worker Spawn:**
|
|
55
55
|
```bash
|
|
56
|
-
|
|
56
|
+
npx claude-flow-spawn \
|
|
57
57
|
"Implement [feature] for MVP - core functionality only" \
|
|
58
58
|
--agents=coder,tester \
|
|
59
59
|
--topology=sequential \
|
|
@@ -86,7 +86,7 @@ swarm:cfn:standard:${PHASE_ID}:loop3:complete
|
|
|
86
86
|
|
|
87
87
|
**Worker Spawn:**
|
|
88
88
|
```bash
|
|
89
|
-
|
|
89
|
+
npx claude-flow-spawn \
|
|
90
90
|
"Implement [feature] with balanced quality and speed" \
|
|
91
91
|
--agents=architect,coder,coder,tester \
|
|
92
92
|
--topology=collaborative \
|
|
@@ -120,7 +120,7 @@ swarm:cfn:enterprise:${PHASE_ID}:loop3:complete
|
|
|
120
120
|
|
|
121
121
|
**Worker Spawn:**
|
|
122
122
|
```bash
|
|
123
|
-
|
|
123
|
+
npx claude-flow-spawn \
|
|
124
124
|
"Implement [feature] with enterprise quality standards" \
|
|
125
125
|
--agents=architect,architect,coder,coder,coder,tester,security-specialist,perf-analyzer \
|
|
126
126
|
--topology=release-gate \
|
|
@@ -157,7 +157,7 @@ swarm:cfn:mvp:${PHASE_ID}:loop2:complete
|
|
|
157
157
|
|
|
158
158
|
**Validator Spawn:**
|
|
159
159
|
```bash
|
|
160
|
-
|
|
160
|
+
npx claude-flow-spawn \
|
|
161
161
|
"Validate MVP implementation - focus on core functionality" \
|
|
162
162
|
--agents=code-quality-validator,security-specialist \
|
|
163
163
|
--topology=sequential \
|
|
@@ -192,7 +192,7 @@ swarm:cfn:standard:${PHASE_ID}:loop2:complete
|
|
|
192
192
|
|
|
193
193
|
**Validator Spawn:**
|
|
194
194
|
```bash
|
|
195
|
-
|
|
195
|
+
npx claude-flow-spawn \
|
|
196
196
|
"Validate standard implementation - comprehensive review" \
|
|
197
197
|
--agents=code-quality-validator,security-specialist,perf-analyzer,interaction-tester \
|
|
198
198
|
--topology=collaborative \
|
|
@@ -227,7 +227,7 @@ swarm:cfn:enterprise:${PHASE_ID}:loop2:complete
|
|
|
227
227
|
|
|
228
228
|
**Validator Spawn:**
|
|
229
229
|
```bash
|
|
230
|
-
|
|
230
|
+
npx claude-flow-spawn \
|
|
231
231
|
"Validate enterprise implementation - full compliance audit" \
|
|
232
232
|
--agents=code-quality-validator,security-specialist,perf-analyzer,interaction-tester,compliance-auditor \
|
|
233
233
|
--topology=release-gate \
|
|
@@ -455,7 +455,7 @@ Total: $4.00-$6.50 per phase
|
|
|
455
455
|
/cfn-loop "Add user registration endpoint" --mode=mvp
|
|
456
456
|
|
|
457
457
|
# Coordinator spawns workers
|
|
458
|
-
|
|
458
|
+
npx claude-flow-spawn \
|
|
459
459
|
"Implement user registration endpoint - core functionality only" \
|
|
460
460
|
--agents=coder,tester \
|
|
461
461
|
--topology=sequential \
|
|
@@ -473,7 +473,7 @@ node src/cli/hybrid-routing/spawn-workers.js \
|
|
|
473
473
|
/cfn-loop "Implement payment processing system" --mode=standard
|
|
474
474
|
|
|
475
475
|
# Coordinator spawns workers
|
|
476
|
-
|
|
476
|
+
npx claude-flow-spawn \
|
|
477
477
|
"Implement payment processing system with balanced quality and speed" \
|
|
478
478
|
--agents=architect,coder,coder,tester \
|
|
479
479
|
--topology=collaborative \
|
|
@@ -491,7 +491,7 @@ node src/cli/hybrid-routing/spawn-workers.js \
|
|
|
491
491
|
/cfn-loop "Deploy HIPAA-compliant patient data API" --mode=enterprise
|
|
492
492
|
|
|
493
493
|
# Coordinator spawns workers
|
|
494
|
-
|
|
494
|
+
npx claude-flow-spawn \
|
|
495
495
|
"Implement HIPAA-compliant patient data API with enterprise quality standards" \
|
|
496
496
|
--agents=architect,architect,coder,coder,coder,tester,security-specialist,perf-analyzer \
|
|
497
497
|
--topology=release-gate \
|
|
@@ -18,14 +18,14 @@ Enable cost-savings mode to use CLI-based agent spawning with spawn-workers.js f
|
|
|
18
18
|
**Mode Details:**
|
|
19
19
|
- **Coordinator**: Runs in main chat (Claude Max, $0)
|
|
20
20
|
- **Workers**: Spawned via CLI with z.ai provider
|
|
21
|
-
- **Spawning**: Uses `
|
|
21
|
+
- **Spawning**: Uses `npx claude-flow-spawn --agents=type1,type2 --provider zai`
|
|
22
22
|
- **Coordination**: Redis pub/sub messaging
|
|
23
23
|
- **State**: SQLite persistence with ACL
|
|
24
24
|
|
|
25
25
|
**Execute mode toggle:**
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
|
|
28
|
+
npx claude-flow-cost-savings on
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
**After enabling:**
|
|
@@ -243,7 +243,7 @@ npm run build
|
|
|
243
243
|
/launch-web-dashboard
|
|
244
244
|
|
|
245
245
|
# Spawn workers (dashboard monitors them)
|
|
246
|
-
|
|
246
|
+
npx claude-flow-spawn "Task" --max-agents 5
|
|
247
247
|
```
|
|
248
248
|
|
|
249
249
|
### With Swarm Coordination
|
|
@@ -34,7 +34,7 @@ Regenerate `src/cli/hybrid-routing/AVAILABLE-AGENTS.md` from live agent discover
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
# Regenerate agent list
|
|
37
|
-
|
|
37
|
+
npx claude-flow-spawn --agents-by-category > src/cli/hybrid-routing/AVAILABLE-AGENTS.md.tmp
|
|
38
38
|
|
|
39
39
|
# Parse and format into markdown document
|
|
40
40
|
node << 'EOF'
|
|
@@ -126,9 +126,9 @@ markdown += '## Usage\n\n';
|
|
|
126
126
|
markdown += '### CLI Commands\n\n';
|
|
127
127
|
markdown += '```bash\n';
|
|
128
128
|
markdown += '# List all agents (flat view)\n';
|
|
129
|
-
markdown += '
|
|
129
|
+
markdown += 'npx claude-flow-spawn --list-agents\n\n';
|
|
130
130
|
markdown += '# List agents by category\n';
|
|
131
|
-
markdown += '
|
|
131
|
+
markdown += 'npx claude-flow-spawn --agents-by-category\n\n';
|
|
132
132
|
markdown += '# Regenerate this documentation file\n';
|
|
133
133
|
markdown += '/list-agents-rebuild\n';
|
|
134
134
|
markdown += '```\n\n';
|
|
@@ -136,12 +136,12 @@ markdown += '```\n\n';
|
|
|
136
136
|
markdown += '### Coordinator Usage\n\n';
|
|
137
137
|
markdown += '```bash\n';
|
|
138
138
|
markdown += '# Automatic selection (keyword-based)\n';
|
|
139
|
-
markdown += '
|
|
139
|
+
markdown += 'npx claude-flow-spawn "Build auth" --max-agents=3\n\n';
|
|
140
140
|
markdown += '# Coordinator override (manual agent types)\n';
|
|
141
|
-
markdown += '
|
|
141
|
+
markdown += 'npx claude-flow-spawn "Task" \\\n';
|
|
142
142
|
markdown += ' --agents=architect,coder,tester\n\n';
|
|
143
143
|
markdown += '# Full override (custom agents + subtasks)\n';
|
|
144
|
-
markdown += '
|
|
144
|
+
markdown += 'npx claude-flow-spawn "Task" \\\n';
|
|
145
145
|
markdown += ' --agents=coder,security-specialist \\\n';
|
|
146
146
|
markdown += ' --subtasks="Subtask 1|Subtask 2"\n';
|
|
147
147
|
markdown += '```\n\n';
|
|
@@ -180,7 +180,7 @@ Add feedback monitoring right after worker spawning:
|
|
|
180
180
|
(... feedback monitor code ...)
|
|
181
181
|
|
|
182
182
|
# Step 2: Spawn workers
|
|
183
|
-
|
|
183
|
+
npx claude-flow-spawn ...
|
|
184
184
|
|
|
185
185
|
# Step 3: Monitor workers AND feedback simultaneously
|
|
186
186
|
while [ $(redis-cli llen "swarm:cfn:${MODE}:${PHASE_ID}:loop3:complete") -eq 0 ]; do
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# Claude Flow Novice — AI Agent Orchestration
|
|
2
|
+
|
|
3
|
+
**🚀 Production Status:** Redis coordination system fully deployed (Phase 7 - 2025-10-17)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1) Critical Rules (Single Source of Truth)
|
|
8
|
+
|
|
9
|
+
**Main Chat Role (Thin Orchestration Layer):**
|
|
10
|
+
* Main chat does ONLY: minimal investigation → determine task type → spawn coordinator + agents in single message → wait for results
|
|
11
|
+
* ALL coordination happens via Redis between coordinator and agents
|
|
12
|
+
* Main chat does NOT orchestrate agents directly - coordinator handles all agent coordination
|
|
13
|
+
* Agents communicate via Redis pub/sub with explicit dependencies (see `.claude/redis-agent-dependencies.md`)
|
|
14
|
+
|
|
15
|
+
**Core Principles:**
|
|
16
|
+
* Use agents for all non-trivial work (≥3 steps or multi-file/research/testing/architecture/security)
|
|
17
|
+
* **PRIMARY COORDINATOR: Use coordinator-hybrid for all multi-agent coordination** (cost-optimized CLI spawning with typed agents)
|
|
18
|
+
* Initialize swarm before multi-agent work
|
|
19
|
+
* Batch operations: spawn ALL agents (coordinator + workers) in single message
|
|
20
|
+
* Run post-edit hook after every file edit
|
|
21
|
+
* **REQUIRED: All CLI agent spawning must use explicit --agents flag with typed agents**
|
|
22
|
+
* **Context continuity:** Redis/SQLite persistence enables unlimited continuation — never stop due to context/token concerns
|
|
23
|
+
|
|
24
|
+
**Prohibited Patterns:**
|
|
25
|
+
* Main chat orchestrating agents directly — spawn coordinator to handle orchestration
|
|
26
|
+
* Spawning agents across multiple messages — use single message for coordinator + all agents
|
|
27
|
+
* Working solo on multi-step tasks — spawn parallel specialists via coordinator-hybrid
|
|
28
|
+
* Using generic "coordinator" fallback when coordinator-hybrid available
|
|
29
|
+
* Spawning agents without explicit --agents flag (must specify types from AVAILABLE-AGENTS.md)
|
|
30
|
+
* Agent coordination without Redis pub/sub messaging — ALL agents must use Redis
|
|
31
|
+
* Running tests inside agents — coordinator runs tests ONCE; workers read cached results from test-results.json
|
|
32
|
+
* Concurrent test runs — terminate previous runs first
|
|
33
|
+
* **Saving to project root — check `.artifacts/logs/post-edit-pipeline.log` after writes; move files if ROOT_WARNING**
|
|
34
|
+
* Creating guides/summaries/reports unless explicitly asked
|
|
35
|
+
* Asking permission to retry/advance when criteria/iterations allow — **relaunch agents immediately when consensus <threshold and iterations <max**
|
|
36
|
+
* Stopping work due to context/token concerns — Redis/SQLite persistence handles continuation automatically
|
|
37
|
+
|
|
38
|
+
**Communication:**
|
|
39
|
+
* Use spartan language
|
|
40
|
+
* Redis persistence enables swarm recovery — state survives interruptions
|
|
41
|
+
* ALL agent communication MUST use Redis pub/sub — no direct file coordination
|
|
42
|
+
|
|
43
|
+
**Consensus thresholds** (mode-dependent)
|
|
44
|
+
|
|
45
|
+
* Standard mode: Gate ≥0.75 • Consensus ≥0.90 • 4 validators • single PO
|
|
46
|
+
* MVP mode: Gate ≥0.65 • Consensus ≥0.85 • 2 validators • single PO
|
|
47
|
+
* Enterprise mode: Gate ≥0.85 • Consensus ≥0.95 • 5 validators • 4-person board • Loop 0.5 planning
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2) When Agents Are Mandatory (Triggers)
|
|
52
|
+
|
|
53
|
+
If **any** apply, spawn coordinator-hybrid (which spawns typed specialist agents):
|
|
54
|
+
|
|
55
|
+
* > 3 distinct steps • multiple files • research+implement+test • design decisions • code review/quality • security/performance/compliance • system integration • docs generation • refactor/optimize • any feature work
|
|
56
|
+
|
|
57
|
+
**Coordinator Selection Priority:**
|
|
58
|
+
1. **coordinator-hybrid** (PRIMARY) - All multi-agent work, CLI spawning with --agents flag, cost-optimized ($0 coordinator + $0.50 workers)
|
|
59
|
+
2. **adaptive-coordinator** - Only for 8+ agents with dynamic topology switching
|
|
60
|
+
3. **coordinator** - FALLBACK ONLY when specialized coordinators unavailable
|
|
61
|
+
|
|
62
|
+
**Required Spawning Pattern:**
|
|
63
|
+
```bash
|
|
64
|
+
# ✅ CORRECT: Explicit typed agents
|
|
65
|
+
node src/cli/hybrid-routing/spawn-workers.js \
|
|
66
|
+
"Task description" \
|
|
67
|
+
--agents=analyst,architect,coder \
|
|
68
|
+
--provider zai
|
|
69
|
+
|
|
70
|
+
# ❌ WRONG: Missing --agents flag (will error)
|
|
71
|
+
node src/cli/hybrid-routing/spawn-workers.js "Task description" --max-agents 3
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 3) Execution Patterns
|
|
77
|
+
|
|
78
|
+
### 3.1 Swarm Init → Spawn (Single Message)
|
|
79
|
+
|
|
80
|
+
**Swarm Init Pattern: ONCE per phase, not per round**
|
|
81
|
+
```bash
|
|
82
|
+
# Phase-level initialization (persistent through all loops)
|
|
83
|
+
executeSwarm({
|
|
84
|
+
swarmId: "phase-0-mcp-less-foundation",
|
|
85
|
+
objective: "Phase 0: MCP-Less Foundation",
|
|
86
|
+
strategy: "development",
|
|
87
|
+
mode: "mesh",
|
|
88
|
+
persistence: true
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Redis-backed Swarm Execution**:
|
|
93
|
+
```bash
|
|
94
|
+
npx claude-flow-novice swarm "Create REST API with authentication" --strategy development --max-agents 3
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Topology**: mesh (2–7), hierarchical (8+)
|
|
98
|
+
|
|
99
|
+
### 3.2 Post-Edit Hook (Mandatory)
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
node config/hooks/post-edit-pipeline.js "[FILE]" --memory-key "swarm/[agent]/[step]"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Hook runs automatically after Edit/Write/MultiEdit** but output is NOT captured by default.
|
|
106
|
+
|
|
107
|
+
**Root Directory Warnings:**
|
|
108
|
+
If file created in root, hook returns `status: "ROOT_WARNING"` with `rootWarning.suggestions[]`. Agent MUST:
|
|
109
|
+
1. Check log file: `.artifacts/logs/post-edit-pipeline.log` (last entry)
|
|
110
|
+
2. If `status: "ROOT_WARNING"`, move file to suggested location
|
|
111
|
+
3. Common suggestions: `src/`, `docs/`, `config/`, `tests/`, `scripts/`
|
|
112
|
+
|
|
113
|
+
**Example Response:**
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"status": "ROOT_WARNING",
|
|
117
|
+
"rootWarning": {
|
|
118
|
+
"suggestions": [
|
|
119
|
+
{"location": "src/example.js", "reason": "Source code directory"},
|
|
120
|
+
{"location": "docs/example.md", "reason": "Documentation directory"}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 3.3 Safe Test Execution
|
|
127
|
+
|
|
128
|
+
**Pattern: Coordinator runs tests ONCE before spawning workers**
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# 1. Coordinator terminates any existing test runs
|
|
132
|
+
pkill -f vitest; pkill -f "npm test"
|
|
133
|
+
|
|
134
|
+
# 2. Coordinator runs tests once and caches results
|
|
135
|
+
npm test -- --run --reporter=json > test-results.json 2>&1
|
|
136
|
+
|
|
137
|
+
# 3. Workers read cached results only (no test execution)
|
|
138
|
+
cat test-results.json
|
|
139
|
+
|
|
140
|
+
# 4. Cleanup after all work complete
|
|
141
|
+
pkill -f vitest; pkill -f "npm test"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Rules:**
|
|
145
|
+
* Coordinator executes tests before worker spawn
|
|
146
|
+
* Workers ONLY read test-results.json (never run tests)
|
|
147
|
+
* Single test execution prevents concurrent run conflicts
|
|
148
|
+
* Cache results in test-results.json for worker consumption
|
|
149
|
+
|
|
150
|
+
### 3.4 Batching (One message = all related ops)
|
|
151
|
+
|
|
152
|
+
* Spawn all agents with Task tool in one message
|
|
153
|
+
* Batch file ops, bash, todos, memory ops
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 4) CFN Loop Overview
|
|
158
|
+
|
|
159
|
+
**→ Full CFN Loop rules: `.claude/cfn-loop-rules.md` (auto-injected by CFN commands)**
|
|
160
|
+
|
|
161
|
+
**Mode Comparison:**
|
|
162
|
+
|
|
163
|
+
| Mode | Gate | Consensus | Iterations | Validators |
|
|
164
|
+
|------|------|-----------|------------|------------|
|
|
165
|
+
| MVP | ≥0.65 | ≥0.85 | 5 | 2 |
|
|
166
|
+
| Standard | ≥0.75 | ≥0.90 | 10 | 4 |
|
|
167
|
+
| Enterprise | ≥0.85 | ≥0.95 | 15 | 5 |
|
|
168
|
+
|
|
169
|
+
**Coordinator Patterns:** See `.claude/coordinator-patterns.md`
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 5) Coordination Checklist
|
|
174
|
+
|
|
175
|
+
**Before**: initialize SQLite memory system → assess complexity → set agent count/types → choose topology → prepare single spawn message
|
|
176
|
+
|
|
177
|
+
**During**: coordinate via SwarmMemory → post-edit hook after every edit → self-validate and report confidence
|
|
178
|
+
|
|
179
|
+
**After**: achieve ≥0.80-0.95 validator consensus → store results → auto next steps
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 6) Hook Feedback System (Phase 4.5)
|
|
184
|
+
|
|
185
|
+
**Auto-enabled:** Agents receive real-time feedback from post-edit hook via Redis.
|
|
186
|
+
|
|
187
|
+
### CLI Mode (Direct Subscription)
|
|
188
|
+
CLI-spawned agents auto-subscribe to `agent:{agentId}:feedback`:
|
|
189
|
+
- Feedback delivered within 100ms
|
|
190
|
+
- Written to `.artifacts/agents/{agentId}/pending-feedback.json`
|
|
191
|
+
|
|
192
|
+
### Task Mode (Coordinator-Mediated)
|
|
193
|
+
Task-spawned agents receive feedback via coordinator wake:
|
|
194
|
+
- Coordinator polls `coordinator:{id}:feedback` every 5s
|
|
195
|
+
- On feedback: Coordinator wakes agent with system reminder
|
|
196
|
+
|
|
197
|
+
### Feedback Types (Priority Order)
|
|
198
|
+
|
|
199
|
+
| Type | Severity | Action Required |
|
|
200
|
+
|------|----------|-----------------|
|
|
201
|
+
| `ROOT_WARNING` | High | Move file from root to suggested location |
|
|
202
|
+
| `TDD_VIOLATION` | High | Write tests before continuing |
|
|
203
|
+
| `LOW_COVERAGE` | Medium | Increase test coverage to threshold |
|
|
204
|
+
| `RUST_QUALITY` | Medium | Fix code quality issues |
|
|
205
|
+
| `LINT_ISSUES` | Low | Fix linting errors |
|
|
206
|
+
|
|
207
|
+
### Handling Feedback (Agents)
|
|
208
|
+
|
|
209
|
+
**ROOT_WARNING example:**
|
|
210
|
+
```bash
|
|
211
|
+
# Feedback: File created in root
|
|
212
|
+
mv test.txt src/test.txt # Move to suggested location
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**→ Pattern: `.claude/coordinator-feedback-pattern.md`**
|
|
216
|
+
|
|
217
|
+
### 6.3 Dashboard Integration (Phase 5)
|
|
218
|
+
|
|
219
|
+
**Real-time Dashboard:**
|
|
220
|
+
- URL: http://localhost:3001 (RealtimeServer)
|
|
221
|
+
- WebSocket: ws://localhost:3001/ws
|
|
222
|
+
- Components: RedisCoordinationMonitor.tsx
|
|
223
|
+
|
|
224
|
+
**REST API Endpoints:**
|
|
225
|
+
| Endpoint | Method | Description |
|
|
226
|
+
|----------|--------|-------------|
|
|
227
|
+
| /api/redis/feedback | GET | Recent feedback (limit=100) |
|
|
228
|
+
| /api/redis/metrics | GET | Current metrics snapshot |
|
|
229
|
+
| /api/swarm/status | GET | Current swarm coordination status |
|
|
230
|
+
|
|
231
|
+
**CLI Monitoring Commands:**
|
|
232
|
+
```bash
|
|
233
|
+
# Monitor feedback
|
|
234
|
+
./scripts/monitor-swarm-redis.sh feedback
|
|
235
|
+
|
|
236
|
+
# Monitor CFN Loop
|
|
237
|
+
./scripts/monitor-swarm-redis.sh coordination
|
|
238
|
+
|
|
239
|
+
# Realtime dashboard launch
|
|
240
|
+
npx claude-flow-novice dashboard --port 3001
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Post-Spawn Validation:**
|
|
244
|
+
```bash
|
|
245
|
+
# Validate CLI agent
|
|
246
|
+
node config/hooks/post-spawn-validation.js coder-1
|
|
247
|
+
|
|
248
|
+
# Validate Task agent
|
|
249
|
+
node config/hooks/post-spawn-validation.js task_abc123 --coordinator-id coordinator-cfn
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**WebSocket Event Types:**
|
|
253
|
+
- `swarm:coordination`
|
|
254
|
+
- `agent:feedback`
|
|
255
|
+
- `system:metrics`
|
|
256
|
+
- `dashboard:status`
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 7) Commands & Setup
|
|
261
|
+
|
|
262
|
+
**Swarm Execution:**
|
|
263
|
+
```bash
|
|
264
|
+
npx claude-flow-novice swarm "Create REST API" --strategy development --max-agents 3
|
|
265
|
+
redis-cli publish "swarm:coordination" '{"agent":"id","status":"message"}'
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**CFN Loop Commands:**
|
|
269
|
+
```bash
|
|
270
|
+
/cfn-loop "Task" --mode=mvp|standard|enterprise
|
|
271
|
+
/cfn-loop-sprints "Phase" --sprints=3
|
|
272
|
+
/cfn-loop-epic "Epic" --phases=4
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 8) SQLite Memory System
|
|
278
|
+
|
|
279
|
+
**5-Level ACL:**
|
|
280
|
+
|
|
281
|
+
| Level | Scope | Encryption | Loop Use |
|
|
282
|
+
|-------|-------|------------|----------|
|
|
283
|
+
| 1 | Agent | AES-256 | Loop 3 |
|
|
284
|
+
| 2 | Team | AES-256 | Team sync |
|
|
285
|
+
| 3 | Swarm | None | Loop 2 |
|
|
286
|
+
| 4 | Project | None | Loop 4 |
|
|
287
|
+
| 5 | System | Master key | Audit |
|
|
288
|
+
|
|
289
|
+
**Agent Usage:**
|
|
290
|
+
```javascript
|
|
291
|
+
const memory = new SQLiteMemorySystem({ swarmId, agentId, dbPath });
|
|
292
|
+
await memory.initialize();
|
|
293
|
+
await memory.memoryAdapter.set(key, value, { agentId, aclLevel, namespace });
|
|
294
|
+
const data = await memory.memoryAdapter.get(key, { agentId });
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Architecture**: Redis (hot, 1h TTL) + SQLite (persistent, 30-365d)
|
|
298
|
+
**Performance**: Write <60ms, Read <5ms (Redis) / <20ms (SQLite)
|
|
299
|
+
|
|
300
|
+
**→ Detailed commands: `readme/additional-commands.md` Section "SQLite Memory & ACL Commands"**
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## 8) Output & Telemetry (Concise)
|
|
305
|
+
|
|
306
|
+
**Agent confidence JSON (per agent)**
|
|
307
|
+
```json
|
|
308
|
+
{ "agent": "coder-1", "confidence": 0.85, "reasoning": "tests pass; security clean", "blockers": [] }
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Next steps block**
|
|
312
|
+
* ✅ Completed: brief list
|
|
313
|
+
* 📊 Validation: confidence, coverage, consensus
|
|
314
|
+
* 🔍 Issues: debt/warnings
|
|
315
|
+
* 💡 Recommendations: prioritized
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 9) CLI Command Reference
|
|
320
|
+
|
|
321
|
+
### Swarm Management
|
|
322
|
+
```bash
|
|
323
|
+
# Initialize and execute swarms
|
|
324
|
+
npx claude-flow-novice swarm "Objective description" --strategy development --max-agents 5
|
|
325
|
+
npx claude-flow-novice swarm "Research cloud patterns" --strategy research
|
|
326
|
+
|
|
327
|
+
# Monitor swarm status
|
|
328
|
+
claude-flow-novice swarm status
|
|
329
|
+
claude-flow-novice metrics --format=json
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Development Workflows
|
|
333
|
+
```bash
|
|
334
|
+
# Execute CFN Loop
|
|
335
|
+
/cfn-loop "Implement authentication system" --phase=auth --mode=standard
|
|
336
|
+
/cfn-loop "Build MVP prototype" --mode=mvp
|
|
337
|
+
/cfn-loop "Production API" --mode=enterprise
|
|
338
|
+
|
|
339
|
+
# Epic and sprint orchestration
|
|
340
|
+
/cfn-loop-sprints "E-commerce platform" --sprints=3 --mode=enterprise
|
|
341
|
+
/cfn-loop-epic "User management system" --phases=4 --mode=standard
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
For specialized commands (fullstack development, SPARC methodology, fleet management, event bus, compliance, performance, markdown validation, utilities, metrics reporting, WASM optimization, build/deployment, neural operations, GitHub integration, workflow automation, security/monitoring, debugging, and SDK integration), see `readme/additional-commands.md`.
|
package/SYNC_USAGE.md
CHANGED
|
@@ -20,6 +20,20 @@ npx claude-flow-sync --backup
|
|
|
20
20
|
node node_modules/claude-flow-novice/scripts/sync-from-package.js --backup
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
### 3. Available CLI Commands
|
|
24
|
+
|
|
25
|
+
The package provides additional commands for agent coordination:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Spawn agents via CLI (cost-optimized coordination)
|
|
29
|
+
npx claude-flow-spawn "Build auth system" --agents=coder,tester --provider zai
|
|
30
|
+
|
|
31
|
+
# Toggle cost-savings mode
|
|
32
|
+
npx claude-flow-cost-savings on # Enable CLI spawning
|
|
33
|
+
npx claude-flow-cost-savings off # Disable CLI spawning
|
|
34
|
+
npx claude-flow-cost-savings status # Check current mode
|
|
35
|
+
```
|
|
36
|
+
|
|
23
37
|
## Sync Options
|
|
24
38
|
|
|
25
39
|
### Sync Everything (Recommended for first time)
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow-novice",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "AI Agent Orchestration CLI",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"bin": {
|
|
7
7
|
"claude-flow-novice": "./src/cli/index.ts",
|
|
8
|
-
"claude-flow-sync": "./scripts/sync-from-package.js"
|
|
8
|
+
"claude-flow-sync": "./scripts/sync-from-package.js",
|
|
9
|
+
"claude-flow-spawn": "./src/cli/hybrid-routing/spawn-workers.js",
|
|
10
|
+
"claude-flow-cost-savings": "./scripts/toggle-cost-savings.cjs",
|
|
11
|
+
"claude-flow-validate-hooks": "./scripts/validate-agent-hooks.js"
|
|
9
12
|
},
|
|
10
13
|
"files": [
|
|
11
14
|
"src",
|
|
12
15
|
"README.md",
|
|
13
16
|
"CHANGELOG.md",
|
|
17
|
+
"CLAUDE.md",
|
|
14
18
|
"LICENSE",
|
|
15
19
|
"SYNC_USAGE.md",
|
|
16
20
|
"config",
|
|
@@ -71,6 +75,16 @@
|
|
|
71
75
|
"typescript": "^5.9.3"
|
|
72
76
|
},
|
|
73
77
|
"dependencies": {
|
|
74
|
-
"ioredis": "^5.8.1"
|
|
78
|
+
"ioredis": "^5.8.1",
|
|
79
|
+
"redis": "^4.7.0",
|
|
80
|
+
"socket.io-client": "^4.8.1"
|
|
81
|
+
},
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"better-sqlite3": "^11.0.0"
|
|
84
|
+
},
|
|
85
|
+
"peerDependenciesMeta": {
|
|
86
|
+
"better-sqlite3": {
|
|
87
|
+
"optional": true
|
|
88
|
+
}
|
|
75
89
|
}
|
|
76
90
|
}
|