This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
Haunted Shell is a terminal where a ghost lives. You type normal commands like dir, echo hello or cd .., the command runs as usual, and then a ghost whispers one eerie sentence about what you just did.
For the "Ghost in the Machine" theme, I took it literally: what if the computer you use every day had a spirit inside it that noticed everything you did? The ghost is powered entirely by an open-weight model running on my own laptop.
Code
đź‘» Haunted Shell
A tiny shell where a ghost whispers an eerie comment after every command you run. Built for the “Ghost in the Machine” theme, powered by an open-weight model running locally.
Demo demo Why open-source AI? Offline: works with Wi-Fi off, using Gemma 3 4B through Ollama. Private: your commands, paths and filenames never leave your laptop. Free: no API keys, no usage bills, no rate limits. Swappable: change MODEL = "gemma3:4b" to try any other Ollama model. Run it Install Ollama from https://ollama.com and run ollama pull gemma3:4b Run python haunt.py Type commands like dir or echo hello and listen for the ghost. How it works
haunt.py runs your command, then sends it to the local Ollama server (localhost:11434), which asks Gemma 3 for a one-line spooky whisper. About 30 lines of Python, no dependencies.
License
MIT
How I Built It
- Model: Gemma 3 4B, an open-weight model from Google
-
Inference: Ollama, which runs the model locally and exposes an API at
localhost:11434 - Code: one Python file (about 30 lines) using only the standard library, with no pip installs
How it works:
- The script reads a command from the user and runs it with
subprocess. - It sends the command to the local Ollama server with a prompt: "You are a ghost trapped in their computer. Whisper ONE short eerie sentence."
- Gemma 3 replies and the whisper is printed in purple after the command output.
I used keep_alive so the model stays loaded in memory after the first call, which keeps later whispers fast. If the model can't be reached, the ghost just says "...the spirit is silent..." instead of crashing.
Why Does Open Innovation Matter?
- It works offline. I turned off Wi-Fi and the ghost still whispered. There is no server to reach and no outage that can silence it.
- It's private. A shell sees everything: file paths, folder names, hostnames, and sometimes secrets. With a local model, none of that leaves my laptop. A closed API would receive every command I type.
- It costs nothing. No API keys, no usage bills and no rate limits, so I can run it all day.
-
It's swappable. Changing one line (
MODEL = "gemma3:4b") switches to any other Ollama model, so I can give the ghost a different personality or try a smaller or larger model. - It can't be taken away. Open weights run for as long as I have the files. A vendor can't deprecate the model or shut down the service my project depends on.
Top comments (0)