Inspiration

Paying a contractor means trusting a stack of documents: a quote with your address and bank details, receipts, change-order emails, photos of half-finished work. AI is great at reading all of that, but you don't want it shipping your contract to a server, and you definitely don't want it deciding when money moves. Clause Private keeps the contract on your device and keeps the money under rules.

What it does

Clause Private turns a contractor quote into a virtual card whose limits come straight from the contract.

  • Read the quote on-device. Gemini Nano extracts milestones, amounts, deadlines and spending rules in the browser. The raw document never leaves the device; you review the terms and choose what to share.
  • Card rules enforce the contract. The card's cumulative cap follows released milestones (§1.1) and banned categories are declined (§2.2). Tap Explain on a decline and AI explains it in plain language, but the card rules made the decision.
  • Change orders. Paste the contractor's email and AI drafts the change (+$1,500, deadline moves 5 days). Deterministic math checks it, and nothing changes until you approve.
  • Proof of work. Upload milestone photos. AI judges whether they meet the clause; a rejected proof keeps the money locked.
  • Offline. AI advises when it can; money never moves offline. Cloud-only steps say "Needs a connection. Nothing was sent."

Every AI answer shows a badge: On-device or Cloud, with model and latency.

How we built it

  • Firebase AI Logic Hybrid Inference (firebase/ai, InferenceMode): each step has its own mode, set by Remote Config. Contract, expense and decline explanation use PREFER_ON_DEVICE; change orders and photo evidence use PREFER_IN_CLOUD (gemini-3.5-flash-lite). Structured JSON via responseConstraint on-device and responseSchema in the cloud.
  • Pipeline: model → zod schema → deterministic validators (verbatim clause quotes, milestone sums, dates, no invented amounts or payment promises) → human approval → card rules. The model never calls a money API.
  • App Check (reCAPTCHA Enterprise), Firestore for an AI-call log (metadata only, no document text), Remote Config for per-step modes.
  • React Router + TypeScript web app (Chrome first), Expo React Native app with a Kotlin module for Android on-device Gemini Nano.
  • Kane CLI (TestMu AI) runs the money flows in a real browser; it caught two bugs that we fixed and re-verified.

Challenges we ran into

  • On-device Nano is slower on CPU (about 80 s vs 3 s in the cloud) and occasionally returns wrong milestone sums. The validators catch it and fall back.
  • @react-native-firebase/ai doesn't support hybrid inference, so mobile needed a native module.
  • Writing validators strict enough that AI text can never imply money was paid.

Accomplishments that we're proud of

  • A real hybrid split where privacy decides the mode, not just cost.
  • AI explains and drafts everywhere, and still can't move a dollar.

What we learned

On-device models are good enough for structured extraction when the output is validated, and the user trusts the app more when every answer says where it ran.

What's next for Clause Private

Android and iOS on-device builds, PII redaction before any cloud call, and offline pre-checks of charges against the clauses.

Built With

Share this project:

Updates