cd /news/generative-ai/compline-the-radical-laziness-of-sle… · home › topics › generative-ai › article
[ARTICLE · art-154735] src=dev.to ↗ pub= topic=generative-ai verified=true sentiment=↑ positive

Compline: The Radical Laziness of Sleep — Building an Offline Gothic Sanctuary with Gemma 2, a Real-Time 3D Astrolabe, and Vinyl Crackle

Developer Arnav, based in Bengaluru, built Compline, an offline gothic wind-down companion that runs Google's open-weight Gemma 2 model locally through Ollama to generate calming bedtime stories with a "hypnagogic decrescendo" prompt structure. The browser-based app pairs the local LLM with a real-time 3D celestial astrolabe that aligns 89 constellations to the user's actual sky via geolocation and sidereal time, plus a Web Audio vinyl-crackle phonograph and a tarot wheel. It was submitted to the Hacktoberfest Open-Source AI Challenge's Week 3 "Slow and Steady" prompt.

by read5 min views4 publishedOct 21, 2026

This is my submission for the Hacktoberfest Open-Source AI Challenge, Week 3: Slow and Steady. 🦥

I'm Arnav, from Bengaluru. For Week 1's "Touch Grass" challenge, I built WildTrail to get people outdoors. For Week 2's "Side Hustle", I built GhostLedger for sovereign freelancer tax intelligence.

For Week 3, the prompt honors International Sloth Day:

"Build something with open-weight models or open-source AI that rewards laziness: a tool for relaxation, an automation for a task you dread, or anything that makes life easier."

One of the challenge's suggested sparks caught my eye immediately:

"A wind-down companion that generates a calming bedtime story or ambient soundscape, running entirely offline."

So I decided to lean fully into radical laziness and built Compline: a candlelit gothic wind-down companion that transforms your nightstand into an ancient, tranquil monastic scriptorium.

Falling asleep in the modern world is an exhausting, high-friction chore:

Sloths have it figured out: move at your own pace, conserve your energy, and let the universe come to you.

With Compline, going to sleep requires zero cognitive effort:

flowchart TD
    subgraph Client ["Gothic Nightstand Sanctuary (Zero Dependencies)"]
        Candle["🕯️ Cinematic Candle Ritual (Match-Strike / Blackout)"]
        Astrolabe["🧭 3D Celestial Astrolabe (Real Sky LST Alignment)"]
        Phono["📻 Abbey Phonograph (The Needle & The Groove)"]
        Scribe["📜 Scriptorium Tome (Illuminated Ink Stream)"]
        Tarot["⚙️ Wheel of Fate & Gothic Slumber Tarot"]
        Grimoire["📖 Scriptorium Grimoire (Local Bookmark Storage)"]
    end

    subgraph AudioEngine ["Web Audio Procedural Engine"]
        Needle["📍 Needle Drop & Arm Physics"]
        Crackle["🪵 Vintage Surface Crackle (Pink Noise + Lowpass)"]
        Tracks["💿 Opus I: Nocturne / Opus II: Vespers"]
    end

    subgraph AI ["Open-Source AI & Hypnagogic Core"]
        Gemma["🧠 Google Gemma 2 (Local Ollama gemma2:2b / 9b)"]
        Offline["🕯️ Offline Hypnagogic Decrescendo Generator"]
    end

    Candle --> Astrolabe
    Phono --> AudioEngine
    Scribe --> AI

The nightstand sky isn't a generic looping starry wallpaper. It is an interactive 3D celestial sphere rendering 89 classical constellations (Ursa Major, Cygnus, Orion, Cassiopeia, Lyra, Taurus...), armillary coordinate rings, and the 7 classical wandering planets.

Tapping the dedicated [🌌 Tonight's Real Sky] header button queries your browser's Geolocation API, calculates the exact Greenwich Sidereal Time (GST) and Local Sidereal Time (LST) for your longitude, and rotates the entire celestial sphere so that the stars above your bed match what is overhead in reality.

A tactile analog player built entirely on the native Web Audio API:

Bedtime stories should never have cliffhangers, sudden shocks, or escalating conflict. Compline connects to local Gemma 2 (via Ollama at http://localhost:11434) using structured relaxation prompts designed around hypnagogic decrescendo:

An ornate brass-and-stained-glass mechanical wheel with procedural ratchet audio. Giving it a gentle spin draws from an 8-card Gothic Slumber Tarot deck (The Hermit of the Bell Tower, The Alchemist's Crucible, The Scribe of Midnight...) to seed the night's meditation.

Sleepers can bookmark chapters directly to their personal Grimoire, stored privately in the browser's local storage with zero cloud accounts.

In the DEV community discussion on running local LLMs, developer Kennedy Raju noted that side projects rarely need an external API key when open-weight models have gotten this good. And as highlighted in recent local AI benchmarks, running smaller models locally achieves real-time streaming speeds with zero network overhead.

Compline only works as a true sleep companion because of open-weight models:

Just like my previous challenge submissions, I made a commitment to test every detail and inspect real network and runtime behavior. That uncovered three tricky technical challenges:

After deploying a critical UI fix, I visited the live Vercel URL and noticed the changes weren't appearing. Opening terminal and inspecting HTTP response headers with curl -sI https://complineapp.vercel.app/ revealed the culprit:

HTTP/2 200 
age: 558
cache-control: public, max-age=0, must-revalidate
x-vercel-cache: HIT

Even with max-age=0, Vercel edge nodes (like bom1 in India) cache static assets at the CDN layer unless explicitly told otherwise. The fix was updating vercel.json to enforce edge invalidation across all routes:

{
  \"headers\": [
    {\n      \"source\": \"/(.*)\",\n      \"headers\": [\n        {\n          \"key\": \"Cache-Control\",\n          \"value\": \"no-cache, no-store, must-revalidate, max-age=0, s-maxage=0\"\n        }\n      ]\n    }\n  ]\n}

Setting s-maxage=0 forced edge cache misses (age: 0, x-vercel-cache: MISS) and instant propagation on every new commit!

Translating GPS coordinates into an accurate 3D celestial sphere required real celestial mechanics. Standard clock time doesn't match star time because the Earth rotates once relative to the stars in 23 hours, 56 minutes, and 4 seconds (one sidereal day).

To compute the celestial rotation angle, I implemented Greenwich Mean Sidereal Time (GMST) and Local Sidereal Time (LST):

// Calculate Julian Date from UTC
const jd = 2440587.5 + (date.getTime() / 86400000);
const d = jd - 2451545.0; // Days from J2000.0

// Greenwich Mean Sidereal Time in degrees
let gmst = (280.46061837 + 360.98564736629 * d) % 360;
if (gmst < 0) gmst += 360;

// Local Sidereal Time
let lst = (gmst + longitude) % 360;
if (lst < 0) lst += 360;

// Rotate the celestial sphere canvas
const lstHours = lst / 15;
stellarSky.rotationAngle = -(lstHours / 24) * Math.PI * 2;

Now, when you look at Cygnus or Ursa Major in Compline, they are in the exact same orientation as the real night sky outside your window.

During development, I got excited and spent hours building a volumetric stained-glass god-ray lighting engine ("Rose Window Prism"). It rendered animated caustic light shafts and chromatic dust motes across the screen.

When I actually tested it at bedtime, it felt completely wrong:

So I ruthlessly deleted all 400+ lines of it. Recognizing when to delete code is just as important as knowing what to write. Stripping away the excess left the sanctuary feeling peaceful, quiet, and effortless.

To give the Hacktoberfest judges a transparent look into how Compline was planned, built, tested, and polished, here is the complete recorded agent session:

To run it locally with zero external dependencies (pure Python 3 standard library):

git clone https://github.com/XiaoArnav/complineapp.git
cd complineapp
python3 app/server.py

Then visit http://localhost:7777.

Connect local Gemma 2 anytime with ollama run gemma2:2b.

May your nights be restful and peaceful. Channel your inner sloth. 🦥✨

── more in #generative-ai 4 stories · sorted by recency
── more on @arnav 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/compline-the-radical…] indexed:0 read:5min 2026-10-21 · —