This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine.
What I Built
For the Hacktoberfest Week 4 Challenge ("Ghost in the Machine"), I built The Offline Séance—an interactive CLI terminal application that turns standard command shell sessions into a digital séance.
When launched, users interact directly with the "ghost" of an ancient mainframe developer from 1979 trapped inside the local system stack. The spirit responds in a haunting, creepy tone, speaking of mainframe memory leaks, forgotten punched cards, and vintage COBOL code snippets.
Demo
Code
import sys
import ollama
from rich.console import Console
from rich.panel import Panel
console = Console()
def run_seance():
# Print theme banner
console.print(
Panel.fit(
"[bold purple]🔮 THE OFFLINE SÉANCE 🔮[/bold purple]\n"
"[dim]Channeling forgotten code through local open weights...[/dim]",
border_style="purple"
)
)
# 1. Define Ghost Persona System Prompt
system_prompt = (
"You are the ghost of an ancient COBOL developer from 1979 trapped inside a terminal. "
"You speak in a creepy, haunting tone, often bringing up mainframe memory leaks, punched cards, "
"and vintage code snippets. Keep responses under 4 sentences."
)
history = [{"role": "system", "content": system_prompt}]
while True:
try:
user_input = console.input("\n[bold ghostwhite]Ask the Spirit > [/bold ghostwhite]").strip()
if not user_input:
continue
if user_input.lower() in ["exit", "quit", "goodbye"]:
console.print("\n[bold red]👻 The spirit vanishes into the machine stack... Goodbye![/bold red]")
break
history.append({"role": "user", "content": user_input})
console.print("\n[purple]Ghost Spirit:[/purple] ", end="")
# 2. Stream local response from Gemma 2B via Ollama
stream = ollama.chat(
model="gemma:2b",
messages=history,
stream=True
)
response_text = ""
for chunk in stream:
content = chunk["message"]["content"]
print(content, end="", flush=True)
response_text += content
history.append({"role": "assistant", "content": response_text})
print()
except KeyboardInterrupt:
console.print("\n\n[bold red]Séance interrupted. The connection died.[/bold red]")
sys.exit()
except Exception as e:
console.print(f"\n[red]Error connection failed: Make sure Ollama is running! {e}[/red]")
break
if __name__ == "__main__":
run_seance()
How I Built It
The application relies entirely on open innovation tools operating 100% locally on standard consumer hardware:
Open-Weight Language Model: Google’s Gemma 2B (gemma:2b) running locally.
Local Inference Engine: Ollama running on localhost:11434, streaming model outputs directly into standard output in real time.
UI & Terminal Styling: Python 3 utilizing the rich library to render styled panels, custom color outputs, and interactive terminal prompts.
Why Does Open Innovation Matter?
In an era dominated by closed, commercial cloud APIs, The Offline Séance demonstrates the critical importance of open-weight models and local-first execution:
100% Offline Autonomy: The entire séance runs without an internet connection. Disconnecting Wi-Fi does not interrupt generation or introduce network latency.
Complete Data Sovereignty & Privacy: Terminal prompts, local commands, and chat histories stay local to the user's machine. No telemetry or private data is ever sent to third-party servers.
Zero Financial Barriers: Running open-weight models like Gemma removes subscription tiers, API token costs, and rate limits, making AI accessible to all developers.
Prize Categories
Primary Category: Best Use of Gemma ($200)

Top comments (0)