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

> Source: <https://dev.to/polymath_arnav/compline-the-radical-laziness-of-sleep-building-an-offline-gothic-sanctuary-with-gemma-2-a-4mh2>
> Published: 2026-10-21 17:29:47+00:00

*This is my submission for the [Hacktoberfest Open-Source AI Challenge, Week 3: Slow and Steady](https://dev.to/challenges/hacktoberfest-week3-2026-10-19).* 🦥

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](https://dev.to/kennedyraju55/the-developers-guide-to-running-llms-locally-ollama-gemma-4-and-why-your-side-projects-dont-54oe), 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](https://dev.to/rainytechlab/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-4ngf), 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):

``` js
// 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. 🦥✨
