Schema Archaeology: How to Use AI to Reverse-Engineer Business Meaning From an Undocumented… A developer built a pipeline called Schema Archaeology that uses AI to reverse-engineer business meaning from undocumented purchase-to-pay databases, transforming them into a human-ready RAG application with a Streamlit interface. The system crawls SQLite databases to learn relationships and domain terms, enabling accurate financial querying without documentation. The approach reduces hallucination risk in AI-driven finance analysis by combining SQL pre-filtering with vector search and caching system messages for 90% cost reduction. This will be a two part spectacular, in this part we will cover the core files of the application: ├── seed db.py → p2p.db seed realistic data + anomalies├── schema agent.py → schema context.json semantic layer via Claude├── rag pipeline.py → interactive Q&A hybrid RAG SQL + ChromaDB ├── app.py → Streamlit UI chat interface In the second article we will cover accessory and helper functions: ├── context packer.py → LLM-ready string token-budget context assembly├── anomaly agent.py → anomaly report.json 8 SQL integrity rules├── cache report.py → logs/cache usage.log token + cost tracking└── logger.py → logs/