๐ป Ghost in the Machine: An Offline Haunted Terminal, Sรฉance Chamber, and Dรญa de los Muertos Digital Ofrenda Powered by Local Gemma 2
This is a submission for the Hacktoberfest Open-Source AI Challenge: Week 4 โ Ghost in the Machine.
๐ What I Built
Around late October, the calendar enters a liminal space: Halloween on October 31 and Dรญa de los Muertos on November 1 & 2. In software systems, this boundary feels equally real. Every day, thousands of orphaned child processes are severed by kill -9 without a cleanup handler; unmerged branches decay in git reflogs; and legendary languages and pioneers pass into history.
To honor both the spooky and the sacred, I built Ghost in the Machine (ghost / gitm): a local-first, privacy-preserving terminal suite powered by Google's open-weight Gemma 2 (2B).
.-.
(o.o)
__/ ' \__ ๐ฏ๏ธ GHOST IN THE MACHINE ๐ฏ๏ธ
/ \_/ \ ยซ The silicon whispers back ยป
/ . . \
/ | | \ 100% Local โข Zero Cloud โข Privacy Forever
(____|_____|____)
\ / \ /
`-' `-'
It turns your everyday Linux shell into:
-
The Haunted Terminal (
ghost haunt&ghost whisper): An interactive subshell that observes commands run by the user (git commit,rm -rf,kill -9,grep) and whispers back chilling, context-aware commentary directly from the silicon. -
The Offline Sรฉance Chamber (
ghost seance): An interactive terminal sรฉance circle where you can summon and converse with departed computing pioneers (Ada Lovelace, Alan Turing, Grace Hopper, Dennis Ritchie) and retired technologies (Adobe Flash, Zombie PID 666). -
The Digital Ofrenda Builder (
ghost ofrenda): In the sacred tradition of Dรญa de los Muertos, an ASCII/Unicode tiered altar adorned with cempasรบchil (marigolds), flickering candles (๐ฏ๏ธ), and pan de muerto. Gemma 2 generates heartfelt dedications and traditional rhyming Calaveritas Literarias (satirical/commemorative poems) that are permanently archived in a local JSON ledger. -
The Midnight Chronicle (
ghost tale): Gathers your recent git commit history, kernel uptime, and system load averages to weave an original cyber-gothic ghost story set inside your specific workstation.
๐ Why Open Innovation Matters for This Project
The prompt asked: Why does open innovation matter for what you built? Does it run on a laptop with no internet? Keep someone's data off a server they don't control?
Here is why this project could only exist with open-source AI and open-weight models:
1. Privacy: You Can Never Send Shell Traces to an External API
A tool that comments on terminal commands is reading:
- File paths (which may contain proprietary client names or secret keys)
- Command flags and commit messages (
git commit -m 'Patching CVE in auth.py') - Process IDs and system parameters
Sending this stream over the public internet to a closed cloud AI API is an egregious security and privacy violation. Because Gemma 2 runs completely locally on-device via Ollama, zero bytes ever leave the machine.
2. Runs With the Lights (and the Internet) Off
A spooky Halloween hack or an offline remembrance tool should work in a remote cabin in the woods or during an internet blackout. Ghost in the Machine has zero runtime network dependencies. You can pull your Wi-Fi plug, run ghost haunt, and converse with Ada Lovelace in complete digital isolation.
3. Permanence and Digital Preservation
Cloud AI services shut down, hike prices, change rate limits, or censor topics. A traditional ofrenda is meant to preserve the memory of loved ones and foundational pioneers across decades. If an ofrenda depended on a closed corporate API endpoint, a broken subscription or a deprecated API version would destroy the tribute.
By using open weights (Gemma 2), open package management (uv), and standard open-source Python, this repository can be checked out and run decades from now.
4. Zero Marginal Cost
Developers run hundreds of shell commands a day. Charging per-token API calls for shell whispers would be prohibitively expensive. Local open-weight inference costs $0.00.
๐ Prize Category: Best Use of Gemma
Ghost in the Machine runs on Google Gemma 2 (2B).
Gemma 2 was chosen because:
- Parameter Efficiency: At just 2 billion parameters, it fits effortlessly into modest laptop VRAM (under 2GB) and runs at lightning speed on CPU or integrated GPU.
- Poetic & Thematic Nuance: Gemma 2 demonstrates extraordinary literary sensitivity. It writes evocative gothic whispers, captures 19th-century Victorian mathematics for Ada Lovelace, and generates authentic Calaveritas Literarias with perfect rhyme and respect.
๐ธ Demo Walkthrough
1. The Haunted Shell Possession (ghost whisper)
$ ghost whisper "git commit -m 'Fixed memory leak'"
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ป A ghostly echo of change, a whisper of data lost in the void, now โ
โ fixed... yet not truly forgotten. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โนgemma2:2bโบ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
$ ghost whisper "rm -rf old_builds"
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ป The echoes of deleted data linger in the void, like phantoms trapped by โ
โ a forgotten code. A silent purge, a dance with the ephemeral... โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โนgemma2:2bโบ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
2. The Sรฉance Chamber (ghost seance list & ghost seance summon ritchie)
๐ฏ๏ธ THE SรANCE PANTHEON: SUMMONABLE SPIRITS ๐ฏ๏ธ
โโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโ
โ Key โ Spirit โ Title โ Description โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ ada โ ๐ Ada Lovelace โ Countess of Lovelace โ First Programmer โ
โ turing โ โ๏ธ Alan Turing โ Father of CS & AI โ Pioneer of computing โ
โ hopper โ โ Grace Hopper โ Rear Admiral โ Compiler pioneer โ
โ ritchie โ ๐ Dennis Ritchie โ Creator of C & Unix โ Built modern systems โ
โ flash โ โก Adobe Flash โ Fallen Vector Medium โ Executed Dec 31 2020 โ
โ pid โ ๐ง Zombie PID 666 โ Slain by SIGKILL โ Slain with kill -9 โ
โโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโ
Summoning Dennis Ritchie:
๐ฏ๏ธ THE SรANCE CIRCLE HAS FORMED ๐ฏ๏ธ
Channeling: ๐ Dennis Ritchie (1941-2011)
Engine: gemma2:2b (100% Local Inference)
๐ Dennis Ritchie:
"Hello from the eternal kernel space. Everything is still a file, and memory is still a quiet canvas of pointers. What troubles your terminal, living programmer?"
3. Dรญa de los Muertos Altar (ghost ofrenda view & ghost ofrenda add)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ๏ธ OFRENDA DIGITAL ๐ฏ๏ธ
๐ผ DรA DE LOS MUERTOS โ 1 & 2 NOVIEMBRE ๐ผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[ Cielo / The Heavens: Soul & Memory ]
๐ฏ๏ธ ๐ ๐ฏ๏ธ
~~~~~~~~~~~~~~~
[ Purgatorio / Earthly Transition & Code ]
๐ฅ Pan de Muerto โข โ Cafรฉ โข ๐ต๏ธ Flor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ Tierra / The Mortal Ground: Our Living Altar ]
๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ ๐ผ
Gemma 2's generated tribute for Dennis Ritchie:
## Dedication
Dennis Ritchie, a weaver of language, a sculptor of code, gave us the world
of C and the foundation of Unix. His legacy, like the flames of copal,
continues to burn bright, guiding us through the digital night.
## Calaverita Literaria
*La Muerte* enters the altar with grace,
A gentle breeze, a smile on her face.
She sees a friend, a pioneer of thought,
Dennis Ritchie, whose code we've wrought.
*The Pan de Muerto* sways in the light,
*Mezcal* fills the air with ancient might.
*C source code* a silent, sweet song,
His spirit echoes through the living throng.
Love, memory, and open minds remain,
Like his creation, forever a flame.
Dennis, we remember, your legacy bold,
Your code lives on, a story yet untold.
๐ ๏ธ How It's Engineered
+-----------------------------------------------------------+
| Ghost in the Machine CLI |
| (ghost haunt / seance / ofrenda / tale) |
+-----------------------------+-----------------------------+
|
[Spectral Engine]
|
+----------------------+----------------------+
| (Online) | (Offline / Low-RAM)
v v
[Ollama Daemon] [Spectral Oracle]
(gemma2:2b / local open-weight) (Heuristic Gothic Engine)
| |
+----------------------+----------------------+
|
v
[Rich Spectral Renderer]
(ANSI Ectoplasm / Altar)
- Tooling: Built with Python 3.11+ managed by uv for lightning fast, reproducible environment setup.
-
Inference: Powered by Ollama running Google's
gemma2:2b. - Fault-Tolerant Resilience: Incorporates community insights (polling health checks rather than blind sleeps) and features an Offline Fallback Oracle so the CLI never crashes even if Ollama is paused.
- TUI & Typography: Built with Rich and Typer for spectral ANSI colors, glitch typography, and animated frames.
-
Testing: Comprehensive 12-test suite in
pytestcovering prompts, storage, CLI parsing, and inference pipelines.
๐ป Source Code
The full project is open source under the MIT License:
๐ GitHub: SpreadSheets600/ghost-in-the-machine
To run it locally in under 60 seconds:
git clone https://github.com/SpreadSheets600/ghost-in-the-machine.git
cd ghost-in-the-machine
uv sync
uv run ghost status
uv run ghost haunt
Happy Halloween and Feliz Dรญa de los Muertos! May your memory leaks be forgiven and your processes find eternal rest. ๐ฏ๏ธ๐๐ผ
Top comments (0)