# thedatastation/pneuma architecture

> Architecture diagram of the GitHub repository thedatastation/pneuma, 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/thedatastation/pneuma
- Repository: https://github.com/thedatastation/pneuma

## Overview

Pneuma is an LLM-powered tabular-data discovery system. Its principal workflow registers tables and optional metadata, summarizes table content, builds searchable indexes, then accepts a natural-language query and returns relevant tables. The graph shows the public façade, distinct preparation and retrieval stages, and the DuckDB and search-index state they use. The README documents the end-to-end sequence; sampled source confirms façade delegation and core implementation responsibilities. Some internal query and storage wiring is only partially excerpted, so uncertain links are omitted.

Main entry points: [`src/pneuma/pneuma.py`](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/pneuma.py) (Pneuma API), [`src/pneuma/query_processor/query_processor.py`](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/query_processor/query_processor.py) (Query processor), [`src/pneuma/index_generator/index_generator.py`](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/index_generator/index_generator.py) (Index generator), [`src/pneuma/utils/prompting_interface.py`](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/utils/prompting_interface.py) (Model prompting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["User workflow"]
  node_api["Pneuma API<br/>[pneuma.py]"]
end

subgraph group_preparation["Data preparation"]
  node_registrar["Table registrar<br/>[registrar.py]"]
  node_summarizer["Table summarizer<br/>[summarizer.py]"]
  node_database[("Pneuma database<br/>[registrar.py]")]
end

subgraph group_retrieval["Search and retrieval"]
  node_indexer["Index generator<br/>[index_generator.py]"]
  node_query["Query processor<br/>[query_processor.py]"]
  node_vector[("Vector index<br/>[index_generator.py]")]
  node_fulltext[("Full-text index<br/>[index_generator.py]")]
end

subgraph group_runtime["Shared runtime"]
  node_prompting["Model prompting"]
  node_pipeline["Pipeline setup"]
  node_response["Response formatting<br/>[response.py]"]
end

node_user(("Data user"))
node_model{{"LLM and embedder"}}
node_table_source["Table files"]
node_metadata_source["Metadata file"]

node_user -->|"calls"| node_api
node_table_source -->|"registers tables"| node_registrar
node_metadata_source -->|"adds metadata"| node_registrar
node_api -->|"delegates registration"| node_registrar
node_registrar -->|"writes table data"| node_database
node_api -->|"requests summaries"| node_summarizer
node_summarizer -->|"reads tables; writes summaries"| node_database
node_api -->|"generates index"| node_indexer
node_indexer -->|"reads summaries and context"| node_database
node_indexer -->|"writes embeddings"| node_vector
node_indexer -->|"writes token index"| node_fulltext
node_user -->|"submits query"| node_api
node_api -->|"delegates query"| node_query
node_query -->|"retrieves candidates"| node_vector
node_query -->|"retrieves candidates"| node_fulltext
node_query -->|"reranks candidates"| node_prompting
node_prompting -->|"prompts model"| node_model
node_summarizer -->|"prompts model"| node_prompting
node_indexer -->|"embeds summaries"| node_model
node_query -->|"embeds queries"| node_model
node_prompting -->|"initializes local model"| node_pipeline
node_query -->|"formats result"| node_response
node_api -->|"returns operation status"| node_response

click node_api "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/pneuma.py"
click node_registrar "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/registrar/registrar.py"
click node_summarizer "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/summarizer/summarizer.py"
click node_indexer "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/index_generator/index_generator.py"
click node_query "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/query_processor/query_processor.py"
click node_database "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/registrar/registrar.py"
click node_vector "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/index_generator/index_generator.py"
click node_fulltext "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/index_generator/index_generator.py"
click node_prompting "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/utils/prompting_interface.py"
click node_pipeline "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/utils/pipeline_initializer.py"
click node_response "https://github.com/thedatastation/pneuma/blob/main/src/pneuma/utils/response.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_api,node_user toneBlue
class node_registrar,node_summarizer,node_database toneAmber
class node_indexer,node_query,node_vector,node_fulltext toneMint
class node_prompting,node_pipeline,node_response toneRose
class node_model,node_table_source,node_metadata_source toneIndigo
```

## Components

### User workflow

- [Pneuma API](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/pneuma.py): `src/pneuma/pneuma.py`

### Data preparation

- [Table registrar](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/registrar/registrar.py): `src/pneuma/registrar/registrar.py`
- [Table summarizer](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/summarizer/summarizer.py): `src/pneuma/summarizer/summarizer.py`
- [Pneuma database](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/registrar/registrar.py): `src/pneuma/registrar/registrar.py`

### Search and retrieval

- [Index generator](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/index_generator/index_generator.py): `src/pneuma/index_generator/index_generator.py`
- [Query processor](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/query_processor/query_processor.py): `src/pneuma/query_processor/query_processor.py`
- [Vector index](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/index_generator/index_generator.py): `src/pneuma/index_generator/index_generator.py`
- [Full-text index](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/index_generator/index_generator.py): `src/pneuma/index_generator/index_generator.py`

### Shared runtime

- [Model prompting](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/utils/prompting_interface.py): `src/pneuma/utils/prompting_interface.py`
- [Pipeline setup](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/utils/pipeline_initializer.py): `src/pneuma/utils/pipeline_initializer.py`
- [Response formatting](https://github.com/thedatastation/pneuma/blob/main/src/pneuma/utils/response.py): `src/pneuma/utils/response.py`

### Other components

- **Data user**
- **LLM and embedder**
- **Table files**
- **Metadata file**

## Connections

- Data user → Pneuma API: calls (evidence: `README.md`)
- Table files → Table registrar: registers tables (evidence: `README.md`)
- Metadata file → Table registrar: adds metadata (evidence: `README.md`)
- Pneuma API → Table registrar: delegates registration (evidence: `src/pneuma/pneuma.py`)
- Table registrar → Pneuma database: writes table data (evidence: `src/pneuma/registrar/registrar.py`)
- Pneuma API → Table summarizer: requests summaries (evidence: `src/pneuma/pneuma.py`)
- Table summarizer → Pneuma database: reads tables; writes summaries (evidence: `src/pneuma/summarizer/summarizer.py`)
- Pneuma API → Index generator: generates index (evidence: `src/pneuma/pneuma.py`)
- Index generator → Pneuma database: reads summaries and context (evidence: `src/pneuma/index_generator/index_generator.py`)
- Index generator → Vector index: writes embeddings (evidence: `src/pneuma/index_generator/index_generator.py`)
- Index generator → Full-text index: writes token index (evidence: `src/pneuma/index_generator/index_generator.py`)
- Data user → Pneuma API: submits query (evidence: `README.md`)
- Pneuma API → Query processor: delegates query (evidence: `src/pneuma/pneuma.py`)
- Query processor → Vector index: retrieves candidates (evidence: `src/pneuma/query_processor/query_processor.py`)
- Query processor → Full-text index: retrieves candidates (evidence: `src/pneuma/query_processor/query_processor.py`)
- Query processor → Model prompting: reranks candidates (evidence: `src/pneuma/query_processor/query_processor.py`)
- Model prompting → LLM and embedder: prompts model (evidence: `src/pneuma/utils/prompting_interface.py`)
- Table summarizer → Model prompting: prompts model (evidence: `src/pneuma/summarizer/summarizer.py`)
- Index generator → LLM and embedder: embeds summaries (evidence: `src/pneuma/index_generator/index_generator.py`)
- Query processor → LLM and embedder: embeds queries (evidence: `src/pneuma/query_processor/query_processor.py`)
- Model prompting → Pipeline setup: initializes local model (evidence: `src/pneuma/utils/prompting_interface.py`)
- Query processor → Response formatting: formats result (evidence: `src/pneuma/query_processor/query_processor.py`)
- Pneuma API → Response formatting: returns operation status (evidence: `src/pneuma/pneuma.py`)
