This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend
What I Built
trance is a small Mac app that keeps you focused on what matters most to you in the moment.
To start, just type what you're doing ("answer emails", "study for my upcoming assignment", "do anything except doomscroll"), pick a track, and get on with your day. Every 45 seconds, a Gemma model running locally looks at what you've actually been doing. From there, it decides whether to stay quiet, nudge you back, or tell you it's time for five minutes away from the screen.
I built this for my friend that has mentioned previously having a hard time staying on track. He was looking for something that could help him focus, provide insights, and gently keep him on track.
Most focus apps block the websites or applications you don't want to visit: you list the bad sites and they slam the door. In my opinion, that doesn't fit how people actually drift away from their focused tasks. YouTube is a distraction until it's the lecture you need. Slack is a distraction until you're clearing your inbox. This app doesn't block anything. Instead, it tries to understand what you're doing, compared with what you said you wanted to do.
What it does:
- Notices drift. Each window you land on gets labeled against your intent: on-task or off-task, plus what kind of thing it is (work, reference, feed, video, game, etc.). The live view shows the label a few seconds after you switch.
- Nudges. When you continue drifting, a small card slides into view, just like a notification. This nudge is intended to bring you back on track without disruption, but also helps the model judge better throughout the session if you tell it that whatever you're doing is actually on-task.
- Recommends breaks. Each track has a working period and a recommended break period. If you remain on task, this app will let you continue working. If you start drifting, tab switching, or seem otherwise unfocused, it will suggest taking a break and show a nice calming visual during the break. Breaks are 5 minutes, but you can come back early or add time if you think you need it.
- Tracks. Deep Work, Study, Create, Admin Sprint and Cruise each set what on-task looks like, how much switching is normal and how often breaks come. You can also make your own track if you need something a little more customized, along with setting the intent for the session.
- Recaps. Whenever you end a session, Gemma writes a short summary of how the session went, any potential time sinks, what you did well, and what you could do better next time.
Screenshots
How I Built It
The open pieces: Gemma 3 4B (instruction-tuned), running locally in Ollama, inside a Tauri app written in Rust.
Gemma reads, then the Rust code decides. Every 45 seconds the model returns a structured opinion of how your focus is going. I used Ollama's format field, which takes a JSON schema, so that the answer always parses properly. Then plain code applies the rules: drift has to show up in two reads in a row before trance says anything, nudges have cooldowns, and flow is never interrupted.
What a 4B model got wrong, and what fixed it
This is the part that required the most time and attention. My first version of the prompt gave Gemma all of the raw activity logs and asked for a verdict. On a 12B Gemma model, this was a pretty good approach. The problem is that a 12B model running constantly while you're doing other work eats a lot of resources, and some people may not have the computer to handle that. When I switched to a 4B model and did a test run, the model decided that me spending 90% of my time on distractions instead of the task at hand was on-task. To combat this, the model now gets the window information and labels it, the Rust code calculates switch rates, scroll rates, typing, on-task time, etc., and the model then gets this structured information rather than being expected to do all of the calculations itself and getting less than ideal results.
Another problem was stale labels. Each window gets labeled the first time you open it, and that label sticks for the session. A browser card game got marked as work and stayed that way, making me look far more on-task than I was. Now the labeler also gets a screenshot of the window, and if a later check-in sees the screen and disagrees with the label, the label is corrected on the spot.
Why Does Open Innovation Matter?
Because of what trance has to look at. To do its job, trance sees every window title you have open, which sites you're on, and how much you're typing and scrolling. With the glance feature on, it sees a capture of your screen about every 45 seconds. With an open model in Ollama, the most private data trance handles never leaves the workstation or laptop. Screenshots are read and deleted, and session logs are plain JSONL files in the user's own directories. No third parties peeking at your usage, no training being done on your data, etc.
Cost and customization. If you're doing a full work day session, you're probably going to leave this running in the background, even while away from the computer. Running locally, each check-in costs nothing but a bit of battery; on a metered API, a full work day in the background adds up fast. Using Ollama also gives you access to a whole plethora of open models, so you can swap them on command to see what works best for your situation.
Where a closed model would have been easier: To be honest, a big hosted model would have needed fewer guardrails and probably would have produced better results more quickly. Most of my weekend went into making a 4B model reliable, but the solutions to those pesky edge cases turned into features that otherwise might not have been considered. The rules that decide whether trance interrupts you are just code that anyone can read: no black box, and no server calls.
My Agent Session
I've always had a weak spot with frontend development and making things look professional, clean, and polished. Because I used Claude Code to create the user interface, I was able to spend my time where I shine best, building the functionality. Claude also helped me track down a few bugs with rendering and permission issues.
Prize Categories
- Best Use of Gemma: Gemma 3 4B runs locally through Ollama. It reads user intent, labels windows (with vision), judges focus every 45 seconds, and writes the session recap, all with no cloud calls!



Top comments (0)