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.7.tar.gz (34.6 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.7-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: elo_memory-0.1.7.tar.gz
  • Upload date:
  • Size: 34.6 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.7.tar.gz
Algorithm Hash digest
SHA256 822a40b5dcb55f44a6c54de05d87c36eac095861289eeb6b8394ff00426279eb
MD5 81db684009fafcd7b78046c05dade491
BLAKE2b-256 ad554f2f0416f16c0ac569dba9b2aa724195feaa8c7cc47f44494796877209f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: elo_memory-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 37.0 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 bbedae89ca297ff558096689755f813cc4c3406e90b5cb9c525db618fc4ebf5d
MD5 c5a489ae5886bc1cc623566981579bcd
BLAKE2b-256 54e53b12b1e5dc2cf5960f783942969cc1044c4d21a8398aac9eafab15cf37de

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