@claude-flow/cli 3.37.0 → 3.38.1

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 (154) hide show
  1. package/.claude/agents/github/code-review-swarm.md +1 -1
  2. package/.claude/agents/github/issue-tracker.md +1 -1
  3. package/.claude/agents/github/pr-manager.md +1 -1
  4. package/.claude/agents/github/release-manager.md +2 -2
  5. package/.claude/agents/github/repo-architect.md +2 -2
  6. package/.claude/agents/github/workflow-automation.md +1 -1
  7. package/.claude/agents/optimization/benchmark-suite.md +8 -8
  8. package/.claude/agents/optimization/load-balancer.md +7 -7
  9. package/.claude/agents/optimization/performance-monitor.md +8 -8
  10. package/.claude/agents/optimization/resource-allocator.md +9 -9
  11. package/.claude/agents/optimization/topology-optimizer.md +8 -8
  12. package/.claude/commands/agents/README.md +4 -4
  13. package/.claude/commands/agents/agent-capabilities.md +1 -1
  14. package/.claude/commands/agents/agent-coordination.md +3 -3
  15. package/.claude/commands/agents/agent-types.md +2 -2
  16. package/.claude/commands/agents/health.md +10 -10
  17. package/.claude/commands/agents/list.md +8 -8
  18. package/.claude/commands/agents/logs.md +16 -16
  19. package/.claude/commands/agents/metrics.md +9 -9
  20. package/.claude/commands/agents/pool.md +10 -10
  21. package/.claude/commands/agents/spawn.md +35 -35
  22. package/.claude/commands/agents/status.md +9 -9
  23. package/.claude/commands/agents/stop.md +15 -15
  24. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +1 -1
  25. package/.claude/commands/analysis/bottleneck-detect.md +5 -5
  26. package/.claude/commands/analysis/performance-report.md +4 -4
  27. package/.claude/commands/analysis/token-usage.md +4 -4
  28. package/.claude/commands/automation/auto-agent.md +5 -5
  29. package/.claude/commands/automation/self-healing.md +1 -1
  30. package/.claude/commands/automation/session-memory.md +1 -1
  31. package/.claude/commands/automation/smart-agents.md +1 -1
  32. package/.claude/commands/automation/smart-spawn.md +4 -4
  33. package/.claude/commands/automation/workflow-select.md +4 -4
  34. package/.claude/commands/claude-flow-help.md +1 -1
  35. package/.claude/commands/coordination/agent-spawn.md +4 -4
  36. package/.claude/commands/coordination/swarm-init.md +5 -5
  37. package/.claude/commands/coordination/task-orchestrate.md +4 -4
  38. package/.claude/commands/github/code-review.md +4 -4
  39. package/.claude/commands/github/github-swarm.md +5 -5
  40. package/.claude/commands/github/issue-triage.md +4 -4
  41. package/.claude/commands/github/pr-enhance.md +4 -4
  42. package/.claude/commands/github/release-manager.md +1 -1
  43. package/.claude/commands/github/repo-analyze.md +4 -4
  44. package/.claude/commands/github/repo-architect.md +2 -2
  45. package/.claude/commands/hive-mind/hive-mind-consensus.md +1 -1
  46. package/.claude/commands/hive-mind/hive-mind-init.md +3 -3
  47. package/.claude/commands/hive-mind/hive-mind-memory.md +1 -1
  48. package/.claude/commands/hive-mind/hive-mind-metrics.md +1 -1
  49. package/.claude/commands/hive-mind/hive-mind-resume.md +1 -1
  50. package/.claude/commands/hive-mind/hive-mind-sessions.md +1 -1
  51. package/.claude/commands/hive-mind/hive-mind-spawn.md +4 -4
  52. package/.claude/commands/hive-mind/hive-mind-status.md +1 -1
  53. package/.claude/commands/hive-mind/hive-mind-stop.md +1 -1
  54. package/.claude/commands/hive-mind/hive-mind-wizard.md +1 -1
  55. package/.claude/commands/hive-mind/hive-mind.md +4 -4
  56. package/.claude/commands/hooks/overview.md +1 -1
  57. package/.claude/commands/hooks/post-edit.md +6 -6
  58. package/.claude/commands/hooks/post-task.md +6 -6
  59. package/.claude/commands/hooks/pre-edit.md +6 -6
  60. package/.claude/commands/hooks/pre-task.md +6 -6
  61. package/.claude/commands/hooks/session-end.md +6 -6
  62. package/.claude/commands/hooks/setup.md +6 -6
  63. package/.claude/commands/memory/memory-persist.md +4 -4
  64. package/.claude/commands/memory/memory-search.md +4 -4
  65. package/.claude/commands/memory/memory-usage.md +4 -4
  66. package/.claude/commands/monitoring/agent-metrics.md +4 -4
  67. package/.claude/commands/monitoring/real-time-view.md +4 -4
  68. package/.claude/commands/monitoring/swarm-monitor.md +4 -4
  69. package/.claude/commands/optimization/auto-topology.md +2 -2
  70. package/.claude/commands/optimization/cache-manage.md +4 -4
  71. package/.claude/commands/optimization/parallel-execute.md +4 -4
  72. package/.claude/commands/optimization/parallel-execution.md +1 -1
  73. package/.claude/commands/optimization/topology-optimize.md +4 -4
  74. package/.claude/commands/sparc/analyzer.md +1 -1
  75. package/.claude/commands/sparc/architect.md +1 -1
  76. package/.claude/commands/sparc/ask.md +5 -5
  77. package/.claude/commands/sparc/batch-executor.md +1 -1
  78. package/.claude/commands/sparc/code.md +5 -5
  79. package/.claude/commands/sparc/coder.md +1 -1
  80. package/.claude/commands/sparc/debug.md +5 -5
  81. package/.claude/commands/sparc/debugger.md +1 -1
  82. package/.claude/commands/sparc/designer.md +1 -1
  83. package/.claude/commands/sparc/devops.md +5 -5
  84. package/.claude/commands/sparc/docs-writer.md +5 -5
  85. package/.claude/commands/sparc/documenter.md +1 -1
  86. package/.claude/commands/sparc/innovator.md +1 -1
  87. package/.claude/commands/sparc/integration.md +5 -5
  88. package/.claude/commands/sparc/mcp.md +5 -5
  89. package/.claude/commands/sparc/memory-manager.md +1 -1
  90. package/.claude/commands/sparc/optimizer.md +1 -1
  91. package/.claude/commands/sparc/orchestrator.md +8 -8
  92. package/.claude/commands/sparc/post-deployment-monitoring-mode.md +5 -5
  93. package/.claude/commands/sparc/refinement-optimization-mode.md +5 -5
  94. package/.claude/commands/sparc/researcher.md +1 -1
  95. package/.claude/commands/sparc/reviewer.md +1 -1
  96. package/.claude/commands/sparc/security-review.md +5 -5
  97. package/.claude/commands/sparc/sparc-modes.md +11 -11
  98. package/.claude/commands/sparc/sparc.md +5 -5
  99. package/.claude/commands/sparc/spec-pseudocode.md +5 -5
  100. package/.claude/commands/sparc/supabase-admin.md +5 -5
  101. package/.claude/commands/sparc/swarm-coordinator.md +1 -1
  102. package/.claude/commands/sparc/tdd.md +1 -1
  103. package/.claude/commands/sparc/tester.md +1 -1
  104. package/.claude/commands/sparc/tutorial.md +5 -5
  105. package/.claude/commands/sparc/workflow-manager.md +1 -1
  106. package/.claude/commands/sparc.md +6 -6
  107. package/.claude/commands/swarm/analysis.md +1 -1
  108. package/.claude/commands/swarm/development.md +1 -1
  109. package/.claude/commands/swarm/examples.md +3 -3
  110. package/.claude/commands/swarm/maintenance.md +1 -1
  111. package/.claude/commands/swarm/optimization.md +1 -1
  112. package/.claude/commands/swarm/research.md +1 -1
  113. package/.claude/commands/swarm/swarm-analysis.md +1 -1
  114. package/.claude/commands/swarm/swarm-background.md +1 -1
  115. package/.claude/commands/swarm/swarm-init.md +3 -3
  116. package/.claude/commands/swarm/swarm-modes.md +1 -1
  117. package/.claude/commands/swarm/swarm-monitor.md +1 -1
  118. package/.claude/commands/swarm/swarm-spawn.md +3 -3
  119. package/.claude/commands/swarm/swarm-status.md +1 -1
  120. package/.claude/commands/swarm/swarm-strategies.md +1 -1
  121. package/.claude/commands/swarm/testing.md +1 -1
  122. package/.claude/commands/training/model-update.md +4 -4
  123. package/.claude/commands/training/neural-patterns.md +12 -12
  124. package/.claude/commands/training/neural-train.md +8 -8
  125. package/.claude/commands/training/pattern-learn.md +4 -4
  126. package/.claude/commands/training/specialization.md +2 -2
  127. package/.claude/commands/workflows/development.md +3 -3
  128. package/.claude/commands/workflows/research.md +2 -2
  129. package/.claude/commands/workflows/workflow-create.md +4 -4
  130. package/.claude/commands/workflows/workflow-execute.md +4 -4
  131. package/.claude/commands/workflows/workflow-export.md +4 -4
  132. package/.claude/helpers/.helpers-version +1 -1
  133. package/.claude/helpers/auto-memory-hook.mjs +1 -1
  134. package/.claude/helpers/github-setup.sh +4 -4
  135. package/.claude/helpers/helpers.manifest.json +3 -3
  136. package/.claude/helpers/quick-start.sh +4 -4
  137. package/.claude/helpers/setup-mcp.sh +1 -1
  138. package/.claude/helpers/statusline.cjs +0 -0
  139. package/.claude/settings.json +1 -1
  140. package/.claude/skills/dual-mode/dual-spawn.md +2 -2
  141. package/.claude/skills/github-multi-repo/SKILL.md +21 -21
  142. package/.claude/skills/github-release-management/SKILL.md +19 -19
  143. package/.claude/skills/hooks-automation/SKILL.md +107 -107
  144. package/.claude/skills/sparc-methodology/SKILL.md +26 -26
  145. package/.claude/skills/swarm-advanced/SKILL.md +3 -3
  146. package/catalog-manifest.json +2 -2
  147. package/dist/src/commands/memory.js +9 -1
  148. package/dist/src/commands/migrate-agent-detection.d.ts +27 -0
  149. package/dist/src/commands/migrate-agent-detection.js +113 -0
  150. package/dist/src/commands/migrate.js +41 -3
  151. package/dist/src/memory/memory-bridge.d.ts +7 -0
  152. package/dist/src/memory/memory-bridge.js +28 -1
  153. package/dist/src/memory/memory-initializer.d.ts +3 -0
  154. package/package.json +1 -1
