# bhoot.sh: I Put the Ghost of a Frustrated Indian Senior Dev on My Desktop (100% Local with Gemma 2)

> Source: <https://dev.to/parth_kulkarni_f56a656693/bhootsh-i-put-the-ghost-of-a-frustrated-indian-senior-dev-on-my-desktop-100-local-with-gemma-2-17i2>
> Published: 2026-10-28 13:03:57+00:00

*This is a submission for the [Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine](https://dev.to/challenges/hacktoberfest-week4-2026-10-26)*

When I looked at the **"Ghost in the Machine"** prompt, I noticed almost everyone was building haunted CLI shells or digital memory altars. As an Indian developer, my mind immediately went to a different kind of horror: **the evolutions of Indian ghost cinema—and the terrifying spirit of a fed-up senior developer watching you copy-paste from Stack Overflow at 2:00 AM.**

Classic Indian horror evolved from melodramatic spirits in ancestral *havelis* (*Mahal*, 1949) and Ramsay Brothers folklore into modern, self-aware "Good Ghosts" (*Stree*, *Bhoot*) who haunt you with lived realities rather than cheap jump scares. Simultaneously, I was inspired by the floating interactive "Loony" lobby companion from *Brawl Stars*[cite: 1].

So I combined the two and built **`bhoot.sh`** (**"Bhoot"** = Ghost in Hindi/Marathi): a **frameless, 60 FPS transparent desktop wraith** that literally possesses your Windows OS, stalks your IDE peripheral vision, tracks your mouse cursor with glowing hollow eyes, and roasts your bad coding habits out loud in **Romanized Hinglish** and **English**[cite: 7, 8, 9].

`bhoot.sh` Actually Does on Your Screen:
`PyQt6` desktop entity whose glowing pupils calculate trigonometric vectors (`math.hypot`) to follow your mouse cursor across the screen in real time. Instead of blocking the code you are actively typing, it glides to targeted IDE zones:
`short` → `medium` → `long`):` VoidDimmer`) across your entire monitor whilelocal `gemma2:2b`)` System32` / Git branch deletion warning before laughing at you.`ai.inference` on Local Gemma 2):`bhoot_sh.coding_sins`):
A reincarnated, highly judgmental senior developer haunting your desktop. Built for the **Hacktoberfest 2026: Ghost in the Machine** challenge, **bhoot.sh** is a frameless, transparent desktop wraith that monitors your clipboard and active windows 100% locally—roasting your bad coding habits in **Hinglish** and **English**.

If you copy-paste from Stack Overflow for the tenth time, accidentally copy a live API key, open Instagram Reels near a deadline, or push `"fix bug"` straight to `main`, this phantom glides across your screen, locks its glowing eyes onto your mouse cursor, dims your monitor blood-red, and yells at you.

I designed `bhoot.sh` around a **hybrid local-first architecture** so that the UI remains butter-smooth at 60 FPS while monitoring system-level events without ever freezing or leaking private clipboard data to the cloud[cite: 9].

```
+-----------------------------------------------------------------------+
|                        WINDOWS DESKTOP / IDE                          |
|  [Clipboard (pyperclip)]   [Window Titles (pygetwindow)]   [Cursor]   |
+-------------+----------------------------+--------------------+-------+
              |                            |                    |
              v                            v                    |
+-------------------------------------------------------+       |
|          src/watcher.py (Background QThread)          |       |
|  • Regex Secret Scanner (sk-*, ghp_*, mongodb+srv://) |       |
|  • Distraction Tab Detector (Reels, YouTube, X)       |       |
|  • Terminal Crash & Console.log Detector              |       |
+---------------------------+---------------------------+       |
                            |                                   |
                            v                                   |
+-------------------------------------------------------+       |
|         src/memory.py (MongoDB Atlas + Local)         |       |
|  • Logs sin category & timestamp to bhoot_sh.sins     |       |
|  • Escalates severity: 1=SHORT -> 2=MEDIUM -> 3+=LONG |       |
+---------------------------+---------------------------+       |
                            |                                   |
                            v                                   |
+-------------------------------------------------------+       |
|     src/ghost_brain.py + GemmaWorker (Async QThread)  |       |
|  • Tier 1-3: Instant lookup from scenariohindi.json   |       |
|    & scenarioenglish.json + Pre-baked ElevenLabs MP3  |       |
|  • Tier 4+: Few-Shot Prompting on Local Gemma 2 (2B)  |       |
|    via Ollama, wrapped in Sentry Agent Tracing Spans  |       |
+---------------------------+---------------------------+       |
                            |                                   |
                            v                                   v
+-----------------------------------------------------------------------+
|              src/ui_overlay.py (PyQt6 Frameless Overlay)              |
|  • 60FPS Procedural Grim Wraith + Rising Smoke Particles              |
|  • Real-Time Pupil Tracking + QPropertyAnimation Zone Roaming         |
|  • Full-Screen Click-Through VoidDimmer + Native winmm.dll Audio      |
+-----------------------------------------------------------------------+
```

**Open-Weight Local Model (`Gemma 2 2B` via Ollama):**

Running inside an asynchronous `GemmaWorker(QThread)` in `src/main.py`[cite: 9], `gemma2:2b` powers our dynamic roast engine[cite: 11]. Instead of generating generic AI slop, `src/ghost_brain.py` dynamically injects lines from our bilingual datasets (`scenariohindi.json` and `scenarioenglish.json`) as **few-shot style examples** into the prompt so Gemma nails the exact sarcastic Hinglish cadence (*"Bas kar bhai"*, *"Deploy karleeee"*, *"Mera past life yaad aa gaya"*)[cite: 7, 8, 9].

