# focai-acc/foceliza architecture

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

- Interactive diagram: https://gitdiagram.com/focai-acc/foceliza
- Repository: https://github.com/focai-acc/foceliza

## Overview

##### High-Level Architecture Components

a) Core System Layer:
- Agent Runtime (from packages/core/src/runtime.ts)
- Memory Manager (from packages/core/src/memory.ts)
- Message Handler System
- Goals Management System

b) Integration Layer:
- Discord
- Twitter/X
- Telegram
- WhatsApp
- Direct Client
- Auto Client

c) Plugin System:
- Plugin architecture showing major categories:
- Blockchain Plugins (EVM, Solana, Starknet, etc.)
- Service Plugins (Image/Video Generation, Web Search)
- Infrastructure Plugins (TEE, Node)

##### Data Flow and Storage

a) Database Layer:
- Multiple database adapter options:
- PostgreSQL
- Redis
- SQLite
- Supabase

b) Memory Systems:
- Memory architecture:
- Short-term Memory
- Long-term Storage
- Document Store
- Cache Management

##### TEE Integration

- Verifiable Runtime Proof Module
- On-Chain Components
- TEE Cluster
- Blockchain Interaction Components

##### Connection Types

Use different line styles to show:

##### Implementation Details

Annotations showing:
- Supported model providers (OpenAI, Anthropic, Llama, etc.)
- Key configuration points
- Plugin extension points
- Client integration interfaces

##### The decentralized nature of the system

Remember to maintain a balance between showing enough detail to understand the system while keeping it clear and readable. Use hierarchical grouping to manage complexity and provide different levels of detail where needed.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core System Layer"]
        Runtime["Agent Runtime"]:::core
        Memory["Memory Manager"]:::core
        Messages["Message Handler"]:::core
        Goals["Goals Management"]:::core
        Cache["Cache System"]:::core
        
        Runtime --> Memory
        Runtime --> Messages
        Runtime --> Goals
        Memory --> Cache
    end

    subgraph Clients["Client Integration Layer"]
        Discord["Discord Client"]:::client
        Twitter["Twitter Client"]:::client
        Telegram["Telegram Client"]:::client
        WhatsApp["WhatsApp Client"]:::client
        Direct["Direct Client"]:::client
        Auto["Auto Client"]:::client
    end

    subgraph Plugins["Plugin System"]
        subgraph Blockchain["Blockchain Plugins"]
            EVM["EVM Plugin"]:::plugin
            Solana["Solana Plugin"]:::plugin
            Starknet["Starknet Plugin"]:::plugin
        end

        subgraph Services["Service Plugins"]
            ImageGen["Image Generation"]:::plugin
            VideoGen["Video Generation"]:::plugin
            WebSearch["Web Search"]:::plugin
        end

        subgraph Infrastructure["Infrastructure Plugins"]
            TEE["TEE Plugin"]:::plugin
            Node["Node Plugin"]:::plugin
        end
    end

    subgraph Storage["Database Layer"]
        Postgres["PostgreSQL"]:::db
        Redis["Redis"]:::db
        SQLite["SQLite"]:::db
        Supabase["Supabase"]:::db
    end

    subgraph TEESystem["TEE Integration"]
        TEERuntime["Verifiable Runtime"]:::tee
        TEECluster["TEE Cluster"]:::tee
        BlockchainInt["Blockchain Interface"]:::tee
    end

    %% Connections
    Clients --> Runtime
    Runtime --> Plugins
    Memory --> Storage
    TEESystem --> Runtime
    Plugins --> Storage

    %% Click Events
    click Runtime "https://github.com/focai-acc/focEliza/blob/main/packages/core/src/runtime.ts"
    click Memory "https://github.com/focai-acc/focEliza/blob/main/packages/core/src/memory.ts"
    click Messages "https://github.com/focai-acc/focEliza/blob/main/packages/core/src/messages.ts"
    click Goals "https://github.com/focai-acc/focEliza/blob/main/packages/core/src/goals.ts"
    click Cache "https://github.com/focai-acc/focEliza/blob/main/packages/core/src/cache.ts"
    
    click Discord "https://github.com/focai-acc/focEliza/blob/main/packages/client-discord/src/index.ts"
    click Twitter "https://github.com/focai-acc/focEliza/blob/main/packages/client-twitter/src/index.ts"
    click Telegram "https://github.com/focai-acc/focEliza/blob/main/packages/client-telegram/src/index.ts"
    click WhatsApp "https://github.com/focai-acc/focEliza/blob/main/packages/client-whatsapp/src/index.ts"
    click Direct "https://github.com/focai-acc/focEliza/blob/main/packages/client-direct/src/index.ts"
    click Auto "https://github.com/focai-acc/focEliza/blob/main/packages/client-auto/src/index.ts"
    
    click EVM "https://github.com/focai-acc/focEliza/blob/main/packages/plugin-evm/src/index.ts"
    click Solana "https://github.com/focai-acc/focEliza/blob/main/packages/plugin-solana/src/index.ts"
    click Starknet "https://github.com/focai-acc/focEliza/blob/main/packages/plugin-starknet/src/index.ts"
    
    click ImageGen "https://github.com/focai-acc/focEliza/blob/main/packages/plugin-image-generation/src/index.ts"
    click VideoGen "https://github.com/focai-acc/focEliza/blob/main/packages/plugin-video-generation/src/index.ts"
    click WebSearch "https://github.com/focai-acc/focEliza/blob/main/packages/plugin-web-search/src/index.ts"
    
    click TEE "https://github.com/focai-acc/focEliza/blob/main/packages/plugin-tee/src/index.ts"
    click Node "https://github.com/focai-acc/focEliza/blob/main/packages/plugin-node/src/index.ts"
    
    click Postgres "https://github.com/focai-acc/focEliza/blob/main/packages/adapter-postgres/src/index.ts"
    click Redis "https://github.com/focai-acc/focEliza/blob/main/packages/adapter-redis/src/index.ts"
    click SQLite "https://github.com/focai-acc/focEliza/blob/main/packages/adapter-sqlite/src/index.ts"
    click Supabase "https://github.com/focai-acc/focEliza/blob/main/packages/adapter-supabase/src/index.ts"

    %% Styling
    classDef core fill:#2374ab
    classDef client fill:#57cc99
    classDef plugin fill:#ff9f1c
    classDef db fill:#7209b7
    classDef tee fill:#d62828

    %% Legend
    subgraph Legend
        CoreL["Core Components"]:::core
        ClientL["Client Integrations"]:::client
        PluginL["Plugins"]:::plugin
        DBL["Databases"]:::db
        TEEL["TEE Components"]:::tee
    end
```
