claude-flow 3.32.18 → 3.32.19

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.32.18",
3
+ "version": "3.32.19",
4
4
  "description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 1,
4
- "generatedAt": "2026-07-27T02:55:18.250Z",
5
- "gitSha": "684ca3bf",
4
+ "generatedAt": "2026-07-27T03:04:01.949Z",
5
+ "gitSha": "7e76906f",
6
6
  "catalog": {
7
7
  "agents": 164,
8
8
  "tools": 387,
@@ -1632,6 +1632,64 @@ const initMemoryCommand = {
1632
1632
  }
1633
1633
  }
1634
1634
  };
1635
+ // #2763 dream-cycle — OAS memory-operator selector. Standalone
1636
+ // subcommand that returns the highest-value consolidation operator
1637
+ // that fits the given budget for the given entry count. Advisory —
1638
+ // the caller decides whether to invoke that operator.
1639
+ const selectOperatorCommand = {
1640
+ name: 'select-operator',
1641
+ description: 'Pick the highest-value consolidation operator that fits a budget (OAS, dream-cycle #2763)',
1642
+ options: [
1643
+ { name: 'budget', short: 'b', type: 'number', required: true, description: 'Budget in abstract operator points (1 point ≈ 1 Haiku call)' },
1644
+ { name: 'entries', short: 'e', type: 'number', required: true, description: 'Number of entries to consolidate' },
1645
+ { name: 'hint', type: 'string', choices: ['duplicates', 'verbose', 'patterns', 'general'], default: 'general', description: 'Entry-shape hint' },
1646
+ ],
1647
+ examples: [
1648
+ { command: 'claude-flow memory select-operator -b 50 -e 200', description: 'Pick operator for 200 entries within 50 points' },
1649
+ { command: 'claude-flow memory select-operator -b 5 -e 100 --hint duplicates --format json', description: 'JSON for pipelines' },
1650
+ ],
1651
+ action: async (ctx) => {
1652
+ const budget = ctx.flags.budget;
1653
+ const entries = ctx.flags.entries;
1654
+ const hint = ctx.flags.hint || 'general';
1655
+ if (budget === undefined || entries === undefined) {
1656
+ output.printError('Both --budget and --entries are required.');
1657
+ return { success: false, exitCode: 1 };
1658
+ }
1659
+ if (budget < 0 || entries < 0) {
1660
+ output.printError('Budget and entries must be non-negative.');
1661
+ return { success: false, exitCode: 1 };
1662
+ }
1663
+ const { selectOperator, OPERATORS } = await import('../memory/oas-operator-selector.js');
1664
+ const selection = selectOperator({ budget, entries, hint: hint });
1665
+ if (ctx.flags.format === 'json') {
1666
+ output.printJson(selection);
1667
+ return { success: true, data: selection };
1668
+ }
1669
+ const chosen = OPERATORS[selection.operator];
1670
+ output.writeln();
1671
+ output.printBox(`Budget: ${budget} points · Entries: ${entries}\n` +
1672
+ `Operator: ${selection.operator}\n` +
1673
+ `Description: ${chosen.description}\n` +
1674
+ `Estimated cost: ${selection.estimatedCost.toFixed(2)} points\n` +
1675
+ `Needs split: ${selection.needsSplit ? `YES — batch size ${selection.suggestedBatchSize}` : 'no'}`, 'OAS Operator Selection (#2763)');
1676
+ output.writeln();
1677
+ output.writeln(output.dim(selection.reason));
1678
+ if (selection.considered.length > 0) {
1679
+ output.writeln();
1680
+ output.writeln(output.bold('All operators considered'));
1681
+ output.printTable({
1682
+ columns: [
1683
+ { key: 'id', header: 'Operator', width: 15 },
1684
+ { key: 'cost', header: 'Est. Cost', width: 12, align: 'right', format: (v) => Number(v).toFixed(2) },
1685
+ { key: 'fits', header: 'Fits Budget', width: 12, align: 'center', format: (v) => v ? '✓' : '—' },
1686
+ ],
1687
+ data: selection.considered,
1688
+ });
1689
+ }
1690
+ return { success: true, data: selection };
1691
+ },
1692
+ };
1635
1693
  // #2760 dream-cycle — SCM query classifier. Standalone subcommand so
1636
1694
  // users can inspect what intent a query maps to and pipe the mapped
1637
1695
  // namespaces into other tools (e.g. `memory search --namespace ...`).
