Skip to main content

Urna: offline-first vector database, Rust and Python

Urna

A vector database in one file, with citations that stay valid.

A .urna file holds the chunks, the embeddings, the source spans, the indices and the search contract. The Rust runtime maps it into memory, checks its hashes, and answers with exact cosine scores and a urna://content_hash/chunk_id citation for every hit. It works offline and rebuilds byte for byte. Python builds the file, Rust serves it.

Documentation: docs.urna.dev, with install, a quickstart, the concepts, the guides and the full CLI, build spec, Python and file format reference. Project site: urna.dev.

Install

brew tap hoffresearch/urna
brew install urna
npm install -g @urna/cli

bun, pnpm and yarn install the same package: bun add -g @urna/cli, pnpm add -g @urna/cli, yarn global add @urna/cli.

cargo install urna
curl -sSf https://raw.githubusercontent.com/hoffresearch/urna/main/script/installer.sh | sh

Then run setup once. It downloads the offline embedder, prepares a Python env and checks the install:

urna setup

Python only, no setup step needed:

pip install "urna[embed]"

Windows, Docker, cargo binstall and how to verify a download are in the install reference.

In the terminal

urna setup shows the plan before it writes anything and ends on the doctor checks. A corpus built with a heavier model, like the pt-BR MiniLM, needs that model on the machine: urna setup --model minilm-multilingual installs it (or m on the plan screen), and the ask tab of urna tui offers the same install when a query needs it. Nothing is downloaded until you say so.

urna setup: the verify step with every doctor check passing

urna tui opens a corpus, validates it, and lets you ask it questions. Each hit shows its score, the stored text and its citation.

urna tui my_corpus.urna
urna tui: the ask tab with scored hits and the cited text of the selected one

Quickstart

demos/quickstart/ has twelve short paragraphs and the spec that builds them. From a checkout:

urna build --spec demos/quickstart/corpus.toml
urna ask demos/quickstart/out/quickstart.urna "can I use this offline" -k 1
urna retrieve demos/quickstart/out/quickstart.urna "how do citations work" -k 2 --format jsonl
urna cite demos/quickstart/out/quickstart.urna 'urna://sha256:1147b256.../sha256:b5dfeb09...'
urna validate demos/quickstart/out/quickstart.urna

ask prints the answer with its citation, retrieve prints JSON for another program, cite turns a citation back into the stored text, and validate checks every hash. To build from your own rows, see usage section 13.

What the file guarantees

Property How
Self-contained The file is the whole database. Copy it like a SQLite file.
Verifiable SHA-256 over the whole file and over the decoded content, plus a checksum on the header and on every section. urna cite resolves any citation.
Reproducible Same chunks and same model give a byte-identical file on any machine.
Offline The runtime never opens a socket. The CLI refuses a query from another model at the model_hash check; in Python, retrieve does when you pass expected_model_hash, as below.

Python

import urna
from urna.embed_potion import potion_embedder

emb = potion_embedder()
db = urna.open("my_corpus.urna")
qvec = emb.embed_texts(["can I use this offline"])[0]

hits = db.retrieve(qvec, 5, expected_model_hash=emb.model_hash(), query_text="can I use this offline")
print(hits[0].citation_id, hits[0].score, hits[0].text)
Search variants, validate, build
db.search(qvec, 5)                                     # exact
db.search_ann(qvec, 5, 400)                            # hnsw beam (floor: the build's ef_construction), then exact rerank
db.search_hybrid(qvec, "vacina contra covid", 5, 100)  # bm25 + vectors, exact rerank
db.search_graph(qvec, 5, hops=2, ef=100)               # chunk graph from the seeds
db.search_space("clip-vit-b32", ivec, 5)               # one named multimodal space

assert db.validate() is True
info = db.inspect()

Each chunk is a dict with canonical_text, source_uri, byte_start, byte_end and embedding:

urna.build(
    output_path="my_corpus.urna",
    embedding_model="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
    embedding_dim=384,
    chunker_version="fixed-512/1",
    model_hash=model_hash,
    chunks=chunks,
    reproducible=True,
    preset="hybrid",
)

python demos/quickstart/quickstart.py runs the whole loop, build to cited hits, with no network.

CLI

The engine verbs take a file and a vector; two of them run Python (search-text for its embedder, doctor to probe the environment), the other ten never do. The agent verbs (ask, retrieve, build) take text and use the offline embedder; ask and retrieve search by what the file carries: BM25 plus vectors when the file has a BM25 index, HNSW when it has one, exact otherwise. setup and tui are the terminal UI. urna --help lists all three groups.

Agent verbs
urna ask my_corpus.urna "can I use this offline" -k 3
urna retrieve my_corpus.urna "can I use this offline" -k 5 --format jsonl
urna build --spec corpus.toml --dry-run

build reads one TOML: the source (SQLite, CSV, JSONL, an image dir), the media settings, and one or more embedding models from the registry (potion, clip-vit-b32, siglip2, wemm-2b, ...). Each model becomes a named vector space in the same file. The full spec is in usage section 13.

Search
urna search my_corpus.urna "[0.1, 0.2, ...]" -k 10
urna search-ann my_corpus.urna "[0.1, 0.2, ...]" -k 10 --ef 800   # the beam floor is the build's ef_construction (400)
urna search-graph my_corpus.urna "[0.1, 0.2, ...]" -k 10 --hops 2 --ef 100
urna search-space my_corpus.urna "[0.1, ...]" --space "wemm-2b@256" -k 5
urna search-text my_corpus.urna "vacina contra covid funciona" -k 5
Inspect, validate, stats, cite, media, benchmark, doctor
urna inspect my_corpus.urna --json
urna validate my_corpus.urna
urna stats my_corpus.urna
urna cite my_corpus.urna 'urna://sha256:1aa9.../sha256:8f314...'
urna media my_corpus.urna --export DIR
urna benchmark my_corpus.urna -q 100 -k 10 --ann 100 --madvise-cold
urna doctor

Benchmarks

100,000 x 384 rows, k=10, one thread, same machine for every store.

Store p50 (ms) p99 (ms) Cold open (ms)
hnswlib 0.32 0.53 182
usearch 0.67 61.4 58
Urna hybrid 0.72 1.02 356
Urna exact 7.80 8.32 292
LanceDB 16.7 19.4 612
sqlite-vec 19.8 24.8 50

Both Urna rows return recall@10 = 1.000. Urna's cold open includes checking every section hash before the first answer. Urna does not do updates, filters or concurrent writers. Method and the full table: docs/BENCH.md.

Presets: size vs recall
Preset Embeddings Index Size Recall@10
exact float32 1.000 1.000
compressed float16 0.339 1.000
tiny int8 HNSW 0.256 0.992
micro mrl256-int8 HNSW 0.223 0.810
nano int4 HNSW 0.209 0.913
hybrid float32 HNSW + BM25 0.609 1.000

Measured on a 30,725-chunk pt-BR corpus. Recall here is rank stability under quantization, not real-query quality. Details in usage section 6.

Real-query quality is in fakenews-ptbr-urna-benchmark: seven public pt-BR fake-news datasets deduplicated into 23,335 documents, 2,601 queries with relevance judgments, three embedders and three presets each, rebuildable from pinned sources. On the exact preset, nDCG@10 is 0.528 for mpnet, 0.503 for the multilingual MiniLM and 0.326 for potion. The files are on Hugging Face.

Images: 38,627 Magic cards in one file
Profile Media File Vs the JPEG source
archive JPEG XL, byte-reversible 3.61 GB 1.10x
stills AVIF, one image per file (q48) 1.20 GB 3.32x
stills-av1 AV1 all-intra crf35 1.37 GB 2.89x
retrieval AV1 all-intra crf50 533 MB 7.46x

The profile names are the forge's ([media] profile = "...", usage section 14). Text-to-image hit@1 over every card: SigLIP2 0.750, wemm-2b 0.744, Jina 0.336, CLIP 0.098. The benchmark is mtg-urna-benchmark, and the .urna files are on Hugging Face; the recipes the forge uses are recorded in python/forge/media_profiles.py and docs/CHANGELOG.

Reference

The crates are urna-format (the container), urna-engine (search), urna (the binary) and urna-bridge (the PyO3 bridge behind the Python package).

Renamed from nest after 0.4.0. A .nest file written by 0.4.0 still opens.

License

MIT, see LICENSE. Hoff Research

Made it simple, but significant (∂μfμν = jν)

Author: Brenner Cruvinel

Metadata

Release files for urna 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for urna 0.5.4
File Actions
urna-0.5.4-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for urna-0.5.4-cp312-abi3-win_amd64.whl
urna-0.5.4-cp312-abi3-manylinux_2_34_x86_64.whl CPython 3.12 abi3 Linux glibc 2.34+ x86-64 Details for urna-0.5.4-cp312-abi3-manylinux_2_34_x86_64.whl
urna-0.5.4-cp312-abi3-manylinux_2_34_aarch64.whl CPython 3.12 abi3 Linux glibc 2.34+ ARM64 Details for urna-0.5.4-cp312-abi3-manylinux_2_34_aarch64.whl
urna-0.5.4-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.12 abi3 macOS 11.0+ ARM64, macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64) Details for urna-0.5.4-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Total release size: 117.8 MB

Release files / urna-0.5.4-cp312-abi3-win_amd64.whl

Download URL urna-0.5.4-cp312-abi3-win_amd64.whl
Size 29.1 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d834ce9eb1b4fed063741e97d70754d58766d99418be06a88ba58cae875c79cd
BLAKE2b-256 checksum
How to use checksums
3af3fac9942ae6ee7f0cb96d83576ffbff63445b400cb8052477fb1f46bc3b17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / urna-0.5.4-cp312-abi3-manylinux_2_34_x86_64.whl

Download URL urna-0.5.4-cp312-abi3-manylinux_2_34_x86_64.whl
Size 29.4 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
fdcebe4b8a367383627a9d9876247fb77dcc86a239c2aad2e687d8906a29517a
BLAKE2b-256 checksum
How to use checksums
59d2eab0adafa7d2300a965a44f599b82303bce9330b67c0fdab18666f622fbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / urna-0.5.4-cp312-abi3-manylinux_2_34_aarch64.whl

Download URL urna-0.5.4-cp312-abi3-manylinux_2_34_aarch64.whl
Size 29.3 MB
Tags CPython 3.12 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
ef03b71265834b7367ec297fadc4db6dfd25546a375782f9a2f25d90780800eb
BLAKE2b-256 checksum
How to use checksums
37335a4dd14048949d7bf2da0a2878d3422f6b3ba2f1844a48a5e658d78f48f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / urna-0.5.4-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL urna-0.5.4-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 30.1 MB
Tags CPython 3.12 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1cd014957aeaa773d4c51581851c6830e2a2b5bbf6932a3b0e1a75e3ee9757ec
BLAKE2b-256 checksum
How to use checksums
5dc88e7c58af23bc996ff69811cc515c108572a0d23cea34e632638f892064f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Security for urna 0.5.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for urna-0.5.4-cp312-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page