moflo 4.8.10 → 4.8.12

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 (182) hide show
  1. package/.claude/agents/browser/browser-agent.yaml +182 -0
  2. package/.claude/agents/core/coder.md +265 -265
  3. package/.claude/agents/core/planner.md +167 -167
  4. package/.claude/agents/core/researcher.md +189 -189
  5. package/.claude/agents/core/reviewer.md +325 -325
  6. package/.claude/agents/core/tester.md +318 -318
  7. package/.claude/agents/dual-mode/codex-coordinator.md +224 -224
  8. package/.claude/agents/dual-mode/codex-worker.md +211 -211
  9. package/.claude/agents/dual-mode/dual-orchestrator.md +291 -291
  10. package/.claude/agents/github/code-review-swarm.md +537 -537
  11. package/.claude/agents/github/github-modes.md +172 -172
  12. package/.claude/agents/github/issue-tracker.md +318 -318
  13. package/.claude/agents/github/multi-repo-swarm.md +552 -552
  14. package/.claude/agents/github/pr-manager.md +190 -190
  15. package/.claude/agents/github/project-board-sync.md +508 -508
  16. package/.claude/agents/github/release-manager.md +366 -366
  17. package/.claude/agents/github/release-swarm.md +582 -582
  18. package/.claude/agents/github/repo-architect.md +397 -397
  19. package/.claude/agents/github/swarm-issue.md +572 -572
  20. package/.claude/agents/github/swarm-pr.md +427 -427
  21. package/.claude/agents/github/sync-coordinator.md +451 -451
  22. package/.claude/agents/github/workflow-automation.md +634 -634
  23. package/.claude/agents/goal/code-goal-planner.md +445 -445
  24. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +129 -129
  25. package/.claude/agents/hive-mind/queen-coordinator.md +202 -202
  26. package/.claude/agents/hive-mind/scout-explorer.md +241 -241
  27. package/.claude/agents/hive-mind/swarm-memory-manager.md +192 -192
  28. package/.claude/agents/hive-mind/worker-specialist.md +216 -216
  29. package/.claude/agents/neural/safla-neural.md +73 -73
  30. package/.claude/agents/reasoning/goal-planner.md +72 -72
  31. package/.claude/agents/swarm/adaptive-coordinator.md +395 -395
  32. package/.claude/agents/swarm/hierarchical-coordinator.md +326 -326
  33. package/.claude/agents/swarm/mesh-coordinator.md +391 -391
  34. package/.claude/agents/templates/migration-plan.md +745 -745
  35. package/.claude/commands/agents/agent-spawning.md +28 -28
  36. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +53 -53
  37. package/.claude/commands/analysis/bottleneck-detect.md +162 -162
  38. package/.claude/commands/analysis/performance-bottlenecks.md +58 -58
  39. package/.claude/commands/analysis/token-efficiency.md +44 -44
  40. package/.claude/commands/automation/auto-agent.md +122 -122
  41. package/.claude/commands/automation/self-healing.md +105 -105
  42. package/.claude/commands/automation/session-memory.md +89 -89
  43. package/.claude/commands/automation/smart-agents.md +72 -72
  44. package/.claude/commands/coordination/init.md +44 -44
  45. package/.claude/commands/coordination/orchestrate.md +43 -43
  46. package/.claude/commands/coordination/spawn.md +45 -45
  47. package/.claude/commands/coordination/swarm-init.md +85 -85
  48. package/.claude/commands/github/github-modes.md +146 -146
  49. package/.claude/commands/github/github-swarm.md +121 -121
  50. package/.claude/commands/github/issue-tracker.md +291 -291
  51. package/.claude/commands/github/pr-manager.md +169 -169
  52. package/.claude/commands/github/release-manager.md +337 -337
  53. package/.claude/commands/github/repo-architect.md +366 -366
  54. package/.claude/commands/github/sync-coordinator.md +300 -300
  55. package/.claude/commands/memory/neural.md +47 -47
  56. package/.claude/commands/monitoring/agents.md +44 -44
  57. package/.claude/commands/monitoring/status.md +46 -46
  58. package/.claude/commands/optimization/auto-topology.md +61 -61
  59. package/.claude/commands/optimization/parallel-execution.md +49 -49
  60. package/.claude/commands/sparc/analyzer.md +51 -51
  61. package/.claude/commands/sparc/architect.md +53 -53
  62. package/.claude/commands/sparc/ask.md +97 -97
  63. package/.claude/commands/sparc/batch-executor.md +54 -54
  64. package/.claude/commands/sparc/code.md +89 -89
  65. package/.claude/commands/sparc/coder.md +54 -54
  66. package/.claude/commands/sparc/debug.md +83 -83
  67. package/.claude/commands/sparc/debugger.md +54 -54
  68. package/.claude/commands/sparc/designer.md +53 -53
  69. package/.claude/commands/sparc/devops.md +109 -109
  70. package/.claude/commands/sparc/docs-writer.md +80 -80
  71. package/.claude/commands/sparc/documenter.md +54 -54
  72. package/.claude/commands/sparc/innovator.md +54 -54
  73. package/.claude/commands/sparc/integration.md +83 -83
  74. package/.claude/commands/sparc/mcp.md +117 -117
  75. package/.claude/commands/sparc/memory-manager.md +54 -54
  76. package/.claude/commands/sparc/optimizer.md +54 -54
  77. package/.claude/commands/sparc/orchestrator.md +131 -131
  78. package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -83
  79. package/.claude/commands/sparc/refinement-optimization-mode.md +83 -83
  80. package/.claude/commands/sparc/researcher.md +54 -54
  81. package/.claude/commands/sparc/reviewer.md +54 -54
  82. package/.claude/commands/sparc/security-review.md +80 -80
  83. package/.claude/commands/sparc/sparc-modes.md +174 -174
  84. package/.claude/commands/sparc/sparc.md +111 -111
  85. package/.claude/commands/sparc/spec-pseudocode.md +80 -80
  86. package/.claude/commands/sparc/supabase-admin.md +348 -348
  87. package/.claude/commands/sparc/swarm-coordinator.md +54 -54
  88. package/.claude/commands/sparc/tdd.md +54 -54
  89. package/.claude/commands/sparc/tester.md +54 -54
  90. package/.claude/commands/sparc/tutorial.md +79 -79
  91. package/.claude/commands/sparc/workflow-manager.md +54 -54
  92. package/.claude/commands/sparc.md +166 -166
  93. package/.claude/commands/swarm/analysis.md +95 -95
  94. package/.claude/commands/swarm/development.md +96 -96
  95. package/.claude/commands/swarm/examples.md +168 -168
  96. package/.claude/commands/swarm/maintenance.md +102 -102
  97. package/.claude/commands/swarm/optimization.md +117 -117
  98. package/.claude/commands/swarm/research.md +136 -136
  99. package/.claude/commands/swarm/testing.md +131 -131
  100. package/.claude/commands/training/neural-patterns.md +73 -73
  101. package/.claude/commands/training/specialization.md +62 -62
  102. package/.claude/commands/workflows/development.md +77 -77
  103. package/.claude/commands/workflows/research.md +62 -62
  104. package/.claude/guidance/moflo-bootstrap.md +129 -0
  105. package/.claude/guidance/{agent-bootstrap.md → shipped/agent-bootstrap.md} +126 -126
  106. package/.claude/guidance/{guidance-memory-strategy.md → shipped/guidance-memory-strategy.md} +262 -262
  107. package/.claude/guidance/{memory-strategy.md → shipped/memory-strategy.md} +204 -204
  108. package/.claude/guidance/{moflo.md → shipped/moflo.md} +45 -31
  109. package/.claude/guidance/{task-swarm-integration.md → shipped/task-swarm-integration.md} +441 -348
  110. package/.claude/helpers/gate-hook.mjs +50 -0
  111. package/.claude/helpers/gate.cjs +138 -236
  112. package/.claude/helpers/hook-handler.cjs +64 -326
  113. package/.claude/helpers/post-commit +16 -0
  114. package/.claude/helpers/pre-commit +26 -0
  115. package/.claude/helpers/prompt-hook.mjs +72 -0
  116. package/.claude/scripts/build-embeddings.mjs +549 -0
  117. package/.claude/scripts/generate-code-map.mjs +697 -0
  118. package/.claude/scripts/hooks.mjs +656 -0
  119. package/.claude/scripts/index-guidance.mjs +893 -0
  120. package/.claude/scripts/index-tests.mjs +710 -0
  121. package/.claude/scripts/semantic-search.mjs +473 -0
  122. package/.claude/scripts/session-start-launcher.mjs +226 -0
  123. package/.claude/settings.json +351 -290
  124. package/.claude/settings.local.json +4 -3
  125. package/.claude/skills/browser/SKILL.md +204 -0
  126. package/.claude/skills/fl/SKILL.md +29 -23
  127. package/.claude/skills/flo/SKILL.md +29 -23
  128. package/.claude/skills/github-code-review/SKILL.md +4 -4
  129. package/.claude/skills/github-multi-repo/SKILL.md +8 -8
  130. package/.claude/skills/github-project-management/SKILL.md +6 -6
  131. package/.claude/skills/github-release-management/SKILL.md +12 -12
  132. package/.claude/skills/github-workflow-automation/SKILL.md +6 -6
  133. package/.claude/skills/hooks-automation/SKILL.md +1201 -1201
  134. package/.claude/skills/performance-analysis/SKILL.md +563 -563
  135. package/.claude/skills/sparc-methodology/SKILL.md +64 -64
  136. package/.claude/skills/swarm-advanced/SKILL.md +77 -77
  137. package/.claude/workflow-state.json +9 -0
  138. package/.claude-plugin/README.md +3 -3
  139. package/.claude-plugin/docs/PLUGIN_SUMMARY.md +3 -3
  140. package/.claude-plugin/docs/QUICKSTART.md +4 -4
  141. package/.claude-plugin/marketplace.json +3 -3
  142. package/.claude-plugin/plugin.json +3 -3
  143. package/.claude-plugin/scripts/install.sh +9 -9
  144. package/.claude-plugin/scripts/verify.sh +7 -7
  145. package/README.md +311 -116
  146. package/bin/gate-hook.mjs +50 -0
  147. package/bin/gate.cjs +138 -0
  148. package/bin/hook-handler.cjs +83 -0
  149. package/bin/hooks.mjs +72 -12
  150. package/bin/index-guidance.mjs +29 -35
  151. package/bin/index-tests.mjs +710 -0
  152. package/bin/lib/process-manager.mjs +243 -0
  153. package/bin/lib/registry-cleanup.cjs +41 -0
  154. package/bin/prompt-hook.mjs +72 -0
  155. package/bin/semantic-search.mjs +472 -440
  156. package/bin/session-start-launcher.mjs +81 -31
  157. package/bin/setup-project.mjs +65 -65
  158. package/package.json +4 -2
  159. package/src/@claude-flow/cli/README.md +1 -1
  160. package/src/@claude-flow/cli/bin/cli.js +175 -175
  161. package/src/@claude-flow/cli/dist/src/commands/doctor.js +1091 -736
  162. package/src/@claude-flow/cli/dist/src/commands/github.d.ts +12 -0
  163. package/src/@claude-flow/cli/dist/src/commands/github.js +505 -0
  164. package/src/@claude-flow/cli/dist/src/commands/hive-mind.js +90 -90
  165. package/src/@claude-flow/cli/dist/src/commands/index.d.ts +1 -0
  166. package/src/@claude-flow/cli/dist/src/commands/index.js +7 -0
  167. package/src/@claude-flow/cli/dist/src/config-adapter.js +1 -1
  168. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.d.ts +29 -24
  169. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +73 -494
  170. package/src/@claude-flow/cli/dist/src/init/executor.js +109 -5
  171. package/src/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +14 -0
  172. package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +156 -24
  173. package/src/@claude-flow/cli/dist/src/init/mcp-generator.js +20 -20
  174. package/src/@claude-flow/cli/dist/src/init/moflo-init.d.ts +30 -23
  175. package/src/@claude-flow/cli/dist/src/init/moflo-init.js +727 -670
  176. package/src/@claude-flow/cli/dist/src/init/settings-generator.js +23 -14
  177. package/src/@claude-flow/cli/dist/src/mcp-server.js +3 -3
  178. package/src/@claude-flow/cli/dist/src/plugins/manager.js +9 -8
  179. package/src/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +1 -0
  180. package/src/@claude-flow/cli/dist/src/services/worker-daemon.js +3 -1
  181. package/src/@claude-flow/cli/dist/src/services/workflow-gate.js +10 -10
  182. package/src/@claude-flow/cli/package.json +106 -106
