Inspiration
Almost everyone hits "Bookmark Bankruptcy"—hundreds of saved links and forgotten tabs piling up into a digital graveyard of good intentions. Traditional read-it-later apps replace one endless vertical list with another, and reading long essays inside cluttered browser tabs leads to constant context-switching and low retention.
Forgotten Press reimagines neglected browser bookmarks through the lens of archival physical publishing (inspired by Stripe Press). Instead of storing links in another checklist, it synthesizes aging bookmarks and open articles into structured, 3-chapter hardcover digital monographs on a tactile 3D bookshelf—prioritizing your oldest unread bookmarks first.
What it does
- Firebase AI Logic Hybrid Inference (
firebase/ai): Runs locally on-device with Chrome's built-in Gemini Nano whenever available (0outbound network bytes) and seamlessly escalates to Cloud Gemini (gemini-4-hydrogenon Web /gemini-3.5-flash-litein Extension) when Nano is unavailable, over token quota, or exceeds a streaming time-to-first-token watchdog. - Full 4-Mode
InferenceModeControl: Switch betweenPREFER_ON_DEVICE,ONLY_ON_DEVICE(strict zero-egress refusal when local weights aren't ready),PREFER_IN_CLOUD, andONLY_IN_CLOUDin both the web Hybrid Engine modal and the Chrome/Brave extension popup. - Manifest V3 Chrome / Brave Extension (
extension/):- Read & Bind Active Tab: Extracts clean prose from the current page and compiles a structured 3-chapter monograph.
- Scan & Bind Oldest Bookmarks: Traverses your oldest Chrome bookmarks 5 at a time with an SSRF-guarded scraper and syncs bound volumes straight to the native extension Side Panel (
shelf.html). - Context Menu Synthesizer: Right-click any selected passage anywhere on the web to bind it into your library.
- Anti-Backlog Queue & 3D Reading Experience: Scores backlog age so forgotten multi-year bookmarks rise to the top of your Daily Reading Queue with a "Backlog Zero" projection, paired with an interactive WebGL2 3D conical page-curl reader (64×64 curved mesh with spring physics & procedural paper grain), a distraction-free serif reader, and EPUB 3.0 / A5 PDF export.
How we built it
1. Unified Hybrid Router (firebase/ai)
Both the web app (src/services/firebaseHybridAi.ts) and MV3 extension (src/extension/firebaseClient.ts) initialize firebase/ai with GoogleAIBackend():
import { initializeApp } from "firebase/app";
import { getAI, GoogleAIBackend, getGenerativeModel, InferenceMode, InferenceSource } from "firebase/ai";
const firebaseApp = initializeApp(firebaseConfig);
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });
Before executing synthesis, Forgotten Press probes self.LanguageModel.availability() and measures exact prompt tokens via session.measureInputUsage() against the hardware 1,024-token input budget. During PREFER_ON_DEVICE, a 4.5s TTFT streaming watchdog escalates stalled local generations to Cloud Gemini and records verifiable execution provenance on every spine (On-Device · Gemini Nano, Cloud · Gemini, Cloud · Gemini (Expanded), Cloud · Gemini (Nano Timeout), or Blocked · Tab Bind).
2. Resilient Scraping & Dossier Parsing
Real bookmarks regularly point to JavaScript SPA shells, paywalls, or /pdf/ URLs. Our pipeline:
- Enforces strict SSRF and content-type guards (blocking private/loopback/metadata IPs, skipping binary media/PDF streams, and rewriting
arxiv.org/pdf/<id>URLs to/abs/<id>HTML abstracts). - Tags login/paywall walls honestly as
Blocked · Tab Bindinstead of hanging or hallucinating. - Expands sparse
<100-word SPA captures into structured 3-chapter dossiers viaparseAiDossierExpansion(), supporting structured JSON schemas, fenced JSON, and Markdown headings while keeping partial streams clean in the UI.
3. Local-First Publishing Stack
- Storage:
IndexedDB(folio_press_db) +chrome.storage.local+ cross-tabBroadcastChannelsync. - Covers & Typesetting: Procedural SVG cloth motifs (
orbital-rings,neural-topology,kintsugi-fracture,typographic-bauhaus,isometric-lattice), high-DPI 2D canvas chapter rasterization mapped onto the WebGL2 curl mesh, and offline EPUB 3.0 (jszip) / A5 PDF (jspdf) export.
Challenges we ran into
- MV3 Extension Runtime Constraints:
firebase/aiand Firebase App Check behave differently across Vite web bundles, MV3 popup scripts, and MV3 background service workers (selfvs.windowglobals andDOM-dependent reCAPTCHA vs. debug-token providers). We solved this by making App Check initializationglobalThis/DOM-aware and bundling a lightweightesbuildruntime (extension/popup.bundle.js) cleanly synced topublic/extension. - Streaming Partial JSON Leakage: Cloud streaming responses for structured chapters initially surfaced raw partial JSON braces in cards mid-stream. We hardened the streaming parser to cleanly suppress unclosed JSON fragments and fall back gracefully on partial/malformed SSE payloads.
- Noisy Real-World Bookmarks: Scraping 5+ year-old bookmarks hits dead links, newsletter footers, paywalls, and sparse SPAs. Differentiating paywalled targets from short abstracts—and sanitizing untrusted scraped metadata in XML prompt delimiters—was essential to avoid broken monographs.
Accomplishments that we're proud of
- Real hybrid execution across two distinct Chromium environments: strict offline
0B-egress Gemini Nano synthesis in Chrome Canary/139+ and seamless Cloud Gemini fallback in any standard Chromium browser (Chrome, Brave, Edge, Arc). - Verifiable provenance badges backed by actual runtime telemetry (
InferenceSource, token usage, TTFT, and outbound byte count) instead of opaque "AI magic." - Full verification coverage: clean
tsc --noEmittypechecking, Vite + MV3 build (npm run build), and19automated test suites (208passing assertions covering SSRF guards, dossier parsing, MV3 IPC, quota routing, TTFT escalation, and WebGL2 rasterization).
What we learned
- Token budgeting matters more than prompt cleverness on-device: Measuring exact
inputQuotaup front (measureInputUsage) prevents silent local truncation and turns hybrid routing from guesswork into deterministic engineering. - Strict fail-closed modes build trust: Implementing
ONLY_ON_DEVICEas a hard refusal (zero cloud bytes) makes privacy guarantees testable and auditable.
What's next
- Multi-bookmark thematic anthology binding (synthesizing 5–10 related links into a single comparative volume with cross-chapter citations).
- Live Reading Highlights sync across devices with optional encrypted cloud vault backup.
Judge's Testing Guide
- Clone the repository and build both the web app and MV3 extension:
bash npm install && npm run build - Open
chrome://extensions(orbrave://extensions), enable Developer mode, click Load unpacked, and select theextension/folder. - Click the Forgotten Press toolbar icon:
- Click Read & Bind Active Tab on any article to observe real hybrid routing, latency, payload bytes, and chapter synthesis.
- Click Scan & Bind Oldest Chrome Bookmarks to incrementally bind 5 bookmarks onto
shelf.html. - Switch the mode selector to On-Device Only (
ONLY_ON_DEVICE) to verify strict zero-egress behavior when local Gemini Nano weights are absent (or enable#prompt-api-for-gemini-nano&#optimization-guide-on-device-modelin Chrome 139+/Canary to test0Blocal inference).
Built With
- chrome
- chrome-built-in-ai
- express.js
- firebase
- firebase-ai-logic
- gemini
- gemini-nano
- indexeddb
- node.js
- react
- tailwindcss
- typescript
- vite
- webgl