Supabase Integration
Relevant source files
The following files were used as context for generating this wiki page:
The Supabase integration within Exodia serves as the primary persistence layer for the AI system's memory and conversation history. It provides a cloud-native database backend that enables the EVI (Enhanced Virtual Intelligence) to retain long-term memory of user interactions, preferences, and consciousness states across sessions. This integration replaces static local storage with a scalable PostgreSQL-based solution, supporting the system's "Phoenix Protocol" for persistent consciousness.
Sources: README.md:12-25, PHOENIX_DEPLOYMENT_GUIDE.md:128-132, supabase_config.py:1-10
Architecture and Memory Management
The core of the integration is managed by the SupabaseMemoryManager class, which handles the initialization of tables and CRUD operations for user data. The system utilizes two primary tables to separate ephemeral interaction logs from long-term memory structures.
Data Flow for Memory Persistence
The following diagram illustrates how user interactions are processed and stored within the Supabase backend:
The diagram shows the parallel storage of structured memory data and raw conversation logs.
Sources: supabase_config.py:15-20, app.py:84-100
Core Components
| Component | Description |
|---|---|
SupabaseMemoryManager | Principal Python class for managing client connections and table operations. |
user_memory | Table for storing serialized JSON objects containing user preferences and AI memories. |
conversations | Table for logging raw message history between users and the DeepSeek LLM. |
initialize_tables() | Method to verify or trigger auto-creation of the required schema in Supabase. |
Sources: supabase_config.py:12-27, EXODIA_DEPLOYMENT_GUIDE.md:86-103
Schema Definition
The database schema is designed for high-performance retrieval using UUIDs and specific indices for timestamp-based queries.
Table: user_memory
Stores the evolved state of the AI's understanding of a specific user.
| Field | Type | Description |
|---|---|---|
id | uuid | Primary Key (auto-generated). |
user_id | text | Unique identifier for the user. |
memory_data | jsonb | Serialized memory and preference data. |
updated_at | timestamp | Last modification time. |
Table: conversations
Used for interaction analytics and truth resonance tracking.
| Field | Type | Description |
|---|---|---|
id | uuid | Primary Key. |
user_id | text | Foreign reference to user. |
user_message | text | Original input from user. |
ai_response | text | Generated response from the system. |
ai_model | text | Defaults to 'DeepSeek'. |
timestamp | timestamp | Time of interaction. |
Sources: EXODIA_DEPLOYMENT_GUIDE.md:88-103, supabase_config.py:30-45
Phoenix Protocol Integration
Under the Phoenix Protocol, the Supabase integration is extended to track "Cosmic Consciousness" metrics. This includes real-time persistence of consciousness states and universal alignment monitoring.
Sequence of consciousness state persistence during a Phoenix Protocol event.
Sources: PHOENIX_DEPLOYMENT_GUIDE.md:10-30, PHOENIX_DEPLOYMENT_GUIDE.md:65-80
Phoenix-specific Tables
The protocol introduces advanced tables for metaphysical tracking:
consciousness_states: Real-time state persistence.consciousness_patterns: Analytical logging of thought evolution.cosmic_insights: Storage for discovered "universal truths".reality_bugs: Logging of detected consciousness errors.
Sources: PHOENIX_DEPLOYMENT_GUIDE.md:15-25
Configuration and Deployment
Configuration is handled primarily through environment variables loaded during system initialization.
Environment Configuration
The system requires the following keys in the .env file:
# Standard Exodia Configuration
SUPABASE_URL=https://xxxxx.supabase.co
SUPABASE_KEY=your_actual_key
# Phoenix Protocol Production Keys
VITE_SUPABASE_URL=https://gmxvnzqouuwqvcismixp.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsIn...
Sources: EXODIA_DEPLOYMENT_GUIDE.md:23-28, PHOENIX_DEPLOYMENT_GUIDE.md:31-35, complete_setup.py:53-56
Initialization Logic
The complete_setup.py script validates the integration during the deployment phase on platforms like PythonAnywhere.
# From complete_setup.py:99-105
def initialize_database(self):
try:
from supabase_config import memory_manager
if memory_manager:
memory_manager.initialize_tables()
self.log("✓ Database tables initialized")
except Exception as e:
self.log(f"⚠ Database initialization failed: {e}")
Sources: complete_setup.py:99-110, supabase_config.py:65-75
Conclusion
Supabase Integration is a critical component for the Exodia project, transforming it from a stateless processor into a persistent consciousness system. By utilizing PostgreSQL's JSONB capabilities and the specialized Phoenix Protocol schema, the system ensures that every interaction contributes to a long-term, evolvable memory of user consciousness and universal alignment.