Files
rUv 402b701a9d fix(security): ADR-165 Phase 1 — close 5 critical CVEs + refresh registry + audit CI gate (#2508)
* fix(security): ADR-165 Phase 1 — close all critical CVEs, refresh registry, add CI gate

Closes ADR-165 Phase 1. Both workspaces pass `npm audit --audit-level=critical`.

## Before (2026-06-29)

| Workspace | Critical | High | Moderate | Total |
|-----------|----------|------|----------|-------|
| Root      | **1**    | 6    | 31       | 38    |
| v3        | **4**    | 33   | 57       | 97    |

## After

| Workspace | Critical | High | Moderate | Total |
|-----------|----------|------|----------|-------|
| Root      | **0**    | 0    | 31       | 31    |
| v3        | **0**    | 27   | 58       | 88    |

All 5 critical advisories closed (vitest GHSA-5xrq, handlebars prototype-pollution,
protobufjs constructor-pollution, plus 2 more in v3). 12 of 39 high advisories
closed via overrides; the remaining 27 v3 highs are deeper transitive chains
that would require breaking-change major bumps — flagged for ADR-165 Phase 2.

## Changes

### Root workspace overrides (package.json)

- `vitest`: `^1.0.0` → `^3.2.6` (closes critical GHSA-5xrq CVSS 9.8)
- `hono`: `>=4.11.4` → `>=4.12.25` (closes 6 hono advisories)
- `undici`: `>=7.18.0` → `>=8.5.0` (closes 7 undici advisories — bumps the
  stale pin that ADR-165 flagged as still-in-vulnerable-range)
- `vite`: `>=6.4.6` → `>=8.0.16` (closes 2 vite advisories)
- NEW `@grpc/grpc-js`: `>=1.14.4`
- NEW `form-data`: `>=4.0.6`
- NEW `http-proxy-middleware`: `>=3.0.7`
- `@hono/node-server`: `>=1.19.10` → `>=1.19.14`

### v3 workspace overrides (v3/package.json + pnpm.overrides)

- `vitest`: `^4.0.16` → `^4.1.0` (and `@vitest/coverage-v8` matched)
- Top-level + pnpm overrides: `handlebars: >=4.7.9`, `protobufjs: >=8.6.0`
- 27 sub-package `package.json` updated to `vitest ^4.1.0`

### CVE registry refresh (v3/@claude-flow/security/src/CVE-REMEDIATION.ts)

Rewritten from 5 stale Jan-2026 entries to 16 total: 15 fixed, 1 open
(ADR165-OPEN-01 — PII pipeline wiring per ADR-164 §6.1 not yet on
dispatch-layer). `SECURITY_SUMMARY` is now computed dynamically from the
registry; `validateRemediation()` correctly returns `allFixed: false`
with 1 issue. ADR-165 §5 flagged this as THE Phase 2 priority — now closed.

### New CI gate

`.github/workflows/cve-audit.yml`:
- `audit-root` — `npm audit --audit-level=critical` in root, blocking
- `audit-v3` — same in v3, blocking
- `audit-high-report` — warn-only summary on high-severity drift
- Triggers: PR, push to main, daily cron

### ADR-165 §9 evidence ledger addendum

Captures AFTER-remediation `npm audit --json` metadata for both workspaces.
The diff between BEFORE (already in §9) and AFTER makes Phase 1 verifiable.

Also CORRECTED one prior surprise in §9: the `validate-input.ts` in
`mcp-tools/` is NOT a 9-line shim. It's 269 lines of real implementation.
(That was an inaccurate findings note from the initial audit.)

### §7.3 research items resolved

- `protobufjs` v3 chain confirmed gone after override pins
- `handlebars` v3 chain confirmed not user-reachable on the workflow path
  (toolchain-only; override sufficient)
- `validate-input.ts` confirmed real implementation, not a shim (registry
  entry corrected)
- CORS surface check: no `cors()` / `app.use(cors` call sites — the hono
  CORS-wildcard advisory is not exploitable on the current server
- ADR-164 §6.1 PII pipeline NOT wired in current agentbbs dispatch —
  recorded as ADR165-OPEN-01 (Phase 3 work)

## Gates (all PASS)

- `npm audit --audit-level=critical` root: exit 0 (was non-zero)
- `npm audit --audit-level=critical` v3:   exit 0 (was non-zero)
- vitest suites: 105/109 pass (4 skip-conditional — same as before)
- ADR-112 audit: 352/352 tools with guidance
- business-pods smoke: 11/11 PASS
- agentbbs smoke: 8/8 PASS
- agenticow smoke: 8/8 PASS
- cli build: clean (tsc)

## Phase 2+ deferred

The 27 v3 high-severity advisories that remain are transitive chains with
no patched-in-range version. ADR-165 §6 Phase 2 picks these up after the
`cve-watch.yml` automation in §6 lands (NEW PR — not in scope here).

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01WbBa4nccx5aGhXphoHxcni

* chore(lock): regen v3/pnpm-lock.yaml after override updates (PR #2508 CI fix)

PR #2508 added handlebars + protobufjs to v3 overrides + bumped vitest pin,
but v3/pnpm-lock.yaml wasn't regenerated. CI surfaced
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH on every install step.

Same pattern as the previous lockfile-drift fixes on PR #2500 and #2503.

* fix(ci): cve-audit.yml jq-only + regen witness manifests for #1609 marker drift

Two PR #2508 CI failures fixed:

1. Static-regression-guard tripped on cve-audit.yml line 52: the static
   YAML strict-parser sees `if high > 0:` inside the `run: |` block as
   a YAML block-mapping key indicator. Refactored all 3 inline-python
   blocks to use jq (preinstalled on ubuntu-latest) — no embedded
   `if x > 0:` lines, so the YAML guard passes.

2. Witness marker drift smoke flagged fix-marker #1609 — the Phase 1
   vitest bump (4.0.16 → 4.1.0) drifted the cited marker string in
   v3/@claude-flow/aidefence/package.json. Updated `marker` field in
   all 3 platform manifests + `desc` to reference ADR-165 Phase 1, then
   re-signed via plugins/ruflo-core/scripts/witness/regen.mjs.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-29 22:41:24 -04:00
..

@claude-flow/plugin-neural-coordination

npm version license downloads

A cutting-edge multi-agent coordination plugin combining the SONA self-optimizing neural architecture with graph neural networks for agent communication topology optimization. The plugin enables emergent protocol development, neural consensus mechanisms, collective memory formation, and adaptive swarm behavior while maintaining interpretability of agent interactions.

Installation

npm

npm install @claude-flow/plugin-neural-coordination

CLI

npx claude-flow plugins install --name @claude-flow/plugin-neural-coordination

Quick Start

import { NeuralCoordinationPlugin } from '@claude-flow/plugin-neural-coordination';

// Initialize the plugin
const plugin = new NeuralCoordinationPlugin();
await plugin.initialize();

// Achieve consensus among agents
const consensus = await plugin.neuralConsensus({
  proposal: {
    topic: 'architecture-decision',
    options: [
      { id: 'microservices', value: { pattern: 'microservices', complexity: 'high' } },
      { id: 'monolith', value: { pattern: 'monolith', complexity: 'low' } }
    ],
    constraints: { maxLatency: 100, minReliability: 0.99 }
  },
  agents: [
    { id: 'architect', preferences: { scalability: 0.8, simplicity: 0.2 } },
    { id: 'ops', preferences: { scalability: 0.3, simplicity: 0.7 } },
    { id: 'developer', preferences: { scalability: 0.5, simplicity: 0.5 } }
  ],
  protocol: 'iterative_refinement',
  maxRounds: 10
});

console.log('Consensus reached:', consensus.decision);

Available MCP Tools

1. coordination/neural-consensus

Achieve agent consensus using neural negotiation protocols.

const result = await mcp.call('coordination/neural-consensus', {
  proposal: {
    topic: 'resource-allocation',
    options: [
      { id: 'option-a', value: { cpus: 4, memory: '8GB' } },
      { id: 'option-b', value: { cpus: 8, memory: '4GB' } }
    ],
    constraints: { budget: 100 }
  },
  agents: [
    { id: 'agent-1', preferences: { performance: 0.9 }, constraints: {} },
    { id: 'agent-2', preferences: { cost: 0.8 }, constraints: {} }
  ],
  protocol: 'neural_voting',
  maxRounds: 5
});

Returns: Consensus decision with voting breakdown, confidence scores, and round-by-round negotiation history.

2. coordination/topology-optimize

Optimize agent communication topology for efficiency using GNN analysis.

const result = await mcp.call('coordination/topology-optimize', {
  agents: [
    { id: 'coordinator', capabilities: ['planning', 'delegation'], location: { zone: 'us-east' } },
    { id: 'worker-1', capabilities: ['coding'], location: { zone: 'us-east' } },
    { id: 'worker-2', capabilities: ['testing'], location: { zone: 'us-west' } }
  ],
  objective: 'minimize_latency',
  constraints: {
    maxConnections: 10,
    minRedundancy: 2,
    preferredTopology: 'hybrid'
  }
});

Returns: Optimized communication graph with connection weights and routing recommendations.

3. coordination/collective-memory

Manage shared collective memory across agent swarms.

const result = await mcp.call('coordination/collective-memory', {
  action: 'store',
  memory: {
    key: 'project-context',
    value: { requirements: [...], decisions: [...] },
    importance: 0.9,
    expiry: '2025-12-31T23:59:59Z'
  },
  scope: 'team',
  consolidationStrategy: 'ewc'
});

Returns: Memory operation status with synchronization metadata across agents.

4. coordination/emergent-protocol

Develop emergent communication protocols through multi-agent reinforcement learning.

const result = await mcp.call('coordination/emergent-protocol', {
  task: {
    type: 'cooperative_search',
    objectives: ['find_target', 'minimize_time'],
    constraints: { maxSteps: 100 }
  },
  communicationBudget: {
    symbolsPerMessage: 10,
    messagesPerRound: 3
  },
  trainingEpisodes: 1000,
  interpretability: true
});

Returns: Learned communication protocol with symbol vocabulary and usage patterns.

5. coordination/swarm-behavior

Orchestrate emergent swarm behaviors using neural coordination.

const result = await mcp.call('coordination/swarm-behavior', {
  behavior: 'task_allocation',
  parameters: {
    taskQueue: [...],
    priorityWeights: { urgency: 0.7, complexity: 0.3 }
  },
  adaptiveRules: true,
  observability: {
    recordTrajectories: true,
    measureEmergence: true
  }
});

Returns: Swarm behavior execution plan with agent assignments and adaptation metrics.

Configuration Options

interface NeuralCoordinationConfig {
  // Maximum number of agents in coordination (default: 1000)
  maxAgents: number;

  // Memory limit per agent (default: 1GB)
  memoryLimitPerAgent: number;

  // Consensus timeout per round in ms (default: 60000)
  consensusTimeoutMs: number;

  // Enable Byzantine fault tolerance (default: true)
  enableBFT: boolean;

  // Message signing for security (default: true)
  signMessages: boolean;

  // Supported consensus protocols
  protocols: ('neural_voting' | 'iterative_refinement' | 'auction' | 'contract_net')[];
}

Performance Targets

Metric Target Improvement vs Baseline
Consensus convergence (100 agents) <100 rounds 10x faster
Communication overhead <10% of total compute 3x reduction
Topology optimization (1000 nodes) <1s 60x faster
Memory synchronization <100ms eventual consistency 10x faster
Emergent protocol training <1 hour for basic tasks Novel capability

Security Considerations

  • Agent Authentication: Every agent must be authenticated with signed credentials before joining coordination
  • Message Signing: All inter-agent messages are cryptographically signed (Ed25519) to prevent spoofing
  • Byzantine Fault Tolerance: Consensus tolerates up to f < n/3 malicious/faulty agents
  • Sybil Attack Prevention: Agent credential verification and rate limiting prevent fake agent multiplication
  • Memory Encryption: Collective memory is encrypted at rest (AES-256-GCM) with session-specific keys
  • Input Validation: All inputs validated with Zod schemas to prevent injection attacks

WASM Security Constraints

Constraint Value Rationale
Memory Limit per Agent 1GB max Prevent resource exhaustion
CPU Time per Round 60 seconds Prevent consensus deadlock
No External Network Enforced Isolated agent communication only
Signed Messages Ed25519 required Prevent message tampering
Session Isolation Per-coordination Prevent cross-session leakage

Rate Limits

Tool Requests/Minute Max Concurrent
neural-consensus 10 2
topology-optimize 5 1
collective-memory 100 10
emergent-protocol 1 1
swarm-behavior 10 2

Input Limits

Constraint Limit
Max agents per coordination 1,000
Max message size 1MB
Max rounds per consensus 1,000
Memory limit per agent 1GB
CPU time per round 60 seconds

Dependencies

  • sona - Self-Optimizing Neural Architecture for agent adaptation
  • ruvector-gnn-wasm - Communication graph optimization and message routing
  • ruvector-nervous-system-wasm - Neural coordination layer for collective behavior
  • ruvector-attention-wasm - Multi-head attention for agent-to-agent communication
  • ruvector-learning-wasm - Multi-agent reinforcement learning (MARL)

Use Cases

  1. Distributed Problem Solving: Coordinate agents to solve complex decomposed problems
  2. Negotiation Systems: Multi-party negotiation with optimal outcomes
  3. Swarm Robotics: Emergent collective behaviors for physical agents
  4. Federated Learning: Coordinate model training across distributed agents
  5. Market Simulation: Agent-based modeling with realistic interactions
Plugin Description Synergy
@claude-flow/plugin-cognitive-kernel Cognitive augmentation with working memory Enhances individual agent reasoning within coordinated swarms
@claude-flow/plugin-quantum-optimizer Quantum-inspired optimization Optimizes task allocation and resource scheduling across agents
@claude-flow/plugin-hyperbolic-reasoning Hierarchical reasoning Enables hierarchical agent organization and taxonomic coordination

License

MIT