Tiny RAG with implicit knowledge graph, powered by zvec
Project description
zrag
Tiny RAG with implicit knowledge graph, powered by zvec.
Ingest a directory of any file type into a local vector store. Query with natural language. Explore connections through an implicit knowledge graph — no servers, no API keys.
Install
pip install zerag
For PDF support:
pip install "zerag[pdf]"
Quick Start
CLI
# Index a codebase
zrag ingest ./src
# Search it
zrag query "how does authentication work?"
# Explore the knowledge graph
zrag graph "authentication" --depth 1
# Check stats
zrag stats
Python API
from zrag import ZragStore
with ZragStore("./my_index") as store:
# Ingest files
store.ingest("./docs")
# Query
results = store.query("how does auth work?", topk=5)
for r in results:
print(f"{r['file_path']}:{r['chunk_index']} ({r['score']:.3f})")
print(f" {r['content'][:100]}")
# Knowledge graph
graph = store.graph("auth", depth=1)
print(f"{len(graph['nodes'])} nodes, {len(graph['edges'])} edges")
How It Works
Vector search — Files are chunked (~512 chars with paragraph-aware boundaries), embedded locally with all-MiniLM-L6-v2 (384-dim), and stored in a zvec HNSW index. Everything runs in-process.
Implicit knowledge graph — No stored graph. Edges are derived at query time:
same_file— chunks from the same file (free from metadata)adjacent— consecutive chunks in a file (free from metadata)similar— chunks above a cosine similarity threshold (computed via zvec)
Supported file types — .md, .txt, .py, .js, .ts, .tsx, .jsx, .json, .yaml, .yml, .toml, .csv, .html, .rst, .pdf. Unknown extensions are attempted as UTF-8 text; binary files are skipped.
CLI Reference
zrag [--index PATH] <command>
Commands:
ingest <dir> Ingest files from a directory
--chunk-size Chunk size in chars (default: 512)
--overlap Overlap between chunks (default: 64)
query <text> Search the index
--topk Number of results (default: 5)
graph <text> Build implicit knowledge graph
--depth Expansion depth (default: 1)
--topk Seed results (default: 5)
--threshold Similarity threshold for edges (default: 0.5)
stats Show index statistics
Requirements
- Python 3.10-3.12 (zvec constraint)
- No API keys, no servers — embeddings run locally
License
MIT — Wayy Research
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zerag-0.1.0.tar.gz.
File metadata
- Download URL: zerag-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ca3d9444c7c3950247f6e477afcb485af51f8858b235622d1bb985ad8f7d021
|
|
| MD5 |
193d92309aef8847417923fad8cac013
|
|
| BLAKE2b-256 |
138363ed27ed40371add28f54890490ce58cd6bc4d458740b13d2735fa26cd2b
|
Provenance
The following attestation bundles were made for zerag-0.1.0.tar.gz:
Publisher:
publish.yml on Wayy-Research/zrag
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zerag-0.1.0.tar.gz -
Subject digest:
2ca3d9444c7c3950247f6e477afcb485af51f8858b235622d1bb985ad8f7d021 - Sigstore transparency entry: 1006374600
- Sigstore integration time:
-
Permalink:
Wayy-Research/zrag@9f91504b8bd6ef30135670558fa58b3715d7a35e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Wayy-Research
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f91504b8bd6ef30135670558fa58b3715d7a35e -
Trigger Event:
push
-
Statement type:
File details
Details for the file zerag-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zerag-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a877677ceba3c7c67baa75557377ad641e33f93cde64e5813f47697849ecad8e
|
|
| MD5 |
b107e5f6d7d5e07f60baf97d17b12e25
|
|
| BLAKE2b-256 |
378bc801c9ebcc033bd1f246d7f93f3e05d81ca42262711e7b3510c6906cc56a
|
Provenance
The following attestation bundles were made for zerag-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Wayy-Research/zrag
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zerag-0.1.0-py3-none-any.whl -
Subject digest:
a877677ceba3c7c67baa75557377ad641e33f93cde64e5813f47697849ecad8e - Sigstore transparency entry: 1006374602
- Sigstore integration time:
-
Permalink:
Wayy-Research/zrag@9f91504b8bd6ef30135670558fa58b3715d7a35e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Wayy-Research
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f91504b8bd6ef30135670558fa58b3715d7a35e -
Trigger Event:
push
-
Statement type: