Instant 60-Second Judge Access (Zero Login / Zero Setup):

  • Live Web X-Ray Studio: https://clearsight-hybrid-ai.web.app (toggle View Raw Trap vs Show Hybrid X-Ray, uncheck +$14.99/mo live, drop a contract .pdf into the Omni-Bar, or click Python Verified -> Re-Verify Live in Cloud Python)
  • Chrome MV3 Extension (v1.0.3): Download Latest Release .zip (press Alt+Shift+S on checkout pages or hosted /judge-kit/ pages; 0 remote scripts, 100% DOM cleanup on Side Panel close)
  • Open-Source Repo (Apache-2.0): https://github.com/huadeng408/clearsight (100% newly created during the Nov 11–30, 2026 #BuildHybridAI Contest Period; run npm ci && npm run ci offline with zero secrets)

Inspiration

Every week, millions of shoppers click a glowing "Start 14-Day Trial for $0.99" button—only to discover days later that cancelling triggers a $405.92 early-termination penalty buried on page 19 of a 24-page Master Subscription Agreement.

Predatory checkouts weaponize two coordinated layers of deception at the exact moment a user's credit card, email, and billing notes are on screen:

  1. Front-end visual & linguistic dark patterns: Ghosting the $0 free exit at 28% opacity, sneaking recurring fees into pre-selected or triple-negative checkboxes ("Do not uncheck if you prefer not to opt out..."), or pairing equal-size confirmshaming buttons ("Protect My Trip (+$38)" vs "No, I'll risk $5,000 medical bills") where CSS/ad-blockers are completely blind.
  2. Back-end contractual arithmetic traps: Coupling a low headline trial price with rolling prior-notice cutoffs (§9.2: 10-day written notice inside a 14-day trial) and remaining-balance clawbacks (§14.3: 50% of remaining annual installments) buried past character 80,000 of a 24-page contract.
Approach Live Checkout Privacy Euphemistic / Equal-Size UI Traps 24-Page Compound Clawback Math Offline / Cold-Model Resilience
Static CSS / Regex Blockers Safe (Local) Fails on euphemistic copy & equal-size buttons Blind to multi-page contracts Instant (1ms)
Pure Cloud LLM Wrapper Risky if raw DOM/PDF leaves browser Strong semantic decoding Hallucinates multi-step prorated fees Fails offline; costly per pageview
Pure On-Device 4B Model Private (0 bytes sent) Decodes subtle dark-pattern phrasing Context-limited on 110KB legal agreements Unavailable on unsupported hardware
ClearSight Hybrid AI (@firebase/ai) 0 .value input reads + local PII Airlock Gemini Nano first + seamless Cloud fallback + 1ms Air-Gap Deterministic Cloud Python decimal.Decimal (OUTCOME_OK) 3-tier graceful degradation

What it does

ClearSight ships two cohesive product surfaces powered by the official @firebase/ai (v3.1.0) Hybrid Inference SDK:

  1. Stage 1 — On-Device-First UI Shield (InferenceMode.PREFER_ON_DEVICE & ONLY_ON_DEVICE + initializeDeviceModel()):
    • Isolates the active checkout decision cluster under a static and runtime Zero-Private-Field Invariant (0 .value reads on <input>, <textarea>, <select>, and strict isolation of [contenteditable] subtrees).
    • Combines a < 4ms W3C WCAG 2.1 backdrop-compositing salience pass with @firebase/ai structured decoding (ifChosenConsequence -> ifSkippedConsequence -> category)—running locally on Chrome Built-in Gemini Nano when available at zero cloud token cost, seamlessly falling back to cloud inference on PII-scrubbed public labels when local hardware weights are unavailable or warming up, and providing a 1ms Strict Air-Gap optical fallback (0 network bytes).
  2. Stage 2 — Cloud Contract Actuary (InferenceMode.ONLY_IN_CLOUD + Python decimal.Decimal Sandbox):
    • Decompresses /FlateDecode & /ASCII85Decode contract PDFs locally in the browser (up to 160,000 chars / 35+ pages) inside a Fail-Closed Structured-PII Airlock (0 binary inlineData bytes and 0 unverified external URLs ever reach cloud tools).
    • Executes deterministic Python decimal.Decimal inside Gemini's codeExecution sandbox—enforcing an OUTCOME_OK + Decimal verification gate—to plot the 90° Trial Ambush Cliff ($0.99 advertised promise -> $405.92 locked on Day 5, dynamically recalculating to $390.93 when the +$14.99/mo pre-checked add-on is unchecked, with full Year-1 exposure of $900.75, displayed rounded as $901/yr on compact chart headers).
    • Caches verified models in a poisoning-resistant two-tier Cloud Firestore architecture (read-only public verified registry + UID-isolated per-user vaults).
    • Trademark-Safe Deterministic Judge Kit: To strictly honor Official Rules §6 & §12 prohibiting third-party logos or trademarks, our hosted /judge-kit/ models three real-world checkout trap archetypes (creative SaaS clawback, airline confirmshaming, and 3-seat workspace lock) using clean, trademark-free storefronts alongside one-step local PDF drag-and-drop or upload testing in the top Omni-Bar.

