Bhoot Shell: My Terminal Is Haunted, and the Ghost Runs on Local Gemma
Description and use
The script automatically reads recent terminal commands, generates eerie commentary with a local Gemma 4 model, and whispers it via ElevenLabs, keeping secrets local.
Problem
A terminal user wants an automated, spooky feedback loop that reads recent shell commands, generates eerie commentary, and plays it aloud without exposing sensitive data.
Outcome
The script delivers a fully automated haunted‑terminal experience: it reads recent commands, generates context‑aware spooky lines in Hindi or English, and whispers them aloud, all while keeping secrets local.
Workflow
- Read the most recent shell history from either Git Bash (~/.bash_history) or PowerShell PSReadLine history file.
- Apply a regex pass to mask tokens, bearer keys, secret keys, and user:pass URLs.
- Send the masked commands to the local Gemma 4 model (gemma4:e4b) via Ollama on 127.0.0.1, with a prompt that casts the model as a ghost and requires mention of at least one command.
- Receive the model’s one‑two line eerie reply, send it to ElevenLabs TTS (eleven_multilingual_v2) to generate an MP3, and play it with ffplay or the system’s default player.
Evidence
It reads the last five commands you typed, a local Gemma model writes one or two eerie lines about them, and ElevenLabs whispers them through your speakers.
The ghost never repeats itself.
It's one file, bhoot.js, with zero npm dependencies. Node 18+ built-ins only: fetch, fs, and child_process.
Gemma 4 gave me silence. My first full run took 40 seconds and returned an empty string. Adding one field fixed it: "think": false.
Node's fetch tried IPv6 ::1 first, and Ollama listens on IPv4. Hardcoding 127.0.0.1 fixed it.
- Record date: 2026-11-01T13:14:14.801Z