Skip to main content

HY Memory - Industrial-grade dual-system cognitive memory framework

Project description

HY Memory

Production-grade dual-system cognitive memory for LLM agents.

English | 中文

Quick Start

pip install hy-memory-internal
from hy_memory import HyMemoryClient

client = HyMemoryClient(mode="pro")

# Write — plain text
client.add("I love sci-fi movies, especially Interstellar", user_id="user_1")

# Write — conversation messages (OpenAI format)
client.add([
    {"role": "user", "content": "Recommend a movie"},
    {"role": "assistant", "content": "Try Interstellar — a sci-fi masterpiece by Nolan"},
], user_id="user_1")

# Search
results = client.search("What movies does the user like?", user_ids=["user_1"])
for mem in results["memories"]["normal"]:
    print(f"  [{mem['score']:.2f}] {mem['content']}")

client.close()

Features

  • 7-Layer Memory Architecture — L0 (basic info) through L7 (intentions), progressively abstracted
  • LLM-Driven Extraction — Automatically extracts facts, identity traits, and behavioral patterns
  • Three Processing Modes — lite (embedding only), pro (+ LLM extraction), ultra (+ graph inference)
  • Semantic Search — Vector similarity with profile/normal/proactive channel separation
  • Evolution Chains — Tracks how memories update over time via supersedes links
  • Graph Knowledge (ultra mode) — Schema inference and cross-domain pattern detection
  • Multiple Backends — ChromaDB, Qdrant, FAISS for vectors; Neo4j, Kuzu for graphs
  • OpenAI-Compatible — Works with any LLM/embedding service that supports the OpenAI API format

Configuration

Minimal setup — just two API keys:

export MEMORY_LLM_API_KEY="sk-your-key"
export MEMORY_LLM_BASE_URL="https://api.deepseek.com"
export MEMORY_LLM_MODEL="deepseek-chat"

export MEMORY_EMBEDDER_API_KEY="sk-your-key"
export MEMORY_EMBEDDER_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
export MEMORY_EMBEDDER_MODEL="text-embedding-v3"
export MEMORY_EMBEDDING_DIMS=1024

Or use OpenAI defaults with a single key:

export OPENAI_API_KEY="sk-your-key"

Modes

Mode What it does Graph Best for
lite Embedding-only write, no LLM No Fast ingestion, zero LLM cost
pro + LLM extraction + reconciliation No Standard use case
ultra + System 2 schema inference + sweeper Yes Full cognitive architecture

Install Options

pip install hy-memory-internal            # Core (ChromaDB included)
pip install hy-memory-internal[qdrant]    # + Qdrant
pip install hy-memory-internal[faiss]     # + FAISS
pip install hy-memory-internal[graph]     # + Neo4j + Kuzu
pip install hy-memory-internal[redis]     # + Redis cache
pip install hy-memory-internal[all]       # Everything

API Overview

from hy_memory import HyMemoryClient

client = HyMemoryClient(mode="pro")

# Write memory
client.add("User likes basketball", user_id="u1")
client.add([
    {"role": "user", "content": "Recommend a movie"},
    {"role": "assistant", "content": "Try Interstellar"},
], user_id="u1")

# Search (returns profile/normal/proactive channels)
results = client.search("hobbies", user_ids=["u1"], limit=10)

# CRUD
client.get("memory_id")
client.update("memory_id", "Updated content")
client.delete("memory_id")
client.list_memories(user_id="u1")

# Ultra mode: check System 2 completion
status = client.get_write_status("request_id")

client.close()

Documentation

License

MIT

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

hy_memory-1.2.11.tar.gz (326.8 kB view details)

Uploaded Source

Built Distribution

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

hy_memory-1.2.11-py3-none-any.whl (360.7 kB view details)

Uploaded Python 3

File details

Details for the file hy_memory-1.2.11.tar.gz.

File metadata

  • Download URL: hy_memory-1.2.11.tar.gz
  • Upload date:
  • Size: 326.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for hy_memory-1.2.11.tar.gz
Algorithm Hash digest
SHA256 078a4961931cde6aba86bc7b30e1f1c63632e3b312aca0e340b215e6f4678adb
MD5 de306a3deefdd26ee2aaa795808085a4
BLAKE2b-256 a8da08ac5e196ba3c08245cf91d0c084affc9a2c0dac45838e22b8e45d4edb0c

See more details on using hashes here.

File details

Details for the file hy_memory-1.2.11-py3-none-any.whl.

File metadata

  • Download URL: hy_memory-1.2.11-py3-none-any.whl
  • Upload date:
  • Size: 360.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for hy_memory-1.2.11-py3-none-any.whl
Algorithm Hash digest
SHA256 ff622318f2376b57a83608bcf79cdc2ac145b8d6cb6686fa25d9ae613d03d5b3
MD5 040af4d276dc923aa69434ef9c3b70d4
BLAKE2b-256 5085534b2652934dc22568f6eb8c8ba39d0dcd0f562ac3b662fd66d7915f0a2f

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