I Haunted My Terminal With a Local Ghost (Gemma 3, No Internet Needed)
Description and use
A local terminal ghost that whispers short lines after commands, keeping all data on the machine.
Problem
Add whimsical, local AI-generated whispers to terminal commands without exposing sensitive data to external services.
Outcome
A lightweight, privacy‑preserving terminal enhancement that injects one‑line spooky comments after commands, using only local resources and no internet.
Workflow
- 1. Install Ollama and pull a local model (e.g., gemma3:4b).
- 2. Run
python3 ghost.py "<command>" --code <exit_code>. - 3. Source
haunt.zshin the shell to hookpreexecandprecmd. - 4. The script rolls a die; if the ghost is chatty, it calls the local model via Ollama’s HTTP API.
- 5. The model returns a single short whisper, printed to the terminal.
- 6. Optionally set
GHOST_ODDS=1to trigger after every command.
Evidence
Two tiny files, no dependencies beyond Python 3 and zsh:
The whole prompt is a few lines: you are a ghost trapped inside a computer, reply with one short eerie whisper, spooky and a little funny.
Nothing leaves your machine. The only network call is to localhost.
It works offline. Plane, train, or a dead Wi‑Fi: the ghost still haunts you.
- Record date: 2026-10-27T00:11:24.689Z