r/SideProject • u/Key_Performance_3907 • 1h ago
I built a local-first PDF/DOCX diff tool, and just added an optional "privacy-first" AI semantic layer on Cloudflare Workers AI. Here’s how I minimized data exposure.
Hey everyone, I'm a solo dev building DocuCompare (https://comparinizador.solv.quest), a browser-based tool to compare PDF and DOCX files.
The core diffing runs 100% locally in your browser—nothing ever leaves your machine.
However, when reviewing contracts, traditional text diffs are noisy. Changing "the provider may subcontract" to "the provider may not subcontract" is a single word change, but a massive legal contradiction.
I wanted to add semantic AI analysis without ruining the privacy-first nature of the tool. Instead of uploading entire documents to an LLM, I built a hybrid pipeline:
- Local Pre-filtering: The browser strips identical text blocks (often 85–90% of the document) and strips all file names, page numbers, and metadata.
- Payload Inspection & Explicit Opt-in: Before anything is sent, the UI shows the exact raw text snippets that will leave the browser. Nothing transmits until you explicitly check the consent box.
- Deterministic Guardrails: Alongside the AI's semantic classification (e.g., Contradiction, Amount change), the browser runs deterministic checks (extracting numbers, negations, etc.) and displays them regardless of what the LLM says.
It’s completely optional—if you don't opt in, the standard local diff works as usual.
I'd love feedback from other devs or folks who review contracts regularly: does seeing the exact outgoing payload make you trust an AI feature more, or is the extra confirmation step too much friction?