# mickunaru/askthespire architecture

> Architecture diagram of the GitHub repository mickunaru/askthespire, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mickunaru/askthespire
- Repository: https://github.com/mickunaru/askthespire

## Overview

AskTheSpire is a Slay the Spire 2 wiki-grounded question-answering application. Users ask questions in the Streamlit UI, which invokes the RAG pipeline: optional query expansion, hybrid retrieval, and Claude answer generation with cited sources. Its corpus is built by scraping three documented sources, converting records into typed chunks, embedding them, and indexing them in Chroma. The README also documents RAGAS evaluation. The main stages and their documented links are shown; source-level detail is limited to the excerpts and reference index provided.

Main entry points: [`rag/pipeline.py`](https://github.com/mickunaru/askthespire/blob/main/rag/pipeline.py) (RAG Orchestrator), [`pipeline/chunker.py`](https://github.com/mickunaru/askthespire/blob/main/pipeline/chunker.py) (Typed Chunking), [`retrieval/retriever.py`](https://github.com/mickunaru/askthespire/blob/main/retrieval/retriever.py) (Hybrid Retrieval), [`pipeline/indexer.py`](https://github.com/mickunaru/askthespire/blob/main/pipeline/indexer.py) (Chroma Indexing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Corpus Ingest"]
  node_stratgg["StratGG Scraper<br/>[scrape_stratgg.py]"]
  node_wiki["STS2 Wiki Scraper<br/>[scrape_sts2wiki.py]"]
  node_patches["Patch Scraper<br/>[scrape_patches.py]"]
  node_chunker["Typed Chunking<br/>[chunker.py]"]
  node_metadata["Chunk Metadata<br/>[metadata.py]"]
end

subgraph group_index["Indexing"]
  node_embedder["Text Embeddings<br/>[embedder.py]"]
  node_indexer["Chroma Indexing<br/>[indexer.py]"]
  node_chroma[("Chroma Store")]
end

subgraph group_query["Question Answering"]
  node_ui["Streamlit UI<br/>[app.py]"]
  node_rag["RAG Orchestrator<br/>[pipeline.py]"]
  node_retriever["Hybrid Retrieval<br/>[retriever.py]"]
  node_reranker["Reranker Stub<br/>[reranker.py]"]
  node_prompt["Grounding Prompt<br/>[prompt.py]"]
  node_claude{{"Claude API"}}
end

subgraph group_evaluation["Evaluation"]
  node_evaluator["RAGAS Evaluation<br/>[run_ragas.py]"]
end

node_user(("Questioner"))
node_openai{{"OpenAI API"}}

node_stratgg -->|"supplies records"| node_chunker
node_wiki -->|"supplies records"| node_chunker
node_patches -->|"supplies records"| node_chunker
node_chunker -->|"creates chunk IDs"| node_metadata
node_chunker -->|"writes chunk corpus"| node_indexer
node_indexer -->|"embeds chunks"| node_embedder
node_embedder -->|"requests vectors"| node_openai
node_indexer -->|"upserts vectors"| node_chroma
node_user -->|"asks question"| node_ui
node_ui -->|"submits question"| node_rag
node_ui -->|"triggers reindex"| node_indexer
node_rag -->|"retrieves chunks"| node_retriever
node_retriever -->|"embeds query"| node_embedder
node_retriever -->|"dense search"| node_chroma
node_retriever -->|"ranks candidates"| node_reranker
node_rag -->|"builds context"| node_prompt
node_rag -->|"requests answer"| node_claude
node_rag -->|"expands query"| node_claude
node_evaluator -->|"evaluates answers"| node_rag
node_evaluator -->|"scores responses"| node_openai

click node_stratgg "https://github.com/mickunaru/askthespire/blob/main/scraper/scrape_stratgg.py"
click node_wiki "https://github.com/mickunaru/askthespire/blob/main/scraper/scrape_sts2wiki.py"
click node_patches "https://github.com/mickunaru/askthespire/blob/main/scraper/scrape_patches.py"
click node_chunker "https://github.com/mickunaru/askthespire/blob/main/pipeline/chunker.py"
click node_metadata "https://github.com/mickunaru/askthespire/blob/main/pipeline/metadata.py"
click node_embedder "https://github.com/mickunaru/askthespire/blob/main/pipeline/embedder.py"
click node_indexer "https://github.com/mickunaru/askthespire/blob/main/pipeline/indexer.py"
click node_ui "https://github.com/mickunaru/askthespire/blob/main/ui/app.py"
click node_rag "https://github.com/mickunaru/askthespire/blob/main/rag/pipeline.py"
click node_retriever "https://github.com/mickunaru/askthespire/blob/main/retrieval/retriever.py"
click node_reranker "https://github.com/mickunaru/askthespire/blob/main/retrieval/reranker.py"
click node_prompt "https://github.com/mickunaru/askthespire/blob/main/rag/prompt.py"
click node_evaluator "https://github.com/mickunaru/askthespire/blob/main/eval/run_ragas.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_stratgg,node_wiki,node_patches,node_chunker,node_metadata toneBlue
class node_embedder,node_indexer,node_chroma toneAmber
class node_ui,node_rag,node_retriever,node_reranker,node_prompt,node_claude,node_openai toneMint
class node_evaluator toneRose
class node_user toneIndigo
```

## Components

### Corpus Ingest

- [StratGG Scraper](https://github.com/mickunaru/askthespire/blob/main/scraper/scrape_stratgg.py): `scraper/scrape_stratgg.py`
- [STS2 Wiki Scraper](https://github.com/mickunaru/askthespire/blob/main/scraper/scrape_sts2wiki.py): `scraper/scrape_sts2wiki.py`
- [Patch Scraper](https://github.com/mickunaru/askthespire/blob/main/scraper/scrape_patches.py): `scraper/scrape_patches.py`
- [Typed Chunking](https://github.com/mickunaru/askthespire/blob/main/pipeline/chunker.py): `pipeline/chunker.py`
- [Chunk Metadata](https://github.com/mickunaru/askthespire/blob/main/pipeline/metadata.py): `pipeline/metadata.py`

### Indexing

- [Text Embeddings](https://github.com/mickunaru/askthespire/blob/main/pipeline/embedder.py): `pipeline/embedder.py`
- [Chroma Indexing](https://github.com/mickunaru/askthespire/blob/main/pipeline/indexer.py): `pipeline/indexer.py`
- **Chroma Store**

### Question Answering

- [Streamlit UI](https://github.com/mickunaru/askthespire/blob/main/ui/app.py): `ui/app.py`
- [RAG Orchestrator](https://github.com/mickunaru/askthespire/blob/main/rag/pipeline.py): `rag/pipeline.py`
- [Hybrid Retrieval](https://github.com/mickunaru/askthespire/blob/main/retrieval/retriever.py): `retrieval/retriever.py`
- [Reranker Stub](https://github.com/mickunaru/askthespire/blob/main/retrieval/reranker.py): `retrieval/reranker.py`
- [Grounding Prompt](https://github.com/mickunaru/askthespire/blob/main/rag/prompt.py): `rag/prompt.py`
- **Claude API**

### Evaluation

- [RAGAS Evaluation](https://github.com/mickunaru/askthespire/blob/main/eval/run_ragas.py): `eval/run_ragas.py`

### Other components

- **Questioner**
- **OpenAI API**

## Connections

- StratGG Scraper → Typed Chunking: supplies records (evidence: `README.md`)
- STS2 Wiki Scraper → Typed Chunking: supplies records (evidence: `README.md`)
- Patch Scraper → Typed Chunking: supplies records (evidence: `README.md`)
- Typed Chunking → Chunk Metadata: creates chunk IDs (evidence: `pipeline/chunker.py`)
- Typed Chunking → Chroma Indexing: writes chunk corpus (evidence: `README.md`)
- Chroma Indexing → Text Embeddings: embeds chunks (evidence: `pipeline/indexer.py`)
- Text Embeddings → OpenAI API: requests vectors (evidence: `pipeline/embedder.py`)
- Chroma Indexing → Chroma Store: upserts vectors (evidence: `pipeline/indexer.py`)
- Questioner → Streamlit UI: asks question (evidence: `README.md`)
- Streamlit UI → RAG Orchestrator: submits question (evidence: `ui/app.py`)
- Streamlit UI → Chroma Indexing: triggers reindex (evidence: `ui/app.py`)
- RAG Orchestrator → Hybrid Retrieval: retrieves chunks (evidence: `rag/pipeline.py`)
- Hybrid Retrieval → Text Embeddings: embeds query (evidence: `retrieval/retriever.py`)
- Hybrid Retrieval → Chroma Store: dense search (evidence: `retrieval/retriever.py`)
- Hybrid Retrieval → Reranker Stub: ranks candidates (evidence: `retrieval/retriever.py`)
- RAG Orchestrator → Grounding Prompt: builds context (evidence: `rag/pipeline.py`)
- RAG Orchestrator → Claude API: requests answer (evidence: `README.md`)
- RAG Orchestrator → Claude API: expands query (evidence: `rag/pipeline.py`)
- RAGAS Evaluation → RAG Orchestrator: evaluates answers (evidence: `eval/run_ragas.py`)
- RAGAS Evaluation → OpenAI API: scores responses (evidence: `eval/run_ragas.py`)
