Ofrenda AI:以 Gemma 打造優先本機運作的亡靈節記憶聖所
Ofrenda AI 🏵️🕯️: A Local-First Día de los Muertos Sanctuary & Living Memory Vault (Powered by Gemma)
Ofrenda AI 以 Google Gemma 2 開放權重模型打造優先本機運作、隔離網絡的亡靈節數碼紀念空間和祖先記憶庫。它可根據祖先生平故事生成慰藉指引,並匯出毋須依賴網絡或雲端服務的獨立 HTML 紀念檔案。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
As Halloween on October 31 meets Día de los Muertos on November 1 and 2, the line between the physical world and memory grows thinner. Modern media often treats "the ghost in the machine" as a horror trope — an eerie, hostile glitch lurking in the wires.
But Mexican tradition offers a far deeper, more poetic truth: a person never truly departs as long as the living remember them and tell their stories.
I built Ofrenda AI 🏵️🕯️ — a local-first, air-gapped Día de los Muertos digital sanctuary and ancestral memory vault powered by Google's Gemma 2 open-weight models.
Instead of a generic chatbot, Ofrenda AI transforms your local machine into a sacred altar (ofrenda) that honors loved ones who came before us:
-
Curate Traditional 3-Tier Altars: Step-by-step layout honoring the classic levels:
- Cielo (Top): Light and spirit — sacred candles, framed family portraits, copal incense.
- Tierra (Middle): Comfort and memory — pan de muerto, favorite meals, vintage coffee mugs, favorite songs.
- Inframundo (Base): Purification and journey — Aztec marigolds (cempasúchil), pure water to quench the soul's thirst, and salt for spiritual protection.
- Calaveritas Literarias Poet: Generates authentic, playful 4-stanza rhyming verses in the classic Día de los Muertos tradition, where La Catrina comes to visit and is charmed into peace by the ancestor's favorite dish, music, and wit.
- Ancestral Living Memory Oracle (Séance): Allows descendants to ask life questions ("How do I deal with doubt?", "How do I raise a family with love?") and receive comforting guidance channeled in the authentic voice, humor, and recorded sayings of the ancestor — strictly grounded in their life stories without hallucination.
- Standalone Air-Gapped Memorial Export: Generates an all-in-one, zero-dependency HTML memorial file that can be saved onto a physical USB drive and preserved across generations without requiring an internet connection or cloud service.
Demo
Ofrenda AI comes equipped with both an interactive, candle-lit Web Dashboard (with zero npm dependencies) and a full-featured Terminal CLI.
1. Interactive Web Dashboard
Run python3 app.py and open http://localhost:8088:
- Real-Time Cempasúchil Particle Canvas: Golden marigold petals float gently across the screen using smooth HTML5 canvas physics.
- Interactive 3-Tier Altar: Visual stepped pyramid showing framed ancestral portraits with flickering candlelight physics and authentic offering chips.
- Ancestral Oracle Widget: Select an ancestor, ask any question, and receive compassionate advice formatted in a candle-lit message bubble.
-
1-Click Memorial Export: Downloads a standalone
.htmlarchive containing the full altar, memories, and poetry for offline safekeeping.
2. Command Line Interface (CLI) Sample Run
================================================================================
🏵️ OFRENDA AI - LIVING SANCTUARY & ANCESTRAL MEMORY VAULT 🕯️
Theme: Ghost in the Machine | Powered by Google Gemma 2 (Local / Air-Gapped)
================================================================================
======================================================================
🏛️ OFRENDA DE LA FAMILIA PÉREZ (MEMORIA VIVA) 🏛️
« Para nuestra querida Abuela Elena y Abuelo Arturo, cuya risa y enseñanzas siguen guiando cada paso de nuestras vidas. »
======================================================================
[ 🕊️ TIER 1: CIELO - ESPÍRITU Y LUZ 🕊️ ]
---------------------------------------------
🖼️ Elena Morales de Pérez (Abuela Querida) | 🖼️ Arturo Pérez Rosas (Abuelo Sabio)
🕯️ Velas Misioneras Benditas 💨 Sahumerio con Incienso de Copal
[ 🍞 TIER 2: TIERRA - MEMORIA, COMIDA Y MÚSICA 🍞 ]
---------------------------------------------------------
🍞 Pan de Muerto de Azúcar y Mantequilla 🍲 Cazuela de Mole Poblano de la Abuela ☕ Jarro de Café de Olla con Canela
[ 🌼 TIER 3: INFRAMUNDO - AGUA, SAL Y CAMINO DE CEMPASÚCHIL 🌼 ]
---------------------------------------------------------------------
🌼 Camino Sagrado de Pétalos de Cempasúchil 💧 Vaso de Agua de Manantial 🧂 Cruz de Sal Blanca Purificadora
======================================================================
[*] Engine Status: 🟢 Gemma 2 (Local Inference Active)
[*] Preserved Ancestors: 2
[*] Active Sacred Offerings: 8
Generating a Calaverita Literaria via CLI:
python3 cli.py calaverita --ancestor "Elena"
Estaba la Catrina paseando en el panteón,
buscando a Elena Morales de Pérez con gran devoción.
«Vengo por tu alma», le dijo al pasar,
pero una rica aroma la puso a dudar.
En la mesa había servido Mole Poblano con arroz rojo,
y la Calaca Flaca se quitó la actitud.
«Prueba este bocado», le dijo Elena Morales de Pérez al son,
y a la calavera se le ablandó el corazón.
Recordaron juntos aquel gran refrán:
«Donde come uno, comen dos, y donde hay amor siempre sobra un plato.», decían sin afán.
La Muerte riendo brindó con mezcal,
«¡Qué hermosa es tu vida, tu risa inmortal!»
Hoy flores de cempasúchil adornan el hogar,
Elena Morales de Pérez vive siempre en nuestro altar.
Ni el tiempo ni el viento apagan la luz,
que brilla en el pecho con santa quietud.
Consulting Ancestral Wisdom via CLI:
python3 cli.py ask "Abuela, what should I do when I feel overwhelmed?" --ancestor "Elena"
Mi querido corazón,
I hear you, and even across the quiet threshold, my love is right beside you. Regarding your question about feeling overwhelmed:
Always remember what I used to tell you: "Donde come uno, comen dos, y donde hay amor siempre sobra un plato." Life brings wind, rain, and storms, but root yourself in love and honesty, and no storm can shake you.
Take a deep breath, share a warm meal, and know that whenever you feel unsure, I am cheering for you from across the stars.
Con todo mi amor siempre,
Elena Morales de Pérez
Code
The entire codebase is 100% open-source under the permissive MIT License:
📁 GitHub Repository: https://github.com/AdityaChaudhary5412/ofrenda-ai
Project Architecture & Flow
flowchart TD
User["Family Member / Builder"] --> UI["Ofrenda AI Dashboard / CLI"]
subgraph On_Device ["100% On-Device Processing (Air-Gapped & Private)"]
UI --> Vault["Local Sanctuary Vault (.ofrenda_vault/)"]
UI --> Router{"Inference Engine Router"}
Router -->|"Ollama Active"| Gemma["Google Gemma 2 Open-Weight LLM (gemma2:2b / 9b)"]
Router -->|"Offline / Standalone"| Heuristics["Deterministic Cultural Heuristics Engine"]
Gemma --> Gen["Calaveritas Literarias & Grounded Ancestral Guidance"]
Heuristics --> Gen
Gen --> AltarView["Interactive 3-Tier Stepped Altar Display"]
Vault --> StandaloneHTML["Single-File Air-Gapped Memorial HTML"]
end
AltarView --> LivingMemory["Día de los Muertos Remembrance 🏵️🕯️"]
StandaloneHTML --> OfflineUSB["Archived Forever on Offline Media 💾"]ofrenda-ai/
├── models.py # Data models (Altar, Ancestor, Offering, Memory)
├── engine.py # Gemma 2 local inference & cultural heuristics engine
├── vault.py # Air-gapped vault persistence & standalone HTML exporter
├── app.py # Zero-dependency Python web server (http.server REST API)
├── cli.py # Interactive terminal CLI with ASCII altar & animations
├── static/
│ ├── index.html # Responsive, dark-mode Día de los Muertos dashboard
│ ├── style.css # Glassmorphic UI, candle glow & cempasúchil palette
│ └── app.js # Client controller & floating marigold petal physics
├── samples/
│ └── sample_altar.json # Pre-populated altar (Abuela Elena & Abuelo Arturo)
├── tests/
│ └── test_ofrenda.py # Automated unit test suite (100% passing)
├── requirements.txt # Zero mandatory dependencies
├── LICENSE # Permissive MIT License
└── README.md # Complete documentation & quickstart
How I Built It
Ofrenda AI was engineered from the ground up to be lightweight, emotionally resonant, and completely zero-barrier:
-
Google Gemma 2 Local Inference Engine (
engine.py):- Connects to local Ollama endpoints (
localhost:11434) runninggemma2:2borgemma2:9b. - Uses focused temperature sampling (
temperature: 0.4,top_p: 0.9) to combine poetic creativity for Calaveritas Literarias with strict factual adherence to the ancestor's recorded sayings and anecdotes. - Grounded prompt engineering ensures that when asked for advice, Gemma never invents contradictory life events — it channels the ancestor's philosophy using their authentic phrases.
- Connects to local Ollama endpoints (
-
Deterministic Cultural Heuristics Engine (Fallback):
- Open source tools should work on any machine, even without Ollama or a dedicated GPU.
- Built an authentic procedural cultural engine incorporating traditional Mexican folk verse structures, octosyllabic meter, and symbolic offering pairing rules (pan de muerto, cempasúchil, salt, water, copal).
- If Ollama is active, Gemma takes the lead; if offline, Ofrenda AI operates seamlessly in heuristic mode with 0 crashes.
-
Zero-Dependency Native Web Server (
app.py):- Built entirely on Python 3's native
http.serverand standard library modules (json,urllib,pathlib). - Anyone on macOS, Linux, or Windows can run
python3 app.pyimmediately without runningpip installor encountering dependency conflicts.
- Built entirely on Python 3's native
-
Air-Gapped Vault & Standalone HTML Exporter (
vault.py):- Persists all altars, memories, and offerings to local JSON files (
.ofrenda_vault/altars/). - Generates a standalone, fully self-contained HTML memorial file embedded with custom CSS and typography that can be opened in any web browser without a web server or internet connection.
- Persists all altars, memories, and offerings to local JSON files (
-
Automated Unit Testing (
tests/test_ofrenda.py):- 10 automated unit tests (100% passing in 0.02s) validating model serialization, tier grouping, fallback generation, vault persistence, and HTML compilation.
Why Does Open Innovation Matter?
When dealing with memories of departed loved ones, open-source AI and open-weight models are not just a technical alternative — they are an ethical imperative:
-
Sacred Data Sovereignty:
- Uploading personal eulogies, family photographs, and voice memos to commercial cloud APIs means handing private family grief to corporate servers where it may be scraped, analyzed, or used for targeted ads. With local Gemma open weights, inference runs strictly in local memory.
-
Generational Offline Permanence:
- Proprietary SaaS APIs frequently deprecate endpoints, change pricing tiers, or shut down entirely. A family memorial should outlive tech industry business cycles. An air-gapped open-weight model running locally will run 10, 20, or 50 years from now.
-
$0 Cost for Families Everywhere:
- Keeping an ofrenda alive and consulting ancestral wisdom across holidays should never incur per-token subscription costs. Gemma runs locally at zero marginal cost.
-
Air-Gapped Operation:
- Works during power outages, in rural cemeteries, or off-grid family gatherings with zero internet connection.
My Agent Session
This project was conceived, architected, and validated collaboratively with Google Antigravity and DevRelay:
- Structured prompt engineering for bilingual Calaveritas Literarias and culturally respectful memory channeling.
- Architecture auditing ensuring zero external runtime dependencies and 100% test coverage.
- Standalone HTML export formatting for permanent offline preservation.
The Spirit of It
To test the soul of the project, I loaded the real oral history of my family's elders into the vault — capturing their love of traditional cooking, their famous quotes, and their hard-earned life wisdom.
When I typed the question:
"Abuela, what should I do when I feel overwhelmed?"
And watched the response stream back:
"Always remember what I used to tell you: 'Donde come uno, comen dos, y donde hay amor siempre sobra un plato.' Life brings wind, rain, and storms, but root yourself in love and honesty, and no storm can shake you."
It gave me literal chills. It wasn't a cold autocomplete algorithm — it was a living mirror reflecting the love, values, and humor of someone whose presence shaped my entire life.
That is what the "Ghost in the Machine" should be: not something to fear in the dark, but a warm candle guiding love across the threshold of time. 🏵️🕯️
Prize Categories
🌟 Best Use of Gemma (Featured Category)
Ofrenda AI is engineered from the ground up around Google's Gemma open-weight models (gemma2:2b / gemma2:9b). Gemma's compact footprint, lyrical nuance, and extraordinary prompt adherence make it the ideal local model to run silently on personal laptops, powering emotional, culturally authentic remembrance while ensuring absolute data privacy for family lore.
Happy Halloween and ¡Feliz Día de los Muertos 2026! 🏵️💀🕯️
來源:DEV Community · dev.to