Skip to content

About

An ofrenda for the dead web: a candlelit 3D closet of dead websites, read aloud by an open-weight Gemma ghost.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

Closet 404

An ofrenda for the dead web. A candlelit walk-in closet of websites that went dark, pulled back out of the Wayback Machine. Take a case off the shelf and hold a séance: an open-weight Gemma 4 model speaks as the site, remembering only what survived in its archived HTML.

Built for the Hacktoberfest 2026 Open-Source AI Challenge, week 4: Ghost in the Machine.

stack stack stack


What you can do

Walk the closet Drag to look, scroll to lean in, W/S to crouch. 31 real sites sit on the shelves among unlabeled blanks, under papel picado, candles and cempasúchil.
Pull a case Click a spine. The case flies to you and turns to show its cover: a period browser window drawn from the site's real scraped text and its first HTML comment. Drag to spin it; the back cover carries the eulogy.
Hold a séance Chat with the site's ghost. Gemma is given the snapshot's HTML comments, image filenames, generator tag and body text, and told to quote them verbatim and to admit what it doesn't know. Quotes are highlighted in marigold so you can check them against the Remains tab.
Read the coroner's report The snapshot only remembers a site alive. The coroner runs a live Google search (SerpApi) for how it ended, and Gemma summarises only those results with [n] citations.
Inspect the remains The raw forensics: comments, images, outbound links, generator, page text, capture years, and what the address returns today. Nothing on that tab was written by a model.
Shine the flashlight Search by memory ("UFO", "free music", "dating"). Matching spines glow marigold and slide out.
Resurrect a URL Paste any dead domain. The server queries the CDX index, fetches the original bytes with the id_ replay flag, extracts forensics, asks Gemma for a eulogy and shelves a new case for your session.
Leave a marigold A remembrance note on the site's ofrenda, stored in your browser.
Hear the ghost Replies can be voiced through ElevenLabs (when a key is set) or the browser's own speech synthesis.

Every AI-written field (eulogy, persona, tags, séance replies, coroner finding) is labeled with the model that wrote it. Every scraped field links to its archive.org source.


Why open weights

The web in this closet did not die for lack of storage. It died when somebody switched it off: a host shut down, a startup ran out of money, a platform changed its mind. An archive of switched-off things should not itself depend on a service that can be switched off.

  • It runs with the lights off. Point LLM_BASE_URL at Ollama and the whole app, séances included, runs on your machine with no API keys. The data is committed to the repo.
  • One env var swaps the host, not the model. Locally it's gemma4:e4b through Ollama; the hosted demo calls the same Gemma 4 open weights through Google AI Studio's OpenAI-compatible endpoint because Render has no GPU. Same client, same prompts (src/lib/llm.ts).
  • Reproducible. The eulogies in data/archive.json were generated by Gemma 4 and record which variant wrote each one. Anyone can regenerate them with npm run data:ghosts -- --force and diff.
  • Costs nothing to run. Local inference is free; the hosted demo fits the AI Studio free tier.

Honest limits are at the bottom.


Run it locally (no keys)

npm ci
cp .env.example .env.local      # defaults to Ollama + gemma4:e4b
ollama pull gemma4:e4b
npm run dev                     # http://localhost:3000

gemma4:e4b wants roughly 16 GB of RAM to answer at a conversational pace. On an 8 GB machine it works but swaps; use the hosted option below or a smaller Gemma.

Hosted model instead

LLM_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/
LLM_MODEL=gemma-4-31b-it
LLM_FALLBACK_MODEL=gemma-4-26b-a4b-it
LLM_API_KEY=<Google AI Studio key>

Optional: SERPAPI_API_KEY for live coroner inquests, ELEVENLABS_API_KEY for the ghost's voice.


How the data was built

Nothing in data/ is hand-written. Scripts produce all of it from real fetches:

Script What it does
npm run data:build (scripts/build-archive.ts) For each URL in data/seed-urls.txt: queries the Wayback CDX API (4 s between requests, backs off on 429/503), picks an early capture with real HTML, fetches it with the id_ modifier (original bytes, no toolbar), decodes the charset, extracts forensics with cheerio, checks what the live URL returns today, and asks the model for title / category / eulogy / persona / tags. Raw HTML is kept in data/raw/.
npm run data:ghosts (scripts/regen-ghosts.ts) Re-runs only the model step over the stored forensics. No archive.org traffic.
npm run data:coroner (scripts/coroner.ts) One SerpApi Google search per domain for how it ended, then a Gemma summary that may only cite those results. Writes data/coroner.json.
scripts/prune.ts <id> Removes a curated-out entry and renumbers spines. (Used once: delicious.com's 1996 snapshot turned out to be an adult link index.)

Capture years are what the CDX index reports, not birth and death dates. A domain can keep getting captured as a parked page long after the site died, which is why some "last captured" years are recent; the coroner tab carries the real story.


Architecture

data/seed-urls.txt
   │  scripts/build-archive.ts      Wayback CDX ─▶ id_ raw HTML ─▶ cheerio forensics ─▶ Gemma 4 (JSON)
   â–¼
data/archive.json + data/raw/*.html
   │  scripts/coroner.ts            SerpApi web search ─▶ Gemma 4 cited summary
   â–¼
data/coroner.json
   │
   ├─ /                 3D closet (R3F, client-only)  ── /api/seance   streaming Gemma ghost
   ├─ /archive          editorial index               ── /api/search   BM25 over tags, eulogy, body
   └─ /site/[id]        static dossier per site       ── /api/resurrect live CDX + Gemma
                                                       ── /api/coroner  live SerpApi inquest
                                                       ── /api/voice    ElevenLabs TTS (optional)
  • src/lib/llm.ts: one fetch-based OpenAI-compatible client. Strips Gemma's <thought> blocks (streamed or not), retries 429/5xx once, then falls back to LLM_FALLBACK_MODEL.
  • src/lib/seance.ts: the ghost's system prompt. SOURCE is the snapshot; RECORDS are coroner citations; the rules forbid stating anything outside them.
  • src/components/closet/: the room. Spine, cover and back textures are drawn once per site on canvases after the fonts load (16x anisotropy, mipmaps), unlabeled cases are a single InstancedMesh, motion is maath/easing damping throughout.
  • src/lib/sound.ts: Web Audio foley with zero audio files (shelf ticks, case slides, room tone, candle crackle).

Known limitations

  • 31 sites. The build script is deliberately slow to respect archive.org's rate limits; framesets and image-only pages are skipped rather than guessed at.
  • Search is keyword (BM25) over the site text plus Gemma-written vibe tags, not embeddings.
  • Small models paraphrase. The prompt demands verbatim quotes and the UI highlights them, but a 4B-class model occasionally rephrases one. The Remains tab is there so you can check.
  • The hosted demo is not offline. It calls Gemma 4 through Google AI Studio's free tier, where Google may use prompts to improve its services. Only public archived pages are sent. Run locally for a fully private séance.
  • Resurrections live in memory for your session and are not written to disk. Ofrenda notes live in your browser's localStorage.
  • Rate limits. Séances are limited per IP to keep the free tier alive; the message suggests running locally.

AI assistance was used to write code for this project.

About

An ofrenda for the dead web: a candlelit 3D closet of dead websites, read aloud by an open-weight Gemma ghost.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages