DEV Community

KUSAL SARKAR
KUSAL SARKAR

Posted on

GhostTrace — A Local AI That Makes Your Terminal Feel Haunted

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

What I Built

GhostTrace is a local, terminal-based AI companion with a haunted personality.

I interpreted Ghost in the Machine as the idea of giving a machine a personality that feels almost alive — something that doesn't just answer questions, but creates an atmosphere around every interaction.

Instead of building another ordinary AI chatbot, I wanted to create an experience where the terminal itself becomes part of the character.

GhostTrace combines local AI inference with a collection of interactive horror-themed features:

  • Local AI Conversations: Chat with a locally running Qwen2.5-1.5B model without depending on a cloud AI API.
  • Persistent Memory: Conversations and relevant information can be stored and recalled using SQLite.
  • Haunted Keystrokes: Typing becomes part of the horror experience through atmospheric effects.
  • Scheduled Whispers: Ambient audio events can occur during idle periods.
  • Dynamic Horror Director: Coordinates atmospheric effects to make the experience feel less predictable.
  • Audio Engine: Handles sound effects and background audio through a dedicated audio subsystem.
  • Command Guardian: Adds a safety layer around potentially sensitive terminal operations.

The project has evolved through multiple versions, with v1.2.0 bringing together its AI, memory, audio, terminal interface, and horror systems.

GhostTrace is a desktop terminal application, so it runs locally rather than as a conventional hosted website.

The most interesting part to demonstrate is the combination of an AI conversation, haunted terminal interactions, and ambient audio.

Code

GitHub Repository: https://github.com/kusalar/GhostTrace

The project is designed to run on Windows and keeps its large GGUF model outside the source repository.

How I Built It

GhostTrace is built around Qwen2.5-1.5B-Instruct, an open-weight language model running locally through llama.cpp.

The goal was to make the experience independent of proprietary hosted AI APIs.

Technology Stack

  • Language: Python 3.11
  • AI Model: Qwen2.5-1.5B-Instruct (GGUF, Q4_K_M)
  • Inference: llama.cpp
  • Terminal Interface: Textual
  • CLI: Typer
  • Database: SQLite
  • Audio: MiniAudio-based audio subsystem
  • Testing: Pytest
  • Code Quality: Ruff

Architecture

The application combines several independent subsystems:

  1. AI Engine — Loads the local GGUF model and manages inference.
  2. Memory System — Stores conversational context and persistent information.
  3. Terminal Interface — Provides the interactive Textual experience.
  4. Audio Engine — Manages audio playback and atmospheric effects.
  5. Horror Director — Coordinates haunted interactions and scheduled events.
  6. Command Guardian — Provides safeguards for terminal commands.

One of the biggest engineering challenges was making local inference and audio work smoothly alongside a responsive terminal interface.

Running a language model on a CPU-only laptop also meant paying close attention to memory usage, inference latency, threading, and UI responsiveness.

I wanted the project to remain usable on modest hardware instead of assuming everyone has access to a powerful GPU.

Why Does Open Innovation Matter?

Open innovation is central to GhostTrace.

Using an open-weight model and local inference gives developers control over how their AI applications operate.

For this project, it made several things possible:

  • Local execution: Conversations don't need to be sent to a third-party generative AI API.
  • Model ownership: Developers can choose, replace, and experiment with compatible models.
  • Transparency: The inference pipeline and application architecture can be inspected and modified.
  • Accessibility: A relatively small model makes experimentation possible on consumer hardware.
  • Experimentation: The AI can be integrated with memory, audio, and terminal tools without being restricted to a hosted chatbot interface.

A closed API could provide conversational intelligence, but GhostTrace needed something more: control over the complete experience, from inference to terminal interaction.

Open-source software and open-weight models made that experimentation possible.

The Spirit of It

The idea behind GhostTrace is simple:

What if your terminal didn't always feel like a tool? What if it felt like something was living inside it?

Imagine opening your terminal late at night, typing a command, and hearing an unexpected whisper during a quiet moment.

The AI is not just a window waiting for prompts. Its environment, sounds, memory, and interactions contribute to its personality.

I wanted to build something that makes people pause for a second and wonder whether the machine is simply responding — or whether it has developed a character of its own.

That's the spirit of GhostTrace: a little bit of AI engineering, a little bit of horror, and a terminal that doesn't always feel empty.

Top comments (0)