# dot-justin/lamathome architecture

> Architecture diagram of the GitHub repository dot-justin/lamathome, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dot-justin/lamathome
- Repository: https://github.com/dot-justin/lamathome

## Overview

##### Main Components

a) Core System Components:
- Rabbit r1 Device & API Interface
- LAMatHome Core Engine
- Integration Manager
- LLM Parser (using Groq API)
- Configuration Management

b) Integration Categories:
- Browser Integrations
- Local Actions
- Messaging Services
- External Services (Google Home, Open Interpreter)

**Top Layer: User Interaction**
**↓**
**Middle Layer: Core Processing**
**↓**
**Bottom Layer: Integration Execution**

##### Data Flow
- Rabbit r1 → Rabbit Hole API → Journal Entry Fetcher
- Journal Entry → LLM Parser → Integration Router
- Integration Router → Specific Integration → External Service

##### Configuration Flow
- Config.json → Configuration Manager → All Components
- Environment Variables → Credential Manager → Integrations

##### Specific Implementation Details

a) Core Processing:
- Journal entry fetching mechanism (utils/journal.py)
- LLM parsing system (utils/llm_parse.py)
- Task execution flow (utils/task_executor.py)

b) Integration Management:
- How integrations/ directory components connect
- Relationship between different integration types
- Authentication flows for services like Telegram and Google Home

##### Key Architectural Patterns

Highlight:
- Modular integration system
- Event-driven architecture
- Plugin-based extensibility
- Configuration-driven behavior

##### Technical Details

- Groq API connection for LLM processing
- Browser automation using Playwright
- Authentication token management
- Configuration management system

Create distinct sections for:
##### Input Processing
- Rabbit r1 interaction
- Journal entry fetching
- LLM parsing

##### Integration Management
- Integration router
- Service connectors
- Authentication handlers

##### External Services
- Browser automation
- Messaging platforms
- Local system controls
- Smart home integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef integration fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white
    classDef config fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef utils fill:#9b59b6,stroke:#8e44ad,color:white

    %% Core Components
    R1[Rabbit r1 Device]:::external
    API[Rabbit Hole API]:::core
    LAM[LAMatHome Core Engine]:::core
    LLM[LLM Parser]:::core
    CFG[Configuration Manager]:::config
    JF[Journal Entry Fetcher]:::core
    TE[Task Executor]:::core

    %% Integration Categories
    subgraph Browser
        BS[Browser Services]:::integration
        GS[Google Services]:::integration
        YT[YouTube]:::integration
        GM[Gmail]:::integration
        AZ[Amazon]:::integration
    end

    subgraph Local
        CC[Computer Control]:::integration
        VC[Volume Control]:::integration
        MC[Media Control]:::integration
        PM[Power Management]:::integration
    end

    subgraph Messaging
        DC[Discord]:::integration
        FB[Facebook Messenger]:::integration
        TG[Telegram]:::integration
    end

    subgraph External
        GH[Google Home]:::external
        OI[Open Interpreter]:::external
    end

    %% Utility Components
    ENV[Environment Management]:::utils
    UI[User Interface]:::utils
    HELP[Helper Functions]:::utils
    SPLASH[Splash Screen]:::utils

    %% Relationships
    R1 --> API
    API --> JF
    JF --> LLM
    LLM --> TE
    TE --> |Route Commands| Browser & Local & Messaging & External
    CFG --> LAM
    ENV --> LAM
    UI --> LAM
    HELP --> LAM

    %% Click Events
    click LAM "https://github.com/dot-Justin/LAMatHome/blob/main/integrations/lam_at_home.py"
    click LLM "https://github.com/dot-Justin/LAMatHome/blob/main/utils/llm_parse.py"
    click CFG "https://github.com/dot-Justin/LAMatHome/blob/main/utils/config.py"
    click JF "https://github.com/dot-Justin/LAMatHome/blob/main/utils/journal.py"
    click TE "https://github.com/dot-Justin/LAMatHome/blob/main/utils/task_executor.py"
    click API "https://github.com/dot-Justin/LAMatHome/blob/main/utils/rabbit_hole.py"
    click BS "https://github.com/dot-Justin/LAMatHome/blob/main/integrations/browser.py"
    click GS "https://github.com/dot-Justin/LAMatHome/blob/main/integrations/google.py"
    click CC "https://github.com/dot-Justin/LAMatHome/blob/main/integrations/computer.py"
    click DC "https://github.com/dot-Justin/LAMatHome/blob/main/integrations/discord.py"
    click TG "https://github.com/dot-Justin/LAMatHome/blob/main/integrations/telegram.py"
    click FB "https://github.com/dot-Justin/LAMatHome/blob/main/integrations/facebook.py"
    click OI "https://github.com/dot-Justin/LAMatHome/blob/main/integrations/open_interpreter.py"
    click ENV "https://github.com/dot-Justin/LAMatHome/blob/main/utils/get_env.py"
    click HELP "https://github.com/dot-Justin/LAMatHome/blob/main/utils/helpers.py"
    click UI "https://github.com/dot-Justin/LAMatHome/blob/main/utils/ui.py"
    click SPLASH "https://github.com/dot-Justin/LAMatHome/blob/main/utils/splash_screen.py"

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Integration Services]:::integration
        L3[External Services]:::external
        L4[Authentication Points]:::auth
        L5[Configuration]:::config
        L6[Utilities]:::utils
    end
```