@@ -1673,7 +1731,7 @@ const classifyCommand = {
1673
1731
  export const memoryCommand = {
1674
1732
  name: 'memory',
1675
1733
  description: 'Memory management commands',
1676
- subcommands: [initMemoryCommand, storeCommand, retrieveCommand, searchCommand, listCommand, deleteCommand, purgeCommand, statsCommand, configureCommand, cleanupCommand, compressCommand, exportCommand, importCommand, distillCommand, backupCommand, classifyCommand],
1734
+ subcommands: [initMemoryCommand, storeCommand, retrieveCommand, searchCommand, listCommand, deleteCommand, purgeCommand, statsCommand, configureCommand, cleanupCommand, compressCommand, exportCommand, importCommand, distillCommand, backupCommand, classifyCommand, selectOperatorCommand],
1677
1735
  options: [],
1678
1736
  examples: [
1679
1737
  { command: 'claude-flow memory store -k "key" -v "value"', description: 'Store data' },
@@ -0,0 +1,74 @@
1
+ /**
2
+ * OAS (Operator-Aware Selection) memory-consolidation operator picker
3
+ * (#2763 dream-cycle).
4
+ *
5
+ * Findings from the OAS paper referenced in dream-cycle #2763: memory-
6
+ * consolidation performance improves by +48% when the caller picks the
7
+ * RIGHT operator for the current budget + workload, instead of always
8
+ * applying the most-expensive one. Ruflo already has multiple
9
+ * consolidation operators (merge / summarize / compress / distill),
10
+ * but has no cost-aware selector — every `memory consolidate` call
11
+ * uses the same path.
12
+ *
13
+ * v1 MVP: rule-based selector. Cost-per-entry estimates are informed
14
+ * by ruflo's own measured performance targets in v3/@claude-flow/cli/
15
+ * CLAUDE.md — no external benchmark call needed. v2 will refine costs
16
+ * from routing-outcomes trajectories.
17
+ */
18
+ /** The four consolidation operators ruflo can apply. */
19
+ export type OperatorId = 'merge' | 'summarize' | 'compress' | 'distill';
20
+ export interface OperatorSpec {
21
+ id: OperatorId;
22
+ /** Estimated cost per entry, in abstract "operator points" (1 point ≈ 1 Haiku call). */
23
+ costPerEntry: number;
24
+ /** Maximum recommended entry count per invocation (higher counts split). */
25
+ maxEntries: number;
26
+ /** What the operator does — human-readable. */
27
+ description: string;
28
+ /** Best when the entry set has this shape. */
29
+ bestWhen: string;
30
+ }
31
+ export declare const OPERATORS: Record<OperatorId, OperatorSpec>;
32
+ export interface OperatorSelection {
33
+ operator: OperatorId;
34
+ reason: string;
35
+ /** Estimated cost = costPerEntry × min(entries, maxEntries). */
36
+ estimatedCost: number;
37
+ /** True if entries > operator.maxEntries and caller should split into multiple invocations. */
38
+ needsSplit: boolean;
39
+ suggestedBatchSize: number;
40
+ /** All operators considered, in ranked order (best first). */
41
+ considered: Array<{
42
+ id: OperatorId;
43
+ cost: number;
44
+ fits: boolean;
45
+ }>;
46
+ }
47
+ export interface SelectOptions {
48
+ /** Budget in abstract operator points. */
49
+ budget: number;
50
+ /** Number of entries to consolidate. */
51
+ entries: number;
52
+ /**
53
+ * Optional hint about entry shape:
54
+ * 'duplicates' → strongly prefer merge (cheap wins first)
55
+ * 'verbose' → prefer summarize
56
+ * 'patterns' → prefer distill (small, high-signal)
57
+ * 'general' → let cost-fit decide (default)
58
+ */
59
+ hint?: 'duplicates' | 'verbose' | 'patterns' | 'general';
60
+ }
61
+ /**
62
+ * Select the highest-value operator that fits the budget.
63
+ *
64
+ * Selection rule (v1):
65
+ * 1. If a hint is provided AND the hinted operator fits the budget,
66
+ * pick it (hint is a strong signal about entry shape).
67
+ * 2. Else, rank operators by cost ascending; pick the most expensive
68
+ * operator that still fits budget × 1.0 (no over-spend). Idea:
69
+ * spend the whole budget on the most-fidelity operator we can afford.
70
+ * 3. If nothing fits, return merge (guaranteed cheapest) with
71
+ * needsSplit=true so caller batches.
72
+ */
73
+ export declare function selectOperator(opts: SelectOptions): OperatorSelection;
74
+ //# sourceMappingURL=oas-operator-selector.d.ts.map
@@ -0,0 +1,117 @@
1
+ /**
2
+ * OAS (Operator-Aware Selection) memory-consolidation operator picker
3
+ * (#2763 dream-cycle).
4
+ *
5
+ * Findings from the OAS paper referenced in dream-cycle #2763: memory-
6
+ * consolidation performance improves by +48% when the caller picks the
7
+ * RIGHT operator for the current budget + workload, instead of always
8
+ * applying the most-expensive one. Ruflo already has multiple
9
+ * consolidation operators (merge / summarize / compress / distill),
10
+ * but has no cost-aware selector — every `memory consolidate` call
11
+ * uses the same path.
12
+ *
13
+ * v1 MVP: rule-based selector. Cost-per-entry estimates are informed
14
+ * by ruflo's own measured performance targets in v3/@claude-flow/cli/
15
+ * CLAUDE.md — no external benchmark call needed. v2 will refine costs
16
+ * from routing-outcomes trajectories.
17
+ */
18
+ export const OPERATORS = {
19
+ merge: {
20
+ id: 'merge',
21
+ costPerEntry: 0.02, // near-free — deterministic near-duplicate merge
22
+ maxEntries: 5000,
23
+ description: 'Near-duplicate merge (deterministic, cosine ≥ 0.95)',
24
+ bestWhen: 'Many near-identical entries (e.g. duplicated command traces)',
25
+ },
26
+ summarize: {
27
+ id: 'summarize',
28
+ costPerEntry: 0.5, // one Haiku call per ~2 entries
29
+ maxEntries: 500,
30
+ description: 'Short-to-long consolidation via Haiku (1 call per ~2 entries)',
31
+ bestWhen: 'Verbose logs / trajectory steps that share a theme',
32
+ },
33
+ compress: {
34
+ id: 'compress',
35
+ costPerEntry: 1.5, // LoRA-style compression pass — heavier
36
+ maxEntries: 200,
37
+ description: 'LoRA/EWC-style compression preserving semantic embeddings',
38
+ bestWhen: 'High-fidelity pattern preservation across many entries',
39
+ },
40
+ distill: {
41
+ id: 'distill',
42
+ costPerEntry: 3, // full distillation — heaviest
43
+ maxEntries: 100,
44
+ description: 'Full pattern distillation (extracts high-value patterns for ReasoningBank)',
45
+ bestWhen: 'Extracting durable learnings from a small high-signal set',
46
+ },
47
+ };
48
+ /**
49
+ * Select the highest-value operator that fits the budget.
50
+ *
51
+ * Selection rule (v1):
52
+ * 1. If a hint is provided AND the hinted operator fits the budget,
53
+ * pick it (hint is a strong signal about entry shape).
54
+ * 2. Else, rank operators by cost ascending; pick the most expensive
55
+ * operator that still fits budget × 1.0 (no over-spend). Idea:
56
+ * spend the whole budget on the most-fidelity operator we can afford.
57
+ * 3. If nothing fits, return merge (guaranteed cheapest) with
58
+ * needsSplit=true so caller batches.
59
+ */
60
+ export function selectOperator(opts) {
61
+ const { budget, entries, hint } = opts;
62
+ const considered = Object.keys(OPERATORS).map((id) => {
63
+ const spec = OPERATORS[id];
64
+ const effectiveEntries = Math.min(entries, spec.maxEntries);
65
+ const cost = spec.costPerEntry * effectiveEntries;
66
+ return { id, cost, fits: cost <= budget };
67
+ }).sort((a, b) => a.cost - b.cost);
68
+ // Rule 1: honor a shape hint if the hinted operator fits.
69
+ const hintMap = {
70
+ duplicates: 'merge',
71
+ verbose: 'summarize',
72
+ patterns: 'distill',
73
+ general: 'compress',
74
+ };
75
+ if (hint && hint !== 'general') {
76
+ const preferred = hintMap[hint];
77
+ const match = considered.find((c) => c.id === preferred);
78
+ if (match?.fits) {
79
+ const spec = OPERATORS[match.id];
80
+ return {
81
+ operator: match.id,
82
+ reason: `Hint "${hint}" → ${match.id} (cost ${match.cost.toFixed(2)} ≤ budget ${budget})`,
83
+ estimatedCost: match.cost,
84
+ needsSplit: entries > spec.maxEntries,
85
+ suggestedBatchSize: spec.maxEntries,
86
+ considered,
87
+ };
88
+ }
89
+ }
90
+ // Rule 2: pick the most-expensive operator that still fits.
91
+ const fitting = considered.filter((c) => c.fits);
92
+ if (fitting.length > 0) {
93
+ const best = fitting[fitting.length - 1]; // most expensive fitting
94
+ const spec = OPERATORS[best.id];
95
+ return {
96
+ operator: best.id,
97
+ reason: `Best-fit within budget: ${best.id} at cost ${best.cost.toFixed(2)} (budget ${budget}, entries ${entries})`,
98
+ estimatedCost: best.cost,
99
+ needsSplit: entries > spec.maxEntries,
100
+ suggestedBatchSize: spec.maxEntries,
101
+ considered,
102
+ };
103
+ }
104
+ // Rule 3: budget too small for any operator on the full entry set.
105
+ // Split via merge (cheapest) with the merge batch size.
106
+ const mergeSpec = OPERATORS.merge;
107
+ const batchSize = Math.max(1, Math.floor(budget / mergeSpec.costPerEntry));
108
+ return {
109
+ operator: 'merge',
110
+ reason: `Budget ${budget} too small for any operator across ${entries} entries — split via merge in batches of ${batchSize}`,
111
+ estimatedCost: budget,
112
+ needsSplit: true,
113
+ suggestedBatchSize: batchSize,
114
+ considered,
115
+ };
116
+ }
117
+ //# sourceMappingURL=oas-operator-selector.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.32.18",
3
+ "version": "3.32.19",
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",