This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
Séance is a terminal app where you talk to the ghosts of dead programming languages. Ask how to loop in COBOL, read a file in Fortran, or build a record in Pascal, and the spirit answers in eerie prose plus a complete program. Ask about a living language and the veil stays closed: it refuses, in character.
For the theme, I wanted to honor the past: languages that people stopped teaching but whose code is still out there. A ghost that makes things up is useless, though, and small open models are shaky on obscure syntax. So every answer is checked: the code is compiled and run with a real compiler before you see it.
Demo
You > How do I loop 5 times in COBOL?
📜 Scrolls consulted (vector): Loops: PERFORM VARYING, PERFORM UNTIL, PERFORM TIMES, ...
👻 COBOL:
The candlelight flickers, casting elongated shadows across the ancient mainframes...
✅ Verified: compiled (free-format) and ran cleanly.
Output:
| Iteration: 00
| Iteration: 01
| Iteration: 02
| Iteration: 03
| Iteration: 04
Code
mrayan980
/
Ouija-Compiler
Local AI séance that only answers questions about dead programming languages (COBOL, Fortran, Pascal). Runs offline on open-weight models, with RAG over verified reference scrolls and real compile-and-run checks.
SEANCE: talk to dead programming languages
A local AI medium that only answers questions about dead or legacy languages. It replies in spooky prose plus working code, and the code is compiled and run for real before you see it. Everything runs on your machine with open-weight models (Ollama).
question -> gate -> RAG (reference scrolls) -> local LLM -> compile & run -> (error -> retry) -> answer
| File | Job |
|---|---|
gate.py |
Only dead languages pass. Alias match first, local-LLM classifier as fallback |
rag.py |
Chunks knowledge/*.md, SQLite index, vector search (Ollama embeddings) with automatic offline BM25 fallback |
verify.py |
Extracts the code block, compiles with the real toolchain, runs it with limits |
seance.py |
The loop: retrieve, generate, verify, repair, print. Run this one |
knowledge/ |
Reference "scrolls" for COBOL, Fortran, Pascal (every snippet is compile-tested) |
Setup
# 1. models (pick any local chat model; coder models do best at old syntax)…How I Built It
Everything runs locally on an 8 GB Windows laptop (WSL2, no GPU):
- Model: Gemma 3 (4B), open-weight, served by Ollama.
- The gate: only dead or legacy languages get through. Alias rules run first, with the local model as a fallback classifier, so "Pascal's triangle in Python" is correctly refused.
- RAG: a small knowledge base of reference "scrolls" (31 sections covering COBOL, Fortran and Pascal) indexed in SQLite and searched with Ollama embedding. If no embedding model is available, it falls back to offline BM25 keyword search.
- Verification: the code block is extracted and compiled with GnuCOBOL, gfortran or Free Pascal, then run with a timeout and a stripped-down environment. If it fails, the compiler error goes back to the model, together with fresh scrolls retrieved using that error as the query, for up to two retries.
- Tests: 52 tests, including one that compiles and runs every code sample in the knowledge base, so the scrolls themselves are known to be correct.
Why Does Open Innovation Matter?
- It works with the lights off. No internet, no API key, no per-question cost. I ran the demo with Wi-Fi switched off.
- I control the whole loop. The model is one environment variable, the knowledge base is plain Markdown, and the persona is a prompt I can edit. The retry loop, retrieval keyed on compiler errors, and the sandbox limits only exist because I could see and change every stage.
- Nothing can disappear on me. A project about preserving things that outlive their vendors would be ironic if it depended on a hosted API that could change or shut down.
- The honest trade-off: a 4B model on a CPU takes tens of seconds per answer and is weaker than large hosted models on obscure syntax. That is exactly why the retrieval and the real compilers matter: they let a small open model produce code you can trust.
The Spirit of It
These languages are not really gone, only quiet. Summoning them felt right, and making each spirit prove its answer by actually running it felt even better.
Top comments (0)