Memory #36

Open
opened 2025-06-07 19:55:09 -04:00 by milo · 0 comments
Owner

🧠 Memory Feature Scope – ChromaDB Integration

Goal

Enable long-term memory so the bot can remember facts about users, past conversations, or important events, making interactions feel more alive and personal.


Phase 1: ChromaDB Setup

  • Add chromadb to requirements.txt
  • Create a module: memory/chroma_memory.py
  • Initialize a persistent ChromaDB instance (e.g. ./memory/chroma_db/)
  • Define default collection: memories
  • Ensure each memory has:
    • id (e.g., user123_2024-06-01)
    • user_id or username
    • content (the memory fact or message)
    • metadata (timestamp, type, source)

Phase 2: Writing Memories

  • Hook into message handling pipeline (on_message)
  • Extract key facts/messages (e.g., "I love Apex Legends" → memory)
  • Store into ChromaDB with metadata
  • Optional: Use keyword extraction or simple LLM call to summarize what’s worth remembering

Phase 3: Retrieving Memories

  • Add memory injection to get_ai_response() context:
    • On message, retrieve relevant memories via vector similarity (e.g., cosine sim)
    • Format as natural-language memory recall (e.g., "Last time you mentioned you love Apex.")
  • Inject top 3–5 similar memory chunks into the context block

  • !remember → Manually add a memory
  • !memories → List a user’s stored memories
  • !forget → Wipe memory of a user or phrase

Phase 5: Optimization and Future Steps

  • Add memory type filtering (e.g., mood, interest, insult, inside joke)
  • Build sentiment/mood tagging into stored memories
  • Periodic memory cleanup or summarization
  • Integrate memory into personality module for adaptive behavior
  • Use embeddings from LLM instead of default Chroma sentence transformer

Tech Notes

  • ChromaDB can be run embedded/local, no server needed
  • Initial vector model: all-MiniLM-L6-v2 or intfloat/e5-small-v2
  • Consider storing embeddings separately to allow upgrades later
## 🧠 Memory Feature Scope – ChromaDB Integration ### Goal Enable long-term memory so the bot can **remember facts about users**, **past conversations**, or **important events**, making interactions feel more alive and personal. --- ### Phase 1: ChromaDB Setup - [ ] Add `chromadb` to `requirements.txt` - [ ] Create a module: `memory/chroma_memory.py` - [ ] Initialize a persistent ChromaDB instance (e.g. `./memory/chroma_db/`) - [ ] Define default collection: `memories` - [ ] Ensure each memory has: - `id` (e.g., `user123_2024-06-01`) - `user_id` or `username` - `content` (the memory fact or message) - `metadata` (timestamp, type, source) --- ### Phase 2: Writing Memories - [ ] Hook into message handling pipeline (`on_message`) - [ ] Extract key facts/messages (e.g., `"I love Apex Legends"` → memory) - [ ] Store into ChromaDB with metadata - [ ] Optional: Use keyword extraction or simple LLM call to summarize what’s worth remembering --- ### Phase 3: Retrieving Memories - [ ] Add memory injection to `get_ai_response()` context: - On message, retrieve relevant memories via vector similarity (e.g., cosine sim) - Format as natural-language memory recall (e.g., `"Last time you mentioned you love Apex."`) - [ ] Inject top 3–5 similar memory chunks into the context block --- ### Phase 4: User Control (Optional but recommended) - [ ] `!remember` → Manually add a memory - [ ] `!memories` → List a user’s stored memories - [ ] `!forget` → Wipe memory of a user or phrase --- ### Phase 5: Optimization and Future Steps - [ ] Add memory type filtering (e.g., mood, interest, insult, inside joke) - [ ] Build sentiment/mood tagging into stored memories - [ ] Periodic memory cleanup or summarization - [ ] Integrate memory into personality module for adaptive behavior - [ ] Use embeddings from LLM instead of default Chroma sentence transformer --- ### Tech Notes - ChromaDB can be run **embedded/local**, no server needed - Initial vector model: `all-MiniLM-L6-v2` or `intfloat/e5-small-v2` - Consider storing embeddings separately to allow upgrades later
milo added this to the Alpha Build Ready milestone 2025-06-07 19:55:09 -04:00
milo added the
High Priority
💡feature
labels 2025-06-07 19:55:09 -04:00
milo self-assigned this 2025-06-07 19:55:09 -04:00
milo added this to the Minimum Viable Product project 2025-06-07 19:55:09 -04:00
Sign in to join this conversation.
No description provided.