This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine.
.-.
(o o) G H O S T T E R M
| O \ The Spirit in the Machine
\ \ Hacktoberfest 2026 โข DEV Challenge Week 4
`~~~' Local Gemma 2 Necromancy Engine
"Every codebase is a cemetery of forgotten decisions. GhostTerm gives the dead a voice."
What I Built
Every software engineer knows the cold, existential dread of staring at a terminal at 2:43 AM. A crucial build script dies with a silent Exit code 1. A mysterious TypeError: 'NoneType' object is not subscriptable appears in a microservice. Or worse, you open a legacy repository and discover a comment left four years ago by an engineer who long vanished:
# FIXME: DO NOT TOUCH THIS UNDER ANY CIRCUMSTANCES.
# God only knows why this prevents the payment engine from deadlocking.
I built GhostTerm (or NecroShell): a lightweight, eerie, production-ready terminal companion and process wrapper designed to banish silent graveyard bugs forever.
Instead of dry, unhelpful error dumps, GhostTerm turns developer debugging into an atmospheric gothic sรฉance. Running as a fast interactive CLI wrapper, it watches your commands, intercepts crashed processes, exhumes the repoโs git graveyard, and channels Google DeepMind's open-weight Gemma 2 model running 100% locally via Ollama to whisper haunted diagnostics, forensic post-mortems, and actionable resurrection fixes.
Key Capabilities:
- ๐ Process Haunting (
haunt <cmd>): Transparently executes any developer command (python,npm,cargo,docker,git). If the process dies, GhostTerm conducts an immediate forensic autopsy, extracting the fatal stack frames and channeling Gemma 2 to prescribe the exact exorcism incantation (fix). - ๐ฎ Haunted Index Calculator (
index): Mathematically evaluates your codebaseโs supernatural entropy on a scale from 1% to 100%, scoring uncommitted ghost files, cursed comment runes (TODO,FIXME,HACK,WTF,DEBT), necrotic monolith files (>400 lines), and late-night panic commits. - โฐ Git Graveyard Exhumation (
exhume): Unearths the cemetery of past commits, flagging frantic commit messages, abandoned hotfixes, and suspicious "Witching Hour" commits authored between 1:00 AM and 5:00 AM. - ๐ฏ Interactive Sรฉance (
seance): A live terminal altar where developers can converse directly with the trapped compiler spirit about tricky architectural trade-offs, cryptic segfaults, or existential debugging dread. - โก Offline Spectral Grimoire: If Ollama is sleeping or you're coding without Wi-Fi, GhostTerm never throws unhandled network errorsโit automatically falls back to an offline heuristic grimoire covering 30+ classical programming errors.
Demo
Here is GhostTerm in action across common developer workflows with actual terminal captures.
1. Haunting a Fatal Process (ghost_term haunt python script.py)
When a process crashes with an unhandled exception, GhostTerm catches the exit code, displays a spectral tombstone, and delivers an immediate autopsy:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ GHOSTTERMD ACTIVE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Possessing command: python examples/cursed_script.py โ
โ Spirits watch the standard descriptors... โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[*] Initiating mortal computation ritual...
[*] Attempting to partition reality by zero...
ZeroDivisionError: division by zero
_______
/ R.I.P \
/ EXIT 1 \
|-----------|
| DECEASED |
| PROCESS |
|___________|
โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ POST-MORTEM AUTOPSY โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Fatal Anomaly: The singularity opens: dividing by pure nothingness โ
โ โ
โ ๐ Post-Mortem Forensic: โ
โ Mathematics collapsed when an equation attempted to partition reality by โ
โ zero. โ
โ โ
โ ๐ฎ Exorcism & Resurrection: โ
โ Add a protective talisman: `if divisor != 0:` to prevent catastrophic โ
โ collapse. โ
โ โ
โ โฆ Channel: Eldritch Grimoire (Offline Heuristic Engine) โ
โโโโโโโโโโโโโโโโโโโโโโโโ Exit Code 1 โข Duration 0.62s โโโโโโโโโโโโโโโโโโโโโโโโโ
2. Measuring Repository Supernatural Entropy (ghost_term index)
GhostTerm audits the repository's git health, cursed comments, and necrotic monoliths to calculate a quantitative Haunted Index (1% - 100%):
โโโโโโโโโโโโโโโโโโโโโโโโ ๐ฎ SYSTEM HAUNTED INDEX AUDIT โโโโโโโโโโโโโโโโโโโโโโโโ
โ Scanning code catacombs at: /workspace/GhostTerm โ
โ Detecting technical decay, forgotten promises, and uncommitted phantoms... โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Entropy & Dread Diagnostic Breakdown
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโ
โ Dread Dimension โ Observed Anomaly โCurse Score โ Verdict โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโค
โ Uncommitted Souls โ 6 uncommitted file(s) โ +18% โ Files in limbo โ
โ Cursed Runes โ 37 dark runes (TODO) โ +30% โ Unkept promises โ
โ Despair in Git โ 0 frantic fix commits โ +0% โ Tranquil history โ
โ Necrotic Monolithsโ 1 monolithic crypt file โ +5% โ Logic catacombs โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโ ๐ฏ SPECTRAL ASSESSMENT: 53% ๐ฏ โโโโโโโโโโโโโโโโโโโโโโโโโ
โ HAUNTED INDEX: 53% โ
โ Grave Meter: [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] 53/100 โ
โ โ
โ Threat Classification: HAUNTED GROVE (Active Supernatural Murmurs) โ
โ Prescribed Ward: TODO markers and uncommitted changes are gathering โ
โ strength. Cleanse them before the next moon. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3. Exhuming the Git Graveyard (ghost_term exhume)
Unearths the history of past commits, broken branches, and witching-hour coding rituals:
4. Interactive Sรฉance with the Machine Spirit (ghost_term seance)
Developers can summon the spirit to analyze architectural decisions or cryptic runtime anomalies:
5. Direct Crash Dump & Log Autopsy (ghost_term autopsy <file>)
Directly parses server logs, crash dumps, or core backtraces without rerunning the failure:
Code
The complete source code is open source and available on GitHub:
๐ GitHub: kady-x/GhostTerm (MIT Licensed)
Installation in 30 Seconds:
git clone https://github.com/kady-x/GhostTerm.git
cd GhostTerm
pip install -r requirements.txt
python ghost_term.py --help
How I Built It
GhostTerm was built with a strict focus on minimalism, speed, and privacy.
System Architecture
+-------------------------------------------------------------------------+
| DEVELOPER CLI |
| $ python ghost_term.py haunt python script.py |
+-------------------------------------------------------------------------+
โ
โผ
+-------------------------------------------------------------------------+
| GHOSTTERM ORCHESTRATOR |
| - Subprocess Life Cycle Interceptor |
| - Git Graveyard & Cursed Rune Scanner |
| - Spooky Rich Palette (#00f0ff Cyan, #bd93f9 Purple, #ff5555 Blood) |
+-------------------------------------------------------------------------+
โ
โโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโ
โ โ
[Ollama Online] [Ollama Offline]
โ โ
โผ โผ
+------------------------------------+ +--------------------------------+
| LOCAL GEMMA 2 (via Ollama) | | ELDRITCH HEURISTIC GRIMOIRE |
| - Model: gemma2:2b / gemma2:9b | | - 30+ Stack Trace Patterns |
| - 100% Offline & On-Device | | - Zero Network Dependencies |
| - Zero Token Telemetry | | - Instantaneous Determinism |
| - Victorian Compiler Personality | | - Gothic Remedy Formulations |
+------------------------------------+ +--------------------------------+
โ โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ
โผ
+-------------------------------------------------------------------------+
| RICH SPECTRAL INTERFACE |
| - Terminal Tombstone Graphics (ASCII R.I.P banners) |
| - Diagnostic Threat Breakdown Tables |
| - Atmospheric Actionable Resurrection Wards |
+-------------------------------------------------------------------------+
1. The Dual-Engine Intelligence Strategy
Developer CLI tools must never hang, crash, or fail when network connectivity drops. GhostTerm implements a resilient two-tier intelligence engine:
-
Primary Tier (Gemma 2 via Ollama): Queries a local instance of Google DeepMind's
gemma2:2borgemma2:9b. A carefully structured system prompt instructs Gemma to adopt the persona of a Victorian/eldritch compiler spiritโdelivering atmospheric prose followed by strictly accurate technical solutions. - Secondary Tier (Eldritch Heuristic Grimoire): If Ollama is offline, GhostTerm intercepts the connection error within milliseconds and activates an embedded grimoire. With pattern-matching regexes covering syntax errors, indentation traps, null pointers, module resolution errors, recursion spirals, segmentation faults, and git merge conflicts, developers get witty, helpful post-mortems even on an airplane.
2. Subprocess Life-Cycle Possession
GhostTermโs haunt command acts as a non-invasive wrapper. It launches commands via subprocess.Popen, transparently proxying stdout and stderr in real-time. Only when the exit code signals death (returncode != 0) does GhostTerm step in to perform its forensic autopsy, extracting the last 800 characters of the fatal stack trace and submitting it for immediate diagnostic analysis.
3. Quantitative Supernatural Entropy
The HauntedIndexScanner parses the local workspace across four dimensions:
-
Uncommitted Git Drift: Untracked and uncommitted files lingering in limbo (
git status --porcelain). -
Cursed Source Runes: Multi-language regex scanning across
.py,.js,.ts,.rs,.go,.cpp,.cfor debt markers (TODO,FIXME,HACK,WTF,BUG,DEPRECATED). -
Git Despair Sentiment: Semantic frequency analysis across recent commits for panic tokens (
fix,wip,broken,revert,undo,help). - Necrotic Monolith Files: Source files exceeding 400 lines that haven't been decomposed.
4. Rich Terminal Aesthetics
Terminal styling is powered by the Python rich library with custom hex palettes:
-
Spectral Cyan (
#00f0ff): Active prompts and live executions. -
Phantom Purple (
#bd93f9): Scroll borders and necromantic headings. -
Blood Orange (
#ff5555): Fatal tombstones and catastrophic errors. -
Ectoplasm Green (
#50fa7b): Clean executions and healing blessings.
Why Does Open Innovation Matter?
In the current era of proprietary AI, developers are frequently encouraged to pipe terminal commands and codebase context into third-party cloud APIs. For developer tooling, this is an immense security and privacy hazard.
The terminal is the most confidential surface on any developer's machine:
- Sensitive Credentials: Stack traces regularly dump unmasked API keys, OAuth bearer tokens, and JWT claims.
- Infrastructure Architecture: Error backtraces reveal internal IP addresses, microservice names, and database connection strings.
- Intellectual Property: Proprietary algorithms, unreleased features, and patented logic reside directly inside stack frames and git diffs.
Open innovation and open-weight models like Gemma 2 change the paradigm completely.
By utilizing Gemma 2:
- Zero Data Leakage: Not a single character leaves the developer's laptop. All inference happens locally in GPU/CPU VRAM.
- Offline Sovereignty: Developers can debug systems in secure air-gapped environments, on airplanes, or inside corporate firewalls without third-party API dependencies.
- No Per-Token Metering: Developers can analyze thousands of lines of logs, git histories, and tests without fear of monthly API bills.
Open-weight models empower developers to build truly personal, private, and permanent developer tooling.
Prize Categories
Category: Best Use of Gemma
GhostTerm is built from the ground up to showcase the unique strengths of Google DeepMind's Gemma 2:
-
Compact Reasoning Power:
gemma2:2bruns effortlessly on consumer laptops while providing nuanced, atmospheric roleplay combined with razor-sharp code debugging. - Structured Instruction Adherence: Gemma 2 reliably formats complex outputs into structured post-mortem sections (Curse Title, Forensic Autopsy, Exorcism Spell) without breaking CLI parsing.
- Local-First Privacy: Demonstrates how Gemma 2 enables developer tooling that respects zero-trust security and complete data sovereignty.
Authored by @kadyx (GitHub @kady-x)
Awaken your terminal from the dead. May your builds compile, your tests pass, and your silicon spirits rest in peace. ๐ป





Top comments (1)
A local terminal assistant earns trust when its proposals are reversible and inspectable. Showing the exact command, the assumed working directory, and the expected changed files before execution turns a fun interface into something developers can safely use on a real repository.