DEV Community

Sanchit
Sanchit

Posted on

SlothHaven: The 100% Local AI Sleep Sanctuary & Overnight Triage Agent

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission πŸ¦₯

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

What I Built

Every morning, millions of developers and digital professionals wake up to the same anxious ritual: an avalanche of 400+ unread notifications across WhatsApp, Slack, Discord, and GitHub. Sifting through noisy chatter, repetitive memes, and bots just to find the two critical deadlines takes 30 to 45 minutes of frantic scrolling before your morning coffee is even poured.

In honor of International Sloth Day, I built SlothHaven: an open-source, on-device AI workspace engineered for radical cognitive rest and zero-effort morning productivity. SlothHaven unites two complementary halves:

1.The Sleep Sanctuary: A 100% offline wind-down companion featuring procedural Web Audio soundscapes (rain on jungle canopy, crackling hearth, 432Hz theta binaural beats) and slow-paced bedtime stories powered by Google Gemma 2 to quiet an overactive mind.
2.The Overnight Triage Agent: A slow, steady local background agent that parses messy group chats (WhatsApp, Slack, Discord) and GitHub notification dumps while you sleep. It purges 90%+ social noise, extracts urgent action items (deadlines, payments, direct requests), and hands you a 2-Line Morning Sloth Brief before your morning tea.

Who Gets to Be Lazier Because of It?

  • Developers & Tech Leads: Who dread the 8:00 AM Slack wall of text and want direct action items isolated from team banter.
  • Freelancers & Students: Managing chaotic flatmate WhatsApp groups and client updates with zero risk of confidential discussions leaking to third-party cloud AI servers.
  • Anyone Struggling with Digital Burnout: Who wants to switch their laptop to Airplane Mode at night, enjoy real offline ambient soundscapes, and wake up to a clear, calm summary.

Demo

SlothHaven runs locally as a sleek, dark-mode glassmorphic application:

Terminal URL: http://127.0.0.1:8000
Enter fullscreen mode Exit fullscreen mode

Key UI Capabilities:

  1. Procedural Web Audio Soundscapes: Generates infinite offline soundscapes (Canopy Rain 🌧️, Crackling Hearth πŸ”₯, 432Hz Deep Theta Drift 🌊, Midnight Forest 🌲) via native Web Audio API oscillatorsβ€”zero external MP3 downloads required.
  2. Google Gemma 2 Bedtime Story Companion: Weaves low-stimulus, calming nighttime stories and delivers daily "Sloth Wisdom" reflections on why rest is productive.
  3. The 2-Line Morning Sloth Brief: Condenses multi-channel overnight chaos into Sloan the Sloth's signature executive summary.
  4. The Lazy Payoff Meter: Real-time KPI tracking showing Minutes Saved, Noise Messages Purged, and % Noise Reduction.
  5. Action Items Matrix: Filterable cards categorizing items into 🚨 Needs You Today, 🟑 Decisions & Commitments, and 🟒 Context & FYI, complete with 1-click completion checkboxes synced to SQLite.
  6. Audio Morning Briefing: Sloan the Sloth voice playback (via ElevenLabs or offline browser Speech Synthesis) so you can listen with your eyes closed.
+-----------------------------------------------------------------------------------------+
|  πŸ¦₯ SlothHaven v1.0                     [🟒 100% Local Β· Offline-Ready Β· Air-Gapped]   |
+-----------------------------------------------------------------------------------------+
|  [πŸŒ™ Sleep Sanctuary]  [β˜€οΈ Morning Brief]  [🚨 Action Matrix]  [πŸ§ͺ Overnight Sim]        |
|                                                                                         |
|  πŸ“œ THE 2-LINE MORNING SLOTH BRIEF:                                                     |
|  "Overnight calm maintained: Sloan filtered 412 chatter messages across #Flatmates,     |
|   #proj-payments-core, leaving you with zero noise to sift through.                     |
|   You have 2 urgent items requiring attention today (Wifi recharge β‚Ή899 & PR #318 review);|
|   everything else can wait while you enjoy your tea."                                   |
|                                                                                         |
|  [ ⏱️ 48 min Saved ]  [ πŸ—‘οΈ 412 Noise Purged ]  [ πŸ“‰ 93.4% Reduction ]  [ πŸ’¬ 441 Scanned ] |
+-----------------------------------------------------------------------------------------+
Enter fullscreen mode Exit fullscreen mode

Code

Quick Local Setup:

# Clone the repository
git clone https://github.com/sanchitagarwal/SlothHaven.git
cd SlothHaven

# Launch with one command
./run.sh
Enter fullscreen mode Exit fullscreen mode

Tested on Python 3.10+ (macOS, Linux, Windows) and Docker.


How I Built It

SlothHaven is engineered around a local-first, dual-engine open-source AI architecture:

flowchart TD
    subgraph NightSanctuary ["πŸŒ™ Nighttime Sleep Sanctuary (100% Offline)"]
        Audio["🎡 Procedural Web Audio Engine<br/>(Rain, Campfire, 432Hz Theta Waves)"]
        Story["πŸ“– Gemma 2 Bedtime Storyteller<br/>(Low-stimulus calming narratives)"]
        Wisdom["🌿 Daily Sloth Wisdom<br/>(Sloan the Sloth aphorisms)"]
    end

    subgraph OvernightAgent ["πŸ’€ Overnight Autonomous Triage (Gemma 2)"]
        Inputs["πŸ“₯ Ingestion Queue<br/>(WhatsApp, Slack, Discord, GitHub)"]
        NoiseFilter["🧹 Stage 1: Deterministic Noise Purge<br/>(Purges gm, lol, emojis, status bots)"]
        GemmaReasoner["🧠 Stage 2: Google Gemma 2 Reasoner<br/>(Local Ollama / Embedded Fallback)"]
        Dedupe["βš–οΈ Needs-You Action Matrix<br/>(Urgent Deadlines, Payments, Mentions)"]
        DB[("πŸ’Ύ Local SQLite Ledger<br/>data/slothhaven.db")]
    end

    subgraph MorningPayoff ["β˜€οΈ Morning Sloth Payoff"]
        Brief["πŸ“œ The 2-Line Morning Brief<br/>(Executive overnight summary)"]
        LazyMetric["⚑ The Lazy Payoff Card<br/>(Minutes saved, % noise filtered)"]
        VoiceBrief["πŸŽ™οΈ Sloan Audio Briefing<br/>(ElevenLabs / Web Speech Synthesis)"]
        Matrix["βœ… 1-Click Action Checklist"]
    end

    Inputs --> NoiseFilter
    NoiseFilter --> GemmaReasoner
    GemmaReasoner --> Dedupe
    Dedupe --> DB
    DB --> Brief
    DB --> LazyMetric
    DB --> Matrix
    Brief --> VoiceBrief

1. Google Gemma 2 Open-Weight Intelligence

The core intelligence engine uses Google Gemma 2 (gemma2:2b / gemma2:9b). Gemma 2 was chosen for its outstanding reasoning density, compact parameter footprint, and strict adherence to structured JSON schemas on consumer hardware.

I implemented Gemma 2's native instruction turn formatting:

system_instruction = (
    "You are SlothHaven, an expert local AI triage co-pilot powered by Google Gemma 2.\n"
    "Extract ONLY high-priority action items that specifically need the user.\n"
    "Skip completed tasks or chatter involving other people.\n"
    "Return JSON adhering strictly to schema."
)

prompt = (
    f"<start_of_turn>user\n"
    f"{system_instruction}\n\n"
    f"{formatted_messages}<end_of_turn>\n"
    f"<start_of_turn>model\n"
)
Enter fullscreen mode Exit fullscreen mode

2. Two-Stage Noise Cancellation Funnel

Feeding 500 raw messages directly into an LLM is inefficient and wastes compute. SlothHaven uses a two-stage filter:

  • Stage 1: Deterministic Heuristic Noise Filter (<5ms): Strips social filler (gm, lol, haha, stickers, pure emojis, and bot uptime pings) while preserving timestamps, currency amounts (β‚Ή, $), relative dates (kal, tonight, tomorrow), and explicit user mentions.
  • Stage 2: Gemma 2 Action & Semantic Reasoner: Understands context, questions, and decisions to classify items into the Needs-You Action Matrix.

3. Dual-Engine Zero-Friction Fallback

To ensure SlothHaven runs out of the box for anyone without requiring a 5GB model download or GPU setup:

  • If a local Ollama daemon is active, it runs live Gemma 2 model inference.
  • If no daemon is present, it seamlessly engages an embedded deterministic local heuristic NLP engine that implements identical extraction logic.

4. Zero-Dependency Procedural Audio Engine

Instead of bundling hundreds of megabytes of audio assets, SlothHaven synthesizes soundscapes in real-time using the Web Audio API:

  • Rain: Brownian noise passed through lowpass biquad filters.
  • Campfire: Low-frequency triangle oscillation + stochastic square crackle pops.
  • 432Hz Theta: Dual stereo sine waves at 432 Hz and 436 Hz generating a 4 Hz theta binaural beat for deep restorative sleep.

Why Does Open Innovation Matter?

Open innovation is not just a feature of SlothHaven β€” it is the only reason this application can exist:

1. Absolute Data Sovereignty for Personal Conversations

Group chats contain our most sensitive conversations: roommate rent discussions, family medical news, private gossip, and confidential client Slack channels. Uploading this intimate stream to closed cloud AI APIs (like OpenAI or Anthropic) surrenders data ownership and violates client NDAs. With open-weight Gemma 2, your conversations never leave your laptop.

2. Zero Token API Tax ($0.00 Running Cost)

Closed AI wrappers are burdened by per-token margins. Summarizing 500 multi-channel messages every night across a year would consume millions of tokens, costing \$15–\$30/month in SaaS bills. Because Gemma 2 executes locally on your CPU or Apple Silicon, our marginal operating cost is $0.00 forever.

3. True Airplane Mode Sleep

To achieve restorative sleep, we should turn off Wi-Fi and disconnect from the network. Closed APIs fail completely the moment Wi-Fi is disabled. SlothHaven operates completely air-gapped: you can enable Airplane Mode, listen to procedural soundscapes, and let the agent triage offline.

4. Resilience & Model Ownership

Closed AI providers regularly deprecate models, enforce unexpected censorship, and change pricing. Open weights mean the software you run today will continue working 5 years from now on your own hardware.


The Lazy Payoff

The lazy payoff of SlothHaven is not theoretical: it is measurable every single morning.

Measured Efficiency from Multi-Channel Overnight Run:

  • Total Messages Scanned: 441 messages across WhatsApp, Slack, and GitHub
  • Chatter Messages Purged: 412 messages (greetings, memes, bot pings)
  • Noise Reduction: 93.4%
  • Cognitive Reading Time Saved: 48 minutes
  • High-Priority Action Items Flagged: 2 items (Wifi recharge due β‚Ή899; review Stripe webhook PR #318)
  • Cloud API Calls Required: 0 (100% offline isolation)

Instead of waking up to anxiety and scrolling for 45 minutes, you glance at two lines, check two boxes, and enjoy your morning tea at a sloth's pace. πŸ¦₯β˜•


🌐 Community Wisdom

In engineering SlothHaven's local-first architecture, I drew heavily upon proven patterns shared by the DEV community:

πŸ›‘οΈ [The Cloud Is Now Optional: Inside the Offline AI Stack You Can Actually Run Today] πŸ‘€ @paullovelace β€” Paul emphasizes that local open-weight AI is now mature enough to deliver genuinely usable privacy-preserving workflows on consumer hardware without cloud dependencies. πŸ”— Read Full Discussion on DEV

βš™οΈ [Local Meeting Notes with Whisper Transcription + Ollama Summaries (Gemma3n, LLaMA, Mistral) β€” Meetily AI] πŸ‘€ @zackriya β€” Zack demonstrates that combining local Ollama model inference with strict temperature tuning eliminates hallucinations when extracting action items from conversational transcripts. πŸ”— Read Full Discussion on DEV

⚑ [How to Summarize PDFs Locally with Open-Source LLMs (No API, No Data Leaving Your Machine)] πŸ‘€ @aitools_overview β€” Demonstrates that filtering document noise before passing tokens to open-weight models dramatically reduces latency and memory usage on personal laptops. πŸ”— Read Full Discussion on DEV


Prize Categories

I am officially entering SlothHaven into:

1. πŸ¦₯ Grand Prize: Hacktoberfest Week 3 "Slow and Steady"

Embodying International Sloth Day: slowing down, recharging with procedural soundscapes, and letting an autonomous local agent do the heavy lifting while you rest.

2. πŸ’Ž Featured Partner Category: Best Use of Gemma ($200 USD)

  • Module: backend/gemma_engine.py
  • Built on open-weight Google Gemma 2 (gemma2:2b / gemma2:9b).
  • Implements Gemma 2's native turn format (<start_of_turn>user ... <end_of_turn>).
  • Powers both the bedtime storytelling sanctuary and structured JSON multi-channel action extraction.

3. πŸŽ™οΈ Partner Category: Best Use of ElevenLabs ($100 USD)

  • Module: backend/integrations/elevenlabs_service.py
  • Sloan the Sloth soothing voice briefing via eleven_multilingual_v2, backed by an offline browser speech synthesis fallback.

4. πŸ”­ Partner Category: Best Use of Sentry Agent Tracing ($100 USD)

  • Module: backend/integrations/sentry_tracing.py
  • Zero-overhead distributed span instrumentation across slothhaven.sanctuary, slothhaven.triage, and slothhaven.gemma.

πŸ¦₯ Parting Sloth Thoughts

In a world addicted to constant hustle, notification badges, and frantic reaction speed, choosing to move slowly and deliberately is a superpower.

Close your tabs, put on the canopy rain soundscape, turn off your Wi-Fi, and let Google Gemma 2 handle the busywork while you sleep. Happy International Sloth Day! πŸ¦₯πŸ‚

Top comments (0)