AI Chat System with RAG

AI Product · Freelance project, built after leaving full-time role · 2026

Impact

Solo build
Architecture to staging deployment
Validated
Full RAG pipeline with hybrid search + memory extraction
Validated
Provider-agnostic LLM layer, reusable across projects

Built this after leaving my full-time role to go deeper into AI engineering. Core architecture complete and deployed to staging. Project on hold due to client funding constraints.

Key lesson: The architecture is solid but unvalidated by real users. If restarting, I would run a concierge MVP first (manually curating memories for a small group of beta users) before building any infrastructure.

Problem

A client wanted an AI companion chat app with memory. Users chat with an AI character, and the system remembers past conversations, extracts facts, and uses them to give contextually relevant responses over time. The roadmap also called for AI agents that could use tools (Google Search, Maps), and push notifications for proactive check-ins.

Key Decisions

Architecture

Project on hold. Live demo not available. Architecture deployed to staging.

Flutter App (iOS / Android) | v Fastify API (Cloud Run, auto-scales to zero) |-- Auth: Supabase JWT verification |-- Chat: embed query > 3-channel hybrid search (vector + trigram + daily summaries) | > composite ranking (semantic + recency weighted) | > augment prompt > Gemini generation > SSE stream to client |-- Agents: tool registry, function calling, job tracking |-- Characters, threads, memories, onboarding, profile | v pg-boss Worker (GCE e2-small, Container-Optimized OS) |-- Persistent job polling (PostgreSQL-backed queue) |-- Embedding generation (OpenAI text-embedding-3-small) |-- Memory extraction: LLM-based fact extraction | Categories: fact, preference, event, person, place, relationship | Dedup + contradiction detection via cosine similarity |-- Daily summary generation |-- Proactive check-in evaluation |-- Agent job execution | v Supabase PostgreSQL |-- public schema (RLS, client-facing) |-- private schema (worker-only) |-- pgvector (cosine distance for similarity search) |-- pg_trgm (trigram full-text search) |-- Storage Shared Package (@migo/shared, pnpm monorepo) |-- LLM provider abstraction (Gemini, extensible) |-- Embedding, memory search, extraction modules |-- DB connection pools

Transferable Pattern

Building AI systems with persistent memory and provider-agnostic architecture. Applicable to any product that needs personalized AI interactions: customer service bots that remember past issues, sales assistants that know the client's history, or internal tools that learn from usage patterns.

Tech Stack

Flutter Fastify TypeScript Google Cloud Run GCE pg-boss Supabase pgvector pg_trgm Gemini OpenAI Embeddings Firebase pnpm Monorepo