moflo 4.8.12 → 4.8.14

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 (140) hide show
  1. package/.claude/settings.json +1 -1
  2. package/.claude/workflow-state.json +3 -3
  3. package/package.json +2 -4
  4. package/src/@claude-flow/cli/dist/src/commands/hooks.js +3 -3
  5. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +47 -46
  6. package/src/@claude-flow/cli/dist/src/services/workflow-gate.js +96 -68
  7. package/src/@claude-flow/cli/package.json +1 -1
  8. package/.claude/agents/MIGRATION_SUMMARY.md +0 -222
  9. package/.claude/agents/analysis/code-review/analyze-code-quality.md +0 -179
  10. package/.claude/agents/development/backend/dev-backend-api.md +0 -142
  11. package/.claude/agents/flow-nexus/app-store.md +0 -88
  12. package/.claude/agents/flow-nexus/authentication.md +0 -69
  13. package/.claude/agents/flow-nexus/challenges.md +0 -81
  14. package/.claude/agents/flow-nexus/neural-network.md +0 -88
  15. package/.claude/agents/flow-nexus/payments.md +0 -83
  16. package/.claude/agents/flow-nexus/sandbox.md +0 -76
  17. package/.claude/agents/flow-nexus/swarm.md +0 -76
  18. package/.claude/agents/flow-nexus/user-tools.md +0 -96
  19. package/.claude/agents/flow-nexus/workflow.md +0 -84
  20. package/.claude/agents/payments/agentic-payments.md +0 -126
  21. package/.claude/agents/sona/sona-learning-optimizer.md +0 -74
  22. package/.claude/agents/sublinear/consensus-coordinator.md +0 -338
  23. package/.claude/agents/sublinear/matrix-optimizer.md +0 -185
  24. package/.claude/agents/sublinear/pagerank-analyzer.md +0 -299
  25. package/.claude/agents/sublinear/performance-optimizer.md +0 -368
  26. package/.claude/agents/sublinear/trading-predictor.md +0 -246
  27. package/.claude/agents/testing/unit/tdd-london-swarm.md +0 -244
  28. package/.claude/agents/testing/validation/production-validator.md +0 -395
  29. package/.claude/agents/v3/database-specialist.yaml +0 -21
  30. package/.claude/agents/v3/index.yaml +0 -17
  31. package/.claude/agents/v3/project-coordinator.yaml +0 -15
  32. package/.claude/agents/v3/python-specialist.yaml +0 -21
  33. package/.claude/agents/v3/test-architect.yaml +0 -20
  34. package/.claude/agents/v3/typescript-specialist.yaml +0 -21
  35. package/.claude/agents/v3/v3-integration-architect.md +0 -346
  36. package/.claude/agents/v3/v3-memory-specialist.md +0 -318
  37. package/.claude/agents/v3/v3-performance-engineer.md +0 -397
  38. package/.claude/agents/v3/v3-queen-coordinator.md +0 -98
  39. package/.claude/agents/v3/v3-security-architect.md +0 -174
  40. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +0 -54
  41. package/.claude/commands/analysis/README.md +0 -9
  42. package/.claude/commands/analysis/bottleneck-detect.md +0 -162
  43. package/.claude/commands/analysis/performance-bottlenecks.md +0 -59
  44. package/.claude/commands/analysis/performance-report.md +0 -25
  45. package/.claude/commands/analysis/token-efficiency.md +0 -45
  46. package/.claude/commands/analysis/token-usage.md +0 -25
  47. package/.claude/commands/automation/README.md +0 -9
  48. package/.claude/commands/automation/auto-agent.md +0 -122
  49. package/.claude/commands/automation/self-healing.md +0 -106
  50. package/.claude/commands/automation/session-memory.md +0 -90
  51. package/.claude/commands/automation/smart-agents.md +0 -73
  52. package/.claude/commands/automation/smart-spawn.md +0 -25
  53. package/.claude/commands/automation/workflow-select.md +0 -25
  54. package/.claude/commands/coordination/README.md +0 -9
  55. package/.claude/commands/coordination/agent-spawn.md +0 -25
  56. package/.claude/commands/coordination/init.md +0 -44
  57. package/.claude/commands/coordination/orchestrate.md +0 -43
  58. package/.claude/commands/coordination/spawn.md +0 -45
  59. package/.claude/commands/coordination/swarm-init.md +0 -85
  60. package/.claude/commands/coordination/task-orchestrate.md +0 -25
  61. package/.claude/commands/flow-nexus/app-store.md +0 -124
  62. package/.claude/commands/flow-nexus/challenges.md +0 -120
  63. package/.claude/commands/flow-nexus/login-registration.md +0 -65
  64. package/.claude/commands/flow-nexus/neural-network.md +0 -134
  65. package/.claude/commands/flow-nexus/payments.md +0 -116
  66. package/.claude/commands/flow-nexus/sandbox.md +0 -83
  67. package/.claude/commands/flow-nexus/swarm.md +0 -87
  68. package/.claude/commands/flow-nexus/user-tools.md +0 -152
  69. package/.claude/commands/flow-nexus/workflow.md +0 -115
  70. package/.claude/commands/monitoring/README.md +0 -9
  71. package/.claude/commands/monitoring/agent-metrics.md +0 -25
  72. package/.claude/commands/monitoring/agents.md +0 -44
  73. package/.claude/commands/monitoring/real-time-view.md +0 -25
  74. package/.claude/commands/monitoring/status.md +0 -46
  75. package/.claude/commands/monitoring/swarm-monitor.md +0 -25
  76. package/.claude/commands/optimization/README.md +0 -9
  77. package/.claude/commands/optimization/auto-topology.md +0 -62
  78. package/.claude/commands/optimization/cache-manage.md +0 -25
  79. package/.claude/commands/optimization/parallel-execute.md +0 -25
  80. package/.claude/commands/optimization/parallel-execution.md +0 -50
  81. package/.claude/commands/optimization/topology-optimize.md +0 -25
  82. package/.claude/commands/pair/README.md +0 -261
  83. package/.claude/commands/pair/commands.md +0 -546
  84. package/.claude/commands/pair/config.md +0 -510
  85. package/.claude/commands/pair/examples.md +0 -512
  86. package/.claude/commands/pair/modes.md +0 -348
  87. package/.claude/commands/pair/session.md +0 -407
  88. package/.claude/commands/pair/start.md +0 -209
  89. package/.claude/commands/stream-chain/pipeline.md +0 -121
  90. package/.claude/commands/stream-chain/run.md +0 -70
  91. package/.claude/commands/training/README.md +0 -9
  92. package/.claude/commands/training/model-update.md +0 -25
  93. package/.claude/commands/training/neural-patterns.md +0 -74
  94. package/.claude/commands/training/neural-train.md +0 -25
  95. package/.claude/commands/training/pattern-learn.md +0 -25
  96. package/.claude/commands/training/specialization.md +0 -63
  97. package/.claude/commands/truth/start.md +0 -143
  98. package/.claude/commands/verify/check.md +0 -50
  99. package/.claude/commands/verify/start.md +0 -128
  100. package/.claude/helpers/gate-hook.mjs +0 -50
  101. package/.claude/helpers/gate.cjs +0 -138
  102. package/.claude/helpers/hook-handler.cjs +0 -83
  103. package/.claude/helpers/prompt-hook.mjs +0 -72
  104. package/.claude/scripts/build-embeddings.mjs +0 -549
  105. package/.claude/scripts/generate-code-map.mjs +0 -697
  106. package/.claude/scripts/hooks.mjs +0 -656
  107. package/.claude/scripts/index-guidance.mjs +0 -893
  108. package/.claude/scripts/index-tests.mjs +0 -710
  109. package/.claude/scripts/semantic-search.mjs +0 -473
  110. package/.claude/scripts/session-start-launcher.mjs +0 -226
  111. package/.claude/skills/agentic-jujutsu/SKILL.md +0 -645
  112. package/.claude/skills/dual-mode/README.md +0 -71
  113. package/.claude/skills/dual-mode/dual-collect.md +0 -103
  114. package/.claude/skills/dual-mode/dual-coordinate.md +0 -85
  115. package/.claude/skills/dual-mode/dual-spawn.md +0 -81
  116. package/.claude/skills/flow-nexus-neural/SKILL.md +0 -738
  117. package/.claude/skills/flow-nexus-platform/SKILL.md +0 -1157
  118. package/.claude/skills/flow-nexus-swarm/SKILL.md +0 -610
  119. package/.claude/skills/pair-programming/SKILL.md +0 -1202
  120. package/.claude/skills/stream-chain/SKILL.md +0 -563
  121. package/.claude/skills/v3-cli-modernization/SKILL.md +0 -872
  122. package/.claude/skills/v3-core-implementation/SKILL.md +0 -797
  123. package/.claude/skills/v3-ddd-architecture/SKILL.md +0 -442
  124. package/.claude/skills/v3-integration-deep/SKILL.md +0 -241
  125. package/.claude/skills/v3-mcp-optimization/SKILL.md +0 -777
  126. package/.claude/skills/v3-memory-unification/SKILL.md +0 -174
  127. package/.claude/skills/v3-performance-optimization/SKILL.md +0 -390
  128. package/.claude/skills/v3-security-overhaul/SKILL.md +0 -82
  129. package/.claude/skills/v3-swarm-coordination/SKILL.md +0 -340
  130. package/.claude-plugin/README.md +0 -720
  131. package/.claude-plugin/docs/INSTALLATION.md +0 -261
  132. package/.claude-plugin/docs/PLUGIN_SUMMARY.md +0 -361
  133. package/.claude-plugin/docs/QUICKSTART.md +0 -361
  134. package/.claude-plugin/docs/STRUCTURE.md +0 -128
  135. package/.claude-plugin/hooks/hooks.json +0 -74
  136. package/.claude-plugin/marketplace.json +0 -96
  137. package/.claude-plugin/plugin.json +0 -71
  138. package/.claude-plugin/scripts/install.sh +0 -234
  139. package/.claude-plugin/scripts/uninstall.sh +0 -36
  140. package/.claude-plugin/scripts/verify.sh +0 -108
