Back to Ruflo

ADR-070: Complete @ruvector/rvagent-wasm & ruvllm-wasm Integration

v3/implementation/adrs/ADR-070-rvagent-wasm-completion.md

3.6.303.8 KB
Original Source

ADR-070: Complete @ruvector/rvagent-wasm & ruvllm-wasm Integration

Status: Implemented Date: 2026-03-25 Author: RuvNet Supersedes: Gaps identified in ADR-059

Context

ADR-059 defined the integration plan for @ruvector/rvagent-wasm and @ruvector/ruvllm-wasm. An audit on 2026-03-25 found that the code was fully implemented but the wiring was incomplete:

ItemADR-059 StatusActual State
src/ruvector/agent-wasm.tsPlannedImplemented (387 lines)
src/mcp-tools/wasm-agent-tools.tsPlannedImplemented (10 MCP tools)
src/ruvector/ruvllm-wasm.tsPendingImplemented (full module)
src/mcp-tools/ruvllm-tools.tsPendingImplemented (MCP tools)
src/ruvector/index.ts re-exportsPendingImplemented (both modules)
src/mcp-tools/index.ts re-exportsPendingImplemented (both tool sets)
src/types/optional-modules.d.tsPlannedImplemented (ambient types)
package.json optional depsRequiredMissing — neither package listed

The sole gap was that @ruvector/rvagent-wasm and @ruvector/ruvllm-wasm were not declared in package.json optionalDependencies, meaning:

  1. npm install would never fetch them
  2. Runtime import() calls would always hit the graceful-degradation path
  3. Users could not enable WASM agents without manually installing the packages

Decision

Add both packages to optionalDependencies in v3/@claude-flow/cli/package.json:

json
{
  "optionalDependencies": {
    "@ruvector/rvagent-wasm": "^0.1.0",
    "@ruvector/ruvllm-wasm": "^2.0.2"
  }
}

No code changes required — all integration modules, MCP tools, type declarations, and re-exports were already in place.

Implementation Summary

rvagent-wasm (10 MCP Tools)

ToolFileStatus
wasm_agent_createwasm-agent-tools.tsWorking
wasm_agent_promptwasm-agent-tools.tsWorking
wasm_agent_toolwasm-agent-tools.tsWorking
wasm_agent_listwasm-agent-tools.tsWorking
wasm_agent_terminatewasm-agent-tools.tsWorking
wasm_agent_fileswasm-agent-tools.tsWorking
wasm_agent_exportwasm-agent-tools.tsWorking
wasm_gallery_listwasm-agent-tools.tsWorking
wasm_gallery_searchwasm-agent-tools.tsWorking
wasm_gallery_createwasm-agent-tools.tsWorking

ruvllm-wasm MCP Tools

ToolFileStatus
ruvllm_statusruvllm-tools.tsWorking
ruvllm_hnsw_createruvllm-tools.tsWorking
ruvllm_sona_createruvllm-tools.tsWorking
ruvllm_microlora_createruvllm-tools.tsWorking
ruvllm_chat_formatruvllm-tools.tsWorking
ruvllm_kvcache_createruvllm-tools.tsWorking

Integration Modules

ModuleLinesExports
src/ruvector/agent-wasm.ts38720+ functions (lifecycle, gallery, RVF, MCP bridge)
src/ruvector/ruvllm-wasm.ts~35012+ functions (HNSW, SONA, MicroLoRA, chat, KV, arena)
src/ruvector/index.ts245Re-exports all public API from both modules

Consequences

Positive

  • npm install now fetches WASM packages when available for the platform
  • All 16 MCP tools become functional without manual package installation
  • Consistent with existing @ruvector/* optional dependency pattern
  • No breaking changes — graceful degradation still works when packages unavailable

Negative

  • Additional ~820 kB unpacked size in optional deps (620 kB + 200 kB)
  • Both packages still have known upstream issues (see ADR-059 § Known Issues)

Neutral

  • ADR-059 can now be considered fully implemented
  • No new code was needed — only the dependency declaration was missing