@@ -1,204 +1,204 @@
1
- # Memory & Semantic Search Strategy
2
-
3
- **Purpose:** How memory, embeddings, and semantic search work in moflo. Reference when debugging memory issues, understanding the search pipeline, or configuring memory for a consumer project.
4
-
5
- ---
6
-
7
- ## Architecture Overview
8
-
9
- ```
10
- Source Files (.claude/guidance/, docs/)
11
- |
12
- v
13
- index-guidance.mjs (chunking, RAG linking)
14
- |
15
- v
16
- .swarm/memory.db (SQLite - entries + metadata)
17
- |
18
- v
19
- build-embeddings.mjs (384-dim neural or hash vectors)
20
- |
21
- v
22
- Search layer (cosine similarity - MCP, CLI, or script)
23
- ```
24
-
25
- ---
26
-
27
- ## Key Files
28
-
29
- | File | Purpose |
30
- |------|---------|
31
- | `.swarm/memory.db` | SQLite database with all entries, embeddings, metadata |
32
- | `.swarm/code-map-hash.txt` | SHA-256 hash for incremental code map skip |
33
- | `.claude-flow/neural/patterns.json` | ReasoningBank learned patterns |
34
- | `bin/build-embeddings.mjs` | Generates 384-dim embeddings |
35
- | `bin/index-guidance.mjs` | Indexes guidance files with RAG linking |
36
- | `bin/generate-code-map.mjs` | Generates structural code map (projects, dirs, types, interfaces) |
37
-
38
- ---
39
-
40
- ## Embedding Strategy
41
-
42
- **Primary model:** `Xenova/all-MiniLM-L6-v2` (384-dim, neural — used by `build-embeddings.mjs`)
43
- **Fallback model:** `domain-aware-hash-v1` (384-dim, hash — used when Transformers.js unavailable)
44
-
45
- **Critical rule:** Query embeddings MUST match stored embeddings. Both the search scripts and MCP tools auto-detect the stored model and generate matching query vectors. Cross-model cosine similarity is meaningless.
46
-
47
- **Neural embeddings (primary):**
48
- - Uses `@xenova/transformers` with ONNX WASM runtime
49
- - True semantic understanding — "soft delete" matches "mark as deleted" without keyword overlap
50
- - ~3s for 1000 entries, loaded lazily and cached
51
-
52
- **Domain-aware hash (fallback):**
53
- - 12 domain clusters with project-specific terms
54
- - SimHash-style word encoding + bigram/trigram features
55
- - Good keyword-level matching, misses semantic paraphrases
56
- - No external dependencies — always available, <1s for 1000 entries
57
-
58
- See `guidance-memory-strategy.md` for full embedding pipeline details.
59
-
60
- ---
61
-
62
- ## Search Commands
63
-
64
- All methods auto-detect the stored embedding model and generate matching query vectors:
65
-
66
- **MCP (Preferred):** `mcp__claude-flow__memory_search` — `query: "your query", namespace: "guidance"`
67
-
68
- **CLI (Fallback):**
69
- ```bash
70
- npx flo memory search --query "your query" --namespace guidance
71
- ```
72
-
73
- **Search options:**
74
-
75
- | Flag | Default | Purpose |
76
- |------|---------|---------|
77
- | `--namespace` | all | Filter to specific namespace |
78
- | `--limit` | 5 | Number of results |
79
- | `--threshold` | 0.3 | Minimum similarity score |
80
- | `--json` | false | Output as JSON |
81
-
82
- ### Code Map Search (for codebase navigation)
83
-
84
- When you need to find where a type, service, entity, or component lives — search `code-map` BEFORE using Glob/Grep:
85
-
86
- **MCP:** `mcp__claude-flow__memory_search` — `query: "payment service", namespace: "code-map"`
87
-
88
- **What code-map contains:**
89
-
90
- | Chunk prefix | What it answers |
91
- |--------------|-----------------|
92
- | `project:` | "What's in the api project?" |
93
- | `dir:` | "What types are in the entities directory?" |
94
- | `iface-map:` | "What implements IPaymentService?" |
95
- | `type-index:` | "Where is Service defined?" |
96
-
97
- **Regenerate:**
98
- ```bash
99
- npx flo-codemap # Incremental (skips if unchanged)
100
- npx flo-codemap --force # Full rebuild
101
- ```
102
-
103
- ---
104
-
105
- ## Database Schema
106
-
107
- ```sql
108
- memory_entries (
109
- id TEXT PRIMARY KEY,
110
- key TEXT NOT NULL, -- e.g., "chunk-guidance-core-0"
111
- namespace TEXT, -- "guidance", "patterns", "default"
112
- content TEXT, -- Full text content
113
- embedding TEXT, -- JSON array of 384 floats
114
- embedding_model TEXT, -- "Xenova/all-MiniLM-L6-v2" or "domain-aware-hash-v1"
115
- embedding_dimensions INTEGER,-- 384
116
- metadata TEXT, -- JSON: parentDoc, chunkTitle, prevChunk, nextChunk, siblings
117
- tags TEXT, -- JSON array
118
- status TEXT, -- "active"
119
- created_at INTEGER,
120
- updated_at INTEGER
121
- )
122
- ```
123
-
124
- ---
125
-
126
- ## RAG Linking (metadata fields)
127
-
128
- Each chunk includes navigation metadata:
129
-
130
- | Field | Purpose |
131
- |-------|---------|
132
- | `parentDoc` | Key of full document (e.g., `doc-guidance-core`) |
133
- | `prevChunk` | Previous chunk key for sequential reading |
134
- | `nextChunk` | Next chunk key |
135
- | `siblings` | All chunk keys from same document |
136
- | `hierarchicalParent` | H2 parent for H3 chunks |
137
- | `hierarchicalChildren` | H3 children for H2 chunks |
138
- | `contextBefore` | Overlapping text from previous chunk (20%) |
139
- | `contextAfter` | Overlapping text from next chunk (20%) |
140
-
141
- ---
142
-
143
- ## Namespaces
144
-
145
- | Namespace | Content | Notes |
146
- |-----------|---------|-------|
147
- | `guidance` | Indexed guidance and docs | Largest — includes bundled moflo guidance |
148
- | `code-map` | Structural codebase index (projects, directories, types, interfaces) | Search BEFORE Glob/Grep for navigation |
149
- | `patterns` | Learned patterns from sessions | Grows over time |
150
- | `default` | Misc stored data | Small |
151
-
152
- ---
153
-
154
- ## Session Start Indexing
155
-
156
- On every session start, moflo automatically runs three background indexers:
157
-
158
- | Indexer | Command | Namespace | What it does |
159
- |---------|---------|-----------|--------------|
160
- | Guidance | `npx flo-index` | `guidance` | Chunks markdown, builds RAG links, generates embeddings |
161
- | Code Map | `npx flo-codemap` | `code-map` | Scans source for types, interfaces, directories |
162
- | Learning | `npx flo-learn` | `patterns` | Pattern research on codebase |
163
-
164
- These are configured in the `SessionStart` hook in `.claude/settings.json` (set up by `npx flo init`).
165
-
166
- Indexing is incremental by default — files whose content hash hasn't changed are skipped. Use `--force` to reindex everything.
167
-
168
- ---
169
-
170
- ## Troubleshooting
171
-
172
- | Symptom | Cause | Fix |
173
- |---------|-------|-----|
174
- | Search returns irrelevant results | Query/stored embedding model mismatch | Auto-detected now; verify with `--verbose` flag |
175
- | Low similarity scores | Query doesn't match domain terms | Include domain keywords in query |
176
- | "Vector: No" in list | Entry lacks embedding | Run `npx flo-index --force` |
177
- | Entries not found after adding file | Indexer hasn't run yet | Run `npx flo-index` or restart session |
178
- | Bundled moflo guidance not indexed | Not installed as dependency | Only indexes when `node_modules/moflo/.claude/guidance/` exists |
179
-
180
- ---
181
-
182
- ## Verification Commands
183
-
184
- ```bash
185
- # Test semantic search
186
- npx flo memory search --query "database entity pattern" --namespace guidance
187
-
188
- # Force reindex all guidance
189
- npx flo-index --force
190
-
191
- # Force rebuild embeddings
192
- npx flo-index --force
193
-
194
- # Check entry count (requires better-sqlite3 or sql.js)
195
- npx flo memory list --namespace guidance --limit 0
196
- ```
197
-
198
- ---
199
-
200
- ## See Also
201
-
202
- - `.claude/guidance/guidance-memory-strategy.md` - RAG system tuning guide
203
- - `.claude/guidance/agent-bootstrap.md` - Subagent bootstrap guide
204
- - `.claude/guidance/moflo.md` - Full CLI/MCP reference
1
+ # Memory & Semantic Search Strategy
2
+
3
+ **Purpose:** How memory, embeddings, and semantic search work in moflo. Reference when debugging memory issues, understanding the search pipeline, or configuring memory for a consumer project.
4
+
5
+ ---
6
+
7
+ ## Architecture Overview
8
+
9
+ ```
10
+ Source Files (.claude/guidance/, docs/)
11
+ |
12
+ v
13
+ index-guidance.mjs (chunking, RAG linking)
14
+ |
15
+ v
16
+ .swarm/memory.db (SQLite - entries + metadata)
17
+ |
18
+ v
19
+ build-embeddings.mjs (384-dim neural or hash vectors)
20
+ |
21
+ v
22
+ Search layer (cosine similarity - MCP, CLI, or script)
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Key Files
28
+
29
+ | File | Purpose |
30
+ |------|---------|
31
+ | `.swarm/memory.db` | SQLite database with all entries, embeddings, metadata |
32
+ | `.swarm/code-map-hash.txt` | SHA-256 hash for incremental code map skip |
33
+ | `.claude-flow/neural/patterns.json` | ReasoningBank learned patterns |
34
+ | `bin/build-embeddings.mjs` | Generates 384-dim embeddings |
35
+ | `bin/index-guidance.mjs` | Indexes guidance files with RAG linking |
36
+ | `bin/generate-code-map.mjs` | Generates structural code map (projects, dirs, types, interfaces) |
37
+
38
+ ---
39
+
40
+ ## Embedding Strategy
41
+
42
+ **Primary model:** `Xenova/all-MiniLM-L6-v2` (384-dim, neural — used by `build-embeddings.mjs`)
43
+ **Fallback model:** `domain-aware-hash-v1` (384-dim, hash — used when Transformers.js unavailable)
44
+
45
+ **Critical rule:** Query embeddings MUST match stored embeddings. Both the search scripts and MCP tools auto-detect the stored model and generate matching query vectors. Cross-model cosine similarity is meaningless.
46
+
47
+ **Neural embeddings (primary):**
48
+ - Uses `@xenova/transformers` with ONNX WASM runtime
49
+ - True semantic understanding — "soft delete" matches "mark as deleted" without keyword overlap
50
+ - ~3s for 1000 entries, loaded lazily and cached
51
+
52
+ **Domain-aware hash (fallback):**
53
+ - 12 domain clusters with project-specific terms
54
+ - SimHash-style word encoding + bigram/trigram features
55
+ - Good keyword-level matching, misses semantic paraphrases
56
+ - No external dependencies — always available, <1s for 1000 entries
57
+
58
+ See `guidance-memory-strategy.md` for full embedding pipeline details.
59
+
60
+ ---
61
+
62
+ ## Search Commands
63
+
64
+ All methods auto-detect the stored embedding model and generate matching query vectors:
65
+
66
+ **MCP (Preferred):** `mcp__moflo__memory_search` — `query: "your query", namespace: "guidance"`
67
+
68
+ **CLI (Fallback):**
69
+ ```bash
70
+ npx flo memory search --query "your query" --namespace guidance
71
+ ```
72
+
73
+ **Search options:**
74
+
75
+ | Flag | Default | Purpose |
76
+ |------|---------|---------|
77
+ | `--namespace` | all | Filter to specific namespace |
78
+ | `--limit` | 5 | Number of results |
79
+ | `--threshold` | 0.3 | Minimum similarity score |
80
+ | `--json` | false | Output as JSON |
81
+
82
+ ### Code Map Search (for codebase navigation)
83
+
84
+ When you need to find where a type, service, entity, or component lives — search `code-map` BEFORE using Glob/Grep:
85
+
86
+ **MCP:** `mcp__moflo__memory_search` — `query: "payment service", namespace: "code-map"`
87
+
88
+ **What code-map contains:**
89
+
90
+ | Chunk prefix | What it answers |
91
+ |--------------|-----------------|
92
+ | `project:` | "What's in the api project?" |
93
+ | `dir:` | "What types are in the entities directory?" |
94
+ | `iface-map:` | "What implements IPaymentService?" |
95
+ | `type-index:` | "Where is Service defined?" |
96
+
97
+ **Regenerate:**
98
+ ```bash
99
+ npx flo-codemap # Incremental (skips if unchanged)
100
+ npx flo-codemap --force # Full rebuild
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Database Schema
106
+
107
+ ```sql
108
+ memory_entries (
109
+ id TEXT PRIMARY KEY,
110
+ key TEXT NOT NULL, -- e.g., "chunk-guidance-core-0"
111
+ namespace TEXT, -- "guidance", "patterns", "default"
112
+ content TEXT, -- Full text content
113
+ embedding TEXT, -- JSON array of 384 floats
114
+ embedding_model TEXT, -- "Xenova/all-MiniLM-L6-v2" or "domain-aware-hash-v1"
115
+ embedding_dimensions INTEGER,-- 384
116
+ metadata TEXT, -- JSON: parentDoc, chunkTitle, prevChunk, nextChunk, siblings
117
+ tags TEXT, -- JSON array
118
+ status TEXT, -- "active"
119
+ created_at INTEGER,
120
+ updated_at INTEGER
121
+ )
122
+ ```
123
+
124
+ ---
125
+
126
+ ## RAG Linking (metadata fields)
127
+
128
+ Each chunk includes navigation metadata:
129
+
130
+ | Field | Purpose |
131
+ |-------|---------|
132
+ | `parentDoc` | Key of full document (e.g., `doc-guidance-core`) |
133
+ | `prevChunk` | Previous chunk key for sequential reading |
134
+ | `nextChunk` | Next chunk key |
135
+ | `siblings` | All chunk keys from same document |
136
+ | `hierarchicalParent` | H2 parent for H3 chunks |
137
+ | `hierarchicalChildren` | H3 children for H2 chunks |
138
+ | `contextBefore` | Overlapping text from previous chunk (20%) |
139
+ | `contextAfter` | Overlapping text from next chunk (20%) |
140
+
141
+ ---
142
+
143
+ ## Namespaces
144
+
145
+ | Namespace | Content | Notes |
146
+ |-----------|---------|-------|
147
+ | `guidance` | Indexed guidance and docs | Largest — includes bundled moflo guidance |
148
+ | `code-map` | Structural codebase index (projects, directories, types, interfaces) | Search BEFORE Glob/Grep for navigation |
149
+ | `patterns` | Learned patterns from sessions | Grows over time |
150
+ | `default` | Misc stored data | Small |
151
+
152
+ ---
153
+
154
+ ## Session Start Indexing
155
+
156
+ On every session start, moflo automatically runs three background indexers:
157
+
158
+ | Indexer | Command | Namespace | What it does |
159
+ |---------|---------|-----------|--------------|
160
+ | Guidance | `npx flo-index` | `guidance` | Chunks markdown, builds RAG links, generates embeddings |
161
+ | Code Map | `npx flo-codemap` | `code-map` | Scans source for types, interfaces, directories |
162
+ | Learning | `npx flo-learn` | `patterns` | Pattern research on codebase |
163
+
164
+ These are configured in the `SessionStart` hook in `.claude/settings.json` (set up by `npx flo init`).
165
+
166
+ Indexing is incremental by default — files whose content hash hasn't changed are skipped. Use `--force` to reindex everything.
167
+
168
+ ---
169
+
170
+ ## Troubleshooting
171
+
172
+ | Symptom | Cause | Fix |
173
+ |---------|-------|-----|
174
+ | Search returns irrelevant results | Query/stored embedding model mismatch | Auto-detected now; verify with `--verbose` flag |
175
+ | Low similarity scores | Query doesn't match domain terms | Include domain keywords in query |
176
+ | "Vector: No" in list | Entry lacks embedding | Run `npx flo-index --force` |
177
+ | Entries not found after adding file | Indexer hasn't run yet | Run `npx flo-index` or restart session |
178
+ | Bundled moflo guidance not indexed | Not installed as dependency | Only indexes when `node_modules/moflo/.claude/guidance/` exists |
179
+
180
+ ---
181
+
182
+ ## Verification Commands
183
+
184
+ ```bash
185
+ # Test semantic search
186
+ npx flo memory search --query "database entity pattern" --namespace guidance
187
+
188
+ # Force reindex all guidance
189
+ npx flo-index --force
190
+
191
+ # Force rebuild embeddings
192
+ npx flo-index --force
193
+
194
+ # Check entry count (requires better-sqlite3 or sql.js)
195
+ npx flo memory list --namespace guidance --limit 0
196
+ ```
197
+
198
+ ---
199
+
200
+ ## See Also
201
+
202
+ - `.claude/guidance/guidance-memory-strategy.md` - RAG system tuning guide
203
+ - `.claude/guidance/agent-bootstrap.md` - Subagent bootstrap guide
204
+ - `.claude/guidance/moflo.md` - Full CLI/MCP reference
@@ -2,7 +2,7 @@
2
2
 
