claude-flow 3.32.12 → 3.32.14

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.12",
3
+ "version": "3.32.14",
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-27T00:21:28.157Z",
5
- "gitSha": "13a3421f",
4
+ "generatedAt": "2026-07-27T02:19:54.128Z",
5
+ "gitSha": "8a884a06",
6
6
  "catalog": {
7
7
  "agents": 164,
8
8
  "tools": 387,
@@ -644,15 +644,68 @@ const routeCommand = {
644
644
  description: 'Number of top agent suggestions',
645
645
  type: 'number',
646
646
  default: 3
647
- }
647
+ },
648
+ {
649
+ // #2778 dream-cycle — Mixture-of-Agents test-time scaling.
650
+ // When `--mode moa` is set AND the router would have chosen a
651
+ // Tier-3 model (Sonnet/Opus), swap to N parallel Tier-2 (Haiku)
652
+ // calls + majority-vote consensus. Grade-A ACL 2026 SRW evidence
653
+ // (arXiv 2605.01566): +2.7pp accuracy at equal-cost when parallel
654
+ // generations exceed sequential aggregations.
655
+ name: 'mode',
656
+ description: 'Routing mode: single (default) or moa (mixture-of-agents fanout, #2778)',
657
+ type: 'string',
658
+ choices: ['single', 'moa'],
659
+ default: 'single',
660
+ },
661
+ {
662
+ // #2778 canonical fanout-width flag. Restored to `--parallel` in
663
+ // v3.32.14 after the parser scoping fix landed (subcommand's
664
+ // non-boolean declaration now overrides the global boolean set,
665
+ // so `--parallel 7` on `hooks route` no longer collides with the
666
+ // boolean `--parallel` on `swarm start` / `workflow run`).
667
+ // NOTE: no `default:` here — default is resolved in the action so
668
+ // we can distinguish "user explicitly passed --parallel" from
669
+ // "user passed --moa-parallel (the v3.32.13 compat alias)". Without
670
+ // this, the parser's applied default would shadow the alias.
671
+ name: 'parallel',
672
+ short: 'p',
673
+ description: 'MoA fanout width (N parallel calls at Haiku tier; only meaningful when --mode=moa)',
674
+ type: 'number',
675
+ },
676
+ {
677
+ // v3.32.13 compat alias — kept so any users who upgraded to that
678
+ // release keep working. Prefer `--parallel` going forward.
679
+ name: 'moa-parallel',
680
+ description: 'DEPRECATED alias for --parallel (kept for v3.32.13 backward compat)',
681
+ type: 'number',
682
+ },
683
+ {
684
+ name: 'consensus',
685
+ description: 'MoA consensus strategy: majority-vote (default) or best-confidence',
686
+ type: 'string',
687
+ choices: ['majority-vote', 'best-confidence'],
688
+ default: 'majority-vote',
689
+ },
648
690
  ],
649
691
  examples: [
650
- { command: 'claude-flow hooks route -t "Fix authentication bug"', description: 'Route task to optimal agent' },
651
- { command: 'claude-flow hooks route -t "Optimize database queries" -K 5', description: 'Get top 5 suggestions' }
692
+ { command: 'claude-flow hooks route -t "Fix authentication bug"', description: 'Route task to optimal agent (single mode)' },
693
+ { command: 'claude-flow hooks route -t "Optimize database queries" -K 5', description: 'Get top 5 suggestions' },
694
+ { command: 'claude-flow hooks route -t "Design payment webhook" --mode moa --parallel 3', description: 'MoA fanout: 3× Haiku + consensus (dream-cycle #2778)' },
652
695
  ],
653
696
  action: async (ctx) => {
654
697
  const task = ctx.flags.task || ctx.args[0];
655
698
  const topK = ctx.flags.topK || 3;
699
+ const mode = ctx.flags.mode || 'single';
700
+ // #2778: prefer canonical --parallel; fall back to --moa-parallel
701
+ // (v3.32.13 compat alias). Nullish coalescing so an explicit 0 still
702
+ // falls through to the alias / default, and neither flag being set
703
+ // resolves to 3 (the ACL 2026 SRW paper's baseline fanout width).
704
+ const parallelRaw = ctx.flags.parallel
705
+ ?? ctx.flags.moaParallel
706
+ ?? 3;
707
+ const parallel = Math.max(2, parallelRaw);
708
+ const consensus = ctx.flags.consensus || 'majority-vote';
656
709
  if (!task) {
657
710
  output.printError('Task description is required. Use --task or -t flag.');
658
711
  return { success: false, exitCode: 1 };
@@ -666,6 +719,35 @@ const routeCommand = {
666
719
  topK,
667
720
  includeEstimates: true,
668
721
  });
722
+ // #2778 — compute the MoA plan BEFORE the JSON output branch so
723
+ // programmatic callers see `moaPlan` in the JSON result too.
724
+ let moaPlan = null;
725
+ if (mode === 'moa') {
726
+ const complexity = result.estimatedMetrics?.complexity ?? 'medium';
727
+ const wouldTier3 = complexity === 'high';
728
+ const primaryAgent = result.primaryAgent.type;
729
+ const agents = Array.from({ length: parallel }, (_, i) => ({
730
+ name: `moa-${primaryAgent}-${i + 1}`,
731
+ model: 'haiku',
732
+ role: primaryAgent,
733
+ }));
734
+ moaPlan = {
735
+ mode: 'moa',
736
+ parallel,
737
+ tier: 'tier2-haiku',
738
+ consensus,
739
+ rationale: wouldTier3
740
+ ? `Complexity=${complexity} would tier-3 (Sonnet/Opus). MoA fanout — ${parallel}× Haiku is typically <1× Sonnet cost (arXiv 2605.01566: +2.7pp at equal cost).`
741
+ : `Complexity=${complexity} — MoA still available as a diversity mechanism, but the single-agent path is usually the cost-optimal choice below Tier-3.`,
742
+ agents,
743
+ synthesizer: {
744
+ name: `moa-synth-${primaryAgent}`,
745
+ model: 'haiku',
746
+ role: 'synthesizer',
747
+ },
748
+ };
749
+ result.moaPlan = moaPlan;
750
+ }
669
751
  if (ctx.flags.format === 'json') {
670
752
  output.printJson(result);
671
753
  return { success: true, data: result };
@@ -719,6 +801,23 @@ const routeCommand = {
719
801
  `Complexity: ${result.estimatedMetrics.complexity.toUpperCase()}`
720
802
  ]);
721
803
  }
804
+ // #2778 dream-cycle — render the MoA plan to text output. moaPlan
805
+ // was already spliced into the result above so JSON consumers see it.
806
+ if (mode === 'moa' && moaPlan) {
807
+ const primaryAgent = result.primaryAgent.type;
808
+ output.writeln();
809
+ output.writeln(output.bold('Mixture-of-Agents Plan (#2778)'));
810
+ output.printList([
811
+ `Mode: moa`,
812
+ `Fanout: ${parallel} parallel ${primaryAgent} × Haiku`,
813
+ `Consensus: ${consensus}`,
814
+ `Synthesizer: 1 Haiku agent (${consensus} over ${parallel} verdicts)`,
815
+ ]);
816
+ output.writeln();
817
+ output.printBox(`Spawn ${parallel} background Task calls with model="haiku" and subagent_type="${primaryAgent}"\n` +
818
+ `then a synthesizer Task ("moa-synth-${primaryAgent}") that reads all ${parallel} results and picks the ${consensus === 'majority-vote' ? 'majority answer' : 'highest-confidence answer'}.\n\n` +
819
+ `Cost note: ${parallel}× Haiku is typically <1× Sonnet on comparable complexity — see arXiv 2605.01566 for the ACL 2026 evidence.`, 'MoA Execution Directive');
820
+ }
722
821
  return { success: true, data: result };
723
822
  }
724
823
  catch (error) {
@@ -78,6 +78,20 @@ export declare class CommandParser {
78
78
  private buildScopedAliases;
79
79
  /**
80
80
  * Get boolean flags scoped to a specific command/subcommand.
81
+ *
82
+ * `getBooleanFlags()` walks EVERY command + subcommand in the registry
83
+ * and adds their boolean options into one flat set. That's convenient
84
+ * for the common case but causes cross-subcommand pollution: if `swarm
85
+ * start --parallel` is boolean AND `hooks route --parallel` is numeric,
86
+ * the flat set marks `parallel` as boolean, and `hooks route --parallel 7`
87
+ * drops the `7` as a positional (parseFlag treats booleanFlags-hit as
88
+ * "consume no value"). This is the exact bug that forced the
89
+ * --moa-parallel rename in the 2026-07-26 dream-cycle #2778 fix.
90
+ *
91
+ * Fix: if the resolved subcommand declares the flag as a non-boolean
92
+ * type, REMOVE it from the boolean set. Narrowest scope wins.
93
+ * (Documented via in-tree comment in commands/hooks.ts and the #2778
94
+ * commit message.)
81
95
  */
82
96
  private getScopedBooleanFlags;
83
97
  private getBooleanFlags;
@@ -406,13 +406,34 @@ export class CommandParser {
406
406
  }
407
407
  /**
408
408
  * Get boolean flags scoped to a specific command/subcommand.
409
+ *
410
+ * `getBooleanFlags()` walks EVERY command + subcommand in the registry
411
+ * and adds their boolean options into one flat set. That's convenient
412
+ * for the common case but causes cross-subcommand pollution: if `swarm
413
+ * start --parallel` is boolean AND `hooks route --parallel` is numeric,
414
+ * the flat set marks `parallel` as boolean, and `hooks route --parallel 7`
415
+ * drops the `7` as a positional (parseFlag treats booleanFlags-hit as
416
+ * "consume no value"). This is the exact bug that forced the
417
+ * --moa-parallel rename in the 2026-07-26 dream-cycle #2778 fix.
418
+ *
419
+ * Fix: if the resolved subcommand declares the flag as a non-boolean
420
+ * type, REMOVE it from the boolean set. Narrowest scope wins.
421
+ * (Documented via in-tree comment in commands/hooks.ts and the #2778
422
+ * commit message.)
409
423
  */
410
424
  getScopedBooleanFlags(resolvedCmd) {
411
425
  const flags = this.getBooleanFlags();
412
426
  if (resolvedCmd?.options) {
413
427
  for (const opt of resolvedCmd.options) {
428
+ const key = this.normalizeKey(opt.name);
414
429
  if (opt.type === 'boolean') {
415
- flags.add(this.normalizeKey(opt.name));
430
+ flags.add(key);
431
+ }
432
+ else if (opt.type) {
433
+ // Subcommand explicitly re-declares this flag as a non-boolean
434
+ // type (string/number/array) — narrowest scope wins, so drop
435
+ // it from the boolean set to override any global pollution.
436
+ flags.delete(key);
416
437
  }
417
438
  }
418
439
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.32.12",
3
+ "version": "3.32.14",
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",