There is no
@ruvector/lattice-wasmpackage — it 404s on npm, and no "Lattice" embedder package exists in the ruvector ecosystem. The models below (bge / qwen3-0.6b / paraphrase-miniLM) exist only in a Rust ONNX example, not a publishable package. What actually shipped in 3.25.0 is a fail-closed, optional adapter seam that degrades to ruvector-ONNX → hash when the (nonexistent) package is absent — so it is DORMANT / no-op today and causes no regression, but it is NOT a working multi-model embedder. The rest of this document describes the intended design; treat it as a proposal for a real embedder, not a shipped capability. Follow-up: remove the seam or wire it to a real embedder.
TL;DR — ruflo now supports a real, multi-model WASM embedder as the primary embedding tier, ahead of the existing ONNX/hash path. It's optional, fail-closed, and zero-regression: if the package isn't installed, embeddings resolve exactly as before. When it is present, retrieval runs on better/more embedding models (miniLM, bge, multi-paraphrase-miniLM, GPU qwen3-0.6b).
The self-learning flywheel tunes the retrieval policy, but a policy is only as good as the vectors underneath it. Auditing ruflo's embedding substrate showed a split:
| Path | Reality |
|---|---|
neural_patterns / memory search (ruvector) |
Real ONNX all‑MiniLM‑L6‑v2 (384‑dim) when ruvector loads |
| Fallback when ruvector/ONNX unavailable | hash placeholder (deterministic, semantically meaningless) |
| Native‑rust ruvllm memory, memory controller, ruview text | hash placeholders |
On a hash‑fallback install, cosine similarity is noise — so "semantic" retrieval (and anything the flywheel optimizes over it) is limited there. The fix: put a real, multi‑model embedder in front of everything, without making it a hard dependency.
Note: the flywheel's shipped results (RR 0.496→0.758→0.847, the +0.0738 mint) were all measured on the real ONNX path (
_realEmbedding: true), so those stand. This work raises the floor (real embeddings where there were placeholders) and the ceiling (models better than miniLM).
(a) Primary tier — done + verified. @ruvector/ruvllm-wasm‑style optional WASM adapter (src/ruvector/lattice-wasm.ts) wired as Tier ‑1 in neural_patterns' ensureEmbeddings(), ahead of ruvector‑ONNX → hash.
(b) Hash placeholders — partial. The primary memory/retrieval + memory-bridge paths route through generateEmbedding(), so they get Lattice‑first automatically. Converging the remaining native‑rust ruvllm / memory‑controller / ruview stub sites is a scoped follow‑up.
(c) Model selection — scaffolded. The adapter is model‑parameterized and env‑selectable now; adding embedding‑model as a flywheel axis is a follow‑up gated on a multi‑model backend being installed to benchmark against.
Tier order (first available wins):
Tier -1 Lattice WASM ← NEW primary: miniLM / bge / paraphrase-miniLM / qwen3-0.6b
Tier 0 ruvector ONNX (bundled all-MiniLM-L6-v2)
Tier 1-3 agentic-flow / @claude-flow/embeddings
Fallback hash (deterministic, non-semantic)
Fail-closed by construction:
- The package is loaded via a dynamic import that catches — absent ⇒
null⇒ tier skipped. - WASM init (
initSync({module: bytes}), ruvnet convention) is wrapped — init failure ⇒ tier skipped. - The API is probed tolerantly across plausible wasm-bindgen surfaces (
embed(text, model),embed(text),embedText,new Embedder(model).embed) — an unexpected shape ⇒ tier skipped. - A real-embed verification probe runs before the tier is accepted (guards the "type-loads-but-runtime-fails" trap) — probe fails ⇒ tier skipped.
- If any of these skip, callers fall straight through to ruvector-ONNX → hash. Zero regression.
Verified with the package absent:
latticeAvailable() → false
latticeEmbed('...') → null
neural_patterns embeddingProvider → ruvector@0.2.27 (bundled all-MiniLM-L6-v2), _realEmbedding: true
| Env var | Effect | Default |
|---|---|---|
RUFLO_LATTICE_WASM_PKG |
Package specifier for the Lattice WASM module | @ruvector/lattice-wasm |
RUFLO_EMBED_MODEL |
Which model to use | minilm |
# Upgrade
npx ruflo@latest # or npx ruflo@3.25.0
# Once the Lattice WASM package is installed, it becomes the primary tier
# automatically. Select a model:
export RUFLO_EMBED_MODEL=bge # or paraphrase-minilm, qwen3-0.6b
# Point at a differently-named/located package if needed:
export RUFLO_LATTICE_WASM_PKG=@ruvector/lattice-wasm- qwen3-0.6b (GPU) is opt-in — selected only when explicitly requested.
- No action needed to stay safe: absent the package, behavior is unchanged.
- Additive · backwards-compatible · fail-closed. No breaking changes; embeddings degrade to today's path when Lattice is absent.
@ruvector/lattice-wasmis NOT a hard dependency — it's an optional runtime dynamic import (never added topackage.json), so installs never break if it's unavailable.- Signing keys unchanged.
To guarantee activation (rather than tolerant probing), confirm:
- the exact published package name (set
RUFLO_LATTICE_WASM_PKGor pin it), - the embed export signature (name +
(text, model) → vectorshape), and - whether qwen3-0.6b requires a GPU at runtime or degrades.
With those, the follow-ups finalize: converge the remaining ruvllm/controller/ruview stubs onto the shared chain, and wire embedding-model as a real flywheel dimension (optimized against the frozen human eval + self-supervised held-out).
Packages: @claude-flow/cli@3.25.0, claude-flow@3.25.0, ruflo@3.25.0
Release: https://github.com/ruvnet/ruflo/releases/tag/v3.25.0