Skip to main content

Cryptographically verified, relational, persistent memory for AI agents.

Project description

cryptomem

Cryptographically verified, relational, persistent memory for AI agents.

This package is the Python engine. Every fact is SHA-256 hashed and Ed25519 signed at write time; at read time each node is re-verified, and tampered or unsigned facts are dropped so the agent abstains rather than guessing.

Install

pip install cryptomem                  # core engine
pip install "cryptomem[serve,local]"   # + Ollama-compatible sidecar & local embeddings

Published on PyPI; the typed Rust client is cryptomem-rs on crates.io.

from cryptomem import MemoryClient

mem = MemoryClient()
mem.archive("Project Phoenix", "Budget approved at $4.2M for FY26.")

for hit in mem.query("What budget did Project Phoenix get?"):
    print(hit.node.content, hit.confidence)

print(mem.answer("What budget did Project Phoenix get?"))

Runs on CPU-only hardware with zero model downloads via the default stub embedder and in-memory SQLite store. See the repository docs/ for the full architecture and roadmap.

Beyond retrieval

  • mem.respond(...) — answer plus a provenance block (injected node ids, verification status, Merkle root).
  • mem.proof(node_id) — a verifiable Merkle inclusion proof against the current ledger root.
  • mem.confidence(...) — semantic-entropy confidence over sampled answers.
  • mem.verify_answer(draft) — Chain-of-Verification re-check of a draft.
  • mem.contradictions() — same-entity nodes whose content diverges.
  • mem.suggest(...), mem.triggers(), mem.stage_facts(...), mem.pending(), mem.confirm(node_id) — proactive planner, triggers, and write-back of staged (pending) facts that you later confirm.

Store backends

Selected via CRYPTOMEM_MODE (or Settings(mode=...)):

  • sqlite (default) — zero-config local store; Python-side vector search.
  • neo4j — graph-native store over the Bolt driver (pip install "cryptomem[neo4j]", CRYPTOMEM_NEO4J_URI=...).
  • remote — signs locally and POSTs verbatim to a /cmem/v1/* backend (CRYPTOMEM_BACKEND_URL=...); falls back to SQLite if the backend is down.

Use with agno

Expose verified memory as agno tools so the agent answers only from signed facts (or abstains):

from agno.agent import Agent
from agno.models.ollama import Ollama
from cryptomem import MemoryClient

MEM = MemoryClient()

def recall_verified_memory(query: str) -> str:
    """Return only signature-verified facts; abstain if none match."""
    hits = [h for h in MEM.query(query, top_k=5) if h.verified]
    if not hits:
        return "NO_VERIFIED_MEMORY: abstain; do not guess."
    return "\n".join(f"- [{h.node.node_id}] {h.node.content}" for h in hits)

agent = Agent(model=Ollama(id="qwen2.5:0.5b"), tools=[recall_verified_memory])
agent.print_response("What budget did Project Phoenix get?")

Full runnable example: examples/agno_verified_memory.py. See also ../docs/framework_integrations.md.

Optional extras

pip install "cryptomem[local]" (MiniLM embeddings), [serve] (FastAPI Ollama-compatible sidecar + CLI), [neo4j] (graph store), [agno] (agno integration example), [dev] (tooling).

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

cryptomem-0.1.10.tar.gz (64.0 kB view details)

Uploaded Source

Built Distribution

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

cryptomem-0.1.10-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file cryptomem-0.1.10.tar.gz.

File metadata

  • Download URL: cryptomem-0.1.10.tar.gz
  • Upload date:
  • Size: 64.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cryptomem-0.1.10.tar.gz
Algorithm Hash digest
SHA256 febaa3a0360f6de3e42be4cbac5aa8d1560a2a4dc4faef97730ca935a31465cb
MD5 4bf8be19f89ee86fd16c1a9f27f51435
BLAKE2b-256 33d8bdaf61905a73eeb35cec4a05b43c23c8bb08d5771a469cb7489babb1dbcd

See more details on using hashes here.

File details

Details for the file cryptomem-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: cryptomem-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cryptomem-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 c8f70d2ecf016ab72b58c6c06e38f17e649df4ae6e513d80237736f50c5ef82b
MD5 73cf759b3d11e57a037cb31f00b1565d
BLAKE2b-256 0f3332aae5bd2567974c69607ce2c1440c21a2fc676f86cc9d6a9c5cb1913fc4

See more details on using hashes here.

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