Skip to content

M4cr0Chen/Zen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zen - Self-Discovery Engine

An AI-powered self-discovery platform that helps users overcome Solomon's Paradox — the tendency to reason more wisely about others' problems than our own. Zen creates a Digital Twin from your journal entries using RAG and pairs it with a Council of 50+ historical mentors to provide personalized wisdom and guidance.

Built at UofT Hacks 2025.

Features

Journal

Write and reflect on journal entries with AI-generated follow-up questions that deepen self-awareness. Entries are embedded and stored for semantic retrieval, allowing the system to learn about you over time.

The Council

Chat with a multi-agent system that intelligently routes your conversation through:

  • The Empath — initial intake and emotional recognition
  • Discovery Agent — clarifying questions to understand your situation
  • Wise Mentor — personalized guidance from 50+ historical figures (Marcus Aurelius, Maya Angelou, Steve Jobs, Socrates, and more)

Mentors are auto-selected based on your situation and reference your journal history for context-aware advice.

Guided Meditation

Personalized meditation sessions (5–30 min) streamed in real-time with:

  • 5-stage journey: welcome, breathing, body scan, visualization, closing
  • Breathing circle animation and progress tracking
  • Content personalized from your journal entries
  • Post-meditation reflection capture

Digital Self

AI-generated analysis of your journal patterns and emotional landscape — your Digital Twin's perspective on who you are.

Tech Stack

Layer Technologies
Frontend Next.js 14 (App Router), React 18, TypeScript, Tailwind CSS, Framer Motion
Backend FastAPI, LangGraph, LangChain, Google Gemini API
Database Supabase (PostgreSQL + pgvector)
Streaming Server-Sent Events (meditation), REST (chat)

Project Structure

├── backend/
│   ├── app/
│   │   ├── agents/orchestrator.py    # LangGraph workflow + mentor personas
│   │   ├── routers/                  # journal, chat, meditation, digital_self
│   │   ├── services/                 # RAG engine, personalization
│   │   ├── models/schemas.py         # Pydantic models
│   │   ├── main.py                   # FastAPI entry point
│   │   ├── config.py                 # Settings
│   │   └── database.py               # Supabase client
│   ├── requirements.txt
│   └── supabase_schema.sql
├── frontend/
│   ├── app/                          # Pages: journal, counsel, meditation, digital-self
│   ├── components/zen/               # ParticleBackground, Navigation
│   └── lib/                          # Utilities

Setup

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • Supabase account
  • Google Gemini API key

Database

  1. Go to your Supabase project dashboard
  2. Enable the pgvector extension
  3. Run backend/supabase_schema.sql in the SQL Editor

Backend

cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env

Edit .env:

SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_anon_key
SUPABASE_SERVICE_KEY=your_supabase_service_role_key
GOOGLE_API_KEY=your_google_gemini_api_key
python -m app.main
# http://localhost:8000

Frontend

cd frontend
npm install
cp .env.local.example .env.local

Edit .env.local:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_API_URL=http://localhost:8000
npm run dev
# http://localhost:3000

Architecture

User -> Next.js Frontend -> FastAPI Backend -> LangGraph Orchestrator
                                |                    |
                                v                    v
                           Supabase             Google Gemini
                        (pgvector RAG)        (embeddings + chat)

The LangGraph orchestrator manages a state-based workflow that routes conversations through specialized agents. The RAG pipeline embeds journal entries using Google's text-embedding-004 model and retrieves semantically relevant context via pgvector, injecting it into mentor responses for personalized guidance.

API

Interactive API docs available at http://localhost:8000/docs when the backend is running.

Endpoint Description
POST /api/journal/ingest Submit a journal entry
POST /api/journal/followup Get AI follow-up questions
POST /api/chat Send a message to The Council
GET /api/meditation/stream Stream a guided meditation (SSE)
POST /api/digital-self/analyze Get Digital Twin analysis

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors