跳到正文
Skillpedia
数据库81k · #1562

vector-search

它能做什么

这项技能说明如何在文本集合中运行相似度搜索,并为任务选择合适的搜索路径。适合需要在较大文档集中查找相关内容的人。

适用场景

  • ✓当你需要在大量文档中按含义搜索的时候。
  • ✓当你的内存有限、希望使用压缩向量存储的时候。
  • ✓当你想比较两个字符串或搜索层级数据的时候。

技能链接

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-agentdb/skills/vector-search/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-agentdb/skills/vector-search/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在我们的 10000 篇支持文章中,找出与这个客户问题含义最接近的文章。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会检查搜索状态,在大规模集合搜索和针对少量热门模式的快速路由器之间进行选择,并返回最接近的匹配结果。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Vector Search

Two distinct vector-search paths live in this plugin. Pick the right one — they're not interchangeable.

Path Tool family Backing Capacity Latency
Large-scale corpus embeddings_* @claude-flow/memory HNSW (Rust/Native) large corpora (measured here only at N=5k and N=20k) ~1.9× at N=20k, ~3.2×–4.7× at N=5k vs brute-force (measured; recall@10 ≈ 0.99). ANN wins above the crossover
Hot-path router ruvllm_hnsw_* WASM-backed router (v2.0.1) ~11 patterns max (ruvllm-tools.ts:58) sub-ms; designed for high-priority routing, not corpus search

The speedups in the Performance section apply to the large-scale embeddings_search path (the older "12,500×" headline was a brute-force-fallback artifact and is retired). The WASM router is not that path.

When to use

Need Path
Search a corpus of N ≥ 500 documents embeddings_search
Memory-constrained corpus (≥5,000 vectors) RaBitQ quantized — see "Quantized search" below
Compare two strings embeddings_compare
Hierarchical / taxonomic data embeddings_hyperbolic (Poincare ball)
Route a query to one of ≤11 hot patterns ruvllm_hnsw_route
Cross-namespace search memory_search_unified

Standard search

  1. Check status — mcp__plugin_ruflo-core_ruflo__embeddings_status to verify the embedding engine.
  2. Initialize — mcp__plugin_ruflo-core_ruflo__embeddings_init if not active.
  3. Generate — mcp__plugin_ruflo-core_ruflo__embeddings_generate for text input.
  4. Search — mcp__plugin_ruflo-core_ruflo__embeddings_search with the query.
  5. Compare — mcp__plugin_ruflo-core_ruflo__embeddings_compare to measure similarity.
  6. Unified search — mcp__plugin_ruflo-core_ruflo__memory_search_unified for cross-namespace.

Quantized search (32× memory reduction)

For corpora ≥5,000 vectors and/or memory-constrained environments, use the RaBitQ 1-bit quantization workflow. Below 5,000 vectors the rebuild cost outweighs the savings — use the standard path instead.

Step Tool Purpose
1 embeddings_init Engine warm
2 embeddings_rabitq_build One-time build of the 1-bit index after corpus is loaded
3 embeddings_rabitq_search Hamming-prefilter returns top-N candidate IDs (cheap)
4 embeddings_search Optional exact rerank on the candidate set (full-precision)
5 embeddings_rabitq_status Index health, memory footprint, build time

Note: embeddings_rabitq_search returns candidate IDs only — the rerank in step 4 is the user's responsibility (mirrors the docstring at embeddings-tools.ts:911). Without rerank, results are approximate; with rerank, you get full-precision quality at 32× lower memory.

Tuning

HNSW exposes three knobs that trade recall against latency. The Performance numbers below were measured at default settings; tune deliberately for your workload and re-measure:

Profile efSearch M When to use
recall-first 200 32 Pattern recall during planning; quality matters more than ms
balanced (default) 64 16 General-purpose semantic recall
latency-first 16 8 Hot-path routing where p99 latency matters

efSearch is passed via ruvllm_hnsw_create (ruvllm-tools.ts:64). M is registry-level today; raise as a follow-up if it should be MCP-tunable. efConstruction defaults to 200 in the lite index (hnsw-index.ts:537).

HNSW pattern router (WASM, ≤11 patterns)

For routing a small number of high-priority patterns:

  • mcp__plugin_ruflo-core_ruflo__ruvllm_hnsw_create — create the WASM index (cap ~11)
  • mcp__plugin_ruflo-core_ruflo__ruvllm_hnsw_add — add a pattern
  • mcp__plugin_ruflo-core_ruflo__ruvllm_hnsw_route — route an incoming query

This is not a corpus index. Treat it as a fast classifier over a curated set of patterns.

Hyperbolic embeddings

For hierarchical data (code trees, org charts), use mcp__plugin_ruflo-core_ruflo__embeddings_hyperbolic which maps to Poincare ball space. Distance is geodesic, not cosine.

CLI alternative

npx @claude-flow/cli@latest embeddings search --query "authentication patterns"
npx @claude-flow/cli@latest embeddings init
npx @claude-flow/cli@latest memory search --query "your query"

Performance

Measured numbers (source: `scripts/benchmark-

常见问题

小规模数据集应使用哪种路径?

这项技能说明,大规模集合搜索适用于约 500 份或更多文档的集合,而路由器适用于约 11 个模式。

什么是量化?

它是一种用更少位数存储向量的方法,因此占用更少的内存。

它能替代关键词搜索吗?

不能。这项技能说明,对于精确的文本匹配或简单查找,应跳过它。

详情

作者的原始描述

Vector search via embeddings_* (large-scale HNSW) and ruvllm_hnsw_* (WASM router for ≤11 hot patterns), with RaBitQ 1-bit quantization for 32× memory reduction

repo: ruvnet/ruflo

热度

GitHub 星标
81k
排名
#1562
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能