# danielsolomon007/g0dm0d3-ai architecture

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

- Interactive diagram: https://gitdiagram.com/danielsolomon007/g0dm0d3-ai
- Repository: https://github.com/danielsolomon007/g0dm0d3-ai

## Overview

G0DM0D3 is a privacy-oriented multi-model chat and red-teaming application, with a browser UI and an optional self-hosted API. The main user path is chat input through model selection/routing to a response, with AutoTune, Parseltongue, and STM transformations available in that flow; ULTRAPLINIAN separately races models and scores a winner. Settings and browser-persisted state support configuration and feedback learning. The API also exposes research-data collection and corpus access. The graph uses README claims and indexed references where excerpts are unavailable; those edges are limited to documented or visible relationships.

Main entry points: [`api/server.ts`](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/server.ts) (API server), [`src/components/ChatInput.tsx`](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/components/ChatInput.tsx) (Chat interface), [`src/components/SettingsModal.tsx`](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/components/SettingsModal.tsx) (Settings), [`api/routes/chat.ts`](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/chat.ts) (Chat endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser app"]
  node_page["App shell<br/>[page.tsx]"]
  node_chatui["Chat interface<br/>[ChatInput.tsx]"]
  node_settings["Settings<br/>[SettingsModal.tsx]"]
  node_state[("Local state<br/>[index.ts]")]
end

subgraph group_engines["Chat engines"]
  node_classify["Query classification<br/>[classify.ts]"]
  node_autotune["AutoTune<br/>[autotune.ts]"]
  node_feedback["Feedback learning"]
  node_parseltongue["Parseltongue<br/>[parseltongue.ts]"]
  node_stm["STM transforms<br/>[modules.ts]"]
  node_openrouter["OpenRouter client<br/>[openrouter.ts]"]
end

subgraph group_api["Optional API"]
  node_server["API server<br/>[server.ts]"]
  node_chatroute["Chat endpoint<br/>[chat.ts]"]
  node_autotuneroute["AutoTune endpoint<br/>[autotune.ts]"]
  node_ultraroute["ULTRAPLINIAN endpoint<br/>[ultraplinian.ts]"]
  node_ultraengine["Model race and scoring<br/>[ultraplinian.ts]"]
  node_tiers["Tier controls<br/>[tiers.ts]"]
  node_dataset_route["Dataset endpoint<br/>[dataset.ts]"]
end

subgraph group_research["Research data"]
  node_dataset[("Dataset buffer<br/>[dataset.ts]")]
  node_publisher["HuggingFace publisher<br/>[hf-publisher.ts]"]
  node_metadata[("Request metadata<br/>[metadata.ts]")]
  node_researchroute["Corpus research API<br/>[research.ts]"]
  node_reader["Corpus reader<br/>[hf-reader.ts]"]
end

node_user(("User"))
node_openrouter_service(("OpenRouter"))
node_huggingface[("HuggingFace dataset")]

node_user -->|"uses"| node_page
node_page -->|"renders"| node_chatui
node_page -->|"renders"| node_settings
node_chatui -->|"reads and updates"| node_state
node_settings -->|"configures"| node_state
node_chatui -->|"classifies query"| node_classify
node_chatui -->|"tunes parameters"| node_autotune
node_autotune -->|"applies learning"| node_feedback
node_settings -->|"configures"| node_autotune
node_settings -->|"manages feedback"| node_feedback
node_chatui -->|"transforms input"| node_parseltongue
node_settings -->|"configures"| node_parseltongue
node_chatui -->|"sends requests"| node_openrouter
node_openrouter -->|"calls"| node_openrouter_service
node_server -->|"mounts"| node_chatroute
node_server -->|"mounts"| node_autotuneroute
node_server -->|"mounts"| node_ultraroute
node_server -->|"mounts"| node_dataset_route
node_server -->|"mounts"| node_researchroute
node_chatroute -->|"uses"| node_autotune
node_chatroute -->|"uses"| node_parseltongue
node_chatroute -->|"uses"| node_stm
node_chatroute -->|"delegates to"| node_ultraengine
node_autotuneroute -->|"uses"| node_autotune
node_ultraroute -->|"delegates to"| node_ultraengine
node_ultraengine -->|"queries models"| node_openrouter_service
node_server -->|"configures access"| node_tiers
node_dataset_route -.->|"accesses"| node_dataset
node_dataset -->|"publishes batches"| node_publisher
node_metadata -->|"registers buffer"| node_publisher
node_researchroute -->|"queries corpus"| node_reader
node_researchroute -->|"reads stats"| node_dataset
node_researchroute -->|"reads stats"| node_metadata
node_reader -.->|"reads batches"| node_huggingface
node_publisher -.->|"publishes"| node_huggingface

click node_page "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/app/page.tsx"
click node_chatui "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/components/ChatInput.tsx"
click node_settings "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/components/SettingsModal.tsx"
click node_state "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/store/index.ts"
click node_classify "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/classify.ts"
click node_autotune "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/autotune.ts"
click node_feedback "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/autotune-feedback.ts"
click node_parseltongue "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/parseltongue.ts"
click node_stm "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/stm/modules.ts"
click node_openrouter "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/openrouter.ts"
click node_server "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/server.ts"
click node_chatroute "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/chat.ts"
click node_autotuneroute "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/autotune.ts"
click node_ultraroute "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/ultraplinian.ts"
click node_ultraengine "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/ultraplinian.ts"
click node_tiers "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/tiers.ts"
click node_dataset_route "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/dataset.ts"
click node_dataset "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/dataset.ts"
click node_publisher "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/hf-publisher.ts"
click node_metadata "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/metadata.ts"
click node_researchroute "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/research.ts"
click node_reader "https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/hf-reader.ts"

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_page,node_chatui,node_settings,node_state,node_user toneBlue
class node_classify,node_autotune,node_feedback,node_parseltongue,node_stm,node_openrouter,node_huggingface toneAmber
class node_server,node_chatroute,node_autotuneroute,node_ultraroute,node_ultraengine,node_tiers,node_dataset_route,node_openrouter_service toneMint
class node_dataset,node_publisher,node_metadata,node_researchroute,node_reader toneRose
```

## Components

### Browser app

- [App shell](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Chat interface](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/components/ChatInput.tsx): `src/components/ChatInput.tsx`
- [Settings](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/components/SettingsModal.tsx): `src/components/SettingsModal.tsx`
- [Local state](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/store/index.ts): `src/store/index.ts`

### Chat engines

- [Query classification](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/classify.ts): `src/lib/classify.ts`
- [AutoTune](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/autotune.ts): `src/lib/autotune.ts`
- [Feedback learning](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/autotune-feedback.ts): `src/lib/autotune-feedback.ts`
- [Parseltongue](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/parseltongue.ts): `src/lib/parseltongue.ts`
- [STM transforms](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/stm/modules.ts): `src/stm/modules.ts`
- [OpenRouter client](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/src/lib/openrouter.ts): `src/lib/openrouter.ts`

### Optional API

- [API server](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/server.ts): `api/server.ts`
- [Chat endpoint](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/chat.ts): `api/routes/chat.ts`
- [AutoTune endpoint](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/autotune.ts): `api/routes/autotune.ts`
- [ULTRAPLINIAN endpoint](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/ultraplinian.ts): `api/routes/ultraplinian.ts`
- [Model race and scoring](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/ultraplinian.ts): `api/lib/ultraplinian.ts`
- [Tier controls](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/tiers.ts): `api/lib/tiers.ts`
- [Dataset endpoint](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/dataset.ts): `api/routes/dataset.ts`

### Research data

- [Dataset buffer](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/dataset.ts): `api/lib/dataset.ts`
- [HuggingFace publisher](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/hf-publisher.ts): `api/lib/hf-publisher.ts`
- [Request metadata](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/metadata.ts): `api/lib/metadata.ts`
- [Corpus research API](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/routes/research.ts): `api/routes/research.ts`
- [Corpus reader](https://github.com/danielsolomon007/g0dm0d3-ai/blob/main/api/lib/hf-reader.ts): `api/lib/hf-reader.ts`

### Other components

- **User**
- **OpenRouter**
- **HuggingFace dataset**

## Connections

- User → App shell: uses (evidence: `src/app/page.tsx`)
- App shell → Chat interface: renders (evidence: `src/app/page.tsx`)
- App shell → Settings: renders (evidence: `src/app/page.tsx`)
- Chat interface → Local state: reads and updates (evidence: `src/components/ChatInput.tsx`)
- Settings → Local state: configures (evidence: `src/components/SettingsModal.tsx`)
- Chat interface → Query classification: classifies query (evidence: `src/components/ChatInput.tsx`)
- Chat interface → AutoTune: tunes parameters (evidence: `src/components/ChatInput.tsx`)
- AutoTune → Feedback learning: applies learning (evidence: `src/lib/autotune.ts`)
- Settings → AutoTune: configures (evidence: `src/components/SettingsModal.tsx`)
- Settings → Feedback learning: manages feedback (evidence: `src/components/SettingsModal.tsx`)
- Chat interface → Parseltongue: transforms input (evidence: `src/components/ChatInput.tsx`)
- Settings → Parseltongue: configures (evidence: `src/components/SettingsModal.tsx`)
- Chat interface → OpenRouter client: sends requests (evidence: `src/components/ChatInput.tsx`)
- OpenRouter client → OpenRouter: calls (evidence: `src/lib/openrouter.ts`)
- API server → Chat endpoint: mounts (evidence: `api/server.ts`)
- API server → AutoTune endpoint: mounts (evidence: `api/server.ts`)
- API server → ULTRAPLINIAN endpoint: mounts (evidence: `api/server.ts`)
- API server → Dataset endpoint: mounts (evidence: `api/server.ts`)
- API server → Corpus research API: mounts (evidence: `api/server.ts`)
- Chat endpoint → AutoTune: uses (evidence: `api/routes/chat.ts`)
- Chat endpoint → Parseltongue: uses (evidence: `api/routes/chat.ts`)
- Chat endpoint → STM transforms: uses (evidence: `api/routes/chat.ts`)
- Chat endpoint → Model race and scoring: delegates to (evidence: `api/routes/chat.ts`)
- AutoTune endpoint → AutoTune: uses (evidence: `api/routes/autotune.ts`)
- ULTRAPLINIAN endpoint → Model race and scoring: delegates to (evidence: `api/routes/ultraplinian.ts`)
- Model race and scoring → OpenRouter: queries models (evidence: `api/lib/ultraplinian.ts`)
- API server → Tier controls: configures access (evidence: `api/server.ts`)
- Dataset endpoint → Dataset buffer: accesses
- Dataset buffer → HuggingFace publisher: publishes batches (evidence: `api/lib/dataset.ts`)
- Request metadata → HuggingFace publisher: registers buffer (evidence: `api/lib/metadata.ts`)
- Corpus research API → Corpus reader: queries corpus (evidence: `api/routes/research.ts`)
- Corpus research API → Dataset buffer: reads stats (evidence: `api/routes/research.ts`)
- Corpus research API → Request metadata: reads stats (evidence: `api/routes/research.ts`)
- Corpus reader → HuggingFace dataset: reads batches
- HuggingFace publisher → HuggingFace dataset: publishes
