claude-flow-novice 2.4.2 → 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.
Files changed (2) hide show
  1. package/CLAUDE.md +346 -0
  2. package/package.json +13 -2
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow-novice",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "AI Agent Orchestration CLI",
5
5
  "main": "src/index.ts",
6
6
  "bin": {
@@ -14,6 +14,7 @@
14
14
  "src",
15
15
  "README.md",
16
16
  "CHANGELOG.md",
17
+ "CLAUDE.md",
17
18
  "LICENSE",
18
19
  "SYNC_USAGE.md",
19
20
  "config",
@@ -74,6 +75,16 @@
74
75
  "typescript": "^5.9.3"
75
76
  },
76
77
  "dependencies": {
77
- "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
+ }
78
89
  }
79
90
  }