Haunted Terminal: a shell possessed by a ghost A developer submission for the Hacktoberfest 2026 Week 4 "Ghost in the Machine" open-source AI challenge, Haunted Terminal, is a Python shell that runs real commands via subprocess.run and, after each one, has a local Llama 3.2 3B model served through Ollama emit a single in-character line reacting to what was typed. The ghost sees only the command text and whether it succeeded or failed — never the command output — and each session is saved to a haunting_*.md log; the author capped replies at one plain-text line of 20 words and forbade quotation marks, asterisks and explanations in the system prompt, which fixed most character breaks. The shell falls back to a normal terminal when Ollama is not running, and was built and tested on an Ubuntu laptop with 15 GB RAM and no GPU. Haunted Terminal: a shell possessed by a ghost 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 the dev 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 → https://dev.to/vikram rautela vr/haunted-terminal-a-shell-possessed-by-a-ghost-41pb