@@ -472,28 +472,28 @@ mcp__claude-flow__swarm_monitor {
472
472
 
473
473
  ```bash
474
474
  # Execute specific mode
475
- npx claude-flow sparc run <mode> "task description"
475
+ npx @claude-flow/cli@latest sparc run <mode> "task description"
476
476
 
477
477
  # Use alpha features
478
478
  npx claude-flow@alpha sparc run <mode> "task description"
479
479
 
480
480
  # List all available modes
481
- npx claude-flow sparc modes
481
+ npx @claude-flow/cli@latest sparc modes
482
482
 
483
483
  # Get help for specific mode
484
- npx claude-flow sparc help <mode>
484
+ npx @claude-flow/cli@latest sparc help <mode>
485
485
 
486
486
  # Run with options
487
- npx claude-flow sparc run <mode> "task" --parallel --monitor
487
+ npx @claude-flow/cli@latest sparc run <mode> "task" --parallel --monitor
488
488
 
489
489
  # Execute TDD workflow
490
- npx claude-flow sparc tdd "feature description"
490
+ npx @claude-flow/cli@latest sparc tdd "feature description"
491
491
 
492
492
  # Batch execution
493
- npx claude-flow sparc batch <mode1,mode2,mode3> "task"
493
+ npx @claude-flow/cli@latest sparc batch <mode1,mode2,mode3> "task"
494
494
 
495
495
  # Pipeline execution
496
- npx claude-flow sparc pipeline "task description"
496
+ npx @claude-flow/cli@latest sparc pipeline "task description"
497
497
  ```
498
498
 
499
499
  ### Method 3: Local Installation
@@ -911,58 +911,58 @@ mcp__claude-flow__sparc_mode {
911
911
 
912
912
  ```bash
913
913
  # Step 1: Research and planning
914
- npx claude-flow sparc run researcher "authentication patterns"
914
+ npx @claude-flow/cli@latest sparc run researcher "authentication patterns"
915
915
 
916
916
  # Step 2: Architecture design
917
- npx claude-flow sparc run architect "design auth system"
917
+ npx @claude-flow/cli@latest sparc run architect "design auth system"
918
918
 
919
919
  # Step 3: TDD implementation
920
- npx claude-flow sparc tdd "user authentication feature"
920
+ npx @claude-flow/cli@latest sparc tdd "user authentication feature"
921
921
 
922
922
  # Step 4: Code review
923
- npx claude-flow sparc run reviewer "review auth implementation"
923
+ npx @claude-flow/cli@latest sparc run reviewer "review auth implementation"
924
924
 
925
925
  # Step 5: Documentation
926
- npx claude-flow sparc run documenter "document auth API"
926
+ npx @claude-flow/cli@latest sparc run documenter "document auth API"
927
927
  ```
928
928
 
929
929
  ### Workflow 2: Bug Investigation
930
930
 
931
931
  ```bash
932
932
  # Step 1: Analyze issue
933
- npx claude-flow sparc run analyzer "investigate bug #456"
933
+ npx @claude-flow/cli@latest sparc run analyzer "investigate bug #456"
934
934
 
935
935
  # Step 2: Debug systematically
936
- npx claude-flow sparc run debugger "fix memory leak in service X"
936
+ npx @claude-flow/cli@latest sparc run debugger "fix memory leak in service X"
937
937
 
938
938
  # Step 3: Create tests
939
- npx claude-flow sparc run tester "regression tests for bug #456"
939
+ npx @claude-flow/cli@latest sparc run tester "regression tests for bug #456"
940
940
 
941
941
  # Step 4: Review fix
942
- npx claude-flow sparc run reviewer "validate bug fix"
942
+ npx @claude-flow/cli@latest sparc run reviewer "validate bug fix"
943
943
  ```
944
944
 
945
945
  ### Workflow 3: Performance Optimization
946
946
 
947
947
  ```bash
948
948
  # Step 1: Profile performance
949
- npx claude-flow sparc run analyzer "profile API response times"
949
+ npx @claude-flow/cli@latest sparc run analyzer "profile API response times"
950
950
 
951
951
  # Step 2: Identify bottlenecks
952
- npx claude-flow sparc run optimizer "optimize database queries"
952
+ npx @claude-flow/cli@latest sparc run optimizer "optimize database queries"
953
953
 
954
954
  # Step 3: Implement improvements
955
- npx claude-flow sparc run coder "implement caching layer"
955
+ npx @claude-flow/cli@latest sparc run coder "implement caching layer"
956
956
 
957
957
  # Step 4: Benchmark results
958
- npx claude-flow sparc run tester "performance benchmarks"
958
+ npx @claude-flow/cli@latest sparc run tester "performance benchmarks"
959
959
  ```
960
960
 
961
961
  ### Workflow 4: Complete Pipeline
962
962
 
963
963
  ```bash
964
964
  # Execute full development pipeline
965
- npx claude-flow sparc pipeline "e-commerce checkout feature"
965
+ npx @claude-flow/cli@latest sparc pipeline "e-commerce checkout feature"
966
966
 
967
967
  # This automatically runs:
968
968
  # 1. researcher - Gather requirements
@@ -1070,19 +1070,19 @@ mcp__claude-flow__token_usage {
1070
1070
 
1071
1071
  ```bash
1072
1072
  # List modes
1073
- npx claude-flow sparc modes
1073
+ npx @claude-flow/cli@latest sparc modes
1074
1074
 
1075
1075
  # Run specific mode
1076
- npx claude-flow sparc run <mode> "task"
1076
+ npx @claude-flow/cli@latest sparc run <mode> "task"
1077
1077
 
1078
1078
  # TDD workflow
1079
- npx claude-flow sparc tdd "feature"
1079
+ npx @claude-flow/cli@latest sparc tdd "feature"
1080
1080
 
1081
1081
  # Full pipeline
1082
- npx claude-flow sparc pipeline "task"
1082
+ npx @claude-flow/cli@latest sparc pipeline "task"
1083
1083
 
1084
1084
  # Batch execution
1085
- npx claude-flow sparc batch <modes> "task"
1085
+ npx @claude-flow/cli@latest sparc batch <modes> "task"
1086
1086
  ```
1087
1087
 
1088
1088
  ### Most Common MCP Calls
@@ -237,7 +237,7 @@ mcp__claude-flow__workflow_execute({
237
237
  ### CLI Fallback
238
238
  ```bash
239
239
  # Quick research swarm
240
- npx claude-flow swarm "research AI trends in 2025" \
240
+ npx @claude-flow/cli@latest swarm "research AI trends in 2025" \
241
241
  --strategy research \
242
242
  --mode distributed \
243
243
  --max-agents 6 \
@@ -381,7 +381,7 @@ mcp__claude-flow__pipeline_create({
381
381
  ### CLI Fallback
382
382
  ```bash
383
383
  # Quick development swarm
384
- npx claude-flow swarm "build REST API with authentication" \
384
+ npx @claude-flow/cli@latest swarm "build REST API with authentication" \
385
385
  --strategy development \
386
386
  --mode hierarchical \
387
387
  --monitor \
@@ -581,7 +581,7 @@ mcp__claude-flow__trend_analysis({
581
581
  ### CLI Fallback
582
582
  ```bash
583
583
  # Quick testing swarm
584
- npx claude-flow swarm "test application comprehensively" \
584
+ npx @claude-flow/cli@latest swarm "test application comprehensively" \
585
585
  --strategy testing \
586
586
  --mode star \
587
587
  --parallel \
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 4,
4
- "generatedAt": "2026-08-11T17:05:49.193Z",
5
- "gitSha": "6ce18b5a",
4
+ "generatedAt": "2026-08-12T14:05:18.962Z",
5
+ "gitSha": "b8c37da8",
6
6
  "catalog": {
7
7
  "agents": 164,
8
8
  "tools": 397,
@@ -214,7 +214,15 @@ const storeCommand = {
214
214
  ]
215
215
  });
216
216
  output.writeln();
217
- output.printSuccess('Data stored successfully');
217
+ if (result.persistWarning) {
218
+ // #2968: the write ran, but the checkpoint signal indicates it may
219
+ // not have reached disk (sql.js fallback driver) — do not print an
220
+ // unconditional green success for a write that might vanish.
221
+ output.printWarning(`Data stored, but persistence is not guaranteed: ${result.persistWarning}`);
222
+ }
223
+ else {
224
+ output.printSuccess('Data stored successfully');
225
+ }
218
226
  return { success: true, data: { ...storeData, id: result.id, embedding: result.embedding, provenanceType: provenance || 'unknown' } };
219
227
  }
220
228
  catch (error) {
@@ -0,0 +1,27 @@
1
+ export interface RemovedAgentMapping {
2
+ /** Basename as it shipped in the init template, e.g. "coder.md". */
3
+ basename: string;
4
+ /** Marketplace plugin id (name in .claude-plugin/marketplace.json) that now owns it. */
5
+ plugin: string;
6
+ }
7
+ export interface RemovedAgentGap {
8
+ agent: string;
9
+ plugin: string;
10
+ installCommand: string;
11
+ }
12
+ export interface DetectRemovedAgentGapsOptions {
13
+ /**
14
+ * Override for the Claude Code plugin-registry home directory. Defaults to
15
+ * os.homedir(). Tests inject an isolated temp dir so results don't depend
16
+ * on whatever is actually installed on the machine running the suite.
17
+ */
18
+ homeDir?: string;
19
+ }
20
+ /**
21
+ * Returns one gap row per removed agent that is both missing from the
22
+ * project's .claude/agents/ tree and not covered by an installed owning
23
+ * plugin. Pure filesystem checks, no CLI version comparison (ADR-382 Part B
24
+ * scope note: a filesystem check is sufficient and accurate here).
25
+ */
26
+ export declare function detectRemovedAgentGaps(cwd: string, removedAgents: RemovedAgentMapping[], options?: DetectRemovedAgentGapsOptions): RemovedAgentGap[];
27
+ //# sourceMappingURL=migrate-agent-detection.d.ts.map
@@ -0,0 +1,113 @@
1
+ /**
2
+ * ADR-382 Part B — the `ruflo migrate` mitigation ADR-128 promised and never
3
+ * shipped: detect the 9 forked agents ADR-128 Phase 2 deleted from the init
4
+ * template (each plugin is now canonical) and, when a project is missing one
5
+ * AND the owning plugin isn't installed, surface an install suggestion.
6
+ * See v3/docs/adr/ADR-382-init-scaffold-content-drift-remediation.md and
7
+ * https://github.com/ruvnet/ruflo/issues/2971.
8
+ *
9
+ * Kept in a sibling module (not migrate.ts) because migrate.ts is already
10
+ * near/over the 500-line budget — see CLAUDE.md file-size rule.
11
+ */
12
+ import * as fs from 'fs';
13
+ import * as path from 'path';
14
+ import * as os from 'os';
15
+ /**
16
+ * Claude Code records every plugin install (marketplace-scoped, "user" or
17
+ * "project") in a single global file — ~/.claude/plugins/installed_plugins.json,
18
+ * keyed "<plugin>@<marketplace>". This is the only real on-disk signal for
19
+ * "is the owning plugin installed"; there is no per-project marker and no
20
+ * ruflo-side tracking for marketplace plugins (ruflo's own PluginManager
21
+ * manifest at .claude-flow/plugins/installed.json tracks a different,
22
+ * npm-package-based plugin system).
23
+ */
24
+ function readInstalledPluginsRegistry(homeDir) {
25
+ const registryPath = path.join(homeDir, '.claude', 'plugins', 'installed_plugins.json');
26
+ try {
27
+ if (!fs.existsSync(registryPath))
28
+ return {};
29
+ const raw = fs.readFileSync(registryPath, 'utf-8');
30
+ const parsed = JSON.parse(raw);
31
+ if (parsed && typeof parsed === 'object' && parsed.plugins && typeof parsed.plugins === 'object') {
32
+ return parsed.plugins;
33
+ }
34
+ return {};
35
+ }
36
+ catch {
37
+ return {};
38
+ }
39
+ }
40
+ function isPluginInstalled(pluginName, cwd, registry) {
41
+ const resolvedCwd = path.resolve(cwd);
42
+ const prefix = `${pluginName}@`;
43
+ for (const [key, entries] of Object.entries(registry)) {
44
+ if (!key.startsWith(prefix))
45
+ continue;
46
+ if (!Array.isArray(entries))
47
+ continue;
48
+ for (const entry of entries) {
49
+ if (entry?.scope === 'project') {
50
+ if (entry.projectPath && path.resolve(entry.projectPath) === resolvedCwd)
51
+ return true;
52
+ }
53
+ else {
54
+ // "user" scope (or unspecified) applies to every project.
55
+ return true;
56
+ }
57
+ }
58
+ }
59
+ return false;
60
+ }
61
+ function agentFileExists(cwd, basename) {
62
+ const agentsDir = path.join(cwd, '.claude', 'agents');
63
+ return findBasename(agentsDir, basename, 0);
64
+ }
65
+ // .claude/agents/ is a shallow tree (category/[subcategory]/name.md); a small
66
+ // depth guard is enough to avoid pathological recursion without needing a
67
+ // real glob dependency for a two-or-three-level lookup.
68
+ const MAX_AGENT_DIR_DEPTH = 6;
69
+ function findBasename(dir, basename, depth) {
70
+ if (depth > MAX_AGENT_DIR_DEPTH)
71
+ return false;
72
+ let entries;
73
+ try {
74
+ entries = fs.readdirSync(dir, { withFileTypes: true });
75
+ }
76
+ catch {
77
+ return false;
78
+ }
79
+ for (const entry of entries) {
80
+ if (entry.isDirectory()) {
81
+ if (findBasename(path.join(dir, entry.name), basename, depth + 1))
82
+ return true;
83
+ }
84
+ else if (entry.isFile() && entry.name === basename) {
85
+ return true;
86
+ }
87
+ }
88
+ return false;
89
+ }
90
+ /**
91
+ * Returns one gap row per removed agent that is both missing from the
92
+ * project's .claude/agents/ tree and not covered by an installed owning
93
+ * plugin. Pure filesystem checks, no CLI version comparison (ADR-382 Part B
94
+ * scope note: a filesystem check is sufficient and accurate here).
95
+ */
96
+ export function detectRemovedAgentGaps(cwd, removedAgents, options = {}) {
97
+ const homeDir = options.homeDir ?? os.homedir();
98
+ const registry = readInstalledPluginsRegistry(homeDir);
99
+ const gaps = [];
100
+ for (const { basename, plugin } of removedAgents) {
101
+ if (agentFileExists(cwd, basename))
102
+ continue;
103
+ if (isPluginInstalled(plugin, cwd, registry))
104
+ continue;
105
+ gaps.push({
106
+ agent: basename,
107
+ plugin,
108
+ installCommand: `ruflo plugins install ${plugin}`,
109
+ });
110
+ }
111
+ return gaps;
112
+ }
113
+ //# sourceMappingURL=migrate-agent-detection.js.map
@@ -5,6 +5,7 @@
5
5
  import { output } from '../output.js';
6
6
  import * as fs from 'fs';
7
7
  import * as path from 'path';
8
+ import { detectRemovedAgentGaps } from './migrate-agent-detection.js';
8
9
  // Migration targets
9
10
  const MIGRATION_TARGETS = [
10
11
  { value: 'config', label: 'Configuration', hint: 'Migrate configuration files' },
@@ -15,6 +16,21 @@ const MIGRATION_TARGETS = [
15
16
  { value: 'embeddings', label: 'Embeddings', hint: 'Migrate to ONNX with hyperbolic support' },
16
17
  { value: 'all', label: 'All', hint: 'Full migration' }
17
18
  ];
19
+ // ADR-128 Phase 2 deleted these 9 forked agents from the init template,
20
+ // making each plugin canonical — but ADR-128's own Consequences section
21
+ // promised "`ruflo migrate` should detect removed agents and print install
22
+ // suggestions," which never shipped until ADR-382 Part B (issue #2971).
23
+ const REMOVED_AGENTS = [
24
+ { basename: 'coder.md', plugin: 'ruflo-core' },
25
+ { basename: 'researcher.md', plugin: 'ruflo-core' },
26
+ { basename: 'reviewer.md', plugin: 'ruflo-core' },
27
+ { basename: 'tester.md', plugin: 'ruflo-testgen' },
28
+ { basename: 'memory-specialist.md', plugin: 'ruflo-rag-memory' },
29
+ { basename: 'security-auditor.md', plugin: 'ruflo-security-audit' },
30
+ { basename: 'sparc-orchestrator.md', plugin: 'ruflo-sparc' },
31
+ { basename: 'goal-planner.md', plugin: 'ruflo-goals' },
32
+ { basename: 'adr-architect.md', plugin: 'ruflo-adr' },
33
+ ];
18
34
  // Status command
19
35
  const statusCommand = {
20
36
  name: 'status',
@@ -101,10 +117,13 @@ const statusCommand = {
101
117
  if (migrationState) {
102
118
  components.push({ component: 'Migration State', status: migrationState, migrationNeeded: 'no' });
103
119
  }
120
+ // ADR-382 Part B: agents ADR-128 removed from the init template that are
121
+ // both missing from this project and not covered by an installed plugin.
122
+ const removedAgentGaps = detectRemovedAgentGaps(cwd, REMOVED_AGENTS);
104
123
  // Display results
105
124
  if (ctx.flags.format === 'json') {
106
- output.printJson({ components, migrationState });
107
- return { success: true, data: { components, migrationState } };
125
+ output.printJson({ components, migrationState, removedAgentGaps });
126
+ return { success: true, data: { components, migrationState, removedAgentGaps } };
108
127
  }
109
128
  output.writeln();
110
129
  output.writeln(output.bold('Migration Status'));
@@ -130,7 +149,26 @@ const statusCommand = {
130
149
  else {
131
150
  output.printSuccess('No migration needed.');
132
151
  }
133
- return { success: true, data: { components, needsMigration } };
152
+ if (removedAgentGaps.length > 0) {
153
+ output.writeln();
154
+ output.writeln(output.bold('Removed Agents (ADR-128)'));
155
+ output.printTable({
156
+ columns: [
157
+ { key: 'agent', header: 'Agent', width: 24 },
158
+ { key: 'plugin', header: 'Owning Plugin', width: 20 },
159
+ { key: 'installCommand', header: 'Install', width: 34 }
160
+ ],
161
+ data: removedAgentGaps.map(g => ({
162
+ agent: output.warning(g.agent),
163
+ plugin: g.plugin,
164
+ installCommand: output.dim(g.installCommand)
165
+ })),
166
+ border: false
167
+ });
168
+ output.writeln();
169
+ output.printInfo(`${removedAgentGaps.length} agent(s) removed by ADR-128 are missing from .claude/agents/ and not covered by an installed plugin.`);
170
+ }
171
+ return { success: true, data: { components, needsMigration, removedAgentGaps } };
134
172
  }
135
173
  };
136
174
  // Run migration
@@ -67,6 +67,13 @@ export declare function bridgeStoreEntry(options: {
67
67
  cached?: boolean;
68
68
  attested?: boolean;
69
69
  error?: string;
70
+ /** #2968: set when the post-write checkpoint failed in a way that
71
+ * indicates this connection may not durably persist writes at all
72
+ * (the sql.js fallback driver, engaged when better-sqlite3's native
73
+ * binding is missing). The write above still ran and `success` is
74
+ * still true — this is advisory, not a failure — but callers should
75
+ * surface it instead of only printing an unconditional success message. */
76
+ persistWarning?: string;
70
77
  } | null>;
71
78
  /**
72
79
  * Search entries via AgentDB v3.
@@ -897,12 +897,27 @@ export async function bridgeStoreEntry(options) {
897
897
  // `sqlite3` vector count) then see a stale/empty main DB file and report
898
898
  // "0 vectors" / empty search. A PASSIVE checkpoint flushes committed pages
899
899
  // into the main file without blocking writers. Best-effort, never fatal.
900
+ let persistWarning;
900
901
  try {
901
902
  if (typeof ctx.db.pragma === 'function') {
902
903
  ctx.db.pragma('wal_checkpoint(PASSIVE)');
903
904
  }
904
905
  }
905
- catch { /* non-WAL, busy, or unsupported — non-fatal */ }
906
+ catch (checkpointErr) {
907
+ // #2968: on the sql.js fallback driver (engaged when better-sqlite3's
908
+ // native binding never got built — e.g. a skipped optionalDependency
909
+ // postinstall), this PRAGMA isn't implemented and throws "Invalid
910
+ // PRAGMA command". sql.js has no WAL journal to checkpoint at all, so
911
+ // this specific failure is the strongest signal available here that
912
+ // the insert above may exist only in this process's in-memory image
913
+ // and never reach disk — not the ordinary "non-WAL, busy, or
914
+ // unsupported" case the old blanket catch assumed. Surface it rather
915
+ // than swallow it silently; other pragma failures stay non-fatal.
916
+ const msg = checkpointErr instanceof Error ? checkpointErr.message : String(checkpointErr);
917
+ if (/Invalid PRAGMA/i.test(msg)) {
918
+ persistWarning = `sql.js fallback driver in use — this write may not be durably persisted to disk (${msg}). Install better-sqlite3's native binding to restore durable writes (see issue #2968: npm rebuild better-sqlite3, or reinstall with install scripts enabled).`;
919
+ }
920
+ }
906
921
  // Phase 2: Write-through to TieredCache
907
922
  const safeNs = String(namespace).replace(/:/g, '_');
908
923
  const safeKey = String(key).replace(/:/g, '_');
@@ -918,6 +933,7 @@ export async function bridgeStoreEntry(options) {
918
933
  guarded: true,
919
934
  cached: true,
920
935
  attested: true,
936
+ ...(persistWarning ? { persistWarning } : {}),
921
937
  };
922
938
  }
923
939
  catch (err) {
@@ -995,10 +1011,17 @@ export async function bridgeSearchEntries(options) {
995
1011
  const whereExtra = filters.length > 0 ? `AND ${filters.join(' AND ')}` : '';
996
1012
  let rows;
997
1013
  try {
1014
+ // #2982/#2976: this pre-rank SELECT truncates the corpus to 1000 rows
1015
+ // before BM25/embedding scoring runs. Without ORDER BY, SQLite returns
1016
+ // rows in arbitrary storage order (effectively oldest-inserted-first at
1017
+ // scale), so on any corpus over 1000 entries the newest — and often
1018
+ // most relevant — rows never reach scoring at all. bridgeListEntries()
1019
+ // already orders by updated_at DESC for the same reason; mirror it here.
998
1020
  const stmt = ctx.db.prepare(`
999
1021
  SELECT id, key, namespace, content, embedding, provenance_type
1000
1022
  FROM memory_entries
1001
1023
  WHERE ${ACTIVE_MEMORY_ROW_SQL} ${whereExtra}
1024
+ ORDER BY updated_at DESC
1002
1025
  LIMIT 1000
1003
1026
  `);
1004
1027
  rows = filterParams.length > 0 ? stmt.all(...filterParams) : stmt.all();
@@ -1506,10 +1529,14 @@ export async function bridgeSearchHNSW(queryEmbedding, options, dbPath) {
1506
1529
  : '';
1507
1530
  let rows;
1508
1531
  try {
1532
+ // #2982/#2976: same unordered pre-rank truncation as bridgeSearchEntries
1533
+ // above — without ORDER BY, a corpus over 10000 rows silently drops
1534
+ // its newest entries before cosine scoring ever runs.
1509
1535
  const stmt = ctx.db.prepare(`
1510
1536
  SELECT id, key, namespace, content, embedding
1511
1537
  FROM memory_entries
1512
1538
  WHERE status = 'active' AND embedding IS NOT NULL ${nsFilter}
1539
+ ORDER BY updated_at DESC
1513
1540
  LIMIT 10000
1514
1541
  `);
1515
1542
  rows = nsFilter
@@ -448,6 +448,9 @@ export declare function storeEntry(options: {
448
448
  model: string;
449
449
  };
450
450
  error?: string;
451
+ /** #2968: set when the bridge's checkpoint failed in a way indicating
452
+ * this write may not be durably persisted (sql.js fallback driver). */
453
+ persistWarning?: string;
451
454
  }>;
452
455
  /**
453
456
  * Search entries using sql.js with vector similarity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.37.0",
3
+ "version": "3.38.1",
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",