surrealdb-vector
Skill27 starsChanged 2 months agoMITView on GitHub
Vector search with SurrealDB using HNSW indexes, KNN queries, and similarity scoring. Use when creating vector indexes, querying vectors with KNN distance operators, building semantic search or RAG pipelines, tuning HNSW parameters (EFC, M, M0, distance function, type), or implementing recommendation systems with SurrealDB. Triggers: HNSW, vector, embedding, KNN, cosine, euclidean, semantic search, RAG, vector::distance.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- Quad4-Software/skillsedited, first seen Oct 3, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- Quad4-Software/skills★ 158% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- surrealdb-agent-memory-docsSkill
- surrealdb-cliSkill
- surrealdb-docsSkill
- surrealdb-jsSkill
- surrealdb-pythonSkill
- surrealkitSkill
- surrealql-functionsSkill
- surrealql-performanceSkill
- surrealqlSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Create a basic HNSW index:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SurrealDB Vector Search
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 accuracy17— 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;Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

