DEV Community

Cover image for I can't ask my old team lead why anymore, so I built a séance
Tanay
Tanay

Posted on AI-assisted

I can't ask my old team lead why anymore, so I built a séance

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine.

A month ago my team lead left. He was the one who knew why our code is shaped the way it is: why one piece
is split from another, why a check lives here and not there, why a decision that looks wrong was actually
right. More than once since then I have hit one of those decisions, opened a chat to ask him, and stopped
halfway through typing. He has moved on. It felt wrong to pull him back into code he no longer owns, and
there was nobody else to ask.

git blame did not help. It showed me the last person who touched the file, not the person who decided why
it exists. That is when it hit me how much a team loses when one person walks out the door, and how little
of what they knew was ever written down where the next person would find it.

Halloween is about talking to people who are no longer in the room. So I built a séance for them.

TL;DR

  • Ouija Blame asks a line of code why it exists. It walks the line back to the commit that first wrote it, gathers what its author and reviewers wrote (commits, the pull request, review comments, linked issues, and the prompts behind agent-written code), and the ghost answers only in their own words, each one linked. If nobody ever wrote the reason down, the ghost says "I never wrote down why."
  • Gemma can only point, then explain with citations. The open model picks passage numbers from a fixed list, so it cannot put a word in the ghost's mouth, and code checks every quote word for word. Then it writes a plain-words answer (what the line does, why it exists, what to check before you change it) where every reason cites a quote by number.
  • The test: 45 real lines from Rails, Kubernetes, Home Assistant, Ansible and Istio that someone deleted as pointless, which broke something and were put back. Every method saw only history from before the deletion. The séance surfaced a written reason for 28/45 lines; the git blame message, 19/45 (+20 points, 95% CI +9 to +33). Reading the whole PR behind the blame commit found 29/45, but meant reading 268 words per line instead of 67.
  • What surprised me: no method, mine included, found the reason the line had to come back more than 18% of the time. The reason code was written and the reason it must stay are usually different, and the second one is almost never written down.
  • What failed: Gemma 4B hates silence. It said "I never wrote down why" for only 1 of the 13 lines where no method found any reason.

What I Built

Ouija Blame is a pixel-art séance for one question: why does this
line exist?
It is a séance for people's lost knowledge in a repo, not a haunted terminal.

  1. Paste a GitHub link to one line (or open a haunted line from the gallery).
  2. The crystal ball wakes up. Behind it, git log -L follows the line back through every change to the commit that first wrote it. git blame stops at the last change, which in my test set was the wrong commit 17 times out of 45.
  3. The ghost appears: the person who first wrote the line, with when they were last seen in the repo. They speak in quotes from their commits, PR descriptions and review threads. A reviewer who explained it better appears as another voice in the room.
  4. The answer comes first. The medium (Gemma) writes a short card: what the line does, why it exists and before you change it. Every reason carries a numbered chip that jumps to the quote it rests on, and a "why" that cites nothing is replaced by code with "the quotes do not state a reason outright". It is labelled as the model's words, never put in the ghost's mouth.
  5. The Ouija board is a control, not a decoration. The ghost spells its name with the planchette and slides to YES, or to NO when it has nothing to say. You can take the planchette yourself: rest it on YES to summon, NO to clear, GOODBYE to close the séance, or spell a project (RAILS, KUBE, ISTIO) to call up that project's ghosts.
  6. For gallery séances, the page then shows what happened next: the commit that deleted the line, and the revert that brought it back, so you can judge the ghost yourself.

A séance on a Kubernetes storage class: the answer card first, then the ghost and its quotes

A Home Assistant séance: the reason was in a code review comment, not the commit

In that Kubernetes example, git blame on cluster/addons/storage-class/openstack/default.yaml shows a
group-version bump by a different person. The ghost is @jsafrane, who wrote the file in 2016, and the
answer comes from his PR: "In previous versions of Kubernetes a PersistentVolumeClaim without a
StorageClass annotation on these cloud platforms would be satisfied by manually-created PersistentVolume
objects…"
Six years later someone deleted it as an OpenStack leftover, and existing Cinder volumes became
unusable until it was restored.

The ghosts of agent-written code

Code written with an AI agent has a new kind of lost knowledge: the prompt. The engineer typed the reason
into a chat, and the commit says "Canvas rce2". Entire records those
sessions and publishes them next to the code as refs/entire/checkpoints/…. Ouija Blame reads them with
plain git (no account needed), so the ghost can quote the human's own prompt:

