# stypox/dicio-android architecture

> Architecture diagram of the GitHub repository stypox/dicio-android, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stypox/dicio-android
- Repository: https://github.com/stypox/dicio-android

## Overview

##### Project type and purpose
- This is a multi-module Android application (“Dicio assistant”) that works entirely on-device as a privacy-focused voice assistant.
- Modules:
- app: the Android UI, DI setup, input/output wiring, ViewModels, Compose screens.
- skill: a Kotlin library defining the generic “Skill” abstraction, matching/evaluation engine and standard constructs.
- sentences-compiler-plugin: a Gradle compiler plugin that processes YAML sentence definitions at compile time to generate type-safe code for sentence matching.

##### File structure
- Top-level:
- app/: Android Studio Gradle module (build.gradle.kts).
- skill/: plain Kotlin/Android library module with its own AndroidManifest (needed for instrumentation).
- sentences-compiler-plugin/: a Gradle plugin project that reads app/src/main/sentences and generates code.
- fastlane/: CI & Play/F-Droid release metadata and screenshots.
- app/src/main/kotlin/org/stypox/dicio/:
- di/: manual dependency-injection modules for network, locale, hardware wrappers (wake, STT, TTS).
- io/: input (wake-word, STT via Vosk or Android Speech, external popup), speech output, wake service.
- eval/: orchestration of skills (SkillEvaluator, SkillHandler), ranking and context.
- skills/: concrete skill implementations grouped by feature (weather, search, calculator,…).
- settings/, ui/, util/, error/: MVVM ViewModels, Compose UI, error screens, utilities.
- Protobufs under app/src/main/proto drive serialization of settings, language, theme, I/O device enums.

##### Key architecture insights from README
- On-device STT via Vosk, on-device TTS via Android TTS or fallback.
- Plug-in “skills” system: each skill provides sentences (YAML → compiler plugin → sealed classes), a SkillInfo object, a concrete Skill class (score + generateOutput), and a SkillOutput with both speech text and @Composable UI.
- Network calls for DuckDuckGo, OpenWeatherMap, Genius.

##### Essential details
- DI container feeding NetworkModule, LocaleManager, Device wrappers into core engine and skills
- Proto layer as configuration driving language, theme, settings serialization

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build-time components
    subgraph "Build-time Components"
        SC["Sentences Compiler Plugin"]:::build
    end

    %% Input Layer
    subgraph "Input Layer"
        direction TB
        MW["Microphone"]:::input
        WS["WakeService"]:::input
        WD["WakeDevice"]:::input
        OWW["OpenWakeWordDevice"]:::input
        Vosk["VoskInputDevice"]:::input
        STT["SttService"]:::input
        EP["ExternalPopupInputDevice"]:::input
        SPAct["SttPopupActivity"]:::input
        SPVM["SttPopupViewModel"]:::input
    end

    %% Core Engine
    subgraph "Core Engine"
        direction TB
        DEPS["Dependency Injection"]:::core
        Eval["SkillEvaluator"]:::core
        Handler["SkillHandler"]:::core
        SKMod["skill module"]:::core
    end

    %% Concrete Skills
    subgraph "Concrete Skills"
        direction TB
        Calc["CalculatorSkill"]:::core
        Weather["WeatherSkill"]:::core
        Search["SearchSkill"]:::core
        Nav["NavigationSkill"]:::core
        Timer["TimerSkill"]:::core
        Lyrics["LyricsSkill"]:::core
        Media["MediaSkill"]:::core
        Tel["TelephoneSkill"]:::core
        Fallback["TextFallbackSkill"]:::core
        Time["CurrentTimeSkill"]:::core
    end

    %% External Dependencies
    subgraph "External Services"
        REST["REST APIs (DuckDuckGo, OpenWeatherMap, Genius)"]:::ext
        AndSrv["Android System Services"]:::ext
    end

    %% Output Layer
    subgraph "Output Layer"
        direction TB
        SpeechOut["SpeechOutputDevice"]:::output
        UI["Compose UI Screens"]:::output
    end

    %% Configuration
    Proto["Proto Configurations"]:::ext

    %% Connections
    MW --> WS
    WS --> WD
    WD --> Vosk
    WD --> STT
    WD --> EP
    EP --> SPAct
    SPAct --> SPVM
    Vosk --> Eval
    STT --> Eval
    SPVM --> Eval
    SC --> Eval
    DEPS --> Eval
    Eval --> Handler
    Handler --> SKMod
    SKMod --> Calc
    SKMod --> Weather
    SKMod --> Search
    SKMod --> Nav
    SKMod --> Timer
    SKMod --> Lyrics
    SKMod --> Media
    SKMod --> Tel
    SKMod --> Fallback
    SKMod --> Time
    Calc --> REST
    Weather --> REST
    Search --> REST
    Nav --> AndSrv
    Timer --> AndSrv
    Lyrics --> REST
    Media --> AndSrv
    Tel --> AndSrv
    Fallback --> REST
    Time --> AndSrv
    Handler --> SpeechOut
    Handler --> UI
    Proto --> DEPS

    %% Click Events
    click SC "https://github.com/stypox/dicio-android/tree/master/sentences-compiler-plugin/"
    click WS "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/io/wake/WakeService.kt"
    click OWW "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/io/wake/oww/OpenWakeWordDevice.kt"
    click WD "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/io/wake/WakeDevice.kt"
    click Vosk "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/io/input/vosk/VoskInputDevice.kt"
    click STT "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/io/input/stt_service/SttService.kt"
    click EP "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/io/input/external_popup/ExternalPopupInputDevice.kt"
    click SPAct "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/io/input/stt_popup/SttPopupActivity.kt"
    click SPVM "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/io/input/stt_popup/SttPopupViewModel.kt"
    click Eval "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/eval/SkillEvaluator.kt"
    click Handler "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/eval/SkillHandler.kt"
    click SKMod "https://github.com/stypox/dicio-android/tree/master/skill/"
    click Calc "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/calculator/CalculatorSkill.kt"
    click Weather "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/weather/WeatherSkill.kt"
    click Search "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/search/SearchSkill.kt"
    click Nav "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/navigation/NavigationSkill.kt"
    click Timer "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/timer/TimerSkill.kt"
    click Lyrics "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/lyrics/LyricsSkill.kt"
    click Media "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/media/MediaSkill.kt"
    click Tel "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/telephone/TelephoneSkill.kt"
    click Fallback "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/fallback/text/TextFallbackSkill.kt"
    click Time "https://github.com/stypox/dicio-android/blob/master/app/src/main/kotlin/org/stypox/dicio/skills/current_time/CurrentTimeSkill.kt"
    click DEPS "https://github.com/stypox/dicio-android/tree/master/app/src/main/kotlin/org/stypox/dicio/di/"
    click Proto "https://github.com/stypox/dicio-android/tree/master/app/src/main/proto/"

    %% Styles
    classDef build fill:#bbdefb,stroke:#1e88e5
    classDef core fill:#c8e6c9,stroke:#388e3c
    classDef input fill:#ffe0b2,stroke:#f57c00
    classDef output fill:#e1bee7,stroke:#8e24aa
    classDef ext fill:#eeeeee,stroke:#9e9e9e
```
