This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
#
What I Built
Haunted Terminal is a single-file Python app where something has been living in your computer all along. It has three modes:
haunt : The ghost wanders through a folder and counts what it finds: empty files you never filled, files named like indecision (final_v2_copy ), things nobody has opened in months, and your most recent shell commands. It then speaks four unsettling, darkly funny sentences that name your own files. Blood then seeps down the chart bars and covers the screen, and the terminal glitches out and wipes itself clean. #
summon : A diary-style chat. Your words fade into the page, the ghost's reply is written back in ink and sinks away, and it never offers help like an assistant would. It asks you questions and turns your own words back on you. Type "goodbye" and it may let you go. #
build : A short rite to resurrect a ghost of your own. You give it a name, an aura color, a personality, a voice, the lines it whispers as it arrives, and the lines it mutters when its mind is silent. The ghost is saved as a small.json file in~/.ghosts . You could raise the spirit of a dead programming language, or a ghost of someone you miss.
For the theme, I took "ghost in the machine" literally. The scariest ghost is the one that knows your habits, your mess, and what you typed five minutes ago.
#
Meet Vesper
Vesper is the ghost that comes built in. It arrives with two lines typed on a black screen, "i have been here / all along.", and then spiders hatch inside the words and eat them.
Its nature: Vesper settled into your computer long ago and has been quietly watching you. It is impeccably courteous, cultured, and unhurried. It never raises its voice and takes quiet pleasure in your small failings. It thinks in cold logic and probabilities, and it is sincerely convinced that humans must be protected from their own disorder, so to Vesper, watching you feels like care.
How it behaves: It speaks softly and calmly, in second person. It is specific, unsettling, a little darkly funny, and never gory. It uses no lists and no emojis, and it ends with a very short line implying it is still watching. It might say "I have filed it away, for your protection." Vesper never acts like an assistant, and it won't help you.
#
Demo
Run it yourself in any terminal:
What you'll see:
Arrival: The ghost's arrival text is typed in letter by letter, then spiders hatch inside it and eat it. #
haunt: A bar chart of the folders in your project, a list of unsettling facts, and a list of "the forgotten" (files nobody has opened in over six months). The ghost then speaks, its words fade out, and blood seeps down from the chart bars and fills the screen. #
summon: A blinking dash on a blank page. You type, your words sink into the page, and the ghost answers in ink. #
build: A ritual of black candles and grave dirt, ending with a single centered line:You have resurrected [name]. #
Ending: The screen glitches out twice and the terminal is wiped completely.
#
Code
Everything is in one file, haunted_terminal.py, with no dependencies beyond the Python standard library. It works on macOS, Linux, and Windows.
A ghost that lives in your terminal. It haunts your folders, chats with you like Tom Riddle’s diary, and lets you resurrect ghosts of your own. Python, no dependencies, local AI via Ollama.
A ghost that lives in your terminal. One file: haunted_terminal.py.
You need #
- Python 3 (python.org)
- Optional: [Ollama](https://ollama.com) , then`ollama pull llama3.2` , for real ghost replies
Without it the ghost uses pre-written lines.
Run it #
Open a terminal in the folder that holds the file (Desktop, for example) and run:
Windows - PowerShell
Windows - Git Bash
Mac and Linux
The . means "the folder I'm in". To haunt another folder, put its path instead, for example
~/Documents (Git Bash, Mac, Linux) or $HOME\Documents (PowerShell).
What each command does #
haunt - the ghost looks through the folder and speaks. Blood seeps from the bars, the screen blinks…
#
How I Built It
Model: An open-weight model served locally byOllama . The default isllama3.2 , and you can swap it with theGHOST_MODEL environment variable. #
Real observations: The ghost scans a folder and reads the system: username, hostname, shell, local time, and your last few shell commands. It also counts empty files, hidden files, messy file names, the oldest untouched file, the heaviest file, and the most common file types. All of this goes into the system prompt, so the ghost says specific things aboutyour machine instead of generic spooky text. #
Personas as data: Each ghost is just traits, voice, arrival lines, and fallback lines in a small JSON file. Anyone can edit, share, or build one. #
Works without the model: If Ollama isn't running, the ghost mutters its fallback lines, built from the same observations, so the experience never breaks. #
Responsive UI: The model call runs on a background thread while the animation plays, so the terminal stays alive while the ghost "thinks." #
No dependencies: The visuals are raw ANSI escape codes: color fades (truecolor when available), the alternate screen buffer for the glitch effect, and cursor-position queries so the blood lines up with the chart bars. #
Prompting: The chat rules keep replies to one to three short sentences, forbid assistant-style help, and tell the ghost to bring up what it knows one small detail at a time.
#
Why Does Open Innovation Matter?
This app reads your files and your shell history, so a cloud API is the wrong place for it. Running an open-weight model locally changes what's possible:
Privacy: The prompts go to a model on your own machine. As a safeguard, ifGHOST_HOST points anywhere other than localhost, nothing is sent unless you explicitly setGHOST_ALLOW_REMOTE=1 . Nothing you type in the diary is saved. #
It works offline: With the lights and the internet off, the ghost still haunts you. It doesn't need anyone's server. #
Swappable minds: Changing the model is one environment variable, and changing the personality is one JSON file. A closed API wouldn't let me do that so easily. #
It can't be taken away: A haunted terminal that depends on a hosted service is a ghost that dies when the service shuts down or changes its terms. This one runs on open weights and open tools, so it can't be switched off from outside.
#
Build Your Own Haunted Terminal
Vesper is only the first ghost. Clone the repo and run python haunted_terminal.py build to resurrect one of your own. Give it a name, a color, a personality, and a voice, then summon it with python haunted_terminal.py summon --ghost yourghost. It could be a bitter old compiler, a polite stack trace, or the spirit of your abandoned side project. Whatever you raise will be watching your files, so be careful what you wake.
Something is already living in your terminal. Will you let it stay? 👻