Data Models
All models are defined in models.py, using SQLAlchemy 2.x declarative syntax, inheriting from DeclarativeBase. Database is SQLite with WAL mode enabled.
Entity Relationship Diagram
Photo (Screenshots)
Table name: photos
Unique constraint: (device_id, local_media_store_id) -- same device's same screenshot won't be duplicated.
Relationship: analysis -- one-to-one with Analysis, cascade delete-orphan, selectin loading strategy.
Analysis (Analysis Results)
Table name: analyses
AnalysisStatus Enum Values:
class AnalysisStatus(str, enum.Enum):
PENDING = "pending" # Waiting to be processed
PROCESSING = "processing" # Currently analyzing
DONE = "done" # Analysis complete
ERROR = "error" # Analysis failed
Conversation (Chat Conversations)
Table name: conversations
Relationship: messages -- one-to-many with ChatMessage, ordered by created_at, cascade delete-orphan.
ChatMessage (Chat Messages)
Table name: chat_messages
Properties:
display_content-- Returns decrypted content ifencrypted_contentexists, otherwise returnscontent
Dynamic (Dynamic Notes)
Table name: dynamics
Articles/notes generated by the background intent reasoner.
Memory (Memories)
Table name: memories
Agent memory system, divided into short-term (48h expiry) and long-term (permanent).
Unique constraint: (device_id, content_hash) -- same device won't store duplicate memories.
DeviceToken (Push Devices)
Table name: device_tokens
DeviceSyncState (Device Sync State)
Table name: device_sync_state
Skill (Skills)
Table name: skills
Default Skills:
| ID | Name | Icon | Description |
|---|---|---|---|
| summarize | Summarize Screenshots | 📝 | Analyze recent screenshots, generate summary notes |
| reminders | Extract Reminders | ⏰ | Extract all reminders from screenshots |
| research | Deep Research | 🔬 | Deep research on screenshot topics |
| stock | Stock Analysis | 📈 | Organize financial information from screenshots |
MCPServer (MCP Servers)
Table name: mcp_servers
LLMConfig (LLM Configuration)
Table name: llm_config
Single-row config table (fixed id=1), stores LLM provider configuration.
:::warning Security Note
api_key is stored in plaintext in the database. API responses do not return the actual value, only api_key_set: true/false. Production environments should use the EVATAR_ENCRYPTION_KEY environment variable with Fernet encryption.
:::