跳到正文
DEV Community· Ravi Jaipal·· 4 小時前AI 評分43

GitGeist:以本機 AI 探查 Git 歷史的離線優先工具

GitGeist 👻: The Ghost in the Machine

AI 導讀

GitGeist 是一款離線優先的本機 AI 工具,結合 TabPFN 的 Git 風險預測與透過 Ollama 執行的 Gemma 3,協助開發者調查可疑提交並理解其背景。風險預測會提供 10–90% 的估算範圍及相關訊號,工具亦可為已退役程式碼製作紀念卡。GitGeist 可在 CPU-only 系統上本機執行,無需付費 AI API 金鑰。

正文

GitGeist: The Ghost in the Machine 👻 | Offline-First AI for Haunted Git Histories

Built for the Hacktoberfest Open-Source AI Challenge — Week 4: Ghost in the Machine.

Every codebase has a haunted corridor.

It's that one file containing a mysterious time.sleep(0.666), a forgotten workaround, or a comment that says: // temporary fix — DO NOT TOUCH.

You run git blame to investigate, only to discover the most frightening answer in software engineering: the ghost is you, from three years ago.

But old code isn't always something to fear. Legacy functions, retired modules, and forgotten commits often tell the story of the people and decisions that kept our software running.

That inspired me to build GitGeist — an offline-first Haunted Git Séance and Digital Code Ofrenda that combines AI-powered code archaeology with a Halloween-inspired experience and a tribute to retired code.

The project brings together two open-weight AI models running locally: Prior Labs' TabPFN for tabular risk forecasting and Google's Gemma 3, through Ollama, for grounded explanations of Git history.

The goal is simple: investigate suspicious commits, understand their context, and keep private repository data on your own machine.

🔮 What I Built

GitGeist combines three main features.

1. The TabPFN Haunting Forecaster

The forecaster analyses Git and system telemetry, including:

  • Commit time and late-night activity
  • Lines changed and files touched
  • Cyclomatic complexity changes
  • Days since a file was last modified
  • Test coverage signals
  • CPU thermal telemetry

It produces a Haunting Risk Score, an estimated 10–90% range, and the signals contributing to the forecast.

2. The Haunted Terminal Séance

Using Google Gemma 3 locally through Ollama, GitGeist turns commit metadata into an understandable explanation of suspicious code.

It can reference the commit hash, author, timestamp, and forecast supplied by the risk engine. The aim is to help developers investigate why a workaround may exist before deleting it.

If Ollama is unavailable, a deterministic fallback can still format the available metadata.

3. The Digital Code Ofrenda 🌼

Inspired by Día de los Muertos, this feature creates a digital remembrance card for retired code and the maintainers behind it.

Instead of treating deleted functions as disposable leftovers, GitGeist gives developers a creative way to document their history and acknowledge the work that came before.

Who is it for?

  • Developers maintaining legacy codebases
  • Engineers investigating regressions and unusual commits
  • Open-source maintainers exploring repository history
  • Teams that want local AI-assisted code analysis

🎬 Demo

GitGeist is designed to run locally, including on CPU-only systems, without requiring a paid AI API key.

It offers two interfaces:

  • Haunted Terminal CLI: python3 cli.py --preset 0
  • Web interface: python3 run.py, with the interface intended to run at http://localhost:8080

The repository also includes a Dockerfile and a Render Blueprint for deployment.

Live demo: [Add your deployed URL here, if available]

Demo video: [Add your video link here, if available]

💻 Code and Quick Start

GitHub repository: https://github.com/ravindrajaipal/gitgeist

License: MIT

Clone the repository and install its dependencies:

git clone https://github.com/ravindrajaipal/gitgeist.git
cd gitgeist
pip install -r requirements.txt

Run the tests:

python3 -m unittest discover tests -v

Try the terminal experience:

python3 cli.py --preset 0

Run the telemetry analysis:

python3 scripts/analyze.py

Launch the web interface:

python3 run.py

For model-backed features, follow the repository instructions for installing the required dependencies and configuring Ollama and the model weights.

⚙️ How I Built It

