Skip to main content

Typed block tree + knowledge graph memory SDK for AI agents

Project description

MemBlock

Structured memory SDK for AI agents.

Typed blocks · Knowledge graph · Hybrid search · Encryption · Decay engine — all local, all yours.


Install

pip install memblock

Quick Start

from memblock import MemBlock, BlockType

mem = MemBlock(storage="sqlite:///memory.db")

# Store structured memories
mem.store("User prefers Python", type=BlockType.PREFERENCE)
mem.store("User works at Acme Corp", type=BlockType.FACT, confidence=0.95)

# Query with hybrid search
results = mem.query(text_search="programming", type=BlockType.PREFERENCE)

# Build LLM-ready context
context = mem.build_context(query="user preferences", token_budget=4000)

# Knowledge graph
mem.link(results[0].id, other.id, relation="related_to")

# Tamper detection
mem.verify()

What's Included

  • 5 typed memory blocks — FACT, PREFERENCE, EVENT, ENTITY, RELATION
  • Knowledge graph — 8 relation types, traversal, no external DB
  • Hybrid search — FTS5 + vector similarity with Reciprocal Rank Fusion
  • Memory decay — Exponential decay with access reinforcement
  • AES-256 encryption — Field-level, your keys, no enterprise tier
  • Tamper detection — SHA-256 hash chain on every operation
  • LLM extraction — Auto-extract memories from conversations (OpenAI, Anthropic, Gemini)
  • Conflict resolution — LLM-powered ADD/UPDATE/DELETE decisions
  • Context builder — Token-budgeted, 3 strategies
  • Async API — Full async support via AsyncMemBlock
  • Event hooks — on_add, on_update, on_delete, on_query
  • Hierarchical scoping — org → project → user → agent → session
  • Rerankers — BM25, Cohere, CrossEncoder
  • Storage — SQLite (local) or PostgreSQL (production)
  • CLI — init, query, stats, prune, export, reindex

Optional Extras

pip install "memblock[postgres]"            # PostgreSQL backend
pip install "memblock[embeddings]"          # Local vector embeddings (FastEmbed)
pip install "memblock[llm]"                 # LLM extraction (OpenAI, Anthropic, Gemini)
pip install "memblock[reranker-cohere]"     # Cohere reranker
pip install "memblock[reranker-cross-encoder]"  # HuggingFace reranker
pip install "memblock[all]"                 # Everything

Documentation

Full docs, API reference, and examples: memblock.xyz

License

Proprietary. Copyright (c) 2025-2026 iexcalibur. All Rights Reserved.

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

memblock-0.4.2.tar.gz (94.2 kB view details)

Uploaded Source

Built Distribution

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

memblock-0.4.2-py3-none-any.whl (72.2 kB view details)

Uploaded Python 3

File details

Details for the file memblock-0.4.2.tar.gz.

File metadata

  • Download URL: memblock-0.4.2.tar.gz
  • Upload date:
  • Size: 94.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for memblock-0.4.2.tar.gz
Algorithm Hash digest
SHA256 c36952e97576e82b368b0ee45a17386488c596c1b08fdd50ee03c9ddf56f7fd1
MD5 d834b4071521590b6334ded85538a648
BLAKE2b-256 6674879fc9ed4ac513bd6c3ae14c58391e081675cb0e7f600c3982efb986f69e

See more details on using hashes here.

File details

Details for the file memblock-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: memblock-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 72.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for memblock-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 69c8ad8c6b5030eacfe61e8fcf667bdeaf913692544c0ad3dce16bbc516817c6
MD5 52d17611fd4e38934b17a69c7c51411b
BLAKE2b-256 1570077104ee3d819c3caf574147e7887f2b1bfa8040bd313591be8bf668563b

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