**System Telemetry Daemon (`src/watcher.py`):**

A dedicated `QThread` monitors clipboard changes (`pyperclip`), active window titles (` pygetwindow`), and system clock hours[cite: 9]. It uses regex pattern matching to classify 18+ distinct developer sins—from exposed `sk-` / `ghp_` / `mongodb+srv://` keys and `git push --force` commands to late-night 2:00 AM coding sessions[cite: 7, 8].

**Dual-Voice Pre-Baked Audio Engine (`src/tts_baker.py` + `winmm.dll`):**

We built a custom baker script using **ElevenLabs** (`eleven_multilingual_v2`) with two distinct personas: **Daniel** for thick, dramatic Hinglish delivery and **Clyde** for gravelly English roasts. By dropping `stability` to `0.25` and cranking `style` to `0.85` with injected pause punctuation (`...` and `—`), the voice sighs, rasps, and mocks naturally. At runtime, `ui_overlay.py` plays these `.mp3` files directly through Windows' native Multimedia Control Interface (`ctypes.windll.winmm.mciSendStringW`) with dynamic alias rotation—achieving **0ms network latency** and **100% offline execution**.

**Persistent Sin Memory (`MongoDB Atlas`):**

`src/memory.py` connects to our MongoDB Atlas cluster (`bhoot_sh.coding_sins`) to store an immutable ledger of every coding sin, severity tier, and timestamp (with automatic offline fallback if Wi-Fi is off)[cite: 6, 9].

**Agent Observability (`Sentry Agent Tracing`):**

Every call to local `gemma2:2b` is wrapped in a `sentry_sdk.start_span(op="ai.inference")` transaction tagged with `language`, `severity_tier`, and `model`, giving us full visibility into local CPU/GPU inference latency.

Building `bhoot.sh` exposed two massive reasons why **open-weight models and local inference are non-negotiable** for OS-level developer tools:

For `bhoot.sh` to catch you copying code from Stack Overflow or accidentally copying a production `.env` secret (`api_key_exposed`), **it has to inspect your system clipboard and active window titles every second**[cite: 7, 8].

If `bhoot.sh` were built on a closed cloud API, watching for leaked API keys would literally require **sending your leaked API keys and proprietary source code over the internet to a third-party server**! That turns a fun developer companion into a massive security vulnerability. Because `gemma2:2b` runs 100% locally via Ollama on my own laptop, my clipboard never leaves `localhost`[cite: 11]. You can turn off your Wi-Fi completely, and the ghost still haunts your machine.

First, closed commercial LLMs often neuter "roast" or "horror" personas with overly sanitized corporate refusals. Open-weight `gemma2:2b` let us use few-shot Hinglish prompting to capture raw, authentic Indian developer banter without censorship[cite: 8, 11].

Second, during development, we hit a classic closed-API bottleneck with voice synthesis: a desktop agent that reacts to every clipboard event triggers dozens of times an hour. Calling a cloud TTS API dynamically on every error introduces 2+ seconds of lag and burns through free-tier character quotas (and paywalled voice libraries) in a single afternoon. 

While our hybrid solution (`tts_baker.py` pre-baking core ElevenLabs MP3s + live Gemma 2 text) solved this for v1.0, it proved why **our immediate v2.0 roadmap is integrating a 100% open-weight local neural TTS (`Kokoro-82M` / `Parler-TTS`)** alongside Ollama—allowing every unscripted Gemma 2 roast to be voiced locally on-device with zero API limits forever.

The moment `bhoot.sh` truly landed for me was at **2:00 AM** while debugging `ui_overlay.py`[cite: 9]. 

Initially, when I triggered a live Gemma 2 roast, the synchronous inference call blocked the main thread and froze the ghost's animation—making it feel like a buggy script. After moving Gemma 2 into a background `QThread` and replacing our early cartoon balloon prototype with the hooded dark wraith[cite: 10], I accidentally copied a stack trace three times in a row while testing. 

Suddenly, my entire monitor flashed blood-crimson (`VoidDimmer`), the hooded wraith glided straight down over my VS Code terminal with its red pupils locked onto my cursor, and the speakers rasped out in Hindi:

*"Deploy karleeee, bol raha tha na? Ab rollback kar, aur apni izzat bhi saath mein rollback kar le."*[cite: 8]

Then I spam-clicked it in frustration, accidentally triggering **Poltergeist Mode**, and watched it violently glitch and teleport across my screen yelling about `System32`. It crossed the line from "a Python script I'm writing" to "an annoying, hilarious roommate living inside my laptop."

`QThread` with bilingual few-shot prompting (`scenariohindi.json` & `scenarioenglish.json`) to improvise context-aware developer roasts[cite: 7, 8, 11].`eleven_multilingual_v2` with custom low-stability/high-style emotional voice settings across dual personas (`src/tts_baker.py` to voice the desktop ghost[cite: 9].`pymongo` in `src/memory.py` to persist developer coding sins, timestamps, and escalation tiers (`src/ghost_brain.py` with `sentry_sdk.start_span(op="ai.inference")` to track latency and metadata across languages and escalation tiers[cite: 9].