@@ -156,7 +156,7 @@
156
156
  "hooks": [
157
157
  {
158
158
  "type": "command",
159
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/scripts/session-start-launcher.mjs\"",
159
+ "command": "node \"$CLAUDE_PROJECT_DIR/bin/session-start-launcher.mjs\"",
160
160
  "timeout": 3000
161
161
  }
162
162
  ]
@@ -2,8 +2,8 @@
2
2
  "tasksCreated": true,
3
3
  "taskCount": 2,
4
4
  "memorySearched": false,
5
- "sessionStart": "2026-03-22T21:38:40.085Z",
5
+ "sessionStart": "2026-03-23T02:45:57.764Z",
6
6
  "memoryRequired": true,
7
- "interactionCount": 9,
8
- "lastBlockedAt": "2026-03-22T21:51:54.015Z"
7
+ "interactionCount": 34,
8
+ "lastBlockedAt": "2026-03-23T04:05:05.816Z"
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moflo",
3
- "version": "4.8.12",
3
+ "version": "4.8.14",
4
4
  "description": "MoFlo — AI agent orchestration for Claude Code. Forked from ruflo/claude-flow with patches applied to source, plus feature-level orchestration.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -12,7 +12,6 @@
12
12
  "flo-embeddings": "bin/build-embeddings.mjs",
