Inspiration
A student in Bengaluru signs a nine-page PG agreement. The deposit is ₹60,000 — often the largest upfront payment they will make. The clauses that decide whether it comes back are buried in legal language: a non-refundable deposit, entry without notice, “tenant pays all repairs,” an eleven-month lock-in, and an unregistered agreement with no copy for the tenant. A lawyer is expensive. A generic “chat with your PDF” tool is inconsistent, cannot cite the clause, and wants the document uploaded to someone else’s server.
What it does
RentDecoded is a local-first rental agreement audit for Indian tenants. Upload a text-based PDF or paste the agreement. In seconds you get:
- a risk score with sub-scores for deposit, exit, cost, control, and clarity;
- the top three things to negotiate;
- evidence-linked findings: severity, clause ID, page, confidence, the exact source quote, why it matters, and what to ask;
- a ready-to-send negotiation message and a move-in checklist;
- HTML (print-to-PDF), Markdown, and JSON exports.
The sample PG audit finds 11 substantive issues and a risk score of 91/100, including a non-refundable ₹60,000 deposit, unrestricted landlord entry, and all repairs — including structural repairs — shifted to the tenant.
Every finding cites the exact clause. The rule engine decides; AI only explains. Turn the explanation layer off and the findings, quotes, and negotiation asks are identical.
How we built it
A deterministic pipeline:
- Ingest —
pdfplumberextracts text with page and character offsets. - Segment — numbered headings, all-caps headings, and paragraph fallback produce clause units with stable IDs and page references.
- Classify — a hybrid of deterministic regex/keyword rules and TF-IDF n-gram similarity to rule exemplars. No remote model.
- Audit — 22 versioned rules cover deposit traps, refund timelines, forfeiture, deductions, notice periods, lock-ins, early-exit penalties, rent escalation, maintenance, repairs, utilities, extra charges, landlord entry, one-sided termination, guests/subletting, pets, inventory, arbitration, jurisdiction, registration/copy, and renewal.
- Link evidence — every finding must carry a quote that exists in the clause; findings without a quote are rejected.
- Explain — deterministic templates by default; an optional local Ollama model can rewrite a structured finding into plain English. The LLM output must contain the clause ID and a source phrase, or it is discarded.
- Report — FastAPI + Jinja2 renders the report; the CLI and web UI use the same model.
The repo includes 12 synthetic agreements (4 PG, 4 flat, 4 mixed; 6 unfair, 3 fair, 3 borderline), a labelled evaluation harness, unit tests, web tests, and a Playwright end-to-end test that uploads a PDF, checks cited findings, toggles AI off, and writes a print PDF.
Challenges
- Legal accuracy vs. usefulness. The tool must not play lawyer. The rules are written as risk flags and questions, not legal conclusions. Every rule cites an official source; the report says “verify” and “not legal advice.”
- Evidence, not vibes. The hardest invariant was “no finding without a quote that exists in the clause.” The evidence linker rejects anything else, and the eval checks 100% coverage.
- Deterministic audit + optional AI. The LLM is deliberately not in the finding path. It only explains. This makes the output reproducible and the demo work offline.
- PDF variability. Text extraction and clause segmentation are tested on synthetic fixtures; scanned PDFs are a documented limitation.
Accomplishments
- A complete local audit: upload → clause segmentation → 22-rule audit → evidence-linked report → negotiation message → checklist → print/export.
- 100% high/critical precision and recall on the 12-agreement synthetic regression set, with 100% evidence coverage and zero high-risk alerts on the three fair agreements. This is a regression benchmark, not a legal accuracy claim.
- A browser E2E test that proves the flow, the source quote, the AI-off equivalence, and the print view.
- No paid APIs, no cloud requirement, no real PII.
What we learned
- A deterministic rule engine plus a small evidence layer is more useful than a chat box for a legal-adjacent document.
- The negotiation message is the product moment: a risk report is interesting, but a message the tenant can send is actionable.
- Synthetic fixtures are excellent for regression testing, but they are not a substitute for real-world legal review.
- Local-first is a feature, not a constraint: rental agreements contain names, addresses, and ID numbers.
What's next
- Add Hindi explanations for the top findings.
- Add scanned-PDF OCR and original-page highlighting.
- Expand state-specific rent rules and a reviewed clause library.
- Add more real-world (consented, redacted) test agreements.
- Optional local-model explanations on more devices.
Disclaimer
RentDecoded provides educational information, not legal advice. It is not a law firm and does not predict a legal outcome. Tenancy law varies by state and by the facts of each agreement. Verify important terms with a qualified lawyer or a tenant rights organisation before you sign or pay.
Built With
- css
- fastapi
- html
- jinja
- pdfplumber
- playwright
- pydantic
- pypdf
- python
- pyyaml
- scikit-learn
- uvicorn