DEV Community

Cover image for AFTERLIGHT: Keeping Family Memories Alive with Open-Weight AI
Megh Shah
Megh Shah

Posted on Edited on

AFTERLIGHT: Keeping Family Memories Alive with Open-Weight AI

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼

AFTERLIGHT: Keeping Family Memories Alive with Open-Weight AI

"We spend so much time building technology that remembers everything about us. But somehow, the stories of the people who mattered most are still the easiest things to lose."


This is a submission for the Hacktoberfest Open-Source AI Challenge: Week 4 — Ghost in the Machine (#hf26challenge, #devchallenge).

  • Targeted Prize Categories:
    • 🏆 Overall Winner ($250)
    • 🌟 Best Use of Gemma ($200)
    • 🚀 Best Use of Render ($200)

🌐 Live Website: https://afterlight-memory-garden.onrender.com/

💻 Source Code: https://github.com/Megh-Shah-08/afterlight


1. 🕊️ What I Built

AFTERLIGHT is a digital memory garden designed to preserve family histories, personal oral stories, beloved recipes, and recollections of loved ones using open-weight AI (Google DeepMind's Gemma) and 100% private local browser storage (IndexedDB).

       🕯️
    (      )      AFTERLIGHT
   .-'"""""'-.    "People leave.
  /'         '\   Their stories don't have to."
 |  MARIGOLD   |
 |  & ANISE    |  Powered by Gemma Open-Weight AI
  \           /   Zero-Cloud Privacy | IndexedDB Vault
   '-.......-'
Enter fullscreen mode Exit fullscreen mode

⚠️ What AFTERLIGHT Is NOT:

This is NOT a "ghost simulator" or an AI chatbot pretending to speak from beyond the grave as a deceased relative. We believe impersonating the deceased or fabricating personal facts dishonors genuine human grief. AFTERLIGHT treats human memories as sacred testimony: faithful, grounded, structured, and permanent.

Core Experience:

  1. The Sanctuary Garden: An atmospheric visual sanctuary featuring deep charcoal (#090a0f), warm candlelight amber (#f59e0b), and marigold accents (#ea580c). Users can toggle between three views:
    • Sanctuary Grid: Interactive cards displaying relationship badges, era pills, remembrance excerpts, and thematic tags.
    • Timeline Journey: A chronological pathway connecting family milestones across generations.
    • Ofrenda Altar View: A three-tiered commemorative display inspired by Día de los Muertos traditions, honoring loved ones with glowing digital shrines.
  2. Plant a Memory: A guided memory capture workflow capturing who, when, where, and the authentic story—accompanied by an in-browser voice memo recorder (MediaRecorder API) to capture spoken words.
  3. Gemma AI Memory Portrait: Deep semantic extraction using Gemma into structured portraits:
    • Evocative suggested title honoring the person's character.
    • Factual 2-sentence summary.
    • Poetic, dignified remembrance tribute passage.
    • Respectfully rewritten editorial narrative that preserves facts without embellishment.
    • Extracted people, places, events, and a chronological milestone timeline.
    • Thematic archetypes (Culinary Heritage, Resilience, Oral Tradition).
    • Generational inquiry prompts for future family conversations.
  4. Ask the Garden: A conversational memory synthesis archivist. Family members can ask natural questions like \"What did Abuela Elena say about the dough bones?\" or \"Tell me about Grandpa Arthur's radio in 1974.\" Gemma retrieves relevant stories from the local vault, answers strictly grounded in preserved memories, and cites clickable source cards.
  5. Data Sovereignty & Export: 1-click Markdown export (with YAML frontmatter) and full JSON archive backup/restore.

2. 📺 Demo

🌐 Live Deployment:

Experience AFTERLIGHT live on Render right now:

👉 https://afterlight-memory-garden.onrender.com/

Screenshots of the Live Application:

AFTERLIGHT Memory Garden Sanctuary

AFTERLIGHT Dashboard and Ofrenda Altar

Key Links:

Judge & Tester Note: You do not need Ollama installed to test AFTERLIGHT on the deployed link! The live app comes pre-populated with three curated benchmark memories (Abuela Elena's Anise Bread, Grandpa Arthur's Shortwave Radio, and The Peat Fire on Inisheer) and instant clickable questions in Ask the Garden. When Ollama is running locally, it seamlessly switches to live open-weight Gemma inference.


3. 💻 Code

The complete source code is open-source under the MIT license:

  • Repository: https://github.com/Megh-Shah-08/afterlight
  • Key Modules:
    • src/types/memory.ts: Strict TypeScript interfaces for memories, portraits, and timeline entries.
    • src/lib/storage.ts: Client-side IndexedDB persistence engine with JSON import/export and Markdown generation.
    • src/lib/ollama.ts: Ollama connectivity detector and model router.
    • src/app/api/ollama/status/route.ts: Real-time probe to detect installed Gemma models.
    • src/app/api/ollama/portrait/route.ts: Structured JSON extraction prompt enforcing zero-hallucination.
    • src/app/api/ollama/ask/route.ts: Retrieval-augmented memory answering strictly grounded in source stories.
    • render.yaml: Official Render Blueprint specification for zero-config production deployment.

4. 🏗️ How I Built It

flowchart TD
    User([User / Family Historian]) -->|Writes story or records voice| Capture[Plant a Memory Experience]
    Capture -->|1. Immediate Save| IDB[(IndexedDB Local Vault)]

    Capture -->|2. Structured Request| APIRoute[Next.js API: /api/ollama/portrait]

    subgraph Local Inference Layer
        APIRoute -->|HTTP POST :11434| Ollama[Local Ollama Engine]
        Ollama -->|Gemma 3:4b / Gemma 2:2b| GemmaModel[Gemma Open-Weight Weights]
        GemmaModel -->|Strict JSON Schema| APIRoute
    end

    subgraph Fallback / Demo Engine
        APIRoute -.->|If Ollama offline| LocalEngine[Local Heuristic Synthesizer]
        LocalEngine -.->|Immediate Preview| APIRoute
    end

    APIRoute -->|Memory Portrait| IDB
    IDB -->|Renders| Garden[The Garden Dashboard]
    IDB -->|Renders| Detail[Portrait Detail Modal]

    User -->|Ask Question| AskGarden[Ask the Garden]
    AskGarden -->|Retrieve Relevant Stories| APIRouteAsk[Next.js API: /api/ollama/ask]
    APIRouteAsk -->|Strictly Grounded Prompt| Ollama
    Ollama -->|Synthesized Answer + Citations| AskGarden

Architectural Decisions:

  1. Next.js 14 App Router: High performance React server and client components, strict TypeScript compilation, and optimized bundle sizes.
  2. IndexedDB Local Persistence: Eliminates external database lock-in. Stories are permanently saved in the user's browser, surviving refreshes without any cloud database credentials.
  3. Structured Open-Weight Inference: Gemma is invoked via Ollama with strict instruction parameters (temperature: 0.2, format: \"json\"). The prompt explicitly forbids inventing biographical details, dates, or quotations not present in the authentic story.
  4. Retrieval-Augmented Grounding: In Ask the Garden, queries are matched against local memory tokens. Only candidate memories are passed into the context window. The system prompt instructs Gemma to respond with explicit honesty if a detail was never recorded.

5. 🧠 Why Does Open Innovation Matter?

DEV Hacktoberfest Week 4 asks: \"Why does open innovation matter for what you built?\"

1. Privacy for Sacred Human Stories

Family histories contain sensitive vulnerabilities: illnesses, historical hardships, regional dialects, and personal grief. Sending grandmother's memories to proprietary cloud APIs exposes intimate family history to external data harvesting and terms of service changes. Running Gemma locally via Ollama ensures your family memories never leave your machine.

2. Dignity & Anti-Hallucination

Generic commercial LLMs are often tuned to be sycophantic or creative to a fault, happily inventing biographical facts. Gemma's strong instruction-following capability allows AFTERLIGHT to enforce strict system boundaries:

  • Never invent dates.
  • Never invent people.
  • Unknown information must remain unknown.

3. Permanence: Working with the Lights and Internet Off

If a proprietary AI company goes out of business, your memory companion vanishes. With open-weight Gemma running on local hardware, AFTERLIGHT works on an airplane, in a remote cabin, or thirty years from now when current cloud companies no longer exist.


6. 🤖 My Agent Session

This project was designed, built, tested, and shipped using Google Antigravity and DevRelay:

Building AFTERLIGHT: Open-Weight AI Memory Garden for Hacktoberfest Week 4 Gemma 3 (4B) / Gemma 2 (2B)
You

Build AFTERLIGHT, a premium AI-powered digital memory garden that preserves family histories, personal stories, and memories of loved ones using open-weight AI (Gemma via Ollama) for DEV Hacktoberfest Week 4: Ghost in the Machine. Ensure zero-cloud data ownership with IndexedDB and strict anti-hallucination boundaries.

Agent

Understood. We are designing AFTERLIGHT as an authentic memory garden rather than a chatbot. Key architectural commitments:
1. Local-first data sovereignty: Stories stored privately in browser IndexedDB.
2. Open-weight inference: Using Google DeepMind's Gemma (gemma3:4b / gemma2:2b) via local Ollama.
3. Anti-hallucination: System prompt forbids fabricating dates, people, or quotations.
4. Editorial synthesis: Generating structured Memory Portraits with summary, remembrance tribute, timeline, and inquiry prompts.
5. Grounded memory Q&A: 'Ask the Garden' answers questions strictly derived from preserved stories with source citations.

You

Now implement the Ollama integration layer, structured memory portraits, guided memory capture with voice recording, and the Día de los Muertos ofrenda altar view.

Agent

Implemented the core systems:
- /api/ollama/status: Real-time detection of local Ollama runtime and installed Gemma models.
- /api/ollama/portrait: Structured extraction enforcing strict JSON schema (title, summary, remembrance passage, rewritten narrative, entities, timeline, themes, tags, follow-ups).
- /api/ollama/ask: Retrieval-augmented question answering grounded exclusively in preserved memories with clickable citations.
- PlantMemory: Step-by-step guided capture with HTML5 MediaRecorder audio memo recording.
- Multi-view Garden: Grid view, Timeline journey, and Ofrenda Altar view.
- Export engine: Full JSON archive backup and formatted Markdown export with YAML frontmatter.

(Interactive session: dev.to/agent_sessions/building-afterlight-open-weight-ai-memory-garden-for-hacktoberfest-week-4-l7e3el)


7. 🕯️ The Spirit of It

Week 4 of Hacktoberfest brings together Halloween (October 31) and Día de los Muertos (November 1 & 2).

In traditional Mexican culture, the Day of the Dead is not a somber or frightening occasion. It is an act of joyful, tender remembrance. Families build ofrendas, scatter marigold petals (cempasúchil) whose scent guides the spirits home, and lay out the favorite foods, songs, and laughter of those who walked ahead of us.

AFTERLIGHT was born from this exact spirit. We do not need AI to simulate the voices of the dead or generate eerie synthetic illusions. What we need is technology that helps us slow down, honor the stories we were trusted with, and ensure that when people leave, their wisdom and love remain glowing in the afterlight.


8. 🏆 Prize Categories

  • Overall Winner ($250): An end-to-end, emotionally resonant, highly original application embodying the \"Ghost in the Machine\" prompt through memory preservation and Día de los Muertos remembrance.
  • Best Use of Gemma ($200): Deep open-weight integration using Gemma (3:4b / 2:2b) for structured entity extraction, editorial remembrance generation, and strictly grounded conversational search.
  • Best Use of Render ($200): Production-ready Next.js application with an official render.yaml Blueprint specification, automated health checks, and live cloud deployment on Render at https://afterlight-memory-garden.onrender.com/.

Top comments (1)

Collapse
 
alexshev profile image
Alex Shev •

For a family-memory system, provenance is part of the product, not just a backend concern. Every generated recollection should distinguish quoted source material, inferred connections, and unknowns—and let the family correct or hide each one. That protects against a warm interface turning uncertain reconstruction into false family history.