<?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: Shalina Bhargava</title>
    <description>The latest articles on DEV Community by Shalina Bhargava (@shalinabhargava).</description>
    <link>https://dev.to/shalinabhargava</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%2F721897%2F03918440-df9b-43ee-bf27-127a42b2ee65.png</url>
      <title>DEV Community: Shalina Bhargava</title>
      <link>https://dev.to/shalinabhargava</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shalinabhargava"/>
    <language>en</language>
    <item>
      <title>Slothie: an on-device Gemma 4 sloth that learns your risky phone hours</title>
      <dc:creator>Shalina Bhargava</dc:creator>
      <pubDate>Mon, 26 Oct 2026 05:57:53 +0000</pubDate>
      <link>https://dev.to/shalinabhargava/slothie-an-on-device-gemma-4-sloth-that-learns-your-risky-phone-hours-40ak</link>
      <guid>https://dev.to/shalinabhargava/slothie-an-on-device-gemma-4-sloth-that-learns-your-risky-phone-hours-40ak</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&lt;/a&gt;, theme: Slow and Steady.&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;Slothie is a sloth that lives in your Android phone. It works out the hours of the day when you are most likely to reach for the phone, tells you which apps are behind each one, and a few minutes before those hours it sends a nudge with a one-tap &lt;strong&gt;nap&lt;/strong&gt;: Do Not Disturb, held for 30 or 60 minutes, released by itself.&lt;/p&gt;

&lt;p&gt;The whole thing is built around one lazy idea: &lt;strong&gt;the phone already knows.&lt;/strong&gt; Android keeps a log of which app was in front and when. Slothie reads that log on the device, slices it into a day-by-hour grid, and asks a simple question of each hour: on what share of days did you spend five or more minutes here? Rank by that chance times the usual minutes, skip the neighbours of a stronger hour, and you get your three &lt;em&gt;risk hours&lt;/em&gt;. Mine, the morning I took the screenshots: 2 AM (85% of days, YouTube, Chrome and Netflix), 6 PM (83%, WhatsApp, Chrome and YouTube) and midnight (85%, Chrome, YouTube and WhatsApp). Yesterday these times looked like 3 AM, 7 PM and 10 PM.&lt;/p&gt;

&lt;p&gt;To get the mood of the hour, slothie shows 4 moods: asleep when you are barely on the phone, chill at your normal pace, one eye open when a risky hour is close, wide awake with a sweat drop when you are well past normal.&lt;/p&gt;

&lt;p&gt;Why not digital wellbeing: The digital wellbeing app gives statistics that might sound scary but also unattainable and actionable, the gentle nudge with slothie actually finds the pattern and gives you a decision.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fraw.githubusercontent.com%2FShalinaBhargava%2Fslothie%2Fmain%2Fdocs%2Fmedia%2Fdemo.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%2Fraw.githubusercontent.com%2FShalinaBhargava%2Fslothie%2Fmain%2Fdocs%2Fmedia%2Fdemo.gif" alt="Slothie demo: the Today tab, the sloth waking up, a risk-hour nudge and a one-tap nap" width="800" height="400"&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;Today&lt;/th&gt;
&lt;th&gt;Hours&lt;/th&gt;
&lt;th&gt;Apps&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%2F1wm6m7yb0rr45q91eaj4.png" alt="Today tab: the sloth, pace against your usual, and the note Gemma wrote" width="800" height="1796"&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%2Fse5ngpv7rjvwq56642c7.png" alt="Hours tab: the three risk hours with their odds and the apps behind them" width="800" height="1796"&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%2Fd7az2xzm9h3gwuvwkxmd.png" alt="Apps tab: Gemma sorted the apps into categories, with manual overrides" width="800" height="1796"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&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%2F8d6m8x59d1hhcis9q36y.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%2F8d6m8x59d1hhcis9q36y.png" alt="A word from Slothie: the note Gemma 4 wrote on the phone, from the numbers above it" width="800" height="1796"&gt;&lt;/a&gt;&lt;/p&gt;

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


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ShalinaBhargava" rel="noopener noreferrer"&gt;
        ShalinaBhargava
      &lt;/a&gt; / &lt;a href="https://github.com/ShalinaBhargava/slothie" rel="noopener noreferrer"&gt;
        slothie
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Slothie 🦥&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;A sloth that lives in your phone, learns the hours you are most likely to pick it up, and
talks you into doing less.&lt;/strong&gt; Everything, including the language model, runs on the phone.&lt;/p&gt;
&lt;p&gt;Slothie reads Android's own usage log (the one Digital Wellbeing reads), turns it into an
hour-by-hour picture of your week, and finds your &lt;em&gt;risk hours&lt;/em&gt;: the hours of the day when you
are most likely to be on the phone, and for how long. A few minutes before each one it sends a
nudge with a one-tap &lt;strong&gt;nap&lt;/strong&gt;, which holds Do Not Disturb for a while and lets go by itself.&lt;/p&gt;
&lt;p&gt;Gemma 4 E2B, an open-weight model under Apache 2.0, runs on the device through LiteRT-LM. It
writes the sloth's daily note and sorts your apps into categories. It never computes a number
every statistic is Kotlin, and the model is handed finished…&lt;/p&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ShalinaBhargava/slothie" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;MIT licensed. Kotlin, Jetpack Compose, no backend, no accounts.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;The open-weight part.&lt;/strong&gt; Slothie runs &lt;strong&gt;Gemma 4 E2B&lt;/strong&gt; on the phone through &lt;a href="https://github.com/google-ai-edge/LiteRT-LM" rel="noopener noreferrer"&gt;LiteRT-LM&lt;/a&gt;, Google's on-device runtime. The weights are the &lt;a href="https://huggingface.co/litert-community/gemma-4-E2B-it-litert-lm" rel="noopener noreferrer"&gt;Apache 2.0 release on Hugging Face&lt;/a&gt;, 2.6 GB, downloaded once from inside the app over Wi-Fi (or pushed with adb). The GPU backend is tried first and CPU is the fallback. On a Pixel 9 the first load takes a few seconds and the note streams in at a comfortable reading pace.&lt;/p&gt;