GitGeist separates numerical forecasting from language generation.

The architecture

  1. Git scanner: Extracts repository and commit information.
  2. TabPFN forecaster: Processes tabular telemetry and estimates risk.
  3. Gemma 3 via Ollama: Uses the supplied metadata and forecast to produce a contextual explanation.
  4. Local coordinator and interfaces: Connect the components to the CLI and web UI.
  5. Code Ofrenda: Presents a remembrance experience for retired code.

Why use two different models?

A language model can explain code in natural language, but its prose should not be treated as a calibrated risk estimate.

GitGeist therefore assigns different responsibilities to its components:

  • TabPFN: Tabular forecasting
  • Gemma 3: Natural-language explanations and storytelling
  • Deterministic fallback: Basic output when the local language model is unavailable

The intention is to keep the forecast separate from the generated narrative, making the system easier to inspect and reason about.

🧪 Testing and Verification

The project includes unit tests for core behaviour, such as:

  • Ensuring the Ofrenda tribute acknowledges the author
  • Checking that the Séance references the expected commit and risk score
  • Testing whether a witching-hour commit increases the forecast in the test scenario

Run the verification suite with:

python3 -m unittest discover tests -v

The repository also contains a telemetry sensitivity analysis script:

python3 scripts/analyze.py

These tests and scripts help make the expected behaviour reproducible. Forecast quality should still be evaluated against suitable labelled data before using risk scores to make production decisions.

🌍 Why Open Innovation Matters

🔐 Privacy by design

Git history can contain proprietary implementation details, internal incident notes, and sensitive metadata. Running analysis locally can reduce the need to send repository contents to external AI services.

📴 Offline-first development

A local workflow is useful when internet access is unreliable or external APIs are unavailable. Once dependencies and model weights are installed, the intended local workflow does not require a cloud AI API.

🔍 More transparent responsibilities

Separating tabular risk estimation from narrative generation makes it easier to inspect the inputs, examine the outputs, and replace individual components.

💸 No per-request cloud AI API bill

Local inference avoids per-request charges from a hosted AI API, although hardware, electricity, storage, and setup still have costs.

Open tools give developers the freedom to experiment, inspect, adapt, and build without being tied to a single hosted provider.

🤖 My Agent Session

My development workflow focused on three ideas:

  1. Theme first: Connect the spooky debugging experience with the idea of preserving the history of retired code.
  2. Separate prediction from explanation: Have the forecasting component produce the risk estimate before the language model generates its explanation.
  3. Verify behaviour: Run unit tests and the telemetry analysis script rather than relying only on a convincing demo.

This approach helped turn a creative challenge theme into a project with a concrete technical workflow.

🌼 The Spirit of GitGeist

Code has a history.

A strange delay, an unusual workaround, or a retired function may look meaningless today, but it might once have prevented a race condition or kept a service running during a difficult incident.

GitGeist is my attempt to make exploring that history more useful — and a little more fun.

The haunted terminal brings the mystery. The risk forecaster brings a structured signal. The Digital Code Ofrenda brings a moment of appreciation for the developers and decisions that came before us.

Sometimes the ghost in the machine isn't a bug. It's a piece of engineering history waiting to be understood.

🏆 Prize Categories

The project is intended for the following challenge categories, subject to the official rules and eligibility requirements:

  • Overall Winner: The combination of Git-history analysis, local AI, and the Digital Code Ofrenda.
  • Best Use of Gemma: Gemma 3 generates contextual explanations grounded in supplied repository metadata.
  • Best Use of TabPFN: Tabular telemetry forecasting and sensitivity analysis.
  • Best Use of Render: The included Render Blueprint for a deployable web application.

🙌 Thanks

Thanks to the organisers of the Hacktoberfest Open-Source AI Challenge for a theme that encouraged me to look at old code from a different perspective.

If you find GitGeist interesting, explore the repository, try the local workflow, and share feedback or ideas for improvement.

GitHub: https://github.com/ravindrajaipal/gitgeist

Built with curiosity, open-source tools, and respect for the ghosts in our codebases.

來源:DEV Community · dev.to