Inspiration
Legal and administrative documents are written for lawyers, not for the people who sign them. Tenants, students, first-time workers and newcomers often accept clauses they don't really understand (automatic renewals, long notice periods, rent increases with almost no warning), because paying a lawyer to read every document isn't realistic. I wanted a tool that gives people a fair first read of a document before they sign it. [Optional: add one sentence about why this matters to you.]
What it does
You paste the text of a lease, job contract, invoice or official letter (up to 20,000 characters), choose English or French, and ClearClause shows you:
- Your document, annotated: the risky clauses are highlighted right in your text (red = high, amber = medium, green = low). Click one to jump to its explanation.
- An overall risk level for the document
- A plain-language summary of what you are agreeing to
- Key points, important dates, and questions to ask the other party before you sign
- For each risky clause: why it matters and what you could ask for instead
It never claims a clause is illegal, and it says on every page that it is an educational tool, not a lawyer.
How I built it
- Next.js, TypeScript and Tailwind CSS for the interface and the API route
- The API route sends the text to an LLM (Google Gemini's free tier, through an OpenAI-compatible endpoint; the Claude API is supported as an alternative) and asks for a structured JSON answer
- The prompt tells the model to use only what is written in the document, quote the clauses it flags, write at a simple reading level, and treat the document as data, not instructions
- A validation layer coerces the model's output to a fixed type, so a malformed answer can't break the page
- A small highlighting engine finds each flagged quote in the original text to draw the annotations
- Without an API key, the app shows a clearly labeled demo result instead of pretending to analyze your text
I built it with help from Claude Code (Anthropic), an AI coding assistant, working from my idea and requirements. The demo video is a real recording of the running app, with captions and a synthetic voice.
Challenges I ran into
- A retired model. My first default model returned a 404 because Google had retired it for new accounts. I switched to a "-latest" alias so the app doesn't break the next time a model is renamed.
- Speed vs. depth. The standard Flash model took 17+ seconds per analysis. The Flash-Lite model answered in roughly 2 to 10 seconds in my tests, so it is the default, with the deeper model one setting away.
- Flaky free tier. Occasional "high demand" errors made the first version fail randomly. Automatic retries fixed most of that.
- Trusting model output. Models sometimes wrap JSON in markdown or return unexpected values, so every field is validated before it reaches the screen.
- Matching quotes. The model often shortens or slightly rewrites a clause, so the highlighter tolerates differences in spacing, quotes and "..." cuts.
Accomplishments that I'm proud of
Seeing a dense lease turn into a document where the dangerous clause literally lights up in red, next to an explanation anyone can read. I'm also proud that it runs on a free API tier, and that it labels honestly what is real and what is a demo.
What I learned
How to get reliable structured output from an LLM, why model names and free-tier limits shouldn't be hard-coded assumptions, and how much small honesty details (demo-mode labels, disclaimers) matter for trust in a legal-adjacent tool.
What's next for ClearClause
PDF and photo upload, more languages, country-specific guidance (laws differ a lot), and a proper evaluation on many document types. Today it is tested mainly on one sample lease, its risk detection is not exhaustive, and it can miss clauses, so treat it as a helper, not a replacement for professional advice.
Built With
- google-gemini
- next.js
- node.js
- react
- tailwindcss
- typescript