surrealdb-vector

surrealdb-vector is a skill for Claude Code, Codex from surrealdb/agent-skills. It costs 104 tokens per session (632 once invoked), scanned A, original, MIT.

A guide to vector search in SurrealDB, a database that can store and query structured data. Vector search compares lists of numbers called embeddings to find items with similar meaning, using HNSW indexes and nearest-neighbour queries.

In plain words
What is it for?
Use it to create vector indexes, run similarity searches, tune HNSW settings, and build semantic search, retrieval-augmented generation, or recommendation systems.
Why use it?
It removes the need to design vector indexes and similarity queries from scratch when building search based on meaning rather than exact words.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to create vector indexes, run similarity searches, tune HNSW settings, and build semantic search, retrieval-augmented generation, or recommendation systems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/surrealdb/agent-skills/surrealdb-vector
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add surrealdb/agent-skills --skill surrealdb-vector
Clone the repo
git clone --depth 1 https://github.com/surrealdb/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for surrealdb-vector

README.md
[![agentmods](https://agentmods.dev/badge/skills/surrealdb/agent-skills/surrealdb-vector/github.svg)](https://agentmods.dev/skills/surrealdb/agent-skills/surrealdb-vector)
Your own site
<a href="https://agentmods.dev/skills/surrealdb/agent-skills/surrealdb-vector"><img src="https://agentmods.dev/badge/skills/surrealdb/agent-skills/surrealdb-vector/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for surrealdb-vector

Your own site · 80×15
<a href="https://agentmods.dev/skills/surrealdb/agent-skills/surrealdb-vector"><img src="https://agentmods.dev/badge/skills/surrealdb/agent-skills/surrealdb-vector.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 104 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 632 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 10 Apr 2026
  • Snyk pass 10 Apr 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00104 $0.00632
Opus 5 $0.00052 $0.00316
Sonnet 5 $0.00021 $0.00126
Haiku 4.5 $0.00010 $0.00063

Measured 12d ago against content hash e7ef6d568866, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

surrealdb-vector scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/surrealdb-vector/SKILL.md · 84 lines

What it actually says

HNSW Index

Create a basic HNSW index:

DEFINE INDEX hnsw_idx ON pts FIELDS point HNSW DIMENSION 4;

With specific distance function and type:

DEFINE INDEX hnsw_idx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN TYPE F64;

Available types: F64, F32, I64, I32, I16.

Full Table Example

DEFINE TABLE OVERWRITE document SCHEMALESS;
DEFINE FIELD OVERWRITE embedding ON document TYPE array<float>;
DEFINE INDEX OVERWRITE hnsw_idx_document ON document
    FIELDS embedding
    HNSW DIMENSION 384
    DIST COSINE
    TYPE F32
    EFC 150 M 12 M0 24;

HNSW Parameters

Parameter Description
DIMENSION Vector dimensionality (must match your embeddings)
DIST Distance function: COSINE, EUCLIDEAN, etc.
TYPE Numeric type: F64, F32, I64, I32, I16
EFC Construction search effort (higher = better index)
M Max connections per node
M0 Max connections at layer 0

Querying Vectors

The <|K, EF|> operator performs KNN search. K is the number of results, EF is the search effort (higher = more accurate, slower).

Recommended effort values:

  • 40 — default, good accuracy
  • 17 — fast but may miss some results

Basic KNN Query

SELECT
    *,
    vector::distance::knn() AS dist
FROM document
WHERE embedding <|10, 40|> $vector;

vector::distance::knn() uses the distance function defined by the index.

Scored Results with Threshold

SELECT *, score
FROM (
    SELECT *, (1 - vector::distance::knn()) AS score
    FROM document
    WHERE embedding <|20, 40|> $vector
)
WHERE score >= $threshold
ORDER BY score DESC;
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 84 lines · 104 tokens per session scan A e7ef6d568866

Subscribe to this mod's changes

surrealdb-vector is a skill published in the GitHub repository surrealdb/agent-skills (25 stars, last pushed 2mo ago), licensed MIT. It adds 104 tokens to every session and 632 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.