Two months ago I signed a contract with an auto-renewal clause I didn't notice. When I tried to cancel, I owed another year. That $1,200 mistake turned into PactLens — a Chrome extension that reviews contracts before you sign. The core problem: LLMs hallucinate. You can't just ask an AI "is this clause risky" — it'll confidently make up laws that don't exist. So I needed real statutes as a source of truth. The RAG Pipeline Here's how it works: User selects contract text on any page → right-clicks → "Review with PactLens" The text hits our Cloudflare Worker backend, which extracts clause-level semantics We run semantic search against 1,700+ pre-loaded statutes using keyword matching + TF-IDF similarity The top N most relevant statutes are injected into the prompt as context The AI generates analysis grounded in those actual statutes, not hallucinations The key insight: ground first, generate second . The AI doesn't need to know every law — it just needs to know how to apply the specific statutes we feed it.…