This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
🌳 What I Built
Vetal PR — The ghost on your push.
“Bol Vikram, varna tera sar phut jayega!”
Remember Vikram-Betaal? I brought that childhood folklore into the developer workflow.
Vetal PR is an AI-powered Git hook that challenges developers to understand the code they are about to push. Instead of simply checking whether tests pass or linting rules are satisfied, Vetal reads your Git diff locally using Gemma 3 through Ollama, creates a folk tale inspired by the changes, and asks a pointed riddle about the actual code.
The idea is simple:
- Answer correctly → Your push goes through.
- Answer incorrectly → Your push is blocked.
- Stay silent → Well, Betaal has a very different kind of response. 💀
The goal isn't to catch bugs. It's to catch code that works but nobody can explain — especially code written with AI assistance.
🎬 Demo
Run Vetal locally and experience an encounter:
ollama pull gemma3:4b
pip install git+https://github.com/rajanikant04/ghostWire
cd your-repo
vetal install
vetal demo
The demo mode includes a sample diff and works even without Ollama.
💻 Code
GitHub Repository:
https://github.com/rajanikant04/ghostWire
The project is built with Python and uses a local Ollama instance to run Gemma 3.
Explore the repository to see how Vetal transforms a Git diff into a story, a riddle, and ultimately a verdict.
⚙️ How I Built It
The core of Vetal PR is powered by Gemma 3, an open-weight model running locally through Ollama.
I deliberately kept the implementation lightweight: pure Python standard library, Git hooks, and two calls to the local model.
Here's how the workflow operates:
- Git pre-push hook: Intercepts a push and extracts the diff of the changes being pushed.
- Diff processing: Removes generated files, lockfiles, images, and other irrelevant content. The remaining diff is proportionally trimmed to fit a 12 KB context budget.
- Call 1 — The Riddle: Gemma 3 analyzes the diff and generates a folk tale, a code-specific question, and a hidden answer key containing the facts a correct answer should cover.
- Developer interaction: The developer reads the tale and explains the code behavior.
- Call 2 — The Judgement: Gemma receives the diff, question, answer key, and developer's response. It evaluates the explanation and returns a verdict.
-
Final decision: A
releaseverdict allows the push; aclingverdict blocks it.
I also extended Vetal beyond local Git hooks with a GitHub Actions workflow concept for pull requests. It can post a riddle as a PR comment, evaluate /answer replies, and report a status check.
Some implementation decisions I'm particularly proud of:
- Structured JSON outputs using Ollama's format parameter.
- A hidden answer key to make grading more consistent, even with smaller models.
- Prompt safeguards to treat the diff as data, not instructions.
- Escape routes for unavailable models, non-interactive environments, tiny diffs, and malformed model responses.
- A configurable strict mode for teams that prefer to block pushes when Ollama is unavailable.
🔓 Why Does Open Innovation Matter?
Vetal PR reads potentially sensitive source code every time a developer pushes changes.
Using a closed-source API would mean sending proprietary code, unfinished experiments, and potentially sensitive implementation details to an external service just to generate a riddle.
Open-weight models made a different approach possible.
By running Gemma 3 locally through Ollama:
- Privacy: Source code stays on the developer's machine.
- No API costs: No external inference bills, API keys, or token limits.
- Independence: No dependency on a third-party API or its availability.
- Customizability: Developers can modify the prompts, grading behavior, and even replace Betaal with another folk character.
- Accessibility: Smaller Gemma models make local inference possible on machines with limited resources.
Open innovation wasn't just a technology choice for Vetal. It was what made the project's privacy-first design possible.
👻 The Spirit of It
Growing up in the 90s, the words “Bol Vikram, varna tera sar phut jayega” were instantly recognizable.
I wanted to bring that memory into something developers encounter every day.
There's something amusing about having an ancient ghost question you about a modern software diff. But there's also a serious idea underneath the humour:
Passing tests doesn't always mean understanding your code.
AI coding assistants have made writing code easier than ever. But understanding, reviewing, and taking responsibility for that code still matters.
Vetal is my little reminder that before code leaves your machine, you should be able to explain what you've built.
Betaal is back. This time, he's reviewing your PRs. 🌳
🏆 Prize Categories
Gemma: Built using Gemma 3, an open-weight AI model running locally through Ollama.
Thank You. Happy Coding
Top comments (0)