A séance on agent-written code: the ghost quotes the prompt the developer gave Copilot CLI, recovered from an Entire checkpoint

Demo

  • Live: https://ouija-blame.onrender.com, no login. The gallery opens instantly. A live séance on any public repo under 150 MB takes about a minute (Gemma runs on a small CPU).
  • Straight to a séance: Kubernetes storage class · Home Assistant Tile · agent-written code
  • Live séances call GitHub from your browser, so the server holds no GitHub token. GitHub allows each browser 60 calls an hour, about two séances; you can paste your own token, which stays in the tab.

Code

GitHub logo Tanay3484 / ouija-blame

Ouija Blame: ask why a line of code exists, and the ghost of whoever wrote it answers only in their own recorded words.

Ouija Blame

Ask a line of code why it exists. The ghost of whoever wrote it answers, only in words they actually wrote.

Live: https://ouija-blame.onrender.com · DEV Hacktoberfest 2026, Week 4: Ghost in the Machine

Every codebase has a line nobody dares delete, and the person who knew why it is there has left. git blame shows the last commit that touched the line, which is often a reformat. Ouija Blame walks the line back to the commit that first wrote it, gathers what its author and reviewers wrote (commit messages, the pull request, review comments, linked issues, and agent-session prompts recorded with Entire), and lets an open-weight model, Gemma, point at the passages that say why. The model can only choose passage numbers, never write the quote, and code checks every quote word for word against its source. If nothing says why, the ghost says "I never wrote down…

How I Built It

The séance

line ──git log -L──▶ every commit that touched it ──▶ PRs · reviews · linked issues · Entire prompts
                                                              │
                         passages: exact slices of the raw text (templates, bots, /lgtm dropped)
                              │  BM25 against the line's own words → top 16
                              ▼
                      Gemma 3 4B (Ollama): "which passages say WHY?" → ids from an enum
                              │
                      quote checker: word for word in the source, or dropped
                              ▼
                      the ghost speaks, or "I never wrote down why."
Enter fullscreen mode Exit fullscreen mode
  • Code decides, the model reads. The walk, the cutoff, bot and template filtering, ranking and the quote check are plain, tested Python. The model does two jobs a regex cannot: judge does this paragraph say why?, then explain the chosen quotes in plain words.
  • The explanation is cited, and code holds it to that. Citations to quotes that do not exist are stripped; a "why" left with no citation is not shown. Gemma can still over-reach inside a cited answer (one Kubernetes card adds an uncited sentence of interpretation), which is why the quotes sit directly under it. The card runs after the evaluated step, so it changes none of the numbers below.
  • The model cannot invent a quote. The JSON schema makes passage ids an enum, so Gemma can only choose from what is there, and every chosen passage is checked against its source again before it is shown. Over the 45 test séances the checker dropped 0 passages, which is the point: it is a guarantee, not a filter.
  • No token on the server. Live séances happen in three calls: the server clones the repo over plain git and walks the line; your browser fetches the PRs and comments from api.github.com; the server asks the medium. The same seance.run() serves the evaluation from a disk cache.
  • Stack: Python and FastAPI, TypeScript and Vite, all pixel art drawn in code, Gemma 3 4B in Ollama on Render, 31 tests with a git repo built inside the test and a fake model (no network).

The evidence

The hardest part of "why does this line exist?" is knowing the right answer. Big projects have a natural
answer key: reverts of deletions. Someone removes code that looks pointless, it breaks something, and a
revert puts it back, usually with a PR explaining why it was needed.

  • Mining: 96 reverted deletions from local clones of Rails (37), Kubernetes (22), Home Assistant (21), Ansible (11) and Istio (5). For each, the line the deletion removed and the revert restored.
  • Answer key: I read each revert's message and PR and kept the 45 that state a reason, as one line each. The other 51 just say "This reverts commit X".
  • Held out by time: every method sees the repo at the deletion's parent, and GitHub comments written at or after the deletion are dropped. The revert is never input.
  • Four methods: the git blame commit message; blame plus its PR (description, comments, reviews); the five oldest git log -S hits for the line's main identifier; the séance.
  • Blind grading: all 180 pieces of evidence were shuffled under random ids and graded without knowing the method: does it give the revert's reason (R), some other written reason for the line (E), or no reason (N)?
