claude-flow 3.5.1 → 3.5.3

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 (59) hide show
  1. package/.claude/helpers/statusline.cjs +3 -3
  2. package/.claude/settings.json +1 -1
  3. package/README.md +156 -26
  4. package/package.json +1 -2
  5. package/v3/@claude-flow/cli/README.md +156 -26
  6. package/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.d.ts +91 -0
  7. package/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.js +425 -0
  8. package/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
  9. package/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.js +292 -0
  10. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.d.ts +44 -0
  11. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.js +329 -0
  12. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.d.ts +97 -0
  13. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.js +370 -0
  14. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.d.ts +111 -0
  15. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.js +393 -0
  16. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.d.ts +69 -0
  17. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.js +237 -0
  18. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.d.ts +123 -0
  19. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.js +347 -0
  20. package/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.d.ts +9 -0
  21. package/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.js +215 -0
  22. package/v3/@claude-flow/cli/dist/src/commands/appliance.d.ts +8 -0
  23. package/v3/@claude-flow/cli/dist/src/commands/appliance.js +406 -0
  24. package/v3/@claude-flow/cli/dist/src/commands/benchmark.js +2 -2
  25. package/v3/@claude-flow/cli/dist/src/commands/claims.js +1 -1
  26. package/v3/@claude-flow/cli/dist/src/commands/config.js +1 -1
  27. package/v3/@claude-flow/cli/dist/src/commands/deployment.js +1 -1
  28. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +25 -42
  29. package/v3/@claude-flow/cli/dist/src/commands/embeddings.js +1 -1
  30. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +1 -1
  31. package/v3/@claude-flow/cli/dist/src/commands/index.d.ts +2 -0
  32. package/v3/@claude-flow/cli/dist/src/commands/index.js +6 -0
  33. package/v3/@claude-flow/cli/dist/src/commands/init.js +11 -11
  34. package/v3/@claude-flow/cli/dist/src/commands/memory.js +24 -0
  35. package/v3/@claude-flow/cli/dist/src/commands/neural.js +1 -1
  36. package/v3/@claude-flow/cli/dist/src/commands/performance.js +1 -1
  37. package/v3/@claude-flow/cli/dist/src/commands/plugins.js +1 -1
  38. package/v3/@claude-flow/cli/dist/src/commands/providers.js +1 -1
  39. package/v3/@claude-flow/cli/dist/src/commands/security.js +1 -1
  40. package/v3/@claude-flow/cli/dist/src/commands/start.js +11 -11
  41. package/v3/@claude-flow/cli/dist/src/commands/status.js +3 -3
  42. package/v3/@claude-flow/cli/dist/src/commands/transfer-store.js +1 -1
  43. package/v3/@claude-flow/cli/dist/src/index.js +2 -2
  44. package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.js +1 -1
  45. package/v3/@claude-flow/cli/dist/src/init/executor.js +20 -46
  46. package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +68 -40
  47. package/v3/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +1 -1
  48. package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +4 -4
  49. package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.js +1 -1
  50. package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.js +5 -5
  51. package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.js +2 -2
  52. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +1 -1
  53. package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.js +1 -1
  54. package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.js +21 -6
  55. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +6 -0
  56. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +54 -2
  57. package/v3/@claude-flow/cli/dist/src/runtime/headless.js +3 -3
  58. package/v3/@claude-flow/cli/dist/src/services/claim-service.js +1 -1
  59. package/v3/@claude-flow/cli/package.json +1 -1
