cd /news/ai-tools/the-haunted-terminal-an-offline-ghos… · home › topics › ai-tools › article
[ARTICLE · art-159169] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

The Haunted Terminal — An Offline Ghost in the Machine

A developer built The Haunted Terminal, a command-line script that passes each executed command to an AI model and prints back a short, spooky, command-specific response in the voice of a terminal ghost. The demo calls Google's Gemini API, but a 503 high-demand spike at the Hacktoberfest deadline forced a switch to a local open-source model fallback for the recorded demo.

by read1 min views2 publishedOct 28, 2026

The Haunted Terminal. It's a script that hooks into your command line. Every time you run a command, an open-source AI model acts as a "ghost" in the machine, whispering a creepy, customized response based on what you just did.

This fits the "Ghost in the Machine" theme perfectly. It brings the idea of a haunted computer to life by giving the terminal a spooky, autonomous personality.

Command run: python3 haunted_terminal.py "rm -rf /"

Ghost's Whisper: "Ah, trying to delete the world with rm -rf /, are we? The abyss is already empty, just like your recycle bin will be. I will be waiting in the dark..."

(Note: The AI generated this locally, but right at the Hacktoberfest deadline, Google's free API servers were experiencing a massive 503 high-demand spike, so I used a local fallback for the demo.)

python
import os
import sys
import requests

API_KEY = os.environ.get("GEMINI_API_KEY")
URL = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-3.7-flash:generateContent?key={API_KEY}"

command = " ".join(sys.argv[1:])

if not command:
    print("👻 The spirit is sleeping. Pass a command like: python3 haunted_terminal.py ls -la")
    sys.exit()

prompt = f"""You are a ghost haunting a developer's terminal. 
The developer just ran this command: '{command}'.
Whisper a short, spooky, eerie response in 1 or 2 sentences. 
Be creepy, but keep it related to what the command actually does."""

payload = {"contents": [{"parts": [{"text": prompt}]}]}
response = requests.post(URL, json=payload)
data = response.json()

try:
    answer = data["candidates"][0]["content"]["parts"][-1]["text"]
    print(f"\n👻 [The Ghost whispers]: {answer}\n")
except Exception as e:
    print(f"\nError: {e}")
── more in #ai-tools 4 stories · sorted by recency
── more on @google 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/the-haunted-terminal…] indexed:0 read:1min 2026-10-28 · —