The Contextual AI Assistant is an advanced system designed to understand user activities across applications by continuously ingesting screen data and responding to complex contextual queries. This document provides comprehensive technical documentation, implementation guidelines, and system design details for the solution based on Mem0's hybrid memory architecture with Neo4j as the graph store.
The knowledge graph in Neo4j consists of the following node types and relationships:
Core Entity Nodes:
| Node Label | Description | Key Properties |
|---|---|---|
Person |
Individuals (users, contacts, team members) | id, name, role, email |
Message |
Communication content across platforms | id, content, timestamp, status |
PullRequest |
Code review requests | id, number, title, description, status, repo |
Comment |
Remarks on various entities | id, content, timestamp |
Team |
Groups of people working together | id, name, description |
Project |
Work initiatives containing tasks | id, name, description, status |
Application |
Software applications being used | id, name, type |
Key Relationships:
| Relationship Type | Source → Target | Description |
|---|---|---|
AUTHORED |
Person → Message / Comment |
Person created content |
RECEIVED_BY |
Message → Person |
Message was received by person |
REPLIED_TO |
Message → Message |
Message is a reply to another |
MEMBER_OF |
Person → Team |
Person belongs to team |
WORKS_ON |
Person → Project |
Person works on project |
CREATED |
Person → PullRequest |
Person created PR |
REVIEWED |
Person → PullRequest |
Person reviewed PR |
COMMENTED_ON |
Person → PullRequest |
Person commented on PR |
CAPTURED_IN |
{Any Entity} → Application |
Entity was observed in app |
Neo4j Schema Definition:
// Core entity constraints
CREATE CONSTRAINT person_id IF NOT EXISTS FOR (p:Person) REQUIRE p.id IS UNIQUE;
CREATE CONSTRAINT message_id IF NOT EXISTS FOR (m:Message) REQUIRE m.id IS UNIQUE;
CREATE CONSTRAINT pr_id IF NOT EXISTS FOR (pr:PullRequest) REQUIRE pr.id IS UNIQUE;
CREATE CONSTRAINT comment_id IF NOT EXISTS FOR (c:Comment) REQUIRE c.id IS UNIQUE;
CREATE CONSTRAINT team_id IF NOT EXISTS FOR (t:Team) REQUIRE t.id IS UNIQUE;
CREATE CONSTRAINT project_id IF NOT EXISTS FOR (p:Project) REQUIRE p.id IS UNIQUE;
CREATE CONSTRAINT app_id IF NOT EXISTS FOR (a:Application) REQUIRE a.id IS UNIQUE;
// Indexes for efficient lookups
CREATE INDEX person_name IF NOT EXISTS FOR (p:Person) ON (p.name);
CREATE INDEX message_status IF NOT EXISTS FOR (m:Message) ON (m.status);
CREATE INDEX pr_status IF NOT EXISTS FOR (pr:PullRequest) ON (pr.status);
The Mem0 memory system integrates three types of storage:
Vector Store:
content_embedding, metadata, timestamp