Inspiration
Across thousands of university, municipal, and national libraries, millions of legacy MARC 21 (ISO 2709) catalog records sit trapped in digital purgatory. Decades-old migrations left them with garbled MARC-8 character encodings, truncated titles, missing summaries (520), absent subject headings (650), and invalid publication dates (008). Because search engines cannot index what lacks semantic metadata, these books effectively vanish from human discovery.
For the Kiroween 2026 — Resurrection track, we built NecroMARC to bring these dead bibliographic records back to scholarly life without sacrificing archival rigor or provenance.
What it does
NecroMARC is a full-stack bibliographic resurrection engine and bilingual digital archive (English LTR & Arabic RTL):
- Forensic Decay Diagnostics: Parses raw binary
.mrcfiles (ISO 2709), repairs legacy MARC-8/Latin-1 encodings to clean UTF-8, and computes a deterministic Decay Score ($D \in [0, 100]$) and Vitality Score ($V = 100 - D$) based on missing or malformed MARC fields: $$D = \min\left(100,\; \sum_{i} w_i \cdot \mathbb{I}(\text{rule}_i \text{ triggered})\right)$$ - AI-Powered Bibliographic Resurrection: Uses LLM synthesis (via OpenRouter) to reconstruct missing scholarly summaries (
520), standardized subject headings (650), and historical era metadata—strictly grounded in the surviving bibliographic fields and explicitly stamped with$9 NecroMARC-AIprovenance. - Semantic Knowledge Graph: Generates 768-dimensional embeddings via Gemini (
gemini-embedding-001) stored in Supabase (pgvector) to uncover hidden thematic connections between resurrected books and render an interactive force-directed Knowledge Graph. - Archival Round-Trip Export: Exports resurrected records back into valid binary
.mrc,MARCXML, andJSON-LD(schema.org/Book) ready for re-ingestion into modern library systems.
How we built it
- Spec-Driven Development with Kiro: Every feature—from the MARC 21 parser and decay rules to the UI redesign—was engineered using Kiro's structured workflow (
requirements.md,design.md, andtasks.md) alongside custom steering rules and automated verification hooks. - Backend (
Python 3.11&Flask): Built aroundpymarcfor binary ISO 2709 parsing/serialization, deterministic rule evaluation, OpenRouter chat completions with automatic fallback routing, and Gemini vector embeddings. - Database (
Supabase&pgvector): Stores raw and resurrected MARC fields, audit logs, and vector similarity RPC functions (match_marc_records&edge_candidates). - Frontend (
Astro,TypeScript, &Tailwind CSS): A high-contrast "Dark Archival Luxury meets Retro-Phosphor CRT Telemetry" interface supporting instant English/Arabic switching using CSS logical properties (ms-*,pe-*) and bidirectional isolation (unicode-bidi: isolate) for raw MARC tags.
Challenges we ran into
- Bilingual RTL/LTR Isolation: MARC 21 tags (
=245 10$a...) and raw terminal logs must remain strictly left-to-right even when the surrounding UI switches to ArabicRTL. We solved this by enforcing logical CSS properties across all components and isolating MARC spans withdir="ltr"andunicode-bidi: isolate. - Legacy Character Encodings: Real-world
.mrcfiles from archival repositories often mix UTF-8, MARC-8, and Latin-1 bytes. We built a multi-stage decoder with fallback recovery so corrupted bytes never crash ingestion. - Shared Hosting Deployment (cPanel/Passenger): Configuring subpath routing (
/necromarc/for static Astro pages and/necromarc/apifor Flask via Phusion Passenger) required custom.htaccessexclusions and WSGI entry-point tuning.
Accomplishments that we're proud of
- 397 Automated Tests Passing: Achieved 100% pass rate across 273 backend tests (pytest) and 124 frontend tests (Vitest, including automated WCAG contrast checks, RTL property audits, and bundle secret scans).
- Zero-Cliché Archival UX: Crafted a distinct visual language that honors library science standards (
$9 NecroMARC-AIsubfield provenance) while delivering an engaging resurrection workflow. - Live Real-World Ingestion: Judges can upload any authentic
.mrcfile from Internet Archive or the Library of Congress and watch it resurrect in real time.
What we learned
Combining deterministic domain standards (MARC 21 / ISO 2709) with generative AI requires strict guardrails: AI should never silently overwrite historical truth, which is why every inferred subfield carries explicit provenance tags and side-by-side terminal diffs.
What's next for NecroMARC — AI Bibliographic Resurrection
- Batch OAI-PMH & Z39.50 Harvesting: Direct harvesting from institutional library endpoints for large-scale catalog healing.
- Linked Data Authority Reconciliation: Automatic linking of
100/700author fields to VIAF and Wikidata URIs. - Human-in-the-Loop Librarian Review Queue: Collaborative approval workflows before pushing resurrected
.mrcbatches back to Integrated Library Systems (ILS).
Built With
- astro
- flask
- gemini
- json-ld
- marc21
- openrouter
- pgvector
- postgresql
- pymarc
- supabase
- tailwindcss
- typescript
