π¦₯ The Doomscroll Derailer & Naptime Narrator
Built for the **Hacktoberfest Open-Source AI Challenge: Week 3* (Theme: Slow and Steady / International Sloth Day)*
π€ The Problem: When Willpower Fails at Midnight
It is 11:45 PM. You are exhausted from a long day. You get into bed, plug in your phone or laptop, and tell yourself: "I'll just check Reddit for five minutes."
Fast forward to 1:15 AM. You are eighty comments deep into a fiery debate between strangers about whether carbon steel pans are superior to cast iron. Your eyes are stinging from blue light. Your brain is hyper-stimulated, pumping cortisol and dopamine, completely detached from the physical reality that you have to wake up in five hours.
In honor of International Sloth Day, let's face an uncomfortable truth: willpower is a finite resource, and at 11:30 PM, your willpower is at absolute zero.
Sloths don't negotiate with high-dopamine algorithms. They don't refresh feeds. Sloths move at 0.15 miles per hour, conserve their energy, and let the world come to them.
So why shouldn't our AI do the work of unwinding for us?
π What I Built: The Doomscroll Derailer & Naptime Narrator
The Doomscroll Derailer & Naptime Narrator is an autonomous, completely offline desktop agent designed to reward laziness by de-escalating your late-night digital addictions without you lifting a finger.
Here is how it works:
- Quiet Window Guardian: A lightweight Python background watcher tracks active desktop window titles with zero CPU overhead.
- Bedtime Intervention: When it detects you active on Reddit, Twitter/X, TikTok, YouTube Shorts, or Instagram past 11:00 PM for longer than 10 seconds, it gracefully intercepts your display.
- Local AI Story Generation: It queries a local open-weight model (Llama-3.2-1B or Llama-3-8B-Instruct running via local Ollama or llama.cpp) to author an exquisitely mundane, extraordinarily slow bedtime story (e.g., "The detailed 45-minute journey of a sloth named Barnaby shifting his left claw by two centimeters across a wet cecropia branch").
- Sedative Voice & Soundscape: It pairs the story with a slowed, low-cadence offline voice narrator (pyttsx3 / Piper TTS) and a procedurally synthesized 432Hz sleep drone & canopy rain soundscape.
- Interactive Sleep Controls: Features an amber-tinted visual 4-7-8 breathing circle (breathe in for 4, hold for 7, exhale for 8) and a one-click "Surrender to Sleep" blackout button that turns the display pitch black while the rain and story gently bore you into deep slumber.
+-------------------------------------------------------------+
| ACTIVE DESKTOP WINDOW |
| ("Popular posts on Reddit - Chrome" @ 11:20 PM) |
+------------------------------+------------------------------+
|
[1] Native Win32 ctypes Watcher
v
+-------------------------------------------------------------+
| DOOMSCROLL DERAILER AGENT CORE |
| - Current time in Bedtime Window (11 PM - 6 AM)? -> YES |
| - Matches blacklist (Reddit, Twitter, Shorts)? -> YES |
| - Doomscroll duration > 10 seconds? -> TRIGGER! |
+------------------------------+------------------------------+
|
v
+-------------------------------------------------------------+
| OFFLINE INTERVENTION PIPELINE |
| |
| +-----------------------+ +-----------------------+ |
| | Local Llama 3 LLM | | Procedural Ambient | |
| | (Ollama / llama.cpp / | | Rain & 432Hz Drone | |
| | Offline Procedural) | | (Pure Python wave) | |
| +-----------+-----------+ +-----------+-----------+ |
| | | |
| v v |
| +-----------------------+ +-----------------------+ |
| | Sleepy Voice TTS | | Screen Interceptor | |
| | (Slow cadence 120wpm) | | (Typewriter + 4-7-8) | |
| +-----------+-----------+ +-----------+-----------+ |
+------------------------------+------------------------------+
|
v
π€ Peaceful, Restorative Sleep
π¦₯ The "Lazy Payoff": How Much Effort Does It Save?
The theme of Week 3 is rewarding laziness. Here is the quantified payoff:
- Willpower Expenditure: 0 Calories. You don't have to force yourself to close tabs or set difficult intentions. The agent catches you automatically and physically replaces the stimulating feed with a soporific environment.
- Sleep Reclaimed: 45 to 90 minutes per night. By derailing the algorithmic dopamine cycle within 10 seconds of starting, you avoid the typical 1-to-2 hour bedtime slip. That equates to over 7 hours of reclaimed sleep each week.
- Effort to Disconnect: A single keystroke. If you want to snooze, the sloth gives you 5 minutes of grace with gentle guilt; if you give in, one click blackouts the screen completely while the ambient rain rocks you to sleep.
π‘ Why Open Innovation & Offline AI Matters: The Pitch
In modern AI, the reflex is almost always: "Send a prompt to an external cloud API." For a bedtime agent, that approach is fundamentally flawed:
1. The Airplane Mode Paradox (Offline Independence)
When people want to wind down, sleep experts universally recommend putting devices in Airplane Mode or disconnecting Wi-Fi to stop the stream of midnight push notifications and messages. If your wind-down companion relies on an external server, turning off Wi-Fi breaks your app. Because the Doomscroll Derailer runs open-weight models locally, it works completely severed from the internet. You can be in airplane mode, in a cabin in the woods, or during a home broadband outageβyour sleep routine is 100% resilient.
2. Radical Privacy
Tracking active desktop window titles is sensitive. Nobody wants their browsing history, open documents, or midnight web sessions transmitted to a cloud telemetry server. Because our agent uses native local Windows APIs and an on-device Llama 3 instance, not a single window title, word of text, or bedtime metric ever leaves your machine.
3. Zero Subscriptions, Infinite Ownership
There are no monthly subscriptions, no API tokens, and no server maintenance costs. You own the code, you own the weights, and you can run it forever.
π¬ Technical Architecture & Deep Dive
The project is structured into five modular components:
1. The Win32 Active Window Watcher (watcher.py)
To avoid heavy dependencies, the watcher communicates directly with the Windows subsystem using Python's built-in ctypes:
- It attaches to the interactive desktop thread via
OpenInputDesktopandSetThreadDesktop. - Calls
GetForegroundWindowandGetWindowTextWat 1Hz with virtually 0.0% CPU usage. - Evaluates whether the current local time falls into the bedtime window (with support for midnight wrap-around: e.g., 23:00 to 06:00).
- If blacklisted keywords (
reddit,twitter,x.com,tiktok,youtube shorts, etc.) are detected continuously past the threshold (default: 10s), it fires the screen interceptor callback.
2. Multi-Tier Open-Weight LLM Story Engine (story_generator.py)
The bedtime storyteller has a multi-tier architecture:
-
Tier 1 (Local Ollama): Automatically checks
http://localhost:11434/api/tagsand streams inference through models likellama3.2:1borllama3:8b. -
Tier 2 (Local llama.cpp): Connects to any OpenAI-compatible local GGUF server at
http://localhost:8080/v1. - Tier 3 (Procedural Offline Sloth Engine): If no local LLM is currently installed or running, the system seamlessly falls back to a rich procedural story generation engine with zero dependencies, ensuring the app works out of the box on any laptop with 0ms delay.
3. Sedative Text-to-Speech (narrator_tts.py)
Standard TTS engines read at 180β200 words per minute, which is jarring and energizing. The Naptime Narrator tunes the speech synthesis rate down to 120β125 WPM, softening the cadence and introducing 1.2-second pauses between sentences to mirror the calm respiration of a sleeping animal.
4. Pure Python Procedural 432Hz Sound Synthesizer (ambient_audio.py)
Rather than shipping large 50MB audio files, the app generates its own sleep soundscapes algorithmically using the standard library wave and math modules:
- Brown-noise rain filter: A low-pass integrated white noise filter ($1/f^2$) that sounds like warm rain hitting broad tropical canopy leaves.
- 108Hz / 432Hz sub-octave drone: Synthesizes a calming harmonic drone that encourages theta brainwaves.
- Loops smoothly in the background using Windows
winsound.PlaySoundin an asynchronous thread.
5. The Melatonin-Friendly UI & 4-7-8 Breathing Guide (overlay_ui.py)
Built with Tkinter, the overlay suppresses blue light by employing a midnight obsidian background (#070913) paired with warm amber glow accents (#f59e0b). A pulsing canvas circle visualizes the scientifically proven 4-7-8 breathing relaxation technique while the story streams word-by-word like a drowsy typewriter.
π A Taste of the Mundane: Sample Generated Story
Here is an actual story generated on our local llama3.2:1b during testing when caught on Twitter:
"In the heart of the cloud forest canopy, a gentle three-toed sloth named Luna slowly made her way across a single, wispy branch. The soft rustle of leaves and the gentle hum of a distant waterfall created a soothing melody that wrapped itself around her.
As she moved, her claws clicked softly on the branch, the sound echoing through the stillness. Her eyelids, heavy with sleep, slowly blinked open, and she felt the gentle texture of the tree bark beneath her. The mist that clung to the forest floor began to form, veiling the world in a damp, gray veil.
Luna's breathing slowed, her chest rising and falling in a gentle rhythm. She paused, her nostrils flaring as she adjusted her position, and then continued her slow journey. The world outside remained, but Luna's focus was inward, lost in the quiet beauty of her surroundings.
Breathe in for 4, hold for 7, exhale for 8. Let the calmness of this moment settle within you, dear one. As you breathe, feel your eyelids growing heavy, your thoughts growing quiet. Allow yourself to let go, to surrender to the peacefulness of this slow, gentle world. Let go and fall asleep right now."
π₯οΈ Desktop Control Dashboard
The project includes an elegant Desktop Control Hub (python main.py):
- Live Monitor Tab: Real-time telemetry displaying the focused window, bedtime status, and a live progress meter tracking active doomscrolling seconds.
- Bedtime Story Lab: Test out stories on any topic and listen to the voice narrator anytime.
- Settings Tab: Configure bedtime start/end hours, customize the blacklist keywords, adjust narration speed, and pick your preferred LLM provider.
- Instant Interceptor Demo: Hit "β‘ Trigger Interceptor Now" at any time of day to experience the full-screen wind-down sequence.
π Try It Yourself
Requirements
- Windows 10/11
- Python 3.10+
- (Optional) Ollama with
llama3.2:1b
Quickstart
# Clone the repository
git clone https://github.com/shashiharanramvanam-crypto/doomscroll-derailer.git
cd doomscroll-derailer
# Install minimal dependencies
pip install -r requirements.txt
# Launch the Control Hub
python main.py
# Or experience an instant demo immediately
python main.py --demo
π¦₯ Conclusion
Hacktoberfest Week 3 asked us to channel our inner sloth and build open-source AI that rewards laziness. By shifting AI away from high-speed productivity and into slow, calming restorative care, The Doomscroll Derailer & Naptime Narrator proves that sometimes the greatest superpower of open innovation is helping us turn off the noise, disconnect, and finally get some sleep.
Happy International Sloth Day, and good night! π¦₯π€
Open-source repository, full source code, and test suite available on GitHub under the MIT License:
π github.com/shashiharanramvanam-crypto/doomscroll-derailer
Top comments (0)