npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ruvector

v0.3.29

Published

Self-learning vector database for Node.js: native HNSW vector search, ONNX embeddings, GNN, attention, SONA routing and an MCP server for agents.

Readme

ruvector: vector search and persistent agent memory

ruvector: text or vector → embeddings → HNSW search → ranked results

RuVector memory and feedback loop

npm version License

The ruvector npm package provides Node.js vector storage, semantic memory commands, and MCP integration. It is part of Reuven Cohen's RuVector stack. Specialized graph, learning, browser, and runtime libraries have their own packages and setup.

Quick start · Claude Code · Node.js tutorial · Full library catalog

Quick start

Run in your project directory:

npm install ruvector
npx ruvector info
npx ruvector hooks remember --semantic --type decision "Keep customer inference in Canada."
npx ruvector hooks recall --semantic --top-k 3 "Where should inference run?"

Memories and vector stores support full create, read, update and delete:

npx ruvector hooks memory-list --type decision          # ids, newest first
npx ruvector hooks memory-update <id> --content "Keep customer inference in Canada and the EU."
npx ruvector hooks forget <id>

npx ruvector create vectors.db -d 384                   # vector store
npx ruvector insert vectors.db data.json                # [{id, vector, metadata?}], existing ids are replaced
npx ruvector get vectors.db doc-1
npx ruvector update vectors.db doc-1 --metadata '{"tag":"reviewed"}' --merge
npx ruvector delete vectors.db doc-1 doc-2

