New to Claude Skills? Learn how to install them →

sickn33 on GitHub

ArrowSpace

Free

Enhance vector search with spectral analysis.

Get this skill

Free · Opens the source repo

What ArrowSpace does

ArrowSpace is a specialized tool designed for spectral vector search, particularly useful when traditional methods like cosine or L2 similarity fail to capture the underlying structure of your data embeddings. This skill leverages graph Laplacian features to improve nearest-neighbor search by computing a Laplacian over the item graph. By employing the Rayleigh quotient, ArrowSpace generates a λτ (lambda-tau) score for each item, allowing for a search that respects both semantic similarity and the structural importance of items within the embedding space.

The skill is particularly beneficial for developers and researchers working with embedding vectors who require a more nuanced approach to similarity search. It is especially useful in scenarios where the context or structural role of items is as important as their semantic content. For example, in Retrieval-Augmented Generation (RAG) pipelines, understanding the contextual role of embeddings can significantly enhance the quality of results.

To utilize ArrowSpace, users begin by installing the package and preparing their data as a NumPy array of embedding vectors. The skill requires configuring graph parameters to optimize performance based on the dataset's characteristics. Once set up, users can query the built graph to retrieve items ranked by their λτ scores, which indicate both semantic closeness and structural relevance. This dual focus on semantic and structural properties makes ArrowSpace a powerful addition to any data scientist's toolkit.

When to use it

Use ArrowSpace when standard similarity measures like cosine or L2 fail to capture the latent structures in your embeddings, especially in graph-based retrieval scenarios.

When not to use it

Avoid using ArrowSpace for real-time streaming data or with datasets smaller than 10 items, as the graph structure is not meaningful in those cases.

What you can build with it

Improving Search Quality in RAG Pipelines

Use ArrowSpace to enhance the retrieval quality in RAG pipelines by considering both semantic and structural roles of embeddings.

Comparing Spectral and Cosine Similarity

Leverage ArrowSpace to compare the effectiveness of spectral ranking against traditional cosine similarity in your embedding searches.

Batch Processing of Embedding Vectors

Utilize ArrowSpace for batch processing of embedding vectors where traditional methods fall short in capturing latent structures.

How to install ArrowSpace

View source

1. Install with the skills CLI

npx skills add sickn33/agentic-awesome-skills/arrowspace --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by sickn33

ArrowSpace

Spectral vector search that augments nearest-neighbour search with graph Laplacian features. Computes a Laplacian over the item graph and uses the Rayleigh quotient to produce a λτ (lambda-tau) score per item, enabling search that respects both semantic similarity and structural role.

When to Use This Skill

  • Cosine or L2 similarity misses latent structure in your embeddings
  • You want graph-based retrieval with spectral awareness
  • You need to characterise the spectral properties of an embedding space
  • You are building RAG pipelines where contextual role matters alongside semantic content

How It Works

Step 1: Install and import

pip install arrowspace
from arrowspace import ArrowSpaceBuilder
import numpy as np

Step 2: Prepare your data

Pass an (N, d) float64 NumPy array of embedding vectors:

items = np.array([[0.1, 0.2, 0.3],
                  [0.0, 0.5, 0.1],
                  [0.9, 0.1, 0.0]], dtype=np.float64)

Step 3: Configure graph parameters

graph_params = {"eps": 0.2, "k": 6, "topk": 3, "p": 2.0, "sigma": 1.0}
builder = ArrowSpaceBuilder(items, graph_params=graph_params)
aspace = builder.build()

Step 4: Query

lambdas = aspace.lambdas()           # array indexed by insertion order
sorted_res = aspace.lambdas_sorted()  # (score, index) pairs ascending

Higher λτ values indicate items that are both semantically close and structurally central.

Examples

Example 1: Basic spectral retrieval

items = np.random.randn(100, 64).astype(np.float64)
builder = ArrowSpaceBuilder(items, graph_params={"eps": 0.5, "k": 10, "topk": 5, "p": 2.0, "sigma": None})
aspace = builder.build()
scores = aspace.lambdas()
top_indices = np.argsort(scores)[-5:]

Example 2: Compare spectral vs cosine ranking

from sklearn.metrics.pairwise import cosine_similarity
cos_sim = cosine_similarity(items)
cosine_order = np.argsort(cos_sim[0])[::-1]
spectral_order = np.argsort(aspace.lambdas())[::-1]

Best Practices

  • ✅ Normalise embeddings to unit norm before passing to ArrowSpace
  • ✅ Start with eps proportional to 1/sqrt(dim) and tune from there
  • ✅ Use k between 3 and 25 depending on dataset size (rule: N/50)
  • ✅ Set sigma=None to auto-select kernel width from distance distribution
  • ❌ Don't use with fewer than 10 items (graph structure is not meaningful)
  • ❌ Don't use for real-time streaming data (ArrowSpace is batch-oriented)

Limitations

  • This skill does not replace environment-specific validation, testing, or expert review.
  • ArrowSpace is batch-oriented and not designed for real-time indexing of streaming data.

Common Pitfalls

  • Problem: eps is too small, producing a disconnected graph Solution: Increase eps, or set it proportional to 1/sqrt(embedding_dim)

  • Problem: k is too large, producing a dense graph with washed-out spectral features Solution: Keep k ≤ 25 for most datasets

Related Skills

  • vector-database-engineer — General vector database expertise
  • embedding-strategies — Embedding model selection and chunking
  • similarity-search-patterns — Semantic search implementation patterns
  • hybrid-search-implementation — Combined semantic + keyword search

Frequently asked questions about ArrowSpace

Similar skills