DEV Community

build996
build996

Posted on

I asked a deleted file to speak. It lied about line 9.

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.

What I Built

Deleting a file from a Git repository does not quite kill it. The last surviving version is still in the parent of the deletion commit. I wanted to see what would happen if an open-weight model tried to speak as that file — with the actual source and commit attached, so I could challenge its memory.

ghostline is a small Python CLI. Point it at a repository and a deleted path. It finds the most recent deletion commit, retrieves the file from the preceding revision, and gives numbered evidence blocks to an open-weight model. The model writes a short first-person “ghost” account and selects citations. The CLI refuses to print an answer if any cited evidence ID does not exist.

The eerie part came when the model cited real lines and still told a false story about them.

Demo

Watch the 15-second demo · Read the complete captured run

The demo uses a deliberately fictional, two-commit repository generated by demo/make_history.py. Its legacy_cache.py file contains a fallback read. The second commit deletes the file with the message “Remove legacy cache after switching to direct reads.” I ran ghostline against that history using NVIDIA's hosted Nemotron 3.5 Lightning open-weight model.

The model's voice said the assignment on line 9 “would have stored a potentially failed value.” That sounds plausible. It even cited the source block containing line 9. But the preceding block says:

try:
    value = fetch(key)
except TimeoutError:
    return cache.get(key)
cache[key] = value
Enter fullscreen mode Exit fullscreen mode

On the timeout path, the function returns before the assignment. The model's interpretation was wrong. The video freezes on that moment. I left the mistake in the captured run because the distinction is the point of the tool: a valid citation is a place to check, not a guarantee that the sentence is true.

Code

ghostline

A tiny code séance for Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine. Give it a deleted file in a Git repository. It retrieves the file's last surviving version and deletion commit, then asks an open-weight model to write a short first-person testimony. Every response must cite real evidence IDs; an invented citation makes the run fail.

This is a new project created during the October 26–31, 2026 challenge window. MIT licensed. Python 3.10+, Git, and no Python package dependencies.

Reproduce the demo

The demo history is fictional and generated locally. It is not presented as a production incident.

Watch the captured 15-second demo. The video is rendered from an actual model run saved in demo/captured-run.txt. It shows a mistake the model made about the cache write and the source lines that disprove it.

python demo/make_history.py demo-history
python ghostline.py demo-history --file legacy_cache.py --evidence-only
…
Enter fullscreen mode Exit fullscreen mode

The MIT-licensed repository was created during this Week 4 challenge window. It has the CLI, a script that builds the fictional Git history, the saved model output, the video renderer, and three tests. The CLI itself uses only Python's standard library and Git.

python demo/make_history.py demo-history
python ghostline.py demo-history --file legacy_cache.py --evidence-only
# Set NVIDIA_API_KEY, then:
python ghostline.py demo-history --file legacy_cache.py
python -m unittest discover -s tests -v
Enter fullscreen mode Exit fullscreen mode

How I Built It

Git does the archaeology. git log --diff-filter=D finds the deletion; git show PARENT:path retrieves the last surviving file. Source lines are numbered and grouped into evidence IDs such as S1 and S2. The deletion commit message and file status become C1 and C2. There is no vector database or fabricated backstory.

Nemotron 3.5 Lightning does the part Git cannot: it turns those fragments into a compact narrative and chooses which evidence it thinks supports the account. The response must be JSON with a voice, 2–5 citations, and an uncertainty sentence. The program rejects missing IDs, duplicates, and malformed responses. It prints the exact evidence behind accepted IDs beside the voice.

I tested the code against a real two-commit Git repository built inside a temporary directory, plus an invented-citation response and a credential-redaction case. All three tests pass. The live demo made one model call; the video was rendered from that captured CLI output, rather than a hand-written mock answer.

The checks validate references, not semantic truth. The line 9 error demonstrates the gap. In particular, this is an aid to reading history, not an automated code reviewer or a source of certainty about why a maintainer deleted something.

Why Does Open Innovation Matter?

The file's “voice” is the part I want to keep replaceable. The default is Nemotron 3.5 Lightning 30B A3B, an open-weight model. The CLI accepts another model and a compatible chat-completions endpoint, so a user with suitable hardware can run inference on infrastructure they control. That matters when the source is private, and it lets people inspect or improve the model-side behavior instead of locking this experiment to one provider.

My recorded run used NVIDIA's hosted API. It was not offline or private. ghostline sends source excerpts to the configured endpoint; its basic secret redaction is best effort. For a sensitive repository, use --evidence-only or a self-hosted endpoint and review the material first.

The Spirit of It

The ghost did not know how it died. It saw a commit message and some old lines, then filled a gap with a confident, incorrect memory. Keeping the source beside the story made that mistake visible. For me, that is a useful kind of haunting: the past can speak, but you still have to read the record.

Top comments (1)

Collapse
 
n_s_df8b9b80336beea1e5b profile image
N. S. •

Very insightful thank you for sharing!