Inspiration

Every software repository eventually degrades into a cemetery of dead code. Teams delete legacy utilities during frantic refactors, experimental feature branches gather digital dust, and uncalled "zombie" routines linger undetected inside active files—bloating codebases and confusing developers.

For the Kiroween Hackathon, we asked: What if an AI-powered development workflow didn't just write new code, but acted as a codebase archeologist and necromancer? What if we could exhume buried logic from Git history, detect living-dead functions through syntax trees, and resurrect them into clean, reviewable Git patches with a single click? That vision became GraveDigger: The Codebase Necromancer.

What it does

GraveDigger transforms repository forensics into an interactive, gothic-themed developer co-pilot:

  • Git Cemetery Excavation: Uses low-level Git plumbing (diff-filter=D, tree-deltas, and reflog mining) to locate historically deleted files, commit SHAs, authors, and epitaphs without clone bloat.
  • AST Zombie Detection: Parses repository source trees into Abstract Syntax Trees (ast.parse & ast.NodeVisitor) to build cross-module symbol reference graphs and flag unreferenced "zombie" functions along with dead LOC weight.
  • Autonomous Code Resurrection: Restores buried artifacts into resurrected/ and outputs clean, unified Git .patch files ready for git apply or pull request creation.
  • Gothic TUI & Cemetery Web Dashboard: Provides both an ANSI-styled terminal interface (python -m gravedigger.cli dig) and a standalone zero-dependency web dashboard (http://localhost:6660) with interactive tombstone cards and one-click Resurrect Artifact actions.

How we built it

Built for the Frankenstein Track, GraveDigger stitches together four disparate systems into one cohesive chimera:

  1. Low-Level Git Forensic Plumbing (git_archeologist.py): Native subprocess bindings running git log --diff-filter=D --summary and git show <sha>^:<file> to recover deleted blobs directly from object history, with a graceful sandbox fallback for non-git directories.
  2. Static AST Analysis Engine (ast_scanner.py): Pure Python ast module walking FunctionDef, AsyncFunctionDef, Name, Call, and Attribute nodes to compute DefinedSymbols - ReferencedSymbols.
  3. Kiro Spec-Driven Architecture & Hooks (.kiro/):
    • Steering: architecture.md and conventions.md lock in system boundaries and zero-dependency rules.
    • Specs: requirements.md, design.md, and tasks.md drive structured implementation.
    • Agent Hooks: post-file-save.json triggers AST zombie scans on file save, and pre-commit-audit.json enforces --strict dead-code audits before commits.
  4. Zero-Dependency Web UI & TUI (web_dashboard.py, cli.py): Built with Python's native http.server and REST endpoints (GET /api/graveyard, POST /api/resurrect) paired with a dark-crypt HTML/CSS interface.

Challenges we ran into

  • AST Cross-Module Scope Resolution: Distinguishing between genuinely uncalled dead routines and entry-point or magic dunder methods required careful filtering across module boundaries.
  • Full Blob Recovery & Path Parsing: Ensuring deleted files across nested directories could be cleanly reconstructed into valid unified Git diff headers (--- /dev/null, +++ b/...) without corrupting line endings or encodings.
  • Zero-Dependency Constraint: Building both an atmospheric Terminal UI and a responsive, interactive Web Dashboard using only the Python 3.10+ standard library without relying on external frameworks.

Accomplishments that we're proud of

  • Zero External Runtime Dependencies: Runs out of the box on pure Python 3.10+ with no pip install required.
  • Sub-Second Excavation & Resurrection: Scans repositories and generates ready-to-apply .patch files instantaneously via both CLI and Web UI.
  • End-to-End Kiro Integration: Full .kiro/steering/, .kiro/specs/, and .kiro/hooks/ workflow verified by an automated unittest suite.

What we learned

Using Kiro's spec-driven workflow (requirements.md -> design.md -> tasks.md -> hooks/) kept architectural intent crystal clear before writing code, eliminating scope drift and making the Git, AST, and UI subsystems snap together cleanly.

What's next for GraveDigger: The Codebase Necromancer

  • Polyglot AST Support: Expanding zombie code detection to TypeScript/JavaScript, Go, and Rust repositories.
  • Semantic AI Excavation: Letting developers query natural language prompts like "Find that Redis retry helper we deleted 6 months ago" and automatically adapting the resurrected code to current HEAD.
  • CI/CD & GitHub Action Packaging: Publishing a drop-in GitHub Action for automated PR zombie-code audits.

Built With

Share this project:

Updates

Submission history