claude-flow 3.57.1 → 3.57.2

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 (27) hide show
  1. package/.claude/helpers/intelligence.cjs +3 -5
  2. package/.claude/proven-config.json +1 -1
  3. package/node_modules/@claude-flow/codex/README.md +9 -9
  4. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +3 -3
  5. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -1
  6. package/package.json +3 -2
  7. package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
  8. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +20 -1
  9. package/v3/@claude-flow/cli/dist/src/commands/memory.js +25 -1
  10. package/v3/@claude-flow/cli/dist/src/commands/workflow.js +55 -15
  11. package/v3/@claude-flow/cli/dist/src/init/executor.js +9 -5
  12. package/v3/@claude-flow/cli/dist/src/init/helper-companions.d.ts +1 -1
  13. package/v3/@claude-flow/cli/dist/src/init/helper-companions.js +4 -3
  14. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +9 -3
  15. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +58 -9
  16. package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +2 -1
  17. package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.d.ts +16 -4
  18. package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.js +19 -7
  19. package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +4 -0
  20. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +12 -5
  21. package/v3/@claude-flow/cli/dist/src/services/memory-backup.d.ts +6 -0
  22. package/v3/@claude-flow/cli/dist/src/services/memory-backup.js +109 -81
  23. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.d.ts +2 -0
  24. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.js +4 -4
  25. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +54 -3
  26. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +4 -0
  27. package/v3/@claude-flow/cli/package.json +5 -4