3
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
4
 
5
- **MCP-First Policy:** Always prefer MCP tools (`mcp__claude-flow__*`) over CLI commands. Use `ToolSearch` to load them, then call directly. CLI is fallback only.
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
6
 
7
7
  ---
8
8
 
@@ -43,6 +43,20 @@ When a Claude Code session starts, moflo automatically runs three background ind
43
43
 
44
44
  These run in background and are incremental (unchanged files are skipped). Controlled by `auto_index` in `moflo.yaml`.
45
45
 
46
+ ### Helper Script Auto-Sync
47
+
48
+ 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.
49
+
50
+ **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.
51
+
52
+ | Source | Target | Files |
53
+ |--------|--------|-------|
54
+ | `bin/` | `.claude/scripts/` | `hooks.mjs`, `session-start-launcher.mjs`, `index-guidance.mjs`, `build-embeddings.mjs`, `generate-code-map.mjs`, `semantic-search.mjs` |
55
+ | `bin/` | `.claude/helpers/` | `gate.cjs`, `gate-hook.mjs`, `prompt-hook.mjs`, `hook-handler.cjs` |
56
+ | `src/@claude-flow/cli/.claude/helpers/` | `.claude/helpers/` | `auto-memory-hook.mjs`, `statusline.cjs`, `pre-commit`, `post-commit` |
57
+
58
+ 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`.
59
+
46
60
  ### Bundled Guidance
47
61
 
48
62
  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.
@@ -79,7 +93,7 @@ MCP tools are the preferred way for Claude to interact with moflo. `flo init` cr
79
93
  ```json