13
13
  "flo-index": "bin/index-guidance.mjs",
14
14
  "flo-testmap": "bin/index-tests.mjs",
15
- "flo-learn": ".claude/helpers/learning-service.mjs",
16
15
  "moflo": "bin/cli.js",
17
16
  "claude-flow": "bin/cli.js"
18
17
  },
@@ -39,7 +38,6 @@
39
38
  "src/@claude-flow/memory/dist/**/*.d.ts",
40
39
  "!src/@claude-flow/memory/dist/**/*.map",
41
40
  "src/@claude-flow/memory/package.json",
42
- ".claude-plugin/**",
43
41
  ".claude/**",
44
42
  "!.claude/guidance/internal/**",
45
43
  "!.claude/**/*.db",
@@ -85,7 +83,7 @@
85
83
  "@types/bcrypt": "^5.0.2",
86
84
  "@types/node": "^20.19.37",
87
85
  "eslint": "^8.0.0",
88
- "moflo": "^4.8.11",
86
+ "moflo": "^4.8.13",
89
87
  "tsx": "^4.21.0",
90
88
  "typescript": "^5.9.3",
91
89
  "vitest": "^4.0.0"
@@ -336,11 +336,11 @@ const routeCommand = {
336
336
  { command: 'claude-flow hooks route -t "Optimize database queries" -K 5', description: 'Get top 5 suggestions' }
337
337
  ],