@@ -277,11 +277,9 @@ function sessionGet(key) {
277
277
 
278
278
  function sessionSet(key, value) {
279
279
  try {
280
- if (!fs.existsSync(SESSION_DIR)) fs.mkdirSync(SESSION_DIR, { recursive: true });
281
- let session = {};
282
- if (fs.existsSync(SESSION_FILE)) {
283
- session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
284
- }
280
+ // Session creation belongs to session.cjs; recall may run before SessionStart.
281
+ if (!fs.existsSync(SESSION_FILE)) return;
282
+ const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
285
283
  if (!session.context) session.context = {};
286
284
  session.context[key] = value;
287
285
  session.updatedAt = new Date().toISOString();
@@ -1,5 +1,5 @@
1
1
  {
2
- "adoptedAt": 1792428331158,
2
+ "adoptedAt": 1792452783501,
3
3
  "championId": "sha256:6141a8ea990c5063b77e090ae8f37f9c539d8aa8f58dcceb30f3a82f97e57319",
4
4
  "manifest": {
5
5
  "schema": "ruflo.proven-config/v1",
@@ -639,19 +639,19 @@ The `@claude-flow/codex` package now includes built-in dual-mode orchestration:
639
639
 
640
640
  ```bash
641
641
  # List available collaboration templates
642
- npx claude-flow-codex dual templates
642
+ npx @claude-flow/codex dual templates
643
643
 
644
644
  # Run a feature development swarm
645
- npx claude-flow-codex dual run --template feature --task "Add user authentication"
645
+ npx @claude-flow/codex dual run --template feature --task "Add user authentication"
646
646
 
647
647
  # Run a security audit swarm
648
- npx claude-flow-codex dual run --template security --task "src/auth/"
648
+ npx @claude-flow/codex dual run --template security --task "src/auth/"
649
649
 
650
650
  # Run a refactoring swarm
651
- npx claude-flow-codex dual run --template refactor --task "src/legacy/"
651
+ npx @claude-flow/codex dual run --template refactor --task "src/legacy/"
652
652
 
653
653
  # Check collaboration status
654
- npx claude-flow-codex dual status
654
+ npx @claude-flow/codex dual status
655
655
  ```
656
656
 
657
657
  ### Codex Loop Runner
@@ -660,15 +660,15 @@ Codex does not expose Claude Code's `ScheduleWakeup`, so `@claude-flow/codex` pr
660
660
 
661
661
  ```bash
662
662
  # Run Codex repeatedly until it creates .codex/loop/default.complete or reaches 10 iterations
663
- npx claude-flow-codex loop run "Fix failing tests and create the completion marker when done"
663
+ npx @claude-flow/codex loop run "Fix failing tests and create the completion marker when done"
664
664
 
665
665
  # Use command mode for recurring Ruflo workers or custom scripts
666
- npx claude-flow-codex loop run --name testgaps --interval 270 --max-iterations 0 \
666
+ npx @claude-flow/codex loop run --name testgaps --interval 270 --max-iterations 0 \
667
667
  --command "npx claude-flow hooks worker dispatch --trigger testgaps"
668
668
 
669
669
  # Inspect or stop a loop from another terminal
670
- npx claude-flow-codex loop status --name testgaps
671
- npx claude-flow-codex loop stop --name testgaps
670
+ npx @claude-flow/codex loop status --name testgaps
671
+ npx @claude-flow/codex loop stop --name testgaps
672
672
  ```
673
673
 
674
674
  Loop state is stored in `.codex/loop/<name>.json`; `loop stop` writes `.codex/loop/<name>.stop`, which the runner observes between iterations.
@@ -174,17 +174,17 @@ function createTemplateCommand() {
174
174
  console.log(chalk.cyan('feature') + ' - Feature Development Swarm');
175
175
  console.log(' Pipeline: architect → coder → tester → reviewer');
176
176
  console.log(' Platforms: Claude (architect, reviewer) + Codex (coder, tester)');
177
- console.log(' Usage: npx claude-flow-codex dual run --template feature --task "Add user auth"');
177
+ console.log(' Usage: npx @claude-flow/codex dual run --template feature --task "Add user auth"');
178
178
  console.log();
179
179
  console.log(chalk.cyan('security') + ' - Security Audit Swarm');
180
180
  console.log(' Pipeline: scanner → analyzer → fixer');
181
181
  console.log(' Platforms: Codex (scanner, fixer) + Claude (analyzer)');
182
- console.log(' Usage: npx claude-flow-codex dual run --template security --task "src/auth/"');
182
+ console.log(' Usage: npx @claude-flow/codex dual run --template security --task "src/auth/"');
183
183
  console.log();
184
184
  console.log(chalk.cyan('refactor') + ' - Refactoring Swarm');
185
185
  console.log(' Pipeline: analyzer → planner → refactorer → validator');
186
186
  console.log(' Platforms: Claude (analyzer, planner) + Codex (refactorer, validator)');
187
- console.log(' Usage: npx claude-flow-codex dual run --template refactor --task "src/legacy/"');
187
+ console.log(' Usage: npx @claude-flow/codex dual run --template refactor --task "src/legacy/"');
188
188
  console.log();
189
189
  console.log(chalk.gray('Custom configurations can be provided via --config <path.json>'));
190
190
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/dual-mode/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,oBAAoB,EAGpB,sBAAsB,EAEtB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAEvE;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;SAC5B,WAAW,CAAC,0DAA0D,CAAC;SACvE,UAAU,CAAC,gBAAgB,EAAE,CAAC;SAC9B,UAAU,CAAC,qBAAqB,EAAE,CAAC;SACnC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAErC,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB;IACvB,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC;SACtB,WAAW,CAAC,qCAAqC,CAAC;SAClD,QAAQ,CAAC,YAAY,EAAE,yFAAyF,CAAC;SACjH,MAAM,CAAC,uBAAuB,EAAE,wDAAwD,CAAC;SACzF,MAAM,CACL,qBAAqB,EACrB,uIAAuI,EACvI,CAAC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AC,MAAM,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC,CAAC;AACxG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.57.1",
3
+ "version": "3.57.2",
4
4
  "workspaces": [
5
5
  "v3/@claude-flow/codex",
6
6
  "v3/@claude-flow/mcp",
@@ -68,7 +68,7 @@
68
68
  "v3:security": "npm run security:audit && npm run security:test"
69
69
  },
70
70
  "dependencies": {
71
- "@claude-flow/cli-core": "3.7.4",
71
+ "@claude-flow/cli-core": "3.7.5",
72
72
  "@claude-flow/codex": "3.0.5",
73
73
  "@claude-flow/mcp": "3.1.1",
74
74
  "@claude-flow/neural": "3.0.0",
@@ -113,6 +113,7 @@
113
113
  "js-yaml": ">=4.3.0",
114
114
  "hono": ">=4.13.2",
115
115
  "@ruvector/rvf-wasm": "0.1.5",
116
+ "@ruvector/rvf": "0.3.4",
116
117
  "@hono/node-server": ">=2.1.1",
117
118
  "flatted": ">=3.4.0",
118
119
  "tar": ">=7.5.11",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 7,
4
- "generatedAt": "2026-10-19T16:47:16.220Z",
5
- "gitSha": "aedd3d53",
4
+ "generatedAt": "2026-10-19T23:34:04.095Z",
5
+ "gitSha": "7be330bc",
6
6
  "catalog": {
7
7
  "agents": 176,
8
8
  "tools": 423,
@@ -2333,6 +2333,19 @@ const workerListCommand = {
2333
2333
  }
2334
2334
  }
2335
2335
  };
2336
+ // Render the status hooks_worker-dispatch actually returned. Only a status that
2337
+ // means work finished may read as "completed" (#4196).
2338
+ function dispatchStatusLabel(status) {
2339
+ switch (status) {
2340
+ case 'dispatched': return output.highlight('dispatched (background)');
2341
+ case 'queued': return output.highlight('queued (daemon)');
2342
+ case 'no-daemon': return output.warning('no-daemon (not run)');
2343
+ case 'mcp-only': return output.warning('mcp-only (not queued)');
2344
+ case 'synthetic-completed': return output.warning('recorded (no work executed)');
2345
+ case 'completed': return output.success('completed');
2346
+ default: return output.dim(String(status));
2347
+ }
2348
+ }
2336
2349
  const workerDispatchCommand = {
2337
2350
  name: 'dispatch',
2338
2351
  description: 'Dispatch a background worker for analysis/optimization',
@@ -2386,9 +2399,15 @@ const workerDispatchCommand = {
2386
2399
  { field: 'Description', value: result.config.description },
2387
2400
  { field: 'Est. Duration', value: result.config.estimatedDuration },
2388
2401
  { field: 'Capabilities', value: result.config.capabilities.join(', ') },
2389
- { field: 'Status', value: result.status === 'dispatched' ? output.highlight('dispatched (background)') : output.success('completed') },
2402
+ { field: 'Status', value: dispatchStatusLabel(result.status) },
2390
2403
  ],
2391
2404
  });
2405
+ // The tool says why it could not run the worker (e.g. no daemon); show it
2406
+ // rather than letting a recorded-only dispatch read as finished work (#4196).
2407
+ if (result.note) {
2408
+ output.writeln();
2409
+ output.printWarning(result.note);
2410
+ }
2392
2411
  if (background) {
2393
2412
  output.writeln();
2394
2413
  output.writeln(output.dim(`Check status: claude-flow hooks worker status --id ${result.workerId}`));
@@ -659,7 +659,9 @@ const searchCommand = {
659
659
  });
660
660
  return {
661
661
  results: r.results.map(e => ({
662
- id: e.id,
662
+ // #2271: searchEntries() ids are truncated to 12 chars and collide
663
+ // for entries written within ~2.8h; SmartRetrieval dedupes on id.
664
+ id: JSON.stringify([e.namespace, e.key]),
663
665
  key: e.key,
664
666
  content: e.content,
665
667
  score: e.score,
@@ -1592,6 +1594,13 @@ const exportCommand = {
1592
1594
  namespace: ctx.flags.namespace,
1593
1595
  includeVectors: ctx.flags.includeVectors ?? true,
1594
1596
  });
1597
+ // memory_export reports failure as { error } rather than throwing; without
1598
+ // this check the command printed "Exported to undefined" and then crashed
1599
+ // reading result.exported.entries (#4204).
1600
+ if (!result || result.error || !result.exported) {
1601
+ output.printError(`Export error: ${result?.error ?? 'memory_export returned no export summary'}`);
1602
+ return { success: false, exitCode: 1 };
1603
+ }
1595
1604
  output.printSuccess(`Exported to ${result.outputPath}`);
1596
1605
  output.printList([
1597
1606
  `Entries: ${result.exported.entries}`,
@@ -1657,6 +1666,21 @@ const importCommand = {
1657
1666
  namespace: ctx.flags.namespace,
1658
1667
  dbPath: resolveDbPath(ctx.flags.path),
1659
1668
  });
1669
+ // memory_import reports a bad file as { error } rather than throwing, and
1670
+ // a partial write as { success: false, error, imported }. Without this the
1671
+ // command printed "Imported from undefined" and crashed on result.imported,
1672
+ // or reported success for an import that dropped entries.
1673
+ const failure = result?.error;
1674
+ if (!result || failure || result.success === false || !result.imported) {
1675
+ output.printError(`Import error: ${failure ?? 'memory_import returned no import summary'}`);
1676
+ if (result?.imported) {
1677
+ output.printList([
1678
+ `Entries imported: ${result.imported.entries}`,
1679
+ `Failed: ${result.failed ?? 'unknown'}`,
1680
+ ]);
1681
+ }
1682
+ return { success: false, exitCode: 1 };
1683
+ }
1660
1684
  output.printSuccess(`Imported from ${result.inputPath}`);
1661
1685
  output.printList([
1662
1686
  `Entries: ${result.imported.entries}`,
@@ -111,6 +111,12 @@ const runCommand = {
111
111
  dryRun,
112
112
  },
113
113
  });
114
+ const runError = toolError(result);
115
+ if (runError || !result.metrics) {
116
+ spinner.fail('Workflow failed');
117
+ output.printError(`Workflow error: ${runError ?? 'workflow_run returned no workflow summary'}`);
118
+ return { success: false, exitCode: 1 };
119
+ }
114
120
  if (dryRun) {
115
121
  spinner.succeed('Workflow validated successfully');
116
122
  }
@@ -277,6 +283,11 @@ const listCommand = {
277
283
  status: status || 'all',
278
284
  limit,
279
285
  });
286
+ const listError = toolError(result);
287
+ if (listError || !Array.isArray(result.workflows)) {
288
+ output.printError(`Failed to list workflows: ${listError ?? 'workflow_list returned no workflows'}`);
289
+ return { success: false, exitCode: 1 };
290
+ }
280
291
  if (ctx.flags.format === 'json') {
281
292
  output.printJson(result);
282
293
  return { success: true, data: result };
@@ -290,13 +301,19 @@ const listCommand = {
290
301
  }
291
302
  output.printTable({
292
303
  columns: [
293
- { key: 'id', header: 'ID', width: 15 },
294
- { key: 'template', header: 'Template', width: 15 },
304
+ { key: 'id', header: 'ID', width: 30 },
305
+ { key: 'name', header: 'Name', width: 24 },
295
306
  { key: 'status', header: 'Status', width: 12, format: formatStageStatus },
296
- { key: 'progress', header: 'Progress', width: 10, align: 'right', format: (v) => `${v}%` },
297
- { key: 'startedAt', header: 'Started', width: 20, format: (v) => new Date(String(v)).toLocaleString() }
307
+ { key: 'steps', header: 'Steps', width: 6, align: 'right' },
308
+ { key: 'createdAt', header: 'Created', width: 20, format: (v) => new Date(String(v)).toLocaleString() }
298
309
  ],
299
- data: result.workflows
310
+ data: result.workflows.map(w => ({
311
+ id: w.workflowId,
312
+ name: w.name,
313
+ status: w.status,
314
+ steps: w.stepCount,
315
+ createdAt: w.createdAt,
316
+ }))
300
317
  });
301
318
  output.writeln();
302
319
  output.printInfo(`Total: ${result.total} workflows`);
@@ -335,30 +352,37 @@ const statusCommand = {
335
352
  try {
336
353
  const result = await callMCPTool('workflow_status', {
337
354
  workflowId,
355
+ verbose: true,
338
356
  });
357
+ const statusError = toolError(result);
358
+ if (statusError) {
359
+ output.printError(`Failed to get status: ${statusError}`);
360
+ return { success: false, exitCode: 1 };
361
+ }
339
362
  if (ctx.flags.format === 'json') {
340
363
  output.printJson(result);
341
364
  return { success: true, data: result };
342
365
  }
366
+ const started = result.startedAt ? Date.parse(result.startedAt) : NaN;
367
+ const ended = result.completedAt ? Date.parse(result.completedAt) : Date.now();
343
368
  output.writeln();
344
369
  output.printBox([
345
- `ID: ${result.id}`,
346
- `Template: ${result.template}`,
370
+ `ID: ${result.workflowId}`,
371
+ `Name: ${result.name}`,
347
372
  `Status: ${formatStageStatus(result.status)}`,
348
- `Progress: ${result.progress}%`,
349
- `Duration: ${(result.metrics.duration / 1000).toFixed(1)}s`,
350
- `Tokens: ${result.metrics.tokensUsed.toLocaleString()}`,
351
- `Agents: ${result.metrics.agentsSpawned}`
373
+ `Progress: ${Math.round(result.progress)}% (${result.completedSteps}/${result.totalSteps} steps)`,
374
+ ...(Number.isNaN(started) ? [] : [`Duration: ${((ended - started) / 1000).toFixed(1)}s`]),
375
+ ...(result.error ? [`Error: ${result.error}`] : []),
352
376
  ].join('\n'), 'Workflow Status');
353
377
  output.writeln();
354
- output.writeln(output.bold('Stage Progress'));
378
+ output.writeln(output.bold('Step Progress'));
355
379
  output.printTable({
356
380
  columns: [
357
- { key: 'name', header: 'Stage', width: 20 },
381
+ { key: 'name', header: 'Step', width: 24 },
382
+ { key: 'type', header: 'Type', width: 10 },
358
383
  { key: 'status', header: 'Status', width: 12, format: formatStageStatus },
359
- { key: 'agents', header: 'Agents', width: 25, format: (v) => Array.isArray(v) ? v.length.toString() : '0' }
360
384
  ],
361
- data: result.stages
385
+ data: result.steps ?? []
362
386
  });
363
387
  return { success: true, data: result };
364
388
  }
@@ -408,6 +432,11 @@ const stopCommand = {
408
432
  workflowId,
409
433
  graceful: !force,
410
434
  });
435
+ const stopError = toolError(result);
436
+ if (stopError || result.stopped !== true) {
437
+ output.printError(`Failed to stop workflow: ${stopError ?? 'the workflow was not stopped'}`);
438
+ return { success: false, exitCode: 1 };
439
+ }
411
440
  output.printSuccess(`Workflow ${workflowId} stopped`);
412
441
  return { success: true, data: result };
413
442
  }
@@ -556,6 +585,17 @@ export const workflowCommand = {
556
585
  }
557
586
  };
558
587
  // Helper functions
588
+ /**
589
+ * The workflow MCP tools report failure as `{ error }` (or `{ success: false, error }`)
590
+ * instead of throwing, so a command that reads the result without checking it prints
591
+ * a false success or crashes on a field the error result does not have.
592
+ */
593
+ function toolError(result) {
594
+ const r = result;
595
+ if (!r)
596
+ return 'the workflow tool returned no result';
597
+ return typeof r.error === 'string' && r.error.length > 0 ? r.error : undefined;
598
+ }
559
599
  function formatStageStatus(status) {
560
600
  const statusStr = String(status);
561
601
  switch (statusStr) {
@@ -18,7 +18,7 @@ import { generatePreCommitHook, generatePostCommitHook, generateSessionManager,
18
18
  import { getInstalledCliVersion, HELPERS_STAMP_FILE } from './helper-refresh.js';
19
19
  import { generateClaudeMd } from './claudemd-generator.js';
20
20
  import { recordMemoryPackagePath } from './memory-package-resolver.js';
21
- import { ensureCommonJsCompanions } from './helper-companions.js';
21
+ import { COMMONJS_COMPANION_HELPERS, ensureCommonJsCompanions } from './helper-companions.js';
22
22
  import { scanSettingsForRisk, formatRiskFindingsAsWarnings } from './settings-risk-scanner.js';
23
23
  import { AUTO_MEMORY_HOOK_TIMEOUT_S, helperHookCommand, helperScopeFor, helperStatusLineCommand, pinToUserHelpers } from './helper-commands.js';
24
24
  /**
@@ -548,10 +548,14 @@ export async function executeUpgrade(targetDir, upgradeSettings = false) {
548
548
  catch { }
549
549
  }
550
550
  }
551
- // #3555: the refreshed hook-handler requires the .cjs companions; older
552
- // installs only have session.js / memory.js, which can't load in ESM.
553
- for (const name of await ensureCommonJsCompanions(path.join(targetDir, '.claude', 'helpers'))) {
554
- result.created.push(`.claude/helpers/${name}`);
551
+ // #4198: refresh existing companions too, so upgraded hook handlers never
552
+ // keep obsolete session/memory logic. Generate from the CLI trust root.
553
+ const helpersDir = path.join(targetDir, '.claude', 'helpers');
554
+ const existingCompanions = new Set(COMMONJS_COMPANION_HELPERS.filter((name) => fs.existsSync(path.join(helpersDir, name))));
555
+ for (const name of await ensureCommonJsCompanions(helpersDir, true)) {
556
+ const changes = existingCompanions.has(name)
557
+ ? result.updated : result.created;
558
+ changes.push(`.claude/helpers/${name}`);
555
559
  }
556
560
  // Stamp the installed version so the startup auto-refresh treats these as
557
561
  // current (no redundant re-copy on the next command).
@@ -1,3 +1,3 @@
1
1
  export declare const COMMONJS_COMPANION_HELPERS: readonly ["session.cjs", "memory.cjs"];
2
- export declare function ensureCommonJsCompanions(helpersDir: string): Promise<string[]>;
2
+ export declare function ensureCommonJsCompanions(helpersDir: string, force?: boolean): Promise<string[]>;
3
3
  //# sourceMappingURL=helper-companions.d.ts.map
@@ -7,13 +7,14 @@
7
7
  * `.js` copies, which the refreshed hook-handler no longer requires, so the
8
8
  * refresh writes any missing `.cjs` companion from the CLI's own compiled
9
9
  * generators (the trust root; no external file to verify). Stale `.js` copies
10
- * are left in place and ignored. Existing `.cjs` files are never overwritten.
10
+ * are left in place and ignored. Existing `.cjs` files are preserved during
11
+ * startup refresh; an explicit init upgrade replaces them from the generators.
11
12
  */
12
13
  import * as fs from 'fs';
13
14
  import * as path from 'path';
14
15
  export const COMMONJS_COMPANION_HELPERS = ['session.cjs', 'memory.cjs'];
15
- export async function ensureCommonJsCompanions(helpersDir) {
16
- const missing = COMMONJS_COMPANION_HELPERS.filter((name) => !fs.existsSync(path.join(helpersDir, name)));
16
+ export async function ensureCommonJsCompanions(helpersDir, force = false) {
17
+ const missing = COMMONJS_COMPANION_HELPERS.filter((name) => force || !fs.existsSync(path.join(helpersDir, name)));
17
18
  if (missing.length === 0)
18
19
  return [];
19
20
  const gen = await import('./helpers-generator.js');
@@ -4175,12 +4175,12 @@ export const hooksIntelligenceLearn = {
4175
4175
  // Intelligence attention hook
4176
4176
  export const hooksIntelligenceAttention = {
4177
4177
  name: 'hooks_intelligence_attention',
4178
- description: 'Compute attention-weighted similarity using MoE/Flash/Hyperbolic Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
4178
+ description: 'Compute attention-weighted similarity using MoE/Flash. Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
4179
4179
  inputSchema: {
4180
4180
  type: 'object',
4181
4181
  properties: {
4182
4182
  query: { type: 'string', description: 'Query for attention computation' },
4183
- mode: { type: 'string', description: 'Attention mode (flash, moe, hyperbolic)' },
4183
+ mode: { type: 'string', description: 'Attention mode (flash, moe)' },
4184
4184
  topK: { type: 'number', description: 'Top-k results' },
4185
4185
  },
4186
4186
  required: ['query'],
@@ -4195,6 +4195,12 @@ export const hooksIntelligenceAttention = {
4195
4195
  if (!v.valid)
4196
4196
  return { success: false, error: v.error };
4197
4197
  }
4198
+ // #3548: only flash and moe have an implementation. Any other mode
4199
+ // (including the previously advertised 'hyperbolic') used to return an
4200
+ // empty stub whose note blamed a missing package; say so instead.
4201
+ if (mode !== 'flash' && mode !== 'moe') {
4202
+ return { success: false, error: `Attention mode "${mode}" is not implemented; supported modes: flash, moe` };
4203
+ }
4198
4204
  let implementation = 'placeholder';
4199
4205
  let embeddingSource = 'none';
4200
4206
  const results = [];
@@ -4370,7 +4376,7 @@ export const hooksIntelligenceAttention = {
4370
4376
  implementation,
4371
4377
  _embeddingSource: embeddingSource,
4372
4378
  _stub: implementation === 'none',
4373
- _note: implementation === 'none' ? 'No attention backend available. Install @ruvector/attention for real computation.' : undefined,
4379
+ _note: implementation === 'none' ? 'No attention backend available: flash/moe attention from @claude-flow/neural could not be loaded or failed.' : undefined,
4374
4380
  ...(embeddingSource === 'hash-fallback' && implementation !== 'none'
4375
4381
  ? { _embeddingNote: 'Query embeddings are hash-based (not semantic). Install @claude-flow/embeddings for real ONNX embeddings.' }
4376
4382
  : {}),
@@ -227,15 +227,31 @@ function loadLegacyStore() {
227
227
  /**
228
228
  * Mark migration as complete
229
229
  */
230
- function markMigrationComplete() {
230
+ function markMigrationComplete(counts) {
231
231
  const legacyDir = resolve(LEGACY_MEMORY_DIR);
232
232
  if (!existsSync(legacyDir))
233
233
  mkdirSync(legacyDir, { recursive: true });
234
234
  writeFileSync(resolve(join(LEGACY_MEMORY_DIR, MIGRATION_MARKER)), JSON.stringify({
235
235
  migratedAt: new Date().toISOString(),
236
236
  version: '3.0.0',
237
+ ...(counts ?? {}),
237
238
  }), 'utf-8');
238
239
  }
240
+ /**
241
+ * Counts recorded by the migration that wrote the marker, or null when no
242
+ * marker (or an older marker without counts) is present.
243
+ */
244
+ function readMigrationCounts() {
245
+ try {
246
+ const marker = JSON.parse(readFileSync(resolve(join(LEGACY_MEMORY_DIR, MIGRATION_MARKER)), 'utf-8'));
247
+ return typeof marker?.migrated === 'number' && typeof marker?.total === 'number'
248
+ ? { migrated: marker.migrated, total: marker.total }
249
+ : null;
250
+ }
251
+ catch {
252
+ return null;
253
+ }
254
+ }
239
255
  /**
240
256
  * Lazy-load memory initializer functions to avoid circular deps
241
257
  */
@@ -391,7 +407,7 @@ async function ensureInitialized(dbPath) {
391
407
  }
392
408
  }
393
409
  console.error(`[MCP Memory] Migrated ${migrated}/${Object.keys(legacyStore.entries).length} entries`);
394
- markMigrationComplete();
410
+ markMigrationComplete({ migrated, total: Object.keys(legacyStore.entries).length });
395
411
  }
396
412
  }
397
413
  }
@@ -636,7 +652,11 @@ export const memoryTools = [
636
652
  });
637
653
  return {
638
654
  results: r.results.map(e => ({
639
- id: e.id,
655
+ // #2271: searchEntries() truncates ids to 12 chars ("entry_" +
656
+ // the leading digits of Date.now()), so entries written within
657
+ // ~2.8h share one id and RRF fused them into a single result.
658
+ // SmartRetrieval dedupes on id: give it the (namespace, key) tuple.
659
+ id: JSON.stringify([e.namespace, e.key]),
640
660
  key: e.key,
641
661
  content: e.content,
642
662
  score: e.score,
@@ -966,11 +986,17 @@ export const memoryTools = [
966
986
  },
967
987
  handler: async (input) => {
968
988
  const force = input.force;
969
- // Remove migration marker if forcing
989
+ // Remove the migration marker if forcing. hasLegacyStore() checks the marker
990
+ // beside the legacy store, so that is the one force must clear (#4194);
991
+ // the old .swarm marker path is cleared too for compatibility.
970
992
  if (force) {
971
- const markerPath = getMigrationMarkerPath();
972
- if (existsSync(markerPath)) {
973
- unlinkSync(markerPath);
993
+ for (const markerPath of [
994
+ resolve(join(LEGACY_MEMORY_DIR, MIGRATION_MARKER)),
995
+ getMigrationMarkerPath(),
996
+ ]) {
997
+ if (existsSync(markerPath)) {
998
+ unlinkSync(markerPath);
999
+ }
974
1000
  }
975
1001
  }
976
1002
  // Check for legacy data
@@ -982,12 +1008,35 @@ export const memoryTools = [
982
1008
  migrated: 0,
983
1009
  };
984
1010
  }
1011
+ // A marker beside the store means a migration already ran; ensureInitialized
1012
+ // would move nothing, so say so instead of reporting the store's size.
1013
+ if (!hasLegacyStore()) {
1014
+ return {
1015
+ success: true,
1016
+ message: 'Legacy store already migrated (marker present); nothing was moved. Pass force: true to re-run.',
1017
+ migrated: 0,
1018
+ total: Object.keys(legacyStore.entries).length,
1019
+ };
1020
+ }
985
1021
  // Run migration via ensureInitialized
986
1022
  await ensureInitialized();
1023
+ // ensureInitialized swallows errors and records what it moved in the marker.
1024
+ const counts = readMigrationCounts();
1025
+ if (!counts) {
1026
+ return {
1027
+ success: false,
1028
+ message: 'Migration did not complete; no entries were recorded as migrated. See the MCP server log.',
1029
+ migrated: 0,
1030
+ total: Object.keys(legacyStore.entries).length,
1031
+ };
1032
+ }
987
1033
  return {
988
1034
  success: true,
989
- message: 'Migration completed',
990
- migrated: Object.keys(legacyStore.entries).length,
1035
+ message: counts.migrated === counts.total
1036
+ ? 'Migration completed'
1037
+ : `Migration completed with failures: ${counts.migrated} of ${counts.total} entries migrated`,
1038
+ migrated: counts.migrated,
1039
+ total: counts.total,
991
1040
  backend: await describeBackend(),
992
1041
  };
993
1042
  },
@@ -577,7 +577,8 @@ export const workflowTools = [
577
577
  const store = loadWorkflowStore();
578
578
  let workflows = Object.values(store.workflows);
579
579
  // Apply filters
580
- if (input.status) {
580
+ // 'all' is the CLI's explicit "no filter" value (`workflow list` sends it by default).
581
+ if (input.status && input.status !== 'all') {
581
582
  workflows = workflows.filter(w => w.status === input.status);
582
583
  }
583
584
  // Sort by creation date (newest first)
@@ -30,10 +30,12 @@
30
30
  * @module v3/cli/memory/graph-edge-writer
31
31
  */
32
32
  /**
33
- * True iff the memory.db bridge at `customDbPath` (or the default location)
34
- * is currently RFE1-encrypted-at-rest. Callers that receive `null` from
35
- * getBridgeDb()/insertGraphEdge() can use this to avoid recommending the
36
- * destructive `memory init` command for this specific, non-corrupt case.
33
+ * True iff the memory.db bridge at `customDbPath` — or, when omitted, the
34
+ * path `resolveDbPath()` resolves from the `CLAUDE_FLOW_DB_PATH` env binding
35
+ * / memory root default (#4291) — is currently RFE1-encrypted-at-rest.
36
+ * Callers that receive `null` from getBridgeDb()/insertGraphEdge() can use
37
+ * this to avoid recommending the destructive `memory init` command for this
38
+ * specific, non-corrupt case.
37
39
  */
38
40
  export declare function isBridgeDbEncryptedAtRest(customDbPath?: string): boolean;
39
41
  /** Test-only: clear the once-per-path warning dedup set. */
@@ -60,6 +62,16 @@ export declare function releaseBridgeDb(dbPath?: string): boolean;
60
62
  * #2431 fix: better-sqlite3 + WAL mode replaces sql.js + whole-file
61
63
  * writeFileSync. Eliminates the dual-write race that corrupted memory.db
62
64
  * when called alongside the memory bridge's better-sqlite3 writer.
65
+ *
66
+ * #4291 fix: the file is resolved via `resolveDbPath()` — the project's one
67
+ * documented path-priority rule (explicit `customDbPath` argument wins, then
68
+ * the `CLAUDE_FLOW_DB_PATH` env binding, then the plain `memory.db` default
69
+ * under the memory root) — instead of a local `customDbPath ?? <default>`
70
+ * expression that silently ignored `CLAUDE_FLOW_DB_PATH`. A caller that
71
+ * explicitly selected a store via that env var no longer gets answers read
72
+ * from a different, unselected database file. When the resolved file is
73
+ * missing (and `createIfMissing` is false) or encrypted at rest, this
74
+ * refuses (returns null) rather than falling back to any other store.
63
75
  */
64
76
  export declare function getBridgeDb(customDbPath?: string, opts?: {
65
77
  createIfMissing?: boolean;
@@ -33,7 +33,7 @@ import * as path from 'path';
33
33
  import * as fs from 'fs';
34
34
  import * as crypto from 'crypto';
35
35
  import { execFileSync } from 'child_process';
36
- import { getMemoryRoot } from './memory-initializer.js';
36
+ import { resolveDbPath } from './memory-initializer.js';
37
37
  import { encodeEmbedding } from './embedding-quantization.js';
38
38
  import { loadBetterSqlite3 } from './shared-sqlite.js';
39
39
  import { isEncryptedBlob } from '../encryption/vault.js';
@@ -125,13 +125,15 @@ function warnRfe1EncryptedOnce(dbPath) {
125
125
  'See #2889 (https://github.com/ruvnet/ruflo/issues/2889) for details and recovery options.');
126
126
  }
127
127
  /**
128
- * True iff the memory.db bridge at `customDbPath` (or the default location)
129
- * is currently RFE1-encrypted-at-rest. Callers that receive `null` from
130
- * getBridgeDb()/insertGraphEdge() can use this to avoid recommending the
131
- * destructive `memory init` command for this specific, non-corrupt case.
128
+ * True iff the memory.db bridge at `customDbPath` — or, when omitted, the
129
+ * path `resolveDbPath()` resolves from the `CLAUDE_FLOW_DB_PATH` env binding
130
+ * / memory root default (#4291) — is currently RFE1-encrypted-at-rest.
131
+ * Callers that receive `null` from getBridgeDb()/insertGraphEdge() can use
132
+ * this to avoid recommending the destructive `memory init` command for this
133
+ * specific, non-corrupt case.
132
134
  */
133
135
  export function isBridgeDbEncryptedAtRest(customDbPath) {
134
- const dbPath = customDbPath ?? path.join(getMemoryRoot(), 'memory.db');
136
+ const dbPath = resolveDbPath(customDbPath);
135
137
  return fs.existsSync(dbPath) && isRfe1EncryptedAtRest(dbPath);
136
138
  }
137
139
  /** Test-only: clear the once-per-path warning dedup set. */
@@ -222,9 +224,19 @@ export function releaseBridgeDb(dbPath) {
222
224
  * #2431 fix: better-sqlite3 + WAL mode replaces sql.js + whole-file
223
225
  * writeFileSync. Eliminates the dual-write race that corrupted memory.db
224
226
  * when called alongside the memory bridge's better-sqlite3 writer.
227
+ *
228
+ * #4291 fix: the file is resolved via `resolveDbPath()` — the project's one
229
+ * documented path-priority rule (explicit `customDbPath` argument wins, then
230
+ * the `CLAUDE_FLOW_DB_PATH` env binding, then the plain `memory.db` default
231
+ * under the memory root) — instead of a local `customDbPath ?? <default>`
232
+ * expression that silently ignored `CLAUDE_FLOW_DB_PATH`. A caller that
233
+ * explicitly selected a store via that env var no longer gets answers read
234
+ * from a different, unselected database file. When the resolved file is
235
+ * missing (and `createIfMissing` is false) or encrypted at rest, this
236
+ * refuses (returns null) rather than falling back to any other store.
225
237
  */
226
238
  export async function getBridgeDb(customDbPath, opts) {
227
- const dbPath = customDbPath ?? path.join(getMemoryRoot(), 'memory.db');
239
+ const dbPath = resolveDbPath(customDbPath);
228
240
  const createIfMissing = opts?.createIfMissing === true;
229
241
  if (_db && _dbPath === dbPath) {
230
242
  armIdleRelease();
@@ -1077,6 +1077,10 @@ export async function recordTrajectory(steps, verdict) {
1077
1077
  }
1078
1078
  bumpStat('trajectoriesRecorded');
1079
1079
  globalStats.lastAdaptation = Date.now();
1080
+ // #4283: the bank's own save is debounced, and the one-shot bins exit as
1081
+ // soon as the command resolves, so write the patterns now. Otherwise
1082
+ // stats.json counts patterns that never reach patterns.json.
1083
+ reasoningBank?.flushToDisk();
1080
1084
  savePersistedStats();
1081
1085
  return true;
1082
1086
  }
@@ -2131,15 +2131,19 @@ async function loadLocalEmbeddingChain(verbose = false, startTime = Date.now())
2131
2131
  if (verbose) {
2132
2132
  console.log('Loading agentic-flow ReasoningBank embedding model...');
2133
2133
  }
2134
+ // #3113: register a callable, like the ruvector branch below —
2135
+ // generateLocalEmbedding() only invokes function models. The bundled
2136
+ // model is all-MiniLM-L6-v2 (384-dim, per agentic-flow's
2137
+ // getEmbeddingDimensions()).
2134
2138
  embeddingModelState = {
2135
2139
  loaded: true,
2136
- model: { embed: reasoningBank.computeEmbedding },
2140
+ model: (text) => reasoningBank.computeEmbedding(text),
2137
2141
  tokenizer: null,
2138
- dimensions: 768
2142
+ dimensions: 384
2139
2143
  };
2140
2144
  return {
2141
2145
  success: true,
2142
- dimensions: 768,
2146
+ dimensions: 384,
2143
2147
  modelName: 'agentic-flow/reasoningbank',
2144
2148
  loadTime: Date.now() - startTime
2145
2149
  };
@@ -2272,10 +2276,13 @@ export async function generateLocalEmbedding(text) {
2272
2276
  if (state.model && typeof state.model === 'function') {
2273
2277
  try {
2274
2278
  const output = await state.model(text, { pooling: 'mean', normalize: true });
2275
- // Handle both @xenova/transformers (output.data) and ruvector (plain array) formats
2279
+ // Handle @xenova/transformers (output.data), ruvector (plain array) and
2280
+ // typed-array (ReasoningBank Float32Array, #3114) formats. DataView is an
2281
+ // ArrayBuffer view without an iterator (Array.from gives []), so exclude it.
2276
2282
  const embedding = output?.data
2277
2283
  ? Array.from(output.data)
2278
- : Array.isArray(output) ? output : null;
2284
+ : Array.isArray(output) ? output
2285
+ : ArrayBuffer.isView(output) && !(output instanceof DataView) ? Array.from(output) : null;
2279
2286
  if (embedding) {
2280
2287
  return {
2281
2288
  embedding,
@@ -10,7 +10,12 @@ export interface BackupOptions {
10
10
  /** Injected epoch millis (tests pass a fixed value; avoids Date.now in logic). */
11
11
  timestamp?: number;
12
12
  verbose?: boolean;
13
+ /** Test seam: inject a fake better-sqlite3-shaped constructor instead of importing the real module. */
14
+ Database?: new (path: string, opts?: Record<string, unknown>) => any;
13
15
  }
16
+ /** Which method actually produced the snapshot — downstream migration tooling
17
+ * should require `native-online-backup` rather than trusting a blanket `backedUp: true`. */
18
+ export type BackupMethod = 'native-online-backup' | 'raw-copy-fallback';
14
19
  export interface BackupResult {
15
20
  backedUp: boolean;
16
21
  path?: string;
@@ -18,6 +23,7 @@ export interface BackupResult {
18
23
  rotatedAway?: string[];
19
24
  gcsUri?: string;
20
25
  skipped?: string;
26
+ method?: BackupMethod;
21
27
  }
22
28
  export declare function defaultMemoryDbPath(cwd?: string): string;
23
29
  export interface ProjectBackupResult extends BackupResult {
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import * as fs from 'fs';
16
16
  import * as path from 'path';
17
- import { readFileMaybeEncrypted } from '../fs-secure.js';
17
+ import { existingFileIsEncrypted, readFileMaybeEncrypted } from '../fs-secure.js';
18
18
  import { loadBetterSqlite3 } from '../memory/shared-sqlite.js';
19
19
  import { resolveMemoryRoot } from '../memory/memory-root.js';
20
20
  export function defaultMemoryDbPath(cwd = process.cwd()) {
@@ -37,12 +37,18 @@ export async function backupProjectMemoryDbs(cwd, opts = {}) {
37
37
  }
38
38
  const successful = backups.filter(result => result.backedUp);
39
39
  const failed = backups.find(result => !result.backedUp && result.skipped !== 'no-db');
40
+ // Only report an aggregate `method` when every successful store agrees — a
41
+ // mixed native/raw-copy result must not collapse to whichever store
42
+ // happened to be first, the exact false-confidence #4287 is about.
43
+ const methods = new Set(successful.map(result => result.method));
44
+ const aggregateMethod = methods.size === 1 ? successful[0]?.method : undefined;
40
45
  return {
41
46
  ...successful[0],
42
47
  backedUp: successful.length > 0 && !failed,
43
48
  sizeBytes: successful.reduce((sum, result) => sum + (result.sizeBytes ?? 0), 0),
44
49
  rotatedAway: successful.flatMap(result => result.rotatedAway ?? []),
45
50
  skipped: failed?.skipped ?? (successful.length === 0 ? 'no-db' : undefined),
51
+ method: aggregateMethod,
46
52
  backups,
47
53
  };
48
54
  }
@@ -63,88 +69,25 @@ function isSnapshotFor(file, dbPath) {
63
69
  return file.startsWith(prefix)
64
70
  && /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z\.db$/.test(file.slice(prefix.length));
65
71
  }
66
- export async function backupMemoryDb(opts = {}) {
67
- const dbPath = opts.dbPath ?? defaultMemoryDbPath();
68
- if (!dbPath || !fs.existsSync(dbPath))
69
- return { backedUp: false, skipped: 'no-db' };
70
- let Database;
72
+ /**
73
+ * A plain file copy of a live WAL-mode SQLite database is not a consistent
74
+ * snapshot — committed data can live only in the `-wal` sidecar until it's
75
+ * checkpointed back into the main file. We can't open an RFE1-encrypted
76
+ * source natively to run a real `wal_checkpoint` probe (it isn't a SQLite
77
+ * image), so for the raw-copy-fallback path the only signal available is
78
+ * sidecar presence: a non-empty `-wal` file means there are frames that a
79
+ * copy of the main file alone would silently drop. Fail closed on that.
80
+ */
81
+ function hasActiveWal(dbPath) {
71
82
  try {
72
- const mod = 'better-sqlite3';
73
- Database = (await import(mod)).default;
83
+ return fs.statSync(`${dbPath}-wal`).size > 0;
74
84
  }
75
85
  catch {
76
- return { backedUp: false, skipped: 'better-sqlite3 unavailable' };
86
+ return false;
77
87
  }
78
- const destDir = opts.destDir ?? path.join(path.dirname(dbPath), 'backups');
79
- try {
80
- fs.mkdirSync(destDir, { recursive: true });
81
- }
82
- catch { /* */ }
83
- const destPath = path.join(destDir, `${snapshotPrefix(dbPath)}${fileStamp(opts.timestamp ?? Date.now())}.db`);
84
- // WAL-safe online backup: read-only source, consistent snapshot to destPath.
85
- let db;
86
- try {
87
- db = new Database(dbPath, { readonly: true });
88
- await db.backup(destPath);
89
- db.close();
90
- }
91
- catch (e) {
92
- try {
93
- db?.close();
94
- }
95
- catch { /* */ }
96
- // #2798 — under CLAUDE_FLOW_ENCRYPT_AT_REST the source is an RFE1
97
- // blob, not native SQLite, so better-sqlite3's online-backup API
98
- // throws "file is not a database" and the run was silently recorded
99
- // as skipped (users with encryption had ZERO backups behind a green
100
- // status). The online-backup API only exists to avoid tearing a live
101
- // WAL-mode DB; that concern doesn't apply to the encrypted file (sql.js
102
- // rewrites it wholesale per flush), so a plain byte copy is a valid
103
- // snapshot. Fall back to it before giving up.
104
- try {
105
- fs.copyFileSync(dbPath, destPath);
106
- const copiedBytes = fs.statSync(destPath).size;
107
- if (copiedBytes > 0) {
108
- // Fall through to rotation/offsite/return below via a flag path.
109
- // (Mirror the success path's tail by re-using the same code.)
110
- const keep = typeof opts.keep === 'number' && opts.keep > 0 ? opts.keep : 7;
111
- const rotatedAway = [];
112
- try {
113
- const snaps = fs.readdirSync(destDir).filter(f => isSnapshotFor(f, dbPath)).sort();
114
- while (snaps.length > keep) {
115
- const old = snaps.shift();
116
- try {
117
- fs.rmSync(path.join(destDir, old), { force: true });
118
- rotatedAway.push(old);
119
- }
120
- catch { /* */ }
121
- }
122
- }
123
- catch { /* */ }
124
- let gcsUri;
125
- if (opts.gcs) {
126
- try {
127
- const { execFileSync } = await import('child_process');
128
- const dest = opts.gcs.replace(/\/+$/, '') + '/' + path.basename(destPath);
129
- execFileSync('gcloud', ['storage', 'cp', destPath, dest], { stdio: ['ignore', 'ignore', 'inherit'] });
130
- gcsUri = dest;
131
- }
132
- catch { /* offsite failed — local snapshot stands */ }
133
- }
134
- if (opts.verbose) {
135
- console.log(`memory DB backed up (byte-copy, encrypted-at-rest) → ${destPath} (${Math.round(copiedBytes / 1024)} KB)`);
136
- }
137
- return { backedUp: true, path: destPath, sizeBytes: copiedBytes, rotatedAway, gcsUri };
138
- }
139
- }
140
- catch { /* byte-copy also failed — report the original error */ }
141
- return { backedUp: false, skipped: `backup failed: ${e?.message ?? e}` };
142
- }
143
- let sizeBytes = 0;
144
- try {
145
- sizeBytes = fs.statSync(destPath).size;
146
- }
147
- catch { /* */ }
88
+ }
89
+ /** Shared tail: rotation + optional GCS offsite + verbose logging + the success receipt. */
90
+ async function finishBackup(destPath, dbPath, destDir, opts, method, sizeBytes) {
148
91
  // Rotation — ISO-stamped names sort chronologically, so keep the tail.
149
92
  const keep = typeof opts.keep === 'number' && opts.keep > 0 ? opts.keep : 7;
150
93
  const rotatedAway = [];
@@ -172,11 +115,96 @@ export async function backupMemoryDb(opts = {}) {
172
115
  catch { /* offsite failed — local snapshot stands */ }
173
116
  }
174
117
  if (opts.verbose) {
175
- console.log(`memory DB backed up → ${destPath} (${Math.round(sizeBytes / 1024)} KB)` +
118
+ const label = method === 'raw-copy-fallback' ? ' (byte-copy, encrypted-at-rest)' : '';
119
+ console.log(`memory DB backed up${label} → ${destPath} (${Math.round(sizeBytes / 1024)} KB)` +
176
120
  (rotatedAway.length ? `, rotated ${rotatedAway.length} old` : '') +
177
121
  (gcsUri ? `, offsite ${gcsUri}` : ''));
178
122
  }
179
- return { backedUp: true, path: destPath, sizeBytes, rotatedAway, gcsUri };
123
+ return { backedUp: true, path: destPath, sizeBytes, rotatedAway, gcsUri, method };
124
+ }
125
+ export async function backupMemoryDb(opts = {}) {
126
+ const dbPath = opts.dbPath ?? defaultMemoryDbPath();
127
+ if (!dbPath || !fs.existsSync(dbPath))
128
+ return { backedUp: false, skipped: 'no-db' };
129
+ const destDir = opts.destDir ?? path.join(path.dirname(dbPath), 'backups');
130
+ try {
131
+ fs.mkdirSync(destDir, { recursive: true });
132
+ }
133
+ catch { /* */ }
134
+ const destPath = path.join(destDir, `${snapshotPrefix(dbPath)}${fileStamp(opts.timestamp ?? Date.now())}.db`);
135
+ let Database = opts.Database;
136
+ let nativeError = null;
137
+ if (!Database) {
138
+ try {
139
+ const mod = 'better-sqlite3';
140
+ Database = (await import(mod)).default;
141
+ }
142
+ catch {
143
+ nativeError = 'better-sqlite3 unavailable';
144
+ }
145
+ }
146
+ if (!nativeError) {
147
+ // WAL-safe online backup: read-only source, consistent snapshot to destPath.
148
+ let db;
149
+ try {
150
+ db = new Database(dbPath, { readonly: true });
151
+ await db.backup(destPath);
152
+ db.close();
153
+ let sizeBytes = 0;
154
+ try {
155
+ sizeBytes = fs.statSync(destPath).size;
156
+ }
157
+ catch { /* */ }
158
+ return await finishBackup(destPath, dbPath, destDir, opts, 'native-online-backup', sizeBytes);
159
+ }
160
+ catch (e) {
161
+ try {
162
+ db?.close();
163
+ }
164
+ catch { /* */ }
165
+ try {
166
+ fs.rmSync(destPath, { force: true });
167
+ }
168
+ catch { /* a native backup() that throws mid-write can leave a torn destPath */ }
169
+ nativeError = e?.message ?? String(e);
170
+ }
171
+ }
172
+ // #2798 — under CLAUDE_FLOW_ENCRYPT_AT_REST the source is an RFE1 blob, not
173
+ // native SQLite, so better-sqlite3's online-backup API throws "file is not
174
+ // a database" (or isn't even importable on a WASM-only host). The
175
+ // online-backup API exists to avoid tearing a live WAL-mode DB; that
176
+ // concern doesn't apply to the encrypted file (sql.js rewrites it wholesale
177
+ // per flush), so a plain byte copy IS a valid snapshot there.
178
+ //
179
+ // But this fallback must never fire for an ORDINARY (non-encrypted) source
180
+ // just because the native backup threw — SQLITE_BUSY, a disk error, or any
181
+ // other native-backup failure on a perfectly normal database must fail
182
+ // closed, not silently report `backedUp: true` off a raw copy. Positively
183
+ // verify encryption (4-byte RFE1 magic sniff) before ever taking this path;
184
+ // "the native backup threw" is never by itself evidence the source is
185
+ // encrypted.
186
+ if (existingFileIsEncrypted(dbPath) !== true) {
187
+ return { backedUp: false, skipped: `native backup failed: ${nativeError}` };
188
+ }
189
+ // Even for a confirmed-encrypted source, refuse the raw-copy fallback if
190
+ // there's an active WAL — a plain copy of the main file alone would miss
191
+ // uncommitted WAL frames and silently produce an inconsistent snapshot.
192
+ if (hasActiveWal(dbPath)) {
193
+ return { backedUp: false, skipped: 'active WAL present — refusing raw-copy fallback (would be inconsistent)' };
194
+ }
195
+ try {
196
+ fs.copyFileSync(dbPath, destPath);
197
+ const copiedBytes = fs.statSync(destPath).size;
198
+ if (copiedBytes > 0) {
199
+ return await finishBackup(destPath, dbPath, destDir, opts, 'raw-copy-fallback', copiedBytes);
200
+ }
201
+ }
202
+ catch { /* byte-copy also failed — report the original native error below */ }
203
+ try {
204
+ fs.rmSync(destPath, { force: true });
205
+ }
206
+ catch { /* */ }
207
+ return { backedUp: false, skipped: `native backup failed: ${nativeError}` };
180
208
  }
181
209
  /** Verify a snapshot without modifying it, including RFE1 images and WASM-only hosts. */
182
210
  async function verifiedBackupRows(file, Database) {
@@ -32,6 +32,8 @@ export type AnchorAssessment = {
32
32
  };
33
33
  export type AnchorWriter = (file: string, value: unknown) => Promise<void>;
34
34
  export type StreamingAnchorWriter = (file: string, value: AtomicJsonSource) => Promise<void>;
35
+ export declare const ANCHOR_LOG_FILE = "ledger-anchors.json";
36
+ export declare const ANCHOR_MIRROR_FILE = "ledger-anchor-head.json";
35
37
  export declare const anchorLogPath: (projectRoot: string) => string;
36
38
  /**
37
39
  * Directory holding per-project trust material (anchor mirror, HMAC key).
@@ -33,9 +33,9 @@ import { closeSync, constants as fsConstants, fstatSync, existsSync, mkdtempSync
33
33
  import { isAbsolute, join, resolve } from 'node:path';
34
34
  import { homedir, tmpdir, userInfo } from 'node:os';
35
35
  import { AgenticPolicyEngine, canonicalizePolicy } from '@claude-flow/security/policy/index';
36
- const LOG_FILE = 'ledger-anchors.json';
37
- const MIRROR_FILE = 'ledger-anchor-head.json';
38
- export const anchorLogPath = (projectRoot) => join(resolve(projectRoot), '.claude-flow', 'policy', LOG_FILE);
36
+ export const ANCHOR_LOG_FILE = 'ledger-anchors.json';
37
+ export const ANCHOR_MIRROR_FILE = 'ledger-anchor-head.json';
38
+ export const anchorLogPath = (projectRoot) => join(resolve(projectRoot), '.claude-flow', 'policy', ANCHOR_LOG_FILE);
39
39
  /**
40
40
  * The home directory trust material lives under: $HOME when it is an absolute path, else the account's home. An empty or relative
41
41
  * $HOME (an unset variable in a wrapper script, `HOME=. cmd`) would make join() yield a path relative to the working directory and
@@ -71,7 +71,7 @@ export function policyTrustRoot() {
71
71
  }
72
72
  function mirrorPath(projectRoot) {
73
73
  const id = createHash('sha256').update(realpathSync(projectRoot)).digest('hex');
74
- return join(policyTrustRoot(), id, MIRROR_FILE);
74
+ return join(policyTrustRoot(), id, ANCHOR_MIRROR_FILE);
75
75
  }
76
76
  // Duplicated from policy-runtime.ts's RECEIPT_ARCHIVE_FILE rather than
77
77
  // imported, to avoid a circular dependency (policy-runtime.ts imports this
@@ -7,17 +7,18 @@ import { AgenticPolicyEngine, POLICY_STATE_VERSION, createLegacyCompatibleState,
7
7
  import { isMcpCallerAuthEnabled, decodeTokenEnvelope, publicKeyFromHex, verifyInvocationToken, } from '@claude-flow/security/mcp-caller-identity';
8
8
  import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto';
9
9
  import { execFileSync } from 'node:child_process';
10
- import { closeSync, constants as fsConstants, existsSync, fstatSync, fsyncSync, ftruncateSync, writeSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readlinkSync, realpathSync, renameSync, unlinkSync, writeFileSync, } from 'node:fs';
10
+ import { closeSync, constants as fsConstants, existsSync, fstatSync, fsyncSync, ftruncateSync, writeSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, renameSync, unlinkSync, writeFileSync, } from 'node:fs';
11
11
  import { dirname, join, resolve } from 'node:path';
12
12
  import { hostname, userInfo } from 'node:os';
13
13
  import { syncPolicyProjection } from '../mods/policy-projection.js';
14
14
  import { ATOMIC_JSON_WRITER } from './policy-anchor-log.js';
15
15
  import { captureArchiveSnapshot, verifyFullPolicyLedger } from './policy-ledger-audit.js';
16
- import { assessAnchors, policyTrustRoot, recordAnchor } from './policy-ledger-anchor.js';
16
+ import { ANCHOR_LOG_FILE, ANCHOR_MIRROR_FILE, assessAnchors, policyTrustRoot, recordAnchor } from './policy-ledger-anchor.js';
17
17
  const POLICY_DIR = join('.claude-flow', 'policy');
18
18
  const POLICY_FILE = 'state.json';
19
19
  const LOCK_FILE = 'state.lock';
20
20
  const RECEIPT_ARCHIVE_FILE = 'receipts.ledger.jsonl';
21
+ const STATE_ANCHOR_FILE = 'state.anchor.json';
21
22
  const LOCK_WAIT_MS = 5_000;
22
23
  // #3164: without a bound, `state.receipts` grows forever and every
23
24
  // transaction's verify/clone/serialize cost is O(all receipts ever issued) —
@@ -362,11 +363,59 @@ async function writeJsonAtomic(file, value) {
362
363
  }
363
364
  }
364
365
  }
366
+ // #3164: a writer killed between creating its temp file and renaming it
367
+ // (SIGKILL from a caller's timeout, OOM) never reaches writeJsonAtomic's
368
+ // cleanup, so a full-size copy of the file stays behind forever (~250 MB each
369
+ // on a mature ledger). Every writer of these files holds the project's
370
+ // state.lock, so while the lock is held no temp file for them can belong to a
371
+ // write in progress. That invariant has known gaps: released versions before
372
+ // the dead-owner fix take over any lock older than 30 s, even a live owner's
373
+ // (a writer suspended mid-write, e.g. a sleeping laptop). So a temp is also
374
+ // kept while its writer pid is alive on this host, and until it is
375
+ // ORPHAN_TEMP_MIN_AGE_MS old; a skipped orphan is removed by a later call.
376
+ const ORPHAN_TEMP_MIN_AGE_MS = 10 * 60_000;
377
+ const ATOMIC_TEMP = /^(.+)\.(\d+)\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.tmp$/;
378
+ const PROJECT_ATOMIC_FILES = new Set([POLICY_FILE, ANCHOR_LOG_FILE]);
379
+ const TRUST_ATOMIC_FILES = new Set([STATE_ANCHOR_FILE, ANCHOR_MIRROR_FILE]);
380
+ function reapOrphanedTemps(dir, files) {
381
+ let names;
382
+ try {
383
+ names = readdirSync(dir);
384
+ }
385
+ catch {
386
+ return;
387
+ }
388
+ const now = Date.now();
389
+ for (const name of names) {
390
+ const match = ATOMIC_TEMP.exec(name);
391
+ if (!match || !files.has(match[1]))
392
+ continue;
393
+ const pid = Number(match[2]);
394
+ if (Number.isSafeInteger(pid) && pid > 0 && isPidAlive(pid))
395
+ continue;
396
+ const file = join(dir, name);
397
+ try {
398
+ const stat = lstatSync(file);
399
+ if (!stat.isFile() || now - stat.mtimeMs < ORPHAN_TEMP_MIN_AGE_MS)
400
+ continue;
401
+ unlinkSync(file);
402
+ }
403
+ catch { /* already gone, or not removable: never fail the caller */ }
404
+ }
405
+ }
406
+ /** Call only while holding the project's state.lock. */
407
+ function reapOrphanedPolicyTemps(projectRoot) {
408
+ reapOrphanedTemps(paths(projectRoot).dir, PROJECT_ATOMIC_FILES);
409
+ try {
410
+ reapOrphanedTemps(dirname(trustPaths(projectRoot).anchor), TRUST_ATOMIC_FILES);
411
+ }
412
+ catch { /* no trust dir yet */ }
413
+ }
365
414
  function trustPaths(projectRoot) {
366
415
  const trustRoot = policyTrustRoot();
367
416
  const projectId = createHash('sha256').update(realpathSync(projectRoot)).digest('hex');
368
417
  const dir = join(trustRoot, projectId);
369
- return { key: join(dir, 'anchor.key'), anchor: join(dir, 'state.anchor.json') };
418
+ return { key: join(dir, 'anchor.key'), anchor: join(dir, STATE_ANCHOR_FILE) };
370
419
  }
371
420
  function trustKey(projectRoot, create) {
372
421
  const { key } = trustPaths(projectRoot);
@@ -531,6 +580,7 @@ export async function withPolicyTransaction(projectRoot, operation, options = {}
531
580
  mkdirDurably(target.dir);
532
581
  const release = await acquireLock(target.lock);
533
582
  try {
583
+ reapOrphanedPolicyTemps(projectRoot);
534
584
  const loaded = loadPolicyState(projectRoot);
535
585
  const engine = AgenticPolicyEngine.fromState(loaded, {
536
586
  signingKey: process.env.CLAUDE_FLOW_POLICY_SIGNING_KEY,
@@ -691,6 +741,7 @@ export async function verifyPolicyLedger(projectRoot = process.cwd(), options =
691
741
  // strings, receipt arrays or maps. The descriptor pins path replacements.
692
742
  const release = await acquireLock(target.lock);
693
743
  try {
744
+ reapOrphanedPolicyTemps(projectRoot);
694
745
  const engine = AgenticPolicyEngine.fromState(loadPolicyState(projectRoot), engineOptions);
695
746
  const outcome = reconcileLedger(projectRoot, engine, options);
696
747
  if (outcome.persist) {
@@ -1699,6 +1699,10 @@ export class WorkerDaemon extends EventEmitter {
1699
1699
  rotatedAway: r.rotatedAway?.length ?? 0,
1700
1700
  gcsUri: r.gcsUri,
1701
1701
  skipped: r.skipped,
1702
+ // Which method actually completed (per-store detail is in `backups`);
1703
+ // migration tooling should require 'native-online-backup', not a
1704
+ // blanket `backedUp: true` — see #4287.
1705
+ method: r.method,
1702
1706
  };
1703
1707
  }
1704
1708
  catch (error) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.57.1",
3
+ "version": "3.57.2",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -48,6 +48,7 @@
48
48
  "import": "./dist/src/index.js"
49
49
  },
50
50
  "./dist/*": "./dist/*",
51
+ "./package.json": "./package.json",
51
52
  "./ruvector": {
52
53
  "types": "./dist/src/ruvector/index.d.ts",
53
54
  "import": "./dist/src/ruvector/index.js"
@@ -98,7 +99,7 @@
98
99
  "vitest": "^4.1.0"
99
100
  },
100
101
  "dependencies": {
101
- "@claude-flow/cli-core": "3.7.4",
102
+ "@claude-flow/cli-core": "3.7.5",
102
103
  "@claude-flow/codex": "3.0.5",
103
104
  "@claude-flow/mcp": "3.1.1",
104
105
  "@claude-flow/neural": "3.0.0",
@@ -125,11 +126,11 @@
125
126
  "ws": "^8.21.0",
126
127
  "yaml": "^2.8.0",
127
128
  "zod": "^3.22.0",
128
- "@claude-flow/memory": "3.0.5"
129
+ "@claude-flow/memory": "3.0.6"
129
130
  },
130
131
  "optionalDependencies": {
131
132
  "@agntcy/slim-bindings": "2.0.0-alpha.5",
132
- "@claude-flow/memory": "3.0.5",
133
+ "@claude-flow/memory": "3.0.6",
133
134
  "@metaharness/darwin": "~0.12.0",
134
135
  "@metaharness/flywheel": "~0.1.10",
135
136
  "@metaharness/radio": "~0.1.0",