Value Proposition & Inspiration
Engineers, forensic investigators, legal analysts, and compliance auditors routinely process sensitive multi-source evidence: internal incident logs, proprietary vendor specifications, and quality audit reports. Existing single-tier AI architectures fail these workflows in two opposing ways:
- Pure Cloud AI Creates Privacy and Offline Bottlenecks: Uploading unredacted PII, credentials, or confidential financials to cloud LLMs creates legal and compliance exposure, fails in air-gapped or low-connectivity environments, and incurs high latency and token costs on repetitive micro-extractions.
- Pure On-Device AI Lacks Global Synthesis Depth: Compact local models excel at deterministic, low-latency entity extraction and redaction, but lack the reasoning depth required to reconcile cross-document technical contradictions and generate executive briefings.
SynapseVault resolves this tradeoff as an installable Progressive Web App (PWA) built on a strict two-tier Firebase AI Logic hybrid pipeline: raw files are parsed, redacted, and structured into an interactive knowledge graph locally on-device with zero network egress, while only sanitized graph topology escalates to the cloud for cross-document contradiction synthesis and executive audio briefings.
How Firebase AI Logic Powers SynapseVault
SynapseVault imports and executes firebase/ai (getAI, getGenerativeModel, GoogleAIBackend) at runtime in src/services/hybridAI.ts, governed by Firebase App Check and Remote Config across three routing modes (prefer_on_device, only_on_device, and only_in_cloud):
Tier 1: On-Device Privacy Firewall & Graph Extraction (Gemini Nano)
- Client-Side Multimodal Ingestion (
documentParser.ts): Parses PDFs (pdfjs-dist), Markdown/text files, and JPEG/PNG images directly in the browser with malformed-PDF recovery so corrupted documents never crash the session. - Zero-Egress PII Redaction: Runs single-turn structured JSON schema extraction locally on-device (
prefer_on_device/only_on_device) to detect and replace sensitive personal, contact, financial, and identifier snippets with typed redaction tokens ([REDACTED_PERSON],[REDACTED_CONTACT],[REDACTED_FINANCIAL],[REDACTED_ID]) at0 Bnetwork egress and$0.00token cost before any data writes to Firestore or leaves the browser. - Structured Knowledge Graph Mapping: Extracts typed JSON nodes (
Entity,Concept,Claim,Risk,Evidence) and directed edges (SUPPORTS,CONTRADICTS,DEPENDS_ON,MENTIONS) rendered on an interactive@xyflow/reactcanvas. - Offline Local Q&A: Powers instant workspace queries from the bottom Ask your local vault dock completely offline.
Tier 2: Sanitized Cloud Synthesis & Executive Audio (gemini-3.8-flash & gemini-3.1-flash-tts-preview)
- Cross-Document Contradiction Synthesis: Escalates strictly redacted text and graph topology (
only_in_cloud) togemini-3.8-flashvia Firebase AI Logic to detect cross-document conflicts, identify knowledge gaps, and produce structured remediation plans. - Executive Audio Briefings: Generates playable audio narration of the synthesized report using
gemini-3.1-flash-tts-preview, automatically falling back to the browser Web Speech API when offline. - Graceful Cross-Browser Degradation: Monitors
LanguageModel.availability()and model download progress in Chrome Desktop v139+. When accessed from Safari, Firefox, or Chrome without on-device AI flags enabled, SynapseVault seamlessly falls back to cloud inference via Firebase AI Logic and surfaces transparent status telemetry inside the header engine popover without runtime errors.
Production Firebase Architecture & Developer Tooling
- Firebase App Check: Strictly initialized via
ReCaptchaEnterpriseProviderwith a hackathon evaluation debug token before anygetAI()call insrc/lib/firebase.ts. - Firebase Remote Config: Dynamically controls
default_inference_mode("prefer_on_device") andauto_pii_firewall(true) without requiring frontend redeployment. - Cloud Firestore & Security Rules: Persists sanitized workspaces, graph structures, and briefings under
users/{userId}/workspaces/{workspaceId}usingpersistentLocalCacheandpersistentMultipleTabManagerfor offline queuing and automatic sync on reconnect. Protected by deployedfirestore.rulesenforcing strict owner-only UID isolation (request.auth != null && request.auth.uid == userId) with an explicit deny-all default (allow read, write: if false;). - Firebase Authentication: Automatically bootstraps Anonymous Auth sessions for zero-friction evaluation alongside optional Google Sign-In.
- Firebase Hosting & PWA: Serves the Vite production bundle and Workbox service worker (
dist/sw.js) with SPA rewrites and strict HTTP security headers (HSTS,X-Content-Type-Options,X-Frame-Options). - Development & Verification: Built with Google Antigravity using the official Firebase Agent Skills (
firebase/agent-skills) and verified by a 15-test Vitest automated suite covering document parsing, hybrid routing/fallback, PII firewall enforcement, Firestore sanitization guards, benchmark calculations, and theme persistence.
Features & Evaluator Experience
- 1-Click Sample Case Study (Project Helios): Loads a realistic 3-document hardware thermal failure investigation containing embedded PII and a deliberate cross-document engineering contradiction directly from the onboarding canvas.
- 5-Step Interactive Walkthrough: Accessible via the Guide control in the header; auto-tracks progress across ingestion, redaction inspection, graph navigation, cloud synthesis, and benchmarking.
- Three Dedicated Workspace Views:
- Canvas: Interactive knowledge graph with elevated category-coded nodes, clickable dashed contradiction edges, slide-over Node Inspector drawer, and offline Q&A dock.
- Redactions: Privacy Firewall summary strip (
PII Items Blocked Locally,0 Raw Bytescloud exposure) and side-by-side local vs. sanitized diff with high-contrast redaction bars. - Briefing: Sanitized payload preview, structured
gemini-3.8-flashexecutive report, and integrated Audio Briefing player.
- Side-by-Side Hybrid Benchmark Modal: Executes identical extraction workloads across
only_on_deviceandonly_in_cloudto compare latency speedup, network egress (0 Blocal vs. wire payload), privacy exposure, and token cost. - Dual-Theme Editorial Interface: Supports Warm Archival (Light) and Obsidian Studio (Dark) modes persisted via
localStorage.
Challenges We Ran Into
- Enforcing Hard Privacy Boundaries Before Persistence: Guaranteeing unredacted PII could never reach Cloud Firestore or Tier 2 cloud synthesis required isolating client-side parsing, local schema-constrained redaction, and cloud payload serialization behind the
auto_pii_firewallRemote Config gate. - Supporting Evaluators Across Every Browser: Because Chrome's on-device Gemini Nano Prompt API requires Desktop v139+ with experimental flags, we engineered an availability monitor and fallback router so judges on any browser can evaluate the complete workflow immediately without crashes.
- Handling Real-World Malformed PDFs: Client-side PDF parsing can throw unrecoverable worker errors on damaged files; wrapping
pdfjs-distwith plain-text fallback recovery and isolating React Flow inside dedicated Error Boundaries ensured workspace resilience.
Accomplishments & What We Learned
- Demonstrated an architectural use case where hybrid inference is strictly necessary—combining air-gapped local privacy and zero-cost micro-extraction with cloud-scale cross-document reasoning.
- Proved real-world hybrid advantages quantitatively inside the product through an interactive side-by-side Benchmark modal and live telemetry popover.
- Learned that designing for on-device models requires strict single-turn JSON schema discipline, explicit session cleanup (
session.destroy()), and progressive disclosure in the UI so technical telemetry informs without cluttering the user workflow.
Judge Testing Instructions
- Open https://synapsevault-38f14.web.app (no account creation required; Anonymous Auth initializes automatically, and Firebase App Check uses an authorized evaluation debug token).
- Click Load Sample Investigation (Project Helios) on the landing canvas, or open the Guide popover in the top bar to follow the 5-step interactive walkthrough.
- Review the extracted graph on Canvas, inspect blocked local PII on Redactions, trigger Tier 2 synthesis and audio playback on Briefing, and run Compare Local vs. Cloud Benchmark.
- Testing Air-Gapped On-Device Mode (Optional): Open the live URL in Chrome Desktop v139+ with
#prompt-api-for-gemini-nano,#prompt-api-for-gemini-nano-multimodal-input, and#optimization-guide-on-device-modelenabled inchrome://flags. Once the top-right engine pill showsLocal, switch DevTools Network to Offline and query the bottom Ask your local vault bar to verify0 Begress execution.
What Is Next for SynapseVault
- Adding client-side WebGPU/IndexedDB vector indexing for offline semantic retrieval across hundreds of local documents.
- Introducing team-level encrypted workspace sharing with role-based Firestore security rules.
- Transitioning Firebase App Check from the hackathon evaluation debug token to full Google Cloud Fraud Defense attestation for public production rollout.
Built With
- cloud-firestore
- firebase
- firebase-agent-skills
- firebase-ai-logic
- firebase-app-check
- firebase-authentication
- firebase-hosting
- firebase-remote-config
- gemini-3.1-flash-tts-preview
- gemini-3.8-flash
- gemini-nano
- google-antigravity
- pdfjs
- pwa
- react
- react-flow
- tailwindcss
- typescript
- vite