erDiagram CHAT_SESSION { int id PK int user_id FK string session_id datetime session_start datetime session_end string timezone } SPECIALIST { int id PK string name text description string type string type_version boolean tuning jsonb configuration jsonb arguments boolean active datetime created_at int created_by FK datetime updated_at int updated_by FK } EVE_AI_ASSET { int id PK string name text description string type string type_version string bucket_name string object_name string file_type float file_size jsonb user_metadata jsonb system_metadata jsonb configuration int prompt_tokens int completion_tokens datetime created_at int created_by FK datetime updated_at int updated_by FK datetime last_used_at } EVE_AI_AGENT { int id PK int specialist_id FK string name text description string type string type_version text role text goal text backstory boolean tuning jsonb configuration jsonb arguments datetime created_at int created_by FK datetime updated_at int updated_by FK } EVE_AI_TASK { int id PK int specialist_id FK string name text description string type string type_version text task_description text expected_output boolean tuning jsonb configuration jsonb arguments jsonb context boolean asynchronous datetime created_at int created_by FK datetime updated_at int updated_by FK } EVE_AI_TOOL { int id PK int specialist_id FK string name text description string type string type_version boolean tuning jsonb configuration jsonb arguments datetime created_at int created_by FK datetime updated_at int updated_by FK } DISPATCHER { int id PK string name text description string type string type_version boolean tuning jsonb configuration jsonb arguments datetime created_at int created_by FK datetime updated_at int updated_by FK } INTERACTION { int id PK int chat_session_id FK int specialist_id FK jsonb specialist_arguments jsonb specialist_results string timezone int appreciation datetime question_at datetime detailed_question_at datetime answer_at string processing_error } INTERACTION_EMBEDDING { int interaction_id PK,FK int embedding_id PK,FK } SPECIALIST_RETRIEVER { int specialist_id PK,FK int retriever_id PK,FK } SPECIALIST_DISPATCHER { int specialist_id PK,FK int dispatcher_id PK,FK } SPECIALIST_MAGIC_LINK { int id PK string name text description int specialist_id FK int tenant_make_id FK string magic_link_code datetime valid_from datetime valid_to jsonb specialist_args datetime created_at int created_by FK datetime updated_at int updated_by FK } USER { int id PK string user_name string email } TENANT_MAKE { int id PK string name text description } RETRIEVER { int id PK string name text description } EMBEDDING { int id PK string type text chunk } %% Main conversation flow USER ||--o{ CHAT_SESSION : "has many" CHAT_SESSION ||--o{ INTERACTION : "has many" SPECIALIST ||--o{ INTERACTION : "processes" %% Specialist composition (EveAI components) SPECIALIST ||--o{ EVE_AI_AGENT : "has many" SPECIALIST ||--o{ EVE_AI_TASK : "has many" SPECIALIST ||--o{ EVE_AI_TOOL : "has many" %% Specialist connections SPECIALIST ||--o{ SPECIALIST_RETRIEVER : "uses retrievers" RETRIEVER ||--o{ SPECIALIST_RETRIEVER : "used by specialists" SPECIALIST ||--o{ SPECIALIST_DISPATCHER : "uses dispatchers" DISPATCHER ||--o{ SPECIALIST_DISPATCHER : "used by specialists" %% Interaction results INTERACTION ||--o{ INTERACTION_EMBEDDING : "references embeddings" EMBEDDING ||--o{ INTERACTION_EMBEDDING : "used in interactions" %% Magic links for specialist access SPECIALIST ||--o{ SPECIALIST_MAGIC_LINK : "has magic links" TENANT_MAKE ||--o{ SPECIALIST_MAGIC_LINK : "branded links"