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
Metadata
Release files for openmemory-python 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openmemory_python-1.0.0.tar.gz | 20.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openmemory_python-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.0 kB
Release files / openmemory_python-1.0.0.tar.gz
| Download URL | openmemory_python-1.0.0.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d13a50f4e864a1efdea270c3c8e6a696dddde020b278db54ea4485cd1ab36d99
|
|
BLAKE2b-256 checksum How to use checksums |
804fa2290ecd3edfd8b14fdb96b2bcc9ab7ff86a5e95d3d07566ce5856e7e3f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / openmemory_python-1.0.0-py3-none-any.whl
| Download URL | openmemory_python-1.0.0-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d885385a54ed9d65af2b31d5bfc27851f6ea165162286af4301a757bd737355
|
|
BLAKE2b-256 checksum How to use checksums |
c41f5425806e5d865e2416af8f8dfd1a9cb87782ae112505817085e770dbfc02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|