# ravidangi41/ru_zara_ai architecture

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

- Interactive diagram: https://gitdiagram.com/ravidangi41/ru_zara_ai
- Repository: https://github.com/ravidangi41/ru_zara_ai

## Overview

Ru Zara AI is a Python voice assistant whose primary flow is microphone speech recognition, command routing, and spoken responses. The command router provides weather, news, email, memory, and AI features; main.py also handles calculator, desktop actions, and a separate Gemini conversation path. The GUI starts that runtime, while memory persists to JSON. Evidence is limited to the README and supplied excerpts; the README names capabilities such as GUI and news, but unsampled modules and wiring are not assumed.

Main entry points: [`commands.py`](https://github.com/ravidangi41/ru_zara_ai/blob/main/commands.py) (Command router), [`main.py`](https://github.com/ravidangi41/ru_zara_ai/blob/main/main.py) (Voice loop), [`memory.py`](https://github.com/ravidangi41/ru_zara_ai/blob/main/memory.py) (Persistent memory), [`gui.py`](https://github.com/ravidangi41/ru_zara_ai/blob/main/gui.py) (Desktop GUI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_gui["Desktop GUI<br/>[gui.py]"]
end

subgraph group_runtime["Assistant runtime"]
  node_main["Voice loop<br/>[main.py]"]
  node_listen["Speech recognition<br/>[listen.py]"]
  node_speak["Speech output<br/>[speak.py]"]
  node_commands["Command router<br/>[commands.py]"]
end

subgraph group_features["Assistant features"]
  node_calculator["Calculator<br/>[calculator.py]"]
  node_memory["Persistent memory<br/>[memory.py]"]
  node_memory_store[("Memory JSON<br/>[memory.json]")]
  node_weather["Weather lookup<br/>[weather.py]"]
  node_news["News headlines<br/>[news.py]"]
  node_email["Email sender<br/>[email_sender.py]"]
  node_ai_chat["AI chat helper<br/>[ai_chat.py]"]
  node_contacts["Contact list<br/>[contacts.json]"]
end

subgraph group_integrations["External services"]
  node_gemini["Google Gemini"]
  node_weather_api["WeatherAPI"]
  node_news_api["NewsAPI"]
  node_speech_service["Google speech service"]
  node_smtp["Gmail SMTP"]
end

node_user(("User"))

node_user -->|"starts"| node_gui
node_gui -->|"starts thread"| node_main
node_main -->|"captures speech"| node_listen
node_listen -->|"recognizes audio"| node_speech_service
node_main -->|"routes command"| node_commands
node_main -->|"speaks response"| node_speak
node_commands -->|"speaks response"| node_speak
node_main -->|"calculates"| node_calculator
node_main -->|"reads or saves"| node_memory
node_commands -->|"reads or saves"| node_memory
node_memory -->|"reads and writes"| node_memory_store
node_commands -->|"fetches weather"| node_weather
node_weather -->|"requests conditions"| node_weather_api
node_commands -->|"fetches headlines"| node_news
node_news -->|"requests articles"| node_news_api
node_commands -->|"sends email"| node_email
node_email -->|"sends message"| node_smtp
node_commands -->|"asks question"| node_ai_chat
node_ai_chat -->|"generates response"| node_gemini
node_main -->|"generates response"| node_gemini
node_commands -->|"loads contacts"| node_contacts

click node_gui "https://github.com/ravidangi41/ru_zara_ai/blob/main/gui.py"
click node_main "https://github.com/ravidangi41/ru_zara_ai/blob/main/main.py"
click node_listen "https://github.com/ravidangi41/ru_zara_ai/blob/main/listen.py"
click node_speak "https://github.com/ravidangi41/ru_zara_ai/blob/main/speak.py"
click node_commands "https://github.com/ravidangi41/ru_zara_ai/blob/main/commands.py"
click node_calculator "https://github.com/ravidangi41/ru_zara_ai/blob/main/calculator.py"
click node_memory "https://github.com/ravidangi41/ru_zara_ai/blob/main/memory.py"
click node_memory_store "https://github.com/ravidangi41/ru_zara_ai/blob/main/memory.json"
click node_weather "https://github.com/ravidangi41/ru_zara_ai/blob/main/weather.py"
click node_news "https://github.com/ravidangi41/ru_zara_ai/blob/main/news.py"
click node_email "https://github.com/ravidangi41/ru_zara_ai/blob/main/email_sender.py"
click node_ai_chat "https://github.com/ravidangi41/ru_zara_ai/blob/main/ai_chat.py"
click node_contacts "https://github.com/ravidangi41/ru_zara_ai/blob/main/contacts.json"

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_gui,node_user toneBlue
class node_main,node_listen,node_speak,node_commands toneAmber
class node_calculator,node_memory,node_memory_store,node_weather,node_news,node_email,node_ai_chat,node_contacts toneMint
class node_gemini,node_weather_api,node_news_api,node_speech_service,node_smtp toneRose
```

## Components

### User interface

- [Desktop GUI](https://github.com/ravidangi41/ru_zara_ai/blob/main/gui.py): `gui.py`

### Assistant runtime

- [Voice loop](https://github.com/ravidangi41/ru_zara_ai/blob/main/main.py): `main.py`
- [Speech recognition](https://github.com/ravidangi41/ru_zara_ai/blob/main/listen.py): `listen.py`
- [Speech output](https://github.com/ravidangi41/ru_zara_ai/blob/main/speak.py): `speak.py`
- [Command router](https://github.com/ravidangi41/ru_zara_ai/blob/main/commands.py): `commands.py`

### Assistant features

- [Calculator](https://github.com/ravidangi41/ru_zara_ai/blob/main/calculator.py): `calculator.py`
- [Persistent memory](https://github.com/ravidangi41/ru_zara_ai/blob/main/memory.py): `memory.py`
- [Memory JSON](https://github.com/ravidangi41/ru_zara_ai/blob/main/memory.json): `memory.json`
- [Weather lookup](https://github.com/ravidangi41/ru_zara_ai/blob/main/weather.py): `weather.py`
- [News headlines](https://github.com/ravidangi41/ru_zara_ai/blob/main/news.py): `news.py`
- [Email sender](https://github.com/ravidangi41/ru_zara_ai/blob/main/email_sender.py): `email_sender.py`
- [AI chat helper](https://github.com/ravidangi41/ru_zara_ai/blob/main/ai_chat.py): `ai_chat.py`
- [Contact list](https://github.com/ravidangi41/ru_zara_ai/blob/main/contacts.json): `contacts.json`

### External services

- **Google Gemini**
- **WeatherAPI**
- **NewsAPI**
- **Google speech service**
- **Gmail SMTP**

### Other components

- **User**

## Connections

- User → Desktop GUI: starts (evidence: `README.md`)
- Desktop GUI → Voice loop: starts thread (evidence: `gui.py`)
- Voice loop → Speech recognition: captures speech (evidence: `main.py`)
- Speech recognition → Google speech service: recognizes audio (evidence: `listen.py`)
- Voice loop → Command router: routes command (evidence: `main.py`)
- Voice loop → Speech output: speaks response (evidence: `main.py`)
- Command router → Speech output: speaks response (evidence: `commands.py`)
- Voice loop → Calculator: calculates (evidence: `main.py`)
- Voice loop → Persistent memory: reads or saves (evidence: `main.py`)
- Command router → Persistent memory: reads or saves (evidence: `commands.py`)
- Persistent memory → Memory JSON: reads and writes (evidence: `memory.py`)
- Command router → Weather lookup: fetches weather (evidence: `commands.py`)
- Weather lookup → WeatherAPI: requests conditions (evidence: `weather.py`)
- Command router → News headlines: fetches headlines (evidence: `commands.py`)
- News headlines → NewsAPI: requests articles (evidence: `news.py`)
- Command router → Email sender: sends email (evidence: `commands.py`)
- Email sender → Gmail SMTP: sends message (evidence: `email_sender.py`)
- Command router → AI chat helper: asks question (evidence: `commands.py`)
- AI chat helper → Google Gemini: generates response (evidence: `ai_chat.py`)
- Voice loop → Google Gemini: generates response (evidence: `main.py`)
- Command router → Contact list: loads contacts (evidence: `commands.py`)
