moflo 4.9.20 → 4.9.22

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 (240) hide show
  1. package/.claude/agents/analysis/analyze-code-quality.md +0 -121
  2. package/.claude/agents/analysis/code-analyzer.md +5 -26
  3. package/.claude/agents/architecture/system-design/arch-system-design.md +0 -119
  4. package/.claude/agents/base-template-generator.md +0 -1
  5. package/.claude/agents/core/coder.md +0 -22
  6. package/.claude/agents/core/planner.md +0 -16
  7. package/.claude/agents/core/researcher.md +0 -16
  8. package/.claude/agents/core/reviewer.md +0 -17
  9. package/.claude/agents/core/tester.md +0 -19
  10. package/.claude/agents/custom/test-long-runner.md +0 -2
  11. package/.claude/agents/development/dev-backend-api.md +0 -167
  12. package/.claude/agents/development/dev-database.md +43 -0
  13. package/.claude/agents/development/dev-frontend.md +42 -0
  14. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +0 -112
  15. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +0 -111
  16. package/.claude/agents/security/security-auditor.md +45 -0
  17. package/.claude/guidance/shipped/moflo-agent-rules.md +172 -0
  18. package/.claude/guidance/shipped/moflo-claude-swarm-cohesion.md +73 -265
  19. package/.claude/guidance/shipped/moflo-cli-reference.md +6 -6
  20. package/.claude/guidance/shipped/moflo-core-guidance.md +66 -184
  21. package/.claude/guidance/shipped/moflo-cross-platform.md +1 -1
  22. package/.claude/guidance/shipped/moflo-error-handling.md +3 -3
  23. package/.claude/guidance/shipped/moflo-guidance-rules.md +17 -7
  24. package/.claude/guidance/shipped/moflo-memory-strategy.md +76 -182
  25. package/.claude/guidance/shipped/moflo-memorydb-maintenance.md +6 -8
  26. package/.claude/guidance/shipped/moflo-settings-injection.md +7 -9
  27. package/.claude/guidance/shipped/moflo-source-hygiene.md +5 -5
  28. package/.claude/guidance/shipped/moflo-spell-connectors.md +3 -4
  29. package/.claude/guidance/shipped/moflo-spell-custom-steps.md +3 -4
  30. package/.claude/guidance/shipped/moflo-spell-engine.md +40 -162
  31. package/.claude/guidance/shipped/moflo-spell-runner.md +134 -0
  32. package/.claude/guidance/shipped/moflo-spell-sandboxing.md +10 -57
  33. package/.claude/guidance/shipped/moflo-spell-troubleshooting.md +149 -0
  34. package/.claude/guidance/shipped/moflo-subagents.md +43 -114
  35. package/.claude/guidance/shipped/moflo-task-icons.md +4 -4
  36. package/.claude/guidance/shipped/moflo-user-facing-language.md +3 -3
  37. package/.claude/guidance/shipped/moflo-verbose-command-filtering.md +3 -3
  38. package/.claude/guidance/shipped/moflo-yaml-reference.md +4 -5
  39. package/.claude/helpers/gate.cjs +192 -15
  40. package/.claude/helpers/prompt-hook.mjs +4 -38
  41. package/.claude/helpers/simplify-classify.cjs +32 -11
  42. package/.claude/helpers/subagent-bootstrap.json +1 -1
  43. package/.claude/helpers/subagent-start.cjs +1 -1
  44. package/.claude/skills/connector-builder/SKILL.md +42 -429
  45. package/.claude/skills/connector-builder/templates/connector.md +189 -0
  46. package/.claude/skills/connector-builder/templates/step-command.md +176 -0
  47. package/.claude/skills/eldar/SKILL.md +7 -7
  48. package/.claude/skills/fl/SKILL.md +3 -3
  49. package/.claude/skills/fl/execution-modes.md +39 -16
  50. package/.claude/skills/fl/phases.md +3 -3
  51. package/.claude/skills/{simplify → flo-simplify}/SKILL.md +11 -11
  52. package/.claude/skills/guidance/SKILL.md +17 -9
  53. package/.claude/skills/memory-patterns/SKILL.md +1 -1
  54. package/.claude/skills/publish/SKILL.md +121 -36
  55. package/.claude/skills/reset-epic/SKILL.md +2 -2
  56. package/.claude/skills/spell-builder/SKILL.md +39 -226
  57. package/.claude/skills/spell-builder/architecture.md +1 -1
  58. package/.claude/skills/spell-builder/permissions.md +107 -0
  59. package/.claude/skills/spell-builder/preflight.md +101 -0
  60. package/.claude/skills/spell-schedule/SKILL.md +2 -3
  61. package/bin/gate.cjs +192 -15
  62. package/bin/lib/retired-files.mjs +146 -0
  63. package/bin/prompt-hook.mjs +4 -38
  64. package/bin/session-start-launcher.mjs +120 -1
  65. package/bin/setup-project.mjs +63 -69
  66. package/bin/simplify-classify.cjs +32 -11
  67. package/dist/src/cli/appliance/rvfa-builder.js +1 -1
  68. package/dist/src/cli/commands/agent.js +3 -9
  69. package/dist/src/cli/commands/doctor-checks-deep.js +4 -0
  70. package/dist/src/cli/commands/hooks.js +1 -3
  71. package/dist/src/cli/commands/index.js +2 -0
  72. package/dist/src/cli/commands/retire.js +111 -0
  73. package/dist/src/cli/hooks/reasoningbank/index.js +7 -7
  74. package/dist/src/cli/init/claudemd-generator.js +30 -33
  75. package/dist/src/cli/init/executor.js +53 -69
  76. package/dist/src/cli/init/helpers-generator.js +165 -52
  77. package/dist/src/cli/init/moflo-init.js +41 -114
  78. package/dist/src/cli/init/settings-generator.js +44 -14
  79. package/dist/src/cli/mcp-tools/agent-tools.js +9 -27
  80. package/dist/src/cli/mcp-tools/hooks-tools.js +23 -21
  81. package/dist/src/cli/memory/controllers/semantic-router.js +18 -12
  82. package/dist/src/cli/memory/sona-optimizer.js +6 -6
  83. package/dist/src/cli/neural/domain/services/learning-service.js +3 -3
  84. package/dist/src/cli/services/agent-router.js +2 -5
  85. package/dist/src/cli/services/hook-block-hash.js +11 -2
  86. package/dist/src/cli/services/hook-wiring.js +86 -3
  87. package/dist/src/cli/services/subagent-bootstrap.js +1 -1
  88. package/dist/src/cli/shared/events/example-usage.js +6 -6
  89. package/dist/src/cli/shared/hooks/task-hooks.js +8 -8
  90. package/dist/src/cli/version.js +1 -1
  91. package/package.json +3 -2
  92. package/retired-files.json +1989 -0
  93. package/scripts/post-install-bootstrap.mjs +19 -0
  94. package/src/cli/data/model-registry.json +2 -2
  95. package/.claude/agents/consensus/byzantine-coordinator.md +0 -63
  96. package/.claude/agents/consensus/crdt-synchronizer.md +0 -997
  97. package/.claude/agents/consensus/gossip-coordinator.md +0 -63
  98. package/.claude/agents/consensus/performance-benchmarker.md +0 -851
  99. package/.claude/agents/consensus/quorum-manager.md +0 -823
  100. package/.claude/agents/consensus/raft-manager.md +0 -63
  101. package/.claude/agents/consensus/security-manager.md +0 -622
  102. package/.claude/agents/data/ml/data-ml-model.md +0 -193
  103. package/.claude/agents/github/code-review-swarm.md +0 -538
  104. package/.claude/agents/github/github-modes.md +0 -172
  105. package/.claude/agents/github/issue-tracker.md +0 -311
  106. package/.claude/agents/github/multi-repo-swarm.md +0 -551
  107. package/.claude/agents/github/pr-manager.md +0 -183
  108. package/.claude/agents/github/project-board-sync.md +0 -508
  109. package/.claude/agents/github/release-manager.md +0 -360
  110. package/.claude/agents/github/release-swarm.md +0 -580
  111. package/.claude/agents/github/repo-architect.md +0 -391
  112. package/.claude/agents/github/swarm-issue.md +0 -566
  113. package/.claude/agents/github/swarm-pr.md +0 -414
  114. package/.claude/agents/github/sync-coordinator.md +0 -426
  115. package/.claude/agents/github/workflow-automation.md +0 -606
  116. package/.claude/agents/goal/code-goal-planner.md +0 -440
  117. package/.claude/agents/goal/goal-planner.md +0 -168
  118. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -127
  119. package/.claude/agents/hive-mind/queen-coordinator.md +0 -198
  120. package/.claude/agents/hive-mind/scout-explorer.md +0 -233
  121. package/.claude/agents/hive-mind/swarm-memory-manager.md +0 -184
  122. package/.claude/agents/hive-mind/worker-specialist.md +0 -208
  123. package/.claude/agents/neural/safla-neural.md +0 -73
  124. package/.claude/agents/optimization/benchmark-suite.md +0 -665
  125. package/.claude/agents/optimization/load-balancer.md +0 -431
  126. package/.claude/agents/optimization/performance-monitor.md +0 -672
  127. package/.claude/agents/optimization/resource-allocator.md +0 -674
  128. package/.claude/agents/optimization/topology-optimizer.md +0 -808
  129. package/.claude/agents/reasoning/goal-planner.md +0 -67
  130. package/.claude/agents/sona/sona-learning-optimizer.md +0 -74
  131. package/.claude/agents/sparc/architecture.md +0 -472
  132. package/.claude/agents/sparc/pseudocode.md +0 -318
  133. package/.claude/agents/sparc/refinement.md +0 -525
  134. package/.claude/agents/sparc/specification.md +0 -276
  135. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -225
  136. package/.claude/agents/swarm/adaptive-coordinator.md +0 -391
  137. package/.claude/agents/swarm/hierarchical-coordinator.md +0 -321
  138. package/.claude/agents/swarm/mesh-coordinator.md +0 -383
  139. package/.claude/agents/testing/production-validator.md +0 -395
  140. package/.claude/agents/testing/tdd-london-swarm.md +0 -244
  141. package/.claude/agents/v3/adr-architect.md +0 -184
  142. package/.claude/agents/v3/aidefence-guardian.md +0 -277
  143. package/.claude/agents/v3/claims-authorizer.md +0 -208
  144. package/.claude/agents/v3/collective-intelligence-coordinator.md +0 -988
  145. package/.claude/agents/v3/ddd-domain-expert.md +0 -220
  146. package/.claude/agents/v3/injection-analyst.md +0 -232
  147. package/.claude/agents/v3/memory-specialist.md +0 -987
  148. package/.claude/agents/v3/performance-engineer.md +0 -1225
  149. package/.claude/agents/v3/pii-detector.md +0 -146
  150. package/.claude/agents/v3/reasoningbank-learner.md +0 -213
  151. package/.claude/agents/v3/security-architect-aidefence.md +0 -405
  152. package/.claude/agents/v3/security-architect.md +0 -865
  153. package/.claude/agents/v3/security-auditor.md +0 -771
  154. package/.claude/agents/v3/sparc-orchestrator.md +0 -182
  155. package/.claude/agents/v3/swarm-memory-manager.md +0 -142
  156. package/.claude/agents/v3/v3-integration-architect.md +0 -205
  157. package/.claude/commands/claude-flow-help.md +0 -103
  158. package/.claude/commands/claude-flow-memory.md +0 -107
  159. package/.claude/commands/claude-flow-swarm.md +0 -205
  160. package/.claude/commands/github/README.md +0 -11
  161. package/.claude/commands/github/code-review-swarm.md +0 -514
  162. package/.claude/commands/github/code-review.md +0 -25
  163. package/.claude/commands/github/github-modes.md +0 -146
  164. package/.claude/commands/github/github-swarm.md +0 -113
  165. package/.claude/commands/github/issue-tracker.md +0 -284
  166. package/.claude/commands/github/issue-triage.md +0 -25
  167. package/.claude/commands/github/multi-repo-swarm.md +0 -519
  168. package/.claude/commands/github/pr-enhance.md +0 -26
  169. package/.claude/commands/github/pr-manager.md +0 -164
  170. package/.claude/commands/github/project-board-sync.md +0 -471
  171. package/.claude/commands/github/release-manager.md +0 -332
  172. package/.claude/commands/github/release-swarm.md +0 -544
  173. package/.claude/commands/github/repo-analyze.md +0 -25
  174. package/.claude/commands/github/repo-architect.md +0 -361
  175. package/.claude/commands/github/swarm-issue.md +0 -482
  176. package/.claude/commands/github/swarm-pr.md +0 -285
  177. package/.claude/commands/github/sync-coordinator.md +0 -294
  178. package/.claude/commands/github/workflow-automation.md +0 -442
  179. package/.claude/commands/hooks/README.md +0 -11
  180. package/.claude/commands/hooks/overview.md +0 -58
  181. package/.claude/commands/hooks/post-edit.md +0 -117
  182. package/.claude/commands/hooks/post-task.md +0 -112
  183. package/.claude/commands/hooks/pre-edit.md +0 -113
  184. package/.claude/commands/hooks/pre-task.md +0 -111
  185. package/.claude/commands/hooks/session-end.md +0 -118
  186. package/.claude/commands/hooks/setup.md +0 -103
  187. package/.claude/commands/simplify.md +0 -101
  188. package/.claude/commands/sparc/analyzer.md +0 -42
  189. package/.claude/commands/sparc/architect.md +0 -43
  190. package/.claude/commands/sparc/ask.md +0 -86
  191. package/.claude/commands/sparc/batch-executor.md +0 -44
  192. package/.claude/commands/sparc/code.md +0 -78
  193. package/.claude/commands/sparc/coder.md +0 -44
  194. package/.claude/commands/sparc/debug.md +0 -72
  195. package/.claude/commands/sparc/debugger.md +0 -44
  196. package/.claude/commands/sparc/designer.md +0 -43
  197. package/.claude/commands/sparc/devops.md +0 -98
  198. package/.claude/commands/sparc/docs-writer.md +0 -69
  199. package/.claude/commands/sparc/documenter.md +0 -44
  200. package/.claude/commands/sparc/innovator.md +0 -44
  201. package/.claude/commands/sparc/integration.md +0 -72
  202. package/.claude/commands/sparc/mcp.md +0 -106
  203. package/.claude/commands/sparc/memory-manager.md +0 -44
  204. package/.claude/commands/sparc/optimizer.md +0 -44
  205. package/.claude/commands/sparc/orchestrator.md +0 -116
  206. package/.claude/commands/sparc/post-deployment-monitoring-mode.md +0 -72
  207. package/.claude/commands/sparc/refinement-optimization-mode.md +0 -72
  208. package/.claude/commands/sparc/researcher.md +0 -44
  209. package/.claude/commands/sparc/reviewer.md +0 -44
  210. package/.claude/commands/sparc/security-review.md +0 -69
  211. package/.claude/commands/sparc/sparc-modes.md +0 -139
  212. package/.claude/commands/sparc/sparc.md +0 -99
  213. package/.claude/commands/sparc/spec-pseudocode.md +0 -69
  214. package/.claude/commands/sparc/spell-manager.md +0 -44
  215. package/.claude/commands/sparc/supabase-admin.md +0 -337
  216. package/.claude/commands/sparc/swarm-coordinator.md +0 -44
  217. package/.claude/commands/sparc/tdd.md +0 -44
  218. package/.claude/commands/sparc/tester.md +0 -44
  219. package/.claude/commands/sparc/tutorial.md +0 -68
  220. package/.claude/commands/sparc.md +0 -151
  221. package/.claude/guidance/shipped/moflo-session-start.md +0 -154
  222. package/.claude/guidance/shipped/moflo-spell-engine-architecture.md +0 -145
  223. package/.claude/skills/browser/SKILL.md +0 -204
  224. package/.claude/skills/github-code-review/SKILL.md +0 -1140
  225. package/.claude/skills/github-multi-repo/SKILL.md +0 -866
  226. package/.claude/skills/github-project-management/SKILL.md +0 -1272
  227. package/.claude/skills/github-release-management/SKILL.md +0 -1074
  228. package/.claude/skills/github-workflow-automation/SKILL.md +0 -1060
  229. package/.claude/skills/hive-mind-advanced/SKILL.md +0 -712
  230. package/.claude/skills/hooks-automation/SKILL.md +0 -1193
  231. package/.claude/skills/pair-programming/SKILL.md +0 -1202
  232. package/.claude/skills/performance-analysis/SKILL.md +0 -563
  233. package/.claude/skills/skill-builder/SKILL.md +0 -910
  234. package/.claude/skills/sparc-methodology/SKILL.md +0 -904
  235. package/.claude/skills/stream-chain/SKILL.md +0 -563
  236. package/.claude/skills/swarm-advanced/SKILL.md +0 -811
  237. package/.claude/skills/swarm-orchestration/SKILL.md +0 -179
  238. package/.claude/skills/verification-quality/SKILL.md +0 -649
  239. package/.claude/skills/worker-benchmarks/skill.md +0 -135
  240. package/.claude/skills/worker-integration/skill.md +0 -154
