moflo 4.3.1 → 4.6.0

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 (66) hide show
  1. package/.claude/guidance/agent-bootstrap.md +2 -2
  2. package/.claude/guidance/guidance-memory-strategy.md +262 -0
  3. package/.claude/guidance/memory-strategy.md +204 -0
  4. package/.claude/guidance/moflo.md +594 -0
  5. package/.claude/guidance/task-swarm-integration.md +348 -0
  6. package/.claude/helpers/hook-handler.cjs +83 -1
  7. package/.claude/helpers/metrics-db.mjs +492 -488
  8. package/.claude/helpers/statusline.cjs +85 -16
  9. package/.claude/settings.json +10 -25
  10. package/.claude/settings.local.json +14 -0
  11. package/README.md +279 -181
  12. package/bin/build-embeddings.mjs +2 -2
  13. package/bin/generate-code-map.mjs +1 -1
  14. package/bin/index-guidance.mjs +85 -15
  15. package/bin/semantic-search.mjs +6 -6
  16. package/bin/setup-project.mjs +9 -9
  17. package/package.json +8 -7
  18. package/src/@claude-flow/cli/dist/src/commands/appliance.js +12 -12
  19. package/src/@claude-flow/cli/dist/src/commands/benchmark.js +2 -2
  20. package/src/@claude-flow/cli/dist/src/commands/claims.js +1 -1
  21. package/src/@claude-flow/cli/dist/src/commands/config.js +3 -3
  22. package/src/@claude-flow/cli/dist/src/commands/daemon.js +25 -3
  23. package/src/@claude-flow/cli/dist/src/commands/deployment.js +1 -1
  24. package/src/@claude-flow/cli/dist/src/commands/doctor.js +23 -6
  25. package/src/@claude-flow/cli/dist/src/commands/embeddings.js +1 -1
  26. package/src/@claude-flow/cli/dist/src/commands/gate.d.ts +8 -8
  27. package/src/@claude-flow/cli/dist/src/commands/gate.js +13 -13
  28. package/src/@claude-flow/cli/dist/src/commands/hooks.js +1 -1
  29. package/src/@claude-flow/cli/dist/src/commands/init.js +14 -12
  30. package/src/@claude-flow/cli/dist/src/commands/neural.js +1 -1
  31. package/src/@claude-flow/cli/dist/src/commands/orc.d.ts +6 -6
  32. package/src/@claude-flow/cli/dist/src/commands/orc.js +25 -25
  33. package/src/@claude-flow/cli/dist/src/commands/performance.js +1 -1
  34. package/src/@claude-flow/cli/dist/src/commands/plugins.js +1 -1
  35. package/src/@claude-flow/cli/dist/src/commands/providers.js +1 -1
  36. package/src/@claude-flow/cli/dist/src/commands/security.js +1 -1
  37. package/src/@claude-flow/cli/dist/src/commands/start.js +11 -11
  38. package/src/@claude-flow/cli/dist/src/commands/status.js +3 -3
  39. package/src/@claude-flow/cli/dist/src/commands/transfer-store.js +1 -1
  40. package/src/@claude-flow/cli/dist/src/config/moflo-config.d.ts +30 -0
  41. package/src/@claude-flow/cli/dist/src/config/moflo-config.js +103 -7
  42. package/src/@claude-flow/cli/dist/src/index.d.ts +1 -1
  43. package/src/@claude-flow/cli/dist/src/index.js +3 -3
  44. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +1 -1
  45. package/src/@claude-flow/cli/dist/src/init/executor.js +9 -12
  46. package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +640 -640
  47. package/src/@claude-flow/cli/dist/src/init/moflo-init.js +522 -67
  48. package/src/@claude-flow/cli/dist/src/init/settings-generator.js +7 -12
  49. package/src/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +1 -1
  50. package/src/@claude-flow/cli/dist/src/init/statusline-generator.js +784 -784
  51. package/src/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +12 -12
  52. package/src/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +122 -66
  53. package/src/@claude-flow/cli/dist/src/memory/intelligence.js +5 -1
  54. package/src/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +1 -1
  55. package/src/@claude-flow/cli/dist/src/memory/memory-initializer.js +371 -371
  56. package/src/@claude-flow/cli/dist/src/parser.d.ts +10 -0
  57. package/src/@claude-flow/cli/dist/src/parser.js +49 -3
  58. package/src/@claude-flow/cli/dist/src/plugins/store/discovery.js +1 -1
  59. package/src/@claude-flow/cli/dist/src/runtime/headless.js +30 -30
  60. package/src/@claude-flow/cli/dist/src/services/claim-service.js +1 -1
  61. package/src/@claude-flow/cli/dist/src/services/ruvector-training.js +11 -5
  62. package/src/@claude-flow/cli/dist/src/services/workflow-gate.d.ts +13 -3
  63. package/src/@claude-flow/cli/dist/src/services/workflow-gate.js +73 -5
  64. package/src/@claude-flow/cli/dist/src/types.d.ts +1 -1
  65. package/src/@claude-flow/cli/dist/src/types.js +1 -1
  66. package/src/@claude-flow/memory/package.json +44 -42
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * MoFlo Orc Command
3
- * Feature orchestrator that sequences GitHub issues through /mf workflows.
3
+ * Feature orchestrator that sequences GitHub issues through /flo workflows.
4
4
  *
