Problem
Non-specialist contract reviewers — founders, freelancers, small-business owners — sign agreements without understanding the risk buried in dense legal language. Professional legal review is expensive and slow, and existing 'AI contract review' tools are either black-box SaaS or surface-level summarizers that don't anchor findings to specific clauses.
Approach
Designed a three-pass structured-output pipeline: Pass 0 extracts metadata, jurisdiction, and a clause inventory; Pass 1 anchors clause text; Pass 2 classifies risk from the user's chosen party perspective with jurisdiction-aware analysis. Used Vercel AI SDK with Zod schemas for deterministic structured output — keeping cost near zero while maintaining reliability. Results stream to the client in real time. The backend handles magic-link auth, saved analyses (Neon Postgres), and rate limiting. A RAG-based clause chat lets users ask follow-up questions grounded in the contract text.
Outcome
Shipped a full-stack contract analyzer with streaming analysis, interactive filtering, clause chat, passwordless auth, analysis persistence, and dual export (Markdown + PDF). Structured output with Zod schemas eliminated output-parsing hacks — the pipeline fans out parallel LLM calls without retry logic. Jurisdiction-aware prompting was the most domain-specific piece: drawing on my legal background to encode EU member state rules into the analysis pass.
Next project
Gato →