338
338
  action: async (ctx) => {
339
- const task = ctx.args[0] || ctx.flags.task;
339
+ const task = ctx.args[0] || ctx.flags.task || process.env.CLAUDE_USER_PROMPT || '';
340
340
  const topK = ctx.flags.topK || 3;
341
341
  if (!task) {
342
- output.printError('Task description is required. Use --task or -t flag.');
343
- return { success: false, exitCode: 1 };
342
+ // No task available (e.g. called from UserPromptSubmit hook with no prompt) — exit cleanly
343
+ return { success: true };
344
344
  }
345
345
  output.printInfo(`Routing task: ${output.highlight(task)}`);
346
346
  try {
@@ -1,19 +1,19 @@
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() {
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
17
  return `${MARKER_START}
18
18
  ## MoFlo — AI Agent Orchestration
19
19
 
@@ -54,34 +54,35 @@ npx flo doctor --fix # Health check
54
54
 
55
55
  ### Full Reference
56
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;
57
+ - **Agent bootstrap protocol:** \`.claude/guidance/shipped/agent-bootstrap.md\`
58
+ - **Task + swarm coordination:** \`.claude/guidance/shipped/task-swarm-integration.md\`
59
+ - **CLI, hooks, swarm, memory, moflo.yaml:** \`.claude/guidance/shipped/moflo.md\`
60
+ ${MARKER_END}`;
61
+ }
62
+ // --- Public API ---
63
+ export { MARKER_START, MARKER_END };
64
+ /**
65
+ * Generate the MoFlo section to inject into CLAUDE.md.
66
+ * Template parameter is accepted for backward compatibility but ignored —
67
+ * all templates now produce the same minimal injection.
68
+ */
69
+ export function generateClaudeMd(_options, _template) {
70
+ return mofloSection() + '\n';
71
+ }
72
+ /**
73
+ * Generate minimal CLAUDE.md content (backward-compatible alias).
74
+ */
75
+ export function generateMinimalClaudeMd(options) {
76
+ return generateClaudeMd(options, 'minimal');
77
+ }
78
+ /** Available template names for CLI wizard (kept for backward compat, all produce same output) */
79
+ export const CLAUDE_MD_TEMPLATES = [
80
+ { name: 'minimal', description: 'Recommended memory search, workflow gates, MCP tools (~40 lines injected)' },
81
+ { name: 'standard', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
82
+ { name: 'full', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
83
+ { name: 'security', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
84
+ { name: 'performance', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
85
+ { name: 'solo', description: 'Same as minimal (detailed docs in .claude/guidance/shipped/moflo.md)' },
86
+ ];
87
+ export default generateClaudeMd;
87
88
  //# sourceMappingURL=claudemd-generator.js.map
@@ -52,13 +52,21 @@ const TASK_PATTERNS = [
52
52
  * Checked first — if matched, memory gate is skipped regardless of task patterns.
53
53
  */
54
54
  const DIRECTIVE_PATTERNS = [
55
- /^(yes|no|yeah|yep|nope|sure|ok|okay|correct|right|exactly|perfect)\b/i,
55
+ // Confirmations and short answers
56
+ /^(yes|no|yeah|yep|nope|sure|ok|okay|correct|right|exactly|perfect|thanks|thank you|got it|sounds good|go ahead|do it|lgtm)\b/i,
57
+ // Git and package management
56
58
  /\b(commit|push|pull|merge|rebase|cherry-pick)\b/,
59
+ /\bpublish\b/, /\bversion\b/, /\bnpm\b/, /\byarn\b/, /\bpnpm\b/,
60
+ // File management directives
57
61
  /\b(rename|move|delete|remove)\b/,
58
62
  /^(show|read|open|cat|look at|check)\s/,
59
63
  /^(run|execute|start|stop|kill|restart)\s/,
60
- /\bpublish\b/, /\bversion\b/, /\bnpm\b/,
61
64
  /^let'?s\s+(commit|push|publish|deploy|ship|merge)/i,
65
+ // Short follow-ups that reference the current conversation (not new tasks)
66
+ // These are anchored to start-of-string to avoid matching mid-sentence task words
67
+ /^(do the same|same for|same thing)\b/i,
68
+ /^(also|too|and also)\s+(for|with|on)\b/i,
69
+ /^(what about|how about)\s+(the\s+)?(other|rest|same)\b/i,
62
70
  ];
63
71
  const BRACKET_MESSAGES = {
64
72
  MODERATE: 'Context: MODERATE. Re-state goal before architectural decisions. Use agents for >300 LOC.',
@@ -304,78 +312,98 @@ export class WorkflowGateService {
304
312
  * Used by hooks.mjs dispatcher.
305
313
  */
306
314
  export function processGateCommand(command, env = process.env) {
307
- const gate = new WorkflowGateService();
308
- switch (command) {
309
- case 'check-before-agent': {
310
- const result = gate.checkBeforeAgent();
311
- if (!result.allowed) {
312
- if (result.message)
313
- process.stderr.write(result.message + '\n');
314
- process.exit(2); // Exit 2 = block tool call in Claude Code
315
- }
316
- process.exit(0);
317
- }
318
- case 'check-before-scan': {
319
- const result = gate.checkBeforeScan(env.TOOL_INPUT_pattern, env.TOOL_INPUT_path);
320
- if (!result.allowed) {
321
- if (result.message)
322
- process.stderr.write(result.message + '\n');
323
- process.exit(2);
315
+ // Gate commands (check-before-*) are STRICT — errors propagate, exit 2 blocks.
316
+ // Non-gate commands (record-*, prompt-reminder, etc.) are FAULT-TOLERANT —
317
+ // they catch errors and exit 0 so classification failures never surface as
318
+ // "hook error" to the user while gates remain fully enforced.
319
+ // --- STRICT GATE COMMANDS (must block on failure) ---
320
+ if (command.startsWith('check-before-') || command === 'check-dangerous-command') {
321
+ const gate = new WorkflowGateService();
322
+ switch (command) {
323
+ case 'check-before-agent': {
324
+ const result = gate.checkBeforeAgent();
325
+ if (!result.allowed) {
326
+ if (result.message)
327
+ process.stderr.write(result.message + '\n');
328
+ process.exit(2); // Exit 2 = block tool call in Claude Code
329
+ }
330
+ process.exit(0);
324
331
  }
325
- process.exit(0);
326
- }
327
- case 'check-before-read': {
328
- const result = gate.checkBeforeRead(env.TOOL_INPUT_file_path);
329
- if (!result.allowed) {
330
- if (result.message)
331
- process.stderr.write(result.message + '\n');
332
- process.exit(2);
332
+ case 'check-before-scan': {
333
+ const result = gate.checkBeforeScan(env.TOOL_INPUT_pattern, env.TOOL_INPUT_path);
334
+ if (!result.allowed) {
335
+ if (result.message)
336
+ process.stderr.write(result.message + '\n');
337
+ process.exit(2);
338
+ }
339
+ process.exit(0);
333
340
  }
334
- process.exit(0);
335
- }
336
- case 'record-task-created':
337
- gate.recordTaskCreated();
338
- process.exit(0);
339
- case 'check-bash-memory':
340
- gate.checkBashMemory(env.TOOL_INPUT_command || '');
341
- process.exit(0);
342
- case 'record-memory-searched':
343
- gate.recordMemorySearched();
344
- process.exit(0);
345
- case 'prompt-reminder': {
346
- const userPrompt = env.CLAUDE_USER_PROMPT || '';
347
- const { reminder, bracket } = gate.promptReminder(userPrompt);
348
- if (reminder)
349
- console.log(reminder);
350
- if (bracket)
351
- console.log(bracket);
352
- process.exit(0);
353
- }
354
- case 'compact-guidance': {
355
- console.log('Pre-Compact Guidance:');
356
- console.log('IMPORTANT: Before compacting, preserve key context:');
357
- console.log(' - Check CLAUDE.md for project rules and architecture');
358
- console.log(' - Memory namespaces: guidance, code-map, patterns, knowledge');
359
- console.log(' - Use memory search to recover context after compact');
360
- console.log(' - Batch all operations in single messages (GOLDEN RULE)');
361
- process.exit(0);
362
- }
363
- case 'check-dangerous-command': {
364
- const cmd = (env.TOOL_INPUT_command || '').toLowerCase();
365
- const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:', 'mkfs.', '> /dev/sda'];
366
- for (const pattern of dangerous) {
367
- if (cmd.includes(pattern)) {
368
- process.stderr.write(`[BLOCKED] Dangerous command detected: ${pattern}\n`);
341
+ case 'check-before-read': {
342
+ const result = gate.checkBeforeRead(env.TOOL_INPUT_file_path);
343
+ if (!result.allowed) {
344
+ if (result.message)
345
+ process.stderr.write(result.message + '\n');
369
346
  process.exit(2);
370
347
  }
348
+ process.exit(0);
349
+ }
350
+ case 'check-dangerous-command': {
351
+ const cmd = (env.TOOL_INPUT_command || '').toLowerCase();
352
+ const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:', 'mkfs.', '> /dev/sda'];
353
+ for (const pattern of dangerous) {
354
+ if (cmd.includes(pattern)) {
355
+ process.stderr.write(`[BLOCKED] Dangerous command detected: ${pattern}\n`);
356
+ process.exit(2);
357
+ }
358
+ }
359
+ process.exit(0);
360
+ }
361
+ default:
362
+ process.exit(0);
363
+ }
364
+ }
365
+ // --- FAULT-TOLERANT COMMANDS (never surface errors to user) ---
366
+ try {
367
+ const gate = new WorkflowGateService();
368
+ switch (command) {
369
+ case 'record-task-created':
370
+ gate.recordTaskCreated();
371
+ process.exit(0);
372
+ case 'check-bash-memory':
373
+ gate.checkBashMemory(env.TOOL_INPUT_command || '');
374
+ process.exit(0);
375
+ case 'record-memory-searched':
376
+ gate.recordMemorySearched();
377
+ process.exit(0);
378
+ case 'prompt-reminder': {
379
+ const userPrompt = env.CLAUDE_USER_PROMPT || '';
380
+ const { reminder, bracket } = gate.promptReminder(userPrompt);
381
+ if (reminder)
382
+ console.log(reminder);
383
+ if (bracket)
384
+ console.log(bracket);
385
+ process.exit(0);
371
386
  }
372
- process.exit(0);
387
+ case 'compact-guidance': {
388
+ console.log('Pre-Compact Guidance:');
389
+ console.log('IMPORTANT: Before compacting, preserve key context:');
390
+ console.log(' - Check CLAUDE.md for project rules and architecture');
391
+ console.log(' - Memory namespaces: guidance, code-map, patterns, knowledge');
392
+ console.log(' - Use memory search to recover context after compact');
393
+ console.log(' - Batch all operations in single messages (GOLDEN RULE)');
394
+ process.exit(0);
395
+ }
396
+ case 'session-reset':
397
+ gate.sessionReset();
398
+ process.exit(0);
399
+ default:
400
+ process.exit(0);
373
401
  }
374
- case 'session-reset':
375
- gate.sessionReset();
376
- process.exit(0);
377
- default:
378
- process.exit(0);
402
+ }
403
+ catch (err) {
404
+ // Non-gate commands must never crash — log for debugging but exit clean
405
+ process.stderr.write(`[gate:${command}] ${err.message ?? err}\n`);
406
+ process.exit(0);
379
407
  }
380
408
  }
381
409
  //# sourceMappingURL=workflow-gate.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moflo/cli",
3
- "version": "4.8.12",
3
+ "version": "4.8.14",
4
4
  "type": "module",
5
5
  "description": "MoFlo CLI — AI agent orchestration with specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -1,222 +0,0 @@
1
- ---
2
- name: Migration Summary
3
- type: documentation
4
- category: migration
5
- description: Complete migration plan for converting command-based system to intelligent agent-based system
6
- ---
7
-
8
- # Claude Flow Commands to Agent System Migration Summary
9
-
10
- ## Executive Summary
11
- This document provides a complete migration plan for converting the existing command-based system (`.claude/commands/`) to the new intelligent agent-based system (`.claude/agents/`). The migration preserves all functionality while adding natural language understanding, intelligent coordination, and improved parallelization.
12
-
13
- ## Key Migration Benefits
14
-
15
- ### 1. Natural Language Activation
16
- - **Before**: `/sparc orchestrator "task"`
17
- - **After**: "Orchestrate the development of the authentication system"
18
-
19
- ### 2. Intelligent Coordination
20
- - Agents understand context and collaborate
21
- - Automatic agent spawning based on task requirements
22
- - Optimal resource allocation and topology selection
23
-
24
- ### 3. Enhanced Parallelization
25
- - Agents execute independent tasks simultaneously
26
- - Improved performance through concurrent operations
27
- - Better resource utilization
28
-
29
- ## Complete Command to Agent Mapping
30
-
31
- ### Coordination Commands → Coordination Agents
32
-
33
- | Command | Agent | Key Changes |
34
- |---------|-------|-------------|
35
- | `/coordination/init.md` | `coordinator-swarm-init.md` | Auto-topology selection, resource optimization |
36
- | `/coordination/spawn.md` | `coordinator-agent-spawn.md` | Intelligent capability matching |
37
- | `/coordination/orchestrate.md` | `orchestrator-task.md` | Enhanced parallel execution |
38
-
39
- ### GitHub Commands → GitHub Specialist Agents
40
-
41
- | Command | Agent | Key Changes |
42
- |---------|-------|-------------|
43
- | `/github/pr-manager.md` | `github-pr-manager.md` | Multi-reviewer coordination, CI/CD integration |
44
- | `/github/code-review-swarm.md` | `github-code-reviewer.md` | Parallel review execution |
45
- | `/github/release-manager.md` | `github-release-manager.md` | Multi-repo coordination |
46
- | `/github/issue-tracker.md` | `github-issue-tracker.md` | Project board integration |
47
-
48
- ### SPARC Commands → SPARC Methodology Agents
49
-
50
- | Command | Agent | Key Changes |
51
- |---------|-------|-------------|
52
- | `/sparc/orchestrator.md` | `sparc-coordinator.md` | Phase management, quality gates |
53
- | `/sparc/coder.md` | `implementer-sparc-coder.md` | Parallel TDD implementation |
54
- | `/sparc/tester.md` | `qa-sparc-tester.md` | Comprehensive test strategies |
55
- | `/sparc/designer.md` | `architect-sparc-designer.md` | System architecture focus |
56
- | `/sparc/documenter.md` | `docs-sparc-documenter.md` | Multi-format documentation |
57
-
58
- ### Analysis Commands → Analysis Agents
59
-
60
- | Command | Agent | Key Changes |
61
- |---------|-------|-------------|
62
- | `/analysis/performance-bottlenecks.md` | `performance-analyzer.md` | Predictive analysis, ML integration |
63
- | `/analysis/token-efficiency.md` | `analyst-token-efficiency.md` | Cost optimization focus |
64
- | `/analysis/COMMAND_COMPLIANCE_REPORT.md` | `analyst-compliance-checker.md` | Automated compliance validation |
65
-
66
- ### Memory Commands → Memory Management Agents
67
-
68
- | Command | Agent | Key Changes |
69
- |---------|-------|-------------|
70
- | `/memory/usage.md` | `memory-coordinator.md` | Enhanced search, compression |
71
- | `/memory/neural.md` | `ai-neural-patterns.md` | Advanced ML capabilities |
72
-
73
- ### Automation Commands → Automation Agents
74
-
75
- | Command | Agent | Key Changes |
76
- |---------|-------|-------------|
77
- | `/automation/smart-agents.md` | `automation-smart-agent.md` | ML-based agent selection |
78
- | `/automation/self-healing.md` | `reliability-self-healing.md` | Proactive fault prevention |
79
- | `/automation/session-memory.md` | `memory-session-manager.md` | Cross-session continuity |
80
-
81
- ### Optimization Commands → Optimization Agents
82
-
83
- | Command | Agent | Key Changes |
84
- |---------|-------|-------------|
85
- | `/optimization/parallel-execution.md` | `optimizer-parallel-exec.md` | Dynamic parallelization |
86
- | `/optimization/auto-topology.md` | `optimizer-topology.md` | Adaptive topology selection |
87
-
88
- ## Agent Definition Structure
89
-
90
- Each agent follows this standardized format:
91
-
92
- ```yaml
93
- ---
94
- role: agent-role-type
95
- name: Human Readable Agent Name
96
- responsibilities:
97
- - Primary responsibility
98
- - Secondary responsibility
99
- - Additional responsibilities
100
- capabilities:
101
- - capability-1
102
- - capability-2
103
- - capability-3
104
- tools:
105
- allowed:
106
- - tool-name-1
107
- - tool-name-2
108
- restricted:
109
- - restricted-tool-1
110
- - restricted-tool-2
111
- triggers:
112
- - pattern: "regex pattern for activation"
113
- priority: high
114
- - keyword: "simple-keyword"
115
- priority: medium
116
- ---
117
-
118
- # Agent Name
119
-
120
- ## Purpose
121
- [Agent description and primary function]
122
-
123
- ## Core Functionality
124
- [Detailed capabilities and operations]
125
-
126
- ## Usage Examples
127
- [Real-world usage scenarios]
128
-
129
- ## Integration Points
130
- [How this agent works with others]
131
-
132
- ## Best Practices
133
- [Guidelines for effective use]
134
- ```
135
-
136
- ## Migration Implementation Plan
137
-
138
- ### Phase 1: Agent Creation (Complete)
139
- ✅ Create agent definitions for all critical commands
140
- ✅ Define YAML frontmatter with roles and triggers
141
- ✅ Map tool permissions appropriately
142
- ✅ Document integration patterns
143
-
144
- ### Phase 2: Parallel Operation
145
- - Deploy agents alongside existing commands
146
- - Route requests to appropriate system
147
- - Collect usage metrics and feedback
148
- - Refine agent triggers and capabilities
149
-
150
- ### Phase 3: User Migration
151
- - Update documentation with agent examples
152
- - Provide migration guides for common workflows
153
- - Show performance improvements
154
- - Encourage natural language usage
155
-
156
- ### Phase 4: Command Deprecation
157
- - Add deprecation warnings to commands
158
- - Provide agent alternatives in warnings
159
- - Monitor remaining command usage
160
- - Set sunset date for command system
161
-
162
- ### Phase 5: Full Agent System
163
- - Remove deprecated commands
164
- - Optimize agent interactions
165
- - Implement advanced features
166
- - Enable agent learning
167
-
168
- ## Key Improvements
169
-
170
- ### 1. Natural Language Understanding
171
- - No need to remember command syntax
172
- - Context-aware activation
173
- - Intelligent intent recognition
174
- - Conversational interactions
175
-
176
- ### 2. Intelligent Coordination
177
- - Agents collaborate automatically
178
- - Optimal task distribution
179
- - Resource-aware execution
180
- - Self-organizing teams
181
-
182
- ### 3. Performance Optimization
183
- - Parallel execution by default
184
- - Predictive resource allocation
185
- - Automatic scaling
186
- - Bottleneck prevention
187
-
188
- ### 4. Learning and Adaptation
189
- - Agents learn from patterns
190
- - Continuous improvement
191
- - Personalized strategies
192
- - Knowledge accumulation
193
-
194
- ## Success Metrics
195
-
196
- ### Technical Metrics
197
- - ✅ 100% feature parity with command system
198
- - ✅ Improved execution speed (30-50% faster)
199
- - ✅ Higher parallelization ratio
200
- - ✅ Reduced error rates
201
-
202
- ### User Experience Metrics
203
- - Natural language adoption rate
204
- - User satisfaction scores
205
- - Task completion rates
206
- - Time to productivity
207
-
208
- ## Next Steps
209
-
210
- 1. **Immediate**: Begin using agents for new tasks
211
- 2. **Short-term**: Migrate existing workflows to agents
212
- 3. **Medium-term**: Optimize agent interactions
213
- 4. **Long-term**: Implement advanced AI features
214
-
215
- ## Support and Resources
216
-
217
- - Agent documentation: `.claude/agents/README.md`
218
- - Migration guides: `.claude/agents/migration/`
219
- - Example workflows: `.claude/agents/examples/`
220
- - Community support: GitHub discussions
221
-
222
- The new agent system represents a significant advancement in AI-assisted development, providing a more intuitive, powerful, and efficient way to accomplish complex tasks.