The same operations are available as MCP tools (hooks_memory_*, hooks_forget, vectordb_*) and in the library (VectorDB#insert/get/update/delete/deleteMany).

The first semantic command downloads a local embedding model. Memory belongs to the current project. Run recall again from the same directory in a new terminal to check persistence. Commit your lockfile to preserve dependency resolution.

Backend check: native vector operations require a working native backend. If it cannot load, the limited fallback does not provide persistent vector storage. Browser applications should use the WASM package and tutorial. See supported deployment surfaces.

Claude Code

claude mcp add --scope project --env RUVECTOR_MCP_PROFILE=readonly --transport stdio ruvector -- npx -y ruvector mcp start
claude mcp get ruvector

Open Claude Code in the project, approve the project server when prompted, and check /mcp. Ask it to retrieve relevant project memory and identify the supporting records.

Complete Claude Code instructions and CLAUDE.md sample

Other MCP clients

Use command npx, arguments ["-y", "ruvector", "mcp", "start"], and environment RUVECTOR_MCP_PROFILE=readonly. Launch from the project directory.

npx ruvector mcp tools
RUVECTOR_MCP_PROFILE=readonly npx ruvector mcp start

Available tools vary with package version and policy. RUVECTOR_MCP_DENY overrides allow rules; RUVECTOR_MCP_ALLOW and profiles restrict access. Without a policy, the broader compatibility surface remains available. Policy and agent integration.

Build with the SDK

Follow the Node.js write and reopen tutorial. It uses VectorDB, OnnxEmbedder, and search parameter k, with a separate read process to verify storage.

Node.js API · Current exports

Choose a capability

| System | Start with | Tutorial | | :--- | :--- | :--- | | System 0: Sense and respond | Local embeddings, npm @ruvector/typesafe | Typed decisions | | System 1: Learn and remember | ruvector, @ruvector/kge, @ruvector/sona | Memory, KGE, SONA | | System 2: Reason and orchestrate | MCP, MetaHarness integrations, RVF artifacts | Examples hub, RVF |

Reading memory does not train weights. Learning requires explicit outcomes and an evaluation policy. Contrastive learning and graph coherence provide different signals; neither establishes factual truth.

Optional extras

Some features use packages that are not installed by default. ruvector add installs one into your project with the package manager it finds (npm, pnpm, yarn or bun), after printing what it will install and why.

npx ruvector add --list            # extras, what each enables, installed or not
npx ruvector add rabitq --dry-run  # show the exact install command only
npx ruvector add rabitq diskann

| Extra | Package | Enables | | :--- | :--- | :--- | | rabitq | @ruvector/rabitq-wasm | RabitqIndex: 1-bit quantized search, ~32x smaller codes | | diskann | @ruvector/diskann | DiskAnnIndex: on-disk Vamana index for data larger than RAM | | router | @ruvector/router | ruvector route, SemanticRouter | | graph | @ruvector/graph-node | CodeGraph with Cypher queries | | rvlite | rvlite | rvlite_sql, rvlite_cypher, rvlite_sparql MCP tools | | quantum | @ruvector/ruqu-wasm | ruvector quantum, quantum_simulate / quantum_info MCP tools, ruvector.quantum |

rvf, tiny-dancer and quantum are optional dependencies and are usually present already; add installs them if your install skipped optional packages.

Quantum (ruqu)

ruvector quantum (alias ruvector ruqu) runs state-vector quantum circuits on the ruqu engine, Rust compiled to WebAssembly. The engine is the optional package @ruvector/ruqu-wasm. If it is missing, the command prints npm i @ruvector/ruqu-wasm and exits non-zero. The engine is loaded only from where ruvector itself is installed (install both in the same project, or both globally), never from the working directory, so a node_modules folder inside a cloned repository cannot replace it.

npm i @ruvector/ruqu-wasm                          # if optional deps were skipped
npx ruvector quantum simulate bell                 # |00> and |11> at 0.5 each, plus 1024 sampled shots
npx ruvector quantum simulate ghz:5 --shots 4096 --seed 1
npx ruvector quantum simulate "h 0; rx 1 1.5708; cx 0 2" --json
npx ruvector quantum simulate circuit.json         # {"qubits":2,"gates":[{"gate":"h","qubits":[0]},{"gate":"cnot","qubits":[0,1]}]}
npx ruvector quantum grover --qubits 4 --target 11
npx ruvector quantum bench                         # GHZ at 10, 16 and 20 qubits
npx ruvector quantum info

The gates are h x y z s t rx ry rz cnot/cx cz swap rzz barrier. Measurement is not a circuit op, because the engine would collapse it with unseeded randomness. Use --shots instead: it samples the final state with a seeded PRNG, so the counts are reproducible. Qubit 0 is the rightmost bit, so x 0 on 2 qubits gives |01>.

From code, const { quantum } = require('ruvector'); await quantum.simulate(quantum.ghzCircuit(3), { shots: 1000 }). The accessor is lazy, so neither the wrapper nor the WASM engine loads until you use it. MCP clients get quantum_simulate and quantum_info. Both are in the readonly profile. The MCP caps are 20 qubits (a 16 MiB state vector, since the state takes 2^n × 16 bytes), 10,000 gates, 100,000 shots and the top 256 states. NaN or infinite angles are rejected. The CLI allows up to the engine's 25 qubits.

Measured with ruvector quantum bench (GHZ circuit, median of 7, Node 22, Ryzen 9 9950X):

| Qubits | State vector | Simulate | | ---: | ---: | ---: | | 10 | 16 KiB | 0.11 ms | | 16 | 1 MiB | 5.60 ms | | 20 | 16 MiB | 104.70 ms |

The engine adds 458 KB unpacked to an install. npx ruvector --help cold start was unchanged: 30 ms, against 31 ms before.

Works with: ruqu, the quantum simulator and agent harness (npx @ruvector/ruqu), which this command uses as its engine.

Weight registry (@ruvector/weight-space)

ruvector weights stores ruv-fann model snapshots (ruv-fann.dense-layers/1 JSON) in a versioned registry keyed by a task embedding, so you can find the snapshot saved for the most similar past task. It runs on @ruvector/weight-space, a dependency of ruvector that installs with it and is loaded only when a weights command runs, so it adds nothing to ruvector --help start-up. If an install is incomplete (for example a pruned node_modules), the command prints npm i @ruvector/[email protected] and exits non-zero.

npx ruvector weights save --model model.json --embedding 1,0,0 --task classify --tags v1
npx ruvector weights save --model model.json --text "classify support tickets"   # ONNX embedding
npx ruvector weights nearest --embedding 0.9,0.1,0 -k 5
npx ruvector weights lineage <id>
npx ruvector weights diff <idA> <idB> --json
npx ruvector weights get <id>

# Edit and fine-tune: each writes a CHILD snapshot of <id>; the parent never changes
npx ruvector weights set-layer <id> 0 --patch patch.json        # {"bias":[...]} / weights / activation / steepness; shape cannot change
npx ruvector weights perturb <id> --scale 0.05 --seed 7         # seeded Gaussian noise (same seed, same model); --layers 0,1 --no-bias --relative
npx ruvector weights learn <id> --trajectories rows.json --epochs 300 --learning-rate 0.2

learn trains on rows of {input, output, score, correction?}: a row at or above --success-threshold (default 0.5) trains toward its output, and a failure trains toward its correction (failures without one are skipped). A child snapshot is written only if a held-out check improves by at least --min-improvement (default 1%); otherwise nothing is written and the result says why, with exit code 0. Epochs are capped at 10,000 and trajectories at 10,000 rows.

The registry is an append-only JSON-lines log, .ruvector/weights.jsonl by default (--registry <path>), with a .index.db vector index beside it. All snapshots in one registry share one embedding dimension, so do not mix --text (384-d) and hand-written --embedding vectors in the same registry. Registry and model paths must be inside the working directory. MCP clients get weights_save, weights_nearest, weights_diff and weights_lineage, which take an explicit embedding array, plus the writing tools weights_set_layer, weights_perturb and weights_learn (inline patch / trajectories, or a patch_path / trajectories_path file). All apply the same path rule (plus RUVECTOR_MCP_ROOTS). To expose only the read tools, use RUVECTOR_MCP_DENY=weights_save,weights_set_layer,weights_perturb,weights_learn.

Recipe: route unseen states with neural-q (ruv-fann)

The tabular learning algorithms score a state they have never seen as all zeros. neural-q fits a small MLP Q-function over hashed state features, so refactor:.rs is routed from what was learned on fix:.rs and edit:.rs. It runs on ruv-fann, an optional peer of ruvector. ruv-fann is also a dependency of @ruvector/weight-space, which ruvector now installs, so a default npm install resolves it and neural-q uses the MLP. A package manager that does not expose transitive dependencies to ruvector (pnpm's strict layout, for example) may not; install [email protected] yourself there. Where ruv-fann does not resolve, neural-q behaves exactly like q-learning.

npm i ruvector [email protected]
npx ruvector hooks learning-config -t agent-routing -a neural-q
npx ruvector hooks learn -s fix:.rs -a rust-developer -r 1
npx ruvector hooks learn -s fix:.rs -a coder -r -0.5
npx ruvector hooks learn -s edit:.py -a python-developer -r 1
npx ruvector hooks learn -s edit:.py -a coder -r -0.5
npx ruvector hooks learn -s refactor:.rs --actions coder,rust-developer,python-developer
# {"success":true,"recommendation":{"action":"rust-developer",...,"backend":"ruv-fann"}}

On a held-out benchmark (node scripts/neural-q-bench.js, 9 agents, 5 seeds, every test state unseen in training), unseen-state accuracy was 0.924 for neural-q vs 0.204 for q-learning on hook route keys, and 0.597 vs 0.203 on free-text states. A decision takes about 7 µs vs about 1 µs.

Recipe: knowledge-graph link prediction (@ruvector/kge)

Predict missing facts in a knowledge graph. @ruvector/kge trains HolE / RotatE embeddings on (head, relation, tail) triples locally and ranks candidate tails for a query like (Tim, citizenOf, ?). It is opt-in: ruvector does not depend on it or install it, and it has no runtime dependencies of its own.

npx @ruvector/kge demo

The demo trains on a bundled toy graph of 39 triples with three citizenOf facts held out, then predicts them. Output from a clean install of 0.2.1 (Node 22, under a second):

Trained HolE (dims 64, 500 epochs) on 39 triples: 24 entities, 4 relations.
3 citizenOf facts were held out of training. Predicting them:

(Tim, citizenOf, ?)  held-out answer: UK, rank 1 of 24
  1. UK           3.34  <- held out
  2. Ada          2.68
  3. Alan         2.54

(Simone, citizenOf, ?)  held-out answer: France, rank 1 of 24
  1. France       3.35  <- held out
  2. German       2.70
  3. Manchester   1.49

(Max, citizenOf, ?)  held-out answer: Germany, rank 1 of 24
  1. Germany      3.58  <- held out
  2. English      1.63
  3. Lyon         1.05

Each held-out answer ranks first. To use it from code, npm install @ruvector/kge and see its README.

Coding hooks and harnesses

Hooks reference covers setup, generated configuration, and workflow integration.

npx ruvector hooks --help
npx ruvector hooks verify
npx ruvector harness doctor --json

Review generated hooks before using them. Harness execution and hosted Brain commands have different effects and data boundaries from local retrieval. Start with the governance and deployment guide.

Troubleshooting

| Symptom | Check | | :--- | :--- | | Native backend unavailable | Run npx ruvector info; check platform and native dependency installation | | Empty recall after changing directory | Return to the directory that owns the memory store | | Embedding dimension mismatch | Use the original model and dimension; review npx ruvector hooks reembed --help before migrating | | Claude cannot find the server | Run claude mcp get ruvector, then inspect /mcp in that project | | A write tool is unavailable | Check the configured MCP profile and explicit tool policy |

Benchmarks with scope and evidence · Known boundaries · Issues · MIT license

Works with / Used by

Part of the ruv.io open-source stack for vector database, vector search, embeddings.


Built by rUv · ruv.io · Source