Python implementation of OpenMemory - Long-term memory for AI systems
Project description
OpenMemory (Python)
Python implementation of OpenMemory - Long-term memory for AI systems with cognitive architecture.
This is a reimplementation of OpenMemory in Python, maintaining the same cognitive memory architecture while enabling integration with Python-based AI systems.
Features
- Multi-sector memory - Episodic, semantic, procedural, emotional, and reflective memory types
- Automatic decay - Memories fade naturally unless reinforced
- Graph associations - Waypoint-based memory linking
- Pattern recognition - Regex-based sector classification
- User isolation - Per-user memory spaces
- Pluggable embeddings - OpenAI, Sentence-Transformers, or local models
- MCP Server - Built-in Model Context Protocol server
Installation
pip install -r requirements.txt
Quick Start
from openmemory import MemorySystem
# Initialize memory system
memory = MemorySystem(db_path="memory.db")
# Add a memory
result = memory.add_memory(
content="User prefers dark mode in their IDE",
user_id="user123"
)
# Query memories
results = memory.query(
query="What are the user's preferences?",
user_id="user123",
k=5
)
for mem in results:
print(f"Score: {mem.score:.3f} | {mem.content}")
Architecture
OpenMemory uses a cognitive architecture with five memory sectors:
- Episodic (decay: 0.015/day) - Time-based experiences
- Semantic (decay: 0.005/day) - Facts and knowledge
- Procedural (decay: 0.008/day) - How-to instructions
- Emotional (decay: 0.020/day) - Feelings and moods
- Reflective (decay: 0.001/day) - Insights and wisdom
Each memory is:
- Classified into sectors using pattern matching
- Embedded with sector-specific models
- Connected via waypoint graphs
- Tracked with salience scores (0-1)
- Subject to exponential decay
MCP Server
Run the MCP server:
python -m openmemory.mcp.server
Or use with Claude Desktop (add to config):
{
"mcpServers": {
"openmemory": {
"command": "python",
"args": ["-m", "openmemory.mcp.server"]
}
}
}
Development
# Install dev dependencies
pip install -r requirements-dev.txt
# Run tests
pytest tests/
# Format code
black openmemory/
License
MIT License - Copyright (c) 2025
Credits
Based on OpenMemory by CaviraOSS
Python reimplementation by @danielsimonjr
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openmemory_python-1.0.0.tar.gz.
File metadata
- Download URL: openmemory_python-1.0.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d13a50f4e864a1efdea270c3c8e6a696dddde020b278db54ea4485cd1ab36d99
|
|
| MD5 |
5aa9f8c5cac17b85702fab8f47a5cc69
|
|
| BLAKE2b-256 |
804fa2290ecd3edfd8b14fdb96b2bcc9ab7ff86a5e95d3d07566ce5856e7e3f1
|
File details
Details for the file openmemory_python-1.0.0-py3-none-any.whl.
File metadata
- Download URL: openmemory_python-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d885385a54ed9d65af2b31d5bfc27851f6ea165162286af4301a757bd737355
|
|
| MD5 |
3aaef62173f420d3fe02fba5b978e3e4
|
|
| BLAKE2b-256 |
c41f5425806e5d865e2416af8f8dfd1a9cb87782ae112505817085e770dbfc02
|