home / skills / ruvnet / ruflo / embeddings

embeddings skill

/.agents/skills/embeddings

This skill provides semantic embeddings and fast vector search using HNSW with sql.js persistence and hyperbolic support to enhance knowledge retrieval.

npx playbooks add skill ruvnet/ruflo --skill embeddings

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.8 KB
---
name: embeddings
description: >
  Vector embeddings with HNSW indexing, sql.js persistence, and hyperbolic support. 75x faster with agentic-flow integration.
  Use when: semantic search, pattern matching, similarity queries, knowledge retrieval.
  Skip when: exact text matching, simple lookups, no semantic understanding needed.
---

# Embeddings Skill

## Purpose
Vector embeddings for semantic search and pattern matching with HNSW indexing.

## Features

| Feature | Description |
|---------|-------------|
| **sql.js** | Cross-platform SQLite persistent cache (WASM) |
| **HNSW** | 150x-12,500x faster search |
| **Hyperbolic** | Poincare ball model for hierarchical data |
| **Normalization** | L2, L1, min-max, z-score |
| **Chunking** | Configurable overlap and size |
| **75x faster** | With agentic-flow ONNX integration |

## Commands

### Initialize Embeddings
```bash
npx claude-flow embeddings init --backend sqlite
```

### Embed Text
```bash
npx claude-flow embeddings embed --text "authentication patterns"
```

### Batch Embed
```bash
npx claude-flow embeddings batch --file documents.json
```

### Semantic Search
```bash
npx claude-flow embeddings search --query "security best practices" --top-k 5
```

## Memory Integration

```bash
# Store with embeddings
npx claude-flow memory store --key "pattern-1" --value "description" --embed

# Search with embeddings
npx claude-flow memory search --query "related patterns" --semantic
```

## Quantization

| Type | Memory Reduction | Speed |
|------|-----------------|-------|
| Int8 | 3.92x | Fast |
| Int4 | 7.84x | Faster |
| Binary | 32x | Fastest |

## Best Practices
1. Use HNSW for large pattern databases
2. Enable quantization for memory efficiency
3. Use hyperbolic for hierarchical relationships
4. Normalize embeddings for consistency

Overview

This skill provides high-performance vector embeddings with HNSW indexing, sql.js persistence, and optional hyperbolic geometry. It accelerates semantic search, pattern matching, and similarity queries, and integrates with agentic-flow for large speedups. Built for cross-platform use, it supports normalization, chunking, quantization, and scalable memory storage.

How this skill works

The skill converts text into vectors and stores them in an HNSW index for sub-linear nearest-neighbor search. Index and embedding metadata persist to a sql.js (WASM SQLite) layer for reliable cross-platform storage. Optional hyperbolic (Poincaré ball) embeddings capture hierarchical relationships while configurable normalization and chunking ensure consistent retrieval quality.

When to use it

  • Semantic search across documents, notes, or knowledge bases
  • Pattern matching and similarity queries over large datasets
  • Hierarchical data retrieval where taxonomic relationships matter
  • Persistent, cross-platform embedding stores for agents or web apps
  • High-performance retrieval integrated in multi-agent workflows

Best practices

  • Use HNSW for large-scale indexes to keep search latency low
  • Enable quantization (Int8/Int4/Binary) for memory-constrained environments
  • Select hyperbolic embeddings for taxonomies or hierarchical features
  • Normalize embeddings (L2 or z-score) to improve nearest-neighbor stability
  • Chunk long documents with overlap to preserve local context

Example use cases

  • RAG retrieval pipeline for an agent that answers product or policy questions
  • Detecting duplicate or semantically similar tickets in customer support systems
  • Search and surfacing of relevant code snippets or patterns across repositories
  • Knowledge memory for autonomous agents with persistent sql.js stores
  • Hierarchy-aware recommendation or taxonomy mapping using hyperbolic embeddings

FAQ

How do I persist the index and vectors across sessions?

Persist the index and metadata to sql.js (WASM SQLite). The skill writes vectors and index state so agents and web clients can reload the index reliably.

When should I use hyperbolic vs Euclidean embeddings?

Use hyperbolic embeddings when your data is hierarchical (taxonomies, ontologies). Use Euclidean embeddings for general semantic similarity where hierarchy is not central.