claude-flow 2.5.0-alpha.139 → 2.7.0-alpha

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 (171) hide show
  1. package/.claude/agents/reasoning/README.md +171 -0
  2. package/.claude/agents/reasoning/agent.md +816 -0
  3. package/.claude/agents/reasoning/example-reasoning-agent-template.md +362 -0
  4. package/.claude/agents/reasoning/goal-planner.md +73 -0
  5. package/.claude/settings.json +2 -1
  6. package/.claude/sparc-modes.json +108 -0
  7. package/README.md +45 -55
  8. package/bin/claude-flow +1 -1
  9. package/dist/src/cli/command-registry.js +70 -6
  10. package/dist/src/cli/command-registry.js.map +1 -1
  11. package/dist/src/cli/commands/hive-mind/pause.js +2 -9
  12. package/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
  13. package/dist/src/cli/commands/index.js +1 -114
  14. package/dist/src/cli/commands/index.js.map +1 -1
  15. package/dist/src/cli/commands/swarm-spawn.js +5 -33
  16. package/dist/src/cli/commands/swarm-spawn.js.map +1 -1
  17. package/dist/src/cli/help-formatter.js +0 -3
  18. package/dist/src/cli/help-formatter.js.map +1 -1
  19. package/dist/src/cli/help-text.js +69 -7
  20. package/dist/src/cli/help-text.js.map +1 -1
  21. package/dist/src/cli/simple-cli.js +182 -172
  22. package/dist/src/cli/simple-cli.js.map +1 -1
  23. package/dist/src/cli/simple-commands/agent-booster.js +415 -0
  24. package/dist/src/cli/simple-commands/agent-booster.js.map +1 -0
  25. package/dist/src/cli/simple-commands/agent.js +856 -13
  26. package/dist/src/cli/simple-commands/agent.js.map +1 -1
  27. package/dist/src/cli/simple-commands/env-template.js +180 -0
  28. package/dist/src/cli/simple-commands/env-template.js.map +1 -0
  29. package/dist/src/cli/simple-commands/hooks.js +233 -0
  30. package/dist/src/cli/simple-commands/hooks.js.map +1 -1
  31. package/dist/src/cli/simple-commands/init/help.js +23 -0
  32. package/dist/src/cli/simple-commands/init/help.js.map +1 -1
  33. package/dist/src/cli/simple-commands/init/index.js +63 -0
  34. package/dist/src/cli/simple-commands/init/index.js.map +1 -1
  35. package/dist/src/cli/simple-commands/memory.js +307 -16
  36. package/dist/src/cli/simple-commands/memory.js.map +1 -1
  37. package/dist/src/cli/simple-commands/proxy.js +304 -0
  38. package/dist/src/cli/simple-commands/proxy.js.map +1 -0
  39. package/dist/src/cli/simple-commands/sparc.js +16 -19
  40. package/dist/src/cli/simple-commands/sparc.js.map +1 -1
  41. package/dist/src/cli/validation-helper.js.map +1 -1
  42. package/dist/src/execution/agent-executor.js +181 -0
  43. package/dist/src/execution/agent-executor.js.map +1 -0
  44. package/dist/src/execution/index.js +12 -0
  45. package/dist/src/execution/index.js.map +1 -0
  46. package/dist/src/execution/provider-manager.js +110 -0
  47. package/dist/src/execution/provider-manager.js.map +1 -0
  48. package/dist/src/hooks/index.js +0 -3
  49. package/dist/src/hooks/index.js.map +1 -1
  50. package/dist/src/hooks/redaction-hook.js +89 -0
  51. package/dist/src/hooks/redaction-hook.js.map +1 -0
  52. package/dist/src/mcp/claude-flow-tools.js +205 -150
  53. package/dist/src/mcp/claude-flow-tools.js.map +1 -1
  54. package/dist/src/mcp/mcp-server.js +125 -0
  55. package/dist/src/mcp/mcp-server.js.map +1 -1
  56. package/dist/src/sdk/query-control.js +293 -139
  57. package/dist/src/sdk/query-control.js.map +1 -1
  58. package/dist/src/sdk/session-forking.js +206 -129
  59. package/dist/src/sdk/session-forking.js.map +1 -1
  60. package/dist/src/utils/key-redactor.js +108 -0
  61. package/dist/src/utils/key-redactor.js.map +1 -0
  62. package/dist/src/utils/metrics-reader.js +37 -39
  63. package/dist/src/utils/metrics-reader.js.map +1 -1
  64. package/docs/AGENT-BOOSTER-INTEGRATION.md +407 -0
  65. package/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md +753 -0
  66. package/docs/AGENTIC_FLOW_EXECUTION_FIX_REPORT.md +474 -0
  67. package/docs/AGENTIC_FLOW_INTEGRATION_STATUS.md +143 -0
  68. package/docs/AGENTIC_FLOW_MVP_COMPLETE.md +367 -0
  69. package/docs/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +369 -0
  70. package/docs/COMMAND-VERIFICATION-REPORT.md +441 -0
  71. package/docs/COMMIT_SUMMARY.md +247 -0
  72. package/docs/DEEP_REVIEW_COMPREHENSIVE_REPORT.md +922 -0
  73. package/docs/DOCKER-VALIDATION-REPORT.md +281 -0
  74. package/docs/ENV-SETUP-GUIDE.md +270 -0
  75. package/docs/FINAL_PRE_PUBLISH_VALIDATION.md +823 -0
  76. package/docs/FINAL_VALIDATION_REPORT.md +165 -0
  77. package/docs/HOOKS-V2-MODIFICATION.md +146 -0
  78. package/docs/INDEX.md +568 -0
  79. package/docs/INTEGRATION_COMPLETE.md +414 -0
  80. package/docs/MEMORY_REDACTION_TEST_REPORT.md +300 -0
  81. package/docs/PERFORMANCE-SYSTEMS-STATUS.md +340 -0
  82. package/docs/PRE_RELEASE_FIXES_REPORT.md +435 -0
  83. package/docs/README.md +35 -0
  84. package/docs/REASONING-AGENTS.md +482 -0
  85. package/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md +813 -0
  86. package/docs/REASONINGBANK-ANALYSIS-COMPLETE.md +479 -0
  87. package/docs/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
  88. package/docs/REASONINGBANK-BENCHMARK.md +396 -0
  89. package/docs/REASONINGBANK-CLI-INTEGRATION.md +455 -0
  90. package/docs/REASONINGBANK-CORE-INTEGRATION.md +658 -0
  91. package/docs/REASONINGBANK-COST-OPTIMIZATION.md +329 -0
  92. package/docs/REASONINGBANK-DEMO.md +419 -0
  93. package/docs/REASONINGBANK-INTEGRATION-COMPLETE.md +249 -0
  94. package/docs/REASONINGBANK-VALIDATION.md +532 -0
  95. package/docs/REASONINGBANK_ARCHITECTURE.md +475 -0
  96. package/docs/REASONINGBANK_INTEGRATION_COMPLETE.md +558 -0
  97. package/docs/REASONINGBANK_INTEGRATION_PLAN.md +1188 -0
  98. package/docs/REGRESSION-ANALYSIS-REPORT.md +500 -0
  99. package/docs/RELEASE_v2.6.0-alpha.2.md +658 -0
  100. package/docs/api/API_DOCUMENTATION.md +721 -0
  101. package/docs/architecture/ARCHITECTURE.md +1690 -0
  102. package/docs/ci-cd/README.md +368 -0
  103. package/docs/development/DEPLOYMENT.md +2348 -0
  104. package/docs/development/DEVELOPMENT_WORKFLOW.md +1333 -0
  105. package/docs/development/build-analysis-report.md +252 -0
  106. package/docs/development/pair-optimization.md +156 -0
  107. package/docs/development/token-tracking-status.md +103 -0
  108. package/docs/development/training-pipeline-demo.md +163 -0
  109. package/docs/development/training-pipeline-real-only.md +196 -0
  110. package/docs/epic-sdk-integration.md +1269 -0
  111. package/docs/experimental/RIEMANN_HYPOTHESIS_PROOF.md +124 -0
  112. package/docs/experimental/computational_verification.py +436 -0
  113. package/docs/experimental/novel_approaches.md +560 -0
  114. package/docs/experimental/riemann_hypothesis_analysis.md +263 -0
  115. package/docs/experimental/riemann_proof_attempt.md +124 -0
  116. package/docs/experimental/riemann_synthesis.md +277 -0
  117. package/docs/experimental/verification_results.json +12 -0
  118. package/docs/experimental/visualization_insights.md +720 -0
  119. package/docs/guides/USER_GUIDE.md +1138 -0
  120. package/docs/guides/token-tracking-guide.md +291 -0
  121. package/docs/reference/AGENTS.md +1011 -0
  122. package/docs/reference/MCP_TOOLS.md +2188 -0
  123. package/docs/reference/SPARC.md +717 -0
  124. package/docs/reference/SWARM.md +2000 -0
  125. package/docs/sdk/CLAUDE-CODE-SDK-DEEP-ANALYSIS.md +649 -0
  126. package/docs/sdk/CLAUDE-FLOW-SDK-INTEGRATION-ANALYSIS.md +242 -0
  127. package/docs/sdk/INTEGRATION-ROADMAP.md +420 -0
  128. package/docs/sdk/MCP-TOOLS-UPDATE.md +270 -0
  129. package/docs/sdk/SDK-ADVANCED-FEATURES-INTEGRATION.md +723 -0
  130. package/docs/sdk/SDK-ALL-FEATURES-INTEGRATION-MATRIX.md +612 -0
  131. package/docs/sdk/SDK-INTEGRATION-COMPLETE.md +358 -0
  132. package/docs/sdk/SDK-INTEGRATION-PHASES-V2.5.md +750 -0
  133. package/docs/sdk/SDK-LEVERAGE-REAL-FEATURES.md +676 -0
  134. package/docs/sdk/SDK-VALIDATION-RESULTS.md +400 -0
  135. package/docs/sdk/epic-sdk-integration.md +1269 -0
  136. package/docs/setup/remote-setup.md +93 -0
  137. package/docs/validation/final-validation-summary.md +220 -0
  138. package/docs/validation/verification-integration.md +190 -0
  139. package/docs/validation/verification-validation.md +349 -0
  140. package/docs/wiki/background-commands.md +1213 -0
  141. package/docs/wiki/session-persistence.md +342 -0
  142. package/docs/wiki/stream-chain-command.md +537 -0
  143. package/package.json +4 -2
  144. package/src/cli/command-registry.js +70 -5
  145. package/src/cli/commands/hive-mind/pause.ts +2 -15
  146. package/src/cli/commands/index.ts +1 -84
  147. package/src/cli/commands/swarm-spawn.ts +3 -47
  148. package/src/cli/help-text.js +42 -7
  149. package/src/cli/simple-cli.ts +18 -8
  150. package/src/cli/simple-commands/agent-booster.js +515 -0
  151. package/src/cli/simple-commands/agent.js +1001 -12
  152. package/src/cli/simple-commands/agent.ts +137 -0
  153. package/src/cli/simple-commands/config.ts +127 -0
  154. package/src/cli/simple-commands/env-template.js +190 -0
  155. package/src/cli/simple-commands/hooks.js +310 -0
  156. package/src/cli/simple-commands/init/help.js +23 -0
  157. package/src/cli/simple-commands/init/index.js +84 -6
  158. package/src/cli/simple-commands/memory.js +363 -16
  159. package/src/cli/simple-commands/proxy.js +384 -0
  160. package/src/cli/simple-commands/sparc.js +16 -19
  161. package/src/execution/agent-executor.ts +306 -0
  162. package/src/execution/index.ts +19 -0
  163. package/src/execution/provider-manager.ts +187 -0
  164. package/src/hooks/index.ts +0 -5
  165. package/src/hooks/redaction-hook.ts +115 -0
  166. package/src/mcp/claude-flow-tools.ts +203 -120
  167. package/src/mcp/mcp-server.js +86 -0
  168. package/src/sdk/query-control.ts +377 -223
  169. package/src/sdk/session-forking.ts +312 -207
  170. package/src/utils/key-redactor.js +178 -0
  171. package/src/utils/key-redactor.ts +184 -0
