跳到正文
DEV Community· Sudhir Sharma·· 3 小時前AI 評分39

Necromancer:利用 TabPFN、Gemma 與 SerpApi 復活廢棄程式碼庫

Necromancer: Resurrecting Dead Repos with TabPFN, Gemma & SerpApi

AI 導讀

Necromancer 是一套自主 AI 智能體系統,運用 TabPFN-3.5、SerpApi 及本地開放權重 Gemma,修復並復活停止維護的開源程式碼庫。復活成功須確保 100% 基線測試通過,且不得刪除測試或令測試退步。完整程式碼以 MIT License 開源。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

💀 THE GHOST IN THE MACHINE

TL;DR: Millions of open-source projects die not because their core algorithms are flawed, but because compiler epochs shift, standard libraries vanish, and package URLs rot into digital dust. Necromancer is an autonomous AI agent harness that conducts digital séances on abandoned repositories: Prior Labs TabPFN-3.5 infers resurrectability priors from tabular repository telemetry; SerpApi grounds deprecated symbols against historical PyPI mirrors; local open-weight Gemma authors surgical AST modernization patches inside a hardened Docker sandbox under Auth0 Token Vault security gates; and ElevenLabs chants an audible eulogy honoring the original human maintainer on a sacred Día de los Muertos ofrenda altar.

⚡ The Iron Invariant: Zero baseline tests may be deleted or regressed. A resurrection only succeeds when 100% of historical tests pass on modern runtimes.

What I Built
The Tragedy of Bitrot

Every autumn, GitHub becomes a graveyard. A library written with passion in 2012 helped thousands of developers build their dreams. But in 2020, Python 2 reached End-of-Life; in Python 3.12, imp and distutils were excised; in Python 3.13, cgi was deleted; build backends mandated PEP 517 isolated environments; and old dependency URLs vanished into 404s.

The code didn't fail. Time did.

When developers encounter a dead repository today, they face an agonizing choice: abandon the work, spend weeks manually untangling 14 years of breaking packaging migrations, or rely on closed-source chatbots that hallucinate modern APIs and delete failing tests to fake success.

Interpreting the Theme: The Ghost in the Machine & Día de los Muertos

In the Mexican tradition of Día de los Muertos (November 1 & 2), the dead are not feared—they are remembered with marigold flowers (cempasúchil), candlelight, bread of the dead (pan de muerto), and stories. The veil between the past and present grows thin.

Necromancer treats dead software in that exact spirit:

The Tombstone (Memento Mori): Exhumes repository git archaeology—lead author, total commits, and years dormant.
The Séance Console: A live, retro-spooky streaming terminal powered by xterm.js that inspects compiler failures, extracts error taxonomies, and executes surgical patches step-by-step.
The Sacred Ofrenda & Spoken Eulogy: Upon successful resurrection, an interactive memorial altar is generated. Maintainers receive an audible, deep atmospheric eulogy narrated via ElevenLabs Voice AI, celebrating lead creator satanic47 and the original contributors, accompanied by an exportable PDF Death Certificate.

                 🕯️ THE DIGITAL SÉANCE 🕯️

+--------------------------------------------------------------+
| Dormant Repo (2008-2020) ---> [Git Archaeologist Engine] |
| | |
| v |
| [Prior Labs TabPFN-3.5 Tabular Model] |
| (Bayesian Resurrectability Score) |
| | |
| v |
| [SerpApi Grounding] <-------------> [Local Gemma AI] |
| (PyPI Mirrors & PEP Fixes) (Open-Weight Patching) |
| | |
| v |
| [Auth0 Token Vault Security Gate] |
| (Safe Subprocess / Docker Exec) |
| | |
| v |
| [The Iron Invariant: 100% Baseline Tests Pass] |
| | |
| v |
| [Día de los Muertos Sacred Ofrenda] |
| (ElevenLabs Eulogy + PDF Death Certificate) |
+--------------------------------------------------------------+

Demo

  • 🌐 Primary Custom Domain: https://necromancer.shivysidinfo.tech
  • ☁️ Direct Render Service: https://necromancer-eqkt.onrender.com
  • 🎙️ Live ElevenLabs Ghost Eulogy Sample: Accessible directly from the Hero Séance banner on the live site.
  • 📱 Mobile & Desktop Responsive: Complete responsive workbench layout featuring an animated flaming skull icon, live interactive inspection widgets, and one-click presets for satanic47/necromancer, mojombo/grit, requests, and flask. ### Interactive Tour: What You Can Test Live in 0 Clicks
  • Instant Presets: Click satanic47/necromancer or any preset chip to populate the exhumation altar.
  • Prior Labs TabPFN-3.5 Resurrectability Gauge: Inspect the Bayesian tabular prediction breakdown (Dormancy: 8.5 yrs, LOC: 2,840, Era: Py2.7 Sunset, 0 C-extensions, 14 Baseline Tests).
  • SerpApi Live Mirror Inspector: Click imp, collections.Mapping, urllib2, cgi.escape, or nose to see live historical mirror URLs and exact PEP migration recipes.
  • Begin The Séance: Watch the streaming terminal diagnose syntax errors, synthesize AST diffs, verify test suite preservation, and trigger the victory bell toll with the sacred ofrenda!

Code

The complete source code is open source under the MIT License:

🕯️ Necromancer: Ghost in the Machine

Resurrecting Dead Open-Source Repositories & Honoring Their Creators.
Built for the DEV × Hacktoberfest 2026 "Ghost in the Machine" Challenge (Week 4).
Target Portal: necromancer.shivysidinfo.tech


🔮 What is Necromancer?

Necromancer is an autonomous AI agent system designed to exhume and resurrect dormant open-source repositories (abandoned 5–10 years ago) using local open-weight LLMs (vLLM / Ollama), a hardened Docker sandbox, and supply-chain auditing.

When a repository is resurrected and passes 100% of its test invariants, Necromancer synthesizes a spoken eulogy via ElevenLabs Voice AI, monitors full agent latency & token spans via Sentry, and renders an offline commemorative HTML "Ofrenda" honoring the original authors in the spirit of Día de los Muertos.


🏛️ The 13 Architectural Pillars

  1. Séance Console: Real-time WebSocket terminal & dashboard streaming agent thoughts, tool calls, and vital signs.
  2. Time-Machine Slider: Interactive component to scrub between vintage release…

Repository Architecture

necromancer/ ├── app/ │ └── main.py # FastAPI ASGI backend + WebSockets + REST harness ├── core/ │ ├── archaeo.py # Git archaeology (commit history, author attribution) │ ├── era.py # Multi-epoch compiler taxonomy (12 runtime eras) │ ├── harness.py # Autonomous séance agent loop & invariant verifier │ ├── llm.py # Open-weight Gemma client with streaming tool calls │ ├── sandbox.py # Hardened Docker container runtime with resource quotas │ ├── resurrectability.py # Prior Labs TabPFN-3.5 tabular foundation model │ ├── serp_crawler.py # SerpApi historical PyPI mirror & PEP migration engine │ ├── auth0_agent.py # Auth0 for AI Agents Token Vault security gate │ ├── eulogy.py # ElevenLabs atmospheric eulogy synthesis │ ├── sentry_tracing.py # Sentry distributed transaction & error tracking │ └── ofrenda.py # Commemorative Día de los Muertos altar generator ├── static/ │ ├── index.html # Responsive GUI, xterm.js terminal, PR diff viewer │ ├── app.js # Reactive WebSockets, Web Audio sound engine, SFX dock │ ├── style.css # Custom Día de los Muertos altar & Halloween themes │ ├── skull_flames.gif # Full animated burning skull │ ├── skull_flames_transparent.gif # Transparent animated skull │ └── favicon_skull.gif # 64x64 animated favicon └── tests/ ├── test_phase1.py # Test parser & baseline invariant verification ├── test_phase2.py # Compiler era taxonomy & AST repo mapping ├── test_phase3.py # Autonomous resurrection agent loop └── test_partners.py # TabPFN, SerpApi, and Auth0 dedicated test suites

How I Built It

Necromancer combines a multi-partner toolchain built around open-weight foundation models and agent safety harnesses:

1. The Core Agent Harness & Local Open-Weight Gemma

Rather than relying on closed, proprietary cloud APIs that cost money and impose unpredictable rate limits, Necromancer's reasoning loop is engineered around Google's open-weight Gemma family (Gemma 2 2B/9B/27B via Ollama / HuggingFace Transformers).

core/llm.py (Excerpt)

class GemmaClient:
"""Interfaces with local open-weight Gemma models for surgical AST patching."""
def init(self, model_name: str = "gemma2:9b", base_url: str = "http://localhost:11434"):
self.model_name = model_name
self.base_url = base_url
async def generate_patch(self, prompt: str, system_prompt: str) -> Dict[str, Any]:
# Formats surgical JSON diff instruction enforcing test suite preservation
...

The agent executes a four-step autonomous loop:

Baseline Phase: Runs existing tests inside an isolated sandbox. If all pass, no resurrection is needed. If they fail, compiler stdout/stderr is captured.

Taxonomy Classification: Parses tracebacks into discrete categories (DEPRECATED_MODULE, PRINT_PAREN_ERROR, COLLECTIONS_ABC_IMPORT, MISSING_DEP, ASSERTION_FAILURE).

Surgical Synthesis: Gemma inspects the repository symbol map and writes minimal, non-destructive file replacements (e.g. converting import imp to import importlib.util, upgrading setup.py to PEP 621 pyproject.toml).

The Iron Invariant Verification: The test runner re-executes. If the count of passing tests drops or baseline test files were tampered with, the patch is rejected immediately.

  1. Prior Labs TabPFN-3.5: Tabular Resurrectability Inference

Before spending compute on dead code, Necromancer queries Prior Labs' TabPFN-3.5, the breakthrough foundation model for tabular data. We extract 7 key structural features from the target repo:

dormancy_years (Float)
total_commits (Float)
loc (Lines of Code)
era_year (Epoch anchor: 2008, 2012, 2015, 2020, 2026)
c_extension_count (C/Cython binary extension risk)
has_tests (1.0 or 0.0)
dependency_count (Active package requirements)

core/resurrectability.py (Excerpt)

class TabPFNResurrectabilityEngine:
def predict_resurrectability(self, features: Dict[str, Any]) -> Dict[str, Any]:
# Evaluates tabular features against TabPFN prior distribution
# Returns score (0-100), predicted strategy, and identified risk factors

TabPFN calculates a zero-shot Bayesian confidence score (e.g., 94.2%) and flags tabular anomalies—such as severe dormancy (>8 years) or C-extension compilation risks—before the séance begins.

  1. SerpApi: Historical Grounding & Dependency Mirror Crawling

When a repository from 2013 specifies dependencies like urllib2, collections.Mapping, or pins packages from deprecated index URLs, modern PyPI rejects them. Necromancer integrates SerpApi to crawl historical Python documentation, PEP deprecation schedules, and PyPI wheel mirrors:

Translates imp → importlib.util (PEP 3108)
Translates collections.Mapping → collections.abc.Mapping (PEP 585)
Translates cgi.escape → html.escape (PEP 594)
Identifies active PyPI backport mirrors and wheel caches.

  1. Auth0 for AI Agents: Token Vault Security Gate

Letting an AI agent execute arbitrary code and modify build systems is inherently risky. We implemented Auth0 for AI Agents:

Evaluates the risk level of every agent action (SAFE, MEDIUM, HIGH, CRITICAL).
Issues cryptographic HMAC Token Vault Session Tickets (auth0_tv_...).
Imposes human-in-the-loop gates whenever an agent attempts destructive file writes or packaging overrides.

  1. ElevenLabs Voice AI: The Spoken Séance Eulogy

When the resurrection succeeds, the lead author's spirit is commemorated. The agent generates a personalized eulogy script acknowledging the maintainer's contributions and calls ElevenLabs using the deep, ominous Adam / Charlie voice model to synthesize an atmospheric spoken audio track.

  1. Sentry Tracing: Distributed Séance Performance

Resurrections can span dozens of container execution steps. Sentry monitors the entire séance pipeline:

Distributed traces for exhumation, TabPFN scoring, Gemma inference, and test verification.
Error taxonomy profiling to track which compiler deprecations fail most frequently across epochs.

Why Does Open Innovation Matter?

This challenge asks: Where did an open-based approach work better than a closed one?

For a project dedicated to resurrecting dead software, open innovation is not a preference—it is an existential requirement:

Immunity from Corporate Sunset: Closed APIs deprecate endpoints, modify weights, and shutter services at will. A tool built to save software from bitrot cannot itself depend on a transient SaaS service that might not exist in five years. Open weights are permanent.

Offline & Air-Gapped Operation: The most critical legacy software in the world runs inside municipal utilities, hospitals, scientific laboratories, and government archives without access to the public internet. Because Gemma runs locally via Ollama / Transformers, Necromancer can execute inside an air-gapped server room with the internet completely disconnected.

Absolute Data Privacy: Millions of unmaintained codebases contain proprietary internal business logic, embedded credentials, or private intellectual property. Organizations cannot upload their confidential 2014 codebases to closed third-party cloud APIs. Open-source AI keeps every line of code strictly on the local machine.

Zero-Token Tax for Long Loops: Fixing complex build chains requires iterative execution—sometimes dozens of compiler rounds. With closed commercial APIs, long tracebacks quickly exhaust rate limits and cost dollars per repository. Open-weight inference costs $0.00.

📜 Session Transcript Archive: Embedded via DevRelay Agent Session
🧪 Automated Test Suite: 83 unit and integration tests passing in 1.85s across all phases (tests/test_partners.py
).

The Spirit of It

During testing, we ran Necromancer against legacy repositories that hadn't seen a git commit in nearly a decade.

When the agent exhumed satanic47/necromancer—a vintage Python codebase frozen in time—it felt like opening a crypt. The dependencies were broken, the imports had been removed from modern Python, and the setup scripts failed with cryptic errors.

Then the séance started.

Watching open-weight Gemma diagnose the 2016 packaging error, consult SerpApi for the PEP 3108 replacement, apply the surgical diff, and re-run the test suite until the terminal flashed green was electric. And then, the screen dimmed, the marigold bunting swayed, and ElevenLabs' resonant, candle-lit voice began to speak:

"Hark, traveler of the digital void. We gather at this sacred altar to honor satanic47, who in the year 2016 cast 47 commits into the ether. For eight winters the code lay dormant in the machine. Tonight, on Día de los Muertos, the spirits awaken once more. Rest easy, creator: your tests pass, and your work lives on."

It wasn't just a green checkmark on a build server. It was a digital remembrance—proof that open-source software, and the people who built it, are never truly forgotten.

Prize Categories

We are formally submitting Necromancer for consideration in the following partner categories:

Featured Categories
Prior Labs — Best Use of TabPFN ($200):
Integrates Prior Labs TabPFN-3.5 (core/resurrectability.py), the state-of-the-art tabular foundation model, to predict whether an abandoned repository can be safely resurrected. TabPFN evaluates 7 structural telemetry features (dormancy years, commit volume, LOC, era, C-extension count, test density, and dependency count) to output zero-shot Bayesian resurrectability priors, recommended porting strategies, and tabular risk factors before any compute is spent.

Render — Best Use of Render ($200):
Necromancer is deployed and hosted live on Render (https://necromancer-eqkt.onrender.com
), running an asynchronous FastAPI ASGI backend with WebSocket streaming, Docker sandbox management, and automated git deployment workflows.

Gemma — Best Use of Gemma ($200):
Uses Google's open-weight Gemma family (core/llm.py) as the primary intelligence engine for autonomous code diagnosis and surgical AST patch generation, demonstrating how open-weight models running locally outshine closed APIs for privacy-sensitive, air-gapped legacy code modernization.

Partner Categories

Auth0 — Best Use of Auth0 for AI Agents ($100):
Implements the Auth0 for AI Agents architecture (core/auth0_agent.py), featuring dynamic risk-tier classification (SAFE, MEDIUM, HIGH, CRITICAL), HMAC-signed Token Vault session tickets, and security gates preventing the agent from modifying arbitrary system files or executing unauthorized packaging scripts.

SerpApi — Best Use of SerpApi ($100):
Powers the Historical Package Grounding Engine (core/serp_crawler.py), crawling archived PyPI repositories, PEP deprecation schedules, and legacy wheel mirrors to ground the LLM with factual replacement paths for removed standard library symbols (imp, collections.Mapping, urllib2, cgi.escape, nose).

ElevenLabs — Best Use of ElevenLabs ($100):
Gives the machine its ghost voice (core/eulogy.py), synthesizing personalized spoken eulogies using ElevenLabs' deep voice models to honor original repository creators when their code is resurrected on the Día de los Muertos ofrenda.

Sentry — Best Use of Sentry ($100):
Integrates distributed transaction tracing and error monitoring (core/sentry_tracing.py), profiling every phase of the autonomous séance loop and tracking compiler deprecation taxonomies in real time.
DigitalOcean & .tech Domains:
Live custom production domain mapped at https://necromancer.shivysidinfo.tech

Published by: @satanic47
Honoring Lead Creator: satanic47 and open-source maintainers everywhere.
Happy Hacktoberfest 2026 & Feliz Día de los Muertos! 🌼💀🕯️
.

來源:DEV Community · dev.to