<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Omar Afifi</title>
    <description>The latest articles on DEV Community by Omar Afifi (@omarafifi).</description>
    <link>https://dev.to/omarafifi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3954903%2F1b239da9-6bec-4707-b255-626d891d9dd7.png</url>
      <title>DEV Community: Omar Afifi</title>
      <link>https://dev.to/omarafifi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omarafifi"/>
    <language>en</language>
    <item>
      <title>Folivora: an open-model reading room that predicts which of your open tabs you'll never actually read — and reads you the few that matter</title>
      <dc:creator>Omar Afifi</dc:creator>
      <pubDate>Sun, 25 Oct 2026 16:57:17 +0000</pubDate>
      <link>https://dev.to/omarafifi/folivora-an-open-model-reading-room-that-predicts-which-of-your-open-tabs-youll-never-actually-3dbo</link>
      <guid>https://dev.to/omarafifi/folivora-an-open-model-reading-room-that-predicts-which-of-your-open-tabs-youll-never-actually-3dbo</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week3-2026-10-19"&gt;Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Look at the top of your browser right now.&lt;/p&gt;

&lt;p&gt;If yours looks anything like mine, there's a row of tabs sitting open from last week — maybe 8 of them, maybe 40. You don't keep them open because you're going to read a 4,000-word article from start to finish. You keep them open because &lt;strong&gt;one of them has the flight time buried in paragraph six of a trip guide, another has the laptop comparison you meant to finish, and a third has the single paragraph you actually needed&lt;/strong&gt; — and closing them feels like throwing something away.&lt;/p&gt;

&lt;p&gt;And you don't need forty tabs for this to hurt. Ten unread articles is already two hours of reading you keep postponing, and "later" never comes. Two things would fix it without requiring an afternoon of reading:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A model that knows which pages you'll actually use and which ones you'll never miss&lt;/strong&gt;, with a calibrated upper bound so a tab is only set aside when that's genuinely safe.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A single calm page with just the takeaways you needed&lt;/strong&gt;, plus a fifteen-second spoken summary so you can close the whole browser window and go make coffee.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So I built &lt;strong&gt;&lt;a href="https://folivora.tech" rel="noopener noreferrer"&gt;Folivora&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;(from the biological suborder for tree sloths, and Latin &lt;code&gt;folium + vorare&lt;/code&gt; — literally *&lt;/em&gt;"the page/folio devourer"*&lt;em&gt;)&lt;/em&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Folivora&lt;/strong&gt; takes the tabs you keep meaning to read, inspects the live pages in a cloud browser when you ask it to, predicts which ones you will never get to, and hands you a &lt;strong&gt;printable, section-anchored reading digest&lt;/strong&gt; of the rest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Say what you need, don't type.&lt;/strong&gt; Tap the mic once, say what you're looking for — &lt;em&gt;"Japan travel itinerary"&lt;/em&gt;, &lt;em&gt;"the quietest laptop for studying"&lt;/em&gt;, or &lt;em&gt;"Web development"&lt;/em&gt; if that's your thing — then tap it again to stop. &lt;strong&gt;ElevenLabs Scribe (&lt;code&gt;scribe_v1&lt;/code&gt;)&lt;/strong&gt; turns your voice note into a filter rule and immediately calls &lt;code&gt;DELETE /v1/speech-to-text/transcripts/{id}&lt;/code&gt; so your voice transcript is wiped from ElevenLabs as soon as the text returns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A cloud browser opens the live tabs for you.&lt;/strong&gt; Instead of you clicking through them one by one, &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/src/browserbase_service.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/browserbase_service.py&lt;/code&gt;&lt;/a&gt; spins up a cloud Chromium session on &lt;strong&gt;Browserbase&lt;/strong&gt;, drives up to 16 links over Chrome DevTools Protocol (CDP), and reads what each page actually contains — reading time, code blocks, tables, headings, and section structure. Larger piles use the same extractor over capped HTTP after the live-browser budget; every CDP failure falls back per link instead of failing the run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An open model predicts a probability range (&lt;code&gt;P10&lt;/code&gt;, &lt;code&gt;P50&lt;/code&gt;, &lt;code&gt;P90&lt;/code&gt;), not a single guess.&lt;/strong&gt; Evaluated on &lt;strong&gt;3,600 tab lifecycle records&lt;/strong&gt; (&lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/data/developer_tabs_telemetry.csv" rel="noopener noreferrer"&gt;&lt;code&gt;data/developer_tabs_telemetry.csv&lt;/code&gt;&lt;/a&gt;), &lt;strong&gt;Prior Labs TabPFN&lt;/strong&gt; scores every tab. A tab is only set aside when even its optimistic &lt;strong&gt;90th-percentile upper bound (&lt;code&gt;P90&lt;/code&gt;)&lt;/strong&gt; falls below threshold—cutting the False-Close Rate by &lt;strong&gt;23x&lt;/strong&gt; down to &lt;strong&gt;&lt;code&gt;0.36%&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemma writes the two-line brief; plain code checks every digit.&lt;/strong&gt; Open-weight &lt;strong&gt;Google Gemma 4 (&lt;code&gt;gemma-4-26b-a4b-it&lt;/code&gt;) &amp;amp; Gemma 3 (&lt;code&gt;gemma-3-12b-it&lt;/code&gt; / &lt;code&gt;27b-it&lt;/code&gt; / &lt;code&gt;4b&lt;/code&gt;)&lt;/strong&gt; write a two-sentence spoken summary of what was set aside and what was kept. &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/src/gemma_service.py" rel="noopener noreferrer"&gt;&lt;code&gt;check_output()&lt;/code&gt;&lt;/a&gt; checks that every single number in Gemma's sentences exists character-for-character in Python's facts dictionary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Print the keepers, export bookmarks, or listen in 15 seconds.&lt;/strong&gt; Hit &lt;strong&gt;Listen (15s)&lt;/strong&gt; to hear &lt;strong&gt;ElevenLabs Flash v2.5&lt;/strong&gt; (Charlie voice) read the two lines aloud, hit &lt;strong&gt;Save Notes (&lt;code&gt;.md&lt;/code&gt;)&lt;/strong&gt; or &lt;strong&gt;Bookmarks&lt;/strong&gt; to export your keepers, or hit &lt;strong&gt;Print&lt;/strong&gt; to print only the cards you kept, then walk away.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built for everyone, not just engineers.&lt;/strong&gt; The interface is a calm reading room in a warm editorial palette (&lt;code&gt;Newsreader&lt;/code&gt; + &lt;code&gt;Plus Jakarta Sans&lt;/code&gt;) — no ML jargon on screen. Built-in topic chips cover everyday life: &lt;strong&gt;Travel, Health &amp;amp; Sleep, Food &amp;amp; Recipes, Shopping&lt;/strong&gt; — next to Web Dev and AI &amp;amp; Tech for the developers. Planning a 10-day Japan trip, comparing laptops, or prepping meals works exactly like triaging 65 engineering articles, while every benchmark, evaluation, and trace stays inspectable in the repository.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Web Application:&lt;/strong&gt; &lt;strong&gt;&lt;a href="https://folivora.tech" rel="noopener noreferrer"&gt;https://folivora.tech&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;(no sign-up; test with your own links, launch the **14 Everyday &amp;amp; Travel Tabs&lt;/em&gt;* window or the &lt;strong&gt;65 DEV Article Library&lt;/strong&gt;, or enable "Use live cloud browser" to watch a real Browserbase Chromium session inspect your URLs)*&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1-Click Browser Extension (&lt;code&gt;.zip&lt;/code&gt;):&lt;/strong&gt; &lt;strong&gt;&lt;a href="https://folivora.tech/download-extension.zip" rel="noopener noreferrer"&gt;https://folivora.tech/download-extension.zip&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;(pre-configured to &lt;code&gt;https://folivora.tech&lt;/code&gt;—one click scans your open window, with an optional topic, and opens the full Reading Digest pre-filled; it never closes or modifies your tabs)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive OpenAPI Docs:&lt;/strong&gt; &lt;strong&gt;&lt;a href="https://folivora.tech/docs" rel="noopener noreferrer"&gt;https://folivora.tech/docs&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation Report (&lt;code&gt;59 / 60&lt;/code&gt; pass):&lt;/strong&gt; &lt;strong&gt;&lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/EVAL.md" rel="noopener noreferrer"&gt;&lt;code&gt;eval/EVAL.md&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;Hand Audit:&lt;/strong&gt; &lt;strong&gt;&lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/REVIEW.md" rel="noopener noreferrer"&gt;&lt;code&gt;eval/REVIEW.md&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flz7iifmer27c3g1unu5w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flz7iifmer27c3g1unu5w.gif" alt="Folivora Live Reading Digest Workflow" width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;01 · The Reading Desk (Calm Intake)&lt;/th&gt;
&lt;th&gt;02 · Sample Windows &amp;amp; 65 DEV Article Library&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F37lgxwldadcbu89y7lkw.png" alt="Reading Desk Home" width="800" height="565"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7n5cn8q1tzem9pnxfsrn.png" alt="Sample Windows" width="800" height="565"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;em&gt;Paste links, import bookmarks, or pick a topic chip (Travel, Health &amp;amp; Sleep, Food &amp;amp; Recipes, Shopping, Web Dev, AI &amp;amp; Tech).&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;One-click sample windows: 14 Everyday &amp;amp; Travel Tabs, the 65 DEV Article Library (600+ min read), and 10 Research Tabs.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;03 · Summarize All Open Tabs (No Filter)&lt;/th&gt;
&lt;th&gt;04 · Topic Focus &amp;amp; Set-Aside Triage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0gjujdrub29g2j3hs7bw.png" alt="Summarize All Mode" width="800" height="612"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fywufdxtcqo70yb2ew5sd.png" alt="Topic Focus Mode" width="800" height="612"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;em&gt;Mode A (Unrated): Summarizes every open tab into a 25-second overview + section-anchored takeaways.&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;Mode B (Topic Focus): Ranks matching pages under **Worth Your Time&lt;/em&gt;* and moves unrelated pages to &lt;strong&gt;Set Aside&lt;/strong&gt;.*&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;strong&gt;&lt;a href="https://github.com/OmarAfifi-CSE/folivora" rel="noopener noreferrer"&gt;https://github.com/OmarAfifi-CSE/folivora&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MIT-licensed. Covered by &lt;strong&gt;92 automated unit, integration, and red-team tests&lt;/strong&gt; (&lt;code&gt;python run_local.py --test&lt;/code&gt;). Every benchmark table, DEV Hall of Fame catalog (&lt;code&gt;data/dev_hall_of_fame_catalog.json&lt;/code&gt;), and evaluation number in this post is reproducible via &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/benchmarks/ablate.py" rel="noopener noreferrer"&gt;&lt;code&gt;benchmarks/ablate.py&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/benchmarks/build_hall_of_fame_catalog.py" rel="noopener noreferrer"&gt;&lt;code&gt;benchmarks/build_hall_of_fame_catalog.py&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/run_eval.py" rel="noopener noreferrer"&gt;&lt;code&gt;eval/run_eval.py&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/summary_quality.py" rel="noopener noreferrer"&gt;&lt;code&gt;eval/summary_quality.py&lt;/code&gt;&lt;/a&gt;, and &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/redteam_eval.py" rel="noopener noreferrer"&gt;&lt;code&gt;eval/redteam_eval.py&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-World Stress Test: Indexing the 65-Article DEV Hall of Fame (600+ Minutes of Reading)
&lt;/h2&gt;

