This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine This week's theme is "Ghost in the Machine" β something spooky, built with open-source AI. I took it fairly literally: I built a terminal that's haunted. Haunted Terminal is a shell. You type real comman
ds β ls, mkdir, git status, rm, whatever β and they run exactly like they would anywhere else. But something is watching. After every command, a ghost β a local open-weight model running through Ollama β reacts to what you just did. One short, eerie, in-character line, every time.
Delete something and it mourns it. Run sudo and it treats it like a dangerous summoning. A command fails, and it mocks you, gently. When you leave, it says goodbye β and it remembers: the whole session gets saved to a haunting_*.md log, a small ledger of everything it watched you do, like a ghost keeping a diary of the living.
A real session, nothing staged: π» haunted-terminal > ls docs haunted_terminal.py π» Files of the living, how... tedious. π» haunted-terminal > mkdir ghost_test π» A new home for me now. π» haunted-terminal > rm -r ghost_test π» My little experiment...
gone to dust. π» haunted-terminal > sudo whoami sudo: a password is required π» Little one still learning, I suppose. π» haunted-terminal > exit π» Your departure won't silence me, I've watched others like you forever, in these cold, echoing halls. The ghost remembers.
Saved to haunting_20261027_1737.md. Notice it never repeats the command back verbatim and never breaks character into an explanation β that's enforced by the prompt, not scripted responses. Every line above came straight from the model. / haunted-terminal π» Haunted Terminal A shell possessed by a ghost.
Built for Hacktoberfest 2026 Week 4: "Ghost in the Machine" β build something spooky with open-source AI. What it does Haunted Terminal is a small interactive shell. You type real commands β ls, git status, mkdir, whatever β and they run exactly like they would in a normal terminal. But after each one, a ghost is watching.
A local open-weight model (Llama 3.2 via Ollama) reacts to what you just did: eerie, witty, in character, one line, every time. Delete something and it mourns it. Run sudo and it treats it like a dangerous summoning. Fail a command and it mocks you, gently.
When you exit, it says goodbye β and it remembers: every session is saved to a haunting_*.md log, a little ledger of everything it watched you do. Demo That's a real captured session ββ¦ View on GitHub One Python file, standard library only β no dependencies beyond Ollama itself. The stack: Part What I used The ghost Llama 3.2 (3B), local, via Ollama Command execution subprocess.run(cmd, shell=True, cwd=...) β real shell syntax, pipes and all Working directory cd handled specially so it persists across commands (subprocess alone can't do this) Built and tested on a laptop: Ubuntu, 15 GB RAM, no GPU. The first version of the ghost's replies sometimes broke character β a stray stage direction in asterisks, a quoted line, a 40-word aside explaining the joke.
I tightened the system prompt to explicitly forbid quotation marks, asterisks, and explanations, and capped it at one plain-text line, 20 words. That alone fixed almost all of it β small models follow hard constraints much better than soft suggestions like "keep it brief." The ghost only ever sees the command text and whether it succeeded or failed β never the actual command output. That was a deliberate choice: output can be huge, sensitive, or binary, and the ghost doesn't need to read your cat secrets.env to react to the fact that you ran it. Reacting to what kind of thing you just did (deleting, summoning root, failing) turned out to be both simpler and funnier than reacting to raw text.
If Ollama isn't running, the shell still works as a completely normal shell β the ghost just goes quiet instead of crashing the whole thing. A haunting is a bonus, not a dependency. --quiet mode Commenting on literally every ls gets old fast in a long session, so --quiet only triggers the ghost on commands that are actually interesting: rm, sudo, git, mv, kill, chmod, chown, or anything that fails. It works with the lights (and the internet) off. Once the model's pulled, the ghost haunts you completely offline. No connectivity check, no "service unavailable," just a possessed shell on a plane. Your terminal history is one of the most private things on your machine. Half-typed commands, file paths, project names, the occasional pasted secret you immediately regret β none of that should be going to a cloud API just so a shell can crack a joke.
Running it locally means it never leaves the laptop. It's meant to be left running constantly, so it has to be free. The entire gag only works if the ghost comments on everything, all session, every day. A per-call API charge would turn a toy into a bill.
A local 3B model makes "haunt me forever" cost nothing. No model to lose. This is a silly, personal tool β exactly the kind of thing that would get orphaned if a cloud provider deprecated the model it depended on. An open weight I've already downloaded doesn't get discontinued out from under a joke.
Try It Out git clone https://github.com/VIKRAM-009/haunted-terminal cd haunted-terminal ollama pull llama3.2 python3 haunted_terminal.py Type exit or quit when you're ready to leave β the ghost gets the last word. π GitHub Repository: VIKRAM-009/haunted-terminal Thanks for reading, and happy Halloween. Something is still watching your terminal. π»
Key Takeaways #
- β’But something is watching.
- β’This story was reported by Dev.to , covering developments in thedev space.
- β’AI advancements continue to reshape industries β read the full article on Dev.to for complete coverage.
π Continue reading the full article:
Read Full Article on Dev.to β