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.

New in 0.11.1: skyline aggregates, no binding code. pareto_min and pareto_max keep, per group, the Pareto frontier of a numeric vector — the points no other point dominates — and are ordinary CozoScript aggregates, so they run straight from the wheel through run_script with nothing to register: db.run_script("?[f] := offer[p, q], v = [p, -q], f = pareto_min(v)", {}, False). pareto_min treats smaller as better and pareto_max larger; mix objectives (minimize price, maximize quality) by negating the maximized components, as above. A malformed operand (non-list, non-numeric component, NaN, or empty vector) raises. It is a non-breaking, purely additive patch — no existing query changes result.

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.11.1.tar.gz (614.8 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.11.1-cp37-abi3-win_amd64.whl (10.6 MB view details)

Uploaded CPython 3.7+Windows x86-64

mnestic-0.11.1-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.11.1-cp37-abi3-manylinux_2_28_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.28+ ARM64

mnestic-0.11.1-cp37-abi3-macosx_11_0_x86_64.whl (11.6 MB view details)

Uploaded CPython 3.7+macOS 11.0+ x86-64

mnestic-0.11.1-cp37-abi3-macosx_11_0_arm64.whl (10.5 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for mnestic-0.11.1.tar.gz
Algorithm Hash digest
SHA256 3bc0ade236c26a9659ec89692d0eda78d818e2efde671c331994493154a23183
MD5 f9c78c040375725972dcc3024b046df5
BLAKE2b-256 188488db6ce3824db29bd498c84230573b43686350c1b53e57258d9c7484a3f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.11.1.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.11.1-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: mnestic-0.11.1-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

Hashes for mnestic-0.11.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b4068324dd14c2713d9ba6dd461b51d0a1a027906bad371e6c00773338177539
MD5 01d730629a0b2cb0bac1026cac555c84
BLAKE2b-256 03de4c39c96365245aadfaad2a26c7ccaa8533e47e74ef355837dc3b30ddca1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.11.1-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.11.1-cp37-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mnestic-0.11.1-cp37-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e38acf204dae30c23718a2e9020566cdad0692f131fddbc24e0a03b8147b136e
MD5 63fcf97a8f048ff06c3ff70c00659343
BLAKE2b-256 adcbe5926b749dd1fc2e790f375294555cd325aac2ca48f55c4fb99d19f7ff76

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.11.1-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.11.1-cp37-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mnestic-0.11.1-cp37-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 eaf11313a767eef572da0c33a81e2d9395937dcaf570e74ac6982098541bc7a3
MD5 ce5d112cfb14de6803c89e41cd6b2d1e
BLAKE2b-256 8821dd7b4f1c384465974bc4a182f5c99fcf37921c4070740d51e3ce88973308

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.11.1-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.11.1-cp37-abi3-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mnestic-0.11.1-cp37-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 ea9e152ad17c46871af394f31cd7be1fb1c890f1e4ce3172059d82c0b3c8e81e
MD5 0d654fc823ba1c358ef035646621880e
BLAKE2b-256 bebe46a1e0702739f5543bb083c6bddfa26794bd4007d3bf39c2cbd3195333bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.11.1-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.11.1-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mnestic-0.11.1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f54b81f33f648093009dcea16271a5999124cc4a518c29ca9a81493cf820844c
MD5 e28078320bc2e1f809361dab60109be9
BLAKE2b-256 4326e636d5bc1a290cc59be7e332698151d4961158afedda79de0a2d81a1b81b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnestic-0.11.1-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