Skip to main content

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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mnestic-0.10.6.tar.gz (565.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mnestic-0.10.6-cp37-abi3-win_amd64.whl (10.5 MB view details)

Uploaded CPython 3.7+Windows x86-64

mnestic-0.10.6-cp37-abi3-manylinux_2_28_x86_64.whl (13.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.28+ x86-64

mnestic-0.10.6-cp37-abi3-manylinux_2_28_aarch64.whl (12.8 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.28+ ARM64

mnestic-0.10.6-cp37-abi3-macosx_11_0_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.7+macOS 11.0+ x86-64

mnestic-0.10.6-cp37-abi3-macosx_11_0_arm64.whl (10.4 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

Details for the file mnestic-0.10.6.tar.gz.

File metadata

  • Download URL: mnestic-0.10.6.tar.gz
  • Upload date:
  • Size: 565.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mnestic-0.10.6.tar.gz
Algorithm Hash digest
SHA256 311c4a2dd76d3f56f44d9927733743df17b6ecc6a60eb0d966ac8497c82dae6c
MD5 a995faaf5bd6d1c0f75a08bb3a778517
BLAKE2b-256 902e7e867bd1be1e6b2599a938810e465ced74a6e54f4c63c320118a63ddb089

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.10.6.tar.gz:

Publisher: python-publish.yml on shuruheel/mnestic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mnestic-0.10.6-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: mnestic-0.10.6-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 10.5 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

Hashes for mnestic-0.10.6-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6e12cc946062b9c402ed74b635af75de13be6f4e29455f7f6ddd2137a74fbb27
MD5 8bd1a15caf4ff87cac3f233e316be4e7
BLAKE2b-256 92aa545e625af6e717d0ab2d31f88c2335ba2fb37f4c9cbd72d4d627b3be1133

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.10.6-cp37-abi3-win_amd64.whl:

Publisher: python-publish.yml on shuruheel/mnestic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mnestic-0.10.6-cp37-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mnestic-0.10.6-cp37-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e3801ee7ea5cc96fab8f7d12564f3535bea33ec1f05ca30ec8d130761fcdceee
MD5 c7a557327d6f71759456b3e8e042acdf
BLAKE2b-256 5d55e58804dfb2bce9b81e5f5017a3991ceefb72b950389fa909fd80a3129fe6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.10.6-cp37-abi3-manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on shuruheel/mnestic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mnestic-0.10.6-cp37-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mnestic-0.10.6-cp37-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c64600a994d77eac26064e77c4d2deed1f63e1c2a452202b9a4160e273566ff4
MD5 515bc32f7edb3aea8d14ac198322e1f1
BLAKE2b-256 260a94a27416653951ceb2dde5a5066ec0c4e408d61a3212fc79fae8e3026ffe

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.10.6-cp37-abi3-manylinux_2_28_aarch64.whl:

Publisher: python-publish.yml on shuruheel/mnestic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mnestic-0.10.6-cp37-abi3-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mnestic-0.10.6-cp37-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9a03733c9e4a26364f7e17b961fae83ce159034fb4394b0e6592fd5664a57cad
MD5 6ccbb7925e808a3f8b3fe4d530985f42
BLAKE2b-256 4de44a38557dccc182151c97b766237eec6a91eb073b336a0286b714c8aeff88

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.10.6-cp37-abi3-macosx_11_0_x86_64.whl:

Publisher: python-publish.yml on shuruheel/mnestic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mnestic-0.10.6-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mnestic-0.10.6-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d22cc82e8cbf9c5f1fca0967e2f5d4685360292a433241c2e6dd162598bb93c9
MD5 880371022649ff132fd2256aa093acad
BLAKE2b-256 ed8b1057b6360380ef5977aa8dcca60144075b2e42e77556c157674fc9e992e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.10.6-cp37-abi3-macosx_11_0_arm64.whl:

Publisher: python-publish.yml on shuruheel/mnestic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page