# aayush-js/offline-voice-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/aayush-js/offline-voice-assistant
- Repository: https://github.com/aayush-js/offline-voice-assistant

## Overview

Offline Voice Assistant converts microphone speech to text, predicts an intent with its bundled classifier, dispatches a supported action, and speaks the response. The main loop also handles first-run name setup and rejects low-confidence predictions. Training from the command dataset is a separate model-preparation path. The README documents the supported action set; the source excerpts show the runtime dispatch and integrations. The graph omits unshown classifier internals and treats the operating-system and browser effects as external.

Main entry points: [`main.py`](https://github.com/aayush-js/offline-voice-assistant/blob/main/main.py) (Assistant loop), [`actions.py`](https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py) (Action dispatcher), [`user.py`](https://github.com/aayush-js/offline-voice-assistant/blob/main/user.py) (Name profile), [`train.py`](https://github.com/aayush-js/offline-voice-assistant/blob/main/train.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Voice interaction"]
  node_loop["Assistant loop<br/>[main.py]"]
  node_stt["Speech recognition<br/>[stt.py]"]
  node_tts["Voice response<br/>[tts.py]"]
end

subgraph group_intent["Intent model"]
  node_classifier["Intent prediction<br/>[main.py]"]
  node_model["Trained model<br/>[intent_model.pkl]"]
  node_trainer["Model training<br/>[train.py]"]
  node_dataset["Command dataset<br/>[dataset.csv]"]
end

subgraph group_actions["Command actions"]
  node_dispatcher["Action dispatcher<br/>[actions.py]"]
  node_personal["Personal greeting<br/>[actions.py]"]
  node_time_date["Time and date<br/>[actions.py]"]
  node_apps["App launcher<br/>[actions.py]"]
  node_search["Web search<br/>[actions.py]"]
  node_help_exit["Help and exit<br/>[actions.py]"]
end

subgraph group_state["Local state and integrations"]
  node_profile["Name profile<br/>[user.py]"]
  node_profile_file[("Name storage<br/>[user_data.json]")]
end

node_user(("Speaker"))
node_os_apps["Windows apps"]
node_browser["Default browser"]

node_user -->|"speaks to"| node_stt
node_loop -->|"listens and calibrates"| node_stt
node_loop -->|"predicts intent"| node_classifier
node_loop -->|"loads"| node_model
node_trainer -->|"reads"| node_dataset
node_trainer -->|"saves"| node_model
node_loop -->|"dispatches intent"| node_dispatcher
node_loop -->|"speaks response"| node_tts
node_dispatcher -->|"dispatches"| node_personal
node_dispatcher -->|"dispatches"| node_time_date
node_dispatcher -->|"dispatches"| node_apps
node_dispatcher -->|"dispatches"| node_search
node_dispatcher -->|"dispatches"| node_help_exit
node_personal -->|"gets name"| node_profile
node_loop -->|"gets and saves name"| node_profile
node_profile -->|"reads and writes"| node_profile_file
node_apps -->|"launches"| node_os_apps
node_search -->|"opens search"| node_browser

click node_loop "https://github.com/aayush-js/offline-voice-assistant/blob/main/main.py"
click node_stt "https://github.com/aayush-js/offline-voice-assistant/blob/main/stt.py"
click node_tts "https://github.com/aayush-js/offline-voice-assistant/blob/main/tts.py"
click node_classifier "https://github.com/aayush-js/offline-voice-assistant/blob/main/main.py"
click node_model "https://github.com/aayush-js/offline-voice-assistant/blob/main/intent_model.pkl"
click node_trainer "https://github.com/aayush-js/offline-voice-assistant/blob/main/train.py"
click node_dataset "https://github.com/aayush-js/offline-voice-assistant/blob/main/dataset.csv"
click node_dispatcher "https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py"
click node_personal "https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py"
click node_time_date "https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py"
click node_apps "https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py"
click node_search "https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py"
click node_help_exit "https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py"
click node_profile "https://github.com/aayush-js/offline-voice-assistant/blob/main/user.py"
click node_profile_file "https://github.com/aayush-js/offline-voice-assistant/blob/main/user_data.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_loop,node_stt,node_tts,node_browser toneBlue
class node_classifier,node_model,node_trainer,node_dataset toneAmber
class node_dispatcher,node_personal,node_time_date,node_apps,node_search,node_help_exit toneMint
class node_profile,node_profile_file toneRose
class node_user,node_os_apps toneIndigo
```

## Components

### Voice interaction

- [Assistant loop](https://github.com/aayush-js/offline-voice-assistant/blob/main/main.py): `main.py`
- [Speech recognition](https://github.com/aayush-js/offline-voice-assistant/blob/main/stt.py): `stt.py`
- [Voice response](https://github.com/aayush-js/offline-voice-assistant/blob/main/tts.py): `tts.py`

### Intent model

- [Intent prediction](https://github.com/aayush-js/offline-voice-assistant/blob/main/main.py): `main.py`
- [Trained model](https://github.com/aayush-js/offline-voice-assistant/blob/main/intent_model.pkl): `intent_model.pkl`
- [Model training](https://github.com/aayush-js/offline-voice-assistant/blob/main/train.py): `train.py`
- [Command dataset](https://github.com/aayush-js/offline-voice-assistant/blob/main/dataset.csv): `dataset.csv`

### Command actions

- [Action dispatcher](https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py): `actions.py`
- [Personal greeting](https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py): `actions.py`
- [Time and date](https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py): `actions.py`
- [App launcher](https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py): `actions.py`
- [Web search](https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py): `actions.py`
- [Help and exit](https://github.com/aayush-js/offline-voice-assistant/blob/main/actions.py): `actions.py`

### Local state and integrations

- [Name profile](https://github.com/aayush-js/offline-voice-assistant/blob/main/user.py): `user.py`
- [Name storage](https://github.com/aayush-js/offline-voice-assistant/blob/main/user_data.json): `user_data.json`

### Other components

- **Speaker**
- **Windows apps**
- **Default browser**

## Connections

- Speaker → Speech recognition: speaks to (evidence: `README.md`)
- Assistant loop → Speech recognition: listens and calibrates (evidence: `main.py`)
- Assistant loop → Intent prediction: predicts intent (evidence: `main.py`)
- Assistant loop → Trained model: loads (evidence: `main.py`)
- Model training → Command dataset: reads (evidence: `train.py`)
- Model training → Trained model: saves (evidence: `train.py`)
- Assistant loop → Action dispatcher: dispatches intent (evidence: `main.py`)
- Assistant loop → Voice response: speaks response (evidence: `main.py`)
- Action dispatcher → Personal greeting: dispatches (evidence: `actions.py`)
- Action dispatcher → Time and date: dispatches (evidence: `actions.py`)
- Action dispatcher → App launcher: dispatches (evidence: `actions.py`)
- Action dispatcher → Web search: dispatches (evidence: `actions.py`)
- Action dispatcher → Help and exit: dispatches (evidence: `actions.py`)
- Personal greeting → Name profile: gets name (evidence: `actions.py`)
- Assistant loop → Name profile: gets and saves name (evidence: `main.py`)
- Name profile → Name storage: reads and writes (evidence: `user.py`)
- App launcher → Windows apps: launches (evidence: `actions.py`)
- Web search → Default browser: opens search (evidence: `actions.py`)
