docs/diagrams/data-model.mmd
erDiagram SETTINGS { string key PK text value datetime updated_at }
MESSAGES {
string message_id PK
datetime created_at
string guild_id
string channel_id
string author_id
string author_name
int is_bot
text content
string referenced_message_id
}
ACTIONS {
int id PK
datetime created_at
string guild_id
string channel_id
string message_id
string user_id
string kind
text content
text metadata
float usd_cost
}
MEMORY_FACTS {
int id PK
datetime created_at
datetime updated_at
string scope
string guild_id
string channel_id
string user_id
string subject
string fact
string fact_type
string evidence_text
string source_message_id
float confidence
int is_active
}
MEMORY_FACT_VECTORS_NATIVE {
int fact_id
string model
int dims
blob embedding_blob
datetime updated_at
}
MESSAGE_VECTORS_NATIVE {
string message_id
string model
int dims
blob embedding_blob
datetime updated_at
}
SHARED_LINKS {
string url PK
datetime first_shared_at
datetime last_shared_at
int share_count
string source
}
AUTOMATIONS {
int id PK
datetime created_at
datetime updated_at
string guild_id
string channel_id
string created_by_user_id
string created_by_name
string title
text instruction
text schedule_json
datetime next_run_at
string status
int is_running
datetime running_started_at
datetime last_run_at
text last_error
text last_result
text match_text
}
AUTOMATION_RUNS {
int id PK
int automation_id
datetime created_at
datetime started_at
datetime finished_at
string status
text summary
text error
string message_id
text metadata
}
RESPONSE_TRIGGERS {
string trigger_message_id PK
int action_id
datetime created_at
}
REFLECTION_CHECKPOINTS {
string date_key PK
string guild_id PK
datetime completed_at
string run_id
}
SESSION_SUMMARIES {
string session_id PK
datetime created_at
datetime updated_at
string guild_id
string channel_id
string modality
datetime started_at
datetime ended_at
text summary_text
}
MESSAGES ||--o{ ACTIONS : "message_id (context/trigger)"
MESSAGES ||--o{ MEMORY_FACTS : "source_message_id"
MEMORY_FACTS ||--o{ MEMORY_FACT_VECTORS_NATIVE : "fact_id"
MESSAGES ||--o{ MESSAGE_VECTORS_NATIVE : "message_id"
MESSAGES ||--o{ MESSAGES : "referenced_message_id"
AUTOMATIONS ||--o{ AUTOMATION_RUNS : "automation_id"
MESSAGES ||--o{ AUTOMATION_RUNS : "message_id (automation output)"
MESSAGES ||--o| RESPONSE_TRIGGERS : "trigger_message_id"
ACTIONS ||--o{ RESPONSE_TRIGGERS : "action_id"
