Skip to content

Handoff: Apply Remaining Curated Scenarios to Supabase

Context

We built 400 curated scenarios across 4 themed worlds (Frontier, Rebuild, Court & Council, Underground) plus ~98 additional Boardroom scenarios. They're stored as SQL migration files in the migrations/ directory. Some have been applied to the production Supabase database, but many haven't.

Current Database State

As of April 9, 2026:

Theme In DB Target Status
Boardroom curated 30 128 Missing: migrations/009_batch3_scenarios.sql (68), scenarios-batch-2.sql (30)
Frontier curated 60 100 Missing: batches 4+5 (migrations/043, 047)
Rebuild curated 60 100 Missing: batches 4+5 (migrations/044, 048)
Court curated 60 100 Missing: batches 4+5 (migrations/045, 049)
Underground curated 50 100 Missing: batches 3-5 partially (migrations/042 partial, 046, 050)

Supabase Project

  • Project ID: rxhsyhpkfyysuhvoccpi
  • Project name: Sync
  • Region: Central EU (Frankfurt)

Files to Apply

These SQL files need to be executed against the Supabase database. Each contains INSERT statements into the scenarios table. They can be run in any order.

Definitely NOT applied yet (need full execution): - migrations/009_batch3_scenarios.sql — 68 boardroom scenarios (source='generated', no theme column) - scenarios-batch-2.sql — 30 boardroom scenarios (source='curated', no theme column)
- migrations/043_frontier_scenarios_batch4.sql — 20 frontier scenarios - migrations/044_rebuild_scenarios_batch4.sql — 20 rebuild scenarios - migrations/045_court_council_scenarios_batch4.sql — 20 court scenarios - migrations/046_underground_scenarios_batch4.sql — 20 underground scenarios - migrations/047_frontier_scenarios_batch5.sql — 20 frontier scenarios - migrations/048_rebuild_scenarios_batch5.sql — 20 rebuild scenarios - migrations/049_court_council_scenarios_batch5.sql — 20 court scenarios - migrations/050_underground_scenarios_batch5.sql — 20 underground scenarios

Partially applied (check before running — some inserts may duplicate): - migrations/042_underground_scenarios_batch3.sql — may have 10-20 of 20 applied

NOTE about 009_batch3_scenarios.sql: This file uses source = 'generated' and does NOT include a theme column in its INSERT statements (it was written before themes existed). The scenarios will default to theme = 'boardroom' via the column default. This is correct.

NOTE about scenarios-batch-2.sql: Same as above — no theme column, defaults to boardroom.

How to Apply

Option A: Supabase SQL Editor (FASTEST - 5 minutes)

  1. Go to https://supabase.com/dashboard/project/rxhsyhpkfyysuhvoccpi/sql
  2. Open each file listed above
  3. Paste the contents into the SQL editor
  4. Click "Run"
  5. Repeat for each file

Option B: Via MCP execute_sql tool

Use mcp__supabase__execute_sql with project_id rxhsyhpkfyysuhvoccpi. The files are too large to pass in one call (~50KB each), so you need to split them. Each file contains 20 INSERT statements. You can batch ~3-5 inserts per call safely.

The batch files are pre-split at /tmp/scenario_batch_000.sql through /tmp/scenario_batch_049.sql (10 inserts each, ~25KB). Batches 000-024 have been applied. Start from batch 025.

Option C: Supabase CLI

npx supabase link --project-ref rxhsyhpkfyysuhvoccpi
# Then for each file:
cat migrations/043_frontier_scenarios_batch4.sql | npx supabase db execute
Note: requires CLI v2.84+ (current install is v2.53 which doesn't support db execute). Update first: brew upgrade supabase

Verification Query

After all files are applied, run:

SELECT theme, source, COUNT(*) as count 
FROM scenarios 
WHERE source IN ('curated', 'generated') 
GROUP BY theme, source 
ORDER BY theme, source;

Expected results: - boardroom/curated: ~60 (30 existing + 30 from batch-2) - boardroom/generated: ~165 (97 AI-generated + 68 from batch3) - court/curated: 100 - frontier/curated: 100 - rebuild/curated: 100 - underground/curated: 100

Why This Matters

The multiplayer game session start route (src/app/api/sessions/start/route.ts) was updated to serve curated scenarios FIRST before falling back to AI generation. Without the curated scenarios in the database, multiplayer always generates via AI — which sometimes produces scenarios with vague consequences and loopholes. The curated scenarios have been quality-audited with tight constraints and specific costs on every option.

Other Completed Work (for context, no action needed)

  • Quality audit: 73 of 240 agent-written scenarios were fixed for loopholes, vague costs, and combinable options
  • AI generator prompt hardened: New Rule 8 ("Airtight constraints") + option cost requirements added to src/lib/ai/scenario-generator.ts
  • Curated-first multiplayer: src/app/api/sessions/start/route.ts queries curated pool before AI generation
  • Lucide icons: Theme selector uses Building2, Rocket, Hammer, Crown, EyeOff, Sparkles
  • Theme descriptions: Richer, more evocative copy with animated description card