Inspiration
Not long ago, a family member of mine went to a car dealer alone and bought a car that included lots of things that were overpriced and unneeded, causing irreversible financial damage on a signed piece of paper. This was incredibly frustrating and as I too needed to look into buying a car or finding places to rent, I did spent a long time doing research and the process was just not flowing. So to help combat this, I introduce contractly! Instead of reading through every detail or missing them in the process, make it much easier with contractly.
What it does
- Flag risky clauses ranked by severity (high / medium / low), with a plain-English explanation of each red flag and an estimated dollar impact
- Surface hidden fees — add-ons, documentation fees, dealer markups, and lease charges you might overlook when signing
- Cross-reference live market data — for car contracts it pulls active NHTSA safety recalls for the specific vehicle; for rental leases it compares rent and fees against HUD Fair Market Rents for your zip code
- Ground analysis in regulatory standards — CFPB auto dealer fee guidelines and HUD/NAA rental standards are fetched from a MongoDB database and injected into every analysis
- Benchmark your deal — an AI agent (hosted on Fetch.ai's Agentverse) searches the live web to compare your contract terms against current market rates and gives a fair / unfair / red flag verdict
How I built it
Frontend: Next.js 15 (Turbopack) with Tailwind CSS, deployed to Vercel at readcontractly.us
Fetch.ai / Agentverse: Contractly includes a live Benchmark Agent registered on Agentverse (the-inspector) The agent implements the AgentChat Protocol v0.3.0 and is discoverable via ASI:One. When a user sends it a contract description in plain text, it: Uses ASI:One to extract the structured financial terms from the message Calls ASI:One with web_search=True to benchmark those terms against live market data (Zillow, Reddit, CFPB, Autotrader) Returns a plain-text GOOD / FAIR / BAD verdict with per-item comparisons and sources This same logic powers the benchmark feature in the Contractly web app — the Agentverse agent makes it available as a standalone autonomous service discoverable across the Fetch.ai ecosystem.
OCR pipeline: Images and HEIC phone photos are uploaded to Cloudinary, preprocessed with transformation filters (auto-rotation, sharpening, grayscale, 2000px cap), then processed with -Tesseract.js locally or a vision model fallback on the web
Regulatory grounding: CFPB and HUD reference rules are stored in MongoDB Atlas (contractly db, reference_rules collection) and fetched at analysis time so the AI has up-to-date standards to compare against
Live market data: NHTSA vehicle recalls API for car contracts; HUD Fair Market Rents API for apartment leases, both keyed to the specific vehicle/zip code in the contract
Agentverse agent: A Python uAgent built with the uagents library and hosted on Fetch.ai's Agentverse, using AgentChatProtocol v0.3.0 — lets anyone chat with Contractly's benchmarking logic directly from the Agentverse interface
Challenges I ran into
- Tesseract.js on Vercel: Tesseract's Node worker spawns a child process using require('..'), which Vercel's Rust bundler cannot resolve, crashing the entire serverless function with an uncaught exception. I worked around this by detecting the VERCEL environment variable and routing to a vision model fallback on production while keeping Tesseract as the primary path locally.
- ASI:One vision model and HEIC files: Cloudinary serves a JPEG regardless of the source format when you use f_jpg in the transformation URL, but ASI:One was reading the .heic filename from the URL and rejecting the image before ever inspecting the content-type. Getting consistent vision results required extra debugging.
- PDF AcroForm extraction: Digitally-filled PDF forms store field values in compressed ObjStm object streams rather than plaintext. I wrote a custom zlib-based parser to decompress and scan these streams since standard PDF.js getTextContent() misses them entirely.
- Agentverse protocol compliance: The AgentChatProtocol requires handlers for both ChatMessage and - ChatAcknowledgement — missing the acknowledgement handler causes a silent RuntimeError: Unable to lookup message handler that takes down the whole agent.
Accomplishments that I'm proud of
- Being able to succcessfully classify the deal that hurt my relative with my software, ensuring that with it others will not have the same misfortune.
What I learned
- Serverless environments have hard constraints on binary runtimes and worker threads that don't appear locally — test OCR pipelines on the actual deployment target early
- Grounding AI responses in structured reference data (MongoDB rules + live government APIs) dramatically improves accuracy and reduces hallucination on domain-specific tasks like contract review
- The Fetch.ai ASI:One API with web_search: true is genuinely useful for real-time market benchmarking without needing to build and maintain your own data pipelines
What's next for Contractly
- Full OCR on the web: Find a serverless-compatible OCR solution (Google Cloud Vision or a dedicated microservice) to replace Tesseract on Vercel so photo uploads work reliably for all users
- More contract types: Employment agreements, freelance contracts, and gym memberships — anywhere fine print hides unfavorable terms
- Side-by-side comparison: Upload two versions of a contract (initial offer vs. revised) and highlight exactly what changed
- Negotiation suggestions: Instead of just flagging problems, suggest specific counter-language the user could propose to the other party
Log in or sign up for Devpost to join the conversation.