DocMind
An agentic RAG assistant that answers questions from your own documents with real citations, and takes scoped, audited actions through a three-tier risk model mirroring production agentic systems.
Role
Creator & Full-Stack Engineer
Capacity
Solo build — portfolio project
Year
2026
Stack size
13 tools
Overview
DocMind is a portfolio-grade AI assistant built to prove out production RAG and agentic patterns end-to-end, not just wrap an LLM API call. The NestJS backend ingests PDFs, Markdown, and plain text through a BullMQ worker: documents are chunked (800-char target, 150-char overlap) and embedded with Gemini `gemini-embedding-001` (768 dimensions) into a Postgres + pgvector column with an HNSW index. Every query runs a parallel vector and keyword search — pgvector cosine similarity alongside Postgres tsvector/tsquery full-text search — fused via Reciprocal Rank Fusion (k=60), so cited answers point back to real source chunks. The chat layer is a LangGraph.js StateGraph agent rather than a raw prompt chain, with tools registered under an explicit three-tier risk model: read tools execute freely, internal-write tools execute and audit, and external-write tools like sending an email digest surface a confirmation card before running. Every tool call, successful or not, writes an audit row. Responses stream token-by-token over SSE, and a QueryTrace is recorded per query — retrieved chunks, vector/keyword/fused scores, provider, latency breakdown — visible in an admin trace viewer. A hand-labeled 18-case retrieval eval runs as a required CI job against a real pgvector container, gated on hit@5 ≥ 0.75 and MRR ≥ 0.60, with a deliberately regressed RRF constant used to confirm the gate actually catches regressions. The Next.js 16 frontend consumes the SSE stream, renders the trace viewer, and handles notes/tasks created by the agent. The full stack runs in Docker Compose with a GitHub Actions pipeline covering backend tests, the retrieval eval, frontend tests, and a security scan.
Responsibilities
- Designed the hybrid retrieval pipeline: parallel pgvector cosine search and Postgres full-text search fused via Reciprocal Rank Fusion, with a similarity floor and optional re-ranking.
- Built the async ingestion path — chunking, Gemini embedding, and HNSW-indexed pgvector storage — on a BullMQ worker so uploads return immediately.
- Implemented a LangGraph.js StateGraph agent with an explicit three-tier tool risk model (read / internal-write / external-write), including a propose-confirm-execute flow for external-write actions.
- Built full observability: a QueryTrace row per query capturing retrieval scores, provider, and latency, plus a ToolCallAudit row for every tool invocation, surfaced in an admin trace viewer.
- Wrote a hand-labeled 18-case retrieval eval and wired it into CI as a required, DB-backed status check with explicit hit@5 and MRR thresholds.
- Implemented SSE streaming for both the direct retrieval-and-generate path and the agent loop, and built the Next.js 16 frontend consuming it.
- Set up Docker Compose infrastructure and a four-job GitHub Actions pipeline: backend tests, retrieval eval, frontend tests, and dependency/security scanning.
Highlights
- Hybrid retrieval (vector + keyword, RRF-fused) with citations that trace back to real source chunks
- Explicit three-tier tool risk model with confirm-gated external actions and a full audit trail
- Required CI eval job against a real pgvector container — verified to catch retrieval regressions, not just green-check CI
- Per-query observability via QueryTrace with a dedicated admin trace viewer
- Token-level SSE streaming across both the retrieval and agent code paths