Supabase Integration
Overview
Centralized database layer for all Shapira ecosystem data persistence. Executes via GitHub Actions workflows - never local curl.
Connection Details
- Project URL:
https://mocerqjnksmhcjzxrewo.supabase.co
- Service Role Key: Stored in GitHub secrets as
SUPABASE_SERVICE_ROLE_KEY
- Key IAT: 1764532526
Table Schema
BidDeed.AI Tables
| Table |
Purpose |
Key Fields |
historical_auctions |
Auction records (1,393+ rows) |
case_number, judgment, sale_price, outcome |
auction_results |
Active analysis |
case_number, max_bid, recommendation, liens |
daily_metrics |
Pipeline performance |
date, properties_analyzed, accuracy |
Life OS Tables
| Table |
Purpose |
Key Fields |
tasks |
Task state machine |
id, description, state, complexity, domain |
activities |
Activity log (12+ rows) |
id, category, description, timestamp |
learning_sessions |
YouTube/podcast insights |
source, key_takeaways, business_application |
health_logs |
Sleep, energy tracking |
date, sleep_hours, energy_1_10 |
michael_swim_times |
Race results |
event, time, meet, date |
michael_nutrition |
Keto adherence |
date, day_type, meals |
michael_recruiting |
D1 outreach |
school, contact, status |
task_interventions |
ADHD intervention log |
task_id, level, timestamp |
Shared Tables
| Table |
Purpose |
Key Fields |
insights |
Cross-domain knowledge |
category, content, tags |
goals |
OKRs and targets |
domain, objective, key_result, progress |
Workflow: Insert Data
Trigger: User says "log this", task completion, auction analysis, learning capture
- Identify target table from context
- Format payload matching schema
- Execute via GitHub Actions workflow
# GitHub Actions dispatch (not local curl)
# See: .github/workflows/insert_insight.yml in both repos
Insert Patterns by Domain
BidDeed.AI - Auction Result:
{
"table": "auction_results",
"data": {
"case_number": "05-2024-CA-012345",
"property_address": "123 Main St, Melbourne, FL",
"judgment_amount": 150000,
"max_bid": 82500,
"recommendation": "BID",
"liens": [{"type": "HOA", "amount": 5000}]
}
}
Life OS - Task:
{
"table": "tasks",
"data": {
"description": "Review Q4 insurance renewals",
"state": "INITIATED",
"complexity": 6,
"clarity": 8,
"domain": "BUSINESS",
"estimated_minutes": 45
}
}
Life OS - Learning Session:
{
"table": "learning_sessions",
"data": {
"source": "YouTube: How to 10x Your Real Estate Portfolio",
"key_takeaways": ["Leverage OPM", "Focus on cash flow"],
"business_application": "Apply to Everest Capital deal structuring"
}
}
Workflow: Query Data
Trigger: "show me", "what were", "find", historical lookup
- Construct query with filters
- Execute via Supabase client
- Return formatted results
Query Examples
-- Recent tasks by domain
SELECT * FROM tasks
WHERE domain = 'BUSINESS'
AND state != 'COMPLETED'
ORDER BY created_at DESC LIMIT 10;
-- Auction performance
SELECT recommendation, COUNT(*)
FROM auction_results
GROUP BY recommendation;
-- Michael's best times by event
SELECT event, MIN(time) as pr
FROM michael_swim_times
GROUP BY event;
LangGraph Integration
Input Schema
class SupabaseInput(TypedDict):
operation: str # "insert" | "query" | "update"
table: str
data: dict # For insert/update
filters: dict # For query
Output Schema
class SupabaseOutput(TypedDict):
success: bool
rows_affected: int
data: list # Query results
error: Optional[str]
Node Implementation
def supabase_node(state: dict) -> dict:
"""Execute Supabase operation as LangGraph node."""
from supabase import create_client
client = create_client(
"https://mocerqjnksmhcjzxrewo.supabase.co",
os.environ["SUPABASE_SERVICE_ROLE_KEY"]
)
if state["operation"] == "insert":
result = client.table(state["table"]).insert(state["data"]).execute()
elif state["operation"] == "query":
query = client.table(state["table"]).select("*")
for k, v in state["filters"].items():
query = query.eq(k, v)
result = query.execute()
return {"success": True, "data": result.data}
Scripts
scripts/insert_insight.py - Generic insert with validation
scripts/query_builder.py - Dynamic query construction
References
references/schema_details.md - Full column definitions and constraints
references/migration_history.md - Schema evolution log
Best Practices
- Always use GitHub Actions - Never local curl to Supabase
- Validate before insert - Check required fields
- Use timestamps - All tables have created_at/updated_at
- Category consistency - Use defined categories (BUSINESS, MICHAEL, FAMILY, PERSONAL)
1---2name: supabase-integration3description: Unified database operations for BidDeed.AI and Life OS ecosystems. Use when: (1) logging insights, activities, or learning sessions, (2) querying historical data from any table, (3) user says "log this" or "save to database", (4) storing auction results, task states, swim times, or health metrics. Database: mocerqjnksmhcjzxrewo.supabase.co4---5
6# Supabase Integration
7
8## Overview
9
10Centralized database layer for all Shapira ecosystem data persistence. Executes via GitHub Actions workflows - never local curl.
11
12## Connection Details
13
14- **Project URL:** `https://mocerqjnksmhcjzxrewo.supabase.co`
15- **Service Role Key:** Stored in GitHub secrets as `SUPABASE_SERVICE_ROLE_KEY`
16- **Key IAT:** 1764532526
17
18## Table Schema
19
20### BidDeed.AI Tables
21| Table | Purpose | Key Fields |
22|-------|---------|------------|
23| `historical_auctions` | Auction records (1,393+ rows) | case_number, judgment, sale_price, outcome |
24| `auction_results` | Active analysis | case_number, max_bid, recommendation, liens |
25| `daily_metrics` | Pipeline performance | date, properties_analyzed, accuracy |
26
27### Life OS Tables
28| Table | Purpose | Key Fields |
29|-------|---------|------------|
30| `tasks` | Task state machine | id, description, state, complexity, domain |
31| `activities` | Activity log (12+ rows) | id, category, description, timestamp |
32| `learning_sessions` | YouTube/podcast insights | source, key_takeaways, business_application |
33| `health_logs` | Sleep, energy tracking | date, sleep_hours, energy_1_10 |
34| `michael_swim_times` | Race results | event, time, meet, date |
35| `michael_nutrition` | Keto adherence | date, day_type, meals |
36| `michael_recruiting` | D1 outreach | school, contact, status |
37| `task_interventions` | ADHD intervention log | task_id, level, timestamp |
38
39### Shared Tables
40| Table | Purpose | Key Fields |
41|-------|---------|------------|
42| `insights` | Cross-domain knowledge | category, content, tags |
43| `goals` | OKRs and targets | domain, objective, key_result, progress |
44
45## Workflow: Insert Data
46
47**Trigger:** User says "log this", task completion, auction analysis, learning capture
48
491. Identify target table from context
502. Format payload matching schema
513. Execute via GitHub Actions workflow
52
53```bash
54# GitHub Actions dispatch (not local curl)
55# See: .github/workflows/insert_insight.yml in both repos
56```
57
58### Insert Patterns by Domain
59
60**BidDeed.AI - Auction Result:**
61```json
62{
63 "table": "auction_results",
64 "data": {
65 "case_number": "05-2024-CA-012345",
66 "property_address": "123 Main St, Melbourne, FL",
67 "judgment_amount": 150000,
68 "max_bid": 82500,
69 "recommendation": "BID",
70 "liens": [{"type": "HOA", "amount": 5000}]
71 }
72}
73```
74
75**Life OS - Task:**
76```json
77{
78 "table": "tasks",
79 "data": {
80 "description": "Review Q4 insurance renewals",
81 "state": "INITIATED",
82 "complexity": 6,
83 "clarity": 8,
84 "domain": "BUSINESS",
85 "estimated_minutes": 45
86 }
87}
88```
89
90**Life OS - Learning Session:**
91```json
92{
93 "table": "learning_sessions",
94 "data": {
95 "source": "YouTube: How to 10x Your Real Estate Portfolio",
96 "key_takeaways": ["Leverage OPM", "Focus on cash flow"],
97 "business_application": "Apply to Everest Capital deal structuring"
98 }
99}
100```
101
102## Workflow: Query Data
103
104**Trigger:** "show me", "what were", "find", historical lookup
105
1061. Construct query with filters
1072. Execute via Supabase client
1083. Return formatted results
109
110### Query Examples
111
112```sql
113-- Recent tasks by domain
114SELECT * FROM tasks
115WHERE domain = 'BUSINESS'
116AND state != 'COMPLETED'
117ORDER BY created_at DESC LIMIT 10;
118
119-- Auction performance
120SELECT recommendation, COUNT(*)
121FROM auction_results
122GROUP BY recommendation;
123
124-- Michael's best times by event
125SELECT event, MIN(time) as pr
126FROM michael_swim_times
127GROUP BY event;
128```
129
130## LangGraph Integration
131
132### Input Schema
133```python
134class SupabaseInput(TypedDict):
135 operation: str # "insert" | "query" | "update"
136 table: str
137 data: dict # For insert/update
138 filters: dict # For query
139```
140
141### Output Schema
142```python
143class SupabaseOutput(TypedDict):
144 success: bool
145 rows_affected: int
146 data: list # Query results
147 error: Optional[str]
148```
149
150### Node Implementation
151```python
152def supabase_node(state: dict) -> dict:
153 """Execute Supabase operation as LangGraph node."""
154 from supabase import create_client
155
156 client = create_client(
157 "https://mocerqjnksmhcjzxrewo.supabase.co",
158 os.environ["SUPABASE_SERVICE_ROLE_KEY"]
159 )
160
161 if state["operation"] == "insert":
162 result = client.table(state["table"]).insert(state["data"]).execute()
163 elif state["operation"] == "query":
164 query = client.table(state["table"]).select("*")
165 for k, v in state["filters"].items():
166 query = query.eq(k, v)
167 result = query.execute()
168
169 return {"success": True, "data": result.data}
170```
171
172## Scripts
173
174- `scripts/insert_insight.py` - Generic insert with validation
175- `scripts/query_builder.py` - Dynamic query construction
176
177## References
178
179- `references/schema_details.md` - Full column definitions and constraints
180- `references/migration_history.md` - Schema evolution log
181
182## Best Practices
183
1841. **Always use GitHub Actions** - Never local curl to Supabase
1852. **Validate before insert** - Check required fields
1863. **Use timestamps** - All tables have created_at/updated_at
1874. **Category consistency** - Use defined categories (BUSINESS, MICHAEL, FAMILY, PERSONAL)