# luxiasl/hephia architecture

> Architecture diagram of the GitHub repository luxiasl/hephia, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luxiasl/hephia
- Repository: https://github.com/luxiasl/hephia

## Overview

##### Main System Components Organization

A. Core System Layer
- Core/server.py as the central hub
- Event_bridge.py and state_bridge.py as primary communication channels
- Timer.py for temporal management

B. Interface Layer (Display)
- Three main windows:
- brain_window
- pet_window
- status_window

C. Pet Entity Layer
- On the right side
- Into distinct modules:
1. Actions Module
2. Behaviors Module
3. Cognition Module
4. Emotions Module
5. Memory Module
6. Needs Module

D. Brain Processing Layer
- On the left side
- Include:
- Commands processing
- Environment handling
- Exo-processor integration

##### Component Relationships

Use the following connection types:

##### Detailed Component Breakdown

A. Pet Module Interactions:
**Needs Manager → Emotional Processor**
- ↕
**Behavior Manager → Cognitive Bridge**
- ↕
**Action Manager → Memory System**

B. Brain Processing Flow:
**Environment Registry**
- ↓
**Command Processors**
- ↓
**Exo Processor**

##### Implementation Details

- Component name
- Key responsibilities
- Primary interfaces
- State management approach

In three levels:
##### Detailed component breakdowns

Key Elements to Emphasize:
- The event-driven nature of the system
- The cognitive processing pipeline
- The emotional/behavioral feedback loops
- State management and persistence
- The interaction between the brain and pet subsystems

Remember to:
- Bidirectional communication between modules
- Event catalog integration points
- Where configuration impacts system behavior
- Logging checkpoints
- Demonstrate how the pet context influences behavior

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#a8d1f0,stroke:#333
    classDef brain fill:#90EE90,stroke:#333
    classDef pet fill:#DDA0DD,stroke:#333
    classDef display fill:#FFA07A,stroke:#333
    classDef critical fill:#FF6B6B,stroke:#333

    %% Core System Layer
    subgraph CoreLayer["Core System Layer"]
        EventBridge["Event Bridge"]
        StateBridge["State Bridge"]
        Timer["Timer System"]
        Server["Server Component"]
    end

    %% Brain Layer
    subgraph BrainLayer["Brain Layer"]
        subgraph CommandProc["Command Processing"]
            ModelInterface["Model Interface"]
            Preprocessor["Preprocessor"]
        end
        
        subgraph EnvMgmt["Environment Management"]
            BaseEnv["Base Environment"]
            EnvRegistry["Environment Registry"]
        end
        
        ExoProc["Exo Processor"]
    end

    %% Pet Module Layer
    subgraph PetLayer["Pet Module Layer"]
        subgraph CognitiveSystem["Cognitive System"]
            CognitiveBridge["Cognitive Bridge"]
        end
        
        subgraph EmotionalSystem["Emotional System"]
            EmotionalProc["Emotional Processor"]
            MoodSynth["Mood Synthesizer"]
        end
        
        MemorySystem["Memory System"]
        NeedsManager["Needs Manager"]
        
        subgraph BehaviorSystem["Behavior System"]
            BehaviorMgr["Behavior Manager"]
        end
        
        subgraph ActionSystem["Action System"]
            ActionMgr["Action Manager"]
        end
    end

    %% Display Layer
    subgraph DisplayLayer["Display Layer"]
        BrainWindow["Brain Window"]
        PetWindow["Pet Window"]
        StatusWindow["Status Window"]
    end

    %% Relationships
    EventBridge <--> StateBridge
    EventBridge <--> Server
    Timer --> EventBridge
    
    ModelInterface <--> Preprocessor
    BaseEnv <--> EnvRegistry
    ExoProc <--> CommandProc
    
    CognitiveBridge <--> EmotionalProc
    EmotionalProc <--> MoodSynth
    MemorySystem <--> NeedsManager
    BehaviorMgr <--> ActionMgr
    
    BrainWindow <--> StatusWindow
    StatusWindow <--> PetWindow

    %% Cross-Layer Connections
    EventBridge --> BrainLayer
    BrainLayer --> PetLayer
    PetLayer --> DisplayLayer

    %% Click Events
    click EventBridge "https://github.com/LuxiaSL/hephia/blob/main/core/event_bridge.py"
    click StateBridge "https://github.com/LuxiaSL/hephia/blob/main/core/state_bridge.py"
    click Timer "https://github.com/LuxiaSL/hephia/blob/main/core/timer.py"
    click Server "https://github.com/LuxiaSL/hephia/blob/main/core/server.py"
    
    click ModelInterface "https://github.com/LuxiaSL/hephia/blob/main/brain/commands/model.py"
    click Preprocessor "https://github.com/LuxiaSL/hephia/blob/main/brain/commands/preprocessor.py"
    click BaseEnv "https://github.com/LuxiaSL/hephia/blob/main/brain/environments/base_environment.py"
    click EnvRegistry "https://github.com/LuxiaSL/hephia/blob/main/brain/environments/environment_registry.py"
    click ExoProc "https://github.com/LuxiaSL/hephia/blob/main/brain/exo_processor.py"
    
    click CognitiveBridge "https://github.com/LuxiaSL/hephia/blob/main/pet/modules/cognition/cognitive_bridge.py"
    click EmotionalProc "https://github.com/LuxiaSL/hephia/blob/main/pet/modules/emotions/emotional_processor.py"
    click MoodSynth "https://github.com/LuxiaSL/hephia/blob/main/pet/modules/emotions/mood_synthesizer.py"
    click MemorySystem "https://github.com/LuxiaSL/hephia/blob/main/pet/modules/memory/memory_system.py"
    click NeedsManager "https://github.com/LuxiaSL/hephia/blob/main/pet/modules/needs/needs_manager.py"
    click BehaviorMgr "https://github.com/LuxiaSL/hephia/blob/main/pet/modules/behaviors/behavior_manager.py"
    click ActionMgr "https://github.com/LuxiaSL/hephia/blob/main/pet/modules/actions/action_manager.py"
    
    click BrainWindow "https://github.com/LuxiaSL/hephia/blob/main/display/brain_window.py"
    click PetWindow "https://github.com/LuxiaSL/hephia/blob/main/display/pet_window.py"
    click StatusWindow "https://github.com/LuxiaSL/hephia/blob/main/display/status_window.py"

    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        BrainComp["Brain Component"]:::brain
        PetComp["Pet Component"]:::pet
        DisplayComp["Display Component"]:::display
        CriticalComp["Critical Component"]:::critical
    end
```