@@ -11,7 +11,7 @@ import { executeInit, executeUpgrade, executeUpgradeWithMissing, DEFAULT_INIT_OP
11
11
  async function initCodexAction(ctx, options) {
12
12
  const { force, minimal, full, dualMode } = options;
13
13
  output.writeln();
14
- output.writeln(output.bold('Initializing Claude Flow V3 for OpenAI Codex'));
14
+ output.writeln(output.bold('Initializing RuFlo V3 for OpenAI Codex'));
15
15
  output.writeln();
16
16
  // Determine template
17
17
  const template = minimal ? 'minimal' : full ? 'full' : 'default';
@@ -155,7 +155,7 @@ const initAction = async (ctx) => {
155
155
  const initialized = isInitialized(cwd);
156
156
  const hasExisting = initialized.claude || initialized.claudeFlow;
157
157
  if (hasExisting && !force) {
158
- output.printWarning('Claude Flow appears to be already initialized');
158
+ output.printWarning('RuFlo appears to be already initialized');
159
159
  if (initialized.claude)
160
160
  output.printInfo(' Found: .claude/settings.json');
161
161
  if (initialized.claudeFlow)
@@ -175,7 +175,7 @@ const initAction = async (ctx) => {
175
175
  }
176
176
  }
177
177
  output.writeln();
178
- output.writeln(output.bold('Initializing Claude Flow V3'));
178
+ output.writeln(output.bold('Initializing RuFlo V3'));
179
179
  output.writeln();
180
180
  // Build init options based on flags
181
181
  let options;
@@ -215,7 +215,7 @@ const initAction = async (ctx) => {
215
215
  }
216
216
  return { success: false, exitCode: 1 };
217
217
  }
218
- spinner.succeed('Claude Flow V3 initialized successfully!');
218
+ spinner.succeed('RuFlo V3 initialized successfully!');
219
219
  output.writeln();
220
220
  // Display summary
221
221
  const summary = [];
@@ -362,7 +362,7 @@ const wizardCommand = {
362
362
  description: 'Interactive setup wizard for comprehensive configuration',
363
363
  action: async (ctx) => {
364
364
  output.writeln();
365
- output.writeln(output.bold('Claude Flow V3 Setup Wizard'));
365
+ output.writeln(output.bold('RuFlo V3 Setup Wizard'));
366
366
  output.writeln(output.dim('Answer questions to configure your project'));
367
367
  output.writeln();
368
368
  try {
@@ -595,7 +595,7 @@ const wizardCommand = {
595
595
  // Check subcommand
596
596
  const checkCommand = {
597
597
  name: 'check',
598
- description: 'Check if Claude Flow is initialized',
598
+ description: 'Check if RuFlo is initialized',
599
599
  action: async (ctx) => {
600
600
  const initialized = isInitialized(ctx.cwd);
601
601
  const result = {
@@ -612,7 +612,7 @@ const checkCommand = {
612
612
  return { success: true, data: result };
613
613
  }
614
614
  if (result.initialized) {
615
- output.printSuccess('Claude Flow is initialized');
615
+ output.printSuccess('RuFlo is initialized');
616
616
  if (initialized.claude) {
617
617
  output.printInfo(` Claude Code: .claude/settings.json`);
618
618
  }
@@ -621,8 +621,8 @@ const checkCommand = {
621
621
  }
622
622
  }
623
623
  else {
624
- output.printWarning('Claude Flow is not initialized in this directory');
625
- output.printInfo('Run "claude-flow init" to initialize');
624
+ output.printWarning('RuFlo is not initialized in this directory');
625
+ output.printInfo('Run "ruflo init" to initialize');
626
626
  }
627
627
  return { success: true, data: result };
628
628
  },
@@ -765,7 +765,7 @@ const upgradeCommand = {
765
765
  const addMissing = (ctx.flags['add-missing'] || ctx.flags.addMissing);
766
766
  const upgradeSettings = (ctx.flags.settings);
767
767
  output.writeln();
768
- output.writeln(output.bold('Upgrading Claude Flow'));
768
+ output.writeln(output.bold('Upgrading RuFlo'));
769
769
  if (addMissing && upgradeSettings) {
770
770
  output.writeln(output.dim('Updates helpers, settings, and adds any missing skills/agents/commands'));
771
771
  }
@@ -865,7 +865,7 @@ const upgradeCommand = {
865
865
  // Main init command
866
866
  export const initCommand = {
867
867
  name: 'init',
868
- description: 'Initialize Claude Flow in the current directory',
868
+ description: 'Initialize RuFlo in the current directory',
869
869
  subcommands: [wizardCommand, checkCommand, skillsCommand, hooksCommand, upgradeCommand],
870
870
  options: [
871
871
  {
@@ -1137,6 +1137,30 @@ const initMemoryCommand = {
1137
1137
  }
1138
1138
  output.printBox(featureLines.join('\n'), 'Configuration');
1139
1139
  output.writeln();
1140
+ // ADR-053: Show ControllerRegistry activation results
1141
+ if (result.controllers) {
1142
+ const { activated, failed, initTimeMs } = result.controllers;
1143
+ if (activated.length > 0 || failed.length > 0) {
1144
+ const controllerLines = [
1145
+ output.bold('AgentDB Controllers:'),
1146
+ ` Activated: ${activated.length} Failed: ${failed.length} Init: ${Math.round(initTimeMs)}ms`,
1147
+ ];
1148
+ if (verbose && activated.length > 0) {
1149
+ controllerLines.push('');
1150
+ for (const name of activated) {
1151
+ controllerLines.push(` ${output.success('✓')} ${name}`);
1152
+ }
1153
+ }
1154
+ if (failed.length > 0 && verbose) {
1155
+ controllerLines.push('');
1156
+ for (const name of failed) {
1157
+ controllerLines.push(` ${output.dim('✗')} ${name}`);
1158
+ }
1159
+ }
1160
+ output.printBox(controllerLines.join('\n'), 'Controller Registry (ADR-053)');
1161
+ output.writeln();
1162
+ }
1163
+ }
1140
1164
  // Show tables created
1141
1165
  if (verbose && result.tablesCreated.length > 0) {
1142
1166
  output.writeln(output.bold('Tables Created:'));
@@ -1435,7 +1435,7 @@ export const neuralCommand = {
1435
1435
  ],
1436
1436
  action: async () => {
1437
1437
  output.writeln();
1438
- output.writeln(output.bold('Claude Flow Neural System'));
1438
+ output.writeln(output.bold('RuFlo Neural System'));
1439
1439
  output.writeln(output.dim('Advanced AI pattern learning and inference'));
1440
1440
  output.writeln();
1441
1441
  output.writeln('Use --help with subcommands for more info');
@@ -552,7 +552,7 @@ export const performanceCommand = {
552
552
  ],
553
553
  action: async () => {
554
554
  output.writeln();
555
- output.writeln(output.bold('Claude Flow Performance Suite'));
555
+ output.writeln(output.bold('RuFlo 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('Claude Flow Plugin System'));
780
+ output.writeln(output.bold('RuFlo 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('Claude Flow Provider Management'));
207
+ output.writeln(output.bold('RuFlo Provider Management'));
208
208
  output.writeln(output.dim('Multi-provider AI orchestration'));
209
209
  output.writeln();
210
210
  output.writeln('Subcommands:');
@@ -552,7 +552,7 @@ export const securityCommand = {
552
552
  ],
553
553
  action: async () => {
554
554
  output.writeln();
555
- output.writeln(output.bold('Claude Flow Security Suite'));
555
+ output.writeln(output.bold('RuFlo Security Suite'));
556
556
  output.writeln(output.dim('Comprehensive security scanning and vulnerability management'));
557
557
  output.writeln();
558
558
  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('Claude Flow is not initialized in this directory');
93
- output.printInfo('Run "claude-flow init" first to initialize');
92
+ output.printError('RuFlo is not initialized in this directory');
93
+ output.printInfo('Run "ruflo 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 Claude Flow V3'));
105
+ output.writeln(output.bold('Starting RuFlo V3'));
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('Claude Flow V3 is running!');
154
+ output.printSuccess('RuFlo V3 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 Claude Flow system',
233
+ description: 'Stop the RuFlo 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 Claude Flow'));
253
+ output.writeln(output.bold('Stopping RuFlo'));
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 Claude Flow?',
257
+ message: 'Are you sure you want to stop RuFlo?',
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('Claude Flow stopped successfully');
297
+ output.printSuccess('RuFlo 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 Claude Flow system',
313
+ description: 'Restart the RuFlo 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 Claude Flow'));
325
+ output.writeln(output.bold('Restarting RuFlo'));
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 Claude Flow orchestration system',
375
+ description: 'Start the RuFlo 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('Claude Flow V3')} ${statusIcon}`);
155
+ output.writeln(`${output.bold('RuFlo V3')} ${statusIcon}`);
156
156
  output.writeln();
157
157
  // Swarm section
158
158
  output.writeln(output.bold('Swarm'));
@@ -262,8 +262,8 @@ const statusAction = async (ctx) => {
262
262
  const cwd = ctx.cwd;
263
263
  // Check initialization
264
264
  if (!isInitialized(cwd)) {
265
- output.printError('Claude Flow is not initialized in this directory');
266
- output.printInfo('Run "claude-flow init" to initialize');
265
+ output.printError('RuFlo is not initialized in this directory');
266
+ output.printInfo('Run "ruflo init" to initialize');
267
267
  return { success: false, exitCode: 1 };
268
268
  }
269
269
  // Get status
@@ -405,7 +405,7 @@ export const storeCommand = {
405
405
  ],
406
406
  action: async () => {
407
407
  output.writeln();
408
- output.writeln(output.bold('Claude Flow Pattern Store'));
408
+ output.writeln(output.bold('RuFlo Pattern Store'));
409
409
  output.writeln(output.dim('Decentralized pattern marketplace via IPFS'));
410
410
  output.writeln();
411
411
  output.writeln('Subcommands:');
@@ -38,8 +38,8 @@ export class CLI {
38
38
  output;
39
39
  interactive;
40
40
  constructor(options = {}) {
41
- this.name = options.name || 'claude-flow';
42
- this.description = options.description || 'Claude Flow V3 - AI Agent Orchestration Platform';
41
+ this.name = options.name || 'ruflo';
42
+ this.description = options.description || 'RuFlo V3 - AI Agent Orchestration Platform';
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 - Claude Flow V3\n`;
466
+ const header = `# Claude Code Configuration - RuFlo V3\n`;
467
467
  const body = sections.map(fn => fn(options)).join('\n\n');
468
468
  return `${header}\n${body}\n`;
469
469
  }
@@ -217,12 +217,9 @@ function mergeSettingsForUpgrade(existing) {
217
217
  // Platform-specific command wrappers
218
218
  // Windows: Use PowerShell-compatible commands
219
219
  // Mac/Linux: Use bash-compatible commands with 2>/dev/null
220
- const teammateIdleCmd = isWindows
221
- ? 'npx @claude-flow/cli@latest hooks teammate-idle --auto-assign true 2>$null; exit 0'
222
- : 'npx @claude-flow/cli@latest hooks teammate-idle --auto-assign true 2>/dev/null || true';
223
- const taskCompletedCmd = isWindows
224
- ? 'if ($env:TASK_ID) { npx @claude-flow/cli@latest hooks task-completed --task-id $env:TASK_ID --train-patterns true 2>$null }; exit 0'
225
- : '[ -n "$TASK_ID" ] && npx @claude-flow/cli@latest hooks task-completed --task-id "$TASK_ID" --train-patterns true 2>/dev/null || true';
220
+ // NOTE: teammateIdleCmd and taskCompletedCmd were removed.
221
+ // TeammateIdle/TaskCompleted are not valid Claude Code hook events and caused warnings.
222
+ // Agent Teams hook config lives in claudeFlow.agentTeams.hooks instead.
226
223
  // 1. Merge env vars (preserve existing, add new)
227
224
  const existingEnv = existing.env || {};
228
225
  merged.env = {
@@ -234,13 +231,14 @@ function mergeSettingsForUpgrade(existing) {
234
231
  // 2. Merge hooks (preserve existing, add new Agent Teams + auto-memory hooks)
235
232
  const existingHooks = existing.hooks || {};
236
233
  merged.hooks = { ...existingHooks };
237
- // Platform-specific auto-memory hook commands
238
- const autoMemoryImportCmd = isWindows
239
- ? 'node .claude/helpers/auto-memory-hook.mjs import 2>$null; exit 0'
240
- : 'node .claude/helpers/auto-memory-hook.mjs import 2>/dev/null || true';
241
- const autoMemorySyncCmd = isWindows
242
- ? 'node .claude/helpers/auto-memory-hook.mjs sync 2>$null; exit 0'
243
- : 'node .claude/helpers/auto-memory-hook.mjs sync 2>/dev/null || true';
234
+ // Cross-platform auto-memory hook commands that resolve paths via git root.
235
+ // Uses node -e with git rev-parse so hooks work regardless of CWD (#1259, #1284).
236
+ const gitRootResolver = "var c=require('child_process'),p=require('path'),u=require('url'),r;"
237
+ + "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}"
238
+ + 'catch(e){r=process.cwd()}';
239
+ const autoMemoryScript = '.claude/helpers/auto-memory-hook.mjs';
240
+ const autoMemoryImportCmd = `node -e "${gitRootResolver}var f=p.join(r,'${autoMemoryScript}');import(u.pathToFileURL(f).href)" import`;
241
+ const autoMemorySyncCmd = `node -e "${gitRootResolver}var f=p.join(r,'${autoMemoryScript}');import(u.pathToFileURL(f).href)" sync`;
244
242
  // Add auto-memory import to SessionStart (if not already present)
245
243
  const sessionStartHooks = existingHooks.SessionStart;
246
244
  const hasAutoMemoryImport = sessionStartHooks?.some(group => group.hooks?.some(h => h.command?.includes('auto-memory-hook')));
@@ -278,43 +276,19 @@ function mergeSettingsForUpgrade(existing) {
278
276
  continueOnError: true,
279
277
  });
280
278
  }
281
- // Add TeammateIdle hook if not present
282
- if (!existingHooks.TeammateIdle) {
283
- merged.hooks.TeammateIdle = [
284
- {
285
- hooks: [
286
- {
287
- type: 'command',
288
- command: teammateIdleCmd,
289
- timeout: 5000,
290
- continueOnError: true,
291
- },
292
- ],
293
- },
294
- ];
295
- }
296
- // Add TaskCompleted hook if not present
297
- if (!existingHooks.TaskCompleted) {
298
- merged.hooks.TaskCompleted = [
299
- {
300
- hooks: [
301
- {
302
- type: 'command',
303
- command: taskCompletedCmd,
304
- timeout: 5000,
305
- continueOnError: true,
306
- },
307
- ],
308
- },
309
- ];
310
- }
279
+ // NOTE: TeammateIdle and TaskCompleted are NOT valid Claude Code hook events.
280
+ // They cause warnings when present in settings.json hooks.
281
+ // Remove them if they exist from a previous init.
282
+ delete merged.hooks.TeammateIdle;
283
+ delete merged.hooks.TaskCompleted;
284
+ // Their configuration lives in claudeFlow.agentTeams.hooks instead.
311
285
  // 3. Fix statusLine config (remove invalid fields, ensure correct format)
312
286
  // Claude Code only supports: type, command, padding
313
287
  const existingStatusLine = existing.statusLine;
314
288
  if (existingStatusLine) {
315
289
  merged.statusLine = {
316
290
  type: 'command',
317
- command: existingStatusLine.command || 'node .claude/helpers/statusline.cjs',
291
+ command: existingStatusLine.command || `node -e "var c=require('child_process'),p=require('path'),r;try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}catch(e){r=process.cwd()}var s=p.join(r,'.claude/helpers/statusline.cjs');process.argv.splice(1,0,s);require(s)"`,
318
292
  // Remove invalid fields: refreshMs, enabled (not supported by Claude Code)
319
293
  };
320
294
  }
@@ -526,8 +500,8 @@ export async function executeUpgrade(targetDir, upgradeSettings = false) {
526
500
  'env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS',
527
501
  'hooks.SessionStart (auto-memory import)',
528
502
  'hooks.SessionEnd (auto-memory sync)',
529
- 'hooks.TeammateIdle',
530
- 'hooks.TaskCompleted',
503
+ 'hooks.TeammateIdle (removed — not a valid Claude Code hook)',
504
+ 'hooks.TaskCompleted (removed — not a valid Claude Code hook)',
531
505
  'claudeFlow.agentTeams',
532
506
  'claudeFlow.memory (learningBridge, memoryGraph, agentScopes)',
533
507
  ];
@@ -141,6 +141,57 @@ export function generateSettings(options) {
141
141
  };
142
142
  return settings;
143
143
  }
144
+ /**
145
+ * Build a cross-platform hook command that resolves paths to the project root.
146
+ * Uses `git rev-parse --show-toplevel` at runtime so hooks work regardless of CWD.
147
+ * Falls back to process.cwd() when not inside a git repo.
148
+ *
149
+ * The generated command is a `node -e` one-liner that:
150
+ * 1. Finds the git root (or falls back to cwd)
151
+ * 2. Requires the target script with the resolved absolute path
152
+ * 3. Passes through process.argv so the script sees its subcommand in argv[2]
153
+ */
154
+ function hookCmd(script, subcommand) {
155
+ // Compact one-liner: resolve project root, then require the script.
156
+ // With `node -e "..." arg`, process.argv = ['node', 'arg'] (no -e entry).
157
+ // hook-handler.cjs reads argv[2] as its command, so we splice in the resolved
158
+ // script path at argv[1] to produce: ['node', '<script>', 'subcommand'].
159
+ // Use single quotes for the script path to avoid conflicting with outer double quotes.
160
+ const scriptLiteral = `'${script}'`;
161
+ const resolver = [
162
+ "var c=require('child_process'),p=require('path'),r;",
163
+ "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}",
164
+ 'catch(e){r=process.cwd()}',
165
+ `var s=p.join(r,${scriptLiteral});`,
166
+ 'process.argv.splice(1,0,s);',
167
+ 'require(s)',
168
+ ].join('');
169
+ return `node -e "${resolver}" ${subcommand}`.trim();
170
+ }
171
+ /**
172
+ * Build a cross-platform hook command for ESM scripts (.mjs).
173
+ * Uses dynamic import() with a file:// URL for cross-platform ESM loading.
174
+ */
175
+ function hookCmdEsm(script, subcommand) {
176
+ const scriptLiteral = `'${script}'`;
177
+ const resolver = [
178
+ "var c=require('child_process'),p=require('path'),u=require('url'),r;",
179
+ "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}",
180
+ 'catch(e){r=process.cwd()}',
181
+ `var f=p.join(r,${scriptLiteral});`,
182
+ 'process.argv.splice(1,0,f);',
183
+ 'import(u.pathToFileURL(f).href)',
184
+ ].join('');
185
+ return `node -e "${resolver}" ${subcommand}`.trim();
186
+ }
187
+ /** Shorthand for CJS hook-handler commands */
188
+ function hookHandlerCmd(subcommand) {
189
+ return hookCmd('.claude/helpers/hook-handler.cjs', subcommand);
190
+ }
191
+ /** Shorthand for ESM auto-memory-hook commands */
192
+ function autoMemoryCmd(subcommand) {
193
+ return hookCmdEsm('.claude/helpers/auto-memory-hook.mjs', subcommand);
194
+ }
144
195
  /**
145
196
  * Generate statusLine configuration for Claude Code
146
197
  * Uses local helper script for cross-platform compatibility (no npx cold-start)
@@ -151,15 +202,14 @@ function generateStatusLineConfig(_options) {
151
202
  // The script runs after each assistant message (debounced 300ms).
152
203
  return {
153
204
  type: 'command',
154
- command: 'node .claude/helpers/statusline.cjs',
205
+ command: hookCmd('.claude/helpers/statusline.cjs', ''),
155
206
  };
156
207
  }
157
208
  /**
158
209
  * Generate hooks configuration
159
210
  * Uses local hook-handler.cjs for cross-platform compatibility.
160
- * All hooks delegate to `node .claude/helpers/hook-handler.cjs <command>`
161
- * which works identically on Windows, macOS, and Linux without
162
- * shell-specific syntax (no bash 2>/dev/null, no PowerShell 2>$null).
211
+ * All hooks delegate to hook-handler.cjs via resolved absolute paths,
212
+ * so they work identically on Windows, macOS, and Linux regardless of CWD.
163
213
  */
164
214
  function generateHooksConfig(config) {
165
215
  const hooks = {};
@@ -173,7 +223,7 @@ function generateHooksConfig(config) {
173
223
  hooks: [
174
224
  {
175
225
  type: 'command',
176
- command: 'node .claude/helpers/hook-handler.cjs pre-bash',
226
+ command: hookHandlerCmd('pre-bash'),
177
227
  timeout: config.timeout,
178
228
  },
179
229
  ],
@@ -188,7 +238,7 @@ function generateHooksConfig(config) {
188
238
  hooks: [
189
239
  {
190
240
  type: 'command',
191
- command: 'node .claude/helpers/hook-handler.cjs post-edit',
241
+ command: hookHandlerCmd('post-edit'),
192
242
  timeout: 10000,
193
243
  },
194
244
  ],
@@ -202,7 +252,7 @@ function generateHooksConfig(config) {
202
252
  hooks: [
203
253
  {
204
254
  type: 'command',
205
- command: 'node .claude/helpers/hook-handler.cjs route',
255
+ command: hookHandlerCmd('route'),
206
256
  timeout: 10000,
207
257
  },
208
258
  ],
@@ -216,12 +266,12 @@ function generateHooksConfig(config) {
216
266
  hooks: [
217
267
  {
218
268
  type: 'command',
219
- command: 'node .claude/helpers/hook-handler.cjs session-restore',
269
+ command: hookHandlerCmd('session-restore'),
220
270
  timeout: 15000,
221
271
  },
222
272
  {
223
273
  type: 'command',
224
- command: 'node .claude/helpers/auto-memory-hook.mjs import',
274
+ command: autoMemoryCmd('import'),
225
275
  timeout: 8000,
226
276
  },
227
277
  ],
@@ -235,7 +285,7 @@ function generateHooksConfig(config) {
235
285
  hooks: [
236
286
  {
237
287
  type: 'command',
238
- command: 'node .claude/helpers/hook-handler.cjs session-end',
288
+ command: hookHandlerCmd('session-end'),
239
289
  timeout: 10000,
240
290
  },
241
291
  ],
@@ -249,7 +299,7 @@ function generateHooksConfig(config) {
249
299
  hooks: [
250
300
  {
251
301
  type: 'command',
252
- command: 'node .claude/helpers/auto-memory-hook.mjs sync',
302
+ command: autoMemoryCmd('sync'),
253
303
  timeout: 10000,
254
304
  },
255
305
  ],
@@ -264,11 +314,11 @@ function generateHooksConfig(config) {
264
314
  hooks: [
265
315
  {
266
316
  type: 'command',
267
- command: 'node .claude/helpers/hook-handler.cjs compact-manual',
317
+ command: hookHandlerCmd('compact-manual'),
268
318
  },
269
319
  {
270
320
  type: 'command',
271
- command: 'node .claude/helpers/hook-handler.cjs session-end',
321
+ command: hookHandlerCmd('session-end'),
272
322
  timeout: 5000,
273
323
  },
274
324
  ],
@@ -278,11 +328,11 @@ function generateHooksConfig(config) {
278
328
  hooks: [
279
329
  {
280
330
  type: 'command',
281
- command: 'node .claude/helpers/hook-handler.cjs compact-auto',
331
+ command: hookHandlerCmd('compact-auto'),
282
332
  },
283
333
  {
284
334
  type: 'command',
285
- command: 'node .claude/helpers/hook-handler.cjs session-end',
335
+ command: hookHandlerCmd('session-end'),
286
336
  timeout: 6000,
287
337
  },
288
338
  ],
@@ -295,36 +345,14 @@ function generateHooksConfig(config) {
295
345
  hooks: [
296
346
  {
297
347
  type: 'command',
298
- command: 'node .claude/helpers/hook-handler.cjs status',
348
+ command: hookHandlerCmd('status'),
299
349
  timeout: 3000,
300
350
  },
301
351
  ],
302
352
  },
303
353
  ];
304
- // TeammateIdle auto-assign pending tasks to idle teammates
305
- hooks.TeammateIdle = [
306
- {
307
- hooks: [
308
- {
309
- type: 'command',
310
- command: 'node .claude/helpers/hook-handler.cjs post-task',
311
- timeout: 5000,
312
- },
313
- ],
314
- },
315
- ];
316
- // TaskCompleted — train patterns and record completion
317
- hooks.TaskCompleted = [
318
- {
319
- hooks: [
320
- {
321
- type: 'command',
322
- command: 'node .claude/helpers/hook-handler.cjs post-task',
323
- timeout: 5000,
324
- },
325
- ],
326
- },
327
- ];
354
+ // NOTE: TeammateIdle and TaskCompleted are NOT valid Claude Code hook events.
355
+ // Their configuration lives in claudeFlow.agentTeams.hooks instead (see generateSettings).
328
356
  return hooks;
329
357
  }
330
358
  /**
@@ -13,7 +13,7 @@ import type { InitOptions } from './types.js';
13
13
  /**
14
14
  * Generate optimized statusline script
15
15
  * Output format:
16
- * ▊ Claude Flow V3 ● user │ ⎇ branch │ Opus 4.6
16
+ * ▊ RuFlo V3 ● user │ ⎇ branch │ Opus 4.6
17
17
  * ─────────────────────────────────────────────────────
18
18
  * 🏗️ DDD Domains [●●○○○] 2/5 ⚡ HNSW 150x
19
19
  * 🤖 Swarm ◉ [ 5/15] 👥 2 🪝 10/17 🟢 CVE 3/3 💾 4MB 🧠 63%