NecroStack: Resurrecting Abandoned Code and Preserving the Ghost in the Machine A developer built NecroStack, an air-gapped tool that migrates legacy code to modern TypeScript while preserving obscure but critical edge-case logic that generic LLM rewrites tend to silently drop. The system runs Google's open-weight Gemma locally via Docker Model Runner with LangGraph.js orchestration and a PostgreSQL pgvector migration knowledge base, executing a four-stage pipeline from forensic analysis through reanimation to a node:test verification suite. The developer reports zero source-code egress and no cloud API token costs. This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine https://dev.to/challenges/hacktoberfest-week4-2026-10-26 Every software engineer has walked through a digital cemetery. It is 2:00 AM on a Friday. You are tasked with upgrading an ancient, mission-critical service. In the depths of the repository, you stumble upon a file last touched on Halloween 2014. It is written in Node.js v4 CommonJS , littered with deprecated calls to new Buffer vulnerable to uninitialized heap memory disclosures under CVE-2018-7167 , or an ancient jQuery 1.8 script relying on .live , or a Python 2.7 financial ledger doing silent integer floor division. The code is terrifying. Nobody on your team wrote it. The original author left the company eight years ago. Your linters are screaming with deprecation errors. So why doesn’t anyone rewrite it? Because of the "Ghost in the Machine." ⚰️ THE GRAVEYARD DILEMMA ⚰️ +------------------------------------------+ | Vulnerable, Rotting 2014 Legacy Code | | - CVE-2018-7167 Heap Memory Leaks | | - Deprecated crypto.createCipher MD5 | | - Synchronous jQuery XMLHttpRequest | +------------------------------------------+ │ Naive LLM Chatbot Rewrite │ ▼ +------------------------------------------+ | "Clean" Modern TypeScript Hallucination | | ❌ Silently deleted 30s NTP Clock Skew | | ❌ Stripped Asian CJK IME Key Locks | | ❌ Ruined IEEE 754 Banker's Rounding | | 🔥 RESULT: Catastrophic Production Bugs | +------------------------------------------+ Buried beneath that messy legacy code are dozens of hard-won, battle-tested edge cases—the collective wisdom of past open-source maintainers who spent sleepless nights debugging obscure distributed race conditions. A 30-second NTP clock-skew tolerance window for unsynchronized IoT gateways. A keystroke composition lock preventing forms from submitting while a user types Japanese Kanji. A Banker's Rounding algorithm preventing thousands of dollars in cumulative tax drift. When developers paste legacy code into generic commercial cloud chatbots and say "Rewrite this in TypeScript," the chatbot gets lazy. It generates aesthetically pleasing syntax, but it silently deletes the weird-looking conditionals . It murders the soul of the code. NecroStack is an autonomous, 100% air-gapped Legacy Code Necromancer & Open-Source Relic Resurrector . It merges the spooky spirit of Halloween with the deep reverence of Día de los Muertos Day of the Dead : honoring the craft of past open-source maintainers by keeping their domain algorithms alive forever. Powered by Google's open-weight Gemma running locally inside Docker Model Runner , LangGraph.js , and a PostgreSQL pgvector Migration Grimoire, NecroStack executes a deterministic 4-stage Necromancy Ritual: performForensicAutopsy : consultMigrationGrimoire : pgvector HNSW cosine similarity search reanimateIntoTypeScript : verifyVitalSignsAndSave : node:test verification suite asserting every preserved invariant and writes a heartfelt All of this happens with 0 bytes of source code egress , $0.00 in cloud API token costs , and 100% offline digital permanence . Live Demo & Repository Links: docker-compose up -d && bun run dev / An atmospheric public landing page styled in Haunted Terminal meets Día de los Muertos Marigold & Spectral Emerald , featuring an interactive side-by-side artifact preview, a 4-node ritual pipeline overview, and a 1-Click Judge Demo Login. Figure 1: Public landing page showcasing 2015 dead code reanimating into zero-dep ES2026 TypeScript with 0 bytes cloud egress. /dashboard The central operations deck. Selecting a dead relic streams real-time node transitions relic start , node active , node complete , ritual complete over Server-Sent Events SSE . Figure 2: The split-screen Resurrection Workbench with live SSE telemetry, 4 KPI metric cards, and the interactive Crypt Queue. ghost-vault-2015.js Node.js v4 Legacy Crypto new Buffer CVE-2018-7167 , deprecated crypto.createCipher broken MD5, no IV , timing side-channel attacks on === signatures, and nested callback hell. Math.abs nowSec - iat <= 30 and .replace /=+$/, '' . Figure 3: Gemma banishes CVE-2018-7167 while proving 100% preservation of Marcus V.'s 30s NTP skew tolerance. jquery-form-poltergeist.js 2013 ES5 + jQuery 1.8 $.fn.live removed in jQuery 1.9 , synchronous async: false XMLHttpRequest freezing the UI thread, deprecated $.Deferred.pipe , and window. POLTERGEIST LOCK race conditions. tags Bracket Array Normalization Figure 4: Converting legacy jQuery into native Fetch & AbortController while keeping Elena's IME composition guard intact. py2-ledger-phantom.py 2014 Python 2.7 Financial Ledger urllib2 , Python 2 integer floor division silent truncation cents / 100 = 1 , dead xrange , and dict.iteritems . \uFEFF Byte Stripping 1,250.50 - -1250.50 . Figure 5: Reanimating Carlos's Latin American commodities accounting ledger with zero-drift Banker's Rounding. Submission for the Hacktoberfest 2026 Open-Source AI Challenge Week 4: "Ghost in the Machine" Honoring past open-source maintainers by keeping their code alive forever — without cloud egress, subscription tolls, or lost edge cases. Every engineering organization is haunted by dead open-source relics and abandoned legacy modules: forgotten 2013–2015 utilities written in Node.js v4 CommonJS , jQuery 1.8 , or Python 2.7 . These libraries sit unmaintained in the GitHub graveyard, riddled with critical memory-disclosure CVEs like new Buffer CVE-2018-7167 or removed runtime APIs. Yet engineering teams cannot simply rewrite them from scratch. Why? Because buried inside that ancient spaghetti code lies the hard-won domain wisdom of past builders: a 30-second NTP clock-skew tolerance, an Asian CJK IME keystroke composition lock, or IEEE 754 Banker's Rounding on financial taxes. When… src/proxy.ts jose JWT cookies. src/lib/agent/models.ts src/lib/agent/state.ts Annotation.Root state channel definitions. src/lib/agent/nodes.ts src/lib/agent/necroGraph.ts src/lib/seed-data.ts src/app/api/necro/resurrect/route.ts src/components/ResurrectionWorkbench.tsx flowchart TD subgraph Browser "Next.js 16 App Router & Edge Guard" A "Public Landing Page / " B "src/proxy.ts jose JWT Cookie Guard " C "Crypt Workbench /dashboard " A -- B B -- |Authorized| C end subgraph API "Next.js Route Handlers & SSE Engine" D "POST /api/necro/resurrect stream: true " E "EventSource SSE Streaming Engine" C -- D D -- E E -.- |Real-Time Telemetry Packets| C end subgraph LangGraph "@langchain/langgraph Deterministic State Machine" F "Node 1: performForensicAutopsy" G "Node 2: consultMigrationGrimoire" H "Node 3: reanimateIntoTypeScript" I "Node 4: verifyVitalSignsAndSave" F -- G -- H -- I end subgraph LocalInference "Docker Model Runner Air-Gapped Local AI " J "Google Gemma ai/gemma3 on :12434" K "ai/mxbai-embed-large on :12434" end subgraph Storage "PostgreSQL 16 + pgvector Prisma 7 " L "dead relics" M "migration grimoire HNSW Index " N "reanimated modules" O "users" end D -- F F <-- |Fetch Relic AST| L F <-- |Extract Soul & CVEs| J G <-- |Generate Embedding| K G <-- |HNSW Cosine Search <= | M H <-- |Synthesize ES2026 TS| J I <-- |Generate node:test & Ofrenda| J I -- |Upsert Reanimated Output| N To achieve 100% offline execution with 0 bytes of cloud egress , we paired Google's open-weight Gemma model with Docker Model Runner. Docker Model Runner exposes a high-performance, local OpenAI-compatible endpoint on http://localhost:12434/engines/llama.cpp/v1 . Here is the exact model integration from src/lib/agent/models.ts : js import { ChatOpenAI } from "@langchain/openai"; import { DOCKER MODEL BASE URL, LLM MODEL NAME } from "../config"; // Local Gemma LLM instance running on Docker Model Runner export const gemmaModel = new ChatOpenAI { modelName: LLM MODEL NAME, // "ai/gemma3:4B-F16" apiKey: "docker-model-runner-local", configuration: { baseURL: DOCKER MODEL BASE URL.replace /\/$/, "" , // http://localhost:12434/engines/llama.cpp/v1 }, temperature: 0.1, // Near-zero temperature for deterministic code analysis maxRetries: 0, timeout: 8000, } ; Because local open-weight models may output markdown fences or