{"slug": "bhoot-sh-i-put-the-ghost-of-a-frustrated-indian-senior-dev-on-my-desktop-100-2", "title": "bhoot.sh: I Put the Ghost of a Frustrated Indian Senior Dev on My Desktop (100% Local with Gemma 2)", "summary": "A developer built bhoot.sh, a frameless, transparent PyQt6 desktop companion that runs entirely locally on Gemma 2 (gemma2:2b) and monitors clipboard contents and active window titles to detect bad coding habits. The ghost tracks the mouse cursor with trigonometric vector calculations, escalates its Hinglish and English roasts in severity as repeated offenses are logged to MongoDB, and scans for leaked secrets such as sk-* and ghp_* tokens without sending clipboard data to the cloud.", "body_md": "*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)*\n\nWhen 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.**\n\nClassic 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].\n\nSo 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].\n\n`bhoot.sh` Actually Does on Your Screen:\n`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:\n`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`):\nA 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**.\n\nIf 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.\n\nI 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].\n\n```\n+-----------------------------------------------------------------------+\n|                        WINDOWS DESKTOP / IDE                          |\n|  [Clipboard (pyperclip)]   [Window Titles (pygetwindow)]   [Cursor]   |\n+-------------+----------------------------+--------------------+-------+\n              |                            |                    |\n              v                            v                    |\n+-------------------------------------------------------+       |\n|          src/watcher.py (Background QThread)          |       |\n|  • Regex Secret Scanner (sk-*, ghp_*, mongodb+srv://) |       |\n|  • Distraction Tab Detector (Reels, YouTube, X)       |       |\n|  • Terminal Crash & Console.log Detector              |       |\n+---------------------------+---------------------------+       |\n                            |                                   |\n                            v                                   |\n+-------------------------------------------------------+       |\n|         src/memory.py (MongoDB Atlas + Local)         |       |\n|  • Logs sin category & timestamp to bhoot_sh.sins     |       |\n|  • Escalates severity: 1=SHORT -> 2=MEDIUM -> 3+=LONG |       |\n+---------------------------+---------------------------+       |\n                            |                                   |\n                            v                                   |\n+-------------------------------------------------------+       |\n|     src/ghost_brain.py + GemmaWorker (Async QThread)  |       |\n|  • Tier 1-3: Instant lookup from scenariohindi.json   |       |\n|    & scenarioenglish.json + Pre-baked ElevenLabs MP3  |       |\n|  • Tier 4+: Few-Shot Prompting on Local Gemma 2 (2B)  |       |\n|    via Ollama, wrapped in Sentry Agent Tracing Spans  |       |\n+---------------------------+---------------------------+       |\n                            |                                   |\n                            v                                   v\n+-----------------------------------------------------------------------+\n|              src/ui_overlay.py (PyQt6 Frameless Overlay)              |\n|  • 60FPS Procedural Grim Wraith + Rising Smoke Particles              |\n|  • Real-Time Pupil Tracking + QPropertyAnimation Zone Roaming         |\n|  • Full-Screen Click-Through VoidDimmer + Native winmm.dll Audio      |\n+-----------------------------------------------------------------------+\n```\n\n**Open-Weight Local Model (`Gemma 2 2B` via Ollama):**\n\nRunning 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].\n\n**System Telemetry Daemon (`src/watcher.py`):**\n\nA 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].\n\n**Dual-Voice Pre-Baked Audio Engine (`src/tts_baker.py` + `winmm.dll`):**\n\nWe 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**.\n\n**Persistent Sin Memory (`MongoDB Atlas`):**\n\n`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].\n\n**Agent Observability (`Sentry Agent Tracing`):**\n\nEvery 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.\n\nBuilding `bhoot.sh` exposed two massive reasons why **open-weight models and local inference are non-negotiable** for OS-level developer tools:\n\nFor `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].\n\nIf `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.\n\nFirst, 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].\n\nSecond, 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. \n\nWhile 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.\n\nThe moment `bhoot.sh` truly landed for me was at **2:00 AM** while debugging `ui_overlay.py`[cite: 9]. \n\nInitially, 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. \n\nSuddenly, 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:\n\n*\"Deploy karleeee, bol raha tha na? Ab rollback kar, aur apni izzat bhi saath mein rollback kar le.\"*[cite: 8]\n\nThen 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.\"\n\n`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].", "url": "https://wpnews.pro/news/bhoot-sh-i-put-the-ghost-of-a-frustrated-indian-senior-dev-on-my-desktop-100-2", "canonical_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_at": "2026-10-28 13:03:57+00:00", "updated_at": "2026-10-28 13:11:26.672323+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-tools", "generative-ai", "developer-tools"], "entities": ["Gemma 2", "PyQt6", "MongoDB Atlas", "Hacktoberfest", "Ollama"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/bhoot-sh-i-put-the-ghost-of-a-frustrated-indian-senior-dev-on-my-desktop-100-2", "markdown": "https://wpnews.pro/news/bhoot-sh-i-put-the-ghost-of-a-frustrated-indian-senior-dev-on-my-desktop-100-2.md", "text": "https://wpnews.pro/news/bhoot-sh-i-put-the-ghost-of-a-frustrated-indian-senior-dev-on-my-desktop-100-2.txt", "jsonld": "https://wpnews.pro/news/bhoot-sh-i-put-the-ghost-of-a-frustrated-indian-senior-dev-on-my-desktop-100-2.jsonld"}}