claude-flow 3.32.19 → 3.32.20

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.19",
3
+ "version": "3.32.20",
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-27T03:04:01.949Z",
5
- "gitSha": "7e76906f",
4
+ "generatedAt": "2026-07-27T03:15:06.269Z",
5
+ "gitSha": "353d0663",
6
6
  "catalog": {
7
7
  "agents": 164,
8
8
  "tools": 387,
@@ -843,10 +843,68 @@ const coordinateCommand = {
843
843
  }
844
844
  };
845
845
  // Main swarm command
846
+ // #2727 dream-cycle — inter-agent message compressor (IB+VQ-inspired
847
+ // MVP). Advisory tool: takes a message + token budget, returns a
848
+ // compressed variant that preserves must-see spans (code, URLs, paths)
849
+ // and keeps the top-scored sentences by TF-IDF-ish keyword density.
850
+ // v2 wires a real VQ codec once a training pipeline exists.
851
+ const compressMessageCommand = {
852
+ name: 'compress-message',
853
+ description: 'Compress an inter-agent message to a token budget (IB+VQ-inspired, dream-cycle #2727)',
854
+ options: [
855
+ { name: 'message', short: 'm', type: 'string', description: 'Message text (or use --message-file)' },
856
+ { name: 'message-file', type: 'string', description: 'Path to a file whose contents will be compressed' },
857
+ { name: 'budget-tokens', short: 'b', type: 'number', default: 200, description: 'Target token budget (approximate, ~4 chars per token)' },
858
+ { name: 'mode', type: 'string', choices: ['keyword', 'sentence', 'hybrid'], default: 'hybrid', description: 'Scoring mode' },
859
+ ],
860
+ examples: [
861
+ { command: 'claude-flow swarm compress-message -m "…" --budget-tokens 100', description: 'Compress inline message to 100 tokens' },
862
+ { command: 'claude-flow swarm compress-message --message-file ./msg.md -b 300 --format json', description: 'JSON for pipelines' },
863
+ ],
864
+ action: async (ctx) => {
865
+ const inlineMsg = ctx.flags.message;
866
+ const msgFile = ctx.flags.messageFile;
867
+ const budgetTokens = ctx.flags.budgetTokens || 200;
868
+ const mode = ctx.flags.mode || 'hybrid';
869
+ let message = inlineMsg ?? '';
870
+ if (msgFile) {
871
+ try {
872
+ const fsMod = await import('node:fs');
873
+ const pathMod = await import('node:path');
874
+ message = fsMod.readFileSync(pathMod.resolve(msgFile), 'utf-8');
875
+ }
876
+ catch (err) {
877
+ output.printError(`Failed to read ${msgFile}: ${err instanceof Error ? err.message : String(err)}`);
878
+ return { success: false, exitCode: 1 };
879
+ }
880
+ }
881
+ if (!message) {
882
+ output.printError('No message provided. Use --message "..." or --message-file <path>.');
883
+ return { success: false, exitCode: 1 };
884
+ }
885
+ const { compressMessage } = await import('../swarm/message-compressor.js');
886
+ const result = compressMessage(message, { budgetTokens, mode: mode });
887
+ if (ctx.flags.format === 'json') {
888
+ output.printJson(result);
889
+ return { success: true, data: result };
890
+ }
891
+ output.writeln();
892
+ output.printBox(`Original: ${result.stats.originalTokens} tokens · Compressed: ${result.stats.compressedTokens} tokens\n` +
893
+ `Ratio: ${(result.stats.compressionRatio * 100).toFixed(1)}%\n` +
894
+ `Sentences kept: ${result.stats.sentencesKept}/${result.stats.sentencesTotal} · Preserved spans: ${result.stats.preservedSpans}\n` +
895
+ `Info retained (top-quartile): ${(result.stats.infoRetainedEstimate * 100).toFixed(1)}%`, 'Message Compressor (#2727 IB+VQ MVP)');
896
+ output.writeln();
897
+ output.writeln(output.bold('Compressed message'));
898
+ output.writeln(output.dim('─'.repeat(60)));
899
+ output.writeln(result.compressed);
900
+ output.writeln(output.dim('─'.repeat(60)));
901
+ return { success: true, data: result };
902
+ },
903
+ };
846
904
  export const swarmCommand = {
847
905
  name: 'swarm',
848
906
  description: 'Swarm coordination commands',
849
- subcommands: [initCommand, startCommand, statusCommand, stopCommand, scaleCommand, coordinateCommand],
907
+ subcommands: [initCommand, startCommand, statusCommand, stopCommand, scaleCommand, coordinateCommand, compressMessageCommand],
850
908
  options: [],
851
909
  examples: [
852
910
  { command: 'claude-flow swarm init --v3-mode', description: 'Initialize V3 swarm' },
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Inter-agent message compressor (#2727 dream-cycle, IB+VQ inspired).
3
+ *
4
+ * Dream-cycle #2727 (IB+VQ messaging 181.8% task gain): variable-
5
+ * bandwidth compression at the inter-agent message boundary breaks the
6
+ * performance/bandwidth tradeoff. Real VQ needs a codebook trained on
7
+ * actual agent-to-agent traffic (own PR, own dataset). This v1 MVP
8
+ * delivers the SPIRIT of the finding with a deterministic pipeline:
9
+ *
10
+ * 1. Extract structured "must-preserve" spans (code fences, inline
11
+ * code, URLs, file paths, tool-call directives) — never compress
12
+ * those; they're load-bearing.
13
+ * 2. Score sentences by keyword density (TF-IDF against a domain
14
+ * stop-list) and keep the top-K sentences that fit `budgetTokens`.
15
+ * 3. Reassemble: preserved spans in original order + top scored
16
+ * sentences.
17
+ *
18
+ * v2 wires a real VQ codec once the training pipeline lands.
19
+ *
20
+ * SCOPE: advisory tool + library. Callers decide whether to use the
21
+ * compressed form. No auto-wire into SendMessage / hooks in v1.
22
+ */
23
+ /** Result of a compression pass. */
24
+ export interface CompressionResult {
25
+ original: string;
26
+ compressed: string;
27
+ stats: {
28
+ originalTokens: number;
29
+ compressedTokens: number;
30
+ compressionRatio: number;
31
+ preservedSpans: number;
32
+ sentencesKept: number;
33
+ sentencesTotal: number;
34
+ /** Rough info-retention proxy: fraction of top-quartile-scored sentences kept. */
35
+ infoRetainedEstimate: number;
36
+ };
37
+ }
38
+ export interface CompressOptions {
39
+ /**
40
+ * Target token budget. The compressor keeps preserved spans first
41
+ * (they're mandatory) and then fills the remaining budget with the
42
+ * highest-scored sentences. Approximate — actual output may exceed
43
+ * budget by up to one sentence if a preserved span is very large.
44
+ */
45
+ budgetTokens?: number;
46
+ /**
47
+ * Mode:
48
+ * 'keyword' → sentence score = sum(TF-IDF-approx) of unique keywords
49
+ * 'sentence' → sentence score = length + position penalty (favor lead)
50
+ * 'hybrid' → 0.7·keyword + 0.3·sentence (default)
51
+ */
52
+ mode?: 'keyword' | 'sentence' | 'hybrid';
53
+ }
54
+ /** ~1 token per 4 chars — matches the OpenAI/Anthropic rule-of-thumb. */
55
+ export declare function estimateTokens(text: string): number;
56
+ export declare function compressMessage(message: string, options?: CompressOptions): CompressionResult;
57
+ //# sourceMappingURL=message-compressor.d.ts.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.32.19",
3
+ "version": "3.32.20",
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",