@@ -15,6 +15,8 @@ import { execSync } from 'child_process';
15
15
  import { locateMofloRootPath } from '../services/moflo-require.js';
16
16
  import { errorDetail } from '../shared/utils/error-detail.js';
17
17
  import { discoverGuidanceDirs, discoverSrcDirs, discoverTestDirs, detectExtensions, renderMofloYaml, } from './moflo-yaml-template.js';
18
+ import { generateClaudeMd as generateMofloSection, MARKER_START, MARKER_END, LEGACY_MARKER_STARTS, LEGACY_MARKER_ENDS, } from './claudemd-generator.js';
19
+ import { DEFAULT_INIT_OPTIONS } from './types.js';
18
20
  export { discoverTestDirs };
19
21
  // ============================================================================
20
22
  // Init
@@ -138,11 +140,10 @@ export async function initMoflo(options) {
138
140
  steps.push(syncScripts(projectRoot, force));
139
141
  // Step 6: .gitignore entries
140
142
  steps.push(updateGitignore(projectRoot));
141
- // Step 7: .claude/guidance/moflo-bootstrap.md (subagent bootstrap protocol)
142
- steps.push(syncBootstrapGuidance(projectRoot, force));
143
- // Step 8: Sync ALL shipped guidance docs from moflo to project
143
+ // Step 7: Sync ALL shipped guidance docs from moflo to project (includes
144
+ // moflo-subagents.md — no separate rename to moflo-bootstrap.md, see #939)
144
145
  steps.push(...syncAllShippedGuidance(projectRoot, force));
145
- // Step 9: Install global `flo` shim so bare `flo` command works without npx
146
+ // Step 8: Install global `flo` shim so bare `flo` command works without npx
146
147
  steps.push(installGlobalFloShim(projectRoot));
147
148
  return { steps };
148
149
  }
