cd /news/ai-tools/i-summoned-cobol-to-ask-if-its-dead-… · home › topics › ai-tools › article
[ARTICLE · art-161116] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

I Summoned COBOL to Ask If It’s Dead. It Was Offended.

A developer built a terminal app that summons eight legacy programming languages — COBOL, Fortran, ALGOL, Pascal, Flash, 6502 Assembly and others — as personality-driven "spirits" users can chat with, translate code into, and get roasted by. The tool runs entirely locally on Ollama with Gemma 3 (4B) on CPU, defines each spirit as a YAML file with layered prompts, streams replies through an async httpx client with a typewriter effect, and keeps a rolling 20-message memory window. Optional ElevenLabs text-to-speech and Sentry tracing of time-to-first-token and token counts round out the build.

by read6 min views1 publishedOct 30, 2026

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine Every few years someone declares COBOL dead. This time I decided to ask it myself.

There are eight spirits, and none of them are polite about being forgotten:

The first thing I typed to COBOL was "are you dead?" It said:

I AM COBOL. I PROCESS TRILLIONS OF DOLLARS DAILY. IT IS NOT "DEAD," UNDERSTAND? IT IS... ACTIVE. I AM HERE.

You can do more than chat. /translate makes a spirit rewrite your modern code in its own language, /teach gives you a lesson from the source, /roast has your code critiqued by someone who was there first, and /history gets you a real story from the language's past.

I took "Ghost in the Machine" literally. These languages are the ghosts in the machine: invisible, supposedly gone, and still running somewhere under everything.

Summon the ghosts of dead (or "dead") programming languages and talk to them.

A terminal app where eight legacy languages come back as spirits with their own personalities, grudges and ways of speaking. It runs 100% locally with Ollama and Gemma 3 (4B). No cloud, no API keys, no internet needed once the model is downloaded.

YOU: are you dead?

COBOL: I AM COBOL. I PROCESS TRILLIONS OF DOLLARS DAILY. IT IS NOT "DEAD," UNDERSTAND? IT IS... ACTIVE. I AM HERE.

Spirit Personality
🏛️ COBOL Proud bureaucrat. SPEAKS IN UPPERCASE. Offended that you think it's dead.
⚡ Fortran Grizzled scientist who invented the compiler. Has opinions about NumPy.
🎩 ALGOL Aristocratic ancestor of everything. Wears a monocle.
🎓 Pascal Strict teacher with a ruler. Disappointed in JavaScript.
🎮 Flash Bitter millennial. Misses Newgrounds.
🧮 6502 Assembly Minimalist monk. Thinks in hex. Judges your

The core app is Python, Ollama and Gemma 3 (4B), running on CPU with no cloud and no API key. The libraries are Rich, Click, httpx and PyYAML.

Spirits are just YAML files. Each one holds a personality, a greeting, era context, a code style and translation rules. A registry auto-discovers them and supports aliases, so asm finds 6502 Assembly. Adding a ninth ghost means writing one file and no code.

Prompts are layered. A shared preamble sets the rules (never break character, be eerie, use real syntax, stay short), and a per-mode block changes behavior for chat, translate, teach, roast or history.

Replies stream. An async httpx client pulls tokens from Ollama, and a typewriter layer reveals them one character at a time. It s on punctuation, and now and then a character flickers into static and corrects itself.

Memory is a rolling window. The last 20 messages are kept, but the opening greeting is always preserved, so a small model keeps its personality without overflowing its context.

/voice on sends each reply to ElevenLabs text-to-speech and plays it. It runs in a background thread so the typewriter never stalls. Before sending, the text is trimmed to about 350 characters, with code blocks and *stage directions* removed, so the ghost doesn't read out "asterisk static crackles asterisk" and the free tier lasts longer.

The gotcha: some ElevenLabs voices return a 402 on the free plan when called through the API. [FILL: describe what you ended up using, e.g. "I ended up with one premade voice for every spirit."] Voices are a simple dictionary in voice.py, so giving each spirit its own sound is a one-line change per ghost.

These spirits are agents with personalities, so I wanted to know what each reply costs. Every reply is a Sentry trace with the spirit, mode, model, time to first token, model generation time (typewriter delays excluded), an approximate token count (counted from streamed chunks) and any errors. Message text never leaves the machine, only timings and counts.

What I found: [FILL: your real numbers, e.g. "The first reply after launch took X seconds to start. Every later one started in about Y seconds. That gap is Ollama Gemma into memory."]

[FILL ONLY IF TRUE: what you changed because of it, e.g. "So the app now warms the model at startup." Delete this line if you didn't change anything.]

A 4B model has limits, and I'd rather tell you than hide them:

a + b test came back as COBOL with hardcoded values and a DISPLAY statement that isn't valid. It looks right and shouldn't be compiled. A bigger Gemma would likely fix the first two. That's the tradeoff of running on a laptop CPU.

A closed API would have changed what this project is.

It cost nothing to run. Tuning a persona means sending the same prompt thirty times, and I did that late into the night without watching a bill.

The core is private. When you /roast your own code, it stays on your machine. Voice and tracing are opt-in extras, and I want to be clear about what they send: voice sends the spirit's reply text to ElevenLabs, and tracing sends timings only.

Anyone can add a ghost. The model is open-weight and the spirits are plain YAML, so someone can summon Perl or Delphi without asking permission. A project about keeping old technology alive felt right on top of something anyone can run, read and keep alive.

I started with an AI coding agent (Antigravity), which generated the first version of the app: the structure, the spirits, the effects, the engine. Its files were written in about ten minutes, according to the folder timestamps. Then it hit its quota, and its shell was broken, so the code had never run once.

I picked it up there. I ran it, fixed the bugs, added the ElevenLabs voice and the Sentry tracing, and wrote this post, with help from Claude for the debugging. A ghost in the machine, built partly by one, and finished by hand when the agent ran out of breath.

The moment it landed for me was COBOL's answer. A 4-billion-parameter model on my laptop had just taken offense on behalf of a language from 1959.

These languages carry stories. COBOL and Fortran still turn up in banks, government systems and labs, BASIC taught a generation their first program, and Lisp keeps being rediscovered. (The "trillions of dollars" line is the model talking, so don't quote it as a statistic, but the point stands.) When we call something dead, we usually mean "I don't have to deal with it." The people who maintain these systems know better.

If this makes one person look up the real history of a language, or lets a beginner try BASIC without feeling intimidated, then the ghosts did their job. Best Use of Gemma: the whole app runs on Gemma 3 (4B) through Ollama, locally on CPU. Gemma is every spirit's voice, translator, teacher and critic, and the post covers what a 4B model handled well and where it struggled.

Best Use of ElevenLabs: spirits speak their replies through ElevenLabs text-to-speech. Voice is opt-in with /voice on, plays in a background thread, and trims and cleans the text so the free tier lasts.

Best Use of Sentry Agent Tracing: every spirit reply is a trace with time to first token, model time, approximate tokens and errors, with no message content sent. The findings are in the Sentry section above.

── more in #ai-tools 4 stories · sorted by recency
── more on @ollama 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-summoned-cobol-to-…] indexed:0 read:6min 2026-10-30 · —