Skip to content

Comments

Feat: Memory Summarization and User Registry#2

Open
cyrexez wants to merge 6 commits intosobowalebukola:mainfrom
cyrexez:feat/memory-summarization
Open

Feat: Memory Summarization and User Registry#2
cyrexez wants to merge 6 commits intosobowalebukola:mainfrom
cyrexez:feat/memory-summarization

Conversation

@cyrexez
Copy link

@cyrexez cyrexez commented Jan 8, 2026

Overview
This PR introduces a tiered memory architecture, persistent AI models, and a robust user identity layer to ensure personalized, hallucination-free AI responses.

Technical additions

  1. User Identity & Registration (New Core)
    Multi-User Support: Implemented a dedicated User class in Weaviate to store unique profiles, bios, and metadata.

Contextual Anchor: The system now fetches the user's "Bio" before every interaction. This bio is injected into the LLM system prompt, ensuring the AI understands the specific technical context of the user (e.g., "Software Engineer working on Go").

Isolated Memory Streams: Memories are strictly partitioned by userId, allowing for personalized summarization thresholds and retrieval per user.

  1. Persistent AI Infrastructure (Docker)
    Bind Mount Migration: Updated docker-compose.yml to map ./ollama_storage to /root/.ollama. This ensures that large models like deepseek-r1:1.5b persist across container restarts.

Refined service healthchecks so the Go server only attempts to connect once the Ollama model runner is fully responsive.

I also added comments on the progress of the go-server in its logs to enable future debugging and identification of issues.

  1. Semantic Summarization & RAG Logic
    Integrated a Summarizer package that uses DeepSeek-R1 to distill fragmented memories into concise summaries once a threshold (e.g., 5 items) is reached.

By anchoring responses with the User Bio, the model correctly identifies MemCortex as a software project, eliminating the hallucinations previously observed.

Embedding Worker Pool: Added a concurrent queue with a 5-retry exponential backoff to handle high-volume embedding requests without crashing the local AI server.

  1. Database Evolution
    Self-Bootstrapping Schema: The application now manages its own schema creation on startup, automatically configuring Weaviate classes for Users and Memories.

Bi-directional Logging: The system saves both User queries and AI responses, ensuring "past context" remains coherent.

Results
User A's memories do not bleed into User B's context.
Summarizer is trigged based on the summary threshold and gives a response with past context
It has reduced hallucinations due to prompt restrictions
Proof is in the folder image_tests ( Using Thunderclient)

@cyrexez
Copy link
Author

cyrexez commented Jan 8, 2026

user_registry summarizer

Copy link
Owner

@sobowalebukola sobowalebukola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes

@cyrexez
Copy link
Author

cyrexez commented Jan 12, 2026

Screenshot 2026-01-12 at 15 26 30

@cyrexez cyrexez force-pushed the feat/memory-summarization branch from 8a63de6 to 13870e4 Compare January 18, 2026 18:39
# Base Ollama image
FROM ollama/ollama:latest

# We comment these out because the models are already in your local volume.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an assumption that someone running it for the first time will automatically have deepseek and nomic-embed already installed on their machine.

# Base Ollama image
FROM ollama/ollama:latest

# We comment these out because the models are already in your local volume.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an assumption that someone running it for the first time will automatically have deepseek and nomic-embed already installed on their machine. We shouldn't comment this out

userBio, err := h.Manager.GetUserBio(ctx, userID)
if err != nil {
log.Printf("Could not fetch user bio: %v", err)
userBio = "A software project called MemCortex."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still feel opinionated about defualting the userBio tp 'A software project called Memcortex'

Copy link
Owner

@sobowalebukola sobowalebukola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants