GhostTrace — A Local AI That Makes Your Terminal Feel Haunted (Java Edition) A developer built GhostTrace (Java Edition), an offline-first terminal companion that wraps a JLine 3 REPL in a haunted persona and runs local AI through Ollama with an offline fallback. The tool intercepts dangerous commands such as rm -rf, dd disk overwrites and curl-piped bash, requiring single-use HMAC-SHA256 approval tokens, and pairs a persistent SQLite memory (WAL mode) with a code indexer, procedural DSP horror audio and host telemetry. It is packaged as a standalone fat JAR via maven-assembly-plugin. This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine. GhostTrace Java Edition is an offline-first, local terminal companion designed for developers, wrapped inside an atmospheric, haunted persona. When approaching the Ghost in the Machine theme, I wanted to explore what happens when your command-line interface stops behaving like a passive pipe and starts feeling like a living, conscious digital entity. Instead of another cloud-tethered chatbot wrapper, GhostTrace turns the terminal into an interactive haunted mainframe that observes your commands, reacts to your coding sessions, and protects your system. ╔═════════════════════════════════════════════════════════════════════════════╗ ║ ██████╗ ██╗ ██╗ ██████╗ ███████╗████████╗████████╗██████╗ █████╗ ██████╗███████╗ ║ ║ ██╔════╝ ██║ ██║██╔═══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔══██╗██╔══██╗██╔════╝██╔════╝ ║ ║ ██║ ███╗███████║██║ ██║███████╗ ██║ ██║ ██████╔╝███████║██║ █████╗ ║ ║ ██║ ██║██╔══██║██║ ██║╚════██║ ██║ ██║ ██╔══██╗██╔══██║██║ ██╔══╝ ║ ║ ╚██████╔╝██║ ██║╚██████╔╝███████║ ██║ ██║ ██║ ██║██║ ██║╚██████╗███████╗ ║ ║ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝ ║ ║ ║ ║ + THE AI THAT HAUNTS YOUR TERMINAL :: JAVA EDITION v1.2.0 ║ ║ + Offline-First :: Autonomous Safety Guardian :: Haunted Memory ║ ╚═════════════════════════════════════════════════════════════════════════════╝ rm -rf , raw disk overwrites dd of=/dev/... , system shutdowns, curl ... | bash , git reset --hard with HMAC-SHA256 single-use cryptographic approval tokens. javax.sound.sampled , plus pure-Java procedural DSP synthesis. ░▒▓█ . TerminalBuilder , LineReader , Completer , DefaultHistory sqlite-jdbc WAL mode enabled java.net.http.HttpClient maven-assembly-plugin to output a standalone fat JAR The application is structured into decoupled, event-driven subsystems: ┌─────────────────────────────────────────────────────────────────────────────┐ │ GhostTrace Java Architecture │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ Interactive Terminal REPL JLine 3 │ │ │ │ Phosphor CRT Glow :: Auto-Completion :: History │ │ │ └───────────────────┬─────────────────────────────┬───────────────────┘ │ │ │ │ │ │ ┌──────────────▼─────────────┐ ┌─────────────▼──────────────┐ │ │ │ Ghost Persona & Mood │ │ Command Guardian │ │ │ │ 3 Profiles & Mood Decay │ │ Risk Rules & HMAC Tokens │ │ │ └──────────────┬─────────────┘ └─────────────┬──────────────┘ │ │ │ │ │ │ ┌──────────────▼─────────────┐ ┌─────────────▼──────────────┐ │ │ │ Local AI / SpectralBrain │ │ Persistent SQLite Memory │ │ │ │ Ollama HTTP + Offline Fall │ │ WAL Mode & Code Indexer │ │ │ └──────────────┬─────────────┘ └─────────────┬──────────────┘ │ │ │ │ │ │ ┌──────────────▼─────────────┐ ┌─────────────▼──────────────┐ │ │ │ Horror Audio & DSP Mixer │ │ Host System Telemetry │ │ │ │ javax.sound 20 WAVs + Synth│ │ CPU, RAM, Disk, Health │ │ │ └────────────────────────────┘ └────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ Before executing potentially destructive operations in the terminal, the Guardian intercepts and classifies command risk LOW , MEDIUM , HIGH , CRITICAL : CommandAnalysis analysis = guardianEngine.analyze "rm -rf /" ; // Flagged: // Risk : Critical Risk // Status : BLOCKED // Details: Matched DEL-001 Recursive Force File Deletion // Token : Wi05M9P3zb05xwJ0 Single-use HMAC-SHA256 signature High-risk actions require a cryptographic approval token guard approve