A persistent memory agent powered by Ollama that remembers conversations, learns facts, and evolves its personality over time through a growing soul.md file.
- Long-term Memory: Remembers all conversations, facts, and tasks across sessions
- Growing Soul:
soul.mdfile that evolves with personality traits, knowledge areas, and relationship patterns - Context-Aware: Automatically retrieves relevant memories for each conversation
- Lightweight: JSON-based storage, no heavy dependencies
- Persistent: Survives restarts - all memories and knowledge are preserved
- Interactive Commands: Rich command set for memory management
- Python 3.8+ installed
- Ollama installed and running (ollama.com)
- Git (for cloning/pushing to GitHub)
- Clone the repository:
git clone <your-private-repo-url>
cd agent- Install dependencies:
pip install ollama- Pull an Ollama model (if you don't have one):
# Recommended: Fast lightweight model
ollama pull llama3.2:1b
# Or other options:
ollama pull mistral
ollama pull phi3:mini- Run the agent:
python simple_agent.pyOr on Windows, double-click:
start_agent.bat
When you first run the agent, it will show:
[*] Initializing Ollama Agent with Memory Layer...
[+] Agent initialized! (Model: llama3.2:1b)
[MEMORY] Starting fresh - no previous memories found
Type /help to see available commands
| Command | Description | Example |
|---|---|---|
/help |
Show all available commands | /help |
/soul |
Display the agent's evolving soul.md | /soul |
/commit [n] |
Manually commit last n exchanges to memory | /commit 3 |
/learn <fact> |
Teach the agent a fact | /learn I prefer Python over JavaScript |
/task <task> |
Record a completed task | /task Built authentication system |
/search <query> |
Search through memories | /search Python preferences |
/stats |
Show memory growth statistics | /stats |
/quit |
Exit the agent | /quit |
You: Hi! My name is Alex and I'm a Python developer.
Agent: Hello Alex! Nice to meet you...
You: /learn I prefer FastAPI for building APIs
[LEARNED] Learned: I prefer FastAPI for building APIs
[NOTIFY] Soul updated with new knowledge
You: /task Completed user authentication module
[TASK] Task recorded: Completed user authentication module
You: What do you know about my tech preferences?
Agent: Based on our conversations, I know you're Alex, a Python developer
who prefers using FastAPI for building APIs...
You: /stats
[STATS] Growth Statistics:
Total Memories: 3
Conversations: 1
Facts: 1
Tasks: 1
Knowledge Areas:
- general: 1
You: /soul
============================================================
# Agent Soul
**Created**: 2026-02-02 17:09:45
**Total Interactions**: 3
**Last Updated**: 2026-02-02 18:45:10
## Memory Statistics
- **Total Memories**: 3
- **Conversations Tracked**: 1
- **Facts Learned**: 1
- **Tasks Completed**: 1
============================================================
┌─────────────────────────────────────────────────────────┐
│ simple_agent.py │
│ (Main agent interface) │
└─────────────────┬───────────────────────────────────────┘
│
┌─────────────┴─────────────┐
│ │
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ simple_memory.py│ │ Ollama API │
│ (Memory layer) │ │ (LLM inference) │
└────────┬────────┘ └──────────────────┘
│
┌────┴────┐
▼ ▼
┌─────────┐ ┌──────────┐
│soul.md │ │memories │
│ │ │.json │
└─────────┘ └──────────┘
- Conversations: Every exchange is stored with timestamps
- Facts: Explicitly taught information with optional categories
- Tasks: Completed work with outcomes
- Auto-Context: Relevant memories automatically retrieved for each query
- Soul Updates: Every 5 interactions (configurable),
soul.mdupdates with insights
agent/
├── simple_agent.py # Main agent interface
├── simple_memory.py # Memory management layer
├── config.py # Configuration settings
├── soul.md # The agent's evolving soul
├── memory_store/
│ └── memories.json # All stored memories
├── requirements-simple.txt # Python dependencies
├── start_agent.bat # Windows launcher
├── .gitignore # Git ignore rules
└── README.md # This file
Edit config.py to customize:
# Change the Ollama model
OLLAMA_MODEL = "llama3.2:1b" # or "mistral", "phi3:mini", etc.
# Change soul update frequency
SOUL_UPDATE_FREQUENCY = 5 # Updates every N interactions
# Memory storage location
MEMORY_DIR = BASE_DIR / "memory_store"All data persists across sessions:
- Memories:
memory_store/memories.json(all conversations, facts, tasks) - Soul:
soul.md(personality, knowledge, statistics) - On Restart: Agent loads all previous memories and shows summary
Example restart:
[+] Agent initialized! (Model: llama3.2:1b)
[MEMORY] Loaded 25 existing memories from previous sessions
- 18 conversations
- 5 facts
- 2 tasks
Organize knowledge by category:
You: /learn Team uses Docker for deployment
Categories help the agent organize knowledge areas in soul.md.
Force immediate soul updates:
You: /commit
[COMMIT] Committed 1 conversation exchange(s) and updated soul
[NOTIFY] Soul updated with new memories
Commit multiple exchanges:
You: /commit 5
Find past conversations or facts:
You: /search Docker
[SEARCH] Found 3 memories:
1. [FACT]: Team uses Docker for deployment
2. [PAST CONVERSATION]
User: How do we deploy applications?
Agent: Based on what I know...
The agent provides real-time feedback:
[NOTIFY] Soul updated automatically- After 5 interactions[NOTIFY] Soul updated with new knowledge- When learning triggers update[NOTIFY] Soul updated with task completion- When tasks trigger update[NOTIFY] Soul updated with new memories- Manual commits[NOTIFY] Search completed- After memory searches[NOTIFY] Statistics retrieved- After viewing stats
Problem: Ollama is not running or model not available
Solution:
- Check Ollama is running:
ollama list - Pull the model:
ollama pull llama3.2:1b - Verify model name in
config.pymatches available model
Problem: Memories not persisting
Solution:
- Check
memory_store/memories.jsonexists - Verify file permissions
- Run
python test_memory.pyto diagnose
Problem: Context not being retrieved
Solution:
- Use
/search <fact>to verify fact was saved - Check
soul.mdshows facts learned - Facts are automatically included in context for all queries
Problem: Model taking too long
Solution:
- Switch to smaller model:
ollama pull llama3.2:1b - Update
config.pywith faster model - Check system resources
# Test memory persistence
python test_memory.py
# Test search functionality
python test_search.py
# Test context retrieval
python quick_test.pyAdd custom commands in simple_agent.py:
elif user_input.lower().startswith("/mycmd"):
# Your custom command logic
print("[MYCMD] Command executed")Add custom memory types in simple_memory.py:
def add_custom_type(self, data: str) -> str:
memory = {
"id": len(self.memories),
"type": "custom",
"text": data,
"timestamp": datetime.now().isoformat()
}
self.memories.append(memory)
self._save_memories()
return str(memory["id"])- Python: 3.8 or higher
- Ollama: Latest version
- Disk Space: ~100MB for model + memories
- RAM: 2GB minimum (4GB recommended for larger models)
MIT License - See LICENSE file for details
This is a private repository. For questions or issues, contact the repository owner.
- Initial release
- JSON-based memory storage
- Growing soul.md system
- Interactive command interface
- Memory persistence across sessions
- Context-aware conversations
- Real-time notifications
- Teach facts explicitly using
/learnfor important information - Check
/statsregularly to see agent growth - Review
soul.mdto see personality evolution - Use
/commitafter important conversations to force soul updates - Search memories with
/searchto verify what the agent remembers - Categories help - use them when learning facts for better organization
For issues, bugs, or feature requests, please open an issue in the GitHub repository.
Built with Ollama - Local LLM inference Inspired by mem0 - Memory for AI agents