DEV Community

Sneha Ghosh
Sneha Ghosh

Posted on

DeadCode: The Spirit of Forgotten Languages 👻

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

👻 DeadCode: The Spirit of Forgotten Languages

Giving forgotten code a second life with open-source AI.

What I Built

What happens when the developer who wrote a program is long gone, the documentation has disappeared, and the code is still running somewhere?

That question inspired me to build DeadCode: The Spirit of Forgotten Languages, an open-source AI coding companion designed to help developers understand and preserve legacy code.

Inspired by the Ghost in the Machine theme, DeadCode explores the digital ghosts left behind by earlier generations of programmers. From COBOL business systems to classic BASIC programs, old code carries logic, decisions, and stories that can easily be lost when nobody understands how it works anymore.

DeadCode currently provides:

  • Legacy Code Analysis: Identifies familiar structures and review-worthy patterns in COBOL and BASIC source files.
  • AI-Powered Explanations: Uses an optional local open-weight coding model to explain code in plain English.
  • Language History: Provides historical context for COBOL and BASIC, helping developers understand the programming traditions behind the code.
  • Local-First Operation: Performs its basic static analysis without an AI API or internet connection.
  • Developer-Friendly CLI: Makes it easy to inspect legacy source files directly from the terminal.

This is an early MVP, not a complete compiler or a replacement for professional static-analysis tools. Its goal is to make legacy code easier to approach, understand, and preserve.

Demo

The project currently runs as a command-line application.

Example:

python -m deadcode.cli analyze examples/haunted_payroll.cob
Enter fullscreen mode Exit fullscreen mode

To explore an old BASIC program:

python -m deadcode.cli analyze examples/old_basic.bas
Enter fullscreen mode Exit fullscreen mode

To request an explanation from a local AI model:

python -m deadcode.cli explain examples/haunted_payroll.cob --ai
Enter fullscreen mode Exit fullscreen mode

Code

GitHub Repository: DeadCode: The Spirit of Forgotten Languages

The repository includes the Python source code, sample COBOL and BASIC programs, automated tests, documentation, and an MIT license.

The project is designed to be approachable for contributors interested in legacy programming languages, open-source AI, and software preservation.

How I Built It

I wanted the project to be useful even when AI is unavailable, so I separated deterministic analysis from AI-generated explanations.

Technology stack:

  • Python: Core application and command-line interface.
  • Ollama: Optional local inference through a locally running model.
  • Qwen2.5-Coder: Example open-weight coding model for local explanations.
  • Python unittest: Automated tests for the analyzer and language-history utilities.
  • Git and GitHub: Version control and open-source collaboration.

The basic analyzer checks source files for recognizable structures and patterns. The optional AI layer sends the source text to a locally running Ollama instance and asks the model to explain the program, walk through important statements, and identify questions or risks that deserve further investigation.

To try the local AI feature, install Ollama and download a compatible model:

ollama pull qwen2.5-coder:3b
python -m deadcode.cli explain examples/haunted_payroll.cob --ai
Enter fullscreen mode Exit fullscreen mode

Once the model has been downloaded, local inference can work without an internet connection, depending on the environment.

The initial implementation includes seven automated tests, covering language detection, common analysis patterns, empty source files, and history lookup.

Why Does Open Innovation Matter?

Legacy source code can contain sensitive business logic, historical decisions, and knowledge that is difficult to reconstruct. Sending that code to a third-party hosted AI service is not always an option.

Open innovation makes a different approach possible.

1. Privacy through local inference

With a locally running model, developers can request code explanations without sending source code to a hosted AI API through DeadCode. This is especially valuable when examining proprietary or sensitive legacy systems, provided the rest of the environment is also configured appropriately.

2. Freedom to choose the model

The AI layer is not tied to one proprietary provider. Developers can experiment with compatible local models and adapt the prompts to their own workflows.

3. Useful without AI

DeadCode's basic static analysis works independently of a model. That means the project can still inspect source files when an AI model is unavailable, while the optional AI layer adds deeper explanations.

4. Software preservation belongs to everyone

The tools used to understand old software should not depend entirely on a single commercial API. An open-source foundation gives developers the freedom to inspect, modify, extend, and preserve the tools themselves.

For me, that is the most important part of this project. Open AI is not just an alternative way to generate text. It can help make software knowledge more accessible, private, and durable.

The Spirit of It

Every old codebase has a story.

A variable name might preserve a business decision. A strange conditional might reflect a hardware limitation from decades ago. A numbered BASIC program might be someone's first experience of programming.

When the original developer leaves, the code remains. Sometimes, the only way to recover the reasoning behind it is to study what was left behind.

I built DeadCode around that idea: the code may be forgotten, but its logic deserves another chance to be understood.

This is an early step toward a larger vision of using open-source AI to preserve programming knowledge across generations.

Prize Categories

  • Open-Source AI: The project combines deterministic analysis with an optional open-weight model.
  • Local Inference: The AI explanation feature is designed to run through a local Ollama instance.

Please verify the official challenge's category names and eligibility before submitting.

Try It and Contribute

If you work with legacy systems, enjoy programming-language history, or want to contribute to open-source AI tools, I'd love to hear your thoughts.

What forgotten programming language or abandoned codebase should DeadCode learn to understand next?

Let's give forgotten code a second life. 👻

Top comments (0)