# georgiebognalbal/mystiquerouter architecture

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

- Interactive diagram: https://gitdiagram.com/georgiebognalbal/mystiquerouter
- Repository: https://github.com/georgiebognalbal/mystiquerouter

## Overview

Mystique is a terminal-based multi-AI assistant. A user prompt enters the main loop, is added to conversation history, and is routed by `src/router.py`: Groq classifies the latest prompt, the router formats history and tries category-specific providers in order, and the response is displayed and saved. The README also describes memory, provider fallback, and terminal customization; these are represented alongside the primary workflow. Relationships reflect the sampled source and README; external provider calls are shown where client code makes them.

Main entry points: [`main.py`](https://github.com/georgiebognalbal/mystiquerouter/blob/master/main.py) (Interactive loop), [`src/router.py`](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/router.py) (Category router), [`src/Memory/memoryManager.py`](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Memory/memoryManager.py) (Memory manager), [`src/Providers/groq_client.py`](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/groq_client.py) (Groq client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Terminal interface"]
  node_main["Interactive loop<br/>[main.py]"]
  node_terminal["Thinking indicator<br/>[terminal.py]"]
  node_display["Response display"]
end

subgraph group_orchestration["Request orchestration"]
  node_router["Category router<br/>[router.py]"]
  node_formatter["Message formatter<br/>[Formatter.py]"]
end

subgraph group_memory["Conversation memory"]
  node_memory_manager["Memory manager<br/>[memoryManager.py]"]
  node_memory_file[("Conversation file<br/>[temp.json]")]
end

subgraph group_providers["AI providers"]
  node_groq["Groq client<br/>[groq_client.py]"]
  node_openai["OpenAI client<br/>[openai_client.py]"]
  node_gemini["Gemini client<br/>[gemini_client.py]"]
  node_openrouter["OpenRouter client"]
end

node_user(("User"))
node_groq_service{{"Groq API"}}
node_openai_service{{"OpenAI API"}}
node_gemini_service{{"Gemini API"}}
node_openrouter_service{{"OpenRouter API"}}

node_user -->|"enters prompt"| node_main
node_main -->|"loads history"| node_memory_manager
node_memory_manager -->|"reads or writes"| node_memory_file
node_main -->|"starts indicator"| node_terminal
node_main -->|"routes history"| node_router
node_router -->|"classifies prompt"| node_groq
node_router -->|"formats history"| node_formatter
node_router -->|"tries provider"| node_groq
node_router -->|"tries provider"| node_openai
node_router -->|"tries provider"| node_gemini
node_router -->|"tries provider"| node_openrouter
node_groq -->|"sends requests"| node_groq_service
node_openai -->|"sends requests"| node_openai_service
node_gemini -->|"sends requests"| node_gemini_service
node_openrouter -->|"sends requests"| node_openrouter_service
node_main -->|"shows response"| node_display
node_main -->|"saves history"| node_memory_manager
node_main -->|"presents answer"| node_user

click node_main "https://github.com/georgiebognalbal/mystiquerouter/blob/master/main.py"
click node_terminal "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Utils/terminal.py"
click node_display "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Utils/responseFormatter.py"
click node_router "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/router.py"
click node_formatter "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Memory/Formatter.py"
click node_memory_manager "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Memory/memoryManager.py"
click node_memory_file "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Memory/temp.json"
click node_groq "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/groq_client.py"
click node_openai "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/openai_client.py"
click node_gemini "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/gemini_client.py"
click node_openrouter "https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/openrouter_client.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_main,node_terminal,node_display,node_user toneBlue
class node_router,node_formatter toneAmber
class node_memory_manager,node_memory_file,node_groq_service,node_openai_service,node_gemini_service,node_openrouter_service toneMint
class node_groq,node_openai,node_gemini,node_openrouter toneRose
```

## Components

### Terminal interface

- [Interactive loop](https://github.com/georgiebognalbal/mystiquerouter/blob/master/main.py): `main.py`
- [Thinking indicator](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Utils/terminal.py): `src/Utils/terminal.py`
- [Response display](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Utils/responseFormatter.py): `src/Utils/responseFormatter.py`

### Request orchestration

- [Category router](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/router.py): `src/router.py`
- [Message formatter](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Memory/Formatter.py): `src/Memory/Formatter.py`

### Conversation memory

- [Memory manager](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Memory/memoryManager.py): `src/Memory/memoryManager.py`
- [Conversation file](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Memory/temp.json): `src/Memory/temp.json`

### AI providers

- [Groq client](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/groq_client.py): `src/Providers/groq_client.py`
- [OpenAI client](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/openai_client.py): `src/Providers/openai_client.py`
- [Gemini client](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/gemini_client.py): `src/Providers/gemini_client.py`
- [OpenRouter client](https://github.com/georgiebognalbal/mystiquerouter/blob/master/src/Providers/openrouter_client.py): `src/Providers/openrouter_client.py`

### Other components

- **User**
- **Groq API**
- **OpenAI API**
- **Gemini API**
- **OpenRouter API**

## Connections

- User → Interactive loop: enters prompt (evidence: `main.py`)
- Interactive loop → Memory manager: loads history (evidence: `main.py`)
- Memory manager → Conversation file: reads or writes (evidence: `src/Memory/memoryManager.py`)
- Interactive loop → Thinking indicator: starts indicator (evidence: `main.py`)
- Interactive loop → Category router: routes history (evidence: `main.py`)
- Category router → Groq client: classifies prompt (evidence: `src/router.py`)
- Category router → Message formatter: formats history (evidence: `src/router.py`)
- Category router → Groq client: tries provider (evidence: `src/router.py`)
- Category router → OpenAI client: tries provider (evidence: `src/router.py`)
- Category router → Gemini client: tries provider (evidence: `src/router.py`)
- Category router → OpenRouter client: tries provider (evidence: `src/router.py`)
- Groq client → Groq API: sends requests (evidence: `src/Providers/groq_client.py`)
- OpenAI client → OpenAI API: sends requests (evidence: `src/Providers/openai_client.py`)
- Gemini client → Gemini API: sends requests (evidence: `src/Providers/gemini_client.py`)
- OpenRouter client → OpenRouter API: sends requests (evidence: `src/Providers/openrouter_client.py`)
- Interactive loop → Response display: shows response (evidence: `main.py`)
- Interactive loop → Memory manager: saves history (evidence: `main.py`)
- Interactive loop → User: presents answer (evidence: `main.py`)
