moflo 4.5.0 → 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 (47) hide show
  1. package/package.json +1 -1
  2. package/src/@claude-flow/cli/dist/src/commands/appliance.js +12 -12
  3. package/src/@claude-flow/cli/dist/src/commands/benchmark.js +2 -2
  4. package/src/@claude-flow/cli/dist/src/commands/claims.js +1 -1
  5. package/src/@claude-flow/cli/dist/src/commands/config.js +1 -1
  6. package/src/@claude-flow/cli/dist/src/commands/daemon.js +25 -3
  7. package/src/@claude-flow/cli/dist/src/commands/deployment.js +1 -1
  8. package/src/@claude-flow/cli/dist/src/commands/doctor.js +23 -6
  9. package/src/@claude-flow/cli/dist/src/commands/embeddings.js +1 -1
  10. package/src/@claude-flow/cli/dist/src/commands/hooks.js +1 -1
  11. package/src/@claude-flow/cli/dist/src/commands/init.js +14 -12
  12. package/src/@claude-flow/cli/dist/src/commands/neural.js +1 -1
  13. package/src/@claude-flow/cli/dist/src/commands/orc.d.ts +2 -2
  14. package/src/@claude-flow/cli/dist/src/commands/orc.js +12 -12
  15. package/src/@claude-flow/cli/dist/src/commands/performance.js +1 -1
  16. package/src/@claude-flow/cli/dist/src/commands/plugins.js +1 -1
  17. package/src/@claude-flow/cli/dist/src/commands/providers.js +1 -1
  18. package/src/@claude-flow/cli/dist/src/commands/security.js +1 -1
  19. package/src/@claude-flow/cli/dist/src/commands/start.js +11 -11
  20. package/src/@claude-flow/cli/dist/src/commands/status.js +3 -3
  21. package/src/@claude-flow/cli/dist/src/commands/transfer-store.js +1 -1
  22. package/src/@claude-flow/cli/dist/src/config/moflo-config.d.ts +30 -0
  23. package/src/@claude-flow/cli/dist/src/config/moflo-config.js +103 -7
  24. package/src/@claude-flow/cli/dist/src/index.d.ts +1 -1
  25. package/src/@claude-flow/cli/dist/src/index.js +3 -3
  26. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +1 -1
  27. package/src/@claude-flow/cli/dist/src/init/executor.js +9 -12
  28. package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +640 -640
  29. package/src/@claude-flow/cli/dist/src/init/moflo-init.js +646 -192
  30. package/src/@claude-flow/cli/dist/src/init/settings-generator.js +7 -12
  31. package/src/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +1 -1
  32. package/src/@claude-flow/cli/dist/src/init/statusline-generator.js +784 -784
  33. package/src/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +12 -12
  34. package/src/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +122 -66
  35. package/src/@claude-flow/cli/dist/src/memory/intelligence.js +5 -1
  36. package/src/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +1 -1
  37. package/src/@claude-flow/cli/dist/src/memory/memory-initializer.js +371 -371
  38. package/src/@claude-flow/cli/dist/src/parser.d.ts +10 -0
  39. package/src/@claude-flow/cli/dist/src/parser.js +49 -3
  40. package/src/@claude-flow/cli/dist/src/plugins/store/discovery.js +1 -1
  41. package/src/@claude-flow/cli/dist/src/runtime/headless.js +30 -30
  42. package/src/@claude-flow/cli/dist/src/services/claim-service.js +1 -1
  43. package/src/@claude-flow/cli/dist/src/services/ruvector-training.js +11 -5
  44. package/src/@claude-flow/cli/dist/src/services/workflow-gate.d.ts +13 -3
  45. package/src/@claude-flow/cli/dist/src/services/workflow-gate.js +73 -5
  46. package/src/@claude-flow/cli/dist/src/types.d.ts +1 -1
  47. package/src/@claude-flow/cli/dist/src/types.js +1 -1
@@ -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