跳到正文
DEV Community· Chestly Ace·· 3 小時前AI 評分47

Do It or Dodge It:Gemma 手機應用程式助用戶拆解待辦任務或生成藉口

Do It or Dodge It: a Gemma on my phone either shrinks the task or writes the excuse

AI 導讀

Do It or Dodge It 是一款 Android 應用程式,使用手機上的 Gemma 4 將用戶想逃避的任務拆成小步驟,或代寫藉口,並記錄及預測用戶容易迴避的任務。Gemma 4 有 E2B 和 E4B 兩種版本,應用程式根據迴避風險安排提醒;模型下載後,任務及運作均留在手機上,毋須伺服器、帳戶或網絡。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

You know the task. The email you have been meaning to send, the form with one box you can't fill in, the thing that has sat at the top of your list for two weeks. It is not hard. It is just big enough to avoid.

Do It or Dodge It is an Android app with exactly one idea: when you add a task you are avoiding, you get two honest buttons.

  • Do It. A Gemma model running on your phone breaks the task into steps so small they are hard to refuse. The first one always takes under two minutes. It drafts the email or the outline if you want, and then nudges you, slowly and steadily, about only the next step.
  • Dodge It. Gemma writes you an excuse. You copy it or send it through the Android share sheet. The dodge is logged, not hidden.

Either way the app notices. It learns which kinds of tasks you tend to dodge, shows you a risk score with a one-line reason ("You dodge admin tasks 70% of the time"), and uses that score to pace the nudges: a task you usually dodge gets more of them, closer together.

All of it runs on the phone. After a one-time model download there is no server, no account and no network use.

Demo

The APK is on the releases page. It needs Android 11 or newer, a 64-bit ARM phone and 4 GB of RAM or more.

Code

GitHub logo chestlyace / Do-it-Or-Dodge-it

Do It or Dodge It is an Android app, built in Flutter, that runs entirely on the phone: an on-device Gemma model either shrinks a task you are avoiding into tiny steps or writes you a believable excuse, and the app learns which tasks you tend to dodge.

Do It or Dodge It

An Android app that runs entirely on your phone. You add a task you are avoiding, then pick one of two buttons:

  • Do It: an on-device Gemma model breaks the task into steps so small they are hard to refuse (the first takes under two minutes), drafts what it can (an email, an outline), and sends you slow, steady nudges about the next step until it is done.
  • Dodge It: Gemma writes an excuse you copy or share through the Android share sheet. The dodge is logged, never hidden.

The app learns which tasks you tend to dodge, shows a dodge risk with a one-line reason, and uses it to pace the nudges. It all happens on the phone. After a one-time model download there is no server, no account and no network use, and your tasks never leave the device.

Built for…

How I Built It

Stack: Flutter and GetX on Android; Gemma 4 (E2B and E4B) running on the phone through LiteRT-LM via flutter_edge_ai; drift for the local SQLite database; flutter_local_notifications and workmanager for nudges and background jobs; and a dodge predictor written in plain Dart.

Making a small on-device model reliable

The interesting engineering is in making a small model dependable. The app gives Gemma four jobs: shrinkTask, helpWithStep, writeExcuse and nudgeWording. Each one asks for JSON in a fixed shape, and I validate the reply in code instead of trusting it:

  • three to seven steps, the first under two minutes, no empty fields;
  • an excuse that is not about health, death, legal trouble or an emergency;
  • not a repeat of one of the last five excuses written for the same person.

If a reply fails, the app retries once with a stricter instruction that says exactly what was wrong. If it fails again, it shows the model's raw text and the reason. It never crashes, and it never pretends.

Getting the model onto the phone

On first launch the app reads the phone's RAM and free storage and recommends a model: E2B (about 2.6 GB) for most phones, E4B (about 3.7 GB) at 8 GB of RAM or more. The file comes from Hugging Face's public litert-community repositories, pinned to a commit and checked against its SHA-256 before the app will use it. The download runs in a foreground service, resumes if interrupted, and can be limited to Wi-Fi.