&lt;p&gt;Gemma does two jobs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Writes the sloth's note.&lt;/strong&gt; It receives a small JSON of integers and app names (today's minutes, usual minutes by this time of day, pickups, longest break, the three risk hours with their odds and apps) and is asked for three short paragraphs: the riskiest hour, one lazy thing to do about it tonight, and one honest line about today.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sorts your apps.&lt;/strong&gt; It gets the list of app labels and package names and returns a JSON array of categories: Feed, Video, Game, Chat, Tool, Work, Health. Your own choices always override it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The deterministic part.&lt;/strong&gt; Every number is computed in Kotlin from &lt;code&gt;UsageStatsManager.queryEvents&lt;/code&gt;. One app is in front at a time, so a resume closes whatever was open; screen-off and lock close everything; blips under three seconds are dropped. Sessions are sliced at hour boundaries into a &lt;code&gt;minutes[day][hour]&lt;/code&gt; matrix. Hours that have not happened yet today are not counted as observed, so the morning never drags down the evening. There are unit tests for all of it.&lt;/p&gt;

&lt;p&gt;The split is deliberate and it is the same rule I would apply to any assistant that reads personal data: &lt;strong&gt;the model is a writer and a sorter, never an accountant.&lt;/strong&gt; If a figure is not in the JSON it is not in the note. The system prompt says so, and because the weights and the prompt are both open you can check.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nudges and naps.&lt;/strong&gt; Inexact &lt;code&gt;AlarmManager&lt;/code&gt; windows, twelve minutes before each risk hour, re-armed daily and after reboot. The nap action flips &lt;code&gt;NotificationManager.setInterruptionFilter&lt;/code&gt; to priority-only, schedules its own end, and posts an ongoing notification so you can end it early. No accessibility service, no overlay, no app blocking: a sloth does not fight you, it just makes the quiet option the easy one.&lt;/p&gt;

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

&lt;p&gt;A phone usage log is a diary. It says when you sleep, what you doom scroll, when you are at work and when you are not. I did not want to upload that to anyone, including a model provider, and I did not want to pay per token for a sloth to tell me to go to bed.&lt;/p&gt;

&lt;p&gt;Open weights make both problems go away. The model is on my phone, so the app works in airplane mode and the INTERNET permission exists for exactly one request: downloading the weights. There is no key to leak, no bill, no rate limit, and no terms-of-service change that can hid it behind a paywall. And because the weights are Apache 2.0, the prompt is in the repo, and the runtime is open source, the promise "the model never invents a number" is something you can read rather than something you have to trust.&lt;/p&gt;

&lt;p&gt;A closed API could have written a nicer paragraph. It could not have done it on a phone with the radio off.&lt;/p&gt;

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

&lt;p&gt;Slothie measures its own payoff with the same log it reads. The "Longest break" tile on the Today tab is the longest stretch since your first pickup without the phone; the risk-hour odds move as the days roll. The honest number from day one on my phone: 7 h 49 m by mid-afternoon against a usual 3 h 50 m, which is why the sloth was wide awake and asked to be put down.&lt;/p&gt;

&lt;p&gt;Effort saved: the three risk hours and the apps behind them took Android's own log plus about forty lines of Kotlin to find. I had never noticed the 3 AM one.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Best Use of Gemma&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>android</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