80
94
  {
81
95
  "mcpServers": {
82
- "claude-flow": {
96
+ "moflo": {
83
97
  "command": "node",
84
98
  "args": ["node_modules/moflo/src/@claude-flow/cli/bin/cli.js", "mcp", "start"]
85
99
  }
@@ -87,7 +101,7 @@ MCP tools are the preferred way for Claude to interact with moflo. `flo init` cr
87
101
  }
88
102
  ```
89
103
 
90
- This gives Claude access to 200+ MCP tools (`mcp__claude-flow__memory_*`, `mcp__claude-flow__hooks_*`, `mcp__claude-flow__swarm_*`, etc.) without any global installation.
104
+ This gives Claude access to 200+ MCP tools (`mcp__moflo__memory_*`, `mcp__moflo__hooks_*`, `mcp__moflo__swarm_*`, etc.) without any global installation.
91
105
 
92
106
  ---
93
107
 
@@ -143,11 +157,11 @@ This gives Claude access to 200+ MCP tools (`mcp__claude-flow__memory_*`, `mcp__
143
157
 
144
158
  | Task | MCP Tool | CLI Fallback |
145
159
  |------|----------|-------------|
146
- | Search memory | `mcp__claude-flow__memory_search` | `memory search --query "..."` |
147
- | Spawn agent | `mcp__claude-flow__agent_spawn` | `agent spawn -t coder --name my-coder` |
148
- | Init swarm | `mcp__claude-flow__swarm_init` | `swarm init --v3-mode` |
149
- | System health | `mcp__claude-flow__system_health` | `doctor --fix` |
150
- | Benchmark | `mcp__claude-flow__performance_benchmark` | `performance benchmark --suite all` |
160
+ | Search memory | `mcp__moflo__memory_search` | `memory search --query "..."` |
161
+ | Spawn agent | `mcp__moflo__agent_spawn` | `agent spawn -t coder --name my-coder` |
162
+ | Init swarm | `mcp__moflo__swarm_init` | `swarm init --v3-mode` |
163
+ | System health | `mcp__moflo__system_health` | `doctor --fix` |
164
+ | Benchmark | `mcp__moflo__performance_benchmark` | `performance benchmark --suite all` |
151
165
 
152
166
  **CLI-only (no MCP equivalent — setup tasks):**
153
167
  ```bash
@@ -249,13 +263,13 @@ npx flo daemon start
249
263
 
250
264
  | Hook | MCP Tool | Key Params |
251
265
  |------|----------|------------|
252
- | Pre-task | `mcp__claude-flow__hooks_pre-task` | `description` |
253
- | Post-task | `mcp__claude-flow__hooks_post-task` | `taskId`, `success` |
254
- | Post-edit | `mcp__claude-flow__hooks_post-edit` | `file`, `trainNeural` |
255
- | Session-start | `mcp__claude-flow__hooks_session-start` | `sessionId` |
256
- | Session-end | `mcp__claude-flow__hooks_session-end` | `exportMetrics` |
257
- | Route | `mcp__claude-flow__hooks_route` | `task` |
258
- | Worker-dispatch | `mcp__claude-flow__hooks_worker-dispatch` | `trigger` |
266
+ | Pre-task | `mcp__moflo__hooks_pre-task` | `description` |
267
+ | Post-task | `mcp__moflo__hooks_post-task` | `taskId`, `success` |
268
+ | Post-edit | `mcp__moflo__hooks_post-edit` | `file`, `trainNeural` |
269
+ | Session-start | `mcp__moflo__hooks_session-start` | `sessionId` |
270
+ | Session-end | `mcp__moflo__hooks_session-end` | `exportMetrics` |
271
+ | Route | `mcp__moflo__hooks_route` | `task` |
272
+ | Worker-dispatch | `mcp__moflo__hooks_worker-dispatch` | `trigger` |
259
273
 
260
274
  ---
261
275
 
@@ -291,7 +305,7 @@ npx flo daemon start
291
305
 
292
306
  ### Before Starting Coding Tasks
293
307
 
294
- **MCP (Preferred):** `mcp__claude-flow__memory_search` — `query: "[task keywords]", namespace: "patterns"`
308
+ **MCP (Preferred):** `mcp__moflo__memory_search` — `query: "[task keywords]", namespace: "patterns"`
295
309
 
296
310
  **CLI Fallback:**
297
311
  ```bash
@@ -302,9 +316,9 @@ npx flo memory search --query '[task keywords]' --namespace patterns
302
316
 
303
317
  | Step | MCP Tool | Key Params |
304
318
  |------|----------|------------|
305
- | 1. Store pattern | `mcp__claude-flow__memory_store` | `namespace: "patterns", key: "[name]", value: "[what worked]"` |
306
- | 2. Train neural | `mcp__claude-flow__hooks_post-edit` | `file: "[main-file]", trainNeural: true` |
307
- | 3. Record completion | `mcp__claude-flow__hooks_post-task` | `taskId: "[id]", success: true, storeResults: true` |
319
+ | 1. Store pattern | `mcp__moflo__memory_store` | `namespace: "patterns", key: "[name]", value: "[what worked]"` |
320
+ | 2. Train neural | `mcp__moflo__hooks_post-edit` | `file: "[main-file]", trainNeural: true` |
321
+ | 3. Record completion | `mcp__moflo__hooks_post-task` | `taskId: "[id]", success: true, storeResults: true` |
308
322
 
309
323
  ### Continuous Improvement Triggers
310
324
 
@@ -337,7 +351,7 @@ npx flo memory search --query '[task keywords]' --namespace patterns
337
351
 
338
352
  ### Store Data
339
353
 
340
- **MCP:** `mcp__claude-flow__memory_store`
354
+ **MCP:** `mcp__moflo__memory_store`
341
355
  - Required: `key`, `value`
342
356
  - Optional: `namespace` (default: "default"), `ttl`, `tags`
343
357
 
@@ -348,7 +362,7 @@ npx flo memory store --key "pattern-auth" --value "JWT with refresh tokens" --na
348
362
 
349
363
  ### Search Data (semantic vector search)
350
364
 
351
- **MCP:** `mcp__claude-flow__memory_search`
365
+ **MCP:** `mcp__moflo__memory_search`
352
366
  - Required: `query`
353
367
  - Optional: `namespace`, `limit`, `threshold`
354
368
 
@@ -359,12 +373,12 @@ npx flo memory search --query "authentication patterns" --namespace patterns --l
359
373
 
360
374
  ### List Entries
361
375
 
362
- **MCP:** `mcp__claude-flow__memory_list`
376
+ **MCP:** `mcp__moflo__memory_list`
363
377
  - Optional: `namespace`, `limit`
364
378
 
365
379
  ### Retrieve Specific Entry
366
380
 
367
- **MCP:** `mcp__claude-flow__memory_retrieve`
381
+ **MCP:** `mcp__moflo__memory_retrieve`
368
382
  - Required: `key`
369
383
  - Optional: `namespace` (default: "default")
370
384
 
@@ -383,11 +397,11 @@ npx flo memory search --query "authentication patterns" --namespace patterns --l
383
397
 
384
398
  | Operation | MCP Tool |
385
399
  |-----------|----------|
386
- | Swarm init | `mcp__claude-flow__swarm_init` |
387
- | Agent spawn | `mcp__claude-flow__agent_spawn` |
388
- | Memory store | `mcp__claude-flow__memory_store` |
389
- | Memory search | `mcp__claude-flow__memory_search` |
390
- | Hooks (all) | `mcp__claude-flow__hooks_<hook-name>` |
400
+ | Swarm init | `mcp__moflo__swarm_init` |
401
+ | Agent spawn | `mcp__moflo__agent_spawn` |
402
+ | Memory store | `mcp__moflo__memory_store` |
403
+ | Memory search | `mcp__moflo__memory_search` |
404
+ | Hooks (all) | `mcp__moflo__hooks_<hook-name>` |
391
405
 
392
406
  ### CLI Commands (Fallback Only):
393
407
 
@@ -402,7 +416,7 @@ npx flo <command> [options]
402
416
 
403
417
  ## Doctor Health Checks
404
418
 
405
- **MCP:** `mcp__claude-flow__system_health` | **CLI:** `npx flo doctor`
419
+ **MCP:** `mcp__moflo__system_health` | **CLI:** `npx flo doctor`
406
420
 
407
421
  Checks: Node version (20+), Git, config validity, daemon status, memory database, API keys, MCP servers, disk space, TypeScript.
408
422
 
@@ -436,7 +450,7 @@ Configure `.mcp.json` in the project root:
436
450
  ```json
437
451
  {
438
452
  "mcpServers": {
439
- "claude-flow": {
453
+ "moflo": {
440
454
  "command": "node",
441
455
  "args": ["node_modules/moflo/src/@claude-flow/cli/bin/cli.js", "mcp", "start"]
442
456
  }
@@ -447,7 +461,7 @@ Configure `.mcp.json` in the project root:
447
461
  ### Alternative: Global MCP Registration
448
462
 
449
463
  ```bash
450
- claude mcp add claude-flow -- npx @claude-flow/cli@alpha
464
+ claude mcp add moflo -- npx @claude-flow/cli@alpha
451
465
  npx flo daemon start
452
466
  npx flo doctor --fix
453
467
  ```