Method Gives the revert's reason Gives a written reason (any) Words to read (median)
git blame message 7/45 (16%) 19/45 (42%) 12
blame + its whole PR 7/45 (16%) 29/45 (64%) 268
git log -S, 5 oldest 5/45 (11%) 15/45 (33%) 41
séance 8/45 (18%) 28/45 (62%) 67

Paired bootstrap over cases, séance minus baseline, any written reason: vs blame +0.20 (+0.09 to +0.33),
vs log -S +0.29 (+0.13 to +0.44), vs blame + PR −0.02 (−0.11 to +0.04). On the revert's reason the
differences are all within ±0.09 and not significant.

So the honest summary: the séance finds a written reason far more often than blame, about as often as
reading the entire PR, in a quarter of the reading
, and it reaches the original author every time.

What went wrong

  • Gemma does not like to stay silent. It answered "I never wrote down why" in 1 of 45 séances. In the 13 cases where no method found any reason, it stayed silent once. In 16 séances it offered quotes that were real and correctly attributed but did not explain anything, most often a bare commit subject (57% of all quotes were commit messages). The quote checker guarantees the words are real. It cannot guarantee they are relevant. A larger model, or a rule that a bare commit subject never counts as a reason, is the next thing to try, on new cases rather than these 45.
  • The reason a line must stay is rarely written. Most reverts say "this was still in its deprecation period", "apps still use it", or "CI broke". Those are facts about the world after the line was written. No archaeology of history-before-deletion can find them, which is why every method sits at 11–18% on that column. That is not a bug in the tool. It is the most useful thing I learned: if you know why a line must stay, write it next to the line.
  • git log -L does not follow code across file moves. In one Rails case the walk stopped at a 2011 commit that moved the code into a new file, so the "ghost" was the person who moved it.
  • The grader is not independent. Claude graded the 180 items blind to method, and no second person re-graded them. Evidence over 400 words (only the PR baseline) was graded from its opening plus every paragraph sharing words with the answer, a Ctrl-F, which can miss a reason phrased differently.
  • 45 cases from 5 repos is small. Reverts are a biased sample: code whose reason mattered enough to break something.

Every number above comes from python -I scripts/stats.py, which reads only files in
results/.

Why Does Open Innovation Matter?

  • The repos that need this most are private. Your team's code and your old lead's PR threads are the last things most companies will send to a closed API. Gemma runs in a container I control, so the same code can run inside your network, next to your Git server, with nothing leaving it.
  • A séance is all reading. Every séance sends the model thousands of words of other people's writing. On an open model that costs CPU time, not tokens, so the demo can afford to read everything.
  • I can constrain it as tightly as I want. Ollama's schema-constrained output let me make the model choose from an enum of passage ids, which is what makes "only their own words" a guarantee rather than a prompt instruction.
  • It will outlive this post. Git, open weights and a public repo: nothing here depends on a service that could change its price or disappear, which feels right for a tool about knowledge that disappeared.

The Spirit of It

The first real user was me. I opened a haunted line from the gallery, read through the séance, and my honest
reaction was: "all I see is a git blame." The quotes were all there, but nothing told me in plain words the
one thing I had come for. That sentence changed the product the same night: every séance now opens with an
answer card (what the line does, why it exists, what to check before you change it), and every reason on
it is pinned to the quote it came from, so you can check the medium against the ghost.

The ghosts in the gallery are real people who wrote real code, and most of them simply moved on to other
work. Nobody here is framed as dead, the ghost is a generic sprite rather than anyone's photo, and every word
it says links to where that person actually wrote it. That last rule turned out to be the whole product:
a tool that only lets people speak in their own recorded words is a tool that makes you notice how rarely
we write down why.

How the work was split

This week I was buried in work until the last night, so most of the code was written by Claude Code from
specs we agreed on (specs/ in the repo). I chose the idea, the cuts and the evaluation design, and I was
its first user.

Prize Categories

  • Best Use of Gemma: Gemma 3 4B is the medium. It reads every candidate passage and decides which ones say why a line exists, under a schema that only lets it choose passage ids, then writes the answer card in plain words, where every reason must cite one of the quotes it chose.
  • Best Use of Render: the app and the API run on a Render web service, and Gemma runs in a private Render service with Ollama, both from one render.yaml. The AI runtime is on Render.
  • Best Use of Entire: "search past agent work to explain why code exists" is exactly what the séance does for agent-written code. When a line's commit carries an Entire-Checkpoint trailer, Ouija Blame reads the published checkpoint and the ghost quotes the developer's own prompt (see the agent-written séance in the gallery).

Top comments (0)