Skip to main content
The Agency.
Portfolio
RAG
Pinecone
RBAC
Claude API
Next.js

Case Study 04

Legal Document Intelligence Portal

RAG-powered document Q&A with role-based access control — turning hours of precedent research into a seconds-long query.

Problem

A law firm with a large document archive — contracts, precedents, case notes, and regulatory guidance spanning decades — was losing billable hours to document search. Associates spent 2–3 hours per day trawling through folders to find relevant clauses or precedents. Knowledge was siloed: documents accessible to senior partners were mixed with those for junior associates, creating both access control and liability concerns.

Our solution

We built a Retrieval-Augmented Generation (RAG) system that ingests the firm's document library, creates vector embeddings, and stores them in Pinecone. Associates query documents in natural language — "find all force majeure clauses from commercial leases after 2020" — and receive source-cited answers in seconds. Role-based access control ensures that each user only sees documents they're authorised for. All queries are logged for audit purposes.

Architecture

Pinecone
Claude API
Next.js
Supabase (auth + RBAC)
PDF/DOCX ingestion
Audit logging

Results

  • Precedent and clause searches return source-cited results in under 5 seconds
  • RBAC controls prevent junior associates from accessing restricted partner-level documents
  • Every query is logged — full audit trail for compliance and review
  • New documents ingested automatically on upload — no manual indexing

Measurable impact

<5s

average time to find a relevant clause or precedent

15 hrs

saved per associate per week on document research

100%

of document access governed by role-based permissions