Every repository is a graveyard, and developer Yash Dharme has built a tool to hold funerals for the code we delete. Git-séance is a command-line utility that scans a repository's history to find files that were deleted and never restored. It then generates a 'GRAVEYARD.md' memorial page, or ofrenda, detailing the life and death of each file. The tool was submitted for the Hacktoberfest Open-Source AI Challenge Week 4, themed 'Ghost in the Machine,' and offers a unique way to visualize the churn of legacy code.

How It Works Under the Hood

The tool relies on standard git plumbing commands to gather hard facts. It uses git log --diff-filter=D to identify deleted paths, git log --diff-filter=A to find creation dates and authors, and git rev-list to count commits that touched the file. For the actual eulogy, it employs Gemma 3 1B, a small open-weight model running locally via Transformers.js and onnxruntime-node. This setup ensures that no proprietary code or sensitive commit messages leave the developer's machine, addressing privacy concerns for enterprise use.

The Lesson of Grounded Generation

Dharme discovered that letting the LLM write the entire eulogy led to hallucinations. Early versions of the tool generated poetic but false histories, such as claiming a file with only two commits had a 'steady flow of updates.' The solution was a hybrid approach: the code extracts all factual data (names, dates, line counts) directly from git, and the model is restricted to a single task. It reads the file's final contents and generates one sentence in the first person describing what the code *used to do*. This ensures the ghost speaks the truth, even if the voice is eerie.

Practical Performance and Limitations

In a demonstration against the Express repository, which contains 6,183 commits and 16 years of history, the tool identified 684 deleted files. The initial scan took approximately 0.3 seconds, while generating the full memorial page took about 35 seconds on a standard laptop CPU. The model is not perfect; smaller models like Gemma 1B struggle with negative constraints, often overusing words like 'meticulously' despite prompt instructions to avoid them. The developer solved this with a post-generation regex strip, a pragmatic fix for a common LLM quirk.

Key Takeaways

  • Git-séance runs entirely offline after an 860 MB model download, ensuring data privacy for private repositories.
  • The tool uses a hybrid architecture where git provides the facts and the LLM provides the semantic description, preventing historical hallucinations.
  • It is built with plain Node.js (MIT licensed) and requires no build step, making it easy to integrate into existing dev workflows.

The Bottom Line

This is a clever utility that turns the mundane task of code archaeology into a memorable experience. By keeping the AI local and grounded in git facts, it avoids the privacy and accuracy pitfalls that plague many other 'AI for dev' tools. It’s a reminder that sometimes the most useful AI applications are the ones that just read the code and tell you what it meant.