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,508 +1,87 @@
1
- /**
2
- * CLAUDE.md Generator
3
- * Generates enforceable, analyzer-optimized Claude Code configuration
4
- * with template variants for different usage patterns.
5
- *
6
- * Templates: minimal | standard | full | security | performance | solo
7
- * All templates use bullet-format rules with imperative keywords for enforceability.
8
- */
9
- // --- Section Generators (each returns enforceable markdown) ---
10
- function behavioralRules() {
11
- return `## Behavioral Rules (Always Enforced)
1
+ /**
2
+ * CLAUDE.md Generator
3
+ *
4
+ * Generates ONLY the MoFlo section to inject into a project's CLAUDE.md.
5
+ * This must be minimal — just enough for Claude to work with moflo.
6
+ * All detailed docs live in .claude/guidance/shipped/moflo.md (copied at install).
7
+ *
8
+ * Principle: we are guests in the user's CLAUDE.md. Keep it small.
9
+ */
10
+ const MARKER_START = '<!-- MOFLO:INJECTED:START -->';
11
+ const MARKER_END = '<!-- MOFLO:INJECTED:END -->';
12
+ /**
13
+ * The single moflo section injected into CLAUDE.md.
14
+ * ~40 lines. Points to moflo.md for everything else.
15
+ */
16
+ function mofloSection() {
17
+ return `${MARKER_START}
18
+ ## MoFlo — AI Agent Orchestration
19
+
20
+ This project uses [MoFlo](https://github.com/eric-cielo/moflo) for AI-assisted development workflows.
21
+
22
+ ### FIRST ACTION ON EVERY PROMPT: Search Memory
23
+
24
+ Your first tool call for every new user prompt MUST be a memory search. Do this BEFORE Glob, Grep, Read, or any file exploration.
12
25
 
13
- - Do what has been asked; nothing more, nothing less
14
- - NEVER create files unless they're absolutely necessary for achieving your goal
15
- - ALWAYS prefer editing an existing file to creating a new one
16
- - NEVER proactively create documentation files (*.md) or README files unless explicitly requested
17
- - NEVER save working files, text/mds, or tests to the root folder
18
- - Never continuously check status after spawning a swarm — wait for results
19
- - ALWAYS read a file before editing it
20
- - NEVER commit secrets, credentials, or .env files`;
21
- }
22
- function fileOrganization() {
23
- return `## File Organization
24
-
25
- - NEVER save to root folder — use the directories below
26
- - Use \`/src\` for source code files
27
- - Use \`/tests\` for test files
28
- - Use \`/docs\` for documentation and markdown files
29
- - Use \`/config\` for configuration files
30
- - Use \`/scripts\` for utility scripts
31
- - Use \`/examples\` for example code`;
32
- }
33
- function projectArchitecture(options) {
34
- return `## Project Architecture
35
-
36
- - Follow Domain-Driven Design with bounded contexts
37
- - Keep files under 500 lines
38
- - Use typed interfaces for all public APIs
39
- - Prefer TDD London School (mock-first) for new code
40
- - Use event sourcing for state changes
41
- - Ensure input validation at system boundaries
42
-
43
- ### Project Config
44
-
45
- - **Topology**: ${options.runtime.topology}
46
- - **Max Agents**: ${options.runtime.maxAgents}
47
- - **Memory**: ${options.runtime.memoryBackend}
48
- - **HNSW**: ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'}
49
- - **Neural**: ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'}`;
50
- }
51
- function concurrencyRules() {
52
- return `## Concurrency: 1 MESSAGE = ALL RELATED OPERATIONS
53
-
54
- - All operations MUST be concurrent/parallel in a single message
55
- - Use Claude Code's Task tool for spawning agents, not just MCP
56
- - ALWAYS batch ALL todos in ONE TodoWrite call (5-10+ minimum)
57
- - ALWAYS spawn ALL agents in ONE message with full instructions via Task tool
58
- - ALWAYS batch ALL file reads/writes/edits in ONE message
59
- - ALWAYS batch ALL Bash commands in ONE message`;
60
- }
61
- function swarmOrchestration() {
62
- return `## Swarm Orchestration
63
-
64
- - MUST initialize the swarm using CLI tools when starting complex tasks
65
- - MUST spawn concurrent agents using Claude Code's Task tool
66
- - Never use CLI tools alone for execution — Task tool agents do the actual work
67
- - MUST call CLI tools AND Task tool in ONE message for complex work
68
-
69
- ### 3-Tier Model Routing (ADR-026)
70
-
71
- | Tier | Handler | Latency | Cost | Use Cases |
72
- |------|---------|---------|------|-----------|
73
- | **1** | Agent Booster (WASM) | <1ms | $0 | Simple transforms (var→const, add types) — Skip LLM |
74
- | **2** | Haiku | ~500ms | $0.0002 | Simple tasks, low complexity (<30%) |
75
- | **3** | Sonnet/Opus | 2-5s | $0.003-0.015 | Complex reasoning, architecture, security (>30%) |
76
-
77
- - Always check for \`[AGENT_BOOSTER_AVAILABLE]\` or \`[TASK_MODEL_RECOMMENDATION]\` before spawning agents
78
- - Use Edit tool directly when \`[AGENT_BOOSTER_AVAILABLE]\``;
79
- }
80
- function antiDriftConfig() {
81
- return `## Swarm Configuration & Anti-Drift
82
-
83
- - ALWAYS use hierarchical topology for coding swarms
84
- - Keep maxAgents at 6-8 for tight coordination
85
- - Use specialized strategy for clear role boundaries
86
- - Use \`raft\` consensus for hive-mind (leader maintains authoritative state)
87
- - Run frequent checkpoints via \`post-task\` hooks
88
- - Keep shared memory namespace for all agents
89
-
90
- \`\`\`bash
91
- npx moflo swarm init --topology hierarchical --max-agents 8 --strategy specialized
92
- \`\`\``;
93
- }
94
- function autoStartProtocol() {
95
- return `## Swarm Protocols & Routing
96
-
97
- ### Auto-Start Swarm Protocol
98
-
99
- When the user requests a complex task, spawn agents in background and WAIT:
100
-
101
- \`\`\`javascript
102
- // STEP 1: Initialize swarm coordination
103
- Bash("npx moflo swarm init --topology hierarchical --max-agents 8 --strategy specialized")
104
-
105
- // STEP 2: Spawn ALL agents IN BACKGROUND in a SINGLE message
106
- Task({prompt: "Research requirements...", subagent_type: "researcher", run_in_background: true})
107
- Task({prompt: "Design architecture...", subagent_type: "system-architect", run_in_background: true})
108
- Task({prompt: "Implement solution...", subagent_type: "coder", run_in_background: true})
109
- Task({prompt: "Write tests...", subagent_type: "tester", run_in_background: true})
110
- Task({prompt: "Review code quality...", subagent_type: "reviewer", run_in_background: true})
111
26
  \`\`\`
112
-
113
- ### Agent Routing
114
-
115
- | Code | Task | Agents |
116
- |------|------|--------|
117
- | 1 | Bug Fix | coordinator, researcher, coder, tester |
118
- | 3 | Feature | coordinator, architect, coder, tester, reviewer |
119
- | 5 | Refactor | coordinator, architect, coder, reviewer |
120
- | 7 | Performance | coordinator, perf-engineer, coder |
121
- | 9 | Security | coordinator, security-architect, auditor |
122
-
123
- ### Task Complexity Detection
124
-
125
- - AUTO-INVOKE SWARM when task involves: 3+ files, new features, cross-module refactoring, API changes, security, or performance work
126
- - SKIP SWARM for: single file edits, simple bug fixes (1-2 lines), documentation updates, configuration changes`;
127
- }
128
- function executionRules() {
129
- return `## Swarm Execution Rules
130
-
131
- - ALWAYS use \`run_in_background: true\` for all agent Task calls
132
- - ALWAYS put ALL agent Task calls in ONE message for parallel execution
133
- - After spawning, STOP — do NOT add more tool calls or check status
134
- - Never poll TaskOutput or check swarm status — trust agents to return
135
- - When agent results arrive, review ALL results before proceeding`;
136
- }
137
- function cliCommandsTable() {
138
- return `## V3 CLI Commands
139
-
140
- ### Core Commands
141
-
142
- | Command | Subcommands | Description |
143
- |---------|-------------|-------------|
144
- | \`init\` | 4 | Project initialization |
145
- | \`agent\` | 8 | Agent lifecycle management |
146
- | \`swarm\` | 6 | Multi-agent swarm coordination |
147
- | \`memory\` | 11 | AgentDB memory with HNSW search |
148
- | \`task\` | 6 | Task creation and lifecycle |
149
- | \`session\` | 7 | Session state management |
150
- | \`hooks\` | 17 | Self-learning hooks + 12 workers |
151
- | \`hive-mind\` | 6 | Byzantine fault-tolerant consensus |
152
-
153
- ### Quick CLI Examples
154
-
155
- \`\`\`bash
156
- npx moflo init --wizard
157
- npx moflo agent spawn -t coder --name my-coder
158
- npx moflo swarm init --v3-mode
159
- npx moflo memory search --query "authentication patterns"
160
- npx moflo doctor --fix
161
- \`\`\``;
162
- }
163
- function agentTypes() {
164
- return `## Available Agents (60+ Types)
165
-
166
- ### Core Development
167
- \`coder\`, \`reviewer\`, \`tester\`, \`planner\`, \`researcher\`
168
-
169
- ### Specialized
170
- \`security-architect\`, \`security-auditor\`, \`memory-specialist\`, \`performance-engineer\`
171
-
172
- ### Swarm Coordination
173
- \`hierarchical-coordinator\`, \`mesh-coordinator\`, \`adaptive-coordinator\`
174
-
175
- ### GitHub & Repository
176
- \`pr-manager\`, \`code-review-swarm\`, \`issue-tracker\`, \`release-manager\`
177
-
178
- ### SPARC Methodology
179
- \`sparc-coord\`, \`sparc-coder\`, \`specification\`, \`pseudocode\`, \`architecture\``;
180
- }
181
- function hooksSystem() {
182
- return `## Hooks System (27 Hooks + 12 Workers)
183
-
184
- ### Essential Hooks
185
-
186
- | Hook | Description |
187
- |------|-------------|
188
- | \`pre-task\` / \`post-task\` | Task lifecycle with learning |
189
- | \`pre-edit\` / \`post-edit\` | File editing with neural training |
190
- | \`session-start\` / \`session-end\` | Session state persistence |
191
- | \`route\` | Route task to optimal agent |
192
- | \`intelligence\` | RuVector intelligence system |
193
- | \`worker\` | Background worker management |
194
-
195
- ### 12 Background Workers
196
-
197
- | Worker | Priority | Description |
198
- |--------|----------|-------------|
199
- | \`optimize\` | high | Performance optimization |
200
- | \`audit\` | critical | Security analysis |
201
- | \`testgaps\` | normal | Test coverage analysis |
202
- | \`map\` | normal | Codebase mapping |
203
- | \`deepdive\` | normal | Deep code analysis |
204
- | \`document\` | normal | Auto-documentation |
205
-
206
- \`\`\`bash
207
- npx moflo hooks pre-task --description "[task]"
208
- npx moflo hooks post-task --task-id "[id]" --success true
209
- npx moflo hooks worker dispatch --trigger audit
210
- \`\`\``;
211
- }
212
- function learningProtocol() {
213
- return `## Auto-Learning Protocol
214
-
215
- ### Before Starting Any Task
216
- \`\`\`bash
217
- npx moflo memory search --query "[task keywords]" --namespace patterns
218
- npx moflo memory search --query "[task keywords]" --namespace knowledge
219
- npx moflo hooks route --task "[task description]"
220
- \`\`\`
221
-
222
- ### After Completing Any Task Successfully
223
- \`\`\`bash
224
- npx moflo memory store --namespace patterns --key "[pattern-name]" --value "[what worked]"
225
- npx moflo hooks post-task --task-id "[id]" --success true
226
- \`\`\`
227
-
228
- ### When the User Asks You to Remember Something
229
- \`\`\`bash
230
- npx moflo memory store --namespace knowledge --key "[topic]" --value "[what to remember]"
231
- \`\`\`
232
-
233
- The \`knowledge\` namespace is for user-directed project knowledge — things like "always use soft delete",
234
- "don't use MUI DataGrid, use TableComponent", or "the billing service uses Stripe". These are searchable
235
- during the memory-first gate and persist across sessions.
236
-
237
- - ALWAYS check memory before starting new features, debugging, or refactoring
238
- - ALWAYS store user-directed knowledge in the \`knowledge\` namespace when asked to remember something
239
- - ALWAYS store code patterns in the \`patterns\` namespace after solving bugs or finding optimizations`;
240
- }
241
- function memoryCommands() {
242
- return `## Memory Commands Reference
243
-
244
- \`\`\`bash
245
- # Store a code pattern
246
- npx moflo memory store --key "pattern-auth" --value "JWT with refresh" --namespace patterns
247
-
248
- # Store user-directed knowledge (remember for next time)
249
- npx moflo memory store --key "soft-delete" --value "Always use soft delete on entities" --namespace knowledge
250
-
251
- # Search (searches across all namespaces if --namespace omitted)
252
- npx moflo memory search --query "authentication patterns"
253
-
254
- # List entries in a namespace
255
- npx moflo memory list --namespace knowledge --limit 10
256
-
257
- # Retrieve a specific key
258
- npx moflo memory retrieve --key "pattern-auth" --namespace patterns
259
- \`\`\`
260
-
261
- ### Namespaces
262
- | Namespace | Purpose | Populated by |
263
- |-----------|---------|-------------|
264
- | \`guidance\` | Doc chunks from .claude/guidance + docs/ | \`flo-index\` (session start) |
265
- | \`code-map\` | File/dir structure for navigation | \`flo-codemap\` (session start) |
266
- | \`patterns\` | Code patterns from repo analysis | \`hooks pretrain\` (session start) |
267
- | \`knowledge\` | User-directed project knowledge | User ("remember X for next time") |`;
268
- }
269
- function securityRulesLight() {
270
- return `## Security Rules
271
-
272
- - NEVER hardcode API keys, secrets, or credentials in source files
273
- - NEVER commit .env files or any file containing secrets
274
- - Always validate user input at system boundaries
275
- - Always sanitize file paths to prevent directory traversal
276
- - Run \`npx moflo security scan\` after security-related changes`;
277
- }
278
- function buildAndTest() {
279
- return `## Build & Test
280
-
281
- \`\`\`bash
282
- # Build
283
- npm run build
284
-
285
- # Test
286
- npm test
287
-
288
- # Lint
289
- npm run lint
290
- \`\`\`
291
-
292
- - ALWAYS run tests after making code changes
293
- - ALWAYS verify build succeeds before committing`;
294
- }
295
- function securitySection() {
296
- return `## Security Protocol
297
-
298
- - NEVER hardcode API keys, secrets, or credentials in source files
299
- - NEVER commit .env files or any file containing secrets
300
- - Always validate all user input at system boundaries using Zod schemas
301
- - Always sanitize file paths to prevent directory traversal attacks
302
- - Always use parameterized queries — never concatenate SQL strings
303
- - Run security audit after any authentication or authorization changes
304
-
305
- ### Security Scanning
306
- \`\`\`bash
307
- npx moflo security scan --depth full
308
- npx moflo security audit --report
309
- npx moflo security cve --check
27
+ mcp__moflo__memory_search — query: "<task description>", namespace: "guidance" or "patterns" or "code-map"
310
28
  \`\`\`
311
29
 
312
- ### Security Agents
313
- - \`security-architect\` threat modeling, architecture review
314
- - \`security-auditor\` — code audit, vulnerability detection
315
- - Use agent routing code 9 (hierarchical/specialized) for security tasks`;
316
- }
317
- function performanceSection() {
318
- return `## Performance Optimization Protocol
30
+ Search \`guidance\` and \`patterns\` namespaces on every prompt. Search \`code-map\` when navigating the codebase.
31
+ When the user asks you to remember something: \`mcp__moflo__memory_store\` with namespace \`knowledge\`.
319
32
 
320
- - Always run benchmarks before and after performance changes
321
- - Always profile before optimizing — never guess at bottlenecks
322
- - Prefer algorithmic improvements over micro-optimizations
323
- - Keep HNSW search within 150x-12,500x faster target
324
- - Keep memory reduction within 50-75% target with quantization
33
+ ### Workflow Gates (enforced automatically)
325
34
 
326
- ### Performance Tooling
327
- \`\`\`bash
328
- npx moflo performance benchmark --suite all
329
- npx moflo performance profile --target "[component]"
330
- npx moflo performance metrics --format table
331
- \`\`\`
35
+ - **Memory-first**: Must search memory before Glob/Grep/Read
36
+ - **TaskCreate-first**: Must call TaskCreate before spawning Agent tool
332
37
 
333
- ### Performance Agents
334
- - \`performance-engineer\` — profiling, benchmarking, optimization
335
- - \`perf-analyzer\` — bottleneck detection, analysis
336
- - Use agent routing code 7 (hierarchical/specialized) for performance tasks`;
337
- }
338
- function intelligenceSystem() {
339
- return `## Intelligence System (RuVector)
38
+ ### MCP Tools (preferred over CLI)
340
39
 
341
- - **SONA**: Self-Optimizing Neural Architecture (<0.05ms adaptation)
342
- - **HNSW**: 150x-12,500x faster pattern search
343
- - **EWC++**: Elastic Weight Consolidation (prevents forgetting)
344
- - **Flash Attention**: 2.49x-7.47x speedup
40
+ | Tool | Purpose |
41
+ |------|---------|
42
+ | \`mcp__moflo__memory_search\` | Semantic search across indexed knowledge |
43
+ | \`mcp__moflo__memory_store\` | Store patterns and decisions |
44
+ | \`mcp__moflo__hooks_route\` | Route task to optimal agent type |
45
+ | \`mcp__moflo__hooks_pre-task\` | Record task start |
46
+ | \`mcp__moflo__hooks_post-task\` | Record task completion for learning |
345
47
 
346
- The 4-step intelligence pipeline:
347
- 1. **RETRIEVE** - Fetch relevant patterns via HNSW
348
- 2. **JUDGE** - Evaluate with verdicts (success/failure)
349
- 3. **DISTILL** - Extract key learnings via LoRA
350
- 4. **CONSOLIDATE** - Prevent catastrophic forgetting via EWC++`;
351
- }
352
- function envVars() {
353
- return `## Environment Variables
48
+ ### CLI Fallback
354
49
 
355
50
  \`\`\`bash
356
- CLAUDE_FLOW_CONFIG=./claude-flow.config.json
357
- CLAUDE_FLOW_LOG_LEVEL=info
358
- ANTHROPIC_API_KEY=sk-ant-...
359
- CLAUDE_FLOW_MEMORY_BACKEND=hybrid
360
- CLAUDE_FLOW_MEMORY_PATH=./data/memory
361
- \`\`\``;
362
- }
363
- function setupAndBoundary() {
364
- return `## Quick Setup
365
-
366
- \`\`\`bash
367
- claude mcp add claude-flow -- npx -y moflo
368
- npx moflo daemon start
369
- npx moflo doctor --fix
51
+ npx flo-search "[query]" --namespace guidance # Semantic search
52
+ npx flo doctor --fix # Health check
370
53
  \`\`\`
371
54
 
372
- ## Claude Code vs CLI Tools
373
-
374
- - Claude Code's Task tool handles ALL execution: agents, file ops, code generation, git
375
- - CLI tools handle coordination via Bash: swarm init, memory, hooks, routing
376
- - NEVER use CLI tools as a substitute for Task tool agents
377
-
378
- ## Support
379
-
380
- - Documentation: https://github.com/eric-cielo/moflo
381
- - Issues: https://github.com/eric-cielo/moflo/issues`;
382
- }
383
- // --- Template Composers ---
384
- /**
385
- * Template section map — defines which sections are included per template.
386
- */
387
- const TEMPLATE_SECTIONS = {
388
- minimal: [
389
- behavioralRules,
390
- fileOrganization,
391
- projectArchitecture,
392
- (_opts) => buildAndTest(),
393
- (_opts) => securityRulesLight(),
394
- concurrencyRules,
395
- (_opts) => antiDriftConfig(),
396
- executionRules,
397
- (_opts) => cliCommandsTable(),
398
- (_opts) => setupAndBoundary(),
399
- ],
400
- standard: [
401
- behavioralRules,
402
- fileOrganization,
403
- projectArchitecture,
404
- (_opts) => buildAndTest(),
405
- (_opts) => securityRulesLight(),
406
- concurrencyRules,
407
- (_opts) => swarmOrchestration(),
408
- (_opts) => antiDriftConfig(),
409
- executionRules,
410
- (_opts) => cliCommandsTable(),
411
- (_opts) => agentTypes(),
412
- (_opts) => memoryCommands(),
413
- (_opts) => setupAndBoundary(),
414
- ],
415
- full: [
416
- behavioralRules,
417
- fileOrganization,
418
- projectArchitecture,
419
- (_opts) => buildAndTest(),
420
- (_opts) => securityRulesLight(),
421
- concurrencyRules,
422
- (_opts) => swarmOrchestration(),
423
- (_opts) => antiDriftConfig(),
424
- (_opts) => autoStartProtocol(),
425
- executionRules,
426
- (_opts) => cliCommandsTable(),
427
- (_opts) => agentTypes(),
428
- (_opts) => hooksSystem(),
429
- (_opts) => learningProtocol(),
430
- (_opts) => memoryCommands(),
431
- (_opts) => intelligenceSystem(),
432
- (_opts) => envVars(),
433
- (_opts) => setupAndBoundary(),
434
- ],
435
- security: [
436
- behavioralRules,
437
- fileOrganization,
438
- projectArchitecture,
439
- (_opts) => buildAndTest(),
440
- concurrencyRules,
441
- (_opts) => swarmOrchestration(),
442
- (_opts) => antiDriftConfig(),
443
- executionRules,
444
- (_opts) => securitySection(),
445
- (_opts) => cliCommandsTable(),
446
- (_opts) => agentTypes(),
447
- (_opts) => memoryCommands(),
448
- (_opts) => setupAndBoundary(),
449
- ],
450
- performance: [
451
- behavioralRules,
452
- fileOrganization,
453
- projectArchitecture,
454
- (_opts) => buildAndTest(),
455
- (_opts) => securityRulesLight(),
456
- concurrencyRules,
457
- (_opts) => swarmOrchestration(),
458
- (_opts) => antiDriftConfig(),
459
- executionRules,
460
- (_opts) => performanceSection(),
461
- (_opts) => cliCommandsTable(),
462
- (_opts) => agentTypes(),
463
- (_opts) => memoryCommands(),
464
- (_opts) => intelligenceSystem(),
465
- (_opts) => setupAndBoundary(),
466
- ],
467
- solo: [
468
- behavioralRules,
469
- fileOrganization,
470
- projectArchitecture,
471
- (_opts) => buildAndTest(),
472
- (_opts) => securityRulesLight(),
473
- concurrencyRules,
474
- executionRules,
475
- (_opts) => cliCommandsTable(),
476
- (_opts) => memoryCommands(),
477
- (_opts) => setupAndBoundary(),
478
- ],
479
- };
480
- // --- Public API ---
481
- /**
482
- * Generate CLAUDE.md content based on init options and template.
483
- * Template is determined by: options.runtime.claudeMdTemplate > explicit param > 'standard'
484
- */
485
- export function generateClaudeMd(options, template) {
486
- const tmpl = template ?? options.runtime.claudeMdTemplate ?? 'standard';
487
- const sections = TEMPLATE_SECTIONS[tmpl] ?? TEMPLATE_SECTIONS.standard;
488
- const header = `# Claude Code Configuration - MoFlo V4\n`;
489
- const body = sections.map(fn => fn(options)).join('\n\n');
490
- return `${header}\n${body}\n`;
491
- }
492
- /**
493
- * Generate minimal CLAUDE.md content (backward-compatible alias).
494
- */
495
- export function generateMinimalClaudeMd(options) {
496
- return generateClaudeMd(options, 'minimal');
497
- }
498
- /** Available template names for CLI wizard */
499
- export const CLAUDE_MD_TEMPLATES = [
500
- { name: 'minimal', description: 'Quick start — behavioral rules, anti-drift config, CLI reference (~120 lines)' },
501
- { name: 'standard', description: 'Recommended — swarm orchestration, agents, memory commands (~250 lines)' },
502
- { name: 'full', description: 'Everything — hooks, learning protocol, intelligence system (~400 lines)' },
503
- { name: 'security', description: 'Security-focused — adds security scanning, audit protocols, CVE checks' },
504
- { name: 'performance', description: 'Performance-focused — adds benchmarking, profiling, optimization protocols' },
505
- { name: 'solo', description: 'Solo developer — no swarm, simple agent usage, memory commands (~150 lines)' },
506
- ];
507
- export default generateClaudeMd;
55
+ ### Full Reference
56
+
57
+ For CLI commands, hooks, agents, swarm config, memory commands, and moflo.yaml options, see:
58
+ \`.claude/guidance/shipped/moflo.md\`
59
+ ${MARKER_END}`;
60
+ }
61
+ // --- Public API ---
62
+ export { MARKER_START, MARKER_END };
63
+ /**
64
+ * Generate the MoFlo section to inject into CLAUDE.md.
65
+ * Template parameter is accepted for backward compatibility but ignored —
66
+ * all templates now produce the same minimal injection.
67
+ */
68
+ export function generateClaudeMd(_options, _template) {
69
+ return mofloSection() + '\n';
70
+ }
71
+ /**
72
+ * Generate minimal CLAUDE.md content (backward-compatible alias).
73
+ */
74
+ export function generateMinimalClaudeMd(options) {
75
+ return generateClaudeMd(options, 'minimal');
76
+ }
77
+ /** Available template names for CLI wizard (kept for backward compat, all produce same output) */
78
+ export const CLAUDE_MD_TEMPLATES = [
79
+ { name: 'minimal', description: 'Recommended — memory search, workflow gates, MCP tools (~40 lines injected)' },
80
+ { name: 'standard', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
81
+ { name: 'full', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
82
+ { name: 'security', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
83
+ { name: 'performance', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
84
+ { name: 'solo', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
85
+ ];
86
+ export default generateClaudeMd;
508
87
  //# sourceMappingURL=claudemd-generator.js.map