Embedded graph + vector + full-text database with Datalog — a maintained fork of CozoDB, tuned as a substrate for agentic memory.
Project description
mnestic (Python)
Embedded graph + vector + full-text database with Datalog queries — a maintained fork of CozoDB, tuned as a substrate for agentic memory. This package is the in-process Python binding (no server required).
mnestic is not the official CozoDB and is not affiliated with or endorsed by its original authors. All credit for the original design belongs to Ziyang Hu and the Cozo Project Authors. See the fork repository for provenance and licensing.
pip install mnestic
from mnestic import CozoDbPy
db = CozoDbPy("mem", "", "{}") # engines: "mem", "sqlite" (file path), "rocksdb" (dir path)
db.run_script("?[x] <- [[1],[2],[3]]", {}, False)
# One-call hybrid retrieval (HNSW + full-text fused with Reciprocal Rank Fusion),
# over a relation that has an HNSW index and an FTS index:
hits = db.hybrid_search({
"relation": "docs",
"vector_index": "vec", "query_vector": [0.1, 0.9], "vector_k": 5,
"fts_index": "fts", "query_text": "vector search", "fts_k": 5,
})
# -> {"headers": ["id", "score"], "rows": [["d3", 0.033], ...], "next": None}
# Pass "detailed": True for per-leg contributions — one row per (item, leg)
# with the within-leg rank the fusion used and the leg's raw score:
# headers ["id","score","list_id","leg_rank","leg_score"]
The "rocksdb" persistent backend now ships in the published wheel —
CozoDbPy("rocksdb", "./my.db", "{}") works straight from pip install mnestic.
The source distribution stays SQLite/compact-only, so the persistent engine is
wheel-only.
Upgrade note (0.10.6): a persistent database whose relation catalogs were
last written by a build older than 0.10.0 could fail to open with Cannot deserialize relation metadata from bytes after upgrading to 0.10.0–0.10.5.
0.10.6 fixes this — legacy catalogs open again with no migration, so upgrade to
0.10.6 if you carry a pre-0.10.0 database.
run_script takes an optional timeout= — a per-query wall-clock budget in
seconds; on expiry the query raises an eval::timeout error.
db.set_default_query_timeout(secs) sets a Db-wide default and
db.default_query_timeout() reads it back; the effective budget for a query is
the minimum of that default and any per-call timeout.
New in 0.11.0: cached graph projections. Run
db.run_script("::graph create g { edges: knows, nodes: person }", {}, False) to
name an in-memory adjacency that twelve graph algorithms reuse across queries:
pass graph: 'g' in place of the positional edge relation
(ConnectedComponents(graph: 'g'), PageRank(graph: 'g', iterations: 20), …)
and the setup — scanning the edges and rebuilding a CSR — is paid once instead of
on every call (measured 15–16× on a 400,000-edge graph). A projection is always
fresh: a write to a source relation frees what was built from it, and it lives
only in memory. ::graph list and ::graph drop manage them, and
db.set_graph_projection_capacity(bytes) sets the cache's ceiling (512 MiB by
default; 0 disables caching while leaving ::graph create working).
Breaking (results): PageRank's default iterations is now 20, up from 10;
pass iterations: 10 to restore the old numbers.
For idiomatic LangChain / LlamaIndex usage, install the integration packages
(langchain-mnestic, llama-index-vector-stores-mnestic).
The query language (CozoScript / Datalog) and engine semantics follow CozoDB; see the upstream documentation and the fork changelog.
License
Mozilla Public License 2.0. Original work © 2022 The Cozo Project Authors; fork modifications © 2026 Shan Rizvi.
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 Distributions
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 mnestic-0.11.0.tar.gz.
File metadata
- Download URL: mnestic-0.11.0.tar.gz
- Upload date:
- Size: 613.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54f35d138f3d3d1076fbbaadb73391e10078ca8d417b02a8993ca7f3d4f0490a
|
|
| MD5 |
67dea215fe3af565cdd7d6f995801cc9
|
|
| BLAKE2b-256 |
707e310a03e3d192356558630cc7ba657831a2aeb41a92a44b57e8255a9fb660
|
Provenance
The following attestation bundles were made for mnestic-0.11.0.tar.gz:
Publisher:
python-publish.yml on shuruheel/mnestic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mnestic-0.11.0.tar.gz -
Subject digest:
54f35d138f3d3d1076fbbaadb73391e10078ca8d417b02a8993ca7f3d4f0490a - Sigstore transparency entry: 2138485564
- Sigstore integration time:
-
Permalink:
shuruheel/mnestic@8f66449d931a2219ea409f35264bfb238660fd9d -
Branch / Tag:
refs/tags/py-v0.11.0 - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8f66449d931a2219ea409f35264bfb238660fd9d -
Trigger Event:
push
-
Statement type:
File details
Details for the file mnestic-0.11.0-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: mnestic-0.11.0-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 10.6 MB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb97e1fd43ee6eb5df770ce2eb080951445a6b9652bfa8d2f127b10361fe0b74
|
|
| MD5 |
c89944feba6a53828c43e06a85ea4e25
|
|
| BLAKE2b-256 |
692501aba64bcb4900be90bca24688a47c73b5d239c514dfb0f48ae87aefb264
|
Provenance
The following attestation bundles were made for mnestic-0.11.0-cp37-abi3-win_amd64.whl:
Publisher:
python-publish.yml on shuruheel/mnestic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mnestic-0.11.0-cp37-abi3-win_amd64.whl -
Subject digest:
cb97e1fd43ee6eb5df770ce2eb080951445a6b9652bfa8d2f127b10361fe0b74 - Sigstore transparency entry: 2138485589
- Sigstore integration time:
-
Permalink:
shuruheel/mnestic@8f66449d931a2219ea409f35264bfb238660fd9d -
Branch / Tag:
refs/tags/py-v0.11.0 - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8f66449d931a2219ea409f35264bfb238660fd9d -
Trigger Event:
push
-
Statement type:
File details
Details for the file mnestic-0.11.0-cp37-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: mnestic-0.11.0-cp37-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.7+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0398699b048f021de96966ed500162924ac58f25277a4ad9c590d88931124d87
|
|
| MD5 |
a349d2ef74fcf49e03184dafd7b995ad
|
|
| BLAKE2b-256 |
fe90503cad84c5c3082395524c6f3f43d8f7ddf21830cfee1fc0cca230cba499
|
Provenance
The following attestation bundles were made for mnestic-0.11.0-cp37-abi3-manylinux_2_28_x86_64.whl:
Publisher:
python-publish.yml on shuruheel/mnestic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mnestic-0.11.0-cp37-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
0398699b048f021de96966ed500162924ac58f25277a4ad9c590d88931124d87 - Sigstore transparency entry: 2138485636
- Sigstore integration time:
-
Permalink:
shuruheel/mnestic@8f66449d931a2219ea409f35264bfb238660fd9d -
Branch / Tag:
refs/tags/py-v0.11.0 - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8f66449d931a2219ea409f35264bfb238660fd9d -
Trigger Event:
push
-
Statement type:
File details
Details for the file mnestic-0.11.0-cp37-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: mnestic-0.11.0-cp37-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.7+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa0184ab74c6598548e22c3791b87c37db5450aef1949ccf1b8c118c5daa7e46
|
|
| MD5 |
8c4376c13eef7f7e719ceffc469a37a1
|
|
| BLAKE2b-256 |
644cf4460f52e9b8924560f0d4d2c100bbb422eabacdd00591e4d6caadd1b353
|
Provenance
The following attestation bundles were made for mnestic-0.11.0-cp37-abi3-manylinux_2_28_aarch64.whl:
Publisher:
python-publish.yml on shuruheel/mnestic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mnestic-0.11.0-cp37-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
fa0184ab74c6598548e22c3791b87c37db5450aef1949ccf1b8c118c5daa7e46 - Sigstore transparency entry: 2138485606
- Sigstore integration time:
-
Permalink:
shuruheel/mnestic@8f66449d931a2219ea409f35264bfb238660fd9d -
Branch / Tag:
refs/tags/py-v0.11.0 - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8f66449d931a2219ea409f35264bfb238660fd9d -
Trigger Event:
push
-
Statement type:
File details
Details for the file mnestic-0.11.0-cp37-abi3-macosx_11_0_x86_64.whl.
File metadata
- Download URL: mnestic-0.11.0-cp37-abi3-macosx_11_0_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.7+, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb2ca7ffc21704aeee8e28b78d8b05d149f7cee181762ba8676e23fd97076d5c
|
|
| MD5 |
6326070842c31a26da349b722247e020
|
|
| BLAKE2b-256 |
0e0e45f6dc3e50c071f7218d6f0aff790b57f3c65645a67e781f1860dabc7208
|
Provenance
The following attestation bundles were made for mnestic-0.11.0-cp37-abi3-macosx_11_0_x86_64.whl:
Publisher:
python-publish.yml on shuruheel/mnestic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mnestic-0.11.0-cp37-abi3-macosx_11_0_x86_64.whl -
Subject digest:
eb2ca7ffc21704aeee8e28b78d8b05d149f7cee181762ba8676e23fd97076d5c - Sigstore transparency entry: 2138485622
- Sigstore integration time:
-
Permalink:
shuruheel/mnestic@8f66449d931a2219ea409f35264bfb238660fd9d -
Branch / Tag:
refs/tags/py-v0.11.0 - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8f66449d931a2219ea409f35264bfb238660fd9d -
Trigger Event:
push
-
Statement type:
File details
Details for the file mnestic-0.11.0-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: mnestic-0.11.0-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 10.4 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7d49dd8a18a84b14ec3502c9867a0850c22e3f6e6811e50082da986778c580b
|
|
| MD5 |
70ad819f927058b8aff299686c8bdf2f
|
|
| BLAKE2b-256 |
59a450e0f585bc52b5c96bb46b661b7227c46cff4a57225b56117848d288b3f9
|
Provenance
The following attestation bundles were made for mnestic-0.11.0-cp37-abi3-macosx_11_0_arm64.whl:
Publisher:
python-publish.yml on shuruheel/mnestic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mnestic-0.11.0-cp37-abi3-macosx_11_0_arm64.whl -
Subject digest:
e7d49dd8a18a84b14ec3502c9867a0850c22e3f6e6811e50082da986778c580b - Sigstore transparency entry: 2138485629
- Sigstore integration time:
-
Permalink:
shuruheel/mnestic@8f66449d931a2219ea409f35264bfb238660fd9d -
Branch / Tag:
refs/tags/py-v0.11.0 - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8f66449d931a2219ea409f35264bfb238660fd9d -
Trigger Event:
push
-
Statement type: