# danish-khan-coder/python-jarwis architecture

> Architecture diagram of the GitHub repository danish-khan-coder/python-jarwis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danish-khan-coder/python-jarwis
- Repository: https://github.com/danish-khan-coder/python-jarwis

## Overview

Jarvis accepts commands through its wake-word voice loop or a separate text terminal, then routes them to command handling. That handler supports web search, YouTube playback, headlines, weather, chat reset, and general AI conversations; responses are spoken through a shared speech module. AI conversations retain history and try Gemini before Groq. Edges follow the sampled imports and calls or README capability statements; external service links documented but not directly shown in sampled callers are marked dashed.

Main entry points: [`ProcessCommands.py`](https://github.com/danish-khan-coder/python-jarwis/blob/main/ProcessCommands.py) (Command Router), [`main.py`](https://github.com/danish-khan-coder/python-jarwis/blob/main/main.py) (Voice Loop), [`Weather.py`](https://github.com/danish-khan-coder/python-jarwis/blob/main/Weather.py) (Weather Forecast), [`AI.py`](https://github.com/danish-khan-coder/python-jarwis/blob/main/AI.py) (AI Chat and Memory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Input and Output"]
  node_voice_loop["Voice Loop<br/>[main.py]"]
  node_text_terminal["Text Terminal<br/>[TextCommands.py]"]
  node_speech_output["Speech Output<br/>[Speak.py]"]
end

subgraph group_routing["Command Routing"]
  node_command_router["Command Router<br/>[ProcessCommands.py]"]
end

subgraph group_features["Assistant Features"]
  node_web_search["Web Search<br/>[ProcessCommands.py]"]
  node_youtube["YouTube Playback<br/>[ProcessCommands.py]"]
  node_news["News Headlines<br/>[news.py]"]
  node_weather["Weather Forecast<br/>[Weather.py]"]
  node_ai_chat["AI Chat and Memory<br/>[AI.py]"]
end

subgraph group_services["External Services"]
  node_speech_recognition["Speech Recognition"]
  node_browser["Web Browser"]
  node_youtube_service["YouTube"]
  node_news_feeds["News Feeds"]
  node_weather_api["WeatherAPI"]
  node_gemini["Gemini"]
  node_groq["Groq"]
end

node_user(("User"))

node_user -->|"speaks to"| node_voice_loop
node_user -->|"types into"| node_text_terminal
node_voice_loop -->|"transcribes audio"| node_speech_recognition
node_voice_loop -->|"dispatches command"| node_command_router
node_voice_loop -->|"opens terminal"| node_text_terminal
node_voice_loop -->|"speaks prompts"| node_speech_output
node_text_terminal -->|"dispatches command"| node_command_router
node_command_router -->|"speaks responses"| node_speech_output
node_command_router -->|"opens search"| node_web_search
node_web_search -.->|"opens pages"| node_browser
node_command_router -->|"starts playback"| node_youtube
node_youtube -->|"plays videos"| node_youtube_service
node_command_router -->|"fetches headlines"| node_news
node_news -->|"fetches RSS"| node_news_feeds
node_command_router -->|"requests forecast"| node_weather
node_weather -->|"requests conditions"| node_weather_api
node_weather -->|"speaks forecast"| node_speech_output
node_command_router -->|"asks or resets"| node_ai_chat
node_ai_chat -->|"tries response"| node_gemini
node_ai_chat -->|"falls back"| node_groq

click node_voice_loop "https://github.com/danish-khan-coder/python-jarwis/blob/main/main.py"
click node_text_terminal "https://github.com/danish-khan-coder/python-jarwis/blob/main/TextCommands.py"
click node_speech_output "https://github.com/danish-khan-coder/python-jarwis/blob/main/Speak.py"
click node_command_router "https://github.com/danish-khan-coder/python-jarwis/blob/main/ProcessCommands.py"
click node_web_search "https://github.com/danish-khan-coder/python-jarwis/blob/main/ProcessCommands.py"
click node_youtube "https://github.com/danish-khan-coder/python-jarwis/blob/main/ProcessCommands.py"
click node_news "https://github.com/danish-khan-coder/python-jarwis/blob/main/news.py"
click node_weather "https://github.com/danish-khan-coder/python-jarwis/blob/main/Weather.py"
click node_ai_chat "https://github.com/danish-khan-coder/python-jarwis/blob/main/AI.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_voice_loop,node_text_terminal,node_speech_output,node_user toneBlue
class node_command_router toneAmber
class node_web_search,node_youtube,node_news,node_weather,node_ai_chat toneMint
class node_speech_recognition,node_browser,node_youtube_service,node_news_feeds,node_weather_api,node_gemini,node_groq toneRose
```

## Components

### Input and Output

- [Voice Loop](https://github.com/danish-khan-coder/python-jarwis/blob/main/main.py): `main.py`
- [Text Terminal](https://github.com/danish-khan-coder/python-jarwis/blob/main/TextCommands.py): `TextCommands.py`
- [Speech Output](https://github.com/danish-khan-coder/python-jarwis/blob/main/Speak.py): `Speak.py`

### Command Routing

- [Command Router](https://github.com/danish-khan-coder/python-jarwis/blob/main/ProcessCommands.py): `ProcessCommands.py`

### Assistant Features

- [Web Search](https://github.com/danish-khan-coder/python-jarwis/blob/main/ProcessCommands.py): `ProcessCommands.py`
- [YouTube Playback](https://github.com/danish-khan-coder/python-jarwis/blob/main/ProcessCommands.py): `ProcessCommands.py`
- [News Headlines](https://github.com/danish-khan-coder/python-jarwis/blob/main/news.py): `news.py`
- [Weather Forecast](https://github.com/danish-khan-coder/python-jarwis/blob/main/Weather.py): `Weather.py`
- [AI Chat and Memory](https://github.com/danish-khan-coder/python-jarwis/blob/main/AI.py): `AI.py`

### External Services

- **Speech Recognition**
- **Web Browser**
- **YouTube**
- **News Feeds**
- **WeatherAPI**
- **Gemini**
- **Groq**

### Other components

- **User**

## Connections

- User → Voice Loop: speaks to (evidence: `README.md`)
- User → Text Terminal: types into (evidence: `README.md`)
- Voice Loop → Speech Recognition: transcribes audio (evidence: `main.py`)
- Voice Loop → Command Router: dispatches command (evidence: `main.py`)
- Voice Loop → Text Terminal: opens terminal (evidence: `main.py`)
- Voice Loop → Speech Output: speaks prompts (evidence: `main.py`)
- Text Terminal → Command Router: dispatches command (evidence: `TextCommands.py`)
- Command Router → Speech Output: speaks responses (evidence: `ProcessCommands.py`)
- Command Router → Web Search: opens search (evidence: `ProcessCommands.py`)
- Web Search → Web Browser: opens pages (evidence: `README.md`)
- Command Router → YouTube Playback: starts playback (evidence: `ProcessCommands.py`)
- YouTube Playback → YouTube: plays videos (evidence: `ProcessCommands.py`)
- Command Router → News Headlines: fetches headlines (evidence: `ProcessCommands.py`)
- News Headlines → News Feeds: fetches RSS (evidence: `news.py`)
- Command Router → Weather Forecast: requests forecast (evidence: `ProcessCommands.py`)
- Weather Forecast → WeatherAPI: requests conditions (evidence: `Weather.py`)
- Weather Forecast → Speech Output: speaks forecast (evidence: `Weather.py`)
- Command Router → AI Chat and Memory: asks or resets (evidence: `ProcessCommands.py`)
- AI Chat and Memory → Gemini: tries response (evidence: `AI.py`)
- AI Chat and Memory → Groq: falls back (evidence: `AI.py`)
