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.patchfiles ready forgit applyor 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:
- Low-Level Git Forensic Plumbing (
git_archeologist.py): Native subprocess bindings runninggit log --diff-filter=D --summaryandgit show <sha>^:<file>to recover deleted blobs directly from object history, with a graceful sandbox fallback for non-git directories. - Static AST Analysis Engine (
ast_scanner.py): Pure Pythonastmodule walkingFunctionDef,AsyncFunctionDef,Name,Call, andAttributenodes to computeDefinedSymbols - ReferencedSymbols. - Kiro Spec-Driven Architecture & Hooks (
.kiro/):- Steering:
architecture.mdandconventions.mdlock in system boundaries and zero-dependency rules. - Specs:
requirements.md,design.md, andtasks.mddrive structured implementation. - Agent Hooks:
post-file-save.jsontriggers AST zombie scans on file save, andpre-commit-audit.jsonenforces--strictdead-code audits before commits.
- Steering:
- Zero-Dependency Web UI & TUI (
web_dashboard.py,cli.py): Built with Python's nativehttp.serverand 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 installrequired. - Sub-Second Excavation & Resurrection: Scans repositories and generates ready-to-apply
.patchfiles instantaneously via both CLI and Web UI. - End-to-End Kiro Integration: Full
.kiro/steering/,.kiro/specs/, and.kiro/hooks/workflow verified by an automatedunittestsuite.
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
- ast
- cli
- css3
- git
- html5
- http-server
- javascript
- kiro
- python