Skip to content

ThilakNarasimhamurthy/ReflectAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ReflectAI - The AI Tutor That Never Forgets

An autonomous AI learning coach with perfect memory that remembers not just what you learned, but how you learn. Uses dual-database architecture (PostgreSQL + Neo4j) to persist learning patterns, struggles, and breakthroughsโ€”even after complete system restart. Built for the "AI Agents with Memory" hackathon.

๐Ÿง  Key Features

  • Perfect Memory Persistence: Uses PostgreSQL with pgvector for semantic search and Neo4j for relationship-based memory
  • Adaptive Teaching: AI agent learns from every interaction and adapts its teaching style
  • Dual Practice Modes: Code practice with Monaco editor and quiz mode with confidence tracking
  • Real-time Feedback: Personalized feedback that references past learning patterns
  • Memory Dashboard: Transparent view into your learning data and patterns
  • Restart Demo: Complete container restart with perfect memory recall

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Docker and Docker Compose
  • OpenAI API key (GPT-3.5-Turbo)

1. Clone and Setup

git clone https://github.com/ThilakNarasimhamurthy/ReflectAI.git
cd ReflectAI
npm install

2. Environment Configuration

Copy the example environment file and configure your settings:

cp env.example .env

Edit .env with your OpenAI API key:

OPENAI_API_KEY=sk-your-openai-api-key-here
NEXTAUTH_SECRET=your-random-secret-here

3. Start the Databases

Start PostgreSQL and Neo4j using Docker Compose:

docker-compose up -d

This will:

  • Start PostgreSQL with pgvector extension on port 5432
  • Start Neo4j on ports 7474 (HTTP) and 7687 (Bolt)
  • Initialize the database schemas automatically

4. Start the Application

npm run dev

The application will be available at http://localhost:3000

5. Start the MCP Server (Optional)

In a separate terminal:

cd mcp-server
pip install -r requirements.txt
python main.py

The MCP server will be available at http://localhost:8080

๐ŸŽฏ Demo Flow

The Restart Demo (Critical for Hackathon)

  1. Setup Phase:

    • Create account: demo@hackathon.com / demo123
    • Complete onboarding
    • Practice JavaScript arrays challenge
    • Make specific mistakes (off-by-one errors)
    • Use hints and complete the challenge
  2. Restart Phase:

    docker-compose down
    docker-compose up -d
  3. Payoff Phase:

    • Log back in with same account
    • Agent recalls everything: "Welcome back! Last time you struggled with array indexing..."
    • Memory dashboard shows persistent data
    • Next challenge targets your weak areas

๐Ÿ—๏ธ Architecture

Database Architecture

PostgreSQL (Profile Memory):

  • memvergeprofile: Structured user knowledge with embeddings
  • session_history: Conversation logs and interactions
  • citations: Links profile knowledge to source conversations
  • users: Authentication data

Neo4j (Relationship Memory):

  • User, Session, Topic, Skill, Mistake, Breakthrough nodes
  • Rich relationships showing learning patterns
  • Graph queries for complex memory retrieval

AI Architecture

  • Data Ingestion Agent: Captures and structures user behavior
  • Context Retrieval Agent: Intelligently queries memories from both databases
  • Main Agent: Makes decisions using retrieved context + GPT-3.5 for language

Technology Stack

  • Frontend: Next.js 14, React 18, Tailwind CSS, Monaco Editor
  • Backend: Next.js API Routes, OpenAI GPT-3.5-Turbo
  • Databases: PostgreSQL with pgvector, Neo4j
  • Infrastructure: Docker Compose, NextAuth

๐Ÿ“Š Memory System

Profile Memory (PostgreSQL)

  • Skills mastery levels with embeddings
  • Learning preferences and styles
  • Goals and objectives
  • Semantic search across all memories

Graph Memory (Neo4j)

  • User learning journey
  • Topic relationships and prerequisites
  • Mistake patterns and breakthroughs
  • Session outcomes and progression

๐ŸŽฎ Practice Modes

Code Practice

  • Monaco editor with JavaScript syntax highlighting
  • Real-time code execution via MCP server
  • Test case validation
  • Performance tracking (typing speed, pauses, mistakes)

Quiz Mode

  • Multiple choice questions
  • Confidence slider for each answer
  • Immediate feedback with explanations
  • Memory-referenced insights

๐Ÿง  Agent Intelligence

Decision Logic (Rule-based)

  • Calculate next practice topic based on skill levels
  • Determine difficulty using mastery percentages
  • Choose between code vs quiz based on recent activity
  • All decisions are deterministic and fast

GPT-3.5 Usage (Natural Language Only)

  • Convert decisions into friendly messages
  • Generate quiz questions from templates
  • Create personalized feedback
  • Explain concepts when asked

๐Ÿ“ˆ Memory Dashboard

Four-panel layout showing:

  1. Overview Cards: Total memories, health status
  2. Profile Memory Table: Searchable, editable memories
  3. Knowledge Graph: D3.js visualization of Neo4j data
  4. Timeline: Chronological session history

๐Ÿ”ง Development

Project Structure

ReflectAI/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/                 # Next.js app router
โ”‚   โ”œโ”€โ”€ components/          # React components
โ”‚   โ”œโ”€โ”€ lib/                 # Utilities and services
โ”‚   โ””โ”€โ”€ types/               # TypeScript definitions
โ”œโ”€โ”€ mcp-server/              # Python FastAPI server
โ”œโ”€โ”€ docker-compose.yml       # Database orchestration
โ””โ”€โ”€ config.yaml             # MemMachine configuration

Key Commands

# Development
npm run dev

# Database management
docker-compose up -d
docker-compose down
docker-compose logs postgres
docker-compose logs neo4j

# MCP Server
cd mcp-server
python main.py

๐ŸŽฏ Demo Credentials

๐Ÿ† Hackathon Focus

This project demonstrates:

  • Perfect Memory Persistence: Survives complete container restart
  • Dual Database Architecture: PostgreSQL + Neo4j working together
  • GPT-3.5 Optimization: Fast, cost-effective AI responses
  • Real-time Learning: Agent adapts after every interaction
  • Transparent Memory: Users can inspect and edit their learning data

๐Ÿ“ License

Built for the "AI Agents with Memory" hackathon. MIT License.

๐Ÿค Contributing

This is a hackathon project. For questions or issues, please open an issue on the repository.


Built with โค๏ธ for the AI Agents with Memory hackathon

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors