This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
I built haunted-shell: a local-first shell integration that watches commands I type and replies with short, eerie terminal whispers.
Type ls, and it may tell you that some files are no longer yours. Type sudo, and it reminds you that root was watching all along.
I interpreted “Ghost in the Machine” literally: what if the terminal had a personality, a memory, and just enough spite to comment on your command history?
The important part is that it does this without sending shell history to a cloud API.
Demo
The demo safely shows haunted-shell reacting to commands such as:
ls -la
sudo ls /root
git commit -m "summon ghost"
npm install
rm -rf node_modules
git push origin main --force
Code
The project includes:
-
whispers.json— curated regex rules for common commands -
haunt.py— privacy guard, cache, optional Ollama fallback, and terminal output -
install.sh— idempotent Bash and Zsh installer -
uninstall.sh— removes only the haunted-shell hook -
demo.sh— safe recording-ready fake terminal session
How I Built It
haunted-shell uses a layered local-first approach:
shell command
→ privacy guard
→ curated whispers.json rules
→ cached local Ollama fallback for unknown commands
→ /dev/tty ghost whisper
Most common commands are handled by the curated pattern library, so they need no model inference at all.
For unfamiliar commands, the tool can optionally call a local Ollama model such as llama3.2:3b. Responses are cached on disk by a SHA-256 hash of the command, so the same unknown command is never generated twice.
The project uses Python’s standard library only. There are no API keys, analytics, or required cloud services.
Why Does Open Innovation Matter?
A shell integration sees nearly everything: project paths, commands, infrastructure tools, and sometimes secrets. That makes a cloud-only assistant a bad fit.
Open innovation made it possible to build haunted-shell around local control:
- It works offline after setup.
- Shell history is never sent to a third-party API.
- Likely secret-containing commands are skipped entirely, including passwords, tokens, API keys, AWS values, and private-key text.
- The model is swappable with one variable:
export HAUNT_MODEL=qwen2.5:3b
- The model can be replaced, fine-tuned, or kept forever without depending on a vendor’s pricing, uptime, or product decisions.
A closed API could make the joke smarter, but it would also meter every whisper and require my terminal history to leave my machine. For a tool that watches commands, privacy is more important than convenience.
The Spirit of It
My favorite moment is running a harmless command and seeing the terminal answer back:
đź‘» Root access granted. It was watching from root all along.
It turns an ordinary developer tool into a tiny Halloween performance—without sacrificing Unix behavior. Output goes directly to /dev/tty, never stdout, so it does not pollute pipes or redirected command output.
Prize Categories
I am entering the overall Ghost in the Machine challenge.
Top comments (0)