🧠 SoulMemory
A memory system for AI companions that mimics human memory: remembers, recalls, forgets, and consolidates.
🎯 Why SoulMemory?
Most AI chatbots have no memory. Every conversation starts from zero. SoulMemory gives your AI a persistent, human-like memory that:
- ✅ Remembers important events (and auto-detects what's important)
- 🔍 Recalls relevant memories using semantic search
- ⏳ Forgets trivial things naturally over time
- 🗜️ Consolidates old memories to save space
- 🛡️ Protects critical memories from ever being forgotten
✨ Features
| Feature | Description |
|---|---|
remember() |
Store memories with auto importance detection |
recall() |
Semantic search (understands meaning, not just keywords) |
decay() |
Natural forgetting based on time and usage |
consolidate() |
Compress similar old memories into summaries |
stats() |
Memory statistics and insights |
📦 Installation
pip install soulmemory
Or install from source:
git clone https://github.com/YOUR_USERNAME/soulmemory.git
cd soulmemory
pip install -e .
🚀 Quick Start
from soulmemory import SoulMemory
# Initialize
mem = SoulMemory("my_memory.db")
# Store memories (importance auto-detected)
mem.remember("My girlfriend proposed to me today!")
mem.remember("Had a sandwich for lunch")
# Search semantically
results = mem.recall("romantic news")
for r in results:
print(r['content']) # → "My girlfriend proposed to me today!"
# Clean up
mem.close()
🧩 Core Concepts
Memory Levels
| Level | Behavior | Example |
|---|---|---|
critical |
Never forgotten | "My mother passed away" |
important |
Fades slowly | "Got a promotion at work" |
normal |
Standard decay | "Meeting with the team" |
trivial |
Fades quickly | "It's cloudy today" |
Auto Importance Detection
SoulMemory automatically detects how important a memory is:
# No need to specify importance - it's detected
mem.remember("My girlfriend proposed to me!")
# → importance: 0.95, level: critical
mem.remember("It's raining outside")
# → importance: 0.35, level: trivial
The Forgetting Curve
Memories fade over time, just like human memory:
# Run the forgetting process
forgotten = mem.decay(decay_rate=0.85, threshold=0.2)
print(f"Forgot {forgotten} memories")
The formula:
score = importance × (decay_rate ^ days_since_access) + (access_count × 0.05)
- More days without access → lower score
- More times accessed → stays "alive"
- Score below threshold → memory is forgotten
criticalmemories → never decay
📚 API Reference
remember(content, importance=None, level=None, emotion=None, auto_detect=True)
Store a new memory.
mem.remember("First date with Ana at the coffee shop")
recall(query, limit=5)
Search for relevant memories.
results = mem.recall("what do I know about Ana?")
decay(decay_rate=0.85, threshold=0.2)
Run the forgetting process.
forgotten_count = mem.decay()
consolidate(min_age_days=7, similarity_threshold=0.75)
Compress old, similar memories.
consolidated = mem.consolidate()
stats()
Get memory statistics.
print(mem.stats())
# → {'total_memories': 42, 'by_level': {'critical': 3, ...}}
🛠️ Use Cases
- 🤖 AI Companions that remember your life
- 💬 Chatbots with long-term memory
- 🎮 Game NPCs that remember player interactions
- 📔 Personal AI journals that evolve over time
🗺️ Roadmap
- Core memory storage
- Semantic search
- Importance auto-detection
- Decay (forgetting)
- Consolidation
- Emotional tagging
- Memory associations
- Multi-user support
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- sentence-transformers for embeddings
- sqlite-vec for vector search
Made with ❤️ for the AI community
If you find this useful, please ⭐ star the repository!
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 soulmemory-0.1.0.tar.gz.
File metadata
- Download URL: soulmemory-0.1.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d13b0be8786f512b3fa7edc32b56034f37b927b258921c4f143791f675b1ee3
|
|
| MD5 |
b5726063f66128fab20b566703875d4c
|
|
| BLAKE2b-256 |
851002ad0113baf27eb11aa409501af77cc6ad2591666c2eff01bb60b2262b73
|
File details
Details for the file soulmemory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: soulmemory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb2a0bf4f551811fb508ee3882b0ae5965ef926deaf2b8cc49fd0b19590aed2c
|
|
| MD5 |
07c22ceb20d1ad74e8764f3994ed76c8
|
|
| BLAKE2b-256 |
ed91d451c2c4bb9e6ec1a280edb13188c9cfddf5e8f0f068cc57f88278a4ff6f
|