The model loads only when you first tap Do It or Dodge It, and is released when the app goes to the background, so 3 GB of weights don't hold your RAM while you're elsewhere. If the GPU can't load it, the app retries on the CPU:

try {
  model = await _runtime.load(options);
} catch (e) {
  if (options.backend == ModelBackend.cpu) rethrow;
  model = await _runtime.load(options.copyWith(backend: ModelBackend.cpu));
  fellBackToCpu.value = true;
}

Slow and steady nudges

The nudges are plain local notifications, so firing one never needs the model. Each message is written once, stored and reused. Low, medium and high risk tasks get 2, 4 or 6 nudges a day, never between 21:00 and 09:00 by default, and each one names only the next undone step, never the whole task. A daily background job plans the next day, and nudges come back after a restart.

The theme fit the product by accident. A big task becomes a sequence of things you can do in a minute, delivered at a pace set by how likely you are to dodge it.

The dodge predictor

The risk score is a small logistic regression written in plain Dart and trained on your own outcomes: a few hundred rows at most, retrained after every task you finish or dodge. For your first twenty outcomes it uses a simple rule instead (how often you have dodged that category), because a model trained on five examples is just a guess in a nicer font.

What the numbers look like

The full tables are in docs/benchmarks.md.

What I learned

Check that your library is alive before you plan around it. I planned the whole app around flutter_gemma. When I added it, pub.dev said it was discontinued, and its last release pointed everyone to flutter_edge_ai. I switched before writing code against it. The move also showed me that the on-device engine needs Android 11 and a 64-bit ARM phone, so my minimum Android version changed. Better to learn that at the start than on release day.

Don't assume a model is locked. I had decided users would need a Hugging Face token because "Gemma is gated". Checking the actual files showed the Gemma 4 LiteRT builds are public and Apache 2.0. That removed a whole class of problem: no token in the app, nothing to leak.

Features can leak the answer. My first design for the risk score used the number of steps Gemma produced as a feature. But only tasks you do get steps, so the model would have "learned" that steps mean done, true only because of which button you pressed, and every new task would have looked risky. Now the features are saved at the moment you choose, before any steps exist, and I wrote the limitation down instead of hiding it.

Edge cases hide in plain sight. A "last call" nudge is supposed to be the final one before the deadline. With a date-only due date and quiet hours starting at 21:00, no nudge ever landed close enough to the deadline to count. The fix was to define it as the last nudge that fits, not one within a fixed gap.

Tests that drive the real screens find real bugs. Running them at twice the normal text size found two layouts that overflowed (a button hidden in the add-task sheet, and the counts cut off in History) and a confirmation message that appeared somewhere you could not see it.

Why Does Open Innovation Matter?

This is the part the app could not exist without.

  • It works offline. A procrastination app is most useful at exactly the moments you have no patience for a spinner or a missing signal. The model is on the phone, so airplane mode changes nothing.
  • Your data stays yours. What you are avoiding is some of the most personal data there is: the awkward email, the money form, the call you dread. Here it never leaves the device. The only network request the app ever makes is downloading the model, and that is only possible because the weights are open: I download them once and run them myself.
  • It costs nothing to run. No API key, no per-token bill, no server to keep alive. The Gemma 4 files need no account or token, so there is nothing secret to ship in the APK.
  • The model can be swapped. Two sizes, picked per phone, and all model code sits behind one small interface, so a better open model later is a small change, not a rewrite.

My Agent Session

The Lazy Payoff

The laziest feature is one you never see: while your phone charges, a background job quietly writes nudge text and a general excuse for your open tasks, so tapping Dodge It shows one instantly. The app does its thinking while you sleep.

Prize Categories

  • Best Use of Gemma: the whole product is Gemma 4 running locally on the phone, doing four jobs (shrinking a task, drafting a step, writing an excuse, wording a nudge), with validation around it so a small model is dependable.

Try it: APK · source.

來源:DEV Community · dev.to