GhostTrace:讓終端機帶有幽靈氛圍的本機 AI
GhostTrace — A Local AI That Makes Your Terminal Feel Haunted
GhostTrace 是一款在本機執行的終端機 AI 夥伴,使用開放權重模型 Qwen2.5-1.5B-Instruct,無需連接雲端 AI API。v1.2.0 整合 AI 對話、SQLite 持久記憶、恐怖氛圍音效及終端互動,並為敏感終端操作加入安全防護。
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:
- AI Engine — Loads the local GGUF model and manages inference.
- Memory System — Stores conversational context and persistent information.
- Terminal Interface — Provides the interactive Textual experience.
- Audio Engine — Manages audio playback and atmospheric effects.
- Horror Director — Coordinates haunted interactions and scheduled events.
- 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.
來源:DEV Community · dev.to