How we built it

  • Firebase AI Logic (@firebase/[email protected]): Singleton GenerativeModel caching across InferenceMode.PREFER_ON_DEVICE, InferenceMode.ONLY_ON_DEVICE, and InferenceMode.ONLY_IN_CLOUD (gemini-3.5-flash-lite with codeExecution Python Sandbox and automatic gemini-3.1-flash-lite fallback), non-blocking initializeDeviceModel() warm-up with cold-download timeout guards, serialized on-device prompt execution, and honest telemetry driven by response.inferenceSource.
  • Serverless Firebase Ecosystem: Firebase Hosting (https://clearsight-hybrid-ai.web.app + hosted /judge-kit/), Cloud Firestore (public_terms_audits read-only baseline + users/{uid}/terms_audits UID-isolated vaults), Firebase App Check (ReCaptchaEnterpriseProvider on Web; isolated CustomProvider in Chrome MV3 with 0 remote scripts), Firebase Anonymous Authentication, and Firebase Remote Config.
  • Dual Pure Surfaces & Agentic Engineering: Built from scratch during the #BuildHybridAI 2026 contest window using Google Antigravity and agentic coding workflows with automated red-team verification (42 / 42 unit & seam falsification tests in npm run ci).

What Was Built During the Submission Period & Honest Hardware Telemetry

  • 100% Built Nov 11–30, 2026: Every line of ClearSight's application source code (14,840 lines across 33 core source, style, security-rule, build, and test files), Chrome MV3 extension, Web X-Ray Studio, 42 automated tests, contract specimens, and video assets was authored from scratch during the #BuildHybridAI 2026 contest window (deployed onto an existing personal GCP billing/project account).
  • Honest response.inferenceSource Telemetry (Zero Fake Badges): ClearSight never spoofs hardware badges. On Chrome 139+ desktops with chrome://flags/#prompt-api-for-gemini-nano-multimodal-input enabled and weights ready (available), @firebase/ai executes Stage 1 locally on Gemini Nano 4 (ON_DEVICE). On headless capture machines or judge browsers where local weights are not yet installed, @firebase/ai transparently routes to Firebase AI · Cloud Fallback (online) or our deterministic 1ms Optical Salience safety net (Strict Air-Gap), surfacing the exact runtime path honestly in the UI pill.
  • Audio Attribution: Demo background music "Limit 70" by Kevin MacLeod (incompetech.com), licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/).

Challenges we ran into

  • Fail-Closed Client-Side PDF & Cross-Line PII Scrubbing: Real contracts compress text inside zlib /FlateDecode streams and split emails, phone numbers, and card numbers across kerning-adjusted TJ/Td operators, cross-line hyphens, and inline HTML spans. We engineered a local fflate stream extractor and linear-time O(N) dual-view HTML/PDF scrubber that redacts structured credentials locally before any cloud call while failing closed on encrypted or unmapped scan-only PDFs.
  • Preventing Polarity Flips & Session Eviction: Small models can flip boolean polarity on triple negatives, CSS linear-gradient buttons report transparent backgroundColor, and concurrent local calls can evict active Prompt API sessions. Ordering consequence slots before category in JSON Schema, compositing W3C root-to-leaf gradients, and serializing generateContent over cached GenerativeModel instances solved all three deterministically.

Accomplishments that we're proud of

  • Zero Hallucinated Contract Math: Every dollar figure on the cliff chart is backed by executed Python decimal.Decimal code (OUTCOME_OK), never raw LLM arithmetic guesses.
  • Surgical Zero-Residue Chrome MV3 UX: Non-occluding Top-Layer popover="manual" badges (Trusted Types compatible with automatic viewport clipping) and a 408px 3-block Side Panel (<= 42 words, >= 13.5px type floor, honest per-state Air-Gap/Airlock telemetry) that removes 100% of host DOM markers the instant the panel closes (port.onDisconnect).

What's next for ClearSight

Adding a Cloud Functions verification signer to promote user-audited contracts into the global public_terms_audits registry automatically, broadening wild-web multi-tier pricing table extraction, and encoding statutory cooling-off rules across EU/UK and US state auto-renewal laws.

Built With

Share this project:

Updates

Submission history