moflo 4.8.49 → 4.8.51

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 (439) hide show
  1. package/.claude/guidance/shipped/moflo-core-guidance.md +646 -646
  2. package/bin/cli.js +1 -1
  3. package/bin/hooks.mjs +607 -607
  4. package/bin/index-all.mjs +2 -2
  5. package/bin/session-start-launcher.mjs +272 -272
  6. package/package.json +22 -23
  7. package/src/{@claude-flow → packages}/cli/dist/src/init/claudemd-generator.js +45 -45
  8. package/src/{@claude-flow → packages}/cli/dist/src/init/executor.js +0 -4
  9. package/src/{@claude-flow → packages}/cli/dist/src/init/moflo-init.js +764 -764
  10. package/src/{@claude-flow → packages}/cli/dist/src/version.js +1 -1
  11. package/src/{@claude-flow → packages}/cli/package.json +1 -1
  12. package/.claude/agents/dual-mode/codex-coordinator.md +0 -224
  13. package/.claude/agents/dual-mode/codex-worker.md +0 -211
  14. package/.claude/agents/dual-mode/dual-orchestrator.md +0 -291
  15. package/.claude/agents/payments/agentic-payments.md +0 -126
  16. package/.claude/agents/sublinear/consensus-coordinator.md +0 -338
  17. package/.claude/agents/sublinear/matrix-optimizer.md +0 -185
  18. package/.claude/agents/sublinear/pagerank-analyzer.md +0 -299
  19. package/.claude/agents/sublinear/performance-optimizer.md +0 -368
  20. package/.claude/agents/sublinear/trading-predictor.md +0 -246
  21. package/.claude/agents/templates/automation-smart-agent.md +0 -205
  22. package/.claude/agents/templates/coordinator-swarm-init.md +0 -105
  23. package/.claude/agents/templates/github-pr-manager.md +0 -177
  24. package/.claude/agents/templates/implementer-sparc-coder.md +0 -259
  25. package/.claude/agents/templates/memory-coordinator.md +0 -187
  26. package/.claude/agents/templates/migration-plan.md +0 -746
  27. package/.claude/agents/templates/orchestrator-task.md +0 -139
  28. package/.claude/agents/templates/performance-analyzer.md +0 -199
  29. package/.claude/agents/templates/sparc-coordinator.md +0 -183
  30. package/.claude/commands/agents/README.md +0 -10
  31. package/.claude/commands/agents/agent-capabilities.md +0 -21
  32. package/.claude/commands/agents/agent-coordination.md +0 -28
  33. package/.claude/commands/agents/agent-spawning.md +0 -28
  34. package/.claude/commands/agents/agent-types.md +0 -26
  35. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +0 -54
  36. package/.claude/commands/analysis/README.md +0 -9
  37. package/.claude/commands/analysis/bottleneck-detect.md +0 -162
  38. package/.claude/commands/analysis/performance-bottlenecks.md +0 -59
  39. package/.claude/commands/analysis/performance-report.md +0 -25
  40. package/.claude/commands/analysis/token-efficiency.md +0 -45
  41. package/.claude/commands/analysis/token-usage.md +0 -25
  42. package/.claude/commands/automation/README.md +0 -9
  43. package/.claude/commands/automation/auto-agent.md +0 -122
  44. package/.claude/commands/automation/self-healing.md +0 -106
  45. package/.claude/commands/automation/session-memory.md +0 -90
  46. package/.claude/commands/automation/smart-agents.md +0 -73
  47. package/.claude/commands/automation/smart-spawn.md +0 -25
  48. package/.claude/commands/automation/workflow-select.md +0 -25
  49. package/.claude/commands/monitoring/README.md +0 -9
  50. package/.claude/commands/monitoring/agent-metrics.md +0 -25
  51. package/.claude/commands/monitoring/agents.md +0 -44
  52. package/.claude/commands/monitoring/real-time-view.md +0 -25
  53. package/.claude/commands/monitoring/status.md +0 -46
  54. package/.claude/commands/monitoring/swarm-monitor.md +0 -25
  55. package/.claude/commands/optimization/README.md +0 -9
  56. package/.claude/commands/optimization/auto-topology.md +0 -62
  57. package/.claude/commands/optimization/cache-manage.md +0 -25
  58. package/.claude/commands/optimization/parallel-execute.md +0 -25
  59. package/.claude/commands/optimization/parallel-execution.md +0 -50
  60. package/.claude/commands/optimization/topology-optimize.md +0 -25
  61. package/.claude/scripts/build-embeddings.mjs +0 -549
  62. package/.claude/scripts/generate-code-map.mjs +0 -956
  63. package/.claude/scripts/hooks.mjs +0 -607
  64. package/.claude/scripts/index-all.mjs +0 -193
  65. package/.claude/scripts/index-guidance.mjs +0 -917
  66. package/.claude/scripts/index-tests.mjs +0 -729
  67. package/.claude/scripts/lib/moflo-resolve.mjs +0 -14
  68. package/.claude/scripts/lib/process-manager.mjs +0 -256
  69. package/.claude/scripts/lib/registry-cleanup.cjs +0 -41
  70. package/.claude/scripts/semantic-search.mjs +0 -473
  71. package/.claude/scripts/session-start-launcher.mjs +0 -272
  72. package/src/@claude-flow/cli/dist/src/commands/orc.js +0 -767
  73. package/src/@claude-flow/cli/dist/src/services/container-worker-pool.js +0 -584
  74. package/src/@claude-flow/memory/dist/hybrid-backend.js +0 -569
  75. package/src/@claude-flow/memory/dist/hybrid-backend.test.js +0 -320
  76. package/src/@claude-flow/memory/dist/sqlite-backend.js +0 -572
  77. /package/src/{@claude-flow → packages}/cli/README.md +0 -0
  78. /package/src/{@claude-flow → packages}/cli/bin/cli.js +0 -0
  79. /package/src/{@claude-flow → packages}/cli/bin/mcp-server.js +0 -0
  80. /package/src/{@claude-flow → packages}/cli/bin/preinstall.cjs +0 -0
  81. /package/src/{@claude-flow → packages}/cli/dist/src/appliance/gguf-engine.js +0 -0
  82. /package/src/{@claude-flow → packages}/cli/dist/src/appliance/ruvllm-bridge.js +0 -0
  83. /package/src/{@claude-flow → packages}/cli/dist/src/appliance/rvfa-builder.js +0 -0
  84. /package/src/{@claude-flow → packages}/cli/dist/src/appliance/rvfa-distribution.js +0 -0
  85. /package/src/{@claude-flow → packages}/cli/dist/src/appliance/rvfa-format.js +0 -0
  86. /package/src/{@claude-flow → packages}/cli/dist/src/appliance/rvfa-runner.js +0 -0
  87. /package/src/{@claude-flow → packages}/cli/dist/src/appliance/rvfa-signing.js +0 -0
  88. /package/src/{@claude-flow → packages}/cli/dist/src/benchmarks/pretrain/index.js +0 -0
  89. /package/src/{@claude-flow → packages}/cli/dist/src/commands/agent.js +0 -0
  90. /package/src/{@claude-flow → packages}/cli/dist/src/commands/analyze.js +0 -0
  91. /package/src/{@claude-flow → packages}/cli/dist/src/commands/appliance-advanced.js +0 -0
  92. /package/src/{@claude-flow → packages}/cli/dist/src/commands/appliance.js +0 -0
  93. /package/src/{@claude-flow → packages}/cli/dist/src/commands/benchmark.js +0 -0
  94. /package/src/{@claude-flow → packages}/cli/dist/src/commands/claims.js +0 -0
  95. /package/src/{@claude-flow → packages}/cli/dist/src/commands/completions.js +0 -0
  96. /package/src/{@claude-flow → packages}/cli/dist/src/commands/config.js +0 -0
  97. /package/src/{@claude-flow → packages}/cli/dist/src/commands/daemon.js +0 -0
  98. /package/src/{@claude-flow → packages}/cli/dist/src/commands/deployment.js +0 -0
  99. /package/src/{@claude-flow → packages}/cli/dist/src/commands/diagnose.js +0 -0
  100. /package/src/{@claude-flow → packages}/cli/dist/src/commands/doctor.js +0 -0
  101. /package/src/{@claude-flow → packages}/cli/dist/src/commands/embeddings.js +0 -0
  102. /package/src/{@claude-flow → packages}/cli/dist/src/commands/epic.js +0 -0
  103. /package/src/{@claude-flow → packages}/cli/dist/src/commands/gate.js +0 -0
  104. /package/src/{@claude-flow → packages}/cli/dist/src/commands/github.js +0 -0
  105. /package/src/{@claude-flow → packages}/cli/dist/src/commands/guidance.js +0 -0
  106. /package/src/{@claude-flow → packages}/cli/dist/src/commands/hive-mind.js +0 -0
  107. /package/src/{@claude-flow → packages}/cli/dist/src/commands/hooks.js +0 -0
  108. /package/src/{@claude-flow → packages}/cli/dist/src/commands/index.js +0 -0
  109. /package/src/{@claude-flow → packages}/cli/dist/src/commands/init.js +0 -0
  110. /package/src/{@claude-flow → packages}/cli/dist/src/commands/issues.js +0 -0
  111. /package/src/{@claude-flow → packages}/cli/dist/src/commands/mcp.js +0 -0
  112. /package/src/{@claude-flow → packages}/cli/dist/src/commands/memory.js +0 -0
  113. /package/src/{@claude-flow → packages}/cli/dist/src/commands/migrate.js +0 -0
  114. /package/src/{@claude-flow → packages}/cli/dist/src/commands/neural.js +0 -0
  115. /package/src/{@claude-flow → packages}/cli/dist/src/commands/performance.js +0 -0
  116. /package/src/{@claude-flow → packages}/cli/dist/src/commands/plugins.js +0 -0
  117. /package/src/{@claude-flow → packages}/cli/dist/src/commands/process.js +0 -0
  118. /package/src/{@claude-flow → packages}/cli/dist/src/commands/progress.js +0 -0
  119. /package/src/{@claude-flow → packages}/cli/dist/src/commands/providers.js +0 -0
  120. /package/src/{@claude-flow → packages}/cli/dist/src/commands/route.js +0 -0
  121. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/backup.js +0 -0
  122. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/benchmark.js +0 -0
  123. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/import.js +0 -0
  124. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/index.js +0 -0
  125. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/init.js +0 -0
  126. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/migrate.js +0 -0
  127. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/optimize.js +0 -0
  128. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/setup.js +0 -0
  129. /package/src/{@claude-flow → packages}/cli/dist/src/commands/ruvector/status.js +0 -0
  130. /package/src/{@claude-flow → packages}/cli/dist/src/commands/security.js +0 -0
  131. /package/src/{@claude-flow → packages}/cli/dist/src/commands/session.js +0 -0
  132. /package/src/{@claude-flow → packages}/cli/dist/src/commands/start.js +0 -0
  133. /package/src/{@claude-flow → packages}/cli/dist/src/commands/status.js +0 -0
  134. /package/src/{@claude-flow → packages}/cli/dist/src/commands/swarm.js +0 -0
  135. /package/src/{@claude-flow → packages}/cli/dist/src/commands/task.js +0 -0
  136. /package/src/{@claude-flow → packages}/cli/dist/src/commands/transfer-store.js +0 -0
  137. /package/src/{@claude-flow → packages}/cli/dist/src/commands/update.js +0 -0
  138. /package/src/{@claude-flow → packages}/cli/dist/src/commands/workflow.js +0 -0
  139. /package/src/{@claude-flow → packages}/cli/dist/src/config/moflo-config.js +0 -0
  140. /package/src/{@claude-flow → packages}/cli/dist/src/config-adapter.js +0 -0
  141. /package/src/{@claude-flow → packages}/cli/dist/src/index.js +0 -0
  142. /package/src/{@claude-flow → packages}/cli/dist/src/infrastructure/in-memory-repositories.js +0 -0
  143. /package/src/{@claude-flow → packages}/cli/dist/src/init/helpers-generator.js +0 -0
  144. /package/src/{@claude-flow → packages}/cli/dist/src/init/index.js +0 -0
  145. /package/src/{@claude-flow → packages}/cli/dist/src/init/mcp-generator.js +0 -0
  146. /package/src/{@claude-flow → packages}/cli/dist/src/init/settings-generator.js +0 -0
  147. /package/src/{@claude-flow → packages}/cli/dist/src/init/statusline-generator.js +0 -0
  148. /package/src/{@claude-flow → packages}/cli/dist/src/init/types.js +0 -0
  149. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-client.js +0 -0
  150. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-server.js +0 -0
  151. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/agent-tools.js +0 -0
  152. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/agentdb-tools.js +0 -0
  153. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/analyze-tools.js +0 -0
  154. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/auto-install.js +0 -0
  155. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/browser-tools.js +0 -0
  156. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/claims-tools.js +0 -0
  157. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/config-tools.js +0 -0
  158. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/coordination-tools.js +0 -0
  159. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/daa-tools.js +0 -0
  160. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/embeddings-tools.js +0 -0
  161. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/github-tools.js +0 -0
  162. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/hive-mind-tools.js +0 -0
  163. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/hooks-tools.js +0 -0
  164. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/index.js +0 -0
  165. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/memory-tools.js +0 -0
  166. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/neural-tools.js +0 -0
  167. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/performance-tools.js +0 -0
  168. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/progress-tools.js +0 -0
  169. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/security-tools.js +0 -0
  170. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/session-tools.js +0 -0
  171. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/swarm-tools.js +0 -0
  172. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/system-tools.js +0 -0
  173. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/task-tools.js +0 -0
  174. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/terminal-tools.js +0 -0
  175. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/transfer-tools.js +0 -0
  176. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/types.js +0 -0
  177. /package/src/{@claude-flow → packages}/cli/dist/src/mcp-tools/workflow-tools.js +0 -0
  178. /package/src/{@claude-flow → packages}/cli/dist/src/memory/ewc-consolidation.js +0 -0
  179. /package/src/{@claude-flow → packages}/cli/dist/src/memory/intelligence.js +0 -0
  180. /package/src/{@claude-flow → packages}/cli/dist/src/memory/memory-bridge.js +0 -0
  181. /package/src/{@claude-flow → packages}/cli/dist/src/memory/memory-initializer.js +0 -0
  182. /package/src/{@claude-flow → packages}/cli/dist/src/memory/sona-optimizer.js +0 -0
  183. /package/src/{@claude-flow → packages}/cli/dist/src/output.js +0 -0
  184. /package/src/{@claude-flow → packages}/cli/dist/src/parser.js +0 -0
  185. /package/src/{@claude-flow → packages}/cli/dist/src/plugins/manager.js +0 -0
  186. /package/src/{@claude-flow → packages}/cli/dist/src/plugins/store/discovery.js +0 -0
  187. /package/src/{@claude-flow → packages}/cli/dist/src/plugins/store/index.js +0 -0
  188. /package/src/{@claude-flow → packages}/cli/dist/src/plugins/store/search.js +0 -0
  189. /package/src/{@claude-flow → packages}/cli/dist/src/plugins/store/types.js +0 -0
  190. /package/src/{@claude-flow → packages}/cli/dist/src/plugins/tests/demo-plugin-store.js +0 -0
  191. /package/src/{@claude-flow → packages}/cli/dist/src/plugins/tests/standalone-test.js +0 -0
  192. /package/src/{@claude-flow → packages}/cli/dist/src/plugins/tests/test-plugin-store.js +0 -0
  193. /package/src/{@claude-flow → packages}/cli/dist/src/production/circuit-breaker.js +0 -0
  194. /package/src/{@claude-flow → packages}/cli/dist/src/production/error-handler.js +0 -0
  195. /package/src/{@claude-flow → packages}/cli/dist/src/production/index.js +0 -0
  196. /package/src/{@claude-flow → packages}/cli/dist/src/production/monitoring.js +0 -0
  197. /package/src/{@claude-flow → packages}/cli/dist/src/production/rate-limiter.js +0 -0
  198. /package/src/{@claude-flow → packages}/cli/dist/src/production/retry.js +0 -0
  199. /package/src/{@claude-flow → packages}/cli/dist/src/prompt.js +0 -0
  200. /package/src/{@claude-flow → packages}/cli/dist/src/runtime/headless.js +0 -0
  201. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/ast-analyzer.js +0 -0
  202. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/coverage-router.js +0 -0
  203. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/coverage-tools.js +0 -0
  204. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/diff-classifier.js +0 -0
  205. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/enhanced-model-router.js +0 -0
  206. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/flash-attention.js +0 -0
  207. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/graph-analyzer.js +0 -0
  208. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/index.js +0 -0
  209. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/lora-adapter.js +0 -0
  210. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/model-router.js +0 -0
  211. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/moe-router.js +0 -0
  212. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/q-learning-router.js +0 -0
  213. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/semantic-router.js +0 -0
  214. /package/src/{@claude-flow → packages}/cli/dist/src/ruvector/vector-db.js +0 -0
  215. /package/src/{@claude-flow → packages}/cli/dist/src/services/agent-router.js +0 -0
  216. /package/src/{@claude-flow → packages}/cli/dist/src/services/agentic-flow-bridge.js +0 -0
  217. /package/src/{@claude-flow → packages}/cli/dist/src/services/claim-service.js +0 -0
  218. /package/src/{@claude-flow → packages}/cli/dist/src/services/daemon-lock.js +0 -0
  219. /package/src/{@claude-flow → packages}/cli/dist/src/services/headless-worker-executor.js +0 -0
  220. /package/src/{@claude-flow → packages}/cli/dist/src/services/index.js +0 -0
  221. /package/src/{@claude-flow → packages}/cli/dist/src/services/learning-service.js +0 -0
  222. /package/src/{@claude-flow → packages}/cli/dist/src/services/moflo-require.js +0 -0
  223. /package/src/{@claude-flow → packages}/cli/dist/src/services/registry-api.js +0 -0
  224. /package/src/{@claude-flow → packages}/cli/dist/src/services/ruvector-training.js +0 -0
  225. /package/src/{@claude-flow → packages}/cli/dist/src/services/worker-daemon.js +0 -0
  226. /package/src/{@claude-flow → packages}/cli/dist/src/services/worker-queue.js +0 -0
  227. /package/src/{@claude-flow → packages}/cli/dist/src/services/workflow-gate.js +0 -0
  228. /package/src/{@claude-flow → packages}/cli/dist/src/suggest.js +0 -0
  229. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/anonymization/index.js +0 -0
  230. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/deploy-seraphine.js +0 -0
  231. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/export.js +0 -0
  232. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/index.js +0 -0
  233. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/ipfs/client.js +0 -0
  234. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/ipfs/upload.js +0 -0
  235. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/models/seraphine.js +0 -0
  236. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/serialization/cfp.js +0 -0
  237. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/storage/gcs.js +0 -0
  238. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/storage/index.js +0 -0
  239. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/store/discovery.js +0 -0
  240. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/store/download.js +0 -0
  241. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/store/index.js +0 -0
  242. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/store/publish.js +0 -0
  243. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/store/registry.js +0 -0
  244. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/store/search.js +0 -0
  245. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/store/tests/standalone-test.js +0 -0
  246. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/store/types.js +0 -0
  247. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/test-seraphine.js +0 -0
  248. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/tests/test-store.js +0 -0
  249. /package/src/{@claude-flow → packages}/cli/dist/src/transfer/types.js +0 -0
  250. /package/src/{@claude-flow → packages}/cli/dist/src/types.js +0 -0
  251. /package/src/{@claude-flow → packages}/cli/dist/src/update/checker.js +0 -0
  252. /package/src/{@claude-flow → packages}/cli/dist/src/update/executor.js +0 -0
  253. /package/src/{@claude-flow → packages}/cli/dist/src/update/index.js +0 -0
  254. /package/src/{@claude-flow → packages}/cli/dist/src/update/rate-limiter.js +0 -0
  255. /package/src/{@claude-flow → packages}/cli/dist/src/update/validator.js +0 -0
  256. /package/src/{@claude-flow → packages}/guidance/README.md +0 -0
  257. /package/src/{@claude-flow → packages}/guidance/dist/adversarial.js +0 -0
  258. /package/src/{@claude-flow → packages}/guidance/dist/analyzer.js +0 -0
  259. /package/src/{@claude-flow → packages}/guidance/dist/artifacts.js +0 -0
  260. /package/src/{@claude-flow → packages}/guidance/dist/authority.js +0 -0
  261. /package/src/{@claude-flow → packages}/guidance/dist/capabilities.js +0 -0
  262. /package/src/{@claude-flow → packages}/guidance/dist/coherence.js +0 -0
  263. /package/src/{@claude-flow → packages}/guidance/dist/compiler.js +0 -0
  264. /package/src/{@claude-flow → packages}/guidance/dist/conformance-kit.js +0 -0
  265. /package/src/{@claude-flow → packages}/guidance/dist/continue-gate.js +0 -0
  266. /package/src/{@claude-flow → packages}/guidance/dist/crypto-utils.js +0 -0
  267. /package/src/{@claude-flow → packages}/guidance/dist/evolution.js +0 -0
  268. /package/src/{@claude-flow → packages}/guidance/dist/gates.js +0 -0
  269. /package/src/{@claude-flow → packages}/guidance/dist/gateway.js +0 -0
  270. /package/src/{@claude-flow → packages}/guidance/dist/generators.js +0 -0
  271. /package/src/{@claude-flow → packages}/guidance/dist/headless.js +0 -0
  272. /package/src/{@claude-flow → packages}/guidance/dist/hooks.js +0 -0
  273. /package/src/{@claude-flow → packages}/guidance/dist/index.js +0 -0
  274. /package/src/{@claude-flow → packages}/guidance/dist/ledger.js +0 -0
  275. /package/src/{@claude-flow → packages}/guidance/dist/manifest-validator.js +0 -0
  276. /package/src/{@claude-flow → packages}/guidance/dist/memory-gate.js +0 -0
  277. /package/src/{@claude-flow → packages}/guidance/dist/meta-governance.js +0 -0
  278. /package/src/{@claude-flow → packages}/guidance/dist/optimizer.js +0 -0
  279. /package/src/{@claude-flow → packages}/guidance/dist/persistence.js +0 -0
  280. /package/src/{@claude-flow → packages}/guidance/dist/proof.js +0 -0
  281. /package/src/{@claude-flow → packages}/guidance/dist/retriever.js +0 -0
  282. /package/src/{@claude-flow → packages}/guidance/dist/ruvbot-integration.js +0 -0
  283. /package/src/{@claude-flow → packages}/guidance/dist/temporal.js +0 -0
  284. /package/src/{@claude-flow → packages}/guidance/dist/trust.js +0 -0
  285. /package/src/{@claude-flow → packages}/guidance/dist/truth-anchors.js +0 -0
  286. /package/src/{@claude-flow → packages}/guidance/dist/types.js +0 -0
  287. /package/src/{@claude-flow → packages}/guidance/dist/uncertainty.js +0 -0
  288. /package/src/{@claude-flow → packages}/guidance/dist/wasm-kernel.js +0 -0
  289. /package/src/{@claude-flow → packages}/guidance/package.json +0 -0
  290. /package/src/{@claude-flow → packages}/memory/README.md +0 -0
  291. /package/src/{@claude-flow → packages}/memory/dist/agent-memory-scope.js +0 -0
  292. /package/src/{@claude-flow → packages}/memory/dist/agent-memory-scope.test.js +0 -0
  293. /package/src/{@claude-flow → packages}/memory/dist/agentdb-adapter.js +0 -0
  294. /package/src/{@claude-flow → packages}/memory/dist/agentdb-backend.js +0 -0
  295. /package/src/{@claude-flow → packages}/memory/dist/agentdb-backend.test.js +0 -0
  296. /package/src/{@claude-flow → packages}/memory/dist/application/commands/delete-memory.command.js +0 -0
  297. /package/src/{@claude-flow → packages}/memory/dist/application/commands/store-memory.command.js +0 -0
  298. /package/src/{@claude-flow → packages}/memory/dist/application/index.js +0 -0
  299. /package/src/{@claude-flow → packages}/memory/dist/application/queries/search-memory.query.js +0 -0
  300. /package/src/{@claude-flow → packages}/memory/dist/application/services/memory-application-service.js +0 -0
  301. /package/src/{@claude-flow → packages}/memory/dist/auto-memory-bridge.js +0 -0
  302. /package/src/{@claude-flow → packages}/memory/dist/auto-memory-bridge.test.js +0 -0
  303. /package/src/{@claude-flow → packages}/memory/dist/benchmark.test.js +0 -0
  304. /package/src/{@claude-flow → packages}/memory/dist/cache-manager.js +0 -0
  305. /package/src/{@claude-flow → packages}/memory/dist/controller-registry.js +0 -0
  306. /package/src/{@claude-flow → packages}/memory/dist/controller-registry.test.js +0 -0
  307. /package/src/{@claude-flow → packages}/memory/dist/database-provider.js +0 -0
  308. /package/src/{@claude-flow → packages}/memory/dist/database-provider.test.js +0 -0
  309. /package/src/{@claude-flow → packages}/memory/dist/domain/entities/memory-entry.js +0 -0
  310. /package/src/{@claude-flow → packages}/memory/dist/domain/index.js +0 -0
  311. /package/src/{@claude-flow → packages}/memory/dist/domain/repositories/memory-repository.interface.js +0 -0
  312. /package/src/{@claude-flow → packages}/memory/dist/domain/services/memory-domain-service.js +0 -0
  313. /package/src/{@claude-flow → packages}/memory/dist/hnsw-index.js +0 -0
  314. /package/src/{@claude-flow → packages}/memory/dist/hnsw-lite.js +0 -0
  315. /package/src/{@claude-flow → packages}/memory/dist/index.js +0 -0
  316. /package/src/{@claude-flow → packages}/memory/dist/infrastructure/index.js +0 -0
  317. /package/src/{@claude-flow → packages}/memory/dist/infrastructure/repositories/hybrid-memory-repository.js +0 -0
  318. /package/src/{@claude-flow → packages}/memory/dist/learning-bridge.js +0 -0
  319. /package/src/{@claude-flow → packages}/memory/dist/learning-bridge.test.js +0 -0
  320. /package/src/{@claude-flow → packages}/memory/dist/memory-graph.js +0 -0
  321. /package/src/{@claude-flow → packages}/memory/dist/memory-graph.test.js +0 -0
  322. /package/src/{@claude-flow → packages}/memory/dist/migration.js +0 -0
  323. /package/src/{@claude-flow → packages}/memory/dist/persistent-sona.js +0 -0
  324. /package/src/{@claude-flow → packages}/memory/dist/query-builder.js +0 -0
  325. /package/src/{@claude-flow → packages}/memory/dist/rvf-backend.js +0 -0
  326. /package/src/{@claude-flow → packages}/memory/dist/rvf-learning-store.js +0 -0
  327. /package/src/{@claude-flow → packages}/memory/dist/rvf-migration.js +0 -0
  328. /package/src/{@claude-flow → packages}/memory/dist/sqljs-backend.js +0 -0
  329. /package/src/{@claude-flow → packages}/memory/dist/types.js +0 -0
  330. /package/src/{@claude-flow → packages}/memory/package.json +0 -0
  331. /package/src/{@claude-flow → packages}/neural/README.md +0 -0
  332. /package/src/{@claude-flow → packages}/neural/dist/algorithms/a2c.js +0 -0
  333. /package/src/{@claude-flow → packages}/neural/dist/algorithms/curiosity.js +0 -0
  334. /package/src/{@claude-flow → packages}/neural/dist/algorithms/decision-transformer.js +0 -0
  335. /package/src/{@claude-flow → packages}/neural/dist/algorithms/dqn.js +0 -0
  336. /package/src/{@claude-flow → packages}/neural/dist/algorithms/index.js +0 -0
  337. /package/src/{@claude-flow → packages}/neural/dist/algorithms/ppo.js +0 -0
  338. /package/src/{@claude-flow → packages}/neural/dist/algorithms/q-learning.js +0 -0
  339. /package/src/{@claude-flow → packages}/neural/dist/algorithms/sarsa.js +0 -0
  340. /package/src/{@claude-flow → packages}/neural/dist/application/index.js +0 -0
  341. /package/src/{@claude-flow → packages}/neural/dist/application/services/neural-application-service.js +0 -0
  342. /package/src/{@claude-flow → packages}/neural/dist/domain/entities/pattern.js +0 -0
  343. /package/src/{@claude-flow → packages}/neural/dist/domain/index.js +0 -0
  344. /package/src/{@claude-flow → packages}/neural/dist/domain/services/learning-service.js +0 -0
  345. /package/src/{@claude-flow → packages}/neural/dist/index.js +0 -0
  346. /package/src/{@claude-flow → packages}/neural/dist/modes/balanced.js +0 -0
  347. /package/src/{@claude-flow → packages}/neural/dist/modes/base.js +0 -0
  348. /package/src/{@claude-flow → packages}/neural/dist/modes/batch.js +0 -0
  349. /package/src/{@claude-flow → packages}/neural/dist/modes/edge.js +0 -0
  350. /package/src/{@claude-flow → packages}/neural/dist/modes/index.js +0 -0
  351. /package/src/{@claude-flow → packages}/neural/dist/modes/real-time.js +0 -0
  352. /package/src/{@claude-flow → packages}/neural/dist/modes/research.js +0 -0
  353. /package/src/{@claude-flow → packages}/neural/dist/pattern-learner.js +0 -0
  354. /package/src/{@claude-flow → packages}/neural/dist/reasoning-bank.js +0 -0
  355. /package/src/{@claude-flow → packages}/neural/dist/reasoningbank-adapter.js +0 -0
  356. /package/src/{@claude-flow → packages}/neural/dist/sona-integration.js +0 -0
  357. /package/src/{@claude-flow → packages}/neural/dist/sona-manager.js +0 -0
  358. /package/src/{@claude-flow → packages}/neural/dist/types.js +0 -0
  359. /package/src/{@claude-flow → packages}/neural/package.json +0 -0
  360. /package/src/{@claude-flow → packages}/shared/README.md +0 -0
  361. /package/src/{@claude-flow → packages}/shared/dist/core/config/defaults.js +0 -0
  362. /package/src/{@claude-flow → packages}/shared/dist/core/config/index.js +0 -0
  363. /package/src/{@claude-flow → packages}/shared/dist/core/config/loader.js +0 -0
  364. /package/src/{@claude-flow → packages}/shared/dist/core/config/schema.js +0 -0
  365. /package/src/{@claude-flow → packages}/shared/dist/core/config/validator.js +0 -0
  366. /package/src/{@claude-flow → packages}/shared/dist/core/event-bus.js +0 -0
  367. /package/src/{@claude-flow → packages}/shared/dist/core/index.js +0 -0
  368. /package/src/{@claude-flow → packages}/shared/dist/core/interfaces/agent.interface.js +0 -0
  369. /package/src/{@claude-flow → packages}/shared/dist/core/interfaces/coordinator.interface.js +0 -0
  370. /package/src/{@claude-flow → packages}/shared/dist/core/interfaces/event.interface.js +0 -0
  371. /package/src/{@claude-flow → packages}/shared/dist/core/interfaces/index.js +0 -0
  372. /package/src/{@claude-flow → packages}/shared/dist/core/interfaces/memory.interface.js +0 -0
  373. /package/src/{@claude-flow → packages}/shared/dist/core/interfaces/task.interface.js +0 -0
  374. /package/src/{@claude-flow → packages}/shared/dist/core/orchestrator/event-coordinator.js +0 -0
  375. /package/src/{@claude-flow → packages}/shared/dist/core/orchestrator/health-monitor.js +0 -0
  376. /package/src/{@claude-flow → packages}/shared/dist/core/orchestrator/index.js +0 -0
  377. /package/src/{@claude-flow → packages}/shared/dist/core/orchestrator/lifecycle-manager.js +0 -0
  378. /package/src/{@claude-flow → packages}/shared/dist/core/orchestrator/session-manager.js +0 -0
  379. /package/src/{@claude-flow → packages}/shared/dist/core/orchestrator/task-manager.js +0 -0
  380. /package/src/{@claude-flow → packages}/shared/dist/events/domain-events.js +0 -0
  381. /package/src/{@claude-flow → packages}/shared/dist/events/event-store.js +0 -0
  382. /package/src/{@claude-flow → packages}/shared/dist/events/event-store.test.js +0 -0
  383. /package/src/{@claude-flow → packages}/shared/dist/events/example-usage.js +0 -0
  384. /package/src/{@claude-flow → packages}/shared/dist/events/index.js +0 -0
  385. /package/src/{@claude-flow → packages}/shared/dist/events/projections.js +0 -0
  386. /package/src/{@claude-flow → packages}/shared/dist/events/rvf-event-log.js +0 -0
  387. /package/src/{@claude-flow → packages}/shared/dist/events/state-reconstructor.js +0 -0
  388. /package/src/{@claude-flow → packages}/shared/dist/events.js +0 -0
  389. /package/src/{@claude-flow → packages}/shared/dist/hooks/example-usage.js +0 -0
  390. /package/src/{@claude-flow → packages}/shared/dist/hooks/executor.js +0 -0
  391. /package/src/{@claude-flow → packages}/shared/dist/hooks/hooks.test.js +0 -0
  392. /package/src/{@claude-flow → packages}/shared/dist/hooks/index.js +0 -0
  393. /package/src/{@claude-flow → packages}/shared/dist/hooks/registry.js +0 -0
  394. /package/src/{@claude-flow → packages}/shared/dist/hooks/safety/bash-safety.js +0 -0
  395. /package/src/{@claude-flow → packages}/shared/dist/hooks/safety/file-organization.js +0 -0
  396. /package/src/{@claude-flow → packages}/shared/dist/hooks/safety/git-commit.js +0 -0
  397. /package/src/{@claude-flow → packages}/shared/dist/hooks/safety/index.js +0 -0
  398. /package/src/{@claude-flow → packages}/shared/dist/hooks/session-hooks.js +0 -0
  399. /package/src/{@claude-flow → packages}/shared/dist/hooks/task-hooks.js +0 -0
  400. /package/src/{@claude-flow → packages}/shared/dist/hooks/types.js +0 -0
  401. /package/src/{@claude-flow → packages}/shared/dist/hooks/verify-exports.test.js +0 -0
  402. /package/src/{@claude-flow → packages}/shared/dist/index.js +0 -0
  403. /package/src/{@claude-flow → packages}/shared/dist/mcp/connection-pool.js +0 -0
  404. /package/src/{@claude-flow → packages}/shared/dist/mcp/index.js +0 -0
  405. /package/src/{@claude-flow → packages}/shared/dist/mcp/server.js +0 -0
  406. /package/src/{@claude-flow → packages}/shared/dist/mcp/session-manager.js +0 -0
  407. /package/src/{@claude-flow → packages}/shared/dist/mcp/tool-registry.js +0 -0
  408. /package/src/{@claude-flow → packages}/shared/dist/mcp/transport/http.js +0 -0
  409. /package/src/{@claude-flow → packages}/shared/dist/mcp/transport/index.js +0 -0
  410. /package/src/{@claude-flow → packages}/shared/dist/mcp/transport/stdio.js +0 -0
  411. /package/src/{@claude-flow → packages}/shared/dist/mcp/transport/websocket.js +0 -0
  412. /package/src/{@claude-flow → packages}/shared/dist/mcp/types.js +0 -0
  413. /package/src/{@claude-flow → packages}/shared/dist/plugin-interface.js +0 -0
  414. /package/src/{@claude-flow → packages}/shared/dist/plugin-loader.js +0 -0
  415. /package/src/{@claude-flow → packages}/shared/dist/plugin-registry.js +0 -0
  416. /package/src/{@claude-flow → packages}/shared/dist/plugins/index.js +0 -0
  417. /package/src/{@claude-flow → packages}/shared/dist/plugins/official/hive-mind-plugin.js +0 -0
  418. /package/src/{@claude-flow → packages}/shared/dist/plugins/official/index.js +0 -0
  419. /package/src/{@claude-flow → packages}/shared/dist/plugins/official/maestro-plugin.js +0 -0
  420. /package/src/{@claude-flow → packages}/shared/dist/plugins/types.js +0 -0
  421. /package/src/{@claude-flow → packages}/shared/dist/resilience/bulkhead.js +0 -0
  422. /package/src/{@claude-flow → packages}/shared/dist/resilience/circuit-breaker.js +0 -0
  423. /package/src/{@claude-flow → packages}/shared/dist/resilience/index.js +0 -0
  424. /package/src/{@claude-flow → packages}/shared/dist/resilience/rate-limiter.js +0 -0
  425. /package/src/{@claude-flow → packages}/shared/dist/resilience/retry.js +0 -0
  426. /package/src/{@claude-flow → packages}/shared/dist/security/index.js +0 -0
  427. /package/src/{@claude-flow → packages}/shared/dist/security/input-validation.js +0 -0
  428. /package/src/{@claude-flow → packages}/shared/dist/security/secure-random.js +0 -0
  429. /package/src/{@claude-flow → packages}/shared/dist/services/index.js +0 -0
  430. /package/src/{@claude-flow → packages}/shared/dist/services/v3-progress.service.js +0 -0
  431. /package/src/{@claude-flow → packages}/shared/dist/types/agent.types.js +0 -0
  432. /package/src/{@claude-flow → packages}/shared/dist/types/index.js +0 -0
  433. /package/src/{@claude-flow → packages}/shared/dist/types/mcp.types.js +0 -0
  434. /package/src/{@claude-flow → packages}/shared/dist/types/memory.types.js +0 -0
  435. /package/src/{@claude-flow → packages}/shared/dist/types/swarm.types.js +0 -0
  436. /package/src/{@claude-flow → packages}/shared/dist/types/task.types.js +0 -0
  437. /package/src/{@claude-flow → packages}/shared/dist/types.js +0 -0
  438. /package/src/{@claude-flow → packages}/shared/dist/utils/secure-logger.js +0 -0
  439. /package/src/{@claude-flow → packages}/shared/package.json +0 -0
