Skip to main content

hyperspace-memory (Python) 🚀

Drop-in replacement for Mem0, Zep, and MemGPT powered by the HyperspaceDB native memory engine with 1-bit ADC quantization, MRL in-RAM cascades, and Lorentz hyperbolic spaces.

PyPI Version License: MIT


⚡ Key Advantages over Mem0 & Zep

  • 100x Lower Search Latency: Sub-millisecond (< 0.5 ms) retrieval via MRL in-RAM cascade indexing.
  • 98% RAM & Storage Reduction: Native extreme 1-bit ADC and turbo 4-bit Lloyd-Max quantization (compressed down to ~100B per vector).
  • Zero Extra LLM Calls: Direct vector and graph traversal memory operations without forcing expensive LLM parsing for every insert.
  • 100% Mem0 API Compatibility: Replace from mem0 import Memory with from hyperspace_memory import Memory without altering your application code.

📦 Installation

pip install hyperspace-memory

🛠 Quick Start (Mem0 Drop-In Migration)

from hyperspace_memory import Memory

# 1. Initialize Memory (connects to HyperspaceDB)
memory = Memory(config={
    "host": "the.yar.ink",
    "api_key": "YOUR_YARINK_API_KEY",
    "quantization": "medium_plus"  # "none" | "medium_plus" | "turbo" | "extreme"
})

# 2. Add Memory
res = memory.add(
    "User prefers Rust and dark mode UI over Python and light mode.",
    user_id="user_123",
    metadata={"category": "preferences"}
)
print("Added Memory:", res)

# 3. Search Memory
results = memory.search("What programming language does the user prefer?", user_id="user_123", limit=3)
for item in results:
    print(f"Memory: {item['memory']} (Score: {item['score']})")

# 4. Get All Memories for User
all_memories = memory.get_all(user_id="user_123")

# 5. Cognitive Consolidation (Fréchet Mean on Hyperboloid)
consolidation = memory.consolidate(
    "programming languages",
    summary_text="User strongly favors Rust and systems programming."
)
print("Consolidated concept:", consolidation["summary"])

# 6. Anti-Hallucination Claim Verification (Lorentz Geodesic Trust)
verification = memory.verify_claim(
    "User prefers Rust and dark mode UI over Python and light mode.",
    "User always requests Python notebooks with light themes."
)
print("Trust status:", verification["status"], "Score:", verification["trust_score"])

# 7. Delete & Reset
memory.delete(results[0]["id"])

🧠 Cognitive Operations

  • memory.consolidate(topic_query, ...): Synthesizes a cluster of related episodic memories into a single abstract semantic concept using the Fréchet Mean on the hyperboloid.
  • memory.verify_claim(premise, conclusion, threshold=0.30): Computes Geodesic Trust Score (Lorentz $\mathbb{H}^{32}$ + Cosine 96D) to verify that an LLM conclusion does not hallucinate.
  • memory.link(source_id, target_id, relation="OWNS", weight=1.0): Links two memory nodes or concepts with an explicit directed edge in the in-engine CSR graph.
  • memory.link_batch(edges): Atomic bulk edge insertion for rapid knowledge ingestion.
  • memory.unlink(source_id, target_id, relation="OWNS"): Zero-lag deletion of graph edges.
  • memory.induce_edges(rules): Declaratively builds edges from metadata attributes (path_hierarchy, foreign_key, exact_match).
  • memory.list_sessions(limit=100): Discovers and enumerates active conversational sessions.
  • memory.explore_hierarchy(concept_id, direction="down"): Navigates conceptual taxonomy trees in Lorentz space.
  • memory.stats(): Returns vector counts, cascade configuration, and collection status.

📄 License

MIT © YARlabs.

Metadata

Release files for hyperspace-memory 4.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hyperspace-memory 4.1.0
File Size Uploaded
hyperspace_memory-4.1.0.tar.gz 23.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hyperspace-memory 4.1.0
File Interpreter ABI Platform
hyperspace_memory-4.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.3 kB

Release files / hyperspace_memory-4.1.0.tar.gz

Download URL hyperspace_memory-4.1.0.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f19576c8b17b9cba53280674b72c15566fd6849fc576e6d752a9c585731a55ea
BLAKE2b-256 checksum
How to use checksums
12aa66af9a09abc3ba9623d6169db58acbece1c1d579139d89df56de1f126d1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / hyperspace_memory-4.1.0-py3-none-any.whl

Download URL hyperspace_memory-4.1.0-py3-none-any.whl
Size 23.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
baa4dc704ffb0c1ac5938e8ee853e9c3a3bf9f8028abece8b7d0fad99ab86e0d
BLAKE2b-256 checksum
How to use checksums
091ffcf3d8af7e7d6146ab05f8a07d78010e20fcf6b167061f8f4a7b52b0b9c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 release files

4.0.0

2 release files

3.1.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page