@@ -0,0 +1,753 @@
1
+ # Agentic-Flow Integration Guide for Claude-Flow
2
+
3
+ ## 🎯 Overview
4
+
5
+ Claude-Flow v2.6.0+ includes deep integration with agentic-flow, providing access to 66+ specialized AI agents with multi-provider support, ReasoningBank memory, and intelligent model optimization.
6
+
7
+ ## 🚀 Quick Start
8
+
9
+ ```bash
10
+ # Initialize ReasoningBank for learning agents
11
+ claude-flow agent memory init
12
+
13
+ # Run your first agent
14
+ claude-flow agent run coder "Build a REST API with authentication"
15
+
16
+ # Run with memory enabled (learns from experience)
17
+ claude-flow agent run coder "Add user management API" --enable-memory
18
+
19
+ # Check what the agent learned
20
+ claude-flow agent memory status
21
+ ```
22
+
23
+ ## 📚 Complete Command Reference
24
+
25
+ ### 1. Agent Execution
26
+
27
+ #### Basic Agent Execution
28
+
29
+ ```bash
30
+ # Execute any of the 66+ available agents
31
+ claude-flow agent run <agent-type> "<task>" [options]
32
+
33
+ # Examples
34
+ claude-flow agent run coder "Create Express.js REST API"
35
+ claude-flow agent run researcher "Research GraphQL best practices"
36
+ claude-flow agent run security-auditor "Audit authentication code"
37
+ claude-flow agent run full-stack-developer "Build Next.js app"
38
+ claude-flow agent run tester "Create Jest test suite"
39
+ ```
40
+
41
+ #### Multi-Provider Support
42
+
43
+ ```bash
44
+ # Use different LLM providers
45
+ claude-flow agent run coder "Build API" --provider anthropic
46
+ claude-flow agent run coder "Build API" --provider openrouter
47
+ claude-flow agent run coder "Build API" --provider onnx # Local
48
+ claude-flow agent run coder "Build API" --provider gemini
49
+
50
+ # With specific models
51
+ claude-flow agent run coder "Build API" --provider anthropic --model claude-3-5-sonnet-20241022
52
+ claude-flow agent run coder "Build API" --provider openrouter --model meta-llama/llama-3.1-70b-instruct
53
+ ```
54
+
55
+ #### Execution Options
56
+
57
+ ```bash
58
+ # Temperature control (creativity vs consistency)
59
+ claude-flow agent run coder "Write code" --temperature 0.3
60
+
61
+ # Max tokens (output length)
62
+ claude-flow agent run researcher "Research topic" --max-tokens 4096
63
+
64
+ # Output format
65
+ claude-flow agent run analyst "Analyze data" --format json
66
+ claude-flow agent run researcher "Research" --format markdown
67
+
68
+ # Streaming output
69
+ claude-flow agent run coder "Build API" --stream
70
+
71
+ # Verbose logging
72
+ claude-flow agent run coder "Build API" --verbose
73
+
74
+ # Retry on errors
75
+ claude-flow agent run coder "Build API" --retry
76
+
77
+ # Custom timeout
78
+ claude-flow agent run coder "Complex task" --timeout 600000 # 10 minutes
79
+ ```
80
+
81
+ ### 2. Model Optimization (85-98% Cost Savings)
82
+
83
+ ```bash
84
+ # Auto-select optimal model based on task
85
+ claude-flow agent run coder "Fix simple bug" --optimize
86
+
87
+ # Optimize for cost (cheapest model that works)
88
+ claude-flow agent run coder "Add logging" --optimize --priority cost
89
+
90
+ # Optimize for quality (best model)
91
+ claude-flow agent run coder "Critical security fix" --optimize --priority quality
92
+
93
+ # Optimize for speed (fastest model)
94
+ claude-flow agent run coder "Quick refactor" --optimize --priority speed
95
+
96
+ # Optimize for privacy (local models only)
97
+ claude-flow agent run coder "Sensitive code" --optimize --priority privacy
98
+
99
+ # Balanced optimization (cost + quality)
100
+ claude-flow agent run coder "Feature implementation" --optimize --priority balanced
101
+
102
+ # With budget cap
103
+ claude-flow agent run coder "Build API" --optimize --max-cost 0.10 # Max $0.10
104
+ ```
105
+
106
+ ### 3. ReasoningBank Memory System
107
+
108
+ #### Initialize Memory
109
+
110
+ ```bash
111
+ # First time setup
112
+ claude-flow agent memory init
113
+
114
+ # With custom database location
115
+ claude-flow agent memory init --db /path/to/memory.db
116
+ ```
117
+
118
+ #### Run Agents with Memory
119
+
120
+ ```bash
121
+ # Enable learning from experience
122
+ claude-flow agent run coder "Build authentication API" --enable-memory
123
+
124
+ # With domain filtering (organize memories)
125
+ claude-flow agent run coder "Add JWT auth" --enable-memory --memory-domain authentication
126
+
127
+ # Customize memory retrieval
128
+ claude-flow agent run coder "Add OAuth" --enable-memory \
129
+ --memory-k 5 \
130
+ --memory-min-confidence 0.7 \
131
+ --memory-domain authentication
132
+
133
+ # Custom task ID for tracking
134
+ claude-flow agent run coder "Deploy app" --enable-memory \
135
+ --memory-task-id deploy-v1.0.0
136
+
137
+ # Read memories without creating new ones
138
+ claude-flow agent run researcher "Check patterns" --enable-memory --no-memory-learning
139
+
140
+ # Custom memory database
141
+ claude-flow agent run coder "Build API" --enable-memory --memory-db .swarm/custom.db
142
+ ```
143
+
144
+ #### Memory Management
145
+
146
+ ```bash
147
+ # Check memory statistics
148
+ claude-flow agent memory status
149
+
150
+ # List stored memories
151
+ claude-flow agent memory list
152
+ claude-flow agent memory list --domain authentication
153
+ claude-flow agent memory list --limit 20
154
+
155
+ # Consolidate (deduplicate and prune)
156
+ claude-flow agent memory consolidate
157
+
158
+ # Run interactive demo (see 0% → 100% learning)
159
+ claude-flow agent memory demo
160
+
161
+ # Run validation tests
162
+ claude-flow agent memory test
163
+
164
+ # Run performance benchmarks
165
+ claude-flow agent memory benchmark
166
+ ```
167
+
168
+ ### 4. Agent Discovery and Management
169
+
170
+ ```bash
171
+ # List all 66+ available agents
172
+ claude-flow agent agents
173
+
174
+ # Get detailed agent information
175
+ claude-flow agent info coder
176
+ claude-flow agent info security-auditor
177
+ claude-flow agent info full-stack-developer
178
+
179
+ # Create custom agent
180
+ claude-flow agent create \
181
+ --name "api-specialist" \
182
+ --description "Specialized in REST API design" \
183
+ --category "backend" \
184
+ --prompt "You are an expert in REST API design..." \
185
+ --tools "web-search,code-execution"
186
+
187
+ # Check for agent conflicts (package vs local)
188
+ claude-flow agent conflicts
189
+ ```
190
+
191
+ ### 5. Configuration Management
192
+
193
+ ```bash
194
+ # Interactive setup wizard
195
+ claude-flow agent config wizard
196
+
197
+ # Set API keys
198
+ claude-flow agent config set ANTHROPIC_API_KEY sk-ant-xxx
199
+ claude-flow agent config set OPENROUTER_API_KEY sk-or-xxx
200
+ claude-flow agent config set GOOGLE_GEMINI_API_KEY xxx
201
+
202
+ # Set default provider/model
203
+ claude-flow agent config set DEFAULT_PROVIDER anthropic
204
+ claude-flow agent config set DEFAULT_MODEL claude-3-5-sonnet-20241022
205
+
206
+ # Get configuration
207
+ claude-flow agent config get ANTHROPIC_API_KEY
208
+ claude-flow agent config get DEFAULT_PROVIDER
209
+
210
+ # List all configurations
211
+ claude-flow agent config list
212
+ claude-flow agent config list --show-secrets
213
+
214
+ # Delete configuration
215
+ claude-flow agent config delete OPENROUTER_API_KEY
216
+
217
+ # Reset to defaults
218
+ claude-flow agent config reset --force
219
+ ```
220
+
221
+ ### 6. MCP Server Management
222
+
223
+ ```bash
224
+ # Start MCP server
225
+ claude-flow agent mcp start
226
+ claude-flow agent mcp start --port 3000
227
+ claude-flow agent mcp start --daemon # Run in background
228
+
229
+ # Check server status
230
+ claude-flow agent mcp status
231
+ claude-flow agent mcp status --detailed
232
+
233
+ # List available MCP tools
234
+ claude-flow agent mcp list
235
+ claude-flow agent mcp list --server agent-booster
236
+ claude-flow agent mcp list --category "code-editing"
237
+
238
+ # View logs
239
+ claude-flow agent mcp logs
240
+ claude-flow agent mcp logs --lines 100
241
+ claude-flow agent mcp logs --follow
242
+
243
+ # Stop/restart server
244
+ claude-flow agent mcp stop
245
+ claude-flow agent mcp restart
246
+ ```
247
+
248
+ ## 🧠 ReasoningBank Learning Workflow
249
+
250
+ ### Complete Example: Building an Authentication System
251
+
252
+ ```bash
253
+ # Step 1: Initialize memory system
254
+ claude-flow agent memory init
255
+
256
+ # Step 2: Build JWT authentication (first attempt)
257
+ claude-flow agent run coder "Build JWT authentication with Express.js" \
258
+ --enable-memory \
259
+ --memory-domain authentication/jwt \
260
+ --memory-task-id auth-v1 \
261
+ --format markdown
262
+
263
+ # Step 3: Add OAuth2 (learns from JWT experience)
264
+ claude-flow agent run coder "Add OAuth2 authentication" \
265
+ --enable-memory \
266
+ --memory-domain authentication/oauth \
267
+ --memory-k 5
268
+
269
+ # Step 4: Check what was learned
270
+ claude-flow agent memory list --domain authentication
271
+
272
+ # Output shows memories like:
273
+ # 1. JWT Token Validation Pattern
274
+ # Confidence: 0.85 | Usage: 2 | Created: 2025-10-12
275
+ # Domain: authentication/jwt
276
+ # Always validate JWT expiration before database queries
277
+ #
278
+ # 2. OAuth2 Token Refresh Strategy
279
+ # Confidence: 0.80 | Usage: 1 | Created: 2025-10-12
280
+ # Domain: authentication/oauth
281
+ # Store refresh tokens securely and implement rotation
282
+
283
+ # Step 5: Add new authentication method (benefits from both JWT and OAuth memories)
284
+ claude-flow agent run coder "Add SAML SSO authentication" \
285
+ --enable-memory \
286
+ --memory-domain authentication/saml \
287
+ --memory-k 5 \
288
+ --memory-min-confidence 0.7
289
+
290
+ # Step 6: Consolidate memories (remove duplicates, prune old ones)
291
+ claude-flow agent memory consolidate
292
+
293
+ # Step 7: Check improved statistics
294
+ claude-flow agent memory status
295
+ ```
296
+
297
+ ## 🔥 Advanced Usage Patterns
298
+
299
+ ### Pattern 1: Progressive Enhancement with Memory
300
+
301
+ ```bash
302
+ # Day 1: Build initial feature
303
+ claude-flow agent run full-stack-developer "Build user profile page" \
304
+ --enable-memory \
305
+ --memory-domain profiles \
306
+ --provider anthropic
307
+
308
+ # Day 2: Add related feature (learns from Day 1)
309
+ claude-flow agent run full-stack-developer "Add profile picture upload" \
310
+ --enable-memory \
311
+ --memory-domain profiles \
312
+ --memory-k 5
313
+
314
+ # Day 3: Add another related feature (learns from Days 1-2)
315
+ claude-flow agent run full-stack-developer "Add profile settings page" \
316
+ --enable-memory \
317
+ --memory-domain profiles \
318
+ --memory-k 5
319
+
320
+ # Result: Each iteration is faster and more consistent
321
+ ```
322
+
323
+ ### Pattern 2: Cost-Optimized Development
324
+
325
+ ```bash
326
+ # Use cheap models for simple tasks
327
+ claude-flow agent run coder "Add console logging" \
328
+ --optimize --priority cost \
329
+ --enable-memory
330
+
331
+ # Use quality models for complex tasks
332
+ claude-flow agent run coder "Implement distributed caching" \
333
+ --optimize --priority quality \
334
+ --max-cost 0.50 \
335
+ --enable-memory
336
+
337
+ # Let optimizer decide based on task
338
+ claude-flow agent run coder "Refactor authentication module" \
339
+ --optimize --priority balanced \
340
+ --enable-memory
341
+ ```
342
+
343
+ ### Pattern 3: Multi-Agent Workflow
344
+
345
+ ```bash
346
+ # Research phase
347
+ claude-flow agent run researcher "Research GraphQL best practices for authentication" \
348
+ --enable-memory \
349
+ --memory-domain research/graphql \
350
+ --format markdown
351
+
352
+ # Design phase
353
+ claude-flow agent run system-architect "Design GraphQL API schema for authentication" \
354
+ --enable-memory \
355
+ --memory-domain design/graphql \
356
+ --memory-k 5
357
+
358
+ # Implementation phase
359
+ claude-flow agent run coder "Implement GraphQL authentication API" \
360
+ --enable-memory \
361
+ --memory-domain implementation/graphql \
362
+ --memory-k 10
363
+
364
+ # Testing phase
365
+ claude-flow agent run tester "Create comprehensive GraphQL API tests" \
366
+ --enable-memory \
367
+ --memory-domain testing/graphql \
368
+ --memory-k 5
369
+
370
+ # Review phase
371
+ claude-flow agent run security-auditor "Audit GraphQL authentication security" \
372
+ --enable-memory \
373
+ --memory-domain security/graphql \
374
+ --memory-k 10
375
+
376
+ # Check accumulated knowledge
377
+ claude-flow agent memory list --domain graphql
378
+ ```
379
+
380
+ ### Pattern 4: Domain-Specific Knowledge Building
381
+
382
+ ```bash
383
+ # Build security knowledge base
384
+ for task in \
385
+ "Implement input validation" \
386
+ "Add SQL injection prevention" \
387
+ "Implement CSRF protection" \
388
+ "Add XSS prevention" \
389
+ "Implement rate limiting"
390
+ do
391
+ claude-flow agent run security-auditor "$task" \
392
+ --enable-memory \
393
+ --memory-domain security \
394
+ --memory-k 10
395
+ done
396
+
397
+ # Now security agent has comprehensive security knowledge
398
+ claude-flow agent memory list --domain security
399
+ ```
400
+
401
+ ### Pattern 5: Local Development with ONNX
402
+
403
+ ```bash
404
+ # Run entirely locally (no API calls)
405
+ claude-flow agent run coder "Add logging to function" \
406
+ --provider onnx \
407
+ --enable-memory
408
+
409
+ # Benefits:
410
+ # - $0 cost
411
+ # - Privacy (code never leaves machine)
412
+ # - No API key needed
413
+ # - Good for simple tasks
414
+ ```
415
+
416
+ ## 🔗 Integration with Claude-Flow Swarms
417
+
418
+ Combine agentic-flow agents with claude-flow swarm coordination:
419
+
420
+ ```bash
421
+ # Initialize swarm with agentic-flow agents
422
+ claude-flow swarm init --topology mesh --agents 5
423
+
424
+ # Each agent runs via agentic-flow with memory
425
+ claude-flow agent run coder "Build API endpoint" --enable-memory &
426
+ claude-flow agent run tester "Create tests" --enable-memory &
427
+ claude-flow agent run security-auditor "Security review" --enable-memory &
428
+
429
+ # Check swarm status
430
+ claude-flow swarm status
431
+ ```
432
+
433
+ ## 📊 Understanding ReasoningBank Performance
434
+
435
+ ### Memory Scoring Formula
436
+
437
+ ```
438
+ score = α·similarity + β·recency + γ·reliability + δ·diversity
439
+
440
+ Default weights:
441
+ - α (similarity) = 0.7 // Semantic relevance
442
+ - β (recency) = 0.2 // How recent
443
+ - γ (reliability) = 0.1 // Confidence from past use
444
+ - δ (diversity) = 0.3 // MMR diversity selection
445
+ ```
446
+
447
+ ### Customize Scoring (Environment Variables)
448
+
449
+ ```bash
450
+ # Adjust weights
451
+ export REASONINGBANK_ALPHA=0.8 # Prioritize similarity
452
+ export REASONINGBANK_BETA=0.1 # Less weight on recency
453
+ export REASONINGBANK_GAMMA=0.1 # Keep reliability weight
454
+ export REASONINGBANK_DELTA=0.2 # Less diversity
455
+
456
+ # Other settings
457
+ export REASONINGBANK_K=5 # Retrieve top 5 memories
458
+ export REASONINGBANK_MIN_CONFIDENCE=0.7 # Higher quality threshold
459
+ export REASONINGBANK_RECENCY_HALFLIFE=14 # 2-week half-life
460
+
461
+ # Database location
462
+ export CLAUDE_FLOW_DB_PATH=.swarm/team-memory.db
463
+ ```
464
+
465
+ ### Performance Metrics
466
+
467
+ After running agents with memory, check improvements:
468
+
469
+ ```bash
470
+ claude-flow agent memory status
471
+ ```
472
+
473
+ Expected metrics:
474
+ - **Success rate**: 70% → 88% (+26%)
475
+ - **Token usage**: -25% reduction
476
+ - **Learning velocity**: 3.2x faster
477
+ - **Task completion**: 0% → 95% over 5 iterations
478
+
479
+ ## 🎯 Real-World Examples
480
+
481
+ ### Example 1: Building a Complete REST API
482
+
483
+ ```bash
484
+ #!/bin/bash
485
+
486
+ # Initialize memory
487
+ claude-flow agent memory init
488
+
489
+ # Research phase
490
+ claude-flow agent run researcher "Research Express.js REST API best practices 2025" \
491
+ --enable-memory \
492
+ --memory-domain api/research \
493
+ --format markdown > research-notes.md
494
+
495
+ # Architecture phase
496
+ claude-flow agent run system-architect "Design REST API architecture for task management" \
497
+ --enable-memory \
498
+ --memory-domain api/architecture \
499
+ --memory-k 5
500
+
501
+ # Implementation phase - Core API
502
+ claude-flow agent run full-stack-developer "Implement Express.js REST API with PostgreSQL" \
503
+ --enable-memory \
504
+ --memory-domain api/implementation \
505
+ --memory-k 10 \
506
+ --optimize --priority balanced
507
+
508
+ # Implementation phase - Authentication
509
+ claude-flow agent run coder "Add JWT authentication to API" \
510
+ --enable-memory \
511
+ --memory-domain api/authentication \
512
+ --memory-k 10
513
+
514
+ # Implementation phase - Validation
515
+ claude-flow agent run coder "Add input validation with Joi" \
516
+ --enable-memory \
517
+ --memory-domain api/validation \
518
+ --memory-k 10
519
+
520
+ # Testing phase
521
+ claude-flow agent run tester "Create comprehensive Jest test suite" \
522
+ --enable-memory \
523
+ --memory-domain api/testing \
524
+ --memory-k 15
525
+
526
+ # Security audit
527
+ claude-flow agent run security-auditor "Audit API for security vulnerabilities" \
528
+ --enable-memory \
529
+ --memory-domain api/security \
530
+ --memory-k 15
531
+
532
+ # Performance optimization
533
+ claude-flow agent run performance-optimizer "Optimize API performance" \
534
+ --enable-memory \
535
+ --memory-domain api/performance \
536
+ --memory-k 10
537
+
538
+ # Documentation
539
+ claude-flow agent run technical-writer "Create API documentation" \
540
+ --enable-memory \
541
+ --memory-domain api/documentation \
542
+ --format markdown > API-DOCS.md
543
+
544
+ # Check what was learned
545
+ echo "\n📚 Knowledge accumulated:"
546
+ claude-flow agent memory list --domain api --limit 20
547
+
548
+ # Consolidate memories
549
+ claude-flow agent memory consolidate
550
+ ```
551
+
552
+ ### Example 2: Debugging with Memory
553
+
554
+ ```bash
555
+ # First bug: Database connection timeout
556
+ claude-flow agent run debugger "Fix PostgreSQL connection timeout error" \
557
+ --enable-memory \
558
+ --memory-domain debugging/database \
559
+ --memory-task-id bug-001
560
+
561
+ # Second bug: Similar database issue (learns from first)
562
+ claude-flow agent run debugger "Fix database deadlock in transaction" \
563
+ --enable-memory \
564
+ --memory-domain debugging/database \
565
+ --memory-k 10 \
566
+ --memory-task-id bug-002
567
+
568
+ # Result: Second fix is faster because agent remembers:
569
+ # - Database connection pool configuration
570
+ # - Transaction isolation levels
571
+ # - Common PostgreSQL issues
572
+ ```
573
+
574
+ ### Example 3: Migration Project
575
+
576
+ ```bash
577
+ # Phase 1: Analyze existing code
578
+ claude-flow agent run code-analyzer "Analyze Express.js v4 API structure" \
579
+ --enable-memory \
580
+ --memory-domain migration/analysis
581
+
582
+ # Phase 2: Plan migration
583
+ claude-flow agent run system-architect "Plan Express.js v4 to v5 migration" \
584
+ --enable-memory \
585
+ --memory-domain migration/planning \
586
+ --memory-k 5
587
+
588
+ # Phase 3: Execute migration (benefits from phases 1-2)
589
+ claude-flow agent run full-stack-developer "Migrate Express.js v4 to v5" \
590
+ --enable-memory \
591
+ --memory-domain migration/implementation \
592
+ --memory-k 10
593
+
594
+ # Phase 4: Validate migration
595
+ claude-flow agent run tester "Create migration validation tests" \
596
+ --enable-memory \
597
+ --memory-domain migration/testing \
598
+ --memory-k 10
599
+ ```
600
+
601
+ ## 🔍 Troubleshooting
602
+
603
+ ### Issue: Agent execution fails
604
+
605
+ ```bash
606
+ # Check configuration
607
+ claude-flow agent config list
608
+
609
+ # Check API keys are set
610
+ claude-flow agent config get ANTHROPIC_API_KEY
611
+
612
+ # Try with explicit provider
613
+ claude-flow agent run coder "Test task" --provider anthropic
614
+
615
+ # Check verbose output
616
+ claude-flow agent run coder "Test task" --verbose
617
+ ```
618
+
619
+ ### Issue: Memory not working
620
+
621
+ ```bash
622
+ # Verify memory is initialized
623
+ claude-flow agent memory status
624
+
625
+ # Re-initialize if needed
626
+ claude-flow agent memory init
627
+
628
+ # Test with demo
629
+ claude-flow agent memory demo
630
+
631
+ # Check database exists
632
+ ls -la .swarm/memory.db
633
+ ```
634
+
635
+ ### Issue: Slow performance
636
+
637
+ ```bash
638
+ # Use model optimization
639
+ claude-flow agent run coder "Task" --optimize --priority speed
640
+
641
+ # Reduce memory retrieval
642
+ claude-flow agent run coder "Task" --enable-memory --memory-k 3
643
+
644
+ # Consolidate old memories
645
+ claude-flow agent memory consolidate
646
+ ```
647
+
648
+ ### Issue: Out of memory errors
649
+
650
+ ```bash
651
+ # Consolidate to prune old memories
652
+ claude-flow agent memory consolidate
653
+
654
+ # Check memory statistics
655
+ claude-flow agent memory status
656
+
657
+ # Use new database if too large
658
+ claude-flow agent run coder "Task" --enable-memory --memory-db .swarm/new.db
659
+ ```
660
+
661
+ ## 📈 Best Practices
662
+
663
+ ### 1. Memory Organization
664
+
665
+ ```bash
666
+ # Use hierarchical domains
667
+ --memory-domain project/feature/aspect
668
+
669
+ # Examples:
670
+ --memory-domain ecommerce/auth/jwt
671
+ --memory-domain ecommerce/cart/checkout
672
+ --memory-domain ecommerce/payments/stripe
673
+ ```
674
+
675
+ ### 2. Progressive Learning
676
+
677
+ ```bash
678
+ # Start simple, build up knowledge
679
+ claude-flow agent run coder "Build simple API" --enable-memory
680
+ claude-flow agent run coder "Add validation" --enable-memory --memory-k 5
681
+ claude-flow agent run coder "Add authentication" --enable-memory --memory-k 10
682
+ claude-flow agent run coder "Add rate limiting" --enable-memory --memory-k 15
683
+ ```
684
+
685
+ ### 3. Cost Optimization
686
+
687
+ ```bash
688
+ # Use optimize flag consistently
689
+ alias cf-run='claude-flow agent run --optimize --enable-memory'
690
+
691
+ # Then use normally
692
+ cf-run coder "Build feature"
693
+ cf-run tester "Create tests"
694
+ ```
695
+
696
+ ### 4. Regular Maintenance
697
+
698
+ ```bash
699
+ # Weekly: Consolidate memories
700
+ claude-flow agent memory consolidate
701
+
702
+ # Monthly: Check memory health
703
+ claude-flow agent memory status
704
+ claude-flow agent memory benchmark
705
+ ```
706
+
707
+ ## 🚀 Migration from Direct agentic-flow Usage
708
+
709
+ If you're currently using `npx agentic-flow` directly:
710
+
711
+ ### Before (direct agentic-flow):
712
+ ```bash
713
+ npx agentic-flow --agent coder --task "Build API" \
714
+ --provider anthropic \
715
+ --enable-memory \
716
+ --memory-domain api
717
+ ```
718
+
719
+ ### After (via claude-flow):
720
+ ```bash
721
+ claude-flow agent run coder "Build API" \
722
+ --provider anthropic \
723
+ --enable-memory \
724
+ --memory-domain api
725
+ ```
726
+
727
+ ### Benefits of using claude-flow wrapper:
728
+ 1. Shorter commands
729
+ 2. Integrated with claude-flow swarms
730
+ 3. Better error handling
731
+ 4. Consistent logging
732
+ 5. Access to claude-flow hooks
733
+ 6. Unified configuration
734
+ 7. Easier MCP integration
735
+
736
+ ## 🔗 Related Documentation
737
+
738
+ - **ReasoningBank Paper**: https://arxiv.org/html/2509.25140v1
739
+ - **Agent Creation Guide**: `docs/REASONINGBANK-AGENT-CREATION-GUIDE.md`
740
+ - **Reasoning Agents**: `.claude/agents/reasoning/README.md`
741
+ - **Available Agents**: Run `claude-flow agent agents`
742
+
743
+ ## 🆘 Support
744
+
745
+ - GitHub Issues: https://github.com/ruvnet/claude-flow/issues
746
+ - Agentic-Flow Issues: https://github.com/ruvnet/agentic-flow/issues
747
+ - Documentation: https://github.com/ruvnet/claude-flow
748
+
749
+ ---
750
+
751
+ **Version**: 2.6.0+
752
+ **Last Updated**: 2025-10-12
753
+ **Status**: Production-ready