5
5
  * Loads a feature YAML definition, resolves story dependencies via topological
6
- * sort, then executes each story sequentially by spawning `claude -p "/mf ..."`.
6
+ * sort, then executes each story sequentially by spawning `claude -p "/flo ..."`.
7
7
  *
8
8
  * Usage:
9
- * moflo orc run <feature.yaml> Execute a feature
10
- * moflo orc run <feature.yaml> --dry-run Show execution plan
11
- * moflo orc status <feature-id> Check progress
12
- * moflo orc reset <feature-id> Reset for re-run
9
+ * flo orc run <feature.yaml> Execute a feature
10
+ * flo orc run <feature.yaml> --dry-run Show execution plan
11
+ * flo orc status <feature-id> Check progress
12
+ * flo orc reset <feature-id> Reset for re-run
13
13
  */
14
14
  import { spawn, execSync } from 'child_process';
15
15
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
@@ -307,12 +307,12 @@ async function runFeature(yamlPath, dryRun, verbose) {
307
307
  console.log(`| Base: ${pad(feature.base_branch, 53)}|`);
308
308
  console.log(`| Auto-merge: ${pad(autoMerge ? 'yes' : 'no', 47)}|`);
309
309
  console.log('+-------------------------------------------------------------+');
310
- console.log('| Stories (via /mf): |');
310
+ console.log('| Stories (via /flo): |');
311
311
  for (let i = 0; i < plan.order.length; i++) {
312
312
  const story = feature.stories.find((s) => s.id === plan.order[i]);
313
313
  const deps = story.depends_on?.length ? ` -> after ${story.depends_on.join(', ')}` : '';
314
- const flags = story.cl_flags || '-sw';
315
- const line = `${i + 1}. /mf ${story.issue} ${flags}${deps}`;
314
+ const flags = story.flo_flags || '-sw';
315
+ const line = `${i + 1}. /flo ${story.issue} ${flags}${deps}`;
316
316
  console.log(`| ${pad(line, 57)}|`);
317
317
  console.log(`| ${pad(story.name.substring(0, 55), 55)}|`);
318
318
  }
@@ -388,11 +388,11 @@ async function runFeature(yamlPath, dryRun, verbose) {
388
388
  }
389
389
  // ── Run the story ─────────────────────────────────────────────────
390
390
  const startedAt = new Date().toISOString();
391
- const flags = storyDef.cl_flags || '-sw';
391
+ const flags = storyDef.flo_flags || '-sw';
392
392
  console.log('');
393
393
  console.log(`=== Starting story: ${storyId} (#${storyDef.issue}) ===`);
394
394
  console.log(` ${storyDef.name}`);
395
- console.log(` Command: /mf ${storyDef.issue} ${flags}`);
395
+ console.log(` Command: /flo ${storyDef.issue} ${flags}`);
396
396
  console.log('');
397
397
  // Update state to running
398
398
  state.features[feature.id].stories[storyId].status = 'running';
@@ -409,7 +409,7 @@ async function runFeature(yamlPath, dryRun, verbose) {
409
409
  console.log('[warn] Failed to pull base branch -- continuing anyway');
410
410
  }
411
411
  // Spawn claude
412
- const command = `/mf ${storyDef.issue} ${flags}`.trim();
412
+ const command = `/flo ${storyDef.issue} ${flags}`.trim();
413
413
  const runResult = await runClaudeSession(command, feature.repository, STORY_TIMEOUT_MS, verbose ? (text) => process.stdout.write(text) : undefined);
414
414
  if (!runResult.success) {
415
415
  console.log(`[FAIL] ${storyId}: ${runResult.error}`);
@@ -430,17 +430,17 @@ async function runFeature(yamlPath, dryRun, verbose) {
430
430
  // Find the PR
431
431
  const prInfo = findPrForIssue(storyDef.issue, feature.repository);
432
432
  if (!prInfo) {
433
- console.log(`[FAIL] ${storyId}: No PR found after /mf completed`);
433
+ console.log(`[FAIL] ${storyId}: No PR found after /flo completed`);
434
434
  state.features[feature.id].stories[storyId].status = 'failed';
435
435
  state.features[feature.id].stories[storyId].completed_at = new Date().toISOString();
436
436
  state.features[feature.id].stories[storyId].duration_ms = runResult.durationMs;
437
- state.features[feature.id].stories[storyId].error = 'No PR created by /mf';
437
+ state.features[feature.id].stories[storyId].error = 'No PR created by /flo';
438
438
  saveState(feature.repository, state);
439
439
  results.push({
440
440
  story_id: storyId, issue: storyDef.issue, status: 'failed',
441
441
  started_at: startedAt, completed_at: new Date().toISOString(),
442
442
  duration_ms: runResult.durationMs, pr_url: null, pr_number: null,
443
- merged: false, error: 'No PR created by /mf',
443
+ merged: false, error: 'No PR created by /flo',
444
444
  });
445
445
  failed = true;
446
446
  break;
@@ -568,19 +568,19 @@ function printSummary(feature, results, order) {
568
568
  // ═══════════════════════════════════════════════════════════════════════════════
569
569
  const orcCommand = {
570
570
  name: 'orc',
571
- description: 'Feature orchestrator — sequences GitHub issues through /mf workflows',
571
+ description: 'Feature orchestrator — sequences GitHub issues through /flo workflows',
572
572
  options: [],
573
573
  examples: [
574
- { command: 'moflo orc run feature.yaml', description: 'Execute a feature definition' },
575
- { command: 'moflo orc run feature.yaml --dry-run', description: 'Show execution plan without running' },
576
- { command: 'moflo orc run feature.yaml --verbose', description: 'Execute with Claude output streaming' },
577
- { command: 'moflo orc status my-feature', description: 'Check progress of a feature' },
578
- { command: 'moflo orc reset my-feature', description: 'Reset feature state for re-run' },
574
+ { command: 'flo orc run feature.yaml', description: 'Execute a feature definition' },
575
+ { command: 'flo orc run feature.yaml --dry-run', description: 'Show execution plan without running' },
576
+ { command: 'flo orc run feature.yaml --verbose', description: 'Execute with Claude output streaming' },
577
+ { command: 'flo orc status my-feature', description: 'Check progress of a feature' },
578
+ { command: 'flo orc reset my-feature', description: 'Reset feature state for re-run' },
579
579
  ],
580
580
  action: async (ctx) => {
581
581
  const subcommand = ctx.args?.[0];
582
582
  if (!subcommand) {
583
- console.log('Usage: moflo orc <command> [args] [flags]');
583
+ console.log('Usage: flo orc <command> [args] [flags]');
584
584
  console.log('');
585
585
  console.log('Commands:');
586
586
  console.log(' run <feature.yaml> Execute a feature definition');
@@ -596,7 +596,7 @@ const orcCommand = {
596
596
  case 'run': {
597
597
  const yamlPath = ctx.args[1];
598
598
  if (!yamlPath) {
599
- console.log('Usage: moflo orc run <feature.yaml> [--dry-run] [--verbose]');
599
+ console.log('Usage: flo orc run <feature.yaml> [--dry-run] [--verbose]');
600
600
  return { success: false, message: 'Missing feature YAML path' };
601
601
  }
602
602
  const dryRun = ctx.flags['dry-run'] === true || ctx.flags['dryRun'] === true;
@@ -606,7 +606,7 @@ const orcCommand = {
606
606
  case 'status': {
607
607
  const featureId = ctx.args[1];
608
608
  if (!featureId) {
609
- console.log('Usage: moflo orc status <feature-id>');
609
+ console.log('Usage: flo orc status <feature-id>');
610
610
  return { success: false, message: 'Missing feature ID' };
611
611
  }
612
612
  return showStatus(featureId);
@@ -614,7 +614,7 @@ const orcCommand = {
614
614
  case 'reset': {
615
615
  const featureId = ctx.args[1];
616
616
  if (!featureId) {
617
- console.log('Usage: moflo orc reset <feature-id>');
617
+ console.log('Usage: flo orc reset <feature-id>');
618
618
  return { success: false, message: 'Missing feature ID' };
619
619
  }
620
620
  return resetFeature(featureId);
@@ -552,7 +552,7 @@ export const performanceCommand = {
552
552
  ],
553
553
  action: async () => {
554
554
  output.writeln();
555
- output.writeln(output.bold('RuFlo Performance Suite'));
555
+ output.writeln(output.bold('MoFlo Performance Suite'));
556
556
  output.writeln(output.dim('Advanced performance profiling and optimization'));
557
557
  output.writeln();
558
558
  output.writeln('Subcommands:');
@@ -777,7 +777,7 @@ export const pluginsCommand = {
777
777
  ],
778
778
  action: async () => {
779
779
  output.writeln();
780
- output.writeln(output.bold('RuFlo Plugin System'));
780
+ output.writeln(output.bold('MoFlo Plugin System'));
781
781
  output.writeln(output.dim('Decentralized plugin marketplace via IPFS'));
782
782
  output.writeln();
783
783
  output.writeln('Subcommands:');
@@ -204,7 +204,7 @@ export const providersCommand = {
204
204
  ],
205
205
  action: async () => {
206
206
  output.writeln();
207
- output.writeln(output.bold('RuFlo Provider Management'));
207
+ output.writeln(output.bold('MoFlo Provider Management'));
208
208
  output.writeln(output.dim('Multi-provider AI orchestration'));
209
209
  output.writeln();
210
210
  output.writeln('Subcommands:');
@@ -553,7 +553,7 @@ export const securityCommand = {
553
553
  ],
554
554
  action: async () => {
555
555
  output.writeln();
556
- output.writeln(output.bold('RuFlo Security Suite'));
556
+ output.writeln(output.bold('MoFlo Security Suite'));
557
557
  output.writeln(output.dim('Comprehensive security scanning and vulnerability management'));
558
558
  output.writeln();
559
559
  output.writeln('Subcommands:');
@@ -89,8 +89,8 @@ const startAction = async (ctx) => {
89
89
  const cwd = ctx.cwd;
90
90
  // Check initialization
91
91
  if (!isInitialized(cwd)) {
92
- output.printError('RuFlo is not initialized in this directory');
93
- output.printInfo('Run "ruflo init" first to initialize');
92
+ output.printError('MoFlo is not initialized in this directory');
93
+ output.printInfo('Run "flo init" first to initialize');
94
94
  return { success: false, exitCode: 1 };
95
95
  }
96
96
  // Load configuration
@@ -102,7 +102,7 @@ const startAction = async (ctx) => {
102
102
  const autoStartMcp = mcpConfig.autoStart !== false && !skipMcp;
103
103
  const mcpPort = port || mcpConfig.serverPort || DEFAULT_PORT;
104
104
  output.writeln();
105
- output.writeln(output.bold('Starting RuFlo V3'));
105
+ output.writeln(output.bold('Starting MoFlo V4'));
106
106
  output.writeln();
107
107
  const spinner = output.createSpinner({ text: 'Initializing system...' });
108
108
  try {
@@ -151,7 +151,7 @@ const startAction = async (ctx) => {
151
151
  }
152
152
  // Success output
153
153
  output.writeln();
154
- output.printSuccess('RuFlo V3 is running!');
154
+ output.printSuccess('MoFlo V4 is running!');
155
155
  output.writeln();
156
156
  // Status display
157
157
  output.printBox([
@@ -230,7 +230,7 @@ const startAction = async (ctx) => {
230
230
  // Stop subcommand
231
231
  const stopCommand = {
232
232
  name: 'stop',
233
- description: 'Stop the RuFlo system',
233
+ description: 'Stop the MoFlo system',
234
234
  options: [
235
235
  {
236
236
  name: 'force',
@@ -250,11 +250,11 @@ const stopCommand = {
250
250
  const force = ctx.flags.force;
251
251
  const timeout = ctx.flags.timeout;
252
252
  output.writeln();
253
- output.writeln(output.bold('Stopping RuFlo'));
253
+ output.writeln(output.bold('Stopping MoFlo'));
254
254
  output.writeln();
255
255
  if (!force && ctx.interactive) {
256
256
  const confirmed = await confirm({
257
- message: 'Are you sure you want to stop RuFlo?',
257
+ message: 'Are you sure you want to stop MoFlo?',
258
258
  default: false
259
259
  });
260
260
  if (!confirmed) {
@@ -294,7 +294,7 @@ const stopCommand = {
294
294
  fs.unlinkSync(daemonPidPath);
295
295
  }
296
296
  output.writeln();
297
- output.printSuccess('RuFlo stopped successfully');
297
+ output.printSuccess('MoFlo stopped successfully');
298
298
  return {
299
299
  success: true,
300
300
  data: { stopped: true, force, stoppedAt: new Date().toISOString() }
@@ -310,7 +310,7 @@ const stopCommand = {
310
310
  // Restart subcommand
311
311
  const restartCommand = {
312
312
  name: 'restart',
313
- description: 'Restart the RuFlo system',
313
+ description: 'Restart the MoFlo system',
314
314
  options: [
315
315
  {
316
316
  name: 'force',
@@ -322,7 +322,7 @@ const restartCommand = {
322
322
  ],
323
323
  action: async (ctx) => {
324
324
  output.writeln();
325
- output.writeln(output.bold('Restarting RuFlo'));
325
+ output.writeln(output.bold('Restarting MoFlo'));
326
326
  output.writeln();
327
327
  // Stop first
328
328
  const stopCtx = { ...ctx, flags: { ...ctx.flags } };
@@ -372,7 +372,7 @@ const quickCommand = {
372
372
  // Main start command
373
373
  export const startCommand = {
374
374
  name: 'start',
375
- description: 'Start the RuFlo orchestration system',
375
+ description: 'Start the MoFlo orchestration system',
376
376
  subcommands: [stopCommand, restartCommand, quickCommand],
377
377
  options: [
378
378
  {
@@ -152,7 +152,7 @@ function displayStatus(status) {
152
152
  const statusIcon = status.running
153
153
  ? output.success('[RUNNING]')
154
154
  : output.warning('[STOPPED]');
155
- output.writeln(`${output.bold('RuFlo V3')} ${statusIcon}`);
155
+ output.writeln(`${output.bold('MoFlo V4')} ${statusIcon}`);
156
156
  output.writeln();
157
157
  // Swarm section
158
158
  output.writeln(output.bold('Swarm'));
@@ -267,8 +267,8 @@ const statusAction = async (ctx) => {
267
267
  const cwd = ctx.cwd;
268
268
  // Check initialization
269
269
  if (!isInitialized(cwd)) {
270
- output.printError('RuFlo is not initialized in this directory');
271
- output.printInfo('Run "ruflo init" to initialize');
270
+ output.printError('MoFlo is not initialized in this directory');
271
+ output.printInfo('Run "flo init" to initialize');
272
272
  return { success: false, exitCode: 1 };
273
273
  }
274
274
  // Get status
@@ -405,7 +405,7 @@ export const storeCommand = {
405
405
  ],
406
406
  action: async () => {
407
407
  output.writeln();
408
- output.writeln(output.bold('RuFlo Pattern Store'));
408
+ output.writeln(output.bold('MoFlo Pattern Store'));
409
409
  output.writeln(output.dim('Decentralized pattern marketplace via IPFS'));
410
410
  output.writeln();
411
411
  output.writeln('Subcommands:');
@@ -28,13 +28,43 @@ export interface MofloConfig {
28
28
  };
29
29
  hooks: {
30
30
  pre_edit: boolean;
31
+ post_edit: boolean;
32
+ pre_task: boolean;
33
+ post_task: boolean;
31
34
  gate: boolean;
35
+ route: boolean;
32
36
  stop_hook: boolean;
33
37
  session_restore: boolean;
38
+ notification: boolean;
34
39
  };
35
40
  models: {
36
41
  default: string;
42
+ research: string;
37
43
  review: string;
44
+ test: string;
45
+ };
46
+ model_routing: {
47
+ enabled: boolean;
48
+ confidence_threshold: number;
49
+ cost_optimization: boolean;
50
+ circuit_breaker: boolean;
51
+ agent_overrides: Record<string, string>;
52
+ };
53
+ status_line: {
54
+ enabled: boolean;
55
+ branding: string;
56
+ show_git: boolean;
57
+ show_model: boolean;
58
+ show_session: boolean;
59
+ show_intelligence: boolean;
60
+ show_swarm: boolean;
61
+ show_hooks: boolean;
62
+ show_mcp: boolean;
63
+ show_security: boolean;
64
+ show_adrs: boolean;
65
+ show_agentdb: boolean;
66
+ show_tests: boolean;
67
+ mode: 'single-line' | 'dashboard';
38
68
  };
39
69
  }
40
70
  /**
@@ -38,13 +38,43 @@ const DEFAULT_CONFIG = {
38
38
  },
39
39
  hooks: {
40
40
  pre_edit: true,
41
+ post_edit: true,
42
+ pre_task: true,
43
+ post_task: true,
41
44
  gate: true,
45
+ route: true,
42
46
  stop_hook: true,
43
47
  session_restore: true,
48
+ notification: true,
44
49
  },
45
50
  models: {
46
51
  default: 'opus',
52
+ research: 'sonnet',
47
53
  review: 'opus',
54
+ test: 'sonnet',
55
+ },
56
+ model_routing: {
57
+ enabled: false,
58
+ confidence_threshold: 0.85,
59
+ cost_optimization: true,
60
+ circuit_breaker: true,
61
+ agent_overrides: {},
62
+ },
63
+ status_line: {
64
+ enabled: true,
65
+ branding: 'Moflo V4',
66
+ show_git: true,
67
+ show_model: true,
68
+ show_session: true,
69
+ show_intelligence: true,
70
+ show_swarm: true,
71
+ show_hooks: true,
72
+ show_mcp: true,
73
+ show_security: true,
74
+ show_adrs: true,
75
+ show_agentdb: true,
76
+ show_tests: true,
77
+ mode: 'single-line',
48
78
  },
49
79
  };
50
80
  // ============================================================================
@@ -98,13 +128,43 @@ function mergeConfig(raw, root) {
98
128
  },
99
129
  hooks: {
100
130
  pre_edit: raw.hooks?.pre_edit ?? raw.hooks?.preEdit ?? DEFAULT_CONFIG.hooks.pre_edit,
131
+ post_edit: raw.hooks?.post_edit ?? raw.hooks?.postEdit ?? DEFAULT_CONFIG.hooks.post_edit,
132
+ pre_task: raw.hooks?.pre_task ?? raw.hooks?.preTask ?? DEFAULT_CONFIG.hooks.pre_task,
133
+ post_task: raw.hooks?.post_task ?? raw.hooks?.postTask ?? DEFAULT_CONFIG.hooks.post_task,
101
134
  gate: raw.hooks?.gate ?? DEFAULT_CONFIG.hooks.gate,
135
+ route: raw.hooks?.route ?? DEFAULT_CONFIG.hooks.route,
102
136
  stop_hook: raw.hooks?.stop_hook ?? raw.hooks?.stopHook ?? DEFAULT_CONFIG.hooks.stop_hook,
103
137
  session_restore: raw.hooks?.session_restore ?? raw.hooks?.sessionRestore ?? DEFAULT_CONFIG.hooks.session_restore,
138
+ notification: raw.hooks?.notification ?? DEFAULT_CONFIG.hooks.notification,
104
139
  },
105
140
  models: {
106
141
  default: raw.models?.default || DEFAULT_CONFIG.models.default,
142
+ research: raw.models?.research || DEFAULT_CONFIG.models.research,
107
143
  review: raw.models?.review || DEFAULT_CONFIG.models.review,
144
+ test: raw.models?.test || DEFAULT_CONFIG.models.test,
145
+ },
146
+ model_routing: {
147
+ enabled: raw.model_routing?.enabled ?? raw.modelRouting?.enabled ?? DEFAULT_CONFIG.model_routing.enabled,
148
+ confidence_threshold: raw.model_routing?.confidence_threshold ?? raw.modelRouting?.confidenceThreshold ?? DEFAULT_CONFIG.model_routing.confidence_threshold,
149
+ cost_optimization: raw.model_routing?.cost_optimization ?? raw.modelRouting?.costOptimization ?? DEFAULT_CONFIG.model_routing.cost_optimization,
150
+ circuit_breaker: raw.model_routing?.circuit_breaker ?? raw.modelRouting?.circuitBreaker ?? DEFAULT_CONFIG.model_routing.circuit_breaker,
151
+ agent_overrides: raw.model_routing?.agent_overrides ?? raw.modelRouting?.agentOverrides ?? DEFAULT_CONFIG.model_routing.agent_overrides,
152
+ },
153
+ status_line: {
154
+ enabled: raw.status_line?.enabled ?? raw.statusLine?.enabled ?? DEFAULT_CONFIG.status_line.enabled,
155
+ branding: raw.status_line?.branding ?? raw.statusLine?.branding ?? DEFAULT_CONFIG.status_line.branding,
156
+ show_git: raw.status_line?.show_git ?? raw.statusLine?.showGit ?? DEFAULT_CONFIG.status_line.show_git,
157
+ show_model: raw.status_line?.show_model ?? raw.statusLine?.showModel ?? DEFAULT_CONFIG.status_line.show_model,
158
+ show_session: raw.status_line?.show_session ?? raw.statusLine?.showSession ?? DEFAULT_CONFIG.status_line.show_session,
159
+ show_intelligence: raw.status_line?.show_intelligence ?? raw.statusLine?.showIntelligence ?? DEFAULT_CONFIG.status_line.show_intelligence,
160
+ show_swarm: raw.status_line?.show_swarm ?? raw.statusLine?.showSwarm ?? DEFAULT_CONFIG.status_line.show_swarm,
161
+ show_hooks: raw.status_line?.show_hooks ?? raw.statusLine?.showHooks ?? DEFAULT_CONFIG.status_line.show_hooks,
162
+ show_mcp: raw.status_line?.show_mcp ?? raw.statusLine?.showMcp ?? DEFAULT_CONFIG.status_line.show_mcp,
163
+ show_security: raw.status_line?.show_security ?? raw.statusLine?.showSecurity ?? DEFAULT_CONFIG.status_line.show_security,
164
+ show_adrs: raw.status_line?.show_adrs ?? raw.statusLine?.showAdrs ?? DEFAULT_CONFIG.status_line.show_adrs,
165
+ show_agentdb: raw.status_line?.show_agentdb ?? raw.statusLine?.showAgentdb ?? DEFAULT_CONFIG.status_line.show_agentdb,
166
+ show_tests: raw.status_line?.show_tests ?? raw.statusLine?.showTests ?? DEFAULT_CONFIG.status_line.show_tests,
167
+ mode: raw.status_line?.mode ?? raw.statusLine?.mode ?? DEFAULT_CONFIG.status_line.mode,
108
168
  },
109
169
  };
110
170
  }
@@ -206,17 +266,53 @@ memory:
206
266
  embedding_model: Xenova/all-MiniLM-L6-v2
207
267
  namespace: default
208
268
 
209
- # Hook toggles
269
+ # Hook toggles (all on by default — disable to slim down)
210
270
  hooks:
211
- pre_edit: true # Track file edits
212
- gate: true # Workflow gate enforcement
213
- stop_hook: true # Session-end persistence
271
+ pre_edit: true # Track file edits for learning
272
+ post_edit: true # Record edit outcomes, train neural patterns
273
+ pre_task: true # Get agent routing before task spawn
274
+ post_task: true # Record task results for learning
275
+ gate: true # Workflow gate enforcement (memory-first, task-create-first)
276
+ route: true # Intelligent task routing on each prompt
277
+ stop_hook: true # Session-end persistence and metric export
214
278
  session_restore: true # Restore session state on start
279
+ notification: true # Hook into Claude Code notifications
215
280
 
216
- # Model preferences
281
+ # Model preferences (haiku, sonnet, opus)
217
282
  models:
218
- default: opus
219
- review: opus
283
+ default: opus # Model for general tasks
284
+ research: sonnet # Model for research/exploration agents
285
+ review: opus # Model for code review agents
286
+ test: sonnet # Model for test-writing agents
287
+
288
+ # Intelligent model routing (auto-selects haiku/sonnet/opus per task)
289
+ # When enabled, overrides the static model preferences above
290
+ # by analyzing task complexity and routing to the cheapest capable model.
291
+ model_routing:
292
+ enabled: false # Set to true to enable dynamic routing
293
+ confidence_threshold: 0.85 # Min confidence before escalating to a more capable model
294
+ cost_optimization: true # Prefer cheaper models when confidence is high
295
+ circuit_breaker: true # Penalize models that fail repeatedly
296
+ # agent_overrides:
297
+ # security-architect: opus # Always use opus for security
298
+ # researcher: sonnet # Pin research to sonnet
299
+
300
+ # Status line items (show/hide individual sections)
301
+ status_line:
302
+ enabled: true
303
+ branding: "Moflo V4" # Text shown in status bar
304
+ show_git: true # Git branch, changes, ahead/behind
305
+ show_model: true # Current model name
306
+ show_session: true # Session duration
307
+ show_intelligence: true # Intelligence % indicator
308
+ show_swarm: true # Active swarm agents count
309
+ show_hooks: true # Enabled hooks count
310
+ show_mcp: true # MCP server count
311
+ show_security: true # CVE/security status (dashboard only)
312
+ show_adrs: true # ADR compliance (dashboard only)
313
+ show_agentdb: true # AgentDB vectors/size (dashboard only)
314
+ show_tests: true # Test file count (dashboard only)
315
+ mode: single-line # single-line (default) or dashboard (multi-line)
220
316
  `;
221
317
  return config;
222
318
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * V3 CLI Main Entry Point
3
- * Modernized CLI for RuFlo V3
3
+ * MoFlo V4 CLI
4
4
  *
5
5
  * Created with ❤️ by motailz.com
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * V3 CLI Main Entry Point
3
- * Modernized CLI for RuFlo V3
3
+ * MoFlo V4 CLI
4
4
  *
5
5
  * Created with ❤️ by motailz.com
6
6
  */
@@ -38,8 +38,8 @@ export class CLI {
38
38
  output;
39
39
  interactive;
40
40
  constructor(options = {}) {
41
- this.name = options.name || 'ruflo';
42
- this.description = options.description || 'RuFlo V3 - AI Agent Orchestration Platform';
41
+ this.name = options.name || 'flo';
42
+ this.description = options.description || 'MoFlo V4 - AI Agent Orchestration for Claude Code';
43
43
  this.version = options.version || VERSION;
44
44
  this.parser = commandParser;
45
45
  this.output = output;
@@ -463,7 +463,7 @@ const TEMPLATE_SECTIONS = {
463
463
  export function generateClaudeMd(options, template) {
464
464
  const tmpl = template ?? options.runtime.claudeMdTemplate ?? 'standard';
465
465
  const sections = TEMPLATE_SECTIONS[tmpl] ?? TEMPLATE_SECTIONS.standard;
466
- const header = `# Claude Code Configuration - RuFlo V3\n`;
466
+ const header = `# Claude Code Configuration - MoFlo V4\n`;
467
467
  const body = sections.map(fn => fn(options)).join('\n\n');
468
468
  return `${header}\n${body}\n`;
469
469
  }
@@ -1007,17 +1007,14 @@ async function writeStatusline(targetDir, options, result) {
1007
1007
  }
1008
1008
  }
1009
1009
  }
1010
- // ALWAYS generate statusline.cjs — settings.json references this path
1011
- // regardless of whether advanced statusline files were also copied.
1010
+ // ALWAYS generate statusline.cjs — the generated version includes AgentDB
1011
+ // vectors/size, tests, ADRs, hooks, and integration stats that the
1012
+ // pre-installed static copy in the npm package lacks.
1013
+ // This must overwrite any copy from writeHelpers() which copies the legacy file.
1012
1014
  const statuslineScript = generateStatuslineScript(options);
1013
1015
  const statuslinePath = path.join(helpersDir, 'statusline.cjs');
1014
- if (!fs.existsSync(statuslinePath) || options.force) {
1015
- fs.writeFileSync(statuslinePath, statuslineScript, 'utf-8');
1016
- result.created.files.push('.claude/helpers/statusline.cjs');
1017
- }
1018
- else {
1019
- result.skipped.push('.claude/helpers/statusline.cjs');
1020
- }
1016
+ fs.writeFileSync(statuslinePath, statuslineScript, 'utf-8');
1017
+ result.created.files.push('.claude/helpers/statusline.cjs');
1021
1018
  }
1022
1019
  /**
1023
1020
  * Write runtime configuration (.claude-flow/)
@@ -1028,7 +1025,7 @@ async function writeRuntimeConfig(targetDir, options, result) {
1028
1025
  result.skipped.push('.claude-flow/config.yaml');
1029
1026
  return;
1030
1027
  }
1031
- const config = `# RuFlo V3 Runtime Configuration
1028
+ const config = `# MoFlo V4 Runtime Configuration
1032
1029
  # Generated: ${new Date().toISOString()}
1033
1030
 
1034
1031
  version: "3.0.0"
@@ -1208,7 +1205,7 @@ async function writeCapabilitiesDoc(targetDir, options, result) {
1208
1205
  result.skipped.push('.claude-flow/CAPABILITIES.md');
1209
1206
  return;
1210
1207
  }
1211
- const capabilities = `# RuFlo V3 - Complete Capabilities Reference
1208
+ const capabilities = `# MoFlo V4 - Complete Capabilities Reference
1212
1209
  > Generated: ${new Date().toISOString()}
1213
1210
  > Full documentation: https://github.com/eric-cielo/moflo
1214
1211
 
@@ -1228,7 +1225,7 @@ async function writeCapabilitiesDoc(targetDir, options, result) {
1228
1225
 
1229
1226
  ## Overview
1230
1227
 
1231
- RuFlo V3 is a domain-driven design architecture for multi-agent AI coordination with:
1228
+ MoFlo V4 is a domain-driven design architecture for multi-agent AI coordination with:
1232
1229
 
1233
1230
  - **15-Agent Swarm Coordination** with hierarchical and mesh topologies
1234
1231
  - **HNSW Vector Search** - 150x-12,500x faster pattern retrieval