# hamza-mint/sound-os architecture

> Architecture diagram of the GitHub repository hamza-mint/sound-os, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hamza-mint/sound-os
- Repository: https://github.com/hamza-mint/sound-os

## Overview

Sound OS is a local, bilingual voice-control assistant. Its principal workflow captures microphone audio, detects a wake phrase, transcribes speech, parses one or more commands, applies safety checks, executes approved actions, and reports through Dave’s UI and voice. The graph preserves documented capabilities such as compound commands, fuzzy and local-LLM parsing, and headless operation. Some implementation details are unsampled; edges are limited to README statements or shown source references and calls.

Main entry points: [`main.py`](https://github.com/hamza-mint/sound-os/blob/main/main.py) (Command coordinator), [`intent_parser/rules.py`](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/rules.py) (Bilingual intent rules), [`audio/wakeword.py`](https://github.com/hamza-mint/sound-os/blob/main/audio/wakeword.py) (Wake detection), [`intent_parser/__init__.py`](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/__init__.py) (Parser entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Runtime orchestration"]
  node_main["Command coordinator<br/>[main.py]"]
end

subgraph group_audio["Audio input"]
  node_recorder["Microphone capture<br/>[recorder.py]"]
  node_wake["Wake detection<br/>[wakeword.py]"]
  node_debug_clips["Audio diagnostics<br/>[debug_clips.py]"]
end

subgraph group_language["Language understanding"]
  node_transcription["Offline transcription<br/>[stt.py]"]
  node_live_stt["Live recognition<br/>[run_live.py]"]
  node_textnorm["Transcript normalization<br/>[textnorm.py]"]
  node_parser["Parser entry point<br/>[__init__.py]"]
  node_normalizer["Text normalization<br/>[normalize.py]"]
  node_rules["Bilingual intent rules<br/>[rules.py]"]
  node_compound["Compound commands<br/>[compound.py]"]
  node_fuzzy["Fuzzy matching<br/>[fuzzy.py]"]
  node_llm["Local LLM fallback<br/>[llm_fallback.py]"]
  node_verb_check["Verb checking<br/>[verb_check.py]"]
end

subgraph group_actions["Safety and actions"]
  node_safety["Safety guardrails<br/>[safety_layer.py]"]
  node_executor["Action dispatch<br/>[__init__.py]"]
  node_action_impl["System actions<br/>[actions.py]"]
end

subgraph group_assistant_ui["Dave interface"]
  node_ui_bridge["UI bridge<br/>[dave_bridge.py]"]
  node_desktop["Desktop assistant<br/>[dave_desktop.py]"]
  node_character["Character animation<br/>[dave_character.py]"]
  node_voice["Speech output<br/>[dave_voice.py]"]
end

node_user(("Voice user"))
node_ollama["Ollama service"]
node_linux["Linux desktop"]

node_user -->|"speaks into"| node_recorder
node_main -->|"starts listening"| node_wake
node_wake -->|"captures audio"| node_recorder
node_wake -->|"transcribes wake"| node_transcription
node_wake -.->|"signals command"| node_main
node_main -->|"runs live mode"| node_live_stt
node_live_stt -->|"transcribes audio"| node_transcription
node_transcription -->|"normalizes text"| node_textnorm
node_main -->|"parses command"| node_parser
node_parser -->|"splits commands"| node_compound
node_parser -->|"parses intent"| node_rules
node_rules -->|"normalizes text"| node_normalizer
node_rules -->|"tries fuzzy match"| node_fuzzy
node_rules -->|"uses fallback"| node_llm
node_fuzzy -->|"normalizes input"| node_normalizer
node_fuzzy -->|"checks rule matches"| node_rules
node_main -->|"checks command"| node_verb_check
node_main -->|"checks permission"| node_safety
node_main -->|"dispatches action"| node_executor
node_executor -->|"invokes actions"| node_action_impl
node_llm -->|"requests inference"| node_ollama
node_main -->|"updates assistant"| node_ui_bridge
node_ui_bridge -->|"routes messages"| node_desktop
node_desktop -->|"renders character"| node_character
node_desktop -->|"speaks responses"| node_voice
node_voice -->|"plays speech"| node_user
node_action_impl -->|"controls desktop"| node_linux

click node_main "https://github.com/hamza-mint/sound-os/blob/main/main.py"
click node_recorder "https://github.com/hamza-mint/sound-os/blob/main/audio/recorder.py"
click node_wake "https://github.com/hamza-mint/sound-os/blob/main/audio/wakeword.py"
click node_debug_clips "https://github.com/hamza-mint/sound-os/blob/main/audio/debug_clips.py"
click node_transcription "https://github.com/hamza-mint/sound-os/blob/main/stt/stt.py"
click node_live_stt "https://github.com/hamza-mint/sound-os/blob/main/stt/run_live.py"
click node_textnorm "https://github.com/hamza-mint/sound-os/blob/main/stt/textnorm.py"
click node_parser "https://github.com/hamza-mint/sound-os/blob/main/intent_parser/__init__.py"
click node_normalizer "https://github.com/hamza-mint/sound-os/blob/main/intent_parser/normalize.py"
click node_rules "https://github.com/hamza-mint/sound-os/blob/main/intent_parser/rules.py"
click node_compound "https://github.com/hamza-mint/sound-os/blob/main/intent_parser/compound.py"
click node_fuzzy "https://github.com/hamza-mint/sound-os/blob/main/intent_parser/fuzzy.py"
click node_llm "https://github.com/hamza-mint/sound-os/blob/main/intent_parser/llm_fallback.py"
click node_verb_check "https://github.com/hamza-mint/sound-os/blob/main/intent_parser/verb_check.py"
click node_safety "https://github.com/hamza-mint/sound-os/blob/main/safety/safety_layer.py"
click node_executor "https://github.com/hamza-mint/sound-os/blob/main/executor/__init__.py"
click node_action_impl "https://github.com/hamza-mint/sound-os/blob/main/executor/actions.py"
click node_ui_bridge "https://github.com/hamza-mint/sound-os/blob/main/ui_tts/dave_bridge.py"
click node_desktop "https://github.com/hamza-mint/sound-os/blob/main/ui_tts/dave_desktop.py"
click node_character "https://github.com/hamza-mint/sound-os/blob/main/ui_tts/dave_character.py"
click node_voice "https://github.com/hamza-mint/sound-os/blob/main/ui_tts/dave_voice.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_user toneBlue
class node_recorder,node_wake,node_debug_clips toneAmber
class node_transcription,node_live_stt,node_textnorm,node_parser,node_normalizer,node_rules,node_compound,node_fuzzy,node_llm,node_verb_check toneMint
class node_safety,node_executor,node_action_impl toneRose
class node_ui_bridge,node_desktop,node_character,node_voice,node_ollama,node_linux toneIndigo
```

## Components

### Runtime orchestration

- [Command coordinator](https://github.com/hamza-mint/sound-os/blob/main/main.py): `main.py`

### Audio input

- [Microphone capture](https://github.com/hamza-mint/sound-os/blob/main/audio/recorder.py): `audio/recorder.py`
- [Wake detection](https://github.com/hamza-mint/sound-os/blob/main/audio/wakeword.py): `audio/wakeword.py`
- [Audio diagnostics](https://github.com/hamza-mint/sound-os/blob/main/audio/debug_clips.py): `audio/debug_clips.py`

### Language understanding

- [Offline transcription](https://github.com/hamza-mint/sound-os/blob/main/stt/stt.py): `stt/stt.py`
- [Live recognition](https://github.com/hamza-mint/sound-os/blob/main/stt/run_live.py): `stt/run_live.py`
- [Transcript normalization](https://github.com/hamza-mint/sound-os/blob/main/stt/textnorm.py): `stt/textnorm.py`
- [Parser entry point](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/__init__.py): `intent_parser/__init__.py`
- [Text normalization](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/normalize.py): `intent_parser/normalize.py`
- [Bilingual intent rules](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/rules.py): `intent_parser/rules.py`
- [Compound commands](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/compound.py): `intent_parser/compound.py`
- [Fuzzy matching](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/fuzzy.py): `intent_parser/fuzzy.py`
- [Local LLM fallback](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/llm_fallback.py): `intent_parser/llm_fallback.py`
- [Verb checking](https://github.com/hamza-mint/sound-os/blob/main/intent_parser/verb_check.py): `intent_parser/verb_check.py`

### Safety and actions

- [Safety guardrails](https://github.com/hamza-mint/sound-os/blob/main/safety/safety_layer.py): `safety/safety_layer.py`
- [Action dispatch](https://github.com/hamza-mint/sound-os/blob/main/executor/__init__.py): `executor/__init__.py`
- [System actions](https://github.com/hamza-mint/sound-os/blob/main/executor/actions.py): `executor/actions.py`

### Dave interface

- [UI bridge](https://github.com/hamza-mint/sound-os/blob/main/ui_tts/dave_bridge.py): `ui_tts/dave_bridge.py`
- [Desktop assistant](https://github.com/hamza-mint/sound-os/blob/main/ui_tts/dave_desktop.py): `ui_tts/dave_desktop.py`
- [Character animation](https://github.com/hamza-mint/sound-os/blob/main/ui_tts/dave_character.py): `ui_tts/dave_character.py`
- [Speech output](https://github.com/hamza-mint/sound-os/blob/main/ui_tts/dave_voice.py): `ui_tts/dave_voice.py`

### Other components

- **Voice user**
- **Ollama service**
- **Linux desktop**

## Connections

- Voice user → Microphone capture: speaks into (evidence: `README.md`)
- Command coordinator → Wake detection: starts listening (evidence: `README.md`)
- Wake detection → Microphone capture: captures audio (evidence: `audio/wakeword.py`)
- Wake detection → Offline transcription: transcribes wake (evidence: `audio/wakeword.py`)
- Wake detection → Command coordinator: signals command
- Command coordinator → Live recognition: runs live mode (evidence: `README.md`)
- Live recognition → Offline transcription: transcribes audio (evidence: `stt/run_live.py`)
- Offline transcription → Transcript normalization: normalizes text (evidence: `stt/__init__.py`)
- Command coordinator → Parser entry point: parses command (evidence: `main.py`)
- Parser entry point → Compound commands: splits commands (evidence: `intent_parser/__init__.py`)
- Parser entry point → Bilingual intent rules: parses intent (evidence: `intent_parser/__init__.py`)
- Bilingual intent rules → Text normalization: normalizes text (evidence: `intent_parser/rules.py`)
- Bilingual intent rules → Fuzzy matching: tries fuzzy match (evidence: `intent_parser/rules.py`)
- Bilingual intent rules → Local LLM fallback: uses fallback (evidence: `intent_parser/rules.py`)
- Fuzzy matching → Text normalization: normalizes input (evidence: `intent_parser/fuzzy.py`)
- Fuzzy matching → Bilingual intent rules: checks rule matches (evidence: `intent_parser/fuzzy.py`)
- Command coordinator → Verb checking: checks command (evidence: `main.py`)
- Command coordinator → Safety guardrails: checks permission (evidence: `main.py`)
- Command coordinator → Action dispatch: dispatches action (evidence: `README.md`)
- Action dispatch → System actions: invokes actions (evidence: `executor/__init__.py`)
- Local LLM fallback → Ollama service: requests inference (evidence: `intent_parser/llm_fallback.py`)
- Command coordinator → UI bridge: updates assistant (evidence: `main.py`)
- UI bridge → Desktop assistant: routes messages (evidence: `ui_tts/dave_bridge.py`)
- Desktop assistant → Character animation: renders character (evidence: `ui_tts/dave_desktop.py`)
- Desktop assistant → Speech output: speaks responses (evidence: `ui_tts/dave_desktop.py`)
- Speech output → Voice user: plays speech (evidence: `README.md`)
- System actions → Linux desktop: controls desktop (evidence: `README.md`)
