{"slug": "i-asked-my-git-repository-what-it-remembered-and-found-a-ghost", "title": "I Asked My Git Repository What It Remembered - and Found a Ghost 👻", "summary": "A developer built RepoGhost, a local AI tool that lets developers query a Git repository's commit history in natural language to recover the reasoning behind abandoned features and deleted files. The tool combines Git's built-in history commands with the open-weight sentence-transformers/all-MiniLM-L6-v2 embedding model and cosine similarity ranking, returning verifiable commit hashes, dates, paths and diff excerpts rather than model-generated explanations, and includes a keyword-matching baseline for comparison. The project passed 34 automated tests and was evaluated with six natural-language questions against a fictional 12-commit demo repository, LanternLedger.", "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\nA repository can forget a feature without losing its fingerprints.\n\nI know the feeling of opening an old project, spotting a strange workaround, and wondering: *Why on earth did we do it this way?* The person who wrote it might have moved on. The documentation might be missing. But buried underneath today's code is a quieter version of the project - one preserved commit at a time.\n\nSo I built **RepoGhost**, a local AI archaeologist that helps developers explore their project's forgotten history.\n\nInstead of creating a fictional ghost that makes things up, it listens to the ghosts we already have: **real Git commits**. Ask “Why did we stop caching login sessions?” and RepoGhost searches commit messages, changed paths, and snippets of actual diffs. The result comes with a commit hash, date, paths, and a historical patch you can verify. It also has a **Lost Files** area where you can inspect deleted text files without restoring or modifying the repository.\n\nThe little twist is intentional: the interface is spooky, but the evidence is not supernatural. I wanted to celebrate the past without pretending an AI knows more than the archive contains.\n\nDevelopers onboarding into an unfamiliar codebase, maintainers revisiting an old side project, and anyone hunting for the reason behind an abandoned feature. A phrase like “that old warehouse callback” may not appear in a commit exactly that way; semantic search provides another route in.\n\n**Video walkthrough:** [https://drive.google.com/file/d/1MyrQZYGUPOZNxV-LM5n03-OvdBkHa0op/view?usp=sharing](https://drive.google.com/file/d/1MyrQZYGUPOZNxV-LM5n03-OvdBkHa0op/view?usp=sharing)\n\nI made a **fictional 12-commit project**, LanternLedger, so I could demonstrate the app without exposing anyone's private repository.\n\nIn the walkthrough, I will:\n\n`src/token_cache.py` as it existed before deletion, and download a read-only copy.\n**GitHub:** [https://github.com/DinukaEk/repoghost.git](https://github.com/DinukaEk/repoghost.git)\n\nThe project includes the Streamlit interface, local Git reader, semantic retrieval layer, a deterministic fictional Git-history generator, comparison script, automated tests, and GitHub Actions CI.\n\nRepoGhost has two parts that work together:\n\n**The archive:** Python invokes Git's built-in history commands to collect actual commit metadata, file changes, and bounded text diff excerpts. It never checks out history or executes old code. Deleted-file previews are read directly from a commit's parent revision.\n\n**The AI:** I used [`sentence-transformers/all-MiniLM-L6-v2`](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2), an open-weight Apache-2.0 model. Sentence Transformers maps a question and the indexed commit text to embeddings. Cosine similarity ranks the results. I show the source evidence rather than ask a language model to invent an explanation.\n\nThe app also includes a simple keyword-matching baseline. That matters because the interesting question isn't “Can I put AI in a Halloween-themed UI?” It's “Does semantic matching retrieve useful evidence when developers describe a problem differently from the original author?”\n\nTo make sure RepoGhost works reliably, I tested its core functionality and compared AI-powered semantic search against traditional keyword matching.\n\n**Automated Testing**\n\nThe project successfully passed **34 automated tests** in the initial development environment. These tests cover Git history parsing, read-only repository access, deleted-file recovery restrictions, search calculations, and retrieval logic.\n\nThe automated tests use a simulated embedding interface, so I also ran a separate evaluation with the actual open-weight AI model.\n\n**Real-Model Evaluation**\n\nI evaluated RepoGhost using six natural-language questions against a fictional Git repository containing historical development decisions.\n\nHere are the results:\n\n| Search Method | Correct Matches | Accuracy | \n|---|---|---|\n| Open-weight AI embeddings | 5/6 | 83.3% | \n| Traditional keyword matching | 4/6 | 66.7% | \n\nThe AI-powered approach performed **16.7 percentage points better** than the keyword baseline on this small test set.\n\nOne interesting example was the question:\n\n*\"Why did we stop keeping login credentials in memory?\"*\n\nThe AI correctly identified the commit **\"Retire token cache after authentication security review,\"** while keyword matching returned an unrelated network outage incident.\n\nAnother example involved a billing precision issue. The AI correctly found the commit fixing currency rounding discrepancies, whereas keyword matching suggested an unrelated CSV import change.\n\nHowever, the AI wasn't perfect. For a question about messages lost during a connection failure, it selected a network outage incident instead of the expected retry-queue implementation.\n\nThis was a useful reminder that semantic search can uncover relationships that simple keyword matching misses, but its suggestions still need to be checked against the original Git history.\n\nThese results come from a small, fictional dataset and should not be interpreted as production accuracy measurements. Search similarity scores are not calibrated confidence values.\n\n**Offline Verification**\n\nRepoGhost successfully loaded and ran the downloaded open-weight model locally. Full offline operation is being verified separately to confirm that the application can search repository history without an internet connection.\n\nGit history can be deeply personal to a development team. Old commits may contain internal names, architecture mistakes, incident discussions, and code that should never leave a machine. Searching that archive through a hosted AI API can create an unnecessary privacy tradeoff.\n\nUsing an **open-weight embedding model** means RepoGhost can do its central task **locally**, without paying per-question inference charges. Once the model is downloaded, it is designed to work with the internet disconnected. I can inspect the retrieval logic, replace the model, change what gets indexed, and debug the ranking rather than accept a mystery answer from a black-box endpoint.\n\nThere is another advantage: **traceability**. I don't need a chatbot to say what a former developer “would have thought.” RepoGhost directs me to actual evidence - the SHA, commit message and patch - so I can decide for myself what the historical change means.\n\nThat felt like the right way to interpret *Ghost in the Machine*: not faking the dead coming back, but helping the work they left behind stay understandable.\n\nMy favorite moment in the fictional demo is finding a file that no longer exists in the project folder. The current working tree says it's gone. Git says: *Here is what it looked like just before the deletion.*\n\nIn a small way, that's the whole project. A codebase is more than its current files. The patches, abandoned ideas and notes from earlier developers are part of its memory.", "url": "https://wpnews.pro/news/i-asked-my-git-repository-what-it-remembered-and-found-a-ghost", "canonical_source": "https://dev.to/dinukaek/i-asked-my-git-repository-what-it-remembered-and-found-a-ghost-3d2j", "published_at": "2026-10-28 11:05:51+00:00", "updated_at": "2026-10-28 11:11:15.442272+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "artificial-intelligence"], "entities": ["RepoGhost", "Git", "sentence-transformers/all-MiniLM-L6-v2", "Streamlit", "GitHub", "Hacktoberfest", "LanternLedger"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/i-asked-my-git-repository-what-it-remembered-and-found-a-ghost", "markdown": "https://wpnews.pro/news/i-asked-my-git-repository-what-it-remembered-and-found-a-ghost.md", "text": "https://wpnews.pro/news/i-asked-my-git-repository-what-it-remembered-and-found-a-ghost.txt", "jsonld": "https://wpnews.pro/news/i-asked-my-git-repository-what-it-remembered-and-found-a-ghost.jsonld"}}