Inspiration

Most people sign contracts they don't fully understand. Employment agreements, freelance contracts, NDAs, lease agreements — they're written by lawyers for lawyers. The average person reads them once, understands maybe 40%, and signs anyway because hiring a lawyer costs hundreds of dollars per hour. I've seen people lose jobs, money, and rights because of a single clause they didn't understand. I wanted to build something that gives everyone access to the kind of contract intelligence that used to be reserved for people who could afford legal counsel.

What it does

Circrisk is an AI-powered contract risk intelligence platform. Here's what happens when you upload a contract:

  1. Clause Extraction — The AI reads your PDF and segments it into individual clauses automatically
  2. Real-Time Analysis — A live terminal streams every event as it happens — clause detected, risk scored, analysis complete — you watch the AI work in real time
  3. Risk Scoring — Every clause gets a score from 0–100 and a severity label: LOW MEDIUM HIGH CRITICAL
  4. Plain English Explanations — Expand any clause to see what it actually means, a real-world example of how it could affect you, and a safer rewritten version 5.Risk Dashboard — Visual heatmap, severity distribution, and an aggregate quadrant gauge across all your contracts
  5. PDF Export — A 9-page professional risk report with cover page, executive summary, clause analysis table, and recommendations — ready to share with your lawyer or team

How I built it

Circrisk was built entirely on MeDo through natural language conversations — no traditional development environment, no manually written backend code. The architecture behind it:

Frontend

  • Multi-page React app with full light/dark theme
  • 3-column analysis layout: PDF viewer + clause cards + live terminal
  • Supabase Realtime subscriptions for live event streaming
  • jsPDF + jsPDF-AutoTable for client-side PDF generation
  • Severity filter system, animated score counters, expandable clause cards

Backend — Edge Functions

Function Purpose
extract-clauses Downloads PDF from Supabase Storage, extracts raw text, calls Gemini 2.5 Flash to segment into clauses, emits realtime events
analyze-risks Scores each clause 0–100, classifies type, generates risk reason, semantic tags, and recommendations
explain-simple On-demand per clause — plain-English explanation + real-world example + safer wording alternative
large-language-model Generic LLM proxy for frontend streaming chat integration

Database — Supabase Postgres

  • Tables: contracts · clauses · clause_risks · analysis_events · profiles · comparisons · contract_contents
  • Row-level security with role-based access (user / admin)
  • Realtime enabled on all core tables

Challenges I ran into

  1. Real-time pipeline complexity Keeping Supabase Realtime subscriptions in sync with the edge function pipeline without race conditions or missed events was the hardest architectural challenge. Events needed to arrive in order and update the correct UI components without breaking the analysis flow.
  2. PDF export rendering bugs The jsPDF library stripped whitespace from extracted clause text, turning "As compensation for services" into "Ascompensationforservices". Emoji characters like ⚠️ rendered as &. Page overflow caused content to silently disappear off the bottom of pages. Each required specific workarounds.
  3. On-demand clause intelligence The explain-simple edge function needed to return three distinct outputs per clause — explanation, example, safer wording — without slowing down the main analysis pipeline. Fetching on demand (only when a user expands a clause) solved the performance issue.
  4. Designing for non-lawyers Every label, explanation, and risk reason had to be understood by someone with zero legal background. Prompting Gemini to write for a general audience — not a legal one — required significant iteration.

Accomplishments that we're proud of

  • Full pipeline in under 3 minutes — from PDF upload to complete risk report with scores, explanations, and recommendations
  • Live AI terminal — watching clause extraction and risk scoring happen in real time, event by event, makes the AI feel transparent and trustworthy instead of a black box
  • On-demand clause intelligence — plain-English explanation + real-world example + safer rewritten wording for every single clause, fetched instantly on expand
  • 9-page professional PDF report — generated entirely client-side with no server round-trips, ready to share with a lawyer or sign-off team

What we learned

  • Natural language is a surprisingly precise engineering tool - The more specific and structured the description, the better MeDo's output. Prompts that included exact variable names, color hex codes, pixel measurements, and data flow logic produced production-quality results. Vague prompts produced generic ones.
  • AI transparency builds trust - The real-time terminal showing every pipeline step — clause detected, risk scored, analysis complete — made users feel like they understood what was happening. A loading spinner would have felt like a black box. The terminal felt like a window.
  • No-code doesn't mean low-quality - The hardest parts of Circrisk — the Supabase realtime architecture, the parallel edge function pipeline, the jsPDF rendering. MeDo solved them from natural language descriptions.

What's next for Circrisk

  1. Mobile app — Contract analysis on the go, camera upload for physical documents
  2. Contract template library — Pre-analyzed safe templates for common contract types (employment, NDA, freelance, lease)
  3. Contract comparison — Upload two versions of a contract and see exactly what changed and whether it got riskier (database schema already exists)
  4. Multi-language support — Analyze contracts in languages beyond English

Built With

Share this project:

Updates

Submission history