@@ -1,646 +1,646 @@
1
- # Moflo CLI & MCP Reference
2
-
3
- **Purpose:** Complete CLI and MCP reference for moflo — hooks, memory, agents, swarm, neural, and doctor commands. Read when using moflo features or debugging agent coordination.
4
-
5
- **MCP-First Policy:** Always prefer MCP tools (`mcp__moflo__*`) over CLI commands. Use `ToolSearch` to load them, then call directly. CLI is fallback only.
6
-
7
- ---
8
-
9
- ## Getting Started
10
-
11
- ### Installation
12
-
13
- ```bash
14
- npm install moflo
15
- npx flo init # Interactive setup wizard
16
- ```
17
-
18
- `flo init` does the following:
19
- 1. Creates `moflo.yaml` with detected project settings
20
- 2. Sets up `.claude/settings.json` hooks (SessionStart, pre-edit, etc.)
21
- 3. Configures `.mcp.json` for MCP tool access
22
- 4. Copies the agent bootstrap guide to `.claude/guidance/`
23
- 5. Injects a memory search section into CLAUDE.md
24
-
25
- ### Post-Install
26
-
27
- ```bash
28
- npx flo-setup # Copy bootstrap guidance, inject CLAUDE.md section
29
- npx flo doctor --fix # Verify everything is working
30
- ```
31
-
32
- ---
33
-
34
- ## Building from Source
35
-
36
- **Full instructions: [`docs/BUILD.md`](../../../docs/BUILD.md)** — the canonical, step-by-step build/test/publish process. Always follow it.
37
-
38
- Quick reference (from project root only):
39
-
40
- ```bash
41
- git pull origin main # ALWAYS pull first
42
- npm run build # tsc -b (project references)
43
- npm test # 0 failures required
44
- npm version patch --no-git-tag-version # Bump + sync cli version
45
- npm run build # Rebuild with new version
46
- npm publish --otp=XXX # Requires 2FA OTP
47
- ```
48
-
49
- **Critical rules:**
50
- - npm only — no pnpm, yarn, or bun
51
- - Always build from root (`npm run build`) — never cd into subdirectories
52
- - Never publish without a successful build — `prepublishOnly` masks failures
53
- - Never publish without tests passing
54
-
55
- ---
56
-
57
- ## Session Start Automation
58
-
59
- When a Claude Code session starts, moflo automatically runs three background indexers:
60
-
61
- | Indexer | Command | Namespace | What it does |
62
- |---------|---------|-----------|--------------|
63
- | Guidance | `npx flo-index` | `guidance` | Chunks markdown docs, builds RAG links, generates 384-dim embeddings |
64
- | Code Map | `npx flo-codemap` | `code-map` | Scans source for types, interfaces, exports, directory structure |
65
- | Learning | `npx flo-learn` | `patterns` | Pattern research on codebase for cross-session learning |
66
-
67
- These run in background and are incremental (unchanged files are skipped). Controlled by `auto_index` in `moflo.yaml`.
68
-
69
- ### Helper Script Auto-Sync
70
-
71
- On version change, `session-start-launcher.mjs` copies helper scripts from the installed moflo package to the consumer project's `.claude/helpers/` and `.claude/scripts/` directories. This ensures hooks always run the latest version.
72
-
73
- **Rule: static files, not dynamic generation.** If a helper script has no dynamic content (no per-project interpolation), it must be shipped as a pre-built static file in `bin/` and synced via the session-start file lists. Do not generate static content dynamically at runtime — it adds fragile moving parts (background `init --upgrade`, race conditions with session-start exit) and causes stale scripts when the sync list is incomplete.
74
-
75
- | Source | Target | Files |
76
- |--------|--------|-------|
77
- | `bin/` | `.claude/scripts/` | `hooks.mjs`, `session-start-launcher.mjs`, `index-guidance.mjs`, `build-embeddings.mjs`, `generate-code-map.mjs`, `semantic-search.mjs` |
78
- | `bin/` | `.claude/helpers/` | `gate.cjs`, `gate-hook.mjs`, `prompt-hook.mjs`, `hook-handler.cjs` |
79
- | `src/@claude-flow/cli/.claude/helpers/` | `.claude/helpers/` | `auto-memory-hook.mjs`, `statusline.cjs`, `pre-commit`, `post-commit` |
80
-
81
- When adding a new helper script: generate it once, save it to `bin/`, and add it to the appropriate list in `session-start-launcher.mjs`.
82
-
83
- ### Bundled Guidance
84
-
85
- Moflo ships its own guidance files (in `.claude/guidance/` within the package). When installed as a dependency, these are **automatically indexed** alongside the consumer project's guidance under the `guidance` namespace. This means agents in your project can search for moflo system docs (swarm patterns, memory commands, etc.) without any extra setup.
86
-
87
- ---
88
-
89
- ## Bin Commands
90
-
91
- | Command | Script | Purpose |
92
- |---------|--------|---------|
93
- | `npx flo-index` | `bin/index-guidance.mjs` | Index guidance docs with RAG linking + embeddings |
94
- | `npx flo-codemap` | `bin/generate-code-map.mjs` | Generate structural code map (types, interfaces, directories) |
95
- | `npx flo-learn` | Learning service | Pattern research on codebase |
96
- | `npx flo-setup` | `bin/setup-project.mjs` | Copy bootstrap guidance, inject CLAUDE.md memory section |
97
- | `npx flo-search` | `bin/semantic-search.mjs` | Standalone semantic search with detailed output |
98
-
99
- ### Common Flags
100
-
101
- | Flag | Applies to | Effect |
102
- |------|-----------|--------|
103
- | `--force` | flo-index, flo-codemap | Reindex everything (ignore hash cache) |
104
- | `--file <path>` | flo-index | Index a specific file only |
105
- | `--no-embeddings` | flo-index | Skip embedding generation |
106
- | `--verbose` | flo-index | Show detailed chunk-level output |
107
- | `--namespace <ns>` | flo-search | Filter search to specific namespace |
108
- | `--limit <n>` | flo-search | Number of results (default: 5) |
109
-
110
- ---
111
-
112
- ## MCP Tools Setup
113
-
114
- MCP tools are the preferred way for Claude to interact with moflo. `flo init` creates a `.mcp.json` in the project root:
115
-
116
- ```json
117
- {
118
- "mcpServers": {
119
- "moflo": {
120
- "command": "node",
121
- "args": ["node_modules/moflo/src/@claude-flow/cli/bin/cli.js", "mcp", "start"]
122
- }
123
- }
124
- }
125
- ```
126
-
127
- This gives Claude access to 200+ MCP tools (`mcp__moflo__memory_*`, `mcp__moflo__hooks_*`, `mcp__moflo__swarm_*`, etc.) without any global installation.
128
-
129
- ---
130
-
131
- ## Project Config (Anti-Drift Defaults)
132
-
133
- - **Topology**: hierarchical (prevents drift)
134
- - **Max Agents**: 8 (smaller = less drift)
135
- - **Strategy**: specialized (clear roles)
136
- - **Consensus**: raft
137
- - **Memory**: hybrid
138
- - **HNSW**: Enabled
139
- - **Neural**: Enabled
140
-
141
- ---
142
-
143
- ## CLI Commands (26 Commands, 140+ Subcommands)
144
-
145
- ### Core Commands
146
-
147
- | Command | Subcommands | Description |
148
- |-------------|-------------|--------------------------------------------------------------------------|
149
- | `init` | 4 | Project initialization with wizard, presets, skills, hooks |
150
- | `agent` | 8 | Agent lifecycle (spawn, list, status, stop, metrics, pool, health, logs) |
151
- | `swarm` | 6 | Multi-agent swarm coordination and orchestration |
152
- | `memory` | 11 | AgentDB memory with vector search (150x-12,500x faster) |
153
- | `mcp` | 9 | MCP server management and tool execution |
154
- | `task` | 6 | Task creation, assignment, and lifecycle |
155
- | `session` | 7 | Session state management and persistence |
156
- | `config` | 7 | Configuration management and provider setup |
157
- | `status` | 3 | System status monitoring with watch mode |
158
- | `workflow` | 6 | Workflow execution and template management |
159
- | `hooks` | 17 | Self-learning hooks + 12 background workers |
160
- | `hive-mind` | 6 | Queen-led Byzantine fault-tolerant consensus |
161
-
162
- ### Advanced Commands
163
-
164
- | Command | Subcommands | Description |
165
- |---------------|-------------|-------------------------------------------------------------------------------|
166
- | `daemon` | 5 | Background worker daemon (start, stop, status, trigger, enable) |
167
- | `neural` | 5 | Neural pattern training (train, status, patterns, predict, optimize) |
168
- | `security` | 6 | Security scanning (scan, audit, cve, threats, validate, report) |
169
- | `performance` | 5 | Performance profiling (benchmark, profile, metrics, optimize, report) |
170
- | `providers` | 5 | AI providers (list, add, remove, test, configure) |
171
- | `plugins` | 5 | Plugin management (list, install, uninstall, enable, disable) |
172
- | `deployment` | 5 | Deployment management (deploy, rollback, status, environments, release) |
173
- | `embeddings` | 4 | Vector embeddings (embed, batch, search, init) - 75x faster with agentic-flow |
174
- | `claims` | 4 | Claims-based authorization (check, grant, revoke, list) |
175
- | `migrate` | 5 | V2 to V3 migration with rollback support |
176
- | `doctor` | 1 | System diagnostics with health checks |
177
- | `completions` | 4 | Shell completions (bash, zsh, fish, powershell) |
178
-
179
- ### Quick Examples (MCP Preferred)
180
-
181
- | Task | MCP Tool | CLI Fallback |
182
- |------|----------|-------------|
183
- | Search memory | `mcp__moflo__memory_search` | `memory search --query "..."` |
184
- | Spawn agent | `mcp__moflo__agent_spawn` | `agent spawn -t coder --name my-coder` |
185
- | Init swarm | `mcp__moflo__swarm_init` | `swarm init --v3-mode` |
186
- | System health | `mcp__moflo__system_health` | `doctor --fix` |
187
- | Benchmark | `mcp__moflo__performance_benchmark` | `performance benchmark --suite all` |
188
-
189
- **CLI-only (no MCP equivalent — setup tasks):**
190
- ```bash
191
- npx flo init --wizard
192
- npx flo daemon start
193
- ```
194
-
195
- ---
196
-
197
- ## Available Agents (60+ Types)
198
-
199
- ### Core Development
200
- `coder`, `reviewer`, `tester`, `planner`, `researcher`
201
-
202
- ### Specialized Agents
203
- `security-architect`, `security-auditor`, `memory-specialist`, `performance-engineer`
204
-
205
- ### Swarm Coordination
206
- `hierarchical-coordinator`, `mesh-coordinator`, `adaptive-coordinator`, `collective-intelligence-coordinator`, `swarm-memory-manager`
207
-
208
- ### Consensus & Distributed
209
- `byzantine-coordinator`, `raft-manager`, `gossip-coordinator`, `consensus-builder`, `crdt-synchronizer`, `quorum-manager`, `security-manager`
210
-
211
- ### Performance & Optimization
212
- `perf-analyzer`, `performance-benchmarker`, `task-orchestrator`, `memory-coordinator`, `smart-agent`
213
-
214
- ### GitHub & Repository
215
- `github-modes`, `pr-manager`, `code-review-swarm`, `issue-tracker`, `release-manager`, `workflow-automation`, `project-board-sync`, `repo-architect`, `multi-repo-swarm`
216
-
217
- ### SPARC Methodology
218
- `sparc-coord`, `sparc-coder`, `specification`, `pseudocode`, `architecture`, `refinement`
219
-
220
- ### Specialized Development
221
- `backend-dev`, `mobile-dev`, `ml-developer`, `cicd-engineer`, `api-docs`, `system-architect`, `code-analyzer`, `base-template-generator`
222
-
223
- ### Testing & Validation
224
- `tdd-london-swarm`, `production-validator`
225
-
226
- ### Agent Routing (Anti-Drift)
227
-
228
- | Code | Task | Agents |
229
- |------|-------------|-------------------------------------------------|
230
- | 1 | Bug Fix | coordinator, researcher, coder, tester |
231
- | 3 | Feature | coordinator, architect, coder, tester, reviewer |
232
- | 5 | Refactor | coordinator, architect, coder, reviewer |
233
- | 7 | Performance | coordinator, perf-engineer, coder |
234
- | 9 | Security | coordinator, security-architect, auditor |
235
- | 11 | Docs | researcher, api-docs |
236
-
237
- **Codes 1-9: hierarchical/specialized (anti-drift). Code 11: mesh/balanced**
238
-
239
- ---
240
-
241
- ## Hooks System (27 Hooks + 12 Workers)
242
-
243
- ### All Available Hooks
244
-
245
- | Hook | Description | Key Options |
246
- |--------------------|------------------------------------------|---------------------------------------------|
247
- | `pre-edit` | Get context before editing files | `--file`, `--operation` |
248
- | `post-edit` | Record editing outcome for learning | `--file`, `--success`, `--train-neural` |
249
- | `pre-command` | Assess risk before commands | `--command`, `--validate-safety` |
250
- | `post-command` | Record command execution outcome | `--command`, `--track-metrics` |
251
- | `pre-task` | Record task start, get agent suggestions | `--description`, `--coordinate-swarm` |
252
- | `post-task` | Record task completion for learning | `--task-id`, `--success`, `--store-results` |
253
- | `session-start` | Start/restore session | `--session-id`, `--auto-configure` |
254
- | `session-end` | End session and persist state | `--generate-summary`, `--export-metrics` |
255
- | `session-restore` | Restore a previous session | `--session-id`, `--latest` |
256
- | `route` | Route task to optimal agent | `--task`, `--context`, `--top-k` |
257
- | `explain` | Explain routing decision | `--topic`, `--detailed` |
258
- | `pretrain` | Bootstrap intelligence from repo | `--model-type`, `--epochs` |
259
- | `build-agents` | Generate optimized agent configs | `--agent-types`, `--focus` |
260
- | `metrics` | View learning metrics dashboard | `--v3-dashboard`, `--format` |
261
- | `transfer` | Transfer patterns via IPFS registry | `store`, `from-project` |
262
- | `intelligence` | RuVector intelligence system | `trajectory-*`, `pattern-*`, `stats` |
263
- | `worker` | Background worker management | `list`, `dispatch`, `status`, `detect` |
264
- | `coverage-route` | Route based on test coverage gaps | `--task`, `--path` |
265
- | `coverage-suggest` | Suggest coverage improvements | `--path` |
266
- | `coverage-gaps` | List coverage gaps with priorities | `--format`, `--limit` |
267
-
268
- ### 12 Background Workers
269
-
270
- | Worker | Priority | Description |
271
- |---------------|----------|----------------------------|
272
- | `ultralearn` | normal | Deep knowledge acquisition |
273
- | `optimize` | high | Performance optimization |
274
- | `consolidate` | low | Memory consolidation |
275
- | `predict` | normal | Predictive preloading |
276
- | `audit` | critical | Security analysis |
277
- | `map` | normal | Codebase mapping |
278
- | `preload` | low | Resource preloading |
279
- | `deepdive` | normal | Deep code analysis |
280
- | `document` | normal | Auto-documentation |
281
- | `refactor` | normal | Refactoring suggestions |
282
- | `benchmark` | normal | Performance benchmarking |
283
- | `testgaps` | normal | Test coverage analysis |
284
-
285
- ### Essential Hook Commands (MCP Preferred)
286
-
287
- | Hook | MCP Tool | Key Params |
288
- |------|----------|------------|
289
- | Pre-task | `mcp__moflo__hooks_pre-task` | `description` |
290
- | Post-task | `mcp__moflo__hooks_post-task` | `taskId`, `success` |
291
- | Post-edit | `mcp__moflo__hooks_post-edit` | `file`, `trainNeural` |
292
- | Session-start | `mcp__moflo__hooks_session-start` | `sessionId` |
293
- | Session-end | `mcp__moflo__hooks_session-end` | `exportMetrics` |
294
- | Route | `mcp__moflo__hooks_route` | `task` |
295
- | Worker-dispatch | `mcp__moflo__hooks_worker-dispatch` | `trigger` |
296
-
297
- ---
298
-
299
- ## Hive-Mind Consensus
300
-
301
- ### Topologies
302
- - `hierarchical` - Queen controls workers directly
303
- - `mesh` - Fully connected peer network
304
- - `hierarchical-mesh` - Hybrid (recommended)
305
- - `adaptive` - Dynamic based on load
306
-
307
- ### Consensus Strategies
308
- - `byzantine` - BFT (tolerates f < n/3 faulty)
309
- - `raft` - Leader-based (tolerates f < n/2)
310
- - `gossip` - Epidemic for eventual consistency
311
- - `crdt` - Conflict-free replicated data types
312
- - `quorum` - Configurable quorum-based
313
-
314
- ---
315
-
316
- ## RuVector Integration (HNSW Vector Search)
317
-
318
- | Feature | Performance | Description |
319
- |---------|-------------|-------------|
320
- | **HNSW Index** | 150x-12,500x faster | Hierarchical Navigable Small World search |
321
- | **MicroLoRA** | <100us adaptation | Fast model adaptation (508k+ ops/sec) |
322
- | **FlashAttention** | 2.49x-7.47x speedup | Optimized attention computation |
323
- | **Int8 Quantization** | 3.92x memory reduction | Compressed weight storage |
324
-
325
- ---
326
-
327
- ## Auto-Learning Protocol
328
-
329
- ### Before Starting Coding Tasks
330
-
331
- **MCP (Preferred):** `mcp__moflo__memory_search` — `query: "[task keywords]", namespace: "patterns"`
332
-
333
- **CLI Fallback:**
334
- ```bash
335
- npx flo memory search --query '[task keywords]' --namespace patterns
336
- ```
337
-
338
- ### After Completing Any Task Successfully (MCP Preferred)
339
-
340
- | Step | MCP Tool | Key Params |
341
- |------|----------|------------|
342
- | 1. Store pattern | `mcp__moflo__memory_store` | `namespace: "patterns", key: "[name]", value: "[what worked]"` |
343
- | 2. Train neural | `mcp__moflo__hooks_post-edit` | `file: "[main-file]", trainNeural: true` |
344
- | 3. Record completion | `mcp__moflo__hooks_post-task` | `taskId: "[id]", success: true, storeResults: true` |
345
-
346
- ### Continuous Improvement Triggers
347
-
348
- | Trigger | Worker | When to Use |
349
- |------------------------|------------|----------------------------|
350
- | After major refactor | `optimize` | Performance optimization |
351
- | After adding features | `testgaps` | Find missing test coverage |
352
- | After security changes | `audit` | Security analysis |
353
- | After API changes | `document` | Update documentation |
354
- | Every 5+ file changes | `map` | Update codebase map |
355
- | Complex debugging | `deepdive` | Deep code analysis |
356
-
357
- ### Memory-Enhanced Development
358
-
359
- **ALWAYS check memory before:**
360
- - Starting a new feature (search for similar implementations)
361
- - Debugging an issue (search for past solutions)
362
- - Refactoring code (search for learned patterns)
363
- - Performance work (search for optimization strategies)
364
-
365
- **ALWAYS store in memory after:**
366
- - Solving a tricky bug (store the solution pattern)
367
- - Completing a feature (store the approach)
368
- - Finding a performance fix (store the optimization)
369
- - Discovering a security issue (store the vulnerability pattern)
370
-
371
- ---
372
-
373
- ## Memory Commands Reference (MCP Preferred)
374
-
375
- ### Store Data
376
-
377
- **MCP:** `mcp__moflo__memory_store`
378
- - Required: `key`, `value`
379
- - Optional: `namespace` (default: "default"), `ttl`, `tags`
380
-
381
- **CLI Fallback:**
382
- ```bash
383
- npx flo memory store --key "pattern-auth" --value "JWT with refresh tokens" --namespace patterns
384
- ```
385
-
386
- ### Search Data (semantic vector search)
387
-
388
- **MCP:** `mcp__moflo__memory_search`
389
- - Required: `query`
390
- - Optional: `namespace`, `limit`, `threshold`
391
-
392
- **CLI Fallback:**
393
- ```bash
394
- npx flo memory search --query "authentication patterns" --namespace patterns --limit 5
395
- ```
396
-
397
- ### List Entries
398
-
399
- **MCP:** `mcp__moflo__memory_list`
400
- - Optional: `namespace`, `limit`
401
-
402
- ### Retrieve Specific Entry
403
-
404
- **MCP:** `mcp__moflo__memory_retrieve`
405
- - Required: `key`
406
- - Optional: `namespace` (default: "default")
407
-
408
- ---
409
-
410
- ## Claude Code vs MCP vs CLI Tools
411
-
412
- ### Claude Code Handles ALL EXECUTION:
413
- - **Task tool**: Spawn and run agents concurrently
414
- - File operations (Read, Write, Edit, Glob, Grep)
415
- - Code generation and programming
416
- - Bash commands and system operations
417
- - Git operations
418
-
419
- ### MCP Tools Handle Coordination (Preferred):
420
-
421
- | Operation | MCP Tool |
422
- |-----------|----------|
423
- | Swarm init | `mcp__moflo__swarm_init` |
424
- | Agent spawn | `mcp__moflo__agent_spawn` |
425
- | Memory store | `mcp__moflo__memory_store` |
426
- | Memory search | `mcp__moflo__memory_search` |
427
- | Hooks (all) | `mcp__moflo__hooks_<hook-name>` |
428
-
429
- ### CLI Commands (Fallback Only):
430
-
431
- Only use CLI via Bash when MCP tools are unavailable:
432
- ```bash
433
- npx flo <command> [options]
434
- ```
435
-
436
- **KEY**: MCP tools coordinate strategy, Claude Code's Task tool executes with real agents.
437
-
438
- ---
439
-
440
- ## Doctor Health Checks
441
-
442
- **MCP:** `mcp__moflo__system_health` | **CLI:** `npx flo doctor`
443
-
444
- Checks: Node version (20+), Git, config validity, daemon status, memory database, API keys, MCP servers, disk space, TypeScript.
445
-
446
- ---
447
-
448
- ## Environment Variables
449
-
450
- ```bash
451
- # Configuration
452
- CLAUDE_FLOW_CONFIG=./claude-flow.config.json
453
- CLAUDE_FLOW_LOG_LEVEL=info
454
-
455
- # MCP Server
456
- CLAUDE_FLOW_MCP_PORT=3000
457
- CLAUDE_FLOW_MCP_HOST=localhost
458
- CLAUDE_FLOW_MCP_TRANSPORT=stdio
459
-
460
- # Memory
461
- CLAUDE_FLOW_MEMORY_BACKEND=hybrid
462
- CLAUDE_FLOW_MEMORY_PATH=./data/memory
463
- ```
464
-
465
- ---
466
-
467
- ## Quick Setup
468
-
469
- ### Project-Level MCP (Recommended)
470
-
471
- Configure `.mcp.json` in the project root:
472
-
473
- ```json
474
- {
475
- "mcpServers": {
476
- "moflo": {
477
- "command": "node",
478
- "args": ["node_modules/moflo/src/@claude-flow/cli/bin/cli.js", "mcp", "start"]
479
- }
480
- }
481
- }
482
- ```
483
-
484
- ### Alternative: Global MCP Registration
485
-
486
- ```bash
487
- claude mcp add moflo -- npx @claude-flow/cli@alpha
488
- npx flo daemon start
489
- npx flo doctor --fix
490
- ```
491
-
492
- ---
493
-
494
- ## Project Configuration (moflo.yaml)
495
-
496
- Moflo reads `moflo.yaml` (or `moflo.config.json`) from the project root. All fields have sensible defaults — the file is optional.
497
-
498
- ### Full Reference
499
-
500
- ```yaml
501
- project:
502
- name: "my-project" # Project name (default: directory name)
503
-
504
- # Guidance/knowledge docs to index for semantic search
505
- guidance:
506
- directories: # Directories to scan for .md files
507
- - .claude/guidance # Default
508
- - docs/guides # Default
509
- namespace: guidance # Memory namespace for indexed docs
510
-
511
- # Source directories for code navigation map
512
- code_map:
513
- directories: # Directories to scan for source files
514
- - src # Default
515
- - packages
516
- - lib
517
- - app
518
- extensions: [".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".rs", ".java"]
519
- exclude: [node_modules, dist, .next, coverage, build, __pycache__, target, .git]
520
- namespace: code-map
521
-
522
- # Workflow gates (enforced via Claude Code hooks)
523
- gates:
524
- memory_first: true # Search memory before Glob/Grep
525
- task_create_first: true # TaskCreate before Agent tool
526
- context_tracking: true # Track context bracket (FRESH/MODERATE/DEPLETED/CRITICAL)
527
-
528
- # Auto-index on session start
529
- auto_index:
530
- guidance: true # Run flo-index (guidance RAG indexer)
531
- code_map: true # Run flo-codemap (structural code index)
532
-
533
- # Memory backend
534
- memory:
535
- backend: sql.js # sql.js (WASM) | agentdb | json
536
- embedding_model: Xenova/all-MiniLM-L6-v2 # 384-dim neural embeddings
537
- namespace: default # Default namespace for memory operations
538
-
539
- # Hook toggles (all on by default — disable to slim down)
540
- hooks:
541
- pre_edit: true # Track file edits for learning
542
- post_edit: true # Record edit outcomes, train neural patterns
543
- pre_task: true # Get agent routing before task spawn
544
- post_task: true # Record task results for learning
545
- gate: true # Workflow gate enforcement (memory-first, task-create-first)
546
- route: true # Intelligent task routing on each prompt
547
- stop_hook: true # Session-end persistence and metric export
548
- session_restore: true # Restore session state on start
549
- notification: true # Hook into Claude Code notifications
550
-
551
- # Model preferences (haiku, sonnet, opus)
552
- models:
553
- default: opus # General tasks
554
- research: sonnet # Research/exploration agents
555
- review: opus # Code review agents
556
- test: sonnet # Test-writing agents
557
-
558
- # Intelligent model routing (auto-selects haiku/sonnet/opus per task)
559
- model_routing:
560
- enabled: false # Set true to enable dynamic routing
561
- confidence_threshold: 0.85 # Min confidence before escalating
562
- cost_optimization: true # Prefer cheaper models when confident
563
- circuit_breaker: true # Penalize models that fail repeatedly
564
- # agent_overrides:
565
- # security-architect: opus
566
- # researcher: sonnet
567
-
568
- # Status line display
569
- status_line:
570
- enabled: true # Show status line at all
571
- branding: "Moflo V4" # Text in status bar
572
- mode: single-line # single-line (default) or dashboard (multi-line)
573
- show_git: true # Git branch, changes, ahead/behind
574
- show_model: true # Current model name
575
- show_session: true # Session duration
576
- show_intelligence: true # Intelligence % indicator
577
- show_swarm: true # Active swarm agents count
578
- show_hooks: true # Enabled hooks count
579
- show_mcp: true # MCP server count
580
- show_security: true # CVE/security status (dashboard only)
581
- show_adrs: true # ADR compliance (dashboard only)
582
- show_agentdb: true # AgentDB vectors/size (dashboard only)
583
- show_tests: true # Test file count (dashboard only)
584
- ```
585
-
586
- ### Key Behaviors
587
-
588
- | Config | Effect |
589
- |--------|--------|
590
- | `auto_index.guidance: false` | Skip guidance indexing on session start |
591
- | `auto_index.code_map: false` | Skip code map generation on session start |
592
- | `gates.memory_first: true` | Block Glob/Grep/Read until memory is searched first |
593
- | `gates.task_create_first: true` | Block Agent/Task tool until TaskCreate is called |
594
- | `gates.context_tracking: true` | Show FRESH/MODERATE/DEPLETED/CRITICAL context bracket |
595
- | `hooks.pre_edit: false` | Disable file-edit tracking (skips pre-edit hook) |
596
- | `hooks.post_edit: false` | Disable edit outcome recording and neural training |
597
- | `hooks.pre_task: false` | Disable agent routing recommendations before spawn |
598
- | `hooks.post_task: false` | Disable task result recording for learning |
599
- | `hooks.gate: false` | Disable all workflow gates (memory-first, task-create-first) |
600
- | `hooks.route: false` | Disable intelligent task routing on each prompt |
601
- | `hooks.stop_hook: false` | Disable session-end persistence and metric export |
602
- | `hooks.notification: false` | Disable notification hook |
603
- | `model_routing.enabled: true` | Auto-select haiku/sonnet/opus based on task complexity |
604
- | `status_line.mode: dashboard` | Switch to multi-line status display |
605
- | `status_line.show_swarm: false` | Hide swarm agent count from status bar |
606
-
607
- ---
608
-
609
- ## Cross-Platform Compatibility
610
-
611
- All code changes MUST work on Windows, macOS, and Linux. Follow these rules:
612
-
613
- - **Paths**: Use `path.join()` / `path.resolve()`, never hardcoded `/` or `\\` separators
614
- - **Process spawning**: Use `detached: !isWin` for background processes; on Windows use `shell: true, windowsHide: true` instead
615
- - **Process killing**: Use `taskkill /F /PID` on Windows, `process.kill(pid, signal)` on POSIX
616
- - **Process inspection**: Use PowerShell `Get-CimInstance` on Windows, `/proc/<pid>/cmdline` on Linux, `ps -p <pid>` on macOS
617
- - **Shell commands**: Never assume bash — use `child_process.spawn` with explicit args instead of shell string interpolation
618
- - **File locking**: Use `fs.writeFileSync(path, data, { flag: 'wx' })` for atomic locks (works cross-platform)
619
- - **Signals**: SIGHUP/SIGTERM are POSIX-only; on Windows use `taskkill` or process exit events
620
- - **Line endings**: Use `\n` in code; let git handle CRLF conversion
621
- - **Temp dirs**: Use `os.tmpdir()`, not `/tmp`
622
- - **PID recycling**: Windows recycles PIDs aggressively — always verify process command line, not just PID liveness
623
-
624
- ## Troubleshooting Common Issues
625
-
626
- | Symptom | Cause | Fix |
627
- |---------|-------|-----|
628
- | No MCP tools available | `.mcp.json` missing or moflo not installed | Run `npx flo init` or manually create `.mcp.json` |
629
- | Memory search returns nothing | Indexer hasn't run yet | Run `npx flo-index --force` to index guidance |
630
- | Low search quality | Guidance docs missing `**Purpose:**` lines or generic headings | Follow guidance optimization rules in `guidance-memory-strategy.md` |
631
- | Session start slow | All three indexers running | Set `auto_index.code_map: false` in `moflo.yaml` if code map not needed |
632
- | Status line not showing | `statusline.cjs` error or `status_line.enabled: false` | Run `node .claude/helpers/statusline.cjs` to test, check `moflo.yaml` |
633
- | Embeddings falling back to hash | Transformers.js not available | Install `@xenova/transformers` — moflo includes it but some environments strip it |
634
- | `flo` command not found | Not in PATH | Use `npx flo` or `node node_modules/moflo/bin/index-guidance.mjs` |
635
- | Bundled guidance not indexed | Running inside moflo repo (same dir) | Bundled guidance only indexes when installed as a dependency in a different project |
636
-
637
- See `moflo-memory-strategy.md` for memory-specific troubleshooting.
638
-
639
- ---
640
-
641
- ## See Also
642
-
643
- - `.claude/guidance/moflo-subagents.md` - Subagents memory-first protocol and store patterns
644
- - `.claude/guidance/moflo-claude-swarm-cohesion.md` - Task & swarm coordination with TaskCreate/TaskUpdate
645
- - `.claude/guidance/moflo-memory-strategy.md` - Database schema, namespaces, search commands, RAG linking
646
- - `.claude/guidance/guidance-memory-strategy.md` - How to write guidance docs that index well for RAG
1
+ # Moflo CLI & MCP Reference
2
+
3
+ **Purpose:** Complete CLI and MCP reference for moflo — hooks, memory, agents, swarm, neural, and doctor commands. Read when using moflo features or debugging agent coordination.
4
+
5
+ **MCP-First Policy:** Always prefer MCP tools (`mcp__moflo__*`) over CLI commands. Use `ToolSearch` to load them, then call directly. CLI is fallback only.
6
+
7
+ ---
8
+
9
+ ## Getting Started
10
+
11
+ ### Installation
12
+
13
+ ```bash
14
+ npm install moflo
15
+ npx flo init # Interactive setup wizard
16
+ ```
17
+
18
+ `flo init` does the following:
19
+ 1. Creates `moflo.yaml` with detected project settings
20
+ 2. Sets up `.claude/settings.json` hooks (SessionStart, pre-edit, etc.)
21
+ 3. Configures `.mcp.json` for MCP tool access
22
+ 4. Copies the agent bootstrap guide to `.claude/guidance/`
23
+ 5. Injects a memory search section into CLAUDE.md
24
+
25
+ ### Post-Install
26
+
27
+ ```bash
28
+ npx flo-setup # Copy bootstrap guidance, inject CLAUDE.md section
29
+ npx flo doctor --fix # Verify everything is working
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Building from Source
35
+
36
+ **Full instructions: [`docs/BUILD.md`](../../../docs/BUILD.md)** — the canonical, step-by-step build/test/publish process. Always follow it.
37
+
38
+ Quick reference (from project root only):
39
+
40
+ ```bash
41
+ git pull origin main # ALWAYS pull first
42
+ npm run build # tsc -b (project references)
43
+ npm test # 0 failures required
44
+ npm version patch --no-git-tag-version # Bump + sync cli version
45
+ npm run build # Rebuild with new version
46
+ npm publish --otp=XXX # Requires 2FA OTP
47
+ ```
48
+
49
+ **Critical rules:**
50
+ - npm only — no pnpm, yarn, or bun
51
+ - Always build from root (`npm run build`) — never cd into subdirectories
52
+ - Never publish without a successful build — `prepublishOnly` masks failures
53
+ - Never publish without tests passing
54
+
55
+ ---
56
+
57
+ ## Session Start Automation
58
+
59
+ When a Claude Code session starts, moflo automatically runs three background indexers:
60
+
61
+ | Indexer | Command | Namespace | What it does |
62
+ |---------|---------|-----------|--------------|
63
+ | Guidance | `npx flo-index` | `guidance` | Chunks markdown docs, builds RAG links, generates 384-dim embeddings |
64
+ | Code Map | `npx flo-codemap` | `code-map` | Scans source for types, interfaces, exports, directory structure |
65
+ | Learning | `npx flo-learn` | `patterns` | Pattern research on codebase for cross-session learning |
66
+
67
+ These run in background and are incremental (unchanged files are skipped). Controlled by `auto_index` in `moflo.yaml`.
68
+
69
+ ### Helper Script Auto-Sync
70
+
71
+ On version change, `session-start-launcher.mjs` copies helper scripts from the installed moflo package to the consumer project's `.claude/helpers/` and `.claude/scripts/` directories. This ensures hooks always run the latest version.
72
+
73
+ **Rule: static files, not dynamic generation.** If a helper script has no dynamic content (no per-project interpolation), it must be shipped as a pre-built static file in `bin/` and synced via the session-start file lists. Do not generate static content dynamically at runtime — it adds fragile moving parts (background `init --upgrade`, race conditions with session-start exit) and causes stale scripts when the sync list is incomplete.
74
+
75
+ | Source | Target | Files |
76
+ |--------|--------|-------|
77
+ | `bin/` | `.claude/scripts/` | `hooks.mjs`, `session-start-launcher.mjs`, `index-guidance.mjs`, `build-embeddings.mjs`, `generate-code-map.mjs`, `semantic-search.mjs` |
78
+ | `bin/` | `.claude/helpers/` | `gate.cjs`, `gate-hook.mjs`, `prompt-hook.mjs`, `hook-handler.cjs` |
79
+ | `src/packages/cli/.claude/helpers/` | `.claude/helpers/` | `auto-memory-hook.mjs`, `statusline.cjs`, `pre-commit`, `post-commit` |
80
+
81
+ When adding a new helper script: generate it once, save it to `bin/`, and add it to the appropriate list in `session-start-launcher.mjs`.
82
+
83
+ ### Bundled Guidance
84
+
85
+ Moflo ships its own guidance files (in `.claude/guidance/` within the package). When installed as a dependency, these are **automatically indexed** alongside the consumer project's guidance under the `guidance` namespace. This means agents in your project can search for moflo system docs (swarm patterns, memory commands, etc.) without any extra setup.
86
+
87
+ ---
88
+
89
+ ## Bin Commands
90
+
91
+ | Command | Script | Purpose |
92
+ |---------|--------|---------|
93
+ | `npx flo-index` | `bin/index-guidance.mjs` | Index guidance docs with RAG linking + embeddings |
94
+ | `npx flo-codemap` | `bin/generate-code-map.mjs` | Generate structural code map (types, interfaces, directories) |
95
+ | `npx flo-learn` | Learning service | Pattern research on codebase |
96
+ | `npx flo-setup` | `bin/setup-project.mjs` | Copy bootstrap guidance, inject CLAUDE.md memory section |
97
+ | `npx flo-search` | `bin/semantic-search.mjs` | Standalone semantic search with detailed output |
98
+
99
+ ### Common Flags
100
+
101
+ | Flag | Applies to | Effect |
102
+ |------|-----------|--------|
103
+ | `--force` | flo-index, flo-codemap | Reindex everything (ignore hash cache) |
104
+ | `--file <path>` | flo-index | Index a specific file only |
105
+ | `--no-embeddings` | flo-index | Skip embedding generation |
106
+ | `--verbose` | flo-index | Show detailed chunk-level output |
107
+ | `--namespace <ns>` | flo-search | Filter search to specific namespace |
108
+ | `--limit <n>` | flo-search | Number of results (default: 5) |
109
+
110
+ ---
111
+
112
+ ## MCP Tools Setup
113
+
114
+ MCP tools are the preferred way for Claude to interact with moflo. `flo init` creates a `.mcp.json` in the project root:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "moflo": {
120
+ "command": "node",
121
+ "args": ["node_modules/moflo/src/packages/cli/bin/cli.js", "mcp", "start"]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ This gives Claude access to 200+ MCP tools (`mcp__moflo__memory_*`, `mcp__moflo__hooks_*`, `mcp__moflo__swarm_*`, etc.) without any global installation.
128
+
129
+ ---
130
+
131
+ ## Project Config (Anti-Drift Defaults)
132
+
133
+ - **Topology**: hierarchical (prevents drift)
134
+ - **Max Agents**: 8 (smaller = less drift)
135
+ - **Strategy**: specialized (clear roles)
136
+ - **Consensus**: raft
137
+ - **Memory**: hybrid
138
+ - **HNSW**: Enabled
139
+ - **Neural**: Enabled
140
+
141
+ ---
142
+
143
+ ## CLI Commands (26 Commands, 140+ Subcommands)
144
+
145
+ ### Core Commands
146
+
147
+ | Command | Subcommands | Description |
148
+ |-------------|-------------|--------------------------------------------------------------------------|
149
+ | `init` | 4 | Project initialization with wizard, presets, skills, hooks |
150
+ | `agent` | 8 | Agent lifecycle (spawn, list, status, stop, metrics, pool, health, logs) |
151
+ | `swarm` | 6 | Multi-agent swarm coordination and orchestration |
152
+ | `memory` | 11 | AgentDB memory with vector search (150x-12,500x faster) |
153
+ | `mcp` | 9 | MCP server management and tool execution |
154
+ | `task` | 6 | Task creation, assignment, and lifecycle |
155
+ | `session` | 7 | Session state management and persistence |
156
+ | `config` | 7 | Configuration management and provider setup |
157
+ | `status` | 3 | System status monitoring with watch mode |
158
+ | `workflow` | 6 | Workflow execution and template management |
159
+ | `hooks` | 17 | Self-learning hooks + 12 background workers |
160
+ | `hive-mind` | 6 | Queen-led Byzantine fault-tolerant consensus |
161
+
162
+ ### Advanced Commands
163
+
164
+ | Command | Subcommands | Description |
165
+ |---------------|-------------|-------------------------------------------------------------------------------|
166
+ | `daemon` | 5 | Background worker daemon (start, stop, status, trigger, enable) |
167
+ | `neural` | 5 | Neural pattern training (train, status, patterns, predict, optimize) |
168
+ | `security` | 6 | Security scanning (scan, audit, cve, threats, validate, report) |
169
+ | `performance` | 5 | Performance profiling (benchmark, profile, metrics, optimize, report) |
170
+ | `providers` | 5 | AI providers (list, add, remove, test, configure) |
171
+ | `plugins` | 5 | Plugin management (list, install, uninstall, enable, disable) |
172
+ | `deployment` | 5 | Deployment management (deploy, rollback, status, environments, release) |
173
+ | `embeddings` | 4 | Vector embeddings (embed, batch, search, init) - 75x faster with agentic-flow |
174
+ | `claims` | 4 | Claims-based authorization (check, grant, revoke, list) |
175
+ | `migrate` | 5 | V2 to V3 migration with rollback support |
176
+ | `doctor` | 1 | System diagnostics with health checks |
177
+ | `completions` | 4 | Shell completions (bash, zsh, fish, powershell) |
178
+
179
+ ### Quick Examples (MCP Preferred)
180
+
181
+ | Task | MCP Tool | CLI Fallback |
182
+ |------|----------|-------------|
183
+ | Search memory | `mcp__moflo__memory_search` | `memory search --query "..."` |
184
+ | Spawn agent | `mcp__moflo__agent_spawn` | `agent spawn -t coder --name my-coder` |
185
+ | Init swarm | `mcp__moflo__swarm_init` | `swarm init --v3-mode` |
186
+ | System health | `mcp__moflo__system_health` | `doctor --fix` |
187
+ | Benchmark | `mcp__moflo__performance_benchmark` | `performance benchmark --suite all` |
188
+
189
+ **CLI-only (no MCP equivalent — setup tasks):**
190
+ ```bash
191
+ npx flo init --wizard
192
+ npx flo daemon start
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Available Agents (60+ Types)
198
+
199
+ ### Core Development
200
+ `coder`, `reviewer`, `tester`, `planner`, `researcher`
201
+
202
+ ### Specialized Agents
203
+ `security-architect`, `security-auditor`, `memory-specialist`, `performance-engineer`
204
+
205
+ ### Swarm Coordination
206
+ `hierarchical-coordinator`, `mesh-coordinator`, `adaptive-coordinator`, `collective-intelligence-coordinator`, `swarm-memory-manager`
207
+
208
+ ### Consensus & Distributed
209
+ `byzantine-coordinator`, `raft-manager`, `gossip-coordinator`, `consensus-builder`, `crdt-synchronizer`, `quorum-manager`, `security-manager`
210
+
211
+ ### Performance & Optimization
212
+ `perf-analyzer`, `performance-benchmarker`, `task-orchestrator`, `memory-coordinator`, `smart-agent`
213
+
214
+ ### GitHub & Repository
215
+ `github-modes`, `pr-manager`, `code-review-swarm`, `issue-tracker`, `release-manager`, `workflow-automation`, `project-board-sync`, `repo-architect`, `multi-repo-swarm`
216
+
217
+ ### SPARC Methodology
218
+ `sparc-coord`, `sparc-coder`, `specification`, `pseudocode`, `architecture`, `refinement`
219
+
220
+ ### Specialized Development
221
+ `backend-dev`, `mobile-dev`, `ml-developer`, `cicd-engineer`, `api-docs`, `system-architect`, `code-analyzer`, `base-template-generator`
222
+
223
+ ### Testing & Validation
224
+ `tdd-london-swarm`, `production-validator`
225
+
226
+ ### Agent Routing (Anti-Drift)
227
+
228
+ | Code | Task | Agents |
229
+ |------|-------------|-------------------------------------------------|
230
+ | 1 | Bug Fix | coordinator, researcher, coder, tester |
231
+ | 3 | Feature | coordinator, architect, coder, tester, reviewer |
232
+ | 5 | Refactor | coordinator, architect, coder, reviewer |
233
+ | 7 | Performance | coordinator, perf-engineer, coder |
234
+ | 9 | Security | coordinator, security-architect, auditor |
235
+ | 11 | Docs | researcher, api-docs |
236
+
237
+ **Codes 1-9: hierarchical/specialized (anti-drift). Code 11: mesh/balanced**
238
+
239
+ ---
240
+
241
+ ## Hooks System (27 Hooks + 12 Workers)
242
+
243
+ ### All Available Hooks
244
+
245
+ | Hook | Description | Key Options |
246
+ |--------------------|------------------------------------------|---------------------------------------------|
247
+ | `pre-edit` | Get context before editing files | `--file`, `--operation` |
248
+ | `post-edit` | Record editing outcome for learning | `--file`, `--success`, `--train-neural` |
249
+ | `pre-command` | Assess risk before commands | `--command`, `--validate-safety` |
250
+ | `post-command` | Record command execution outcome | `--command`, `--track-metrics` |
251
+ | `pre-task` | Record task start, get agent suggestions | `--description`, `--coordinate-swarm` |
252
+ | `post-task` | Record task completion for learning | `--task-id`, `--success`, `--store-results` |
253
+ | `session-start` | Start/restore session | `--session-id`, `--auto-configure` |
254
+ | `session-end` | End session and persist state | `--generate-summary`, `--export-metrics` |
255
+ | `session-restore` | Restore a previous session | `--session-id`, `--latest` |
256
+ | `route` | Route task to optimal agent | `--task`, `--context`, `--top-k` |
257
+ | `explain` | Explain routing decision | `--topic`, `--detailed` |
258
+ | `pretrain` | Bootstrap intelligence from repo | `--model-type`, `--epochs` |
259
+ | `build-agents` | Generate optimized agent configs | `--agent-types`, `--focus` |
260
+ | `metrics` | View learning metrics dashboard | `--v3-dashboard`, `--format` |
261
+ | `transfer` | Transfer patterns via IPFS registry | `store`, `from-project` |
262
+ | `intelligence` | RuVector intelligence system | `trajectory-*`, `pattern-*`, `stats` |
263
+ | `worker` | Background worker management | `list`, `dispatch`, `status`, `detect` |
264
+ | `coverage-route` | Route based on test coverage gaps | `--task`, `--path` |
265
+ | `coverage-suggest` | Suggest coverage improvements | `--path` |
266
+ | `coverage-gaps` | List coverage gaps with priorities | `--format`, `--limit` |
267
+
268
+ ### 12 Background Workers
269
+
270
+ | Worker | Priority | Description |
271
+ |---------------|----------|----------------------------|
272
+ | `ultralearn` | normal | Deep knowledge acquisition |
273
+ | `optimize` | high | Performance optimization |
274
+ | `consolidate` | low | Memory consolidation |
275
+ | `predict` | normal | Predictive preloading |
276
+ | `audit` | critical | Security analysis |
277
+ | `map` | normal | Codebase mapping |
278
+ | `preload` | low | Resource preloading |
279
+ | `deepdive` | normal | Deep code analysis |
280
+ | `document` | normal | Auto-documentation |
281
+ | `refactor` | normal | Refactoring suggestions |
282
+ | `benchmark` | normal | Performance benchmarking |
283
+ | `testgaps` | normal | Test coverage analysis |
284
+
285
+ ### Essential Hook Commands (MCP Preferred)
286
+
287
+ | Hook | MCP Tool | Key Params |
288
+ |------|----------|------------|
289
+ | Pre-task | `mcp__moflo__hooks_pre-task` | `description` |
290
+ | Post-task | `mcp__moflo__hooks_post-task` | `taskId`, `success` |
291
+ | Post-edit | `mcp__moflo__hooks_post-edit` | `file`, `trainNeural` |
292
+ | Session-start | `mcp__moflo__hooks_session-start` | `sessionId` |
293
+ | Session-end | `mcp__moflo__hooks_session-end` | `exportMetrics` |
294
+ | Route | `mcp__moflo__hooks_route` | `task` |
295
+ | Worker-dispatch | `mcp__moflo__hooks_worker-dispatch` | `trigger` |
296
+
297
+ ---
298
+
299
+ ## Hive-Mind Consensus
300
+
301
+ ### Topologies
302
+ - `hierarchical` - Queen controls workers directly
303
+ - `mesh` - Fully connected peer network
304
+ - `hierarchical-mesh` - Hybrid (recommended)
305
+ - `adaptive` - Dynamic based on load
306
+
307
+ ### Consensus Strategies
308
+ - `byzantine` - BFT (tolerates f < n/3 faulty)
309
+ - `raft` - Leader-based (tolerates f < n/2)
310
+ - `gossip` - Epidemic for eventual consistency
311
+ - `crdt` - Conflict-free replicated data types
312
+ - `quorum` - Configurable quorum-based
313
+
314
+ ---
315
+
316
+ ## RuVector Integration (HNSW Vector Search)
317
+
318
+ | Feature | Performance | Description |
319
+ |---------|-------------|-------------|
320
+ | **HNSW Index** | 150x-12,500x faster | Hierarchical Navigable Small World search |
321
+ | **MicroLoRA** | <100us adaptation | Fast model adaptation (508k+ ops/sec) |
322
+ | **FlashAttention** | 2.49x-7.47x speedup | Optimized attention computation |
323
+ | **Int8 Quantization** | 3.92x memory reduction | Compressed weight storage |
324
+
325
+ ---
326
+
327
+ ## Auto-Learning Protocol
328
+
329
+ ### Before Starting Coding Tasks
330
+
331
+ **MCP (Preferred):** `mcp__moflo__memory_search` — `query: "[task keywords]", namespace: "patterns"`
332
+
333
+ **CLI Fallback:**
334
+ ```bash
335
+ npx flo memory search --query '[task keywords]' --namespace patterns
336
+ ```
337
+
338
+ ### After Completing Any Task Successfully (MCP Preferred)
339
+
340
+ | Step | MCP Tool | Key Params |
341
+ |------|----------|------------|
342
+ | 1. Store pattern | `mcp__moflo__memory_store` | `namespace: "patterns", key: "[name]", value: "[what worked]"` |
343
+ | 2. Train neural | `mcp__moflo__hooks_post-edit` | `file: "[main-file]", trainNeural: true` |
344
+ | 3. Record completion | `mcp__moflo__hooks_post-task` | `taskId: "[id]", success: true, storeResults: true` |
345
+
346
+ ### Continuous Improvement Triggers
347
+
348
+ | Trigger | Worker | When to Use |
349
+ |------------------------|------------|----------------------------|
350
+ | After major refactor | `optimize` | Performance optimization |
351
+ | After adding features | `testgaps` | Find missing test coverage |
352
+ | After security changes | `audit` | Security analysis |
353
+ | After API changes | `document` | Update documentation |
354
+ | Every 5+ file changes | `map` | Update codebase map |
355
+ | Complex debugging | `deepdive` | Deep code analysis |
356
+
357
+ ### Memory-Enhanced Development
358
+
359
+ **ALWAYS check memory before:**
360
+ - Starting a new feature (search for similar implementations)
361
+ - Debugging an issue (search for past solutions)
362
+ - Refactoring code (search for learned patterns)
363
+ - Performance work (search for optimization strategies)
364
+
365
+ **ALWAYS store in memory after:**
366
+ - Solving a tricky bug (store the solution pattern)
367
+ - Completing a feature (store the approach)
368
+ - Finding a performance fix (store the optimization)
369
+ - Discovering a security issue (store the vulnerability pattern)
370
+
371
+ ---
372
+
373
+ ## Memory Commands Reference (MCP Preferred)
374
+
375
+ ### Store Data
376
+
377
+ **MCP:** `mcp__moflo__memory_store`
378
+ - Required: `key`, `value`
379
+ - Optional: `namespace` (default: "default"), `ttl`, `tags`
380
+
381
+ **CLI Fallback:**
382
+ ```bash
383
+ npx flo memory store --key "pattern-auth" --value "JWT with refresh tokens" --namespace patterns
384
+ ```
385
+
386
+ ### Search Data (semantic vector search)
387
+
388
+ **MCP:** `mcp__moflo__memory_search`
389
+ - Required: `query`
390
+ - Optional: `namespace`, `limit`, `threshold`
391
+
392
+ **CLI Fallback:**
393
+ ```bash
394
+ npx flo memory search --query "authentication patterns" --namespace patterns --limit 5
395
+ ```
396
+
397
+ ### List Entries
398
+
399
+ **MCP:** `mcp__moflo__memory_list`
400
+ - Optional: `namespace`, `limit`
401
+
402
+ ### Retrieve Specific Entry
403
+
404
+ **MCP:** `mcp__moflo__memory_retrieve`
405
+ - Required: `key`
406
+ - Optional: `namespace` (default: "default")
407
+
408
+ ---
409
+
410
+ ## Claude Code vs MCP vs CLI Tools
411
+
412
+ ### Claude Code Handles ALL EXECUTION:
413
+ - **Task tool**: Spawn and run agents concurrently
414
+ - File operations (Read, Write, Edit, Glob, Grep)
415
+ - Code generation and programming
416
+ - Bash commands and system operations
417
+ - Git operations
418
+
419
+ ### MCP Tools Handle Coordination (Preferred):
420
+
421
+ | Operation | MCP Tool |
422
+ |-----------|----------|
423
+ | Swarm init | `mcp__moflo__swarm_init` |
424
+ | Agent spawn | `mcp__moflo__agent_spawn` |
425
+ | Memory store | `mcp__moflo__memory_store` |
426
+ | Memory search | `mcp__moflo__memory_search` |
427
+ | Hooks (all) | `mcp__moflo__hooks_<hook-name>` |
428
+
429
+ ### CLI Commands (Fallback Only):
430
+
431
+ Only use CLI via Bash when MCP tools are unavailable:
432
+ ```bash
433
+ npx flo <command> [options]
434
+ ```
435
+
436
+ **KEY**: MCP tools coordinate strategy, Claude Code's Task tool executes with real agents.
437
+
438
+ ---
439
+
440
+ ## Doctor Health Checks
441
+
442
+ **MCP:** `mcp__moflo__system_health` | **CLI:** `npx flo doctor`
443
+
444
+ Checks: Node version (20+), Git, config validity, daemon status, memory database, API keys, MCP servers, disk space, TypeScript.
445
+
446
+ ---
447
+
448
+ ## Environment Variables
449
+
450
+ ```bash
451
+ # Configuration
452
+ CLAUDE_FLOW_CONFIG=./claude-flow.config.json
453
+ CLAUDE_FLOW_LOG_LEVEL=info
454
+
455
+ # MCP Server
456
+ CLAUDE_FLOW_MCP_PORT=3000
457
+ CLAUDE_FLOW_MCP_HOST=localhost
458
+ CLAUDE_FLOW_MCP_TRANSPORT=stdio
459
+
460
+ # Memory
461
+ CLAUDE_FLOW_MEMORY_BACKEND=hybrid
462
+ CLAUDE_FLOW_MEMORY_PATH=./data/memory
463
+ ```
464
+
465
+ ---
466
+
467
+ ## Quick Setup
468
+
469
+ ### Project-Level MCP (Recommended)
470
+
471
+ Configure `.mcp.json` in the project root:
472
+
473
+ ```json
474
+ {
475
+ "mcpServers": {
476
+ "moflo": {
477
+ "command": "node",
478
+ "args": ["node_modules/moflo/src/packages/cli/bin/cli.js", "mcp", "start"]
479
+ }
480
+ }
481
+ }
482
+ ```
483
+
484
+ ### Alternative: Global MCP Registration
485
+
486
+ ```bash
487
+ claude mcp add moflo -- npx @claude-flow/cli@alpha
488
+ npx flo daemon start
489
+ npx flo doctor --fix
490
+ ```
491
+
492
+ ---
493
+
494
+ ## Project Configuration (moflo.yaml)
495
+
496
+ Moflo reads `moflo.yaml` (or `moflo.config.json`) from the project root. All fields have sensible defaults — the file is optional.
497
+
498
+ ### Full Reference
499
+
500
+ ```yaml
501
+ project:
502
+ name: "my-project" # Project name (default: directory name)
503
+
504
+ # Guidance/knowledge docs to index for semantic search
505
+ guidance:
506
+ directories: # Directories to scan for .md files
507
+ - .claude/guidance # Default
508
+ - docs/guides # Default
509
+ namespace: guidance # Memory namespace for indexed docs
510
+
511
+ # Source directories for code navigation map
512
+ code_map:
513
+ directories: # Directories to scan for source files
514
+ - src # Default
515
+ - packages
516
+ - lib
517
+ - app
518
+ extensions: [".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".rs", ".java"]
519
+ exclude: [node_modules, dist, .next, coverage, build, __pycache__, target, .git]
520
+ namespace: code-map
521
+
522
+ # Workflow gates (enforced via Claude Code hooks)
523
+ gates:
524
+ memory_first: true # Search memory before Glob/Grep
525
+ task_create_first: true # TaskCreate before Agent tool
526
+ context_tracking: true # Track context bracket (FRESH/MODERATE/DEPLETED/CRITICAL)
527
+
528
+ # Auto-index on session start
529
+ auto_index:
530
+ guidance: true # Run flo-index (guidance RAG indexer)
531
+ code_map: true # Run flo-codemap (structural code index)
532
+
533
+ # Memory backend
534
+ memory:
535
+ backend: sql.js # sql.js (WASM) | agentdb | json
536
+ embedding_model: Xenova/all-MiniLM-L6-v2 # 384-dim neural embeddings
537
+ namespace: default # Default namespace for memory operations
538
+
539
+ # Hook toggles (all on by default — disable to slim down)
540
+ hooks:
541
+ pre_edit: true # Track file edits for learning
542
+ post_edit: true # Record edit outcomes, train neural patterns
543
+ pre_task: true # Get agent routing before task spawn
544
+ post_task: true # Record task results for learning
545
+ gate: true # Workflow gate enforcement (memory-first, task-create-first)
546
+ route: true # Intelligent task routing on each prompt
547
+ stop_hook: true # Session-end persistence and metric export
548
+ session_restore: true # Restore session state on start
549
+ notification: true # Hook into Claude Code notifications
550
+
551
+ # Model preferences (haiku, sonnet, opus)
552
+ models:
553
+ default: opus # General tasks
554
+ research: sonnet # Research/exploration agents
555
+ review: opus # Code review agents
556
+ test: sonnet # Test-writing agents
557
+
558
+ # Intelligent model routing (auto-selects haiku/sonnet/opus per task)
559
+ model_routing:
560
+ enabled: false # Set true to enable dynamic routing
561
+ confidence_threshold: 0.85 # Min confidence before escalating
562
+ cost_optimization: true # Prefer cheaper models when confident
563
+ circuit_breaker: true # Penalize models that fail repeatedly
564
+ # agent_overrides:
565
+ # security-architect: opus
566
+ # researcher: sonnet
567
+
568
+ # Status line display
569
+ status_line:
570
+ enabled: true # Show status line at all
571
+ branding: "Moflo V4" # Text in status bar
572
+ mode: single-line # single-line (default) or dashboard (multi-line)
573
+ show_git: true # Git branch, changes, ahead/behind
574
+ show_model: true # Current model name
575
+ show_session: true # Session duration
576
+ show_intelligence: true # Intelligence % indicator
577
+ show_swarm: true # Active swarm agents count
578
+ show_hooks: true # Enabled hooks count
579
+ show_mcp: true # MCP server count
580
+ show_security: true # CVE/security status (dashboard only)
581
+ show_adrs: true # ADR compliance (dashboard only)
582
+ show_agentdb: true # AgentDB vectors/size (dashboard only)
583
+ show_tests: true # Test file count (dashboard only)
584
+ ```
585
+
586
+ ### Key Behaviors
587
+
588
+ | Config | Effect |
589
+ |--------|--------|
590
+ | `auto_index.guidance: false` | Skip guidance indexing on session start |
591
+ | `auto_index.code_map: false` | Skip code map generation on session start |
592
+ | `gates.memory_first: true` | Block Glob/Grep/Read until memory is searched first |
593
+ | `gates.task_create_first: true` | Block Agent/Task tool until TaskCreate is called |
594
+ | `gates.context_tracking: true` | Show FRESH/MODERATE/DEPLETED/CRITICAL context bracket |
595
+ | `hooks.pre_edit: false` | Disable file-edit tracking (skips pre-edit hook) |
596
+ | `hooks.post_edit: false` | Disable edit outcome recording and neural training |
597
+ | `hooks.pre_task: false` | Disable agent routing recommendations before spawn |
598
+ | `hooks.post_task: false` | Disable task result recording for learning |
599
+ | `hooks.gate: false` | Disable all workflow gates (memory-first, task-create-first) |
600
+ | `hooks.route: false` | Disable intelligent task routing on each prompt |
601
+ | `hooks.stop_hook: false` | Disable session-end persistence and metric export |
602
+ | `hooks.notification: false` | Disable notification hook |
603
+ | `model_routing.enabled: true` | Auto-select haiku/sonnet/opus based on task complexity |
604
+ | `status_line.mode: dashboard` | Switch to multi-line status display |
605
+ | `status_line.show_swarm: false` | Hide swarm agent count from status bar |
606
+
607
+ ---
608
+
609
+ ## Cross-Platform Compatibility
610
+
611
+ All code changes MUST work on Windows, macOS, and Linux. Follow these rules:
612
+
613
+ - **Paths**: Use `path.join()` / `path.resolve()`, never hardcoded `/` or `\\` separators
614
+ - **Process spawning**: Use `detached: !isWin` for background processes; on Windows use `shell: true, windowsHide: true` instead
615
+ - **Process killing**: Use `taskkill /F /PID` on Windows, `process.kill(pid, signal)` on POSIX
616
+ - **Process inspection**: Use PowerShell `Get-CimInstance` on Windows, `/proc/<pid>/cmdline` on Linux, `ps -p <pid>` on macOS
617
+ - **Shell commands**: Never assume bash — use `child_process.spawn` with explicit args instead of shell string interpolation
618
+ - **File locking**: Use `fs.writeFileSync(path, data, { flag: 'wx' })` for atomic locks (works cross-platform)
619
+ - **Signals**: SIGHUP/SIGTERM are POSIX-only; on Windows use `taskkill` or process exit events
620
+ - **Line endings**: Use `\n` in code; let git handle CRLF conversion
621
+ - **Temp dirs**: Use `os.tmpdir()`, not `/tmp`
622
+ - **PID recycling**: Windows recycles PIDs aggressively — always verify process command line, not just PID liveness
623
+
624
+ ## Troubleshooting Common Issues
625
+
626
+ | Symptom | Cause | Fix |
627
+ |---------|-------|-----|
628
+ | No MCP tools available | `.mcp.json` missing or moflo not installed | Run `npx flo init` or manually create `.mcp.json` |
629
+ | Memory search returns nothing | Indexer hasn't run yet | Run `npx flo-index --force` to index guidance |
630
+ | Low search quality | Guidance docs missing `**Purpose:**` lines or generic headings | Follow guidance optimization rules in `guidance-memory-strategy.md` |
631
+ | Session start slow | All three indexers running | Set `auto_index.code_map: false` in `moflo.yaml` if code map not needed |
632
+ | Status line not showing | `statusline.cjs` error or `status_line.enabled: false` | Run `node .claude/helpers/statusline.cjs` to test, check `moflo.yaml` |
633
+ | Embeddings falling back to hash | Transformers.js not available | Install `@xenova/transformers` — moflo includes it but some environments strip it |
634
+ | `flo` command not found | Not in PATH | Use `npx flo` or `node node_modules/moflo/bin/index-guidance.mjs` |
635
+ | Bundled guidance not indexed | Running inside moflo repo (same dir) | Bundled guidance only indexes when installed as a dependency in a different project |
636
+
637
+ See `moflo-memory-strategy.md` for memory-specific troubleshooting.
638
+
639
+ ---
640
+
641
+ ## See Also
642
+
643
+ - `.claude/guidance/moflo-subagents.md` - Subagents memory-first protocol and store patterns
644
+ - `.claude/guidance/moflo-claude-swarm-cohesion.md` - Task & swarm coordination with TaskCreate/TaskUpdate
645
+ - `.claude/guidance/moflo-memory-strategy.md` - Database schema, namespaces, search commands, RAG linking
646
+ - `.claude/guidance/guidance-memory-strategy.md` - How to write guidance docs that index well for RAG