# adilmunawar/jarvis architecture

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

- Interactive diagram: https://gitdiagram.com/adilmunawar/jarvis
- Repository: https://github.com/adilmunawar/jarvis

## Overview

1. **Overall shape**
   This is a Python-based personal assistant/JARVIS-style automation system. The repository is organized around a central “brain” that routes user commands into specialized modules for speech, automation, web tasks, vision, and utility features.

2. **Primary entry points**
   `jarvis.py` appears to be the main runtime entry point described in the README. Supporting top-level scripts like `ui.py`, `demo.py`, and `co_brain.py` likely provide alternate frontends, demos, or coordination logic around the core assistant loop.

3. **Core command-routing layer**
   The `Brain/brain.py`, `Automation/Automation_Brain.py`, `Time_Operations/brain.py`, and `Vision/MVbrain.py` / `Vision/Vbrain.py` files suggest a multi-brain architecture: one central orchestration layer plus domain-specific routers. These components likely classify commands and dispatch them to the correct subsystem instead of keeping all logic in one place.

4. **Speech input and speech output**
   Voice interaction is a first-class path. `NetHyTechSTT/listen.py` handles speech-to-text input, while `TextToSpeech/Fast_DF_TTS.py` provides text-to-speech output. The presence of files like `speech_output.txt`, `input.txt`, and conversation-history logs indicates the assistant also persists spoken/text exchanges for debugging or context.

5. **Task automation subsystem**
   The `Automation/` package is the main action layer for controlling the machine and browser. It includes modules for opening apps, tab automation, scrolling, battery checks, YouTube playback, Spotify playback, web opening, and web data fetching. This is the boundary where abstract commands become OS/browser actions.

6. **Feature/utility modules**
   `Features/` contains small capability-focused helpers such as volume control, microphone/speaker health checks, battery percentage, IP lookup, jokes, advice, clap detection, and file creation. These are likely invoked by the brain when a command matches a narrow utility task.

7. **Web and online integrations**
   Several folders point to external-service driven features: `Real_Time/` for Google search flows, `Weather_Check/check_weather.py` for weather, and `Whatsapp_automation/wa.py` for WhatsApp automation. `Automation/Play_Music_YT.py`, `Automation/Youtube_play_back.py`, and Spotify-related code show direct dependence on online media platforms.

8. **Scheduling and time-based behavior**
   `Time_Operations/` and `schedule.txt` indicate reminder/alarm/scheduler support. `Time_Operations/throw_alert.py` likely triggers notifications or alerts based on parsed times, while this subsystem handles deferred actions rather than immediate commands.

9. **Vision and image generation**
   The `Vision/` package suggests optional camera/image-based features, separate from voice. `TextToImage/gen_image.py` indicates the assistant can also generate images from text, which is a distinct capability path from command automation.

10. **Data and context persistence**
   `Data/DLG_Data.py`, `Alam_data.txt`, `chat_hystory.txt`, `conv_history.txt`, `history.txt`, and `log.txt` show local data storage for dialogue, alarms, and logs. This repo appears to rely on flat files rather than a database for conversation state and lightweight memory.

11. **External tooling and platform coupling**
   `chromedriver.exe` makes browser automation a concrete dependency, likely for Selenium-style control of Chrome. `requirements.txt` and `setup.py` define the Python environment, so the architecture is strongly tied to local desktop execution rather than a cloud service.

12. **Likely runtime flow**
   The expected flow is: user speaks or types a command → STT/input layer captures it → the brain/router identifies intent → a specialized module performs the action (system, web, media, reminder, vision, etc.) → TTS or UI returns the result. The repo is therefore best understood as a local, modular desktop assistant with several service-specific adapters behind one command interface.

Main entry points: [`Brain/brain.py`](https://github.com/adilmunawar/jarvis/blob/main/Brain/brain.py) (Brain), [`Automation/Automation_Brain.py`](https://github.com/adilmunawar/jarvis/blob/main/Automation/Automation_Brain.py) (Automation brain), [`jarvis.py`](https://github.com/adilmunawar/jarvis/blob/main/jarvis.py) (jarvis.py), [`Time_Operations/brain.py`](https://github.com/adilmunawar/jarvis/blob/main/Time_Operations/brain.py) (Time brain)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Interfaces"]
  node_jarvis_py["jarvis.py<br/>entrypoint<br/>[jarvis.py]"]
  node_ui_py["ui.py<br/>ui frontend<br/>[ui.py]"]
  node_demo_py["demo.py<br/>demo runner<br/>[demo.py]"]
  node_stt["Speech input<br/>stt<br/>[listen.py]"]
  node_tts["Speech output<br/>tts<br/>[Fast_DF_TTS.py]"]
end

subgraph group_core["Core Brain"]
  node_brain{{"Brain<br/>router<br/>[brain.py]"}}
  node_co_brain{{"Co-brain<br/>coordination<br/>[co_brain.py]"}}
  node_automation_brain{{"Automation brain<br/>router"}}
  node_time_brain{{"Time brain<br/>scheduler router<br/>[brain.py]"}}
  node_vision_brain{{"Vision brain<br/>vision router<br/>[Vbrain.py]"}}
  node_mv_brain{{"MV brain<br/>vision router<br/>[MVbrain.py]"}}
end

subgraph group_actions["Actions"]
  node_system_actions["System actions<br/>os control<br/>[open_App.py]"]
  node_browser_actions["Browser actions<br/>browser control<br/>[tab_automation.py]"]
  node_media_actions["Media actions<br/>media control<br/>[Play_Music_YT.py]"]
  node_utility_features["Utilities<br/>feature helpers<br/>[get_jokes.py]"]
end

subgraph group_integrations["Online Integrations"]
  node_web_integrations["Web services<br/>online features<br/>[google_big.py]"]
  node_image_gen["Image gen<br/>image synthesis<br/>[gen_image.py]"]
  node_alerting["Alerts<br/>scheduler output<br/>[throw_alert.py]"]
end

subgraph group_state["State & Data"]
  node_dlg_data[("Dialogue data<br/>conversation store<br/>[DLG_Data.py]")]
  node_flat_logs["Flat files<br/>local memory<br/>[chat_hystory.txt]"]
  node_deps["Runtime deps<br/>environment<br/>[requirements.txt]"]
end

node_jarvis_py -->|"capture input"| node_stt
node_jarvis_py -->|"route"| node_brain
node_ui_py -->|"send command"| node_brain
node_demo_py -.->|"exercise"| node_brain
node_brain -->|"dispatch"| node_automation_brain
node_brain -->|"dispatch"| node_time_brain
node_brain -->|"dispatch"| node_vision_brain
node_brain -.->|"coordinate"| node_co_brain
node_automation_brain -->|"control"| node_system_actions
node_automation_brain -->|"browse"| node_browser_actions
node_automation_brain -->|"play media"| node_media_actions
node_automation_brain -.->|"invoke"| node_utility_features
node_brain -->|"query"| node_web_integrations
node_brain -->|"generate"| node_image_gen
node_time_brain -->|"schedule"| node_alerting
node_vision_brain -.->|"delegate"| node_mv_brain
node_jarvis_py -->|"respond"| node_tts
node_brain -.->|"store context"| node_dlg_data
node_brain -.->|"persist"| node_flat_logs
node_automation_brain -.->|"depends on"| node_deps

click node_jarvis_py "https://github.com/adilmunawar/jarvis/blob/main/jarvis.py"
click node_ui_py "https://github.com/adilmunawar/jarvis/blob/main/ui.py"
click node_demo_py "https://github.com/adilmunawar/jarvis/blob/main/demo.py"
click node_stt "https://github.com/adilmunawar/jarvis/blob/main/NetHyTechSTT/listen.py"
click node_tts "https://github.com/adilmunawar/jarvis/blob/main/TextToSpeech/Fast_DF_TTS.py"
click node_brain "https://github.com/adilmunawar/jarvis/blob/main/Brain/brain.py"
click node_co_brain "https://github.com/adilmunawar/jarvis/blob/main/co_brain.py"
click node_automation_brain "https://github.com/adilmunawar/jarvis/blob/main/Automation/Automation_Brain.py"
click node_time_brain "https://github.com/adilmunawar/jarvis/blob/main/Time_Operations/brain.py"
click node_vision_brain "https://github.com/adilmunawar/jarvis/blob/main/Vision/Vbrain.py"
click node_mv_brain "https://github.com/adilmunawar/jarvis/blob/main/Vision/MVbrain.py"
click node_system_actions "https://github.com/adilmunawar/jarvis/blob/main/Automation/open_App.py"
click node_browser_actions "https://github.com/adilmunawar/jarvis/blob/main/Automation/tab_automation.py"
click node_media_actions "https://github.com/adilmunawar/jarvis/blob/main/Automation/Play_Music_YT.py"
click node_utility_features "https://github.com/adilmunawar/jarvis/blob/main/Features/get_jokes.py"
click node_web_integrations "https://github.com/adilmunawar/jarvis/blob/main/Real_Time/google_big.py"
click node_image_gen "https://github.com/adilmunawar/jarvis/blob/main/TextToImage/gen_image.py"
click node_alerting "https://github.com/adilmunawar/jarvis/blob/main/Time_Operations/throw_alert.py"
click node_dlg_data "https://github.com/adilmunawar/jarvis/blob/main/Data/DLG_Data.py"
click node_flat_logs "https://github.com/adilmunawar/jarvis/blob/main/chat_hystory.txt"
click node_deps "https://github.com/adilmunawar/jarvis/blob/main/requirements.txt"

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_jarvis_py,node_ui_py,node_demo_py,node_stt,node_tts toneBlue
class node_brain,node_co_brain,node_automation_brain,node_time_brain,node_vision_brain,node_mv_brain toneAmber
class node_system_actions,node_browser_actions,node_media_actions,node_utility_features toneMint
class node_web_integrations,node_image_gen,node_alerting toneRose
class node_dlg_data,node_flat_logs,node_deps toneIndigo
```

## Components

### Interfaces

Ways users enter commands and receive responses

- [jarvis.py](https://github.com/adilmunawar/jarvis/blob/main/jarvis.py): entrypoint · Main assistant runtime · `jarvis.py`
- [ui.py](https://github.com/adilmunawar/jarvis/blob/main/ui.py): ui frontend · Alternate user interface · `ui.py`
- [demo.py](https://github.com/adilmunawar/jarvis/blob/main/demo.py): demo runner · Showcase or test run · `demo.py`
- [Speech input](https://github.com/adilmunawar/jarvis/blob/main/NetHyTechSTT/listen.py): stt · Speech-to-text command capture · `NetHyTechSTT/listen.py`
- [Speech output](https://github.com/adilmunawar/jarvis/blob/main/TextToSpeech/Fast_DF_TTS.py): tts · Text-to-speech response generation · `TextToSpeech/Fast_DF_TTS.py`

### Core Brain

Command routing and orchestration

- [Brain](https://github.com/adilmunawar/jarvis/blob/main/Brain/brain.py): router · Primary intent dispatcher · `Brain/brain.py`
- [Co-brain](https://github.com/adilmunawar/jarvis/blob/main/co_brain.py): coordination · Secondary orchestration layer · `co_brain.py`
- [Automation brain](https://github.com/adilmunawar/jarvis/blob/main/Automation/Automation_Brain.py): router · Routes automation commands · `Automation/Automation_Brain.py`
- [Time brain](https://github.com/adilmunawar/jarvis/blob/main/Time_Operations/brain.py): scheduler router · Routes reminders and time-based actions · `Time_Operations/brain.py`
- [Vision brain](https://github.com/adilmunawar/jarvis/blob/main/Vision/Vbrain.py): vision router · Routes camera and vision tasks · `Vision/Vbrain.py`
- [MV brain](https://github.com/adilmunawar/jarvis/blob/main/Vision/MVbrain.py): vision router · Alternate vision command router · `Vision/MVbrain.py`

### Actions

Local machine, browser, and media control

- [System actions](https://github.com/adilmunawar/jarvis/blob/main/Automation/open_App.py): os control · Open apps, check battery, volume, file creation, device health · `Automation/open_App.py`
- [Browser actions](https://github.com/adilmunawar/jarvis/blob/main/Automation/tab_automation.py): browser control · Tabs, scrolling, web open, page data, YouTube playback · `Automation/tab_automation.py`
- [Media actions](https://github.com/adilmunawar/jarvis/blob/main/Automation/Play_Music_YT.py): media control · Music and playback helpers for YouTube and Spotify · `Automation/Play_Music_YT.py`
- [Utilities](https://github.com/adilmunawar/jarvis/blob/main/Features/get_jokes.py): feature helpers · Advice, jokes, IP lookup, clap detection, microphone and speaker checks · `Features/get_jokes.py`

### Online Integrations

External services and web-backed features

- [Web services](https://github.com/adilmunawar/jarvis/blob/main/Real_Time/google_big.py): online features · Search, weather, WhatsApp, and data fetch helpers · `Real_Time/google_big.py`
- [Image gen](https://github.com/adilmunawar/jarvis/blob/main/TextToImage/gen_image.py): image synthesis · Text-to-image generation · `TextToImage/gen_image.py`
- [Alerts](https://github.com/adilmunawar/jarvis/blob/main/Time_Operations/throw_alert.py): scheduler output · Deferred alerts and reminders · `Time_Operations/throw_alert.py`

### State & Data

Persistent text files and stored context

- [Dialogue data](https://github.com/adilmunawar/jarvis/blob/main/Data/DLG_Data.py): conversation store · Conversation-related data access · `Data/DLG_Data.py`
- [Flat files](https://github.com/adilmunawar/jarvis/blob/main/chat_hystory.txt): local memory · Chat history, logs, schedule, and speech/input buffers · `chat_hystory.txt`
- [Runtime deps](https://github.com/adilmunawar/jarvis/blob/main/requirements.txt): environment · Python packaging and browser driver dependency · `requirements.txt`

## Connections

- jarvis.py → Speech input: capture input · Main runtime accepts spoken commands
- jarvis.py → Brain: route · Entry point hands commands to the core router
- ui.py → Brain: send command · UI forwards typed commands to the brain
- demo.py → Brain: exercise · Demo run likely uses the same routing layer
- Brain → Automation brain: dispatch · Core brain delegates action commands
- Brain → Time brain: dispatch · Core brain delegates reminder and alert commands
- Brain → Vision brain: dispatch · Core brain delegates vision commands
- Brain → Co-brain: coordinate · Secondary orchestration for multi-step flows
- Automation brain → System actions: control · Automation router triggers local system tasks
- Automation brain → Browser actions: browse · Automation router triggers browser automation
- Automation brain → Media actions: play media · Automation router handles music and video playback
- Automation brain → Utilities: invoke · Automation flow can call narrow utility helpers
- Brain → Web services: query · Core routes online lookup and service tasks
- Brain → Image gen: generate · Core can trigger text-to-image generation
- Time brain → Alerts: schedule · Time subsystem emits reminders and alerts
- Vision brain → MV brain: delegate · Vision entry point may forward to alternate vision router
- jarvis.py → Speech output: respond · Main runtime speaks results back to the user
- Brain → Dialogue data: store context · Conversation data supports memory and dialogue state
- Brain → Flat files: persist · Assistant uses flat files for history, logs, and buffers
- Automation brain → Runtime deps: depends on · Browser/system automation relies on packaged runtime and driver
