A technical investigation into a RAG system that can't tell when it's out of its depth

Setup

InboxSync is a personal project I built: a multi-account email aggregation API that uses a RAG (Retrieval-Augmented Generation) pipeline to suggest replies. The system indexes emails via IMAP, categorizes them with GPT-4o-mini, and for actionable emails retrieves semantically similar training examples from a pgvector database to generate contextually grounded reply suggestions.

The stack: Node.js / TypeScript backend, PostgreSQL with the pgvector extension for vector similarity search, OpenAI's text-embedding-3-small for embeddings, and gpt-4o-mini for generation. The training corpus contains three examples covering: job interview scheduling, product demos, and partnership proposals.

The system is built for B2B outreach helping salespeople respond to inbound leads faster. That framing matters for what follows.