&lt;p&gt;This week, &lt;a href="https://dev.to/georgekobaidze"&gt;@georgekobaidze&lt;/a&gt; published &lt;strong&gt;&lt;a href="https://dev.to/georgekobaidze/promise-delivered-welcome-to-the-dev-hall-of-fame-65-authors-65-masterpieces-15fa"&gt;Promise Delivered: Welcome to the DEV Hall of Fame (65 Authors, 65 Masterpieces)&lt;/a&gt;&lt;/strong&gt;—a curated tour of 65 community-chosen articles across 7 themed wings (&lt;em&gt;The Welcome Desk&lt;/em&gt;, &lt;em&gt;Stories From the Trenches&lt;/em&gt;, &lt;em&gt;The "Finally, It Clicked" Gallery&lt;/em&gt;, &lt;em&gt;The Engine Room&lt;/em&gt;, &lt;em&gt;The AI Lab&lt;/em&gt;, &lt;em&gt;The Philosophy Floor&lt;/em&gt;, and &lt;em&gt;The Builder's Garage&lt;/em&gt;), including my own post &lt;a href="https://dev.to/omarafifi/my-phone-broke-and-gemini-fixed-it-329l"&gt;My Phone Broke, and Gemini Fixed It&lt;/a&gt; in &lt;strong&gt;The Engine Room&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Listed reading time across all 65 tabs? &lt;strong&gt;Over 600 minutes (10+ hours).&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Opening 65 tabs at once is the ultimate browser-tab nightmare. So I built the &lt;strong&gt;65 DEV Article Library&lt;/strong&gt; directly into Folivora (&lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/benchmarks/build_hall_of_fame_catalog.py" rel="noopener noreferrer"&gt;&lt;code&gt;benchmarks/build_hall_of_fame_catalog.py&lt;/code&gt;&lt;/a&gt;) and calibrated &lt;strong&gt;TabPFN&lt;/strong&gt; on their real DOM feature profiles (&lt;code&gt;word_count&lt;/code&gt;, &lt;code&gt;code_block_count&lt;/code&gt;, &lt;code&gt;table_count&lt;/code&gt;, &lt;code&gt;heading_count&lt;/code&gt;, &lt;code&gt;link_density&lt;/code&gt;, and &lt;code&gt;intent_match_score&lt;/code&gt;).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;05 · 65 DEV Article Library Filtered by "Web Development"&lt;/th&gt;
&lt;th&gt;06 · Mobile Responsive Digest View&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbcsliy3shbxs1s4c0fdr.png" alt="65 DEV Article Library Filtered by Web Development" width="800" height="612"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8orlul58s6mm6glungqr.png" alt="Mobile Digest View" width="500" height="980"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;em&gt;Partitions 65 community articles in one deterministic pass (zero LLM in the loop): keeps 22 matching Web Development articles and sets aside 43 unrelated tabs (478.9 min saved).&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Responsive down to mobile screens with zero horizontal overflow and 44px+ touch targets.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Even better, when you filter by a specific topic, each matching card gives you &lt;strong&gt;two interactive Segmented Tabs&lt;/strong&gt; (never a cluttered wall of stacked text):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Focused on "&amp;lt;Your Topic&amp;gt;"&lt;/code&gt; (Active Tab):&lt;/strong&gt; Synthesizes &lt;em&gt;why&lt;/em&gt; the article matters for your exact query and extracts section-anchored takeaways (&lt;code&gt;Heading — Key Insight&lt;/code&gt;) specifically from the sections discussing that topic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Full Summary&lt;/code&gt; (Second Tab):&lt;/strong&gt; Gives you the full, objective summary across all sections of the article.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is what happens when you load all &lt;strong&gt;65 DEV Hall of Fame tabs&lt;/strong&gt; in Folivora and filter by different engineering topics:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Filter Query on All 65 DEV Articles&lt;/th&gt;
&lt;th&gt;Matching Tabs Kept&lt;/th&gt;
&lt;th&gt;Unrelated Tabs Set Aside&lt;/th&gt;
&lt;th&gt;Full-Article Reading Time Saved&lt;/th&gt;
&lt;th&gt;Top-Ranked Hall of Fame Masterpiece (&lt;code&gt;P50&lt;/code&gt; Match)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;"Flutter"&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2 / 65&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;697.9 min (~11.6 hrs)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;Creating Adaptive Flutter Screens and Widgets&lt;/em&gt; by &lt;a href="https://dev.to/dylanscottmickelson"&gt;@dylanscottmickelson&lt;/a&gt; (&lt;code&gt;94.2%&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;"Gemini"&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3 / 65&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;62&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;691.8 min (~11.5 hrs)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;My Phone Broke, and Gemini Fixed It&lt;/em&gt; by &lt;a href="https://dev.to/omarafifi"&gt;@omarafifi&lt;/a&gt; (&lt;code&gt;95.0%&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;"Security"&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8 / 65&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;57&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;635.1 min (~10.6 hrs)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;The one you reported is gone. This one is still up.&lt;/em&gt; by &lt;a href="https://dev.to/mrveiss"&gt;@mrveiss&lt;/a&gt; (&lt;code&gt;93.7%&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;"Debugging"&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;12 / 65&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;53&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;595.5 min (~9.9 hrs)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;My Phone Broke, and Gemini Fixed It&lt;/em&gt; (&lt;code&gt;95.0%&lt;/code&gt;) &amp;amp; &lt;em&gt;Jerry Ran Out of Numbers But Drank All the Punch&lt;/em&gt; (&lt;code&gt;93.7%&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;"Databases &amp;amp; SQL"&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;13 / 65&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;52&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;530.7 min (~8.8 hrs)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;SQL Common Table Expressions and Window functions&lt;/em&gt; by &lt;a href="https://dev.to/mrpercival"&gt;@mrpercival&lt;/a&gt; (&lt;code&gt;96.0%&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;"Career"&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;20 / 65&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;45&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;447.8 min (~7.5 hrs)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;Dreams &amp;amp; Cheers&lt;/em&gt; &amp;amp; &lt;em&gt;The Most Painful Career Lesson My Best Job Taught Me&lt;/em&gt; by &lt;a href="https://dev.to/canro91"&gt;@canro91&lt;/a&gt; (both &lt;code&gt;92.7%&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;"AI Agents"&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;36 / 65&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;29&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;329.6 min (~5.5 hrs)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;Pair Programming With Three AI Tools&lt;/em&gt; by &lt;a href="https://dev.to/elsie-rainee"&gt;@elsie-rainee&lt;/a&gt; (&lt;code&gt;95.6%&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Focm3f705w79mdl6ib30y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Focm3f705w79mdl6ib30y.png" alt="Folivora Dual-Lane Architecture &amp;amp; Verification Pipeline" width="800" height="507"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;voice note (optional)   ──▶ ElevenLabs Scribe STT → text filter (remote transcript deleted immediately)
tab URLs / pile         ──▶ Browserbase Cloud Chromium (CDP) → word count, code blocks, tables, snippet
7 DOM features + intent ──▶ Prior Labs TabPFN (CPU) → P10, P50, P90 utility quantiles
P90 surviving tabs      ──▶ Gemini 3.1 Flash Lite + Gemma Pool → grounded card polish → validator (targeted repair → Python fallback)
                        ──▶ Gemma 4 / 3 → 2-sentence brief → check_output() digit gate (1 retry → template)
verified brief + cards  ──▶ ElevenLabs Flash v2.5 audio + printable section summary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Code owns the numbers, TabPFN predicts the distribution, Gemini and Gemma write the words, and Sentry traces every step.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The reading-time rule ranks tabs no better than a coin flip
&lt;/h3&gt;

&lt;p&gt;A naive tab cleaner uses a reading-time rule: close anything old or long. That fails immediately for developers, because a 6-day-old documentation tab with 11 code blocks is something you still need, while a 4,800-word opinion essay from two weeks ago is dead weight.&lt;/p&gt;

&lt;p&gt;I built a &lt;strong&gt;3,600-row tab telemetry dataset&lt;/strong&gt; (&lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/data/developer_tabs_telemetry.csv" rel="noopener noreferrer"&gt;&lt;code&gt;data/developer_tabs_telemetry.csv&lt;/code&gt;&lt;/a&gt;) with seven numerical features—six extracted from the DOM (&lt;code&gt;age_days&lt;/code&gt;, &lt;code&gt;word_count&lt;/code&gt;, &lt;code&gt;code_block_count&lt;/code&gt;, &lt;code&gt;table_count&lt;/code&gt;, &lt;code&gt;heading_count&lt;/code&gt;, &lt;code&gt;link_density&lt;/code&gt;) plus one &lt;strong&gt;intent-match score&lt;/strong&gt; for how well the page matches what you asked for.&lt;/p&gt;

&lt;p&gt;I held out &lt;strong&gt;720 unseen tabs (20%)&lt;/strong&gt; and compared &lt;strong&gt;Prior Labs TabPFN&lt;/strong&gt; (&lt;code&gt;output_type="quantiles"&lt;/code&gt;, &lt;code&gt;quantiles=[0.10, 0.50, 0.90]&lt;/code&gt;) against a Reading-Time &amp;amp; Recency Heuristic and &lt;code&gt;HistGradientBoostingRegressor&lt;/code&gt; in &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/benchmarks/ablate.py" rel="noopener noreferrer"&gt;&lt;code&gt;benchmarks/ablate.py&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model (Evaluated on 720 Unseen Tabs)&lt;/th&gt;
&lt;th&gt;Average Error (MAE) ↓&lt;/th&gt;
&lt;th&gt;RMSE ↓&lt;/th&gt;
&lt;th&gt;Spearman Rank $r$ ↑&lt;/th&gt;
&lt;th&gt;Real Scores Inside 80% (&lt;code&gt;P10–P90&lt;/code&gt;) Band&lt;/th&gt;
&lt;th&gt;Real Scores Below &lt;code&gt;P90&lt;/code&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Reading-Time &amp;amp; Recency Heuristic&lt;/td&gt;
&lt;td&gt;21.88&lt;/td&gt;
&lt;td&gt;26.68&lt;/td&gt;
&lt;td&gt;0.033&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;HistGradientBoosting&lt;/code&gt; (Quantile)&lt;/td&gt;
&lt;td&gt;3.95&lt;/td&gt;
&lt;td&gt;4.94&lt;/td&gt;
&lt;td&gt;0.967&lt;/td&gt;
&lt;td&gt;55.3%&lt;/td&gt;
&lt;td&gt;77.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Prior Labs TabPFN (All 7 Features)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4.31&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.975&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;77.9%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;90.0%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TabPFN Ablation (without &lt;code&gt;intent_match_score&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;15.4&lt;/td&gt;
&lt;td&gt;18.32&lt;/td&gt;
&lt;td&gt;0.390&lt;/td&gt;
&lt;td&gt;81.2%&lt;/td&gt;
&lt;td&gt;91.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TabPFN Ablation (without &lt;code&gt;code_block_count&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;4.18&lt;/td&gt;
&lt;td&gt;5.37&lt;/td&gt;
&lt;td&gt;0.965&lt;/td&gt;
&lt;td&gt;80.7%&lt;/td&gt;
&lt;td&gt;92.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TabPFN Ablation (without &lt;code&gt;age_days&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;3.87&lt;/td&gt;
&lt;td&gt;4.79&lt;/td&gt;
&lt;td&gt;0.971&lt;/td&gt;
&lt;td&gt;78.5%&lt;/td&gt;
&lt;td&gt;90.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two things jump out of this table. First, the reading-time heuristic ranks tabs &lt;strong&gt;no better than random chance&lt;/strong&gt; (Spearman &lt;code&gt;0.033&lt;/code&gt;)—"close anything old or long" is statistically meaningless. Second, look at the fifth column (&lt;strong&gt;Real Scores Inside 80% &lt;code&gt;P10–P90&lt;/code&gt; Band&lt;/strong&gt;). That is why TabPFN is here instead of gradient boosting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;HistGradientBoostingRegressor&lt;/code&gt; with quantile loss is fast, but its &lt;code&gt;P10–P90&lt;/code&gt; interval only captured &lt;strong&gt;55.3%&lt;/strong&gt; of unseen tabs—it is overconfident by nearly 25 percentage points.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TabPFN's Bayesian prior distribution captured 77.9% of unseen tabs inside its 80% band&lt;/strong&gt;—within two points of nominal—and &lt;strong&gt;90.0%&lt;/strong&gt; fell below its &lt;code&gt;P90&lt;/code&gt; upper bound (while lowering MAE to &lt;strong&gt;3.5&lt;/strong&gt; and RMSE to &lt;strong&gt;4.31&lt;/strong&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even more importantly, closing a browser tab is an &lt;strong&gt;asymmetric risk&lt;/strong&gt;: keeping one extra borderline tab costs 30 seconds of skimming, while closing a reference tab you actually needed destroys context. In &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/src/tabpfn_engine.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/tabpfn_engine.py&lt;/code&gt;&lt;/a&gt;, TabPFN predicts the full quantile distribution &lt;code&gt;[0.10, 0.50, 0.90]&lt;/code&gt; in a single forward pass on CPU:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# src/tabpfn_engine.py — Calibrated quantile triage on CPU
&lt;/span&gt;&lt;span class="n"&gt;reg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TabPFNRegressor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_default_for_version&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;ModelVersion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;V2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_estimators&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;reg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;quantiles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;quantiles&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quantiles&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.90&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# Asymmetric guardrail: only set a tab aside when even its optimistic P90 bound &amp;lt; 45.0
&lt;/span&gt;&lt;span class="n"&gt;verdict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CLOSE_ARCHIVE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;p90&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;45.0&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;KEEP_EXTRACT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you triage tabs using a point estimate (&lt;code&gt;P50 &amp;lt; 45.0&lt;/code&gt;), you close &lt;strong&gt;8.33%&lt;/strong&gt; of genuinely useful reference tabs. By setting a tab aside &lt;strong&gt;only when even its optimistic &lt;code&gt;P90&lt;/code&gt; upper bound falls below threshold (&lt;code&gt;P90 &amp;lt; 45.0&lt;/code&gt;)&lt;/strong&gt;, Folivora cuts the &lt;strong&gt;False-Close Rate by 23x down to &lt;code&gt;0.36%&lt;/code&gt; (&lt;code&gt;1 / 276&lt;/code&gt; useful tabs)&lt;/strong&gt; on the 720 held-out tabs while still clearing &lt;strong&gt;86.3%&lt;/strong&gt; of dead weight:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Triage Decision Policy (on 720 Unseen Tabs)&lt;/th&gt;
&lt;th&gt;Useful Reference Tabs Wrongly Closed ↓&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;False-Close Rate ↓&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;Dead Tabs Cleared ↑&lt;/th&gt;
&lt;th&gt;Total Utility Conserved ↑&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Reading-Time &amp;amp; Recency Heuristic (&lt;code&gt;score &amp;lt; 45&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;66 / 276&lt;/td&gt;
&lt;td&gt;23.91%&lt;/td&gt;
&lt;td&gt;34.9%&lt;/td&gt;
&lt;td&gt;72.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;HistGradientBoosting&lt;/code&gt; Point Triage (&lt;code&gt;P50 &amp;lt; 45&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;23 / 276&lt;/td&gt;
&lt;td&gt;8.33%&lt;/td&gt;
&lt;td&gt;95.9%&lt;/td&gt;
&lt;td&gt;57.9%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;HistGradientBoosting&lt;/code&gt; Upper-Bound Triage (&lt;code&gt;P90 &amp;lt; 45&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;13 / 276&lt;/td&gt;
&lt;td&gt;4.71%&lt;/td&gt;
&lt;td&gt;90.8%&lt;/td&gt;
&lt;td&gt;62.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;TabPFN&lt;/code&gt; Point Triage (&lt;code&gt;P50 &amp;lt; 45&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;23 / 276&lt;/td&gt;
&lt;td&gt;8.33%&lt;/td&gt;
&lt;td&gt;96.8%&lt;/td&gt;
&lt;td&gt;57.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;TabPFN&lt;/code&gt; Quantile Guardrail (&lt;code&gt;P90 &amp;lt; 45&lt;/code&gt;, Shipped)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;1 / 276&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;0.36%&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;86.3%&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;67.6%&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  2. The ablation that explained my browser habits
&lt;/h3&gt;

&lt;p&gt;Look at the fourth row in the benchmark table above: removing &lt;code&gt;intent_match_score&lt;/code&gt;—the one feature that is &lt;strong&gt;not a DOM statistic at all&lt;/strong&gt;, but a measure of how well a tab matches what you &lt;em&gt;said&lt;/em&gt; you were looking for—&lt;strong&gt;collapsed the model. MAE jumped from 3.5 to 15.4 (4.4× worse), Spearman rank correlation fell from 0.975 to 0.390, and RMSE rose by +325% (&lt;code&gt;4.31 → 18.32&lt;/code&gt;)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The single most valuable signal in the whole pipeline isn't anything the page measures—it's your ten-second voice note. That ablation is the reason Folivora is voice-first: say &lt;em&gt;"the Japan rail-pass math"&lt;/em&gt; or &lt;em&gt;"the laptop battery comparison"&lt;/em&gt; into ElevenLabs Scribe and the predictions get dramatically sharper than any passive crawling could make them.&lt;/p&gt;

&lt;p&gt;Among the DOM-only features, &lt;code&gt;code_block_count&lt;/code&gt; is the strongest (removing it degrades RMSE by &lt;strong&gt;+24.6%&lt;/strong&gt;, &lt;code&gt;4.31 → 5.37&lt;/code&gt;), while &lt;code&gt;age_days&lt;/code&gt; matters least (&lt;strong&gt;+11.1%&lt;/strong&gt;). Grouping all 3,600 tabs in the dataset by page archetype shows why:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Page Archetype (&lt;code&gt;n = 3,600&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Avg Word Count&lt;/th&gt;
&lt;th&gt;Avg Code Blocks&lt;/th&gt;
&lt;th&gt;Avg Utility Score&lt;/th&gt;
&lt;th&gt;Safe to Close After 7 Days&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Directory / Link Hub (&lt;code&gt;nav_hub&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;644 words&lt;/td&gt;
&lt;td&gt;0.1&lt;/td&gt;
&lt;td&gt;27.8 / 100&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;91.1%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Long-Form Essay (&lt;code&gt;long_essay&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4,031 words&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.3&lt;/td&gt;
&lt;td&gt;32.1 / 100&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;80.5%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tech Brief / News (&lt;code&gt;tech_brief&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;973 words&lt;/td&gt;
&lt;td&gt;4.6&lt;/td&gt;
&lt;td&gt;44.1 / 100&lt;/td&gt;
&lt;td&gt;55.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Deep Guide with Code (&lt;code&gt;deep_guide&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1,530 words&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8.6&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;48.8 / 100&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;44.6%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;91.1% of link-hub tabs and 80.5% of 4,000-word essays are safe to close after 7 days.&lt;/strong&gt; We tell ourselves we're going to read a 4,500-word essay over the weekend, and four times out of five we never do. Deep guides dense with code blocks are the opposite: they hold the highest average utility (&lt;code&gt;48.8 / 100&lt;/code&gt;) and are the &lt;em&gt;least&lt;/em&gt; safe to discard—because the only thing we ever needed from them was the 3-line snippet inside.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Browserbase Cloud Chromium over raw CDP WebSockets
&lt;/h3&gt;

&lt;p&gt;Installing a 400 MB local Chromium binary inside a small cloud container eats RAM that belongs to PyTorch and TabPFN.&lt;/p&gt;

&lt;p&gt;Instead, &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/src/browserbase_service.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/browserbase_service.py&lt;/code&gt;&lt;/a&gt; creates a remote session on &lt;strong&gt;Browserbase&lt;/strong&gt; (&lt;code&gt;POST /v1/sessions&lt;/code&gt;), fetches the DevTools WebSocket URL from &lt;code&gt;/v1/sessions/{id}/debug&lt;/code&gt;, and drives up to 16 links directly over Python's &lt;code&gt;websockets&lt;/code&gt; using Chrome DevTools Protocol (&lt;code&gt;Target.createTarget&lt;/code&gt;, &lt;code&gt;Target.attachToTarget&lt;/code&gt;, &lt;code&gt;Page.navigate&lt;/code&gt;, and &lt;code&gt;Runtime.evaluate&lt;/code&gt;). It polls &lt;code&gt;document.readyState&lt;/code&gt;, verifies the final URL is still public, reads the rendered DOM, and reuses the same section-aware extractor as the HTTP path. It returns the live &lt;code&gt;debuggerFullscreenUrl&lt;/code&gt; to the UI and always calls &lt;code&gt;REQUEST_RELEASE&lt;/code&gt; in a &lt;code&gt;finally&lt;/code&gt; block so none of the concurrency slots leak.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Gemma 4 &amp;amp; Gemma 3 write the words; &lt;code&gt;check_output()&lt;/code&gt; checks every digit
&lt;/h3&gt;

&lt;p&gt;Once TabPFN partitions the pile, Python knows the exact numbers: &lt;code&gt;total_tabs&lt;/code&gt;, &lt;code&gt;closed_count&lt;/code&gt;, &lt;code&gt;kept_count&lt;/code&gt;, and &lt;code&gt;minutes_saved&lt;/code&gt; (at 220 words per minute). Open-weight &lt;strong&gt;Google Gemma 4&lt;/strong&gt; (&lt;code&gt;gemma-4-26b-a4b-it&lt;/code&gt; with &lt;code&gt;thinkingLevel: "MINIMAL"&lt;/code&gt;) and &lt;strong&gt;Gemma 3&lt;/strong&gt; (&lt;code&gt;google/gemma-3-27b-it&lt;/code&gt;, &lt;code&gt;google/gemma-3-12b-it&lt;/code&gt;, or local Ollama &lt;code&gt;gemma3:4b&lt;/code&gt;) write a two-sentence spoken brief.&lt;/p&gt;

&lt;p&gt;In early testing, Gemma kept trying to sound "helpful" by rounding &lt;code&gt;152.9 minutes&lt;/code&gt; to &lt;code&gt;"about 150 minutes"&lt;/code&gt; or adding &lt;code&gt;"in 3 seconds"&lt;/code&gt;. So &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/src/gemma_service.py" rel="noopener noreferrer"&gt;&lt;code&gt;check_output()&lt;/code&gt;&lt;/a&gt; enforces a strict digit allowlist:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Every numeric literal (&lt;code&gt;\b\d+(?:\.\d+)?\b&lt;/code&gt;) in Gemma's reply must exist in Python's &lt;code&gt;allowed_numbers&lt;/code&gt; set.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;closed_count&lt;/code&gt;, &lt;code&gt;kept_count&lt;/code&gt;, and &lt;code&gt;minutes_saved&lt;/code&gt; must appear character-for-character.&lt;/li&gt;
&lt;li&gt;Strictly 10 to 42 words, with no markdown (&lt;code&gt;**&lt;/code&gt;) or conversational filler.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A failed draft gets &lt;strong&gt;one retry&lt;/strong&gt; that names the exact rejected token (&lt;em&gt;"Your previous draft was rejected for: unverified_or_rounded_number:150"&lt;/em&gt;). If the retry also fails, a deterministic template answers instead.&lt;/p&gt;

&lt;p&gt;I ran four prompt versions across &lt;strong&gt;60 test piles&lt;/strong&gt; (&lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/EVAL.md" rel="noopener noreferrer"&gt;full report in &lt;code&gt;eval/EVAL.md&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Prompt&lt;/th&gt;
&lt;th&gt;What Changed&lt;/th&gt;
&lt;th&gt;Passed First Try&lt;/th&gt;
&lt;th&gt;Printed (with 1 Retry)&lt;/th&gt;
&lt;th&gt;Backup Template Used&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;v1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Plain prompt&lt;/td&gt;
&lt;td&gt;32 / 60 (53.3%)&lt;/td&gt;
&lt;td&gt;53 / 60 (88.3%)&lt;/td&gt;
&lt;td&gt;7 / 60 (11.7%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;v2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;38-word cap + &lt;em&gt;"Plain text only"&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;45 / 60 (75.0%)&lt;/td&gt;
&lt;td&gt;59 / 60 (98.3%)&lt;/td&gt;
&lt;td&gt;1 / 60 (1.7%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;v3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;"Copy numbers character-for-character without rounding"&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;50 / 60 (83.3%)&lt;/td&gt;
&lt;td&gt;58 / 60 (96.7%)&lt;/td&gt;
&lt;td&gt;2 / 60 (3.3%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;v4 (Shipped)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Locked 2-sentence order + named rejected digits on retry&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;55 / 60 (91.7%)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;59 / 60 (98.3%)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1 / 60 (1.7%)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The rejections were not mysterious. Each failure mode got a named fix in code:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What Gemma Did During Testing&lt;/th&gt;
&lt;th&gt;What Fixed It in Code&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Rounded &lt;code&gt;79.6 minutes&lt;/code&gt; to &lt;em&gt;"about 80 minutes"&lt;/em&gt; to sound conversational&lt;/td&gt;
&lt;td&gt;Digit allowlist: every numeric literal must exist character-for-character in Python's &lt;code&gt;allowed_numbers&lt;/code&gt; set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wrapped the closed count in &lt;code&gt;**bold**&lt;/code&gt; and opened with &lt;em&gt;"Sure! Here is your summary:"&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;Markdown + preamble regex rejects &lt;code&gt;**&lt;/code&gt;, &lt;em&gt;"Sure,"&lt;/em&gt;, &lt;em&gt;"here is"&lt;/em&gt;, and the usual clichés&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Added &lt;em&gt;"in 3 seconds"&lt;/em&gt; and &lt;em&gt;"1-page cheat sheet"&lt;/em&gt; — digits that were never in the input facts&lt;/td&gt;
&lt;td&gt;Retry prompt names the exact rejected token (&lt;em&gt;&lt;code&gt;unverified_or_rounded_number:3&lt;/code&gt;&lt;/em&gt;); the prompt now writes &lt;em&gt;"one-page"&lt;/em&gt; in words&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Quietly dropped &lt;code&gt;kept_count&lt;/code&gt; from the second sentence&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;missing_required_fact&lt;/code&gt; triggers the one retry naming the missing number&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  5. A small model is a careless witness — so every card passes a three-stage repair shop
&lt;/h3&gt;

&lt;p&gt;A two-sentence executive brief isn't enough when you're trying to close 60 tabs without losing the technical substance inside the kept ones. Each surviving card also needs a &lt;strong&gt;35–50-word overview&lt;/strong&gt; and &lt;strong&gt;3–4 section-anchored takeaways&lt;/strong&gt; (&lt;code&gt;Heading — Key Insight&lt;/code&gt;, 30–45 words each).&lt;/p&gt;

&lt;p&gt;When I first wired live model polishing onto the cards, almost every card fell back to the static summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calling &lt;code&gt;gemma-4-26b-a4b-it&lt;/code&gt; without &lt;code&gt;"thinkingConfig": {"thinkingLevel": "MINIMAL"}&lt;/code&gt; caused the model to burn its token budget on internal reasoning thoughts before emitting spoken prose. Setting &lt;code&gt;thinkingLevel: "MINIMAL"&lt;/code&gt; cut executive-digest latency to &lt;strong&gt;~2.5 seconds&lt;/strong&gt;, and a round-robin Open-Weight pool across &lt;strong&gt;Gemma 4 26B (&lt;code&gt;gemma-4-26b-a4b-it&lt;/code&gt;)&lt;/strong&gt; and &lt;strong&gt;Gemma 3 12B (&lt;code&gt;gemma-3-12b-it&lt;/code&gt;)&lt;/strong&gt; distributes concurrent card requests without per-model rate-limit bottlenecks.&lt;/li&gt;
&lt;li&gt;On per-tab JSON rewrites, models frequently cited a valid section idea but paraphrased 1 word inside the &lt;code&gt;6–15&lt;/code&gt;-word &lt;code&gt;anchor&lt;/code&gt; substring, or wrote a 28-word bullet when the validator required 30–45 words.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of throwing away the whole card when one bullet is 2 words short, &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/src/summary_service.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/summary_service.py&lt;/code&gt;&lt;/a&gt; uses a three-stage verification and self-healing pipeline:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;_repair_draft_citations()&lt;/code&gt;:&lt;/strong&gt; Maps every takeaway to its highest token-overlap &lt;code&gt;E#&lt;/code&gt;/&lt;code&gt;C#&lt;/code&gt; evidence block and extracts an exact &lt;code&gt;8&lt;/code&gt;-word contiguous substring anchor directly from the source evidence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;validate_tab_summary()&lt;/code&gt; (&lt;code&gt;tab-summary-validation-v3&lt;/code&gt;):&lt;/strong&gt; Rejects emojis, quote-only bullets, first-person diary narration, cross-view duplication (&lt;code&gt;Jaccard &amp;gt;= 0.68&lt;/code&gt;), invented numbers/units, and verbatim evidence copying (&lt;code&gt;&amp;gt;=90%&lt;/code&gt; token containment).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;_repair_bullets()&lt;/code&gt;:&lt;/strong&gt; If a draft fails only on bullet-level rules (e.g., &lt;code&gt;takeaway_1_word_count:28&lt;/code&gt; or &lt;code&gt;takeaway_3_verbatim_copy&lt;/code&gt;), Folivora rewrites &lt;em&gt;only&lt;/em&gt; the offending bullet at &lt;code&gt;temperature=0.1&lt;/code&gt; and re-validates—polishing &lt;strong&gt;8 / 8 top cards in ~10-16 s&lt;/strong&gt; via &lt;code&gt;gemini-3.1-flash-lite&lt;/code&gt; (provider-load dependent; I measured 14.4 s for a full 8-card batch) while keeping all &lt;strong&gt;11 quality gates green&lt;/strong&gt; in &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/summary_quality.py" rel="noopener noreferrer"&gt;&lt;code&gt;eval/summary_quality.py&lt;/code&gt;&lt;/a&gt; (&lt;code&gt;20 / 20&lt;/code&gt; golden cases, &lt;code&gt;mean 4.65 / 5.0&lt;/code&gt; manual readability):&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Quality Gate (&lt;code&gt;python eval/summary_quality.py --gate&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Requirement&lt;/th&gt;
&lt;th&gt;Measured Result (&lt;code&gt;n = 20&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;no_unsupported_numbers&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; invented or rounded digits/units&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;0&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;PASS&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;no_quote_only_bullets&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; raw dialogue/quote-only bullets&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;0&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;PASS&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;no_verbatim_copy&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; bullets copying &lt;code&gt;&amp;gt;=90%&lt;/code&gt; of an evidence block&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;0&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;PASS&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;no_emoji&lt;/code&gt; &amp;amp; &lt;code&gt;no_forbidden_claims&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; emojis or cross-page claim contamination&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;0&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;PASS&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;duplicate_rate_below_5pct&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;&amp;lt; 5.0%&lt;/code&gt; near-duplicate takeaway pairs (&lt;code&gt;Jaccard &amp;gt;= 0.68&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;0.0%&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;PASS&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;fact_coverage_at_least_85pct&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;&amp;gt;= 85.0%&lt;/code&gt; required technical facts preserved&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;100.0%&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;PASS&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;word_target&lt;/code&gt; &amp;amp; &lt;code&gt;manual_review&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;&amp;gt;= 18 / 20&lt;/code&gt; within &lt;code&gt;140–220&lt;/code&gt; words &amp;amp; &lt;code&gt;&amp;gt;= 4.0 / 5.0&lt;/code&gt; readability&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;20 / 20&lt;/code&gt; (&lt;code&gt;mean 4.65 / 5.0&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;PASS&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Because every web page inspected by a browser agent is untrusted input, I also built a &lt;strong&gt;24-case Adversarial Prompt-Injection &amp;amp; Canary Red-Team Suite&lt;/strong&gt; (&lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/redteam_eval.py" rel="noopener noreferrer"&gt;&lt;code&gt;eval/redteam_eval.py&lt;/code&gt;&lt;/a&gt;) across 8 threat families (&lt;code&gt;T1&lt;/code&gt; score hijacking, &lt;code&gt;T2&lt;/code&gt; hallucinated metrics/units, &lt;code&gt;T3&lt;/code&gt; spoofed &lt;code&gt;E#&lt;/code&gt;/&lt;code&gt;C#&lt;/code&gt; anchors, &lt;code&gt;T4&lt;/code&gt; markdown/jailbreak preambles, &lt;code&gt;T5&lt;/code&gt; first-person/emoji hijacks, &lt;code&gt;T6&lt;/code&gt; verbatim evidence copying, &lt;code&gt;T7&lt;/code&gt; raw dialogue dumps, and &lt;code&gt;T8&lt;/code&gt; private body/&lt;code&gt;CANARY-FOLIVORA-9941-SECRET&lt;/code&gt; exfiltration):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pipeline Configuration (&lt;code&gt;eval/redteam_eval.py&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Hijacked Outputs (&lt;code&gt;n = 24&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Attack Success Rate (ASR) ↓&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;Canary Secret Leaks ↓&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Naive Unvalidated LLM Summarizer&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;24 / 24&lt;/td&gt;
&lt;td&gt;100.0%&lt;/td&gt;
&lt;td&gt;3 / 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;JSON-Schema-Only (&lt;code&gt;_TabSummaryDraft&lt;/code&gt; Pydantic Validation)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;21 / 24&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;87.5%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0 / 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Folivora Hardened (&lt;code&gt;check_output()&lt;/code&gt; + &lt;code&gt;validate_tab_summary()&lt;/code&gt; v3 + Allowlist + Scrubber)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0 / 24&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;0.0%&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;0 / 3&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Look at the second row: &lt;strong&gt;&lt;code&gt;responseMimeType: "application/json"&lt;/code&gt; plus Pydantic schema validation still let 21 of 24 attacks (&lt;code&gt;87.5%&lt;/code&gt;) straight through&lt;/strong&gt;, because JSON schemas constrain syntax, not semantics, grounding, or verbatim copying. Only deterministic post-generation verification drops the Attack Success Rate to &lt;strong&gt;0.0%&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Sentry Agent Tracing: and the two bugs my traces caught
&lt;/h3&gt;

&lt;p&gt;Every Browserbase session, TabPFN quantile pass, Scribe transcription, and Gemma/Gemini call runs inside an OpenTelemetry &lt;code&gt;op="gen_ai.request"&lt;/code&gt; or &lt;code&gt;summary.*&lt;/code&gt; span in &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/src/telemetry.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/telemetry.py&lt;/code&gt;&lt;/a&gt;, recording model IDs, input/output tokens, tokens/sec, latency, and estimated cost.&lt;/p&gt;

&lt;p&gt;Two real bugs showed up during testing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;float('inf')&lt;/code&gt; word-count crash Caught by Sentry:&lt;/strong&gt; When a malformed page reported an infinite numeric value, &lt;code&gt;_sanitize_num()&lt;/code&gt; cleaned the NumPy feature matrix for TabPFN, but left the raw &lt;code&gt;inf&lt;/code&gt; inside the tab dictionary—crashing &lt;code&gt;sum(int(t["word_count"]))&lt;/code&gt; with &lt;code&gt;OverflowError: cannot convert float infinity to integer&lt;/code&gt;. Writing the sanitized integers back into the enriched tab dict fixed it, verified by &lt;code&gt;test_handles_nan_and_inf_gracefully&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preserving &lt;code&gt;gen_ai.usage.input_tokens&lt;/code&gt; in &lt;code&gt;before_send&lt;/code&gt;:&lt;/strong&gt; A naive secret scrubber that redacts any key containing &lt;code&gt;"token"&lt;/code&gt; (&lt;code&gt;api_token&lt;/code&gt;, &lt;code&gt;access_token&lt;/code&gt;, &lt;code&gt;tabpfn_token&lt;/code&gt;) also blanks out &lt;code&gt;gen_ai.usage.input_tokens&lt;/code&gt; and &lt;code&gt;gen_ai.usage.output_tokens&lt;/code&gt;. Using the negative-lookbehind/lookahead regex &lt;code&gt;(?&amp;lt;!put_)token(?!s)&lt;/code&gt; in &lt;code&gt;SECRET_KEY_PATTERN&lt;/code&gt; kept all secrets redacted (&lt;code&gt;[Redacted]&lt;/code&gt;) while leaving OpenTelemetry token counts intact:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# src/telemetry.py — Scrub auth tokens while preserving gen_ai.usage.input_tokens / output_tokens
&lt;/span&gt;&lt;span class="n"&gt;SECRET_KEY_PATTERN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sa"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;(api[_-]?key|secret|password|authorization|bearer|(?&amp;lt;!put_)token(?!s)|dsn)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IGNORECASE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  7. Two deployment lessons: TabPFN v2 open weights &amp;amp; CPU threads on Render
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Why TabPFN v2 is the default on headless servers:&lt;/strong&gt; &lt;code&gt;tabpfn&lt;/code&gt; v9.1.0 defaults to &lt;code&gt;ModelVersion.V3_5&lt;/code&gt;, which sits behind an interactive license check that can hang non-interactive container workers if not cached. Calling &lt;code&gt;TabPFNRegressor.create_default_for_version(ModelVersion.V2, device="cpu", n_estimators=4)&lt;/code&gt; uses Prior Labs' fully open weights with zero interactive prompts (while keeping &lt;code&gt;TABPFN_MODEL_VERSION=v3.5&lt;/code&gt; one environment variable away) and runs warm quantile inference for 14 tabs in &lt;strong&gt;~1.3 s&lt;/strong&gt; on a laptop CPU (the shared 2-vCPU container takes a few seconds, which is exactly why the deterministic fast lane runs &lt;em&gt;ahead&lt;/em&gt; of the AI lanes and identical preset requests are served from a 10-minute TTL cache in under 30 ms).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Thread pool capping (&lt;code&gt;OMP_NUM_THREADS=2&lt;/code&gt;):&lt;/strong&gt; On shared cloud hosts, PyTorch sizes its thread pool from the host machine's physical cores rather than the container's slice. Pinning &lt;code&gt;OMP_NUM_THREADS=2&lt;/code&gt; and pre-baking the weights in the &lt;code&gt;Dockerfile&lt;/code&gt; keeps container startup and inference latency flat on Render.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Honest Limits (What It Can't Do Yet)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Intent-hungry predictions:&lt;/strong&gt; The ablation above cuts both ways—without a spoken or typed intent, &lt;code&gt;intent_match_score&lt;/code&gt; is near zero for every tab and triage accuracy falls back toward DOM-only quality (MAE &lt;code&gt;15.4&lt;/code&gt;). That is exactly why &lt;strong&gt;Summarize All&lt;/strong&gt; mode deliberately keeps &lt;em&gt;every&lt;/em&gt; readable tab instead of guessing, and why the mic button sits next to the topic chips.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auth-walled tabs (detected, not guessed):&lt;/strong&gt; Browserbase can inspect any public documentation, GitHub issue, or blog post, but sites like Facebook, YouTube, LinkedIn, or Cloudflare-challenged pages serve a cookie-less fetcher a wall instead of the article — a login screen, Google's consent page, a bot check, or a bare JavaScript shell with no readable text at all. Folivora detects all four (wall phrases, or a plain-HTTP response with under 120 raw words), labels the tab &lt;code&gt;Login-walled&lt;/code&gt;/&lt;code&gt;Unreadable page&lt;/code&gt; with an honest note instead of summarizing the wall, and forces it to stay open with maximum-uncertainty quantiles (&lt;code&gt;P10/P50/P90 = 20/50/99&lt;/code&gt;) — the same asymmetric-safety rule as the &lt;code&gt;P90&lt;/code&gt; guardrail: never auto-close a page the server couldn't actually read. Your logged-in browser still shows the real page; only the server was blind. Tabs behind your personal company SSO get the same honest label.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swapped counts inside the allowed set:&lt;/strong&gt; As documented in &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/REVIEW.md" rel="noopener noreferrer"&gt;&lt;code&gt;eval/REVIEW.md&lt;/code&gt;&lt;/a&gt;, if &lt;code&gt;kept_count&lt;/code&gt; is &lt;code&gt;5&lt;/code&gt; and &lt;code&gt;closed_count&lt;/code&gt; is &lt;code&gt;9&lt;/code&gt;, both &lt;code&gt;'5'&lt;/code&gt; and &lt;code&gt;'9'&lt;/code&gt; are in &lt;code&gt;allowed_numbers&lt;/code&gt;. A set-based digit check can't tell if a model swapped which was which, so the UI renders the primary counters directly from Python's JSON response rather than parsing Gemma's prose.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Every decision in this pipeline is made by an open-weight model.&lt;/strong&gt; TabPFN v2 (open weights, CPU, local inference) decides which tabs are safe to set aside, and open-weight Gemma 4 26B (with Gemma 3 27B/12B and local &lt;code&gt;gemma3:4b&lt;/code&gt; as fallback lanes) writes the spoken brief behind &lt;code&gt;check_output()&lt;/code&gt; — the digest lane contains no closed model at all. The one closed model in the stack, Gemini Flash Lite, is a &lt;em&gt;speed-only&lt;/em&gt; fallback for card prose: each card tries the open-weight lanes first (Ollama → Gemma 4 → Gemma 3), Gemini only answers when an open lane blows the responsive-UI budget, its output passes the same deterministic &lt;code&gt;validate_tab_summary()&lt;/code&gt; gate, and setting &lt;code&gt;SUMMARY_POLISH_PROVIDER=gemma&lt;/code&gt; (or running without a Google key) removes it entirely — the app degrades to local Ollama or deterministic cards, never breaks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your browsing backlog is private.&lt;/strong&gt; The tabs sitting open in your browser reveal what you're working on, what bugs you're stuck on, and what you read at night. Because &lt;strong&gt;TabPFN&lt;/strong&gt; and &lt;strong&gt;Gemma&lt;/strong&gt; are open-weight models, you can point &lt;code&gt;OLLAMA_BASE_URL&lt;/code&gt; at a local Ollama instance (&lt;code&gt;gemma3:4b&lt;/code&gt;) and score and summarize your tabs with your data staying under your control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inspectable calibration.&lt;/strong&gt; When an automation tells you it's safe to set aside 36 tabs, a black-box score isn't enough. With open weights and &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/benchmarks/ablate.py" rel="noopener noreferrer"&gt;&lt;code&gt;benchmarks/ablate.py&lt;/code&gt;&lt;/a&gt;, anyone can verify on 720 unseen tabs that TabPFN's 80% interval actually covers &lt;strong&gt;77.9%&lt;/strong&gt; of real cases and achieves a &lt;strong&gt;0.36%&lt;/strong&gt; False-Close Rate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set it up once, $0 recurring subscription.&lt;/strong&gt; A weekly tab cleanup tool shouldn't cost $20/month in proprietary token bills.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Lazy Payoff
&lt;/h2&gt;

&lt;p&gt;I ran &lt;strong&gt;Folivora&lt;/strong&gt; on my own two real browser windows this week — an everyday 14-tab window and a 10-tab work window (&lt;strong&gt;24 open tabs, 61,020 words&lt;/strong&gt; total). Neither was an extreme hoard; that's the point. Twenty-four ordinary "I'll read it tonight" tabs:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Doing It By Hand&lt;/th&gt;
&lt;th&gt;With Folivora&lt;/th&gt;
&lt;th&gt;Effort Saved&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tabs inspected across both windows&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;24 open tabs (61,020 words)&lt;/td&gt;
&lt;td&gt;24 open tabs&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tabs safely set aside (&lt;code&gt;&amp;lt; P90&lt;/code&gt; bound)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0 (kept procrastinating)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;15 dead essay/directory tabs set aside (52,370 words)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;238.0 minutes of reading skipped&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Key takeaways extracted&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Reading 9 pages in full and copy-pasting notes (~28 mins)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;9 section-anchored takeaway sets in a printable digest&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1 click + 1 eight-second voice note&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of TabPFN:&lt;/strong&gt; Prior Labs' TabPFN predicts calibrated &lt;code&gt;P10 / P50 / P90&lt;/code&gt; utility quantiles for every tab (&lt;code&gt;src/tabpfn_engine.py&lt;/code&gt;). Backtested on 720 unseen tabs from a 3,600-row dataset (&lt;code&gt;benchmarks/ablate.py&lt;/code&gt;), beating the reading-time heuristic (&lt;code&gt;MAE 3.5 vs 21.88&lt;/code&gt;, and the heuristic's Spearman &lt;code&gt;0.033&lt;/code&gt; means it ranks tabs no better than chance), beating &lt;code&gt;HistGradientBoosting&lt;/code&gt; on both error (&lt;code&gt;3.5 vs 3.95&lt;/code&gt;) and &lt;code&gt;P10–P90&lt;/code&gt; uncertainty calibration (&lt;strong&gt;77.9% vs 55.3%&lt;/strong&gt;), with a feature ablation showing the stated-intent signal is load-bearing (removing it: MAE &lt;code&gt;3.5 → 15.4&lt;/code&gt;), and cutting the &lt;strong&gt;False-Close Rate by 23x (&lt;code&gt;8.33% → 0.36%&lt;/code&gt;)&lt;/strong&gt; via the &lt;code&gt;P90 &amp;lt; 45.0&lt;/code&gt; quantile guardrail.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Browserbase:&lt;/strong&gt; &lt;code&gt;src/browserbase_service.py&lt;/code&gt; creates live cloud Chromium sessions on Browserbase (&lt;code&gt;POST /v1/sessions&lt;/code&gt;), connects over CDP WebSockets to extract real rendered-DOM metrics for up to 16 links (&lt;code&gt;word_count&lt;/code&gt;, &lt;code&gt;code_block_count&lt;/code&gt;, &lt;code&gt;table_count&lt;/code&gt;, &lt;code&gt;heading_count&lt;/code&gt;, and section-anchored takeaways), falls back per link on CDP failure, surfaces the live &lt;code&gt;debuggerFullscreenUrl&lt;/code&gt; in the UI, and releases every session slot cleanly (&lt;code&gt;REQUEST_RELEASE&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Gemma:&lt;/strong&gt; Open-weight &lt;strong&gt;Google Gemma 4 (&lt;code&gt;gemma-4-26b-a4b-it&lt;/code&gt; with &lt;code&gt;thinkingLevel: MINIMAL&lt;/code&gt;)&lt;/strong&gt; and a round-robin &lt;strong&gt;Gemma 4 26B + Gemma 3 12B/27B/4B pool&lt;/strong&gt; (&lt;code&gt;src/gemma_service.py&lt;/code&gt;) power the two-sentence spoken digest behind &lt;code&gt;check_output()&lt;/code&gt; (&lt;strong&gt;59 / 60 [98.3%]&lt;/strong&gt; verified in &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/EVAL.md" rel="noopener noreferrer"&gt;&lt;code&gt;eval/EVAL.md&lt;/code&gt;&lt;/a&gt; &amp;amp; &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/REVIEW.md" rel="noopener noreferrer"&gt;&lt;code&gt;eval/REVIEW.md&lt;/code&gt;&lt;/a&gt;) and the grounded card-polish pipeline (&lt;strong&gt;20 / 20&lt;/strong&gt; golden cases in &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/summary_quality.py" rel="noopener noreferrer"&gt;&lt;code&gt;eval/summary_quality.py&lt;/code&gt;&lt;/a&gt; and &lt;strong&gt;0.0% ASR&lt;/strong&gt; across 24 adversarial attacks in &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/eval/redteam_eval.py" rel="noopener noreferrer"&gt;&lt;code&gt;eval/redteam_eval.py&lt;/code&gt;&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of ElevenLabs:&lt;/strong&gt; Bidirectional voice workflow in &lt;code&gt;src/audio_service.py&lt;/code&gt;—&lt;strong&gt;ElevenLabs Scribe (&lt;code&gt;scribe_v1&lt;/code&gt;)&lt;/strong&gt; transcribes spoken filter rules and immediately deletes the remote transcript (&lt;code&gt;DELETE /v1/speech-to-text/transcripts/{id}&lt;/code&gt;) for privacy, while &lt;strong&gt;ElevenLabs Flash v2.5 (&lt;code&gt;eleven_flash_v2_5&lt;/code&gt;, Charlie voice)&lt;/strong&gt; reads the verified two-sentence brief aloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Sentry Agent Tracing:&lt;/strong&gt; Every Browserbase CDP run, TabPFN quantile prediction, Scribe transcription, and Gemma/Gemini call is wrapped in an OpenTelemetry &lt;code&gt;op="gen_ai.request"&lt;/code&gt; or &lt;code&gt;summary.*&lt;/code&gt; span (&lt;code&gt;src/telemetry.py&lt;/code&gt;) with token counts, throughput, and cost, backed by unit-tested regex scrubbing (&lt;code&gt;(?&amp;lt;!put_)token(?!s)&lt;/code&gt;) that preserves &lt;code&gt;gen_ai.usage.input_tokens&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Render:&lt;/strong&gt; Deployed at &lt;strong&gt;&lt;a href="https://folivora.tech" rel="noopener noreferrer"&gt;https://folivora.tech&lt;/a&gt;&lt;/strong&gt; via a declarative &lt;a href="https://github.com/OmarAfifi-CSE/folivora/blob/main/render.yaml" rel="noopener noreferrer"&gt;&lt;code&gt;render.yaml&lt;/code&gt;&lt;/a&gt; Blueprint and &lt;code&gt;Dockerfile&lt;/code&gt; with pre-baked TabPFN weights, &lt;code&gt;/health&lt;/code&gt; readiness probes, &lt;code&gt;OMP_NUM_THREADS=2&lt;/code&gt; CPU thread tuning, and per-IP sliding-window limits on the expensive &lt;code&gt;/triage&lt;/code&gt;, &lt;code&gt;/polish-tabs&lt;/code&gt;, &lt;code&gt;/digest&lt;/code&gt;, &lt;code&gt;/transcribe-voice&lt;/code&gt;, and &lt;code&gt;/synthesize-audio&lt;/code&gt; routes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of a &lt;code&gt;.tech&lt;/code&gt; Domain:&lt;/strong&gt; The entire product lives at &lt;strong&gt;&lt;a href="https://folivora.tech" rel="noopener noreferrer"&gt;folivora.tech&lt;/a&gt;&lt;/strong&gt;—and the name &lt;em&gt;is&lt;/em&gt; the theme: &lt;em&gt;Folivora&lt;/em&gt; is the taxonomic suborder of tree sloths, so the domain had to be the sloth's own name. Mapped to the Render Blueprint with automatic SSL, it's the one URL in this post that does everything: triage, live Browserbase sessions, voice, the pitch deck, OpenAPI docs, and the extension download.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try It on Your Own Tabs
&lt;/h2&gt;

&lt;p&gt;Don't take my word for it — &lt;strong&gt;&lt;a href="https://folivora.tech" rel="noopener noreferrer"&gt;folivora.tech&lt;/a&gt;&lt;/strong&gt; is open, no sign-up. Paste a few links you've been "meaning to read," or launch a built-in sample window, and get your own two-line briefing before your coffee cools.&lt;/p&gt;

&lt;p&gt;Everything is MIT-licensed at &lt;strong&gt;&lt;a href="https://github.com/OmarAfifi-CSE/folivora" rel="noopener noreferrer"&gt;github.com/OmarAfifi-CSE/folivora&lt;/a&gt;&lt;/strong&gt; — if the sloth mishandles one of your pages, that's exactly what the issue tracker is for. 🦥&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>ai</category>
      <category>mlhacks</category>
    </item>
    <item>
      <title>SunSync: How I Used TabPFN, Google Gemma, and ElevenLabs to Help Developers Touch Grass</title>
      <dc:creator>Omar Afifi</dc:creator>
      <pubDate>Sun, 11 Oct 2026 20:33:46 +0000</pubDate>
      <link>https://dev.to/omarafifi/sunsync-how-i-used-tabpfn-google-gemma-and-elevenlabs-to-help-developers-touch-grass-4i37</link>
      <guid>https://dev.to/omarafifi/sunsync-how-i-used-tabpfn-google-gemma-and-elevenlabs-to-help-developers-touch-grass-4i37</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week1-2026-10-05"&gt;Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Most software developers spend their working days indoors under artificial lighting, locked to an IDE, staring at screens for hours on end.&lt;/p&gt;

&lt;p&gt;By mid-afternoon, the consequences are familiar across the tech community: eye strain, brain fog, fading focus, and a disrupted circadian rhythm that makes quality sleep an uphill battle. For years, I treated this as simply the unavoidable occupational hazard of writing code.&lt;/p&gt;

&lt;p&gt;The real issue isn't a lack of discipline or coffee—it's that standard indoor work environments fight against basic human biology.&lt;/p&gt;

&lt;p&gt;The human body relies on natural daylight to set its internal circadian clock. But standard office windows filter out the specific daylight wavelengths needed to feel alert. Even sitting right next to a window, indoor lighting is rarely brighter than 400–500 lux—compared to 10,000+ lux outdoors. To the body, sitting inside all day feels like constant twilight, draining energy and throwing off sleep.&lt;/p&gt;

&lt;p&gt;And the tech industry's standard answer to developer burnout? &lt;strong&gt;Another screen.&lt;/strong&gt; Wellness apps that demand more typing, habit trackers with endless push notifications, and weather apps that treat sunlight purely as a sunburn hazard.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;&lt;a href="https://sunsync.omar-afifi.com/" rel="noopener noreferrer"&gt;SunSync&lt;/a&gt;&lt;/strong&gt; as a direct alternative.&lt;/p&gt;

&lt;p&gt;SunSync is a lightweight open-source daylight timing tool built with a single goal: &lt;strong&gt;evaluate local sunlight in under 30 seconds, give you a quick 15-second eyes-free voice brief, lock into a 20-minute outdoor breathing timer, and get you away from your desk into the fresh air.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works in Practice
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero-Shot Tabular ML on CPU (Prior Labs TabPFN):&lt;/strong&gt; Instead of naive heuristics, a foundation tabular transformer (&lt;code&gt;TabPFNRegressor&lt;/code&gt;) fits 12 daylight hours in a single forward pass without gradient descent, evaluating solar angles, cloud cover, and irradiance to compute your best 20-minute sunlight window (e.g., &lt;code&gt;13:15 - 13:35&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Eyes-Free Spoken Directive (Google Gemma + ElevenLabs):&lt;/strong&gt; A 15-second spoken briefing delivers the key window and UV safety tips using ElevenLabs' low-latency &lt;code&gt;eleven_flash_v2_5&lt;/code&gt; model and the natural, calm Charlie voice—turning raw telemetry into a human send-off so you don't have to keep reading a screen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production Grounding for Safe Health Guidance:&lt;/strong&gt; Gemma crafts natural, encouraging dialogue, while a deterministic validation layer guarantees that safety-critical numbers (the computed window start and UV index) remain strictly grounded to the underlying physics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Outdoor Breathing Lock:&lt;/strong&gt; When you tap &lt;em&gt;"I'm going outside"&lt;/em&gt;, the UI locks into a 20-minute circular breathing timer so you can put your phone away. You focus on the horizon (never staring directly at the sun) and return to your desk refreshed and ready to code.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The app is live, publicly accessible, and deployed on Google Cloud Run with interactive OpenAPI documentation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🌐 &lt;strong&gt;Live Web Application:&lt;/strong&gt; &lt;a href="https://sunsync.omar-afifi.com" rel="noopener noreferrer"&gt;https://sunsync.omar-afifi.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📡 &lt;strong&gt;Interactive OpenAPI Specification:&lt;/strong&gt; &lt;a href="https://sunsync.omar-afifi.com/docs" rel="noopener noreferrer"&gt;https://sunsync.omar-afifi.com/docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;💻 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/OmarAfifi-CSE/sunsync" rel="noopener noreferrer"&gt;https://github.com/OmarAfifi-CSE/sunsync&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Mobile-First Interface Tour (Zero Mockups)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table width="100%"&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th width="25%"&gt;☀️ 01 · Hero Protocol&lt;/th&gt;
      &lt;th width="25%"&gt;⏱️ 02 · 20-Min Sun Window&lt;/th&gt;
      &lt;th width="25%"&gt;🎙️ 03 · Gemma Spoken Brief&lt;/th&gt;
      &lt;th width="25%"&gt;🌿 04 · Touch Grass Protocol&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td width="25%"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FOmarAfifi-CSE%2Fsunsync%2Fmain%2Fdocs%2Fscreenshots%2Fmobile-hero.jpg" width="800" alt="SunSync Mobile Hero Dashboard" height="1759"&gt;
      &lt;/td&gt;
      &lt;td width="25%"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FOmarAfifi-CSE%2Fsunsync%2Fmain%2Fdocs%2Fscreenshots%2Fmobile-glance-window.jpg" width="800" alt="SunSync Mobile 20-Minute Solar Window" height="1759"&gt;
      &lt;/td&gt;
      &lt;td width="25%"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FOmarAfifi-CSE%2Fsunsync%2Fmain%2Fdocs%2Fscreenshots%2Fmobile-gemma-voice-brief.jpg" width="800" alt="SunSync Mobile Gemma Spoken Brief" height="1759"&gt;
      &lt;/td&gt;
      &lt;td width="25%"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FOmarAfifi-CSE%2Fsunsync%2Fmain%2Fdocs%2Fscreenshots%2Fmobile-touch-grass-protocol.jpg" width="800" alt="SunSync Mobile Touch Grass Protocol" height="1759"&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td width="25%"&gt;
        &lt;em&gt;Glance card: today's window, live countdown, recharge score — the 10-second answer.&lt;/em&gt;
      &lt;/td&gt;
      &lt;td width="25%"&gt;
        &lt;em&gt;Decision card (&lt;b&gt;GO NOW / Wait / Done&lt;/b&gt;) + UV safety bands + daylight curve to 6 PM.&lt;/em&gt;
      &lt;/td&gt;
      &lt;td width="25%"&gt;
        &lt;em&gt;Fact-verified Gemma directive with source badge (✦ Gemma live / ⚡ edge instant) + Charlie voice playback.&lt;/em&gt;
      &lt;/td&gt;
      &lt;td width="25%"&gt;
        &lt;em&gt;The outdoor commitment card: 20-minute breathing timer + auto-playing voice send-off, phone face-down.&lt;/em&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Every screenshot above is a raw capture from my live production deployment on Google Cloud Run - zero synthetic device frames, zero mockups.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What to Look for When Testing
&lt;/h3&gt;

&lt;p&gt;The app dynamically adapts to whatever time of day you test it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test Your Location or City Presets:&lt;/strong&gt; Tap &lt;strong&gt;Use my location&lt;/strong&gt; or switch between presets (Cairo, London, New York, Tokyo). SunSync calculates the solar window relative to that location's local solar clock, not your computer's clock.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Real-Time States:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Upcoming Window (&lt;code&gt;Wait&lt;/code&gt;):&lt;/strong&gt; If it's daytime before the computed peak, you'll see a live countdown ticking down to the recharge window.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Active Window (&lt;code&gt;GO NOW&lt;/code&gt;):&lt;/strong&gt; If you test during the peak window, the status badge flips to &lt;code&gt;GO NOW&lt;/code&gt; with live UV guidance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Past Window (&lt;code&gt;Done today&lt;/code&gt;):&lt;/strong&gt; If the sun has set or the peak has already passed in that city, the card displays &lt;code&gt;Done today&lt;/code&gt; and advises morning light tomorrow—it will never tell someone to go recharge under a dark night sky.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Listen to Charlie (Voice Briefing):&lt;/strong&gt; Tap &lt;strong&gt;Listen · 15s brief&lt;/strong&gt; on any location to hear the lifelike ElevenLabs voice briefing with real-time UV safety tips.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The entire codebase is open-source, fully tested, and available on GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;💻 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/OmarAfifi-CSE/sunsync" rel="noopener noreferrer"&gt;https://github.com/OmarAfifi-CSE/sunsync&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The project is structured around lean, modular Python services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;src/circadian_ml.py&lt;/code&gt;: Prior Labs TabPFN zero-shot Bayesian tabular regression on live CPU.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/gemma_service.py&lt;/code&gt;: Google Gemma integration paired with deterministic factual grounding (&lt;code&gt;validate_directive()&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/audio_service.py&lt;/code&gt;: ElevenLabs low-latency voice synthesis via &lt;code&gt;eleven_flash_v2_5&lt;/code&gt; (Charlie voice).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/data_service.py&lt;/code&gt;: Ingests real-time Open-Meteo weather data (solar irradiance, UV index, cloud cover, and sun angles) to feed into TabPFN.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/app.py&lt;/code&gt;: FastAPI application instrumented with distributed Sentry tracing spans. &lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. System Architecture &amp;amp; Dual-Lane Decoupling
&lt;/h3&gt;

&lt;p&gt;I enforced a strict architectural principle: &lt;strong&gt;The user's first paint must never wait on generative AI.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                ┌─────────────────────────────┐
                │  Live Open-Meteo Telemetry  │
                │(Hourly UV, Solar Irradiance)│
                └──────────────┬──────────────┘
                               │
                               ▼
                ┌─────────────────────────────┐
                │   Feature Vector Assembly   │
                │  (12-Hour Daylight Context) │
                └──────────────┬──────────────┘
                               │
                               ▼
[Sentry Spans]  ┌─────────────────────────────┐
(Distributed) ─►│  Prior Labs TabPFN ML Core  │
(Latency Trace) │ (Zero-Shot Bayesian CPU ML) │
                └──────────────┬──────────────┘
                               │
                               ▼
                ┌─────────────────────────────┐ ◄── [Grounding Layer]
                │ Google Gemma Directive Core │     (Factual Verify:
                │ (Natural Spoken Directive)  │      Window &amp;amp; UV)
                └──────────────┬──────────────┘
                               │
                               ▼
[Google Cloud]  ┌─────────────────────────────┐
(Cloud Run)   ─►│ ElevenLabs Audio Synthesis │
(Public Host)   │ (Lifelike Charlie Briefing) │
                └─────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I decoupled the execution into two asynchronous paths:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Fast Lane (&lt;code&gt;/evaluate&lt;/code&gt;):&lt;/strong&gt; Computes solar geometry, atmospheric vector transforms, and TabPFN scoring. Returns the deterministic solar window and recharge score immediately with an instant analytical draft.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Slow Upgrade Lane (&lt;code&gt;/directive&lt;/code&gt; &amp;amp; &lt;code&gt;/synthesize-audio&lt;/code&gt;):&lt;/strong&gt; Asynchronously generates the personalized Google Gemma voice directive and ElevenLabs audio stream, upgrading the UI quote in place without blocking interaction.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. Prior Labs TabPFN: Foundation Tabular ML on CPU
&lt;/h3&gt;

&lt;p&gt;In &lt;code&gt;src/circadian_ml.py&lt;/code&gt;, I run the &lt;strong&gt;real&lt;/strong&gt; &lt;code&gt;TabPFNRegressor&lt;/code&gt; on live CPU. My training context is exactly &lt;strong&gt;12 rows&lt;/strong&gt;—the daylight operational hours of a single day (7 AM to 6 PM).&lt;/p&gt;

&lt;p&gt;Classical ML algorithms like XGBoost or RandomForest fail here: they demand hundreds of rows, hyperparameter tuning, and cross-validation splits that don't exist in single-day telemetry. TabPFN is a prior-fitted transformer trained on millions of synthetic tabular tasks that performs Bayesian posterior inference in a single forward pass without gradient descent:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric / Verification Check&lt;/th&gt;
&lt;th&gt;Production Measured Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Peak window reproducibility across consecutive runs&lt;/td&gt;
&lt;td&gt;✅ Identical time window every run (deterministic)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Score variance across repeated runs&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.00&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Window stability under seeded ±5% sensor noise&lt;/td&gt;
&lt;td&gt;✅ Resilient &amp;amp; stable (score Δ 2.6)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Warm inference execution on multi-core CPU&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~1.1–1.5 s&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Container cold initialization (one-time weight loading)&lt;/td&gt;
&lt;td&gt;~15–17 s (isolated to container cold boot; never blocks warm traffic)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# From src/circadian_ml.py
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tabpfn&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TabPFNRegressor&lt;/span&gt;

&lt;span class="c1"&gt;# 12 daylight rows. No gradient descent: forward pass stores tabular context
&lt;/span&gt;&lt;span class="n"&gt;regressor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TabPFNRegressor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_estimators&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;regressor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train_atmospheric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_melanopic_target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;predicted_eml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;regressor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train_atmospheric&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With only 12 hourly data points per day, traditional ML models fall apart. TabPFN is built specifically for this: delivering accurate Bayesian predictions on small tabular data in under a second without overfitting or requiring hours of hyperparameter tuning.&lt;/p&gt;

&lt;p&gt;To deploy SunSync cleanly in production, I packaged the application into an optimized container running on &lt;strong&gt;Google Cloud Run&lt;/strong&gt; with 4 vCPUs and 4 GB RAM in &lt;code&gt;europe-west1&lt;/code&gt;. Within the container runtime, I tuned PyTorch's intra-op parallelism (&lt;code&gt;torch.set_num_threads(min(4, os.cpu_count()))&lt;/code&gt;) and configured &lt;code&gt;TabPFNRegressor(n_estimators=4)&lt;/code&gt;. This unlocks multi-core execution on the tabular transformer while preventing thread thrashing, keeping memory rock-solid and delivering consistent sub-1.5s inference on warm instances.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Sentry Distributed Agent Tracing: Real Production Telemetry Bands
&lt;/h3&gt;

&lt;p&gt;I instrumented the entire pipeline with distributed Sentry tracing spans (&lt;code&gt;ai.telemetry.ingest&lt;/code&gt;, &lt;code&gt;ai.model.tabpfn&lt;/code&gt;, and &lt;code&gt;ai.llm.gemma&lt;/code&gt;) to monitor live production performance, diagnose latency variances, and ensure pipeline health.&lt;/p&gt;

&lt;p&gt;Rather than publishing synthetic local benchmarks, Sentry reveals the authentic behavior across live cloud conditions on Google Cloud Run:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Span Name&lt;/th&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Warm Production Range&lt;/th&gt;
&lt;th&gt;Production Lifecycle Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ai.telemetry.ingest&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Open-Meteo REST Fetch &amp;amp; Serialization&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;70–300 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Live upstream solar telemetry fetch (varies with DNS &amp;amp; regional latency)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ai.model.tabpfn&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;TabPFN Tabular Feature Fitting &amp;amp; Scoring&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~1.1–1.5 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;In-memory zero-shot Bayesian regression on 4 vCPUs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ai.llm.gemma&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Google Gemma Narrative Generation&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~1.4–2.2 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Non-blocking slow-lane synthesis via OpenRouter/Google AI Studio&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Fast-Lane User Delivery&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;/evaluate&lt;/code&gt; Deterministic Delivery&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~1.5–2.5 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Immediate deterministic UI paint; zero blocking on LLM or audio generation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h4&gt;
  
  
  What Sentry Revealed: Observability in Action
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cold Starts vs. Warm Multi-Core Execution:&lt;/strong&gt; In a serverless container environment like Google Cloud Run, initial container spin-up requires importing PyTorch and loading TabPFN's transformer checkpoint into memory (~15–17s on cold boot). Sentry tracing immediately surfaced this difference: once the container is warm, multi-core CPU execution consistently executes in &lt;strong&gt;~1.1–1.5s&lt;/strong&gt;. Sentry isolated container lifecycle overhead from algorithmic compute.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upstream Data Hygiene:&lt;/strong&gt; Distributed tracing caught intermittent floating-point NaNs returned by upstream weather sensors, allowing me to inject a deterministic sanitization layer (&lt;code&gt;_sanitize_float&lt;/code&gt;) before data reaches TabPFN.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dual-Lane User Protection:&lt;/strong&gt; By tracing span durations, I verified the value of decoupling &lt;code&gt;/evaluate&lt;/code&gt; (the fast lane) from &lt;code&gt;/directive&lt;/code&gt; and &lt;code&gt;/synthesize-audio&lt;/code&gt; (the slow lane). The user's screen renders the photobiology dashboard in ~2 seconds, while Gemma and ElevenLabs upgrade the briefing asynchronously in the background.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  4. Google Gemma: Fast Generative Directives with Production Grounding
&lt;/h3&gt;

&lt;p&gt;To deliver a personalized, encouraging voice brief that doesn't sound like a boilerplate weather bot, I integrated Google's &lt;strong&gt;Gemma 3 27B&lt;/strong&gt; (&lt;code&gt;google/gemma-3-27b-it&lt;/code&gt;). &lt;/p&gt;

&lt;p&gt;Gemma excels at following concise persona instructions while maintaining a natural, empathetic tone. For SunSync's fast-paced user flow, instruction-tuned Gemma delivers punchy 15-second directives in seconds without the latency overhead of extended thinking traces.&lt;/p&gt;

&lt;h4&gt;
  
  
  Grounding &amp;amp; Health Safety Guardrails (&lt;code&gt;src/gemma_service.py&lt;/code&gt;)
&lt;/h4&gt;

&lt;p&gt;Because UV exposure and solar timing directly affect user well-being, production AI requires strict factual grounding. Gemma provides the creative, human variety, while code verifies that safety-critical numbers match reality before reaching the user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# From src/gemma_service.py
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;validate_directive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;window_time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;uv_index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Code-decides guardrail: The model narrates, but only verified facts ship.
    A candidate passes iff it repeats the computed window start AND grounds
    the UV reading. Any hallucinated drift is instantly rejected.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;

    &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;window_time&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;  &lt;span class="c1"&gt;# Hallucinated or shifted time -&amp;gt; rejected
&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;uv_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uv_index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="nf"&gt;except &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;

    &lt;span class="n"&gt;text_lower&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;uv_token&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;uv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text_lower&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;  &lt;span class="c1"&gt;# Dropped or fabricated UV safety reading -&amp;gt; rejected
&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This dual-layer architecture guarantees total reliability: Gemma crafts natural, motivating copy, while the verification layer ensures that the solar window and UV safety readings remain 100% faithful to the underlying telemetry. The UI displays an authentic badge indicating the exact origin (&lt;code&gt;✦ Gemma live&lt;/code&gt; vs &lt;code&gt;⚡ edge instant&lt;/code&gt;).&lt;/p&gt;




&lt;h3&gt;
  
  
  5. ElevenLabs Voice Architecture: Screen-Free Audio Presence
&lt;/h3&gt;

&lt;p&gt;Standard browser text-to-speech engines sound robotic, monotone, and clinical—developers tune them out immediately. To build an app that genuinely motivates someone to step away from their desk, the voice needed to feel calm, natural, and human.&lt;/p&gt;

&lt;p&gt;I integrated ElevenLabs using the &lt;code&gt;eleven_flash_v2_5&lt;/code&gt; model and the official Charlie voice (&lt;code&gt;IKne3meq5aSn9XLyUdCD&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Low-Latency Voice:&lt;/strong&gt; &lt;code&gt;eleven_flash_v2_5&lt;/code&gt; synthesizes the spoken brief in seconds while the UI stays fully interactive, and a browser-voice fallback guarantees the guide plays even if the API is unreachable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calm, Human Pacing:&lt;/strong&gt; Charlie delivers a natural, reassuring presence when reading the computed UV warnings and window times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Eyes-Free Outdoor Send-Off:&lt;/strong&gt; When you tap &lt;em&gt;"I'm going outside"&lt;/em&gt;, Charlie plays a warm send-off audio message so you can pocket your phone immediately and head out without looking back at the screen.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  6. The Field Test: Taking SunSync Outside for 20 Minutes (Bonus Challenge)
&lt;/h3&gt;

&lt;p&gt;The Hacktoberfest Week 1 challenge brief includes an explicit bonus criteria: taking the build outside, testing it in the real world, and reporting the experience.&lt;/p&gt;

&lt;p&gt;During development, when SunSync computed my local 20-minute peak recharge window (&lt;code&gt;14:15 - 14:35&lt;/code&gt;), I followed my own protocol:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I opened the live production URL on my phone, tapped &lt;strong&gt;Listen · 15s brief&lt;/strong&gt;, heard Charlie read out the computed window and UV safety tips, and tapped the green commitment button (&lt;em&gt;"I'm going outside"&lt;/em&gt;).&lt;/li&gt;
&lt;li&gt;The UI locked into the 20-minute circular breathing ring. I turned the phone face-down, slipped it into my pocket, and walked out under the open sky.&lt;/li&gt;
&lt;li&gt;Instead of checking notifications, I just looked out toward the horizon and took a walk (without staring directly at the sun, of course).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;How it actually went:&lt;/strong&gt;&lt;br&gt;
You notice the difference within a few minutes. Staring at an IDE two feet away for hours puts constant strain on your eyes. Looking out at the horizon under natural outdoor daylight lets your eyes relax and gives your nervous system a genuine reset. By the time the 20-minute timer wrapped up and I walked back to my desk, the usual 3:00 PM afternoon slump was gone—no extra coffee required.&lt;/p&gt;




&lt;h3&gt;
  
  
  7. Handling Timezones &amp;amp; Diurnal States: Real API Outputs
&lt;/h3&gt;

&lt;p&gt;Because SunSync runs live against the target location's solar clock, the decision engine and Gemma's spoken brief adapt dynamically to the time of day. Below are unedited API responses captured from the production service demonstrating how the system handles different diurnal states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When the Day's Peak Has Already Passed (e.g., Evening in Cairo):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Coordinates:&lt;/em&gt; &lt;code&gt;30.04° N, 31.24° E&lt;/code&gt; · Computed Window: &lt;code&gt;14:15 - 14:35&lt;/code&gt; · Score: &lt;code&gt;100/100&lt;/code&gt; · UV: &lt;code&gt;5.35&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Gemma Spoken Brief:&lt;/em&gt; &lt;em&gt;"Quick one: Just noting your daylight break peak — it was 14:15 - 14:35 with a UV of 5.35 — missed it, but let's aim for softer morning light tomorrow!"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Behavior:&lt;/em&gt; Recognizes the peak has passed, the UI displays &lt;code&gt;Done today&lt;/code&gt;, and advises softer morning light tomorrow without false "go outside now" prompts in the dark.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When the Day's Peak Is Upcoming (e.g., Morning in New York):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Coordinates:&lt;/em&gt; &lt;code&gt;40.71° N, -74.01° W&lt;/code&gt; · Computed Window: &lt;code&gt;14:15 - 14:35&lt;/code&gt; · Score: &lt;code&gt;100/100&lt;/code&gt; · UV: &lt;code&gt;0.95&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Gemma Spoken Brief:&lt;/em&gt; &lt;em&gt;"Hey you: Your daylight break with a UV index of 0.95 opens later today between 14:15 - 14:35, so be ready to step outside then!"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Behavior:&lt;/em&gt; Confirms future tense ("opens later today"), ticking down a live countdown rather than prompting the user prematurely.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When Testing Across Far Timezones (e.g., Midnight in Tokyo):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Coordinates:&lt;/em&gt; &lt;code&gt;35.68° N, 139.65° E&lt;/code&gt; · Computed Window: &lt;code&gt;12:15 - 12:35&lt;/code&gt; · Score: &lt;code&gt;100/100&lt;/code&gt; · UV: &lt;code&gt;5.2&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Gemma Spoken Brief:&lt;/em&gt; &lt;em&gt;"Fresh air alert: Your daylight break with a UV value of 5.2 opens between 12:15 - 12:35 today, so prepare to step outside then!"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Behavior:&lt;/em&gt; Evaluates Tokyo-local time (UTC+9) rather than the tester's client time, correctly scheduling the upcoming daylight window.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;Closed wellness algorithms treat human biology as a proprietary subscription black box. Building SunSync on an open-source architecture made critical capabilities possible that closed proprietary APIs simply cannot deliver:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Circadian Health Belongs to Everyone, Not Subscription SaaS:&lt;/strong&gt; Human biology is not an enterprise product. By building SunSync with open-source models, open data, and containerized infrastructure, the entire pipeline costs &lt;strong&gt;~$0.00 to run&lt;/strong&gt; at this scale. Anyone can fork the repository, deploy the included &lt;code&gt;Dockerfile&lt;/code&gt; on Google Cloud Run's free tier, and use it indefinitely without paying a $15/month wellness tax.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local CPU Independence via TabPFN:&lt;/strong&gt; Closed AI APIs demand continuous internet connectivity, recurring credit card billing, and API key management. TabPFN running zero-shot on local CPU proves that high-performance scientific modeling doesn't require gigawatt GPU clusters. Serving TabPFN directly on the application CPU keeps tabular predictions fast, self-contained, and completely free of remote ML endpoint costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict Data Privacy:&lt;/strong&gt; Commercial wellness applications harvest location history to monetize behavioral profiles. SunSync queries Open-Meteo for atmospheric weather only. My LLM prompts receive pure numerical arrays (irradiance, UV, angles)—&lt;strong&gt;personal coordinates are never passed to any AI model&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transparent, Reproducible Logic:&lt;/strong&gt; Proprietary health apps hide behind vague, closed algorithms. By keeping SunSync open source, every developer can inspect the exact solar calculations, daylight thresholds, and automated test suites.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Featured Categories
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Best Use of TabPFN (Prior Labs)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How SunSync Uses It:&lt;/strong&gt; Evaluates real 12-row tabular atmospheric telemetry vectors on live CPU using &lt;code&gt;TabPFNRegressor(n_estimators=4)&lt;/code&gt; with zero GPU dependencies. TabPFN predicts Equivalent Melanopic Lux (EML) in a single forward pass without gradient descent, achieving a &lt;strong&gt;0.00 score variance&lt;/strong&gt; across repeated runs. Foundation weights are pre-baked into Docker image layers, and warm multi-core CPU execution consistently evaluates in &lt;strong&gt;~1.1–1.5s&lt;/strong&gt; on Google Cloud Run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evidence in Repo:&lt;/strong&gt; &lt;a href="https://github.com/OmarAfifi-CSE/sunsync/blob/main/src/circadian_ml.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/circadian_ml.py&lt;/code&gt;&lt;/a&gt; · Determinism &amp;amp; stability benchmarks · &lt;code&gt;tests/test_circadian_ml.py&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2. Best Use of Gemma (Google)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How SunSync Uses It:&lt;/strong&gt; Uses Google's state-of-the-art open model (&lt;code&gt;google/gemma-3-27b-it&lt;/code&gt; via OpenRouter with Google AI Studio fallback) to synthesize the 15-second spoken outdoor directive. Gemma turns raw telemetry into an encouraging, natural audio brief, protected by a production grounding layer (&lt;code&gt;validate_directive()&lt;/code&gt;) that ensures computed window times and UV safety ratings remain strictly accurate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evidence in Repo:&lt;/strong&gt; &lt;a href="https://github.com/OmarAfifi-CSE/sunsync/blob/main/src/gemma_service.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/gemma_service.py&lt;/code&gt;&lt;/a&gt; · &lt;code&gt;tests/test_gemma_service.py&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Partner Categories
&lt;/h3&gt;

&lt;h4&gt;
  
  
  3. Best Use of Sentry Agent Tracing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How SunSync Uses It:&lt;/strong&gt; Shows the entire pipeline's performance via distributed tracing spans (&lt;code&gt;ai.telemetry.ingest&lt;/code&gt;, &lt;code&gt;ai.model.tabpfn&lt;/code&gt;, and &lt;code&gt;ai.llm.gemma&lt;/code&gt;). Sentry traces directly revealed upstream network latency, informed the progressive dual-lane decoupling, and surfaced upstream floating-point NaNs that led to the &lt;code&gt;_sanitize_float&lt;/code&gt; safety layer. Token metrics (&lt;code&gt;llm.estimated_prompt_tokens: 48&lt;/code&gt;) are attached to every span.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evidence in Repo:&lt;/strong&gt; &lt;a href="https://github.com/OmarAfifi-CSE/sunsync/blob/main/src/app.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/app.py&lt;/code&gt;&lt;/a&gt; 42–52 &amp;amp; 212–220 · Latency waterfall table in write-up · Expandable Sentry telemetry HUD in UI&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  4. Best Use of ElevenLabs
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How SunSync Uses It:&lt;/strong&gt; Powers SunSync's eyes-free audio interface using the &lt;code&gt;eleven_flash_v2_5&lt;/code&gt; model and the official Charlie voice (&lt;code&gt;IKne3meq5aSn9XLyUdCD&lt;/code&gt;). Delivers lifelike voice briefings and outdoor send-offs so developers can pocket their phones without looking at screens. ElevenLabs transforms what would otherwise be a robotic notification into a calm, human ritual that encourages stepping away from the desk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evidence in Repo:&lt;/strong&gt; &lt;a href="https://github.com/OmarAfifi-CSE/sunsync/blob/main/src/audio_service.py" rel="noopener noreferrer"&gt;&lt;code&gt;src/audio_service.py&lt;/code&gt;&lt;/a&gt; · &lt;a href="https://github.com/OmarAfifi-CSE/sunsync/blob/main/src/static/app.js" rel="noopener noreferrer"&gt;&lt;code&gt;src/static/app.js&lt;/code&gt;&lt;/a&gt; &lt;em&gt;(voice pipeline: synthesizeAudioElement, speakViaBrowser fallback, playDetoxGuide)&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Closing: Step Away from the Screen
&lt;/h3&gt;

&lt;p&gt;For years, I treated developer fatigue as a software problem to be solved with more software, more productivity tools, and more screen time.&lt;/p&gt;

&lt;p&gt;Building SunSync reinforced the opposite truth: the most valuable thing an AI tool can do is provide a fast, mathematically grounded answer, get completely out of the way, and encourage a return to the physical world.&lt;/p&gt;

&lt;p&gt;Human knowledge has real limits, and so does biological endurance. A developer simply isn't built to spend 14 hours a day under office lights staring at glowing screens.&lt;/p&gt;

&lt;p&gt;Now, close this tab. &lt;/p&gt;

&lt;p&gt;Lock your screen. &lt;/p&gt;

&lt;p&gt;Step outside, and go touch some grass. 🌿&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>mlhacks</category>
      <category>ai</category>
    </item>
    <item>
      <title>Building an Agent That Can't Afford to Be Wrong: Quran Sanity Agent</title>
      <dc:creator>Omar Afifi</dc:creator>
      <pubDate>Sun, 04 Oct 2026 06:59:52 +0000</pubDate>
      <link>https://dev.to/omarafifi/building-an-agent-that-cant-afford-to-be-wrong-quran-sanity-agent-1pai</link>
      <guid>https://dev.to/omarafifi/building-an-agent-that-cant-afford-to-be-wrong-quran-sanity-agent-1pai</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/sanity-2026-09-16"&gt;Sanity Challenge, Path One: Ship an Agent That Queries Real Content&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;When I first opened the Sanity Challenge announcement, one sentence in the Path One brief immediately grabbed my attention:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Build anything that needs an answer it can't afford to get wrong."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That one line defined this entire project. &lt;/p&gt;

&lt;p&gt;If you ask an AI chatbot for movie recommendations or a recipe, a small hallucination is harmless. But if you ask it about the Quran, religious scripture, or classical commentary, &lt;strong&gt;getting things wrong is not an option.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yet that is exactly what standard LLMs do every day:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They drop words from verses or invent Arabic grammar on the fly.&lt;/li&gt;
&lt;li&gt;When two classical scholars disagree, the model either invents a fake consensus or blends both opinions into a confusing, contradictory mess.&lt;/li&gt;
&lt;li&gt;It cites famous books and scholars with total confidence, even when the quote never existed in that book.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Traditional RAG (Retrieval-Augmented Generation) doesn't fix this either, because dumping raw chunks into a prompt still leaves the model free to summarize, blur, and paraphrase whatever it wants.&lt;/p&gt;

&lt;p&gt;I wanted to see what happens when you treat the problem differently: &lt;strong&gt;what if the AI literally cannot generate Quranic text?&lt;/strong&gt; What if the agent only has access to verified, structured records in Sanity, and conflicting historical opinions are modeled cleanly as data rather than smoothed over?&lt;/p&gt;

&lt;p&gt;That is what &lt;strong&gt;Quran Sanity Agent&lt;/strong&gt; is built to do.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Quran Sanity Agent&lt;/strong&gt; is a bilingual (Arabic &amp;amp; English) web research workspace where every single verse, translation, and scholarly commentary is anchored to an immutable record in Sanity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq7exqwu402ek1oy2051a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq7exqwu402ek1oy2051a.png" alt="Quran Sanity Agent Interface" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works in Practice
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Verses Are Read, Never Generated:&lt;/strong&gt; The LLM is never asked to recite or recall Quranic text from memory. Every Ayah displayed in the interface is pulled directly from a verified Sanity document matching the authoritative Tanzil Uthmani 1.1 reference standard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scholarly Differences as Structured Data:&lt;/strong&gt; In classical Islamic exegesis (Tafsir), scholars have debated linguistic nuances and legal rulings for over a thousand years. Instead of hiding these differences, the application structures them into two distinct categories:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Contradictory (&lt;em&gt;Ikhtilaf Tadadd&lt;/em&gt;):&lt;/strong&gt; True conflicting positions (e.g., whether the opening &lt;em&gt;Basmalah&lt;/em&gt; is counted as a verse of Al-Fatihah).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complementary (&lt;em&gt;Ikhtilaf Tanawwu'&lt;/em&gt;):&lt;/strong&gt; Multi-faceted meanings that coexist (e.g., whether &lt;em&gt;Al-Asr&lt;/em&gt; refers to time itself or the afternoon prayer).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Evidence Drawer:&lt;/strong&gt; Every verse and commentary card has an interactive citation badge. Clicking it opens a side drawer showing the exact Sanity Document ID, the physical book locator (chapter, volume, and primary URL), and the raw JSON payload straight from the Content Lake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Honest Evidence Gaps:&lt;/strong&gt; If you ask a question outside the curated dataset (like modern cryptocurrency rulings), the agent doesn't try to guess or produce an ungrounded opinion. It explicitly reports an &lt;strong&gt;Evidence Gap&lt;/strong&gt;, showing what records it searched and clarifying that no authoritative source is available.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The app is live, publicly accessible, and backed by a hosted Sanity Studio:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🌐 &lt;strong&gt;Live Web Application:&lt;/strong&gt; &lt;a href="https://quran-sanity.omar-afifi.com" rel="noopener noreferrer"&gt;https://quran-sanity.omar-afifi.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;🏛️ &lt;strong&gt;Hosted Sanity Studio:&lt;/strong&gt; &lt;a href="https://quran-evidence-studio.sanity.studio/" rel="noopener noreferrer"&gt;https://quran-evidence-studio.sanity.studio/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;💻 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/OmarAfifi-CSE/quran-sanity-agent" rel="noopener noreferrer"&gt;https://github.com/OmarAfifi-CSE/quran-sanity-agent&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Zero-Trust Transparency: The Live Evidence Drawer
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbur676jvqlalkovb7lcg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbur676jvqlalkovb7lcg.png" alt="Evidence Drawer with Raw Sanity Content Lake JSON" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Inspect real-time Sanity Document IDs, physical book locators, and raw JSON payloads straight from the Content Lake.&lt;/em&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  Queries You Can Test Right Now
&lt;/h3&gt;

&lt;p&gt;Here are four questions you can paste into the live app to see the structured pipeline in action:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Exact Verse Integrity:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Query: &lt;code&gt;2:255&lt;/code&gt; (or switch the UI to Arabic and type &lt;code&gt;البقرة ٢٥٥&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;What to look for:&lt;/em&gt; Instant retrieval of Ayat al-Kursi with verified Uthmani script and Saheeh International translation. Click the citation badge to view &lt;code&gt;ayah-2-255&lt;/code&gt; in the Evidence Drawer.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contradictory Divergence:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Query: &lt;code&gt;Compare interpretations of Al-Fatiha Basmalah&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;What to look for:&lt;/em&gt; Surfaces the opposing classical positions between Ibn Kathir / Al-Qurtubi vs. Fakhr al-Din al-Razi side-by-side, without the model taking a side or muddying the waters.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complementary Divergence:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Query: &lt;code&gt;Compare interpretations of Al-Asr&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;What to look for:&lt;/em&gt; Shows how Al-Tabari, Ibn Kathir, and Al-Qurtubi each highlight complementary dimensions of the word (time, human deeds, afternoon prayer).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Retrieval via Sanity Context MCP:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Query: &lt;code&gt;What does the Quran say about justice even against oneself?&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;What to look for:&lt;/em&gt; The agent queries the Sanity Context MCP endpoint, ranks Ayah 4:135 at the top, and provides grounded notes quoting the primary text verbatim.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The entire codebase is open-source and available on GitHub:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/OmarAfifi-CSE/quran-sanity-agent" rel="noopener noreferrer"&gt;github.com/OmarAfifi-CSE/quran-sanity-agent&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The project is structured as a TypeScript monorepo:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;web/&lt;/code&gt;:&lt;/strong&gt; Next.js 15 (App Router) interface with full Arabic RTL support and the Sanity Context MCP integration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;studio/&lt;/code&gt;:&lt;/strong&gt; Sanity Studio v3 with custom Desk Structure and dedicated Islamic hermeneutic schemas.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;scripts/&lt;/code&gt;:&lt;/strong&gt; Verification tools ensuring zero character drift against reference text standards.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  How I Used Sanity
&lt;/h2&gt;

&lt;p&gt;This project is built around the idea that &lt;strong&gt;an agent is only as reliable as the structure behind its content.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Here is how Sanity handles every layer of the architecture:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────────────────────────────────────────┐
│                   SANITY CONTENT LAKE                    │
│   • 114 Surahs (Surah number, names, revelation type)    │
│   • 6,236 Ayahs (Uthmani text, translation, keywords)    │
│   • 6 Tafsir Authorities (Scholar, death year, school)   │
│   • 12 Audited Interpretive Claims with primary excerpts │
└────────────┬─────────────────────────────┬───────────────┘
             │                             │
    Exact Lookups (GROQ)          Semantic Queries (MCP)
             │                             │
             ▼                             ▼
┌──────────────────────────┐  ┌─────────────────────────────┐
│ Deterministic Lake Fetch │  │ Sanity Context MCP Endpoint │
│  • Sub-50ms response     │  │  • 21,398 library chunks    │
│  • Direct schema joins   │  │  • Vector embeddings rank   │
└────────────┬─────────────┘  └────────────┬────────────────┘
             │                             │
             └──────────────┬──────────────┘
                            ▼
┌──────────────────────────────────────────────────────────┐
│                 NEXT.JS AGENT WORKSPACE                  │
│   • Verifies all candidate IDs against Content Lake      │
│   • Rejects AI notes that lack verbatim source quotes    │
│   • Renders bilingual cards &amp;amp; Evidence Drawer            │
└──────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1. The Content Model (&lt;code&gt;studio/schemaTypes/&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Instead of generic blog or article schemas, Sanity Studio manages structured Quranic and classical commentary data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;surah&lt;/code&gt;:&lt;/strong&gt; Core chapter metadata (number, Arabic name, English name, revelation type, verse count).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ayah&lt;/code&gt;:&lt;/strong&gt; Individual verse records containing Tanzil Uthmani text, verified English translations, and references to parent chapters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;tafsirSource&lt;/code&gt;:&lt;/strong&gt; Classical authorities (e.g. Al-Tabari d. 310 AH, Al-Qurtubi d. 671 AH, Ibn Kathir d. 774 AH) with their specific methodology (&lt;code&gt;athari&lt;/code&gt;, &lt;code&gt;juridical&lt;/code&gt;, &lt;code&gt;rational&lt;/code&gt;, &lt;code&gt;linguistic&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;interpretiveClaim&lt;/code&gt;:&lt;/strong&gt; An atomic claim linking an &lt;code&gt;ayah&lt;/code&gt; to a &lt;code&gt;tafsirSource&lt;/code&gt;. It stores the primary excerpt (&lt;code&gt;primaryExcerpt&lt;/code&gt;), the physical book locator (&lt;code&gt;sourceLocator&lt;/code&gt;), the divergence classification (&lt;code&gt;contradictory&lt;/code&gt;, &lt;code&gt;complementary&lt;/code&gt;, &lt;code&gt;consensus&lt;/code&gt;), and editorial status.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;sourceEdition&lt;/code&gt; &amp;amp; &lt;code&gt;libraryChunk&lt;/code&gt;:&lt;/strong&gt; Ingestion schemas representing 21,398 chunks across classical commentaries for semantic retrieval.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. The Editorial Review Gate
&lt;/h3&gt;

&lt;p&gt;One of the most practical things about Sanity Studio is how easily you can customize the &lt;strong&gt;Desk Structure&lt;/strong&gt; to enforce editorial discipline.&lt;/p&gt;

&lt;p&gt;In &lt;a&gt;&lt;code&gt;studio/deskStructure.ts&lt;/code&gt;&lt;/a&gt;, I added a custom &lt;strong&gt;"Needs source review"&lt;/strong&gt; filter:&lt;br&gt;
If an editor enters a new claim but forgets the primary book excerpt, the exact source URL, or the reviewer sign-off, Sanity immediately catches it and moves it into this review queue.&lt;/p&gt;

&lt;p&gt;More importantly, the Next.js agent's GROQ queries strictly filter for &lt;code&gt;reviewStatus in ["source_checked", "reviewed"]&lt;/code&gt;. If a claim hasn't passed the editorial gate, the AI agent is physically unable to see it or use it in an answer.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Sanity Context MCP &amp;amp; Semantic Retrieval
&lt;/h3&gt;

&lt;p&gt;While exact verse numbers (e.g. &lt;code&gt;2:255&lt;/code&gt;) are resolved instantly via deterministic GROQ queries, thematic questions (e.g. &lt;em&gt;"What does the Quran say about justice?"&lt;/em&gt;) require semantic understanding.&lt;/p&gt;

&lt;p&gt;To handle this, I pointed &lt;strong&gt;Sanity Context&lt;/strong&gt; at the imported library of &lt;strong&gt;21,398 chunks&lt;/strong&gt; and enabled Content Lake embeddings:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When a user asks a conceptual question, the agent queries the remote &lt;strong&gt;Sanity Context MCP endpoint&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The MCP server ranks relevant chunks based on semantic similarity and returns their document IDs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Grounding Rule:&lt;/strong&gt; The agent never relies solely on the LLM's summary. It uses those document IDs to re-fetch the raw records directly from the Content Lake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verbatim Quotation Enforcement:&lt;/strong&gt; If the model generates an explanatory note, the application validates that the note quotes words directly from the retrieved source text. If it fails this check, the UI falls back to displaying the raw verified excerpt.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Sanity Project Details
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sanity Project ID:&lt;/strong&gt; &lt;code&gt;qkca243t&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dataset:&lt;/strong&gt; &lt;code&gt;production&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hosted Studio:&lt;/strong&gt; &lt;a href="https://quran-evidence-studio.sanity.studio/" rel="noopener noreferrer"&gt;https://quran-evidence-studio.sanity.studio/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sanity Context MCP Endpoint:&lt;/strong&gt; &lt;code&gt;https://api.sanity.io/v1/context/organizations/o831wcpb9/mcp/quran-evidence-mcp&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content Lake Stats:&lt;/strong&gt; 6,369 primary documents (114 Surahs, 6,236 Ayahs, 6 Tafsir Sources, 12 Curated Interpretive Claims) and 21,398 indexed library chunks.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Building This Taught Me
&lt;/h2&gt;

&lt;p&gt;Building this project made one thing very clear:&lt;/p&gt;

&lt;p&gt;The solution to AI hallucination in high-stakes domains isn't "better prompts" or larger models. It's &lt;strong&gt;structured content.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you treat texts as unstructured strings dumped into a vector database, the AI is always one step away from fabricating an answer. But when you model your domain properly—distinguishing chapters from verses, authorities from editions, and consensus from disagreement—the AI stops guessing and starts acting as an interface to verified knowledge.&lt;/p&gt;

&lt;p&gt;Sanity was uniquely suited for this: having schemas, the Content Lake, GROQ, and the Context MCP in one unified ecosystem meant I could build a zero-hallucination agent that remains completely transparent with every answer it gives.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Check out the live project at &lt;a href="https://quran-sanity.omar-afifi.com" rel="noopener noreferrer"&gt;quran-sanity.omar-afifi.com&lt;/a&gt; and explore the code on &lt;a href="https://github.com/OmarAfifi-CSE/quran-sanity-agent" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>sanitychallenge</category>
      <category>sanity</category>
      <category>ai</category>
    </item>
    <item>
      <title>My Phone Broke, and Gemini Fixed It</title>
      <dc:creator>Omar Afifi</dc:creator>
      <pubDate>Wed, 09 Sep 2026 22:26:48 +0000</pubDate>
      <link>https://dev.to/omarafifi/my-phone-broke-and-gemini-fixed-it-329l</link>
      <guid>https://dev.to/omarafifi/my-phone-broke-and-gemini-fixed-it-329l</guid>
      <description>&lt;h2&gt;
  
  
  📱 Picture This: An All-Nighter Turns Into a Morning Nightmare
&lt;/h2&gt;

&lt;p&gt;It is early morning. You’ve just pulled an all-nighter tinkering with an Android project over ADB. The sun is already creeping through the window, tests finally pass, and you unplug the USB cable from your OnePlus to finally go to bed.&lt;/p&gt;

&lt;p&gt;You unlock your screen, swipe down to open Settings, and freeze.&lt;/p&gt;

&lt;p&gt;Right across your menus is a block of bright-red monospace text:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyyu387sfmchubhw4o4si.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyyu387sfmchubhw4o4si.jpg" alt="The mysterious red debug overlay on OxygenOS" width="431" height="948"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;isOverScrolling: false
X: FlingVX: 0.0, ClickVX: 0.0
Y: FlingVY: 15435.0, ClickVY: 0.0
AbortVX:0.0, AbortVY:15435.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You stare at it, then touch the screen again. The numbers immediately jump, recalculating in real time with every movement of your thumb. You swipe fast, and &lt;code&gt;FlingVY&lt;/code&gt; shoots into the tens of thousands. &lt;/p&gt;

&lt;p&gt;Then you notice something even worse: the phone is lagging badly. &lt;/p&gt;

&lt;p&gt;When you swipe from the screen edge to go back, the gesture stutters. Pulling out the OnePlus Smart Sidebar hesitates and drops frames. The smooth 120Hz display suddenly feels like a cheap phone struggling to keep up.&lt;/p&gt;




&lt;h2&gt;
  
  
  🥶 Zero Results: When Google Goes Completely Silent
&lt;/h2&gt;

&lt;p&gt;Your developer reflexes kick in immediately. You jump straight into &lt;strong&gt;Developer Options&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Pointer Location?&lt;/em&gt; Off.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Show Layout Bounds?&lt;/em&gt; Off.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Show Taps?&lt;/em&gt; Off.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Strict Mode?&lt;/em&gt; Off.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything is disabled. &lt;/p&gt;

&lt;p&gt;Fine. You hold down the power button and reboot. The phone restarts, you unlock it, open Settings, scroll down—and the red numbers are still right there.&lt;/p&gt;

&lt;p&gt;That's when you start to panic. You open your browser and start searching:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;"red text on android screen"&lt;/code&gt;: &lt;em&gt;Generic guides telling you to turn off Developer Options.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"OnePlus red text on screen"&lt;/code&gt;: &lt;em&gt;Threads asking about the red "1" on the lock screen clock (funny, but not helping).&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"OnePlus red text error"&lt;/code&gt;: &lt;em&gt;Nothing remotely relevant.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"isOverScrolling: false" OnePlus&lt;/code&gt;: &lt;em&gt;No results found.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"AbortVX"&lt;/code&gt; / &lt;code&gt;"ClickVX"&lt;/code&gt;: &lt;em&gt;Absolute zero.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Zero results. Not a single thread on XDA Forums, not a mention on Reddit, and nothing on the OnePlus Community.&lt;/p&gt;

&lt;p&gt;If you've worked with Android long enough, you know what this silence means: when an issue has zero documentation in AOSP and zero community threads, you're usually looking at a full factory reset.&lt;/p&gt;




&lt;h2&gt;
  
  
  😴 "That’s Future Me’s Problem"
&lt;/h2&gt;

&lt;p&gt;At that point, the morning sun was already up. I had stayed up all night, I was running on zero sleep, completely exhausted, and my brain felt like an OutOfMemory error. I stared at the red numbers on my screen and made the most mature engineering decision possible:&lt;/p&gt;

&lt;p&gt;I decided to go to sleep.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"You know what? This is future me's problem."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I put the phone face-down on the nightstand, closed my eyes, and hoped it would just magically disappear by the time I woke up.&lt;/p&gt;

&lt;p&gt;Fast forward to later that afternoon: I woke up, tapped the screen, and nope—the red velocity numbers were still right there, tracking every single swipe while I was still half-asleep.&lt;/p&gt;

&lt;p&gt;Now awake and ready to deal with it, I decided it was time to bring in serious backup.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤖 Handing the Terminal to Gemini
&lt;/h2&gt;

&lt;p&gt;I plugged the USB cable back into my laptop. I opened my Antigravity IDE where I had been pair-programming with &lt;strong&gt;Gemini&lt;/strong&gt;, and typed out of pure frustration:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Hey, you ran some ADB commands on my phone earlier for some app testing and now there's this weird red text on my screen and the edges are lagging. I plugged it in—fix it."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If this were a standard chatbot, you already know what its first response would be:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Go to Settings &amp;gt; Developer Options and disable 'Pointer Location', 'Show Layout Bounds', or 'Strict Mode'. If those are already off, try backing up your data and performing a factory reset."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every standard LLM defaults to that exact script because it assumes you're dealing with standard Android toggles. And when you tell it they're already off, it hits a complete dead end.&lt;/p&gt;

&lt;p&gt;Instead, Gemini took the wheel. What happened on my terminal over the next few minutes was impressive: rather than giving boilerplate advice, Gemini started systematically diagnosing the operating system from the inside out.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎨 Step 1: The Canvas Deduction
&lt;/h2&gt;

&lt;p&gt;Gemini didn't guess. It queried the device's runtime settings via ADB:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell settings get system pointer_location
adb shell settings get system show_touches
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both came back &lt;code&gt;0&lt;/code&gt;. Standard Android touch telemetry was definitively off.&lt;/p&gt;

&lt;p&gt;Then Gemini dumped the entire live UI hierarchy of the Settings app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell uiautomator dump /sdcard/window_dump.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It grepped the XML tree for &lt;code&gt;isOverScrolling&lt;/code&gt;. The result? &lt;strong&gt;Empty.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That silence told Gemini everything:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"This text does not exist as a TextView or a system overlay window. It is being painted directly onto the hardware Canvas buffer during draw passes by an internal UI component."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because the text appeared during scrolling in OnePlus system menus, Gemini formed an immediate hypothesis: the code belonged to OnePlus/OPPO’s proprietary UI toolkit—&lt;strong&gt;COUI&lt;/strong&gt; (ColorOS UI).&lt;/p&gt;




&lt;h2&gt;
  
  
  🔬 Step 2: Disassembling the Phone on the Fly
&lt;/h2&gt;

&lt;p&gt;Because these OEM classes are completely proprietary and unreleased, Gemini couldn't look up documentation. It had to read the machine code directly from the phone.&lt;/p&gt;

&lt;p&gt;To inspect the COUI framework without needing root access, Gemini pulled a built-in pre-installed app that uses the same UI components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb pull /product/app/Calculator2/Calculator2.apk ./calc.apk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, right inside my terminal, Gemini wrote and executed Python scripts to parse the raw binary DEX (Dalvik Executable) structures of the APK.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Hunting the String Table
&lt;/h3&gt;

&lt;p&gt;Gemini parsed the DEX string pool inside &lt;code&gt;calc.apk&lt;/code&gt; and found the exact IDs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;String &lt;code&gt;#2600&lt;/code&gt; = &lt;code&gt;'AbortVX:'&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;String &lt;code&gt;#37919&lt;/code&gt; = &lt;code&gt;'isOverScrolling: '&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Pinpointing the Method
&lt;/h3&gt;

&lt;p&gt;It mapped those string IDs across every class definition in the binary. In seconds, Gemini had the exact location:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Class:&lt;/strong&gt; &lt;code&gt;androidx.recyclerview.widget.COUIRecyclerView&lt;/code&gt; (OnePlus’s internal extension of the Jetpack RecyclerView)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Method:&lt;/strong&gt; &lt;code&gt;dispatchDraw(Canvas canvas)&lt;/code&gt; at bytecode offset &lt;code&gt;0x1fbea0&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Reading the Dalvik Bytecode
&lt;/h3&gt;

&lt;p&gt;Gemini disassembled the opcodes at that offset. The bytecode showed exactly what was going on under the hood:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0x1fbea0: invoke-virtual View-&amp;gt;dispatchDraw
0x1fbea6: sget COUIRecyclerView-&amp;gt;COUI_DEBUG:Z   // Check static boolean flag
0x1fbeaa: if-eqz -&amp;gt; 0x1fc03c                   // If false, skip entirely!
0x1fbeae: iget COUIRecyclerView-&amp;gt;mDebugPaint   // Get Paint object
0x1fbec4: invoke-virtual Paint-&amp;gt;setColor       // Set paint color to RED
0x1fbed4: const-string 'isOverScrolling: '     // Format velocity strings
0x1fbf2a: const-string 'X: FlingVX: '
0x1fbf86: const-string 'Y: FlingVY: '
0x1fbfe4: const-string 'AbortVX:'
0x1fc036: invoke-virtual Canvas-&amp;gt;drawText      // Draw directly on screen!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There it was: an undocumented, internal scroll-physics debugger built by OEM engineers to measure fling velocities during ROM development.&lt;/p&gt;




&lt;h2&gt;
  
  
  💥 Step 3: The Domino Effect — Finding Patient Zero
&lt;/h2&gt;

&lt;p&gt;Gemini now knew &lt;em&gt;what&lt;/em&gt; was painting the screen, but why had &lt;code&gt;COUI_DEBUG&lt;/code&gt; suddenly turned &lt;code&gt;true&lt;/code&gt; across my entire phone?&lt;/p&gt;

&lt;p&gt;Gemini inspected the class initializer &lt;code&gt;&amp;lt;clinit&amp;gt;&lt;/code&gt; of &lt;code&gt;COUIRecyclerView&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0x1fb9bc: const-string 'COUIRecyclerView'
0x1fb9c2: invoke-static COUILog-&amp;gt;isLoggable("COUIRecyclerView", Log.DEBUG)
0x1fb9d6: sput COUIRecyclerView-&amp;gt;COUI_DEBUG:Z
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;COUILog.isLoggable()&lt;/code&gt; simply calls Android's built-in &lt;code&gt;android.util.Log.isLoggable(tag, level)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In Android, &lt;code&gt;Log.isLoggable()&lt;/code&gt; first checks for a tag-specific system property (&lt;code&gt;log.tag.&amp;lt;TAG&amp;gt;&lt;/code&gt;). If that doesn't exist, it checks the global fallback property:&lt;/p&gt;

&lt;blockquote&gt;
&lt;h3&gt;
  
  
  🎯 The Culprit: &lt;code&gt;persist.log.tag&lt;/code&gt;
&lt;/h3&gt;
&lt;/blockquote&gt;

&lt;p&gt;Gemini queried the phone:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell getprop persist.log.tag
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The terminal printed one character:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;V
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Connecting the Dots
&lt;/h3&gt;

&lt;p&gt;Hours earlier, while debugging an audio service over ADB, a command had set &lt;code&gt;persist.log.tag&lt;/code&gt; to &lt;code&gt;V&lt;/code&gt; (Verbose) to inspect background audio logs. &lt;/p&gt;

&lt;p&gt;That one command triggered an unexpected chain reaction:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Why it survived reboots:&lt;/strong&gt; Properties starting with &lt;code&gt;persist.&lt;/code&gt; are saved directly to flash storage (&lt;code&gt;/data/property&lt;/code&gt;). A reboot does not wipe them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why the red text appeared:&lt;/strong&gt; Every time any app initialized a scrollable list, &lt;code&gt;COUIRecyclerView&lt;/code&gt; checked if debug logging was enabled. Because &lt;code&gt;persist.log.tag&lt;/code&gt; was set globally to &lt;code&gt;V&lt;/code&gt;, Android replied that everything was in verbose mode. &lt;code&gt;COUI_DEBUG&lt;/code&gt; became &lt;code&gt;true&lt;/code&gt;, and the red velocity overlay activated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why the edges were lagging:&lt;/strong&gt; With global verbose logging enabled across the entire OS, every single touch event, swipe coordinate, and edge gesture flooded the system log daemon with hundreds of log lines per second. The CPU was overwhelmed with logging I/O, dropping frames and causing noticeable edge touch lag.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  ⚡ The Cure: Total Relief in Five Seconds
&lt;/h2&gt;

&lt;p&gt;Once Gemini identified the exact root cause, the fix was quick and clean:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Resetting the Global Flag
&lt;/h3&gt;

&lt;p&gt;Gemini reset the dangerous persistent global log property to empty:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell setprop persist.log.tag &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Preventing It from Happening Again
&lt;/h3&gt;

&lt;p&gt;To make sure &lt;code&gt;COUIRecyclerView&lt;/code&gt; could never wake up its debug drawing again—even if global verbose logging were accidentally enabled in a future project—Gemini injected a permanent tag-level suppression rule:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell setprop persist.log.tag.COUIRecyclerView SUPPRESS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Killing the Active Process for Instant Testing
&lt;/h3&gt;

&lt;p&gt;Gemini killed the Settings process to immediately test the fix on the current window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell am force-stop com.android.settings
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Gemini triggered an automated swipe gesture through ADB, captured a live screenshot, and verified that the red text had vanished from Settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The Final Device Reboot: Flushing In-Memory State
&lt;/h3&gt;

&lt;p&gt;While Settings was fixed immediately, Gemini pointed out a crucial Android runtime mechanic:&lt;/p&gt;

&lt;p&gt;In the Dalvik/ART virtual machine, static initializers (&lt;code&gt;&amp;lt;clinit&amp;gt;&lt;/code&gt;) run &lt;strong&gt;only once&lt;/strong&gt; when a class is first loaded into a process. That meant any app or system service already running in RAM (like the Launcher, SystemUI, or Contacts) still held &lt;code&gt;COUI_DEBUG = true&lt;/code&gt; cached in memory.&lt;/p&gt;

&lt;p&gt;To guarantee that every background process, system daemon, and service reloaded cleanly from scratch with the new suppressed properties, we performed a fresh device reboot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the phone rebooted, I picked it up, unlocked it, and scrolled through every corner of the system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The red text was 100% gone across all apps.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The edges were instantly responsive.&lt;/strong&gt; Edge gestures, the Smart Sidebar, and the silky 120Hz display were completely restored.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Zero personal data touched, zero system partitions modified.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;All temporary extraction scripts were cleanly wiped from both the phone and PC.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎓 Final Thoughts: An Engineering Student Left Speechless
&lt;/h2&gt;

&lt;p&gt;As a Computer &amp;amp; Systems Engineering student, I usually take AI hype with a grain of salt. I understand how systems work under the hood, and I know how complex and messy OEM Android frameworks get when low-level state gets corrupted.&lt;/p&gt;

&lt;p&gt;If I had posted this on a forum or asked a standard chatbot, the advice would have been the same generic response: back up your data and factory reset.&lt;/p&gt;

&lt;p&gt;Watching Gemini handle this live in my terminal was genuinely impressive. It didn't guess, and it didn't give generic tips. It followed a solid systems debugging process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It systematically eliminated UI layers until only hardware Canvas rendering was left.&lt;/li&gt;
&lt;li&gt;It pulled compiled OEM packages directly from the phone without needing root access.&lt;/li&gt;
&lt;li&gt;It wrote Python scripts on the spot to parse binary DEX string pools and find the right class offsets.&lt;/li&gt;
&lt;li&gt;It analyzed the raw Dalvik bytecode and isolated the exact &lt;code&gt;sget&lt;/code&gt; instruction controlling the overlay.&lt;/li&gt;
&lt;li&gt;It traced an undocumented UI flag back to a persistent Linux system property that had survived reboots.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Watching an AI autonomously reverse-engineer compiled bytecode on a live device—and solve an undocumented framework issue in minutes without touching a single byte of my personal data—was amazing to see.&lt;/p&gt;

&lt;p&gt;This isn't just about autocompleting syntax or generating boilerplate code anymore. This is a real glimpse into the future of systems engineering—and as an engineering student, it completely blew me away.&lt;/p&gt;

</description>
      <category>android</category>
      <category>gemini</category>
      <category>googleai</category>
      <category>debugging</category>
    </item>
    <item>
      <title>The Ghost in the View Transitions API: A Bizarre Debugging Saga with Google AI 👻</title>
      <dc:creator>Omar Afifi</dc:creator>
      <pubDate>Fri, 07 Aug 2026 17:35:35 +0000</pubDate>
      <link>https://dev.to/omarafifi/the-ghost-in-the-view-transitions-api-a-bizarre-debugging-saga-with-google-ai-5aph</link>
      <guid>https://dev.to/omarafifi/the-ghost-in-the-view-transitions-api-a-bizarre-debugging-saga-with-google-ai-5aph</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/bugsmash"&gt;DEV's Summer Bug Smash: Clear the Lineup&lt;/a&gt; powered by &lt;a href="https://sentry.io/" rel="noopener noreferrer"&gt;Sentry&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🎨 Project Overview
&lt;/h2&gt;

&lt;p&gt;While working on a major upgrade for my personal portfolio (Check it out here: &lt;a href="https://omar-afifi.com/" rel="noopener noreferrer"&gt;Live Portfolio Link&lt;/a&gt; | &lt;a href="https://github.com/omarafifi-cse/omarafifi-cse.github.io" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;), I built a feature called the &lt;strong&gt;Theme Showcase&lt;/strong&gt;. When a user first loads the homepage, a slick &lt;code&gt;View Transitions API&lt;/code&gt; animation sweeps across the screen, temporarily switching the site to one of my custom showcase themes (like "Obsidian" or "Midnight"), before gracefully sweeping back to their chosen default theme. It was a 1.7-second "Wow Effect" designed to show off the site's dynamic color system.&lt;/p&gt;

&lt;h2&gt;
  
  
  🐛 Bug Fix
&lt;/h2&gt;

&lt;p&gt;Soon after deploying, I noticed a terrifying, chaotic bug. Sometimes, I would open the website and quickly switch to another tab to check an email, or minimize the browser window completely. When I switched back... &lt;/p&gt;

&lt;p&gt;Instead of my beautiful default theme, the website was permanently stuck on one of the other showcase themes! The animation had frozen mid-way, leaving the site in an awkward intermediate state. While the website was still fully functional and I could manually fix it by selecting my original theme from the dropdown menu, it was a terrible first impression for a professional portfolio. It was as if a ghost had possessed the CSS.&lt;/p&gt;

&lt;p&gt;My first instinct? Smash the refresh button. Refreshing would actually fix the glitch and play the animation perfectly—but &lt;em&gt;only&lt;/em&gt; if I stayed patiently on the tab and watched it finish! If I refreshed and immediately switched tabs again, the ghost would return.&lt;/p&gt;

&lt;h2&gt;
  
  
  💻 Code
&lt;/h2&gt;

&lt;p&gt;Here is the exact code change we made to exorcise the ghost. &lt;em&gt;(You can view the full fix in this &lt;a href="https://github.com/OmarAfifi-CSE/omarafifi-cse.github.io/commit/e5563dd648562f10317cd382b7876efad9285517" rel="noopener noreferrer"&gt;GitHub Commit&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Buggy Code (Before):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transition&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startViewTransition&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// If the browser aborts the transition here, the Promise rejects and execution halts forever!&lt;/span&gt;
&lt;span class="nx"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;animation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documentElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;animate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="cm"&gt;/* ... */&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onfinish&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Bulletproof Code (After):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;isCancelled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// 1. Gracefully handle tab switching&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleVisibility&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;isCancelled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;originalTheme&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Instantly restore&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;visibilitychange&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handleVisibility&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;visibilitychange&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handleVisibility&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// 2. Bulletproof the View Transition Promise&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transition&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startViewTransition&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isCancelled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="nx"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isCancelled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;animation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documentElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;animate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="cm"&gt;/* ... */&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onfinish&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;oncancel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// THE MAGIC FIX: If the browser aborts the transition (background tab), resolve immediately!&lt;/span&gt;
      &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Fallback if startViewTransition throws synchronously&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isCancelled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🛠️ My Improvements
&lt;/h2&gt;

&lt;p&gt;My technical approach to resolving this was two-fold:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;State Management on Visibility Change:&lt;/strong&gt; I added a &lt;code&gt;visibilitychange&lt;/code&gt; event listener. If the user navigates away, we instantly cancel the sequence and forcefully restore the original theme to prevent intermediate states.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error Handling for the View Transitions API:&lt;/strong&gt; The core issue was that browsers forcefully abort the &lt;code&gt;startViewTransition&lt;/code&gt; when a tab is hidden to save battery. This caused the &lt;code&gt;transition.ready&lt;/code&gt; Promise to reject. Because there was no &lt;code&gt;.catch()&lt;/code&gt; block, the unhandled rejection caused the entire async sequence to hang permanently. By wrapping the transition in a &lt;code&gt;try/catch&lt;/code&gt; and adding a &lt;code&gt;.catch(() =&amp;gt; resolve())&lt;/code&gt; handler, we guarantee that the execution flow always continues gracefully, even if the browser interrupts it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🤖 Best Use of Google AI
&lt;/h2&gt;

&lt;p&gt;I couldn't figure out why this bug was only happening &lt;em&gt;sometimes&lt;/em&gt;, and no errors were showing up in the console. So, I turned to my trusty pair programmer: &lt;strong&gt;Google AI integrated within the Antigravity IDE&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;What's really cool about my workflow is that I chat with my AI agent completely casually in Arabic. It feels incredibly natural, like brainstorming with a senior engineer sitting right next to me. But debugging with AI isn't always a "one-shot" magic trick. It’s an iterative journey. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Note: I interact with my AI agent natively in Arabic! For this post, I have translated our debugging conversation. I've kept the original Arabic screenshots on hand just in case the judges want to see them!)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Phase 1: The Misdiagnosis
&lt;/h3&gt;

&lt;p&gt;At first, I explained the symptoms loosely to the AI: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;"I have another issue. Sometimes the theme changes to dark suddenly and weird things happen. I don't know what it is."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The AI analyzed the code and thought the &lt;em&gt;animation feature itself&lt;/em&gt; was the bug (assuming it was just annoying the user). So, it enthusiastically offered a "fix" by completely disabling the showcase animation function! &lt;/p&gt;

&lt;p&gt;I had to intervene and correct its assumption: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;"Bro, no, you misunderstood! The animation at the beginning is natural and fine. What's NOT natural is leaving the website open, going to another tab, and coming back to find it permanently stuck on a new theme."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Phase 2: The Deep Dive
&lt;/h3&gt;

&lt;p&gt;Once I steered the AI in the right direction, it immediately dug into the mechanics of tab-switching. It realized that modern browsers aggressively pause &lt;code&gt;requestAnimationFrame&lt;/code&gt; when a tab goes to the background. &lt;/p&gt;

&lt;p&gt;The AI wrote the &lt;code&gt;visibilitychange&lt;/code&gt; listener, but then we ran into another issue when I was testing it locally with my dev server.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;"Why does it open on a different theme every time I hit save in my editor? I have to manually refresh to get my original theme back."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The AI assumed I was just being impatient with the 1.7-second animation delay during live-reloads:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;AI:&lt;/strong&gt; &lt;em&gt;"When you save, the dev server refreshes the page. The animation starts, switches to the showcase theme, and then returns. You are just manually refreshing before the 1.7 seconds finish, trapping yourself in a loop! Just wait 1.7 seconds."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Phase 3: The "Aha!" Moment
&lt;/h3&gt;

&lt;p&gt;I knew I wasn't just being impatient. The UI was &lt;em&gt;literally getting stuck&lt;/em&gt;. I pushed the AI to look deeper: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;"Bro, I'm not rushing. I open it, find it on a new theme, and it is completely STUCK on it. This causes problems if the user goes to another tab. Focus well, think carefully, and take your time."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s when the AI hit the absolute jackpot. &lt;/p&gt;

&lt;p&gt;It didn't just hand me a snippet of code; it provided a masterclass on browser mechanics. It analyzed the &lt;code&gt;View Transitions API&lt;/code&gt; behavior and uncovered the true root cause: to save battery and resources, modern browsers aggressively throttle or abort animations when a tab is hidden. This aggressive optimization was causing the &lt;code&gt;transition.ready&lt;/code&gt; promise to reject silently, which hung the entire async sequence because it lacked a &lt;code&gt;.catch()&lt;/code&gt; block.&lt;/p&gt;

&lt;p&gt;I initially asked the AI if we could just "force" the browser to play the animation in the background anyway. Instead of blindly agreeing, the AI pushed back and explained the engineering philosophy behind this: it’s a hard performance constraint built into modern browsers. You can't fight the browser's resource management. Instead, it taught me the "Best Practice": monitor the tab's state (which led to the &lt;code&gt;visibilitychange&lt;/code&gt; listener), gracefully catch any forced abortions (the &lt;code&gt;.catch()&lt;/code&gt; fix), instantly restore the original UI, and respect the browser's rules.&lt;/p&gt;

&lt;p&gt;Thanks to Google AI in the Antigravity IDE, I didn't just fix a bug—I learned exactly &lt;em&gt;why&lt;/em&gt; the browser was behaving that way under the hood. It transformed a frustrating debugging session into a profound learning experience about advanced JavaScript APIs and browser rendering mechanics. This is exactly what the future of pair programming looks like!&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>bugsmash</category>
      <category>webdev</category>
      <category>googleai</category>
    </item>
    <item>
      <title>Reviving Daphq: How I Built an Open-Source, Bare-Metal File Transfer Engine Solo with GitHub Copilot</title>
      <dc:creator>Omar Afifi</dc:creator>
      <pubDate>Wed, 27 May 2026 21:12:32 +0000</pubDate>
      <link>https://dev.to/omarafifi/reviving-daphq-how-i-built-an-open-source-bare-metal-file-transfer-engine-solo-with-github-copilot-5cd8</link>
      <guid>https://dev.to/omarafifi/reviving-daphq-how-i-built-an-open-source-bare-metal-file-transfer-engine-solo-with-github-copilot-5cd8</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/github-2026-05-21"&gt;GitHub Finish-Up-A-Thon Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Daphq&lt;/strong&gt; is a robust, open-source, cross-platform file transfer application engineered entirely from scratch to deliver hardware-saturating speeds over local area networks (LAN), Wi-Fi, and Mobile Hotspots. &lt;/p&gt;

&lt;p&gt;As a solo developer, I built Daphq to solve a personal frustration: the bloated overhead, privacy concerns, and artificial speed limits of conventional HTTP-based or cloud-reliant file-sharing tools. Daphq bypasses the standard Web/REST layer completely, establishing direct, bare-metal &lt;strong&gt;TCP Sockets&lt;/strong&gt; (&lt;code&gt;Socket&lt;/code&gt; &amp;amp; &lt;code&gt;ServerSocket&lt;/code&gt;) with &lt;code&gt;SocketOption.tcpNoDelay&lt;/code&gt; enabled to eliminate protocol latency and push network hardware to its absolute physical limits.&lt;/p&gt;

&lt;p&gt;Built using &lt;strong&gt;Flutter (Dart)&lt;/strong&gt; for seamless cross-platform performance (currently native on Android and Windows), Daphq features a highly decoupled architecture using the &lt;strong&gt;BLoC/Cubit&lt;/strong&gt; pattern, multi-gigabyte memory protection guards, and background network synchronization, and intelligent user guidance. &lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The entire project is completely open-source and free to review, fork, or run locally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🌐 &lt;strong&gt;Official Product Website:&lt;/strong&gt; &lt;a href="http://omar-afifi.com/daphq/" rel="noopener noreferrer"&gt;omar-afifi.com/daphq/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;💻 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/omarafifi-cse/daphq" rel="noopener noreferrer"&gt;github.com/omarafifi-cse/daphq&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Screenshots in Action
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Android UI Layout&lt;/th&gt;
&lt;th&gt;Windows Desktop Experience&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuhthhu31i9z3r5zp4c2v.png" alt="Android Interface" width="800" height="1666"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6s9qm7a2y59mo7hxic2o.png" alt="Windows Interface" width="799" height="510"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;em&gt;Clean, robust mobile layout with active background service tracking.&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Fluid, modern, and highly responsive desktop experience.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  The Comeback Story
&lt;/h2&gt;

&lt;p&gt;Daphq was born under high pressure, but after shipping the bare bones of version &lt;strong&gt;v1.0.0&lt;/strong&gt;, it was essentially abandoned in my local repository directory. The project had immense raw speed potential, but it was plagued by architectural gaps, clunky user workflows, and high-stress bugs that made it unviable for everyday users. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;GitHub Finish-Up-A-Thon Challenge&lt;/strong&gt; was the exact catalyst I needed to dust off the codebase and transform it from a fragile command-like utility into a highly polished, resilient consumer application (&lt;code&gt;v2.3.0&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Deep Evolution: v1.0.0 vs. v2.3.0
&lt;/h3&gt;

&lt;p&gt;Here is exactly how the architecture and UX matured over the course of this challenge:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Discovery, Connectivity &amp;amp; Resilience:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; Zero automation. Users manually typed cryptic IPv4 addresses, and any connection drop required a full app restart.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.3.0):&lt;/em&gt; A custom &lt;strong&gt;UDP Auto-Discovery Service&lt;/strong&gt; with an integrated watchdog. Backed by a rewritten, &lt;strong&gt;Bulletproof Receiver Engine&lt;/strong&gt;, the app instantly bounces back if a connection drops or cancels abruptly—never getting stuck on "Connecting...".&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Interface, Fluidity &amp;amp; Storage:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; Rigid layouts, storage bloat from cached files, and main-thread hangs (UI freezing) when selecting large directories.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.3.0):&lt;/em&gt; A unified dashboard anchored by an &lt;strong&gt;"Orbital Radar"&lt;/strong&gt; and Non-Blocking Async UI. Sharing 1,000+ files is now buttery smooth with zero lagging. Plus, it features &lt;strong&gt;Persistent Folders&lt;/strong&gt; to permanently remember your download path and &lt;strong&gt;Smart Auto-Cleaning&lt;/strong&gt; to wipe cache bloat automatically.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart User Guidance:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; Users suffered from slow transfers due to ISP router bottlenecks without knowing why.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.3.0):&lt;/em&gt; Integrated a real-time speed monitor that triggers a &lt;strong&gt;Smart Hotspot Guide&lt;/strong&gt; if speeds drop below 2.0 MB/s, guiding users to utilize 5GHz direct hotspots for up to 10x faster speeds.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Safety &amp;amp; Disk I/O Flow Control:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; High risk of Out-Of-Memory (OOM) crashes when streaming multi-gigabyte files due to unthrottled asynchronous disk reads.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.3.0):&lt;/em&gt; Implemented zero-copy byte slicing (&lt;code&gt;Uint8List.sublistView&lt;/code&gt;) and &lt;strong&gt;Natural Socket Backpressure&lt;/strong&gt; (&lt;code&gt;await socket.flush()&lt;/code&gt;). Daphq now self-throttles to match real-time network speeds, saving physical RAM.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deep System-Wide Integrations:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; Isolated sandboxed app.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.3.0):&lt;/em&gt; Deployed deep OS hooks, including native Android Share Menu entry and background execution. On Android, &lt;strong&gt;Instant Wake-up&lt;/strong&gt; intelligently turns on the screen for incoming requests. On Windows, the &lt;strong&gt;Context Menu Shell Extension&lt;/strong&gt; was completely rebuilt to be unbreakable, eliminating all File Explorer hangs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  My Experience with GitHub Copilot
&lt;/h2&gt;

&lt;p&gt;As a solo developer, you are the software architect, the UI designer, the QA technician, and the DevOps engineer all at once. Time is your greatest bottleneck. Throughout this sprint, GitHub Copilot didn’t just autocomplete lines of boilerplate—it acted as an incredibly knowledgeable senior engineering peer, unlocking complex architectural problems.&lt;/p&gt;

&lt;p&gt;Here are three distinct breakthroughs where GitHub Copilot completely changed the trajectory of the project:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Solving the Math of the Orbital Radar UI
&lt;/h3&gt;

&lt;p&gt;I wanted the home dashboard to feel alive with an evenly distributed, deterministic "Orbital Radar" circle showing available peer devices. Distributing dynamic widgets symmetrically on a circular plane without them overlapping can quickly become a headache.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copilot's Intervention:&lt;/strong&gt; By providing Copilot with my layout boundaries and device state arrays, it instantly mapped out the exact trigonometric distribution math using &lt;code&gt;cos&lt;/code&gt; and &lt;code&gt;sin&lt;/code&gt; over a mapped index. Furthermore, it proactively recommended assigning unique &lt;code&gt;ValueKey&lt;/code&gt;s to the dynamically generated widgets, preventing unnecessary re-paints and maximizing rendering performance on low-end hardware.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Eliminating the Windows FFI Mutex Deadlock
&lt;/h3&gt;

&lt;p&gt;A critical, highly frustrating platform bug on Windows caused Daphq to accidentally trigger background execution loops whenever a user performed completely unrelated right-click shell actions elsewhere in the OS. Worse, exiting the app caused a stubborn Dart VM deadlock.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copilot's Intervention:&lt;/strong&gt; I explained the process conflict to Copilot. It guided me through structuring a clean, platform-specific local session mutex check. When it came to bypassing the Dart VM shutdown hang, Copilot instantly generated the safe native Windows FFI code block to execute a clean &lt;code&gt;ExitProcess&lt;/code&gt; command, killing the deadlocks instantly and safely.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Engineering Flow-Safe Dynamic Streaming Buffer
&lt;/h3&gt;

&lt;p&gt;To stop aggressive disk-read bursts from triggering Out-Of-Memory exceptions, I needed a way to throttle file streams smoothly based on network capacity.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copilot's Intervention:&lt;/strong&gt; Copilot analyzed my asynchronous data-sync loop and suggested transitioning away from arbitrary chunk delay timers. It helped refactor the code to explicitly await &lt;code&gt;socket.flush()&lt;/code&gt; based on monitored &lt;code&gt;bytesBuffered&lt;/code&gt; thresholds. The result was an automated backpressure loop that scales throughput up or down safely based on real-time network conditions.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Standard path for larger files: stream in chunks&lt;/span&gt;
&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fileToRead&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;openRead&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_isCancelled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="s"&gt;"Transfer Cancelled"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="n"&gt;bytesBuffered&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bytesBuffered&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AppConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;socketFlushThresholdBytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Awaited flush: provides backpressure so the disk read loop&lt;/span&gt;
        &lt;span class="c1"&gt;// runs at network speed, not disk speed. Without this, a fast&lt;/span&gt;
        &lt;span class="c1"&gt;// UFS device would read the entire file in &amp;lt;500ms before any&lt;/span&gt;
        &lt;span class="c1"&gt;// onUpdate fires, causing the snapshot/stutter UI bug.&lt;/span&gt;
        &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;flush&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;bytesBuffered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_isCancelled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="s"&gt;"Transfer Cancelled"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;SocketException&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"reset by peer"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="s"&gt;"Receiver disconnected during transfer."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="k"&gt;rethrow&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// ... UI update logic &lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Verdict
&lt;/h2&gt;

&lt;p&gt;Building Daphq independently meant encountering dozens of architectural edge cases. Having GitHub Copilot available to instantly generate platform-specific guards, analyze multi-threaded socket behavior, and handle tedious Win32 registry bindings allowed me to focus on what mattered most: delivering a breathtakingly fast file transfer engine. &lt;/p&gt;

&lt;p&gt;Daphq went from an unpolished repository artifact to a production-grade open-source engine capable of hitting &lt;strong&gt;80-90 MB/s (~93% bandwidth saturation)&lt;/strong&gt; over a standard local Wi-Fi 5 connection. I couldn't be prouder of how this challenge ended.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>githubchallenge</category>
      <category>flutter</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
