Inspiration
Small businesses sign contracts they don't fully understand — vendor agreements, leases, NDAs, SaaS terms — because a lawyer costs $300–500/hour. They miss auto-renewal traps, unlimited-liability clauses, and one-sided IP assignment, and those misses cost real money. We wanted a tool that reads a contract in 30 seconds and tells a non-lawyer exactly what to worry about — without hallucinating legal advice.
What it does
ClauseGuard scans any contract (PDF/DOCX/TXT), splits it into clauses, and for each one runs a true Retrieval-Augmented Generation pipeline: it retrieves the most similar known-risky patterns from a curated clause library, then generates a finding tailored to that clause's exact wording — a plain-English explanation, a risk level, and a redline diff with safer language. Three things make it trustworthy:
- Grounded, not guessed. Every finding is anchored to a retrieved pattern (shown as a "Grounded on" chip).
- Calibrated abstention. When no library pattern is a strong enough match, it refuses to guess and flags the clause "for human review."
- The moat. A second vector search over the organization's own past contracts surfaces "you accepted similar language in N past contracts" — relational data and vector search in one Aurora query path. It also ships a team dashboard and an immutable compliance audit log.
How we built it
Next.js (App Router) + TypeScript + Tailwind/shadcn on Vercel. Amazon Aurora PostgreSQL with pgvector is the single source of truth — it stores the relational data (orgs, users, contracts, clauses, findings, audit log) AND the clause-library + contract embeddings for retrieval, with full ACID. The RAG core embeds each clause, runs an HNSW nearest-neighbour query over the curated library, abstains when the nearest match is beyond a calibrated cosine-distance floor, and otherwise grounds an LLM to produce the tailored finding and redline. The database connects to Vercel via the Aurora Marketplace integration using OIDC + RDS IAM auth (no static DB password).
Challenges we ran into
Our AWS account had near-zero Amazon Bedrock inference quota (every region returned ThrottlingException), so we built the inference layer Bedrock-first with a one-env-var provider switch and ran the live demo on Google Gemini (1024-dim embeddings to match the pgvector schema). The Aurora cluster is private to Vercel's network, so we run schema + seeding from a guarded server-side endpoint. We also had to calibrate the abstention distance-floor to the embedding model's distance distribution.
Accomplishments that we're proud of
A genuinely grounded legal RAG that generalizes beyond its seed patterns, abstains when unsure, and proves the relational+vector value of Aurora with a cross-contract "you've-accepted-this-before" join — all live and deployed.
What we learned
RAG is only as trustworthy as its willingness to say "I don't know," and a single database that does both relational integrity and vector search removes a whole class of consistency bugs for compliance data.
What's next for ClauseGuard
Flip inference back to Amazon Bedrock (Titan + Claude) once quota is granted, expand the clause library, add team roles/SSO, and ship the redline export to Word.
Built With
- amazon-aurora-postgresql
- amazon-bedrock
- google-gemini
- next.js
- node.js
- pg
- pgvector
- shadcn-ui
- tailwindcss
- typescript
- vercel

Log in or sign up for Devpost to join the conversation.