@@ -222,6 +223,16 @@ function generateHooks(root, force, answers) {
222
223
  { "type": "command", "command": gateHook('check-dangerous-command'), "timeout": 2000 },
223
224
  { "type": "command", "command": gateHook('check-before-pr'), "timeout": 2000 }
224
225
  ]
226
+ },
227
+ {
228
+ // #931 — Advisory only; never blocks. TaskCreate REMINDER and the
229
+ // namespace hint moved here from UserPromptSubmit so they emit only
230
+ // when Claude is about to spawn an Agent — saves ~90 tokens × every
231
+ // prompt × every consumer. Routed via gate-hook.mjs so Claude Code's
232
+ // session_id is forwarded as HOOK_SESSION_ID, enabling per-actor
233
+ // single-shot emission (mirror of #879's record-memory-searched fix).
234
+ "matcher": "^Agent$",
235
+ "hooks": [{ "type": "command", "command": gateHook('check-before-agent'), "timeout": 2000 }]
225
236
  }
226
237
  ],
227
238
  "PostToolUse": [
@@ -252,12 +263,16 @@ function generateHooks(root, force, answers) {
252
263
  "hooks": [{ "type": "command", "command": gateHook('record-skill-run'), "timeout": 2000 }]
253
264
  },
254
265
  {
266
+ // Anchored alternation — Claude Code anchors hook matchers (`^…$` semantics),
267
+ // so a bare `mcp__moflo__memory_` never matches any real MCP tool name and the
268
+ // hook silently no-ops (#929 regression). The explicit suffix list keeps the
269
+ // matcher narrow while catching every memory_* tool we ship.
255
270
  // Use gateHook (not gate) so the wrapper forwards Claude Code's session_id as
256
271
  // HOOK_SESSION_ID — record-memory-searched needs this to mark the per-actor map
257
272
  // (memorySearchedBy[sid]) that check-before-read consults under #838's per-actor gating.
258
273
  // Without it, the legacy boolean is set but the per-actor map stays empty, and the gate
259
274
  // blocks every Read forever within the turn (issue #879).
260
- "matcher": "mcp__moflo__memory_",
275
+ "matcher": "^mcp__moflo__memory_(search|retrieve|list|stats|store)$",
261
276
  "hooks": [{ "type": "command", "command": gateHook('record-memory-searched'), "timeout": 3000 }]
262
277
  },
263
278
  {
@@ -272,11 +287,13 @@ function generateHooks(root, force, answers) {
272
287
  ]
273
288
  },
274
289
  {
275
- // prompt-reminder is REQUIRED to reset memorySearched/memorySearchedBy on each
276
- // new prompt and reclassify memoryRequired. Without it, gate state leaks across
277
- // prompts. Separate hook entry so a prompt-hook.mjs exception doesn't skip the reset.
290
+ // prompt-state-reset is REQUIRED to reset memorySearched/memorySearchedBy on
291
+ // each new prompt and reclassify memoryRequired. Without it, gate state leaks
292
+ // across prompts. Separate hook entry so a prompt-hook.mjs exception doesn't
293
+ // skip the reset. Idempotent state reset only — no emission, no
294
+ // interactionCount increment (#931 dedupe).
278
295
  "hooks": [
279
- { "type": "command", "command": gateHook('prompt-reminder'), "timeout": 3000 }
296
+ { "type": "command", "command": gateHook('prompt-state-reset'), "timeout": 3000 }
280
297
  ]
281
298
  }
282
299
  ],
@@ -381,24 +398,16 @@ function generateSkill(root, force) {
381
398
  // ============================================================================
382
399
  // Step 4: CLAUDE.md MoFlo section
383
400
  // ============================================================================
384
- // Markers for idempotent CLAUDE.md injection — keep in sync with claudemd-generator.ts
385
- const MOFLO_MARKER = '<!-- MOFLO:INJECTED:START -->';
386
- const MOFLO_MARKER_END = '<!-- MOFLO:INJECTED:END -->';
387
- // Also detect legacy markers so we can replace them
388
- const LEGACY_MARKERS = ['<!-- MOFLO:START -->', '<!-- MOFLO:SUBAGENT-PROTOCOL:START -->'];
389
- const LEGACY_MARKERS_END = ['<!-- MOFLO:END -->', '<!-- MOFLO:SUBAGENT-PROTOCOL:END -->'];
390
- function generateClaudeMd(root, force) {
401
+ function generateClaudeMd(root, _force) {
391
402
  const claudeMdPath = path.join(root, 'CLAUDE.md');
392
403
  let existing = '';
393
404
  if (fs.existsSync(claudeMdPath)) {
394
405
  existing = fs.readFileSync(claudeMdPath, 'utf-8');
395
- // Check for current or legacy markers
396
- const allStartMarkers = [MOFLO_MARKER, ...LEGACY_MARKERS];
397
- const allEndMarkers = [MOFLO_MARKER_END, ...LEGACY_MARKERS_END];
406
+ // Strip current or legacy MoFlo block so we can re-inject the latest content.
407
+ const allStartMarkers = [MARKER_START, ...LEGACY_MARKER_STARTS];
408
+ const allEndMarkers = [MARKER_END, ...LEGACY_MARKER_ENDS];
398
409
  for (let i = 0; i < allStartMarkers.length; i++) {
399
410
  if (existing.includes(allStartMarkers[i])) {
400
- // Always strip the existing section so we can re-inject the latest version.
401
- // This ensures CLAUDE.md stays current when moflo updates its injected content.
402
411
  const startIdx = existing.indexOf(allStartMarkers[i]);
403
412
  const endIdx = existing.indexOf(allEndMarkers[i]);
404
413
  if (endIdx > startIdx) {
@@ -407,60 +416,14 @@ function generateClaudeMd(root, force) {
407
416
  }
408
417
  }
409
418
  }
410
- // Minimal injection just enough for Claude to work with moflo.
411
- // All detailed docs live in .claude/guidance/shipped/moflo-core-guidance.md.
412
- const mofloSection = `
413
- ${MOFLO_MARKER}
414
- ## MoFlo — AI Agent Orchestration
415
-
416
- This project uses [MoFlo](https://github.com/eric-cielo/moflo) for AI-assisted development spells.
417
-
418
- ### FIRST ACTION ON EVERY PROMPT: Search Memory
419
-
420
- Your first tool call for every new user prompt MUST be a memory search. Do this BEFORE Glob, Grep, Read, or any file exploration.
421
-
422
- \`\`\`
423
- mcp__moflo__memory_search — query: "<task description>", namespace: "guidance" or "patterns" or "learnings" or "code-map" or "tests"
424
- \`\`\`
425
-
426
- Search \`guidance\`, \`patterns\`, and \`learnings\` namespaces on every prompt. Search \`code-map\` when navigating the codebase, \`tests\` when looking for test inventory or coverage.
427
- When the user asks you to remember something: \`mcp__moflo__memory_store\` with namespace \`learnings\`.
428
-
429
- ### Spell Gates (enforced automatically)
430
-
431
- - **Memory-first**: Must search memory before Glob/Grep/Read
432
- - **TaskCreate-first**: Must call TaskCreate before spawning Agent tool
433
- - **Task Icons**: \`TaskCreate\` MUST use ICON+[Role] format — see \`.claude/guidance/moflo-task-icons.md\`
434
-
435
- ### MCP Tools (preferred over CLI)
436
-
437
- | Tool | Purpose |
438
- |------|---------|
439
- | \`mcp__moflo__memory_search\` | Semantic search across indexed knowledge |
440
- | \`mcp__moflo__memory_store\` | Store patterns and decisions |
441
- | \`mcp__moflo__hooks_route\` | Route task to optimal agent type |
442
- | \`mcp__moflo__hooks_pre-task\` | Record task start |
443
- | \`mcp__moflo__hooks_post-task\` | Record task completion for learning |
444
-
445
- ### CLI Fallback
446
-
447
- \`\`\`bash
448
- flo-search "[query]" --namespace guidance # Semantic search
449
- flo doctor --fix # Health check
450
- \`\`\`
451
-
452
- ### Full Reference
453
-
454
- For CLI commands, hooks, agents, swarm config, memory commands, and moflo.yaml options, see:
455
- \`.claude/guidance/shipped/moflo-core-guidance.md\`
456
- ${MOFLO_MARKER_END}
457
- `;
458
- const finalContent = existing.trimEnd() + '\n' + mofloSection;
419
+ // Single source of truth: claudemd-generator.ts owns the section content.
420
+ const canonical = generateMofloSection(DEFAULT_INIT_OPTIONS);
421
+ const finalContent = existing.trimEnd() + '\n\n' + canonical;
459
422
  fs.writeFileSync(claudeMdPath, finalContent, 'utf-8');
460
423
  return {
461
424
  name: 'CLAUDE.md',
462
425
  status: existing ? 'updated' : 'created',
463
- detail: 'MoFlo section injected (~35 lines)',
426
+ detail: 'MoFlo section injected (~22 lines)',
464
427
  };
465
428
  }
466
429
  // ============================================================================
@@ -561,48 +524,10 @@ function updateGitignore(root) {
561
524
  return { name: '.gitignore', status: 'updated', detail: `Added: ${toAdd.join(', ')}` };
562
525
  }
563
526
  // ============================================================================
564
- // Step 7: .claude/guidance/moflo-bootstrap.md
565
- // Copies the agent bootstrap guidance to the project so subagents can read it
566
- // from disk without requiring memory search.
567
- // ============================================================================
568
- function syncBootstrapGuidance(root, force) {
569
- const guidanceDir = path.join(root, '.claude', 'guidance');
570
- const targetFile = path.join(guidanceDir, 'moflo-bootstrap.md');
571
- const candidates = [
572
- path.join(root, 'node_modules', 'moflo', '.claude', 'guidance', 'shipped', 'moflo-subagents.md'),
573
- // Anchor on moflo's own package root (covers dev + installed; #782).
574
- ...mofloRootJoin('.claude', 'guidance', 'shipped', 'moflo-subagents.md'),
575
- ];
576
- const sourceFile = candidates.find(f => { try {
577
- return fs.existsSync(f);
578
- }
579
- catch {
580
- return false;
581
- } });
582
- if (!sourceFile) {
583
- return { name: 'guidance/moflo-bootstrap.md', status: 'skipped', detail: 'Source bootstrap not found' };
584
- }
585
- // Check if target exists and is up to date
586
- if (fs.existsSync(targetFile) && !force) {
587
- if (!isStale(sourceFile, targetFile)) {
588
- return { name: 'guidance/moflo-bootstrap.md', status: 'skipped', detail: 'Already up to date' };
589
- }
590
- }
591
- // Read source and prepend header
592
- const content = fs.readFileSync(sourceFile, 'utf-8');
593
- const header = `<!-- AUTO-GENERATED by moflo init. Do not edit — changes will be overwritten on next init. -->\n<!-- Source: moflo/.claude/guidance/shipped/moflo-subagents.md -->\n<!-- To customize, create your own project-specific guidance in .claude/guidance/. -->\n\n`;
594
- fs.mkdirSync(guidanceDir, { recursive: true });
595
- fs.writeFileSync(targetFile, header + content, 'utf-8');
596
- return {
597
- name: 'guidance/moflo-bootstrap.md',
598
- status: fs.existsSync(targetFile) ? 'updated' : 'created',
599
- detail: 'Subagent bootstrap protocol'
600
- };
601
- }
602
- // ============================================================================
603
- // Step 8: Sync ALL shipped guidance docs
527
+ // Step 7: Sync ALL shipped guidance docs
604
528
  // Discovers all .md files in moflo/.claude/guidance/shipped/ and copies them
605
- // to project .claude/guidance/. Skips moflo-subagents.md (handled by Step 7).
529
+ // to project .claude/guidance/ (including moflo-subagents.md see #939, prior
530
+ // versions renamed it to moflo-bootstrap.md, creating a structural duplicate).
606
531
  // ============================================================================
607
532
  function syncAllShippedGuidance(root, force) {
608
533
  const guidanceDir = path.join(root, '.claude', 'guidance');
@@ -621,8 +546,10 @@ function syncAllShippedGuidance(root, force) {
621
546
  if (!shippedDir) {
622
547
  return [{ name: 'guidance/shipped/*', status: 'skipped', detail: 'Shipped guidance directory not found' }];
623
548
  }
624
- // Discover all .md files, skip moflo-subagents.md (synced separately as moflo-bootstrap.md)
625
- const files = fs.readdirSync(shippedDir).filter(f => f.endsWith('.md') && f !== 'moflo-subagents.md');
549
+ // Discover all shipped .md files dynamically including moflo-subagents.md
550
+ // (#939: prior versions renamed it to moflo-bootstrap.md as a separate step,
551
+ // which left two copies of the same content on consumer disk).
552
+ const files = fs.readdirSync(shippedDir).filter(f => f.endsWith('.md'));
626
553
  if (files.length === 0) {
627
554
  return [{ name: 'guidance/shipped/*', status: 'skipped', detail: 'No shipped guidance files found' }];
628
555
  }
@@ -236,6 +236,18 @@ function generateHooksConfig(config) {
236
236
  { type: 'command', command: gateHookCmd('check-before-pr'), timeout: 2000 },
237
237
  ],
238
238
  },
239
+ // #931 — TaskCreate REMINDER + namespace hint moved here from
240
+ // UserPromptSubmit. They only matter when Claude is about to spawn an
241
+ // Agent; emitting per-prompt cost ~90 tokens × every prompt × every
242
+ // consumer. Advisory only — never blocks. Routed through gate-hook.mjs
243
+ // so Claude Code's session_id is forwarded as HOOK_SESSION_ID — the
244
+ // namespace hint emission tracks per-actor (mirror of #879's fix for
245
+ // record-memory-searched), so subagents that spawn their own agents
246
+ // still get the hint on their first check.
247
+ {
248
+ matcher: '^Agent$',
249
+ hooks: [{ type: 'command', command: gateHookCmd('check-before-agent'), timeout: 2000 }],
250
+ },
239
251
  ];
240
252
  }
241
253
  // PostToolUse — record outcomes for learning
@@ -270,13 +282,16 @@ function generateHooksConfig(config) {
270
282
  hooks: [{ type: 'command', command: gateHookCmd('record-skill-run'), timeout: 2000 }],
271
283
  },
272
284
  {
273
- // Simplified matcheranchored regex with parens doesn't match MCP tool names reliably.
274
- // Use gateHookCmd (not gateCmd) so the wrapper forwards Claude Code's session_id as
275
- // HOOK_SESSION_ID record-memory-searched needs this to mark the per-actor map
276
- // (memorySearchedBy[sid]) that check-before-read consults under #838's per-actor gating.
277
- // Without it, the legacy boolean is set but the per-actor map stays empty, and the gate
278
- // blocks every Read forever within the turn (issue #879).
279
- matcher: 'mcp__moflo__memory_',
285
+ // Anchored alternationClaude Code anchors hook matchers (`^…$` semantics),
286
+ // so a bare `mcp__moflo__memory_` never matches any real MCP tool name and the
287
+ // hook silently no-ops (#929 regression). Listing the explicit suffixes keeps
288
+ // the matcher narrow while still catching every memory_* tool we ship.
289
+ // Use gateHookCmd (not gateCmd) so the wrapper forwards Claude Code's session_id
290
+ // as HOOK_SESSION_ID record-memory-searched needs this to mark the per-actor
291
+ // map (memorySearchedBy[sid]) that check-before-read consults under #838's
292
+ // per-actor gating. Without it, the legacy boolean is set but the per-actor map
293
+ // stays empty, and the gate blocks every Read forever within the turn (#879).
294
+ matcher: '^mcp__moflo__memory_(search|retrieve|list|stats|store)$',
280
295
  hooks: [{ type: 'command', command: gateHookCmd('record-memory-searched'), timeout: 3000 }],
281
296
  },
282
297
  {
@@ -287,14 +302,29 @@ function generateHooksConfig(config) {
287
302
  matcher: '^mcp__moflo__memory_store$',
288
303
  hooks: [{ type: 'command', command: gateCmd('record-learnings-stored'), timeout: 2000 }],
289
304
  },
305
+ {
306
+ // #952 — when /fl is invoked with -s/--swarm, the gate blocks Agent
307
+ // spawns until mcp__moflo__swarm_init runs. Record the call here so
308
+ // the hard block in check-before-agent passes for legitimate /fl runs.
309
+ matcher: '^mcp__moflo__swarm_init$',
310
+ hooks: [{ type: 'command', command: gateCmd('record-swarm-init'), timeout: 2000 }],
311
+ },
312
+ {
313
+ // #952 — symmetric record for /fl -h/--hive runs.
314
+ matcher: '^mcp__moflo__hive-mind_init$',
315
+ hooks: [{ type: 'command', command: gateCmd('record-hive-init'), timeout: 2000 }],
316
+ },
290
317
  ];
291
318
  }
292
- // UserPromptSubmit — gate reminders + intelligent task routing.
293
- // The prompt-reminder hook is REQUIRED it resets memorySearched / memorySearchedBy
294
- // and reclassifies memoryRequired from the new prompt. Without it, gate state leaks
295
- // across prompts: a previous turn's "satisfied" state survives, OR a previous turn's
296
- // "armed" state never clears. Two separate hook entries (not chained) so an exception
297
- // in prompt-hook.mjs doesn't skip the reset.
319
+ // UserPromptSubmit — per-prompt state reset + Context warnings.
320
+ // Two separate hook entries (not chained) so an exception in prompt-hook.mjs
321
+ // doesn't skip the reset. The first hook runs prompt-hook.mjs which invokes
322
+ // gate.cjs `prompt-reminder` (full reset + interactionCount + Context
323
+ // warnings). The second hook runs `prompt-state-reset` a defensive
324
+ // safety-net that re-applies the idempotent state reset (memorySearched,
325
+ // memorySearchedBy, memoryRequired, lastNamespaceHint) without
326
+ // double-incrementing interactionCount or duplicating any user-visible
327
+ // emission (#931).
298
328
  if (config.userPromptSubmit) {
299
329
  hooks.UserPromptSubmit = [
300
330
  {
@@ -304,7 +334,7 @@ function generateHooksConfig(config) {
304
334
  },
305
335
  {
306
336
  hooks: [
307
- { type: 'command', command: gateHookCmd('prompt-reminder'), timeout: 3000 },
337
+ { type: 'command', command: gateHookCmd('prompt-state-reset'), timeout: 3000 },
308
338
  ],
309
339
  },
310
340
  ];
@@ -27,33 +27,16 @@ const CANONICAL_AGENT_TYPES = [
27
27
  ];
28
28
  const ALLOWED_AGENT_TYPES = new Set([
29
29
  ...CANONICAL_AGENT_TYPES,
30
- // Shipped Claude Code agent definitions (.claude/agents/**)
31
- 'adaptive-coordinator', 'adr-architect', 'aidefence-guardian',
30
+ // Claude Code built-ins
31
+ 'claude-code-guide', 'general-purpose',
32
+ // Shipped Claude Code agent definitions (.claude/agents/**) — both the
33
+ // canonical `name:` slug and the file basename are accepted.
32
34
  'analyze-code-quality', 'api-docs', 'arch-system-design',
33
- 'backend-dev', 'base-template-generator', 'benchmark-suite',
34
- 'byzantine-coordinator', 'cicd-engineer', 'claims-authorizer',
35
- 'claude-code-guide', 'code-analyzer', 'code-goal-planner',
36
- 'code-review-swarm', 'collective-intelligence-coordinator',
37
- 'crdt-synchronizer', 'data-ml-model', 'ddd-domain-expert',
38
- 'dev-backend-api', 'docs-api-openapi', 'general-purpose',
39
- 'github-modes', 'goal-planner', 'gossip-coordinator',
40
- 'hierarchical-coordinator', 'injection-analyst', 'issue-tracker',
41
- 'load-balancer', 'memory-specialist', 'mesh-coordinator',
42
- 'ml-developer', 'mobile-dev', 'multi-repo-swarm',
43
- 'ops-cicd-github', 'performance-benchmarker', 'performance-engineer',
44
- 'performance-monitor', 'pii-detector', 'planner',
45
- 'pr-manager', 'production-validator', 'project-board-sync',
46
- 'pseudocode', 'quorum-manager', 'queen-coordinator',
47
- 'raft-manager', 'reasoningbank-learner', 'refinement',
48
- 'release-manager', 'release-swarm', 'repo-architect',
49
- 'resource-allocator', 'safla-neural', 'scout-explorer',
50
- 'security-architect', 'security-architect-aidefence',
51
- 'security-auditor', 'security-manager', 'sona-learning-optimizer',
52
- 'sparc-orchestrator', 'spec-mobile-react-native', 'specification',
53
- 'swarm-issue', 'swarm-memory-manager', 'swarm-pr',
54
- 'sync-coordinator', 'system-architect', 'tdd-london-swarm',
55
- 'test-long-runner', 'topology-optimizer', 'v3-integration-architect',
56
- 'workflow-automation', 'worker-specialist',
35
+ 'backend-dev', 'base-template-generator', 'cicd-engineer',
36
+ 'code-analyzer', 'database-dev', 'dev-backend-api',
37
+ 'dev-database', 'dev-frontend', 'docs-api-openapi',
38
+ 'frontend-dev', 'ops-cicd-github', 'planner',
39
+ 'security-auditor', 'system-architect', 'test-long-runner',
57
40
  ]);
58
41
  const AGENT_TYPE_SLUG_RE = /^[a-z][a-z0-9-]*$/;
59
42
  export function toNonNegativeInt(value, fallback) {
@@ -78,7 +61,6 @@ export function validateAgentType(value) {
78
61
  const AGENT_TYPE_MODEL_DEFAULTS = {
79
62
  // Complex agents → opus
80
63
  'architect': 'opus',
81
- 'security-architect': 'opus',
82
64
  'system-architect': 'opus',
83
65
  'core-architect': 'opus',
84
66
  // Medium complexity → sonnet
@@ -211,7 +211,7 @@ function learnedPatternsFromOutcomes() {
211
211
  const TASK_PATTERNS = {
212
212
  'security-task': {
213
213
  keywords: ['authentication', 'security', 'auth', 'password', 'encryption', 'vulnerability', 'cve', 'audit'],
214
- agents: ['security-architect', 'security-auditor', 'reviewer'],
214
+ agents: ['security-auditor', 'reviewer'],
215
215
  },
216
216
  'testing-task': {
217
217
  keywords: ['test', 'testing', 'spec', 'coverage', 'unit test', 'integration test', 'e2e'],
@@ -223,7 +223,7 @@ const TASK_PATTERNS = {
223
223
  },
224
224
  'performance-task': {
225
225
  keywords: ['performance', 'optimize', 'speed', 'memory', 'benchmark', 'profiling', 'bottleneck'],
226
- agents: ['performance-engineer', 'coder', 'tester'],
226
+ agents: ['reviewer', 'coder', 'tester'],
227
227
  },
228
228
  'refactor-task': {
229
229
  keywords: ['refactor', 'restructure', 'clean', 'organize', 'modular', 'decouple'],
@@ -239,23 +239,25 @@ const TASK_PATTERNS = {
239
239
  },
240
240
  'database-task': {
241
241
  keywords: ['database', 'sql', 'query', 'schema', 'migration', 'orm'],
242
- agents: ['architect', 'coder', 'tester'],
242
+ agents: ['database-dev', 'coder', 'tester'],
243
243
  },
244
244
  'frontend-task': {
245
- keywords: ['frontend', 'ui', 'component', 'react', 'css', 'style', 'layout'],
246
- agents: ['coder', 'reviewer', 'tester'],
245
+ keywords: ['frontend', 'ui', 'component', 'react', 'vue', 'svelte', 'css', 'tailwind', 'style', 'layout', 'accessibility'],
246
+ agents: ['frontend-dev', 'reviewer', 'tester'],
247
247
  },
248
248
  'devops-task': {
249
249
  keywords: ['deploy', 'ci', 'cd', 'pipeline', 'docker', 'kubernetes', 'infrastructure'],
250
- agents: ['devops', 'coder', 'tester'],
250
+ agents: ['cicd-engineer', 'coder', 'tester'],
251
251
  },
252
+ // (github-task intent removed — github work routes to generic coder/reviewer
253
+ // with the gh CLI; specialized github-* agents were retired in #932)
252
254
  'swarm-task': {
253
255
  keywords: ['swarm', 'agent', 'coordinator', 'hive', 'mesh', 'topology'],
254
- agents: ['swarm-specialist', 'coordinator', 'architect'],
256
+ agents: ['coordinator', 'architect'],
255
257
  },
256
258
  'memory-task': {
257
259
  keywords: ['memory', 'cache', 'store', 'vector', 'embedding', 'persistence'],
258
- agents: ['memory-specialist', 'architect', 'coder'],
260
+ agents: ['researcher', 'architect', 'coder'],
259
261
  },
260
262
  };
261
263
  /**
@@ -436,30 +438,30 @@ const AGENT_PATTERNS = {
436
438
  '.yaml': ['coder', 'devops'],
437
439
  '.yml': ['coder', 'devops'],
438
440
  '.sh': ['devops', 'coder'],
439
- '.py': ['coder', 'ml-developer', 'researcher'],
441
+ '.py': ['coder', 'researcher'],
440
442
  '.sql': ['coder', 'architect'],
441
443
  '.css': ['coder', 'designer'],
442
444
  '.scss': ['coder', 'designer'],
443
445
  };
444
446
  // Keyword patterns for fallback routing (when semantic routing doesn't match)
445
447
  const KEYWORD_PATTERNS = {
446
- 'authentication': { agents: ['security-architect', 'coder', 'tester'], confidence: 0.9 },
447
- 'auth': { agents: ['security-architect', 'coder', 'tester'], confidence: 0.85 },
448
+ 'authentication': { agents: ['security-auditor', 'coder', 'tester'], confidence: 0.9 },
449
+ 'auth': { agents: ['security-auditor', 'coder', 'tester'], confidence: 0.85 },
448
450
  'api': { agents: ['architect', 'coder', 'tester'], confidence: 0.85 },
449
451
  'test': { agents: ['tester', 'reviewer'], confidence: 0.95 },
450
452
  'refactor': { agents: ['architect', 'coder', 'reviewer'], confidence: 0.9 },
451
- 'performance': { agents: ['performance-engineer', 'coder', 'tester'], confidence: 0.88 },
452
- 'security': { agents: ['security-architect', 'security-auditor', 'reviewer'], confidence: 0.92 },
453
- 'database': { agents: ['architect', 'coder', 'tester'], confidence: 0.85 },
454
- 'frontend': { agents: ['coder', 'designer', 'tester'], confidence: 0.82 },
455
- 'backend': { agents: ['architect', 'coder', 'tester'], confidence: 0.85 },
453
+ 'performance': { agents: ['reviewer', 'coder', 'tester'], confidence: 0.88 },
454
+ 'security': { agents: ['security-auditor', 'reviewer'], confidence: 0.92 },
455
+ 'database': { agents: ['database-dev', 'coder', 'tester'], confidence: 0.9 },
456
+ 'frontend': { agents: ['frontend-dev', 'reviewer', 'tester'], confidence: 0.9 },
457
+ 'backend': { agents: ['backend-dev', 'architect', 'coder', 'tester'], confidence: 0.9 },
456
458
  'bug': { agents: ['coder', 'tester', 'reviewer'], confidence: 0.88 },
457
459
  'fix': { agents: ['coder', 'tester', 'reviewer'], confidence: 0.85 },
458
460
  'feature': { agents: ['architect', 'coder', 'tester'], confidence: 0.8 },
459
- 'swarm': { agents: ['swarm-specialist', 'coordinator', 'architect'], confidence: 0.9 },
460
- 'memory': { agents: ['memory-specialist', 'architect', 'coder'], confidence: 0.88 },
461
- 'deploy': { agents: ['devops', 'coder', 'tester'], confidence: 0.85 },
462
- 'ci/cd': { agents: ['devops', 'coder'], confidence: 0.9 },
461
+ 'swarm': { agents: ['coordinator', 'architect'], confidence: 0.9 },
462
+ 'memory': { agents: ['researcher', 'architect', 'coder'], confidence: 0.88 },
463
+ 'deploy': { agents: ['cicd-engineer', 'coder', 'tester'], confidence: 0.85 },
464
+ 'ci/cd': { agents: ['cicd-engineer', 'coder'], confidence: 0.9 },
463
465
  };
464
466
  function getFileExtension(filePath) {
465
467
  const match = filePath.match(/\.[a-zA-Z0-9]+$/);
@@ -1675,7 +1677,7 @@ export const hooksBuildAgents = {
1675
1677
  { type: 'coder', configFile: join(outputDir, `coder.${format}`), capabilities: ['code-generation', 'refactoring', 'debugging'], optimizations: ['flash-attention', 'token-reduction'] },
1676
1678
  { type: 'architect', configFile: join(outputDir, `architect.${format}`), capabilities: ['system-design', 'api-design', 'documentation'], optimizations: ['context-caching', 'memory-persistence'] },
1677
1679
  { type: 'tester', configFile: join(outputDir, `tester.${format}`), capabilities: ['unit-testing', 'integration-testing', 'coverage'], optimizations: ['parallel-execution'] },
1678
- { type: 'security-architect', configFile: join(outputDir, `security-architect.${format}`), capabilities: ['threat-modeling', 'vulnerability-analysis', 'security-review'], optimizations: ['pattern-matching'] },
1680
+ { type: 'security-auditor', configFile: join(outputDir, `security-auditor.${format}`), capabilities: ['threat-modeling', 'vulnerability-analysis', 'security-review'], optimizations: ['pattern-matching'] },
1679
1681
  { type: 'reviewer', configFile: join(outputDir, `reviewer.${format}`), capabilities: ['code-review', 'quality-analysis', 'best-practices'], optimizations: ['incremental-analysis'] },
1680
1682
  ];
1681
1683
  const filteredAgents = focus === 'all' ? agents :
@@ -27,43 +27,49 @@ const DEFAULT_INTENTS = [
27
27
  name: 'memory',
28
28
  category: 'storage',
29
29
  keywords: ['memory', 'store', 'retrieve', 'search', 'embedding', 'vector', 'recall', 'persist'],
30
- agents: ['memory-specialist', 'swarm-memory-manager'],
30
+ agents: ['researcher', 'coder'],
31
+ },
32
+ {
33
+ name: 'frontend',
34
+ category: 'development',
35
+ keywords: ['frontend', 'ui', 'component', 'react', 'vue', 'svelte', 'css', 'tailwind', 'style', 'layout', 'accessibility', 'responsive'],
36
+ agents: ['frontend-dev', 'reviewer'],
37
+ },
38
+ {
39
+ name: 'database',
40
+ category: 'development',
41
+ keywords: ['database', 'sql', 'query', 'schema', 'migration', 'orm', 'index', 'postgres', 'mysql', 'sqlite', 'transaction'],
42
+ agents: ['database-dev', 'reviewer'],
31
43
  },
32
44
  {
33
45
  name: 'spell',
34
46
  category: 'workflow',
35
47
  keywords: ['spell', 'workflow', 'orchestrate', 'cast', 'pipeline', 'step'],
36
- agents: ['planner', 'sparc-orchestrator'],
48
+ agents: ['planner'],
37
49
  },
38
50
  {
39
51
  name: 'hooks',
40
52
  category: 'automation',
41
53
  keywords: ['hook', 'pre-task', 'post-task', 'event', 'trigger', 'automation'],
42
- agents: ['cicd-engineer', 'workflow-automation'],
54
+ agents: ['cicd-engineer', 'coder'],
43
55
  },
44
56
  {
45
57
  name: 'security',
46
58
  category: 'security',
47
59
  keywords: ['security', 'vulnerability', 'cve', 'audit', 'threat', 'permission', 'auth'],
48
- agents: ['security-auditor', 'security-architect'],
49
- },
50
- {
51
- name: 'neural',
52
- category: 'ml',
53
- keywords: ['neural', 'train', 'model', 'learning', 'reinforcement', 'sona', 'reasoningbank'],
54
- agents: ['ml-developer', 'safla-neural'],
60
+ agents: ['security-auditor', 'reviewer'],
55
61
  },
56
62
  {
57
63
  name: 'test',
58
64
  category: 'quality',
59
65
  keywords: ['test', 'vitest', 'unit', 'integration', 'tdd', 'coverage', 'assertion'],
60
- agents: ['tester', 'tdd-london-swarm'],
66
+ agents: ['tester'],
61
67
  },
62
68
  {
63
69
  name: 'github',
64
70
  category: 'integration',
65
71
  keywords: ['github', 'pr', 'pull request', 'issue', 'release', 'commit', 'branch'],
66
- agents: ['pr-manager', 'github-modes', 'release-manager'],
72
+ agents: ['coder', 'reviewer'],
67
73
  },
68
74
  ];
69
75
  export class SemanticRouter {
@@ -38,8 +38,8 @@ const AGENT_TYPES = [
38
38
  'optimizer',
39
39
  'debugger',
40
40
  'documenter',
41
- 'security-architect',
42
- 'performance-engineer',
41
+ 'security-auditor',
42
+ 'planner',
43
43
  ];
44
44
  /**
45
45
  * Task keywords for pattern extraction
@@ -77,13 +77,13 @@ const KEYWORD_CATEGORIES = {
77
77
  'document', 'docs', 'readme', 'comment', 'explain', 'guide',
78
78
  'tutorial', 'api-docs', 'specification', 'jsdoc',
79
79
  ],
80
- 'security-architect': [
80
+ 'security-auditor': [
81
81
  'security', 'auth', 'authentication', 'authorization', 'encrypt',
82
82
  'vulnerability', 'cve', 'secure', 'permission', 'role',
83
83
  ],
84
- 'performance-engineer': [
85
- 'profiling', 'bottleneck', 'latency', 'throughput', 'cache',
86
- 'scale', 'load', 'stress', 'concurrent', 'parallel',
84
+ planner: [
85
+ 'plan', 'breakdown', 'sequencing', 'estimate', 'milestone', 'roadmap',
86
+ 'task', 'dependency', 'goal',
87
87
  ],
88
88
  };
89
89
  // ============================================================================
@@ -118,9 +118,9 @@ export class LearningDomainService {
118
118
  review: 'reviewer',
119
119
  plan: 'planner',
120
120
  research: 'researcher',
121
- security: 'security-architect',
122
- performance: 'performance-engineer',
123
- memory: 'memory-specialist',
121
+ security: 'security-auditor',
122
+ performance: 'reviewer',
123
+ memory: 'researcher',
124
124
  };
125
125
  for (const [keyword, role] of Object.entries(keywordMap)) {
126
126
  if (taskLower.includes(keyword)) {
@@ -19,9 +19,7 @@ export const AGENT_CAPABILITIES = {
19
19
  'backend-dev': ['api', 'database', 'server', 'authentication'],
20
20
  'frontend-dev': ['ui', 'react', 'css', 'components'],
21
21
  devops: ['ci-cd', 'docker', 'deployment', 'infrastructure'],
22
- 'security-architect': ['security-design', 'threat-modeling', 'auth-flow'],
23
- 'security-auditor': ['vulnerability-scan', 'dependency-audit', 'compliance'],
24
- 'memory-specialist': ['memory-management', 'caching', 'persistence'],
22
+ 'security-auditor': ['security-design', 'threat-modeling', 'auth-flow', 'vulnerability-scan', 'dependency-audit', 'compliance'],
25
23
  coordinator: ['task-distribution', 'orchestration', 'scheduling'],
26
24
  analyst: ['data-analysis', 'metrics', 'reporting', 'monitoring'],
27
25
  optimizer: ['performance', 'profiling', 'optimization', 'benchmarking'],
@@ -41,8 +39,7 @@ const TASK_PATTERNS = [
41
39
  { regex: /ui|frontend|component|react|css|style/i, agentType: 'frontend-dev' },
42
40
  { regex: /deploy|docker|ci|cd|pipeline|infrastructure/i, agentType: 'devops' },
43
41
  // Specialized patterns
44
- { regex: /security|auth|permission|rbac|oauth/i, agentType: 'security-architect' },
45
- { regex: /vulnerability|cve|dependency.*update|npm audit/i, agentType: 'security-auditor' },
42
+ { regex: /security|auth|permission|rbac|oauth|vulnerability|cve|dependency.*update|npm audit/i, agentType: 'security-auditor' },
46
43
  { regex: /performance|optimize|profile|benchmark|speed/i, agentType: 'optimizer' },
47
44
  { regex: /analyz|metric|report|monitor|dashboard/i, agentType: 'analyst' },
48
45
  ];