# nethermindeth/ice-nine architecture

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

- Interactive diagram: https://gitdiagram.com/nethermindeth/ice-nine
- Repository: https://github.com/nethermindeth/ice-nine

## Overview

##### Main Components

a) Core Layer (essential/core):
- Core as a central hexagon, containing:
- Essence Module (particle, substance)
- Keeper Module (interaction, subscription)
- Router Module (model, tool, types)
- Space and Sequence components

b) Standard Library Layer (essential/std):
- As a supporting layer below the core
- Config_loader component

c) Plugins Layer:
- Plugins in a circular pattern around the core:
- Chat Plugins (chat-stdio, chat-telegram)
- Exchange Plugin (exchange-dydx)
- Model Plugin (model-openai)

d) Tools Layer:
- At the top:
- Dashboard (UI9)
- Protocol

##### Architectural Patterns to Highlight

a) Actor Model:
- Particles as individual actors
- Message passing between components

b) State Machine:
- State transition indicators within the core

c) Plugin System:
- Demonstrate the extensible nature through plugin interfaces

##### Technical Details

- Rust-based implementation notation
- Actor-State Machine hybrid pattern
- Real-time configuration paths
- Distribution boundaries
- Plugin extension points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#a8d1f0,stroke:#333
    classDef plugin fill:#90EE90,stroke:#333
    classDef tool fill:#FFB347,stroke:#333
    classDef stdlib fill:#E6E6E6,stroke:#333
    
    %% Layers as subgraphs
    subgraph Tools
        Dashboard["Dashboard UI"]
        Protocol["Protocol Definitions"]
    end

    subgraph Plugins
        subgraph ChatPlugins["Chat Plugins"]
            StdIO["StdIO"]
            Telegram["Telegram"]
        end
        
        subgraph ExchangePlugins["Exchange Plugins"]
            DyDx["dYdX"]
        end
        
        subgraph ModelPlugins["Model Plugins"]
            OpenAI["OpenAI"]
        end
    end

    subgraph Core
        subgraph EssenceModule["Essence Module"]
            Particle["Particle"]
            Substance["Substance"]
        end
        
        subgraph KeeperModule["Keeper Module"]
            Interaction["Interaction Handler"]
            Subscription["Subscription Manager"]
        end
        
        subgraph RouterModule["Router Module"]
            ModelHandler["Model Handler"]
            ToolManager["Tool Manager"]
        end
        
        Space["Space Handler"]
        Sequence["Sequence Handler"]
    end

    subgraph StdLib["Standard Library"]
        Config["Config Loader"]
        Utils["Utilities"]
    end

    %% Relationships
    Substance --> Particle
    KeeperModule --> EssenceModule
    RouterModule --> KeeperModule
    Space --> EssenceModule
    Sequence --> Space
    
    ChatPlugins -.-> KeeperModule
    ExchangePlugins -.-> KeeperModule
    ModelPlugins -.-> RouterModule
    
    Dashboard --> Protocol
    Protocol -.-> Core
    
    Core --> StdLib

    %% Click events
    click EssenceModule "https://github.com/NethermindEth/ice-nine/tree/trunk/essential/core/src/essence/"
    click Particle "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/core/src/essence/particle.rs"
    click Substance "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/core/src/essence/substance.rs"
    click KeeperModule "https://github.com/NethermindEth/ice-nine/tree/trunk/essential/core/src/keeper/"
    click Interaction "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/core/src/keeper/interaction.rs"
    click Subscription "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/core/src/keeper/subscription.rs"
    click RouterModule "https://github.com/NethermindEth/ice-nine/tree/trunk/essential/core/src/router/"
    click ModelHandler "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/core/src/router/model.rs"
    click ToolManager "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/core/src/router/tool.rs"
    click Space "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/core/src/space.rs"
    click Sequence "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/core/src/sequence.rs"
    click Config "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/std/src/config_loader.rs"
    click Utils "https://github.com/NethermindEth/ice-nine/blob/trunk/essential/std/src/lib.rs"
    click StdIO "https://github.com/NethermindEth/ice-nine/tree/trunk/plugins/chat-stdio/"
    click Telegram "https://github.com/NethermindEth/ice-nine/tree/trunk/plugins/chat-telegram/"
    click DyDx "https://github.com/NethermindEth/ice-nine/tree/trunk/plugins/exchange-dydx/"
    click OpenAI "https://github.com/NethermindEth/ice-nine/tree/trunk/plugins/model-openai/"
    click Dashboard "https://github.com/NethermindEth/ice-nine/tree/trunk/tools/dashboard/"
    click Protocol "https://github.com/NethermindEth/ice-nine/tree/trunk/tools/protocol/"

    %% Class assignments
    class EssenceModule,Particle,Substance,KeeperModule,Interaction,Subscription,RouterModule,ModelHandler,ToolManager,Space,Sequence core
    class StdIO,Telegram,DyDx,OpenAI,ChatPlugins,ExchangePlugins,ModelPlugins plugin
    class Dashboard,Protocol tool
    class Config,Utils,StdLib stdlib
```
