I Haunted My Terminal With a Local Ghost (Gemma 3, No Internet Needed) A developer built shell-ghost, an open-source zsh hook that uses preexec and precmd to capture each command and its exit code, then sends them to a local Gemma 3 4B model via Ollama's HTTP API to print a single eerie one-line whisper after roughly one in three commands. The tool runs entirely offline, with a temperature of 0.9 and a 48-token cap keeping replies short, and the author argues that routing terminal commands to a hosted API for a joke would be a bad trade given the secrets a shell can expose. This is a submission for the Hacktoberfest Open-Source AI Challenge: Week 4, "Ghost in the Machine" https://dev.to/challenges/hacktoberfest-week4-2026-10-26 . shell-ghost is a haunted terminal. After some of the commands you run, a ghost whispers one eerie line about what you just did: bash $ rm -rf node modules 👻 Don't worry, it just wanted a little... tidier oblivion. $ git push --force 👻 Don't you dare rewrite my carefully crafted digital chaos. $ sudo make me a sandwich 👻 It wants fillings… and a very long, slow, digital chew. By default it speaks on about 1 in 3 commands, so it stays a surprise instead of a nuisance. Repo: https://github.com/GAlmeidaDev/shell-ghost https://github.com/GAlmeidaDev/shell-ghost Two tiny files, no dependencies beyond Python 3 and zsh: haunt.zsh hooks into zsh with preexec to remember the command and precmd to read its exit code . It rolls a die, and if the ghost is feeling chatty it calls the script. ghost.py sends the command and exit code to a local model through Ollama's HTTP API and prints one dim purple line. 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. Temperature 0.9 and a 48-token cap keep it short and weird. Try it: ollama pull gemma3:4b python3 ghost.py "rm -rf node modules" --code 1 echo 'source /path/to/shell-ghost/haunt.zsh' ~/.zshrc Set GHOST ODDS=1 and it speaks after every command. A terminal sees everything: your commands, paths, hostnames, sometimes secrets typed inline. Sending that to a hosted API for a joke would be a bad trade. With an open-weight model running locally: localhost . --model swaps in any model Ollama can run. A 4B model is plenty for one spooky sentence, and that's the point: small, open models are good enough to make tools feel alive without a cloud dependency. splitlines 0 is still a cheap safety net.