Skip to main content

Bio-inspired episodic memory system for AI agents

Project description

Elo Memory

PyPI version Python 3.10+ License: MIT Tests Code style: black

Bio-inspired episodic memory system implementing EM-LLM (ICLR 2025).

The missing memory layer for AI agents — automatic event detection, surprise-based encoding, and human-like memory consolidation.

Works with: OpenClaw | Claude Code | OpenCode | Codex | Claude | Any MCP-compatible agent


Why Elo Memory?

AI agents forget everything between conversations. Elo Memory fixes that.

  • Fast — Retrieves relevant memories in ~5ms. Agent queries by similarity, gets top 5 matches. Never reads all memories.
  • Smart storage — Bayesian surprise engine decides in <1ms what's worth remembering. Repetitive content is skipped automatically.
  • Human-like recall — Two-stage retrieval finds by similarity first, then expands by time context. Like how you remember "that whole day" not just one fact.
  • Self-maintaining — Background consolidation extracts patterns. Old irrelevant memories decay naturally. No manual cleanup.
  • Works everywhere — Python library, MCP server, or REST API. Drop into any agent framework.

How It Works

User message → Query memory (5ms) → 5 relevant episodes → Added to prompt → Better response
                                              ↓
                                    Surprise check (1ms) → Novel? Store it. Boring? Skip it.
                                              ↓
                                    Consolidation (background) → Extract patterns, forget noise

Quick Start

pip install elo-memory
from elo_memory import EpisodicMemoryStore, BayesianSurpriseEngine

# Initialize memory
memory = EpisodicMemoryStore(embedding_dim=768)
surprise = BayesianSurpriseEngine(input_dim=768)

# Store an observation
embedding = encoder.encode("User loves Italian food")
surprise_info = surprise.compute_surprise(embedding)

if surprise_info['is_novel']:
    memory.store_episode(
        content={"text": "User loves Italian food"},
        embedding=embedding,
        surprise=surprise_info['surprise']
    )

# Retrieve relevant memories
results = memory.retrieve(query_embedding, k=5)

vs Alternatives

Elo Memory Mem0/Zep Plain RAG
Stores Experiences with surprise Everything Documents
Retrieval Similarity + temporal Similarity only Similarity only
Filtering Automatic (surprise) Manual None
Forgetting Natural decay Manual cleanup None
Speed ~5ms query ~50ms ~100ms
Cost Free $70+/month API costs

Components (8/8 Complete)

Component Description Status
Bayesian Surprise Detection KL divergence-based novelty detection
Event Segmentation HMM + prediction error boundaries
Episodic Storage ChromaDB with temporal-spatial indexing
Two-Stage Retrieval Similarity + temporal expansion
Memory Consolidation Sleep-like replay + schema extraction
Forgetting & Decay Power-law activation decay
Interference Resolution Pattern separation/completion
Online Learning Experience replay + adaptive thresholds

Documentation


Installation

From PyPI

pip install elo-memory

From Source

git clone https://github.com/server-elo/elo-memory.git
cd elo-memory
pip install -e ".[dev]"

With API Server

pip install "elo-memory[api]"
elo-memory server --port 8000

Running Tests

pytest tests/ -v --cov=elo_memory

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Quick start:

git clone https://github.com/server-elo/elo-memory.git
cd elo-memory
pip install -e ".[dev]"
pytest

License

MIT License — see LICENSE for details.


Acknowledgments

  • EM-LLM (ICLR 2025) — Research foundation
  • Itti & Baldi (2009) — Bayesian Surprise
  • Squire & Alvarez (1995) — Systems Consolidation
  • Kirkpatrick et al. (2017) — Catastrophic Forgetting

Links


Status: Production ready ✅

Made with ❤️ by the Elo Memory community.

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

elo_memory-0.1.8.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

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

elo_memory-0.1.8-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

Details for the file elo_memory-0.1.8.tar.gz.

File metadata

  • Download URL: elo_memory-0.1.8.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for elo_memory-0.1.8.tar.gz
Algorithm Hash digest
SHA256 0650c7552b30462b417e8d78e165d2ef80e6fdf788810e8107fd355e235cc0a1
MD5 a69c875f81168aa9f7d0e4dd5669a810
BLAKE2b-256 768af7729bc76cced202d06942ee105e93e0a170eda9b6bf192094305ae8677a

See more details on using hashes here.

File details

Details for the file elo_memory-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: elo_memory-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for elo_memory-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 65e9a6dbed75746ed9f5d612db068fd9ab375af59a44ded7d36e7b923d48bf60
MD5 0a48c4ed3ce2929f58b2d6bb5f91c212
BLAKE2b-256 a72ea30e4be635c0d8186b6ee3987a51667dc1aa19677da62912bd61c58f93d7

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