# LOBBY TRACKER ARGENTINA — Session Handoff
**Generated:** 2026-05-01 ~21:00 UTC-3  
**Previous Agent:** Pipo (Hermes), serving Ignacio "Chicho" Lagos Ruiz  
**For:** ChatGPT 5.5 — continuation session

---

## 1. PROJECT IDENTITY

**Project:** Lobby Tracker Argentina  
**What it is:** A Next.js 14 web app that tracks political connections between Argentine politicians and Israel lobby groups — contracts, trips, appointments. Collectible-card style UI. Dark theme, red/black palette.  
**Domain:** https://lobbytracker.vercel.app  
**Primary Goal:** Document public-money flows and connections. "Seguí el dinero. Seguí los contratos. Seguí las conexiones."  
**Hard Constraints:** Only public sources. Every connection must have verifiable evidence. No AI-invented data. Editorial images must be clearly labeled as such.

---

## 2. WHAT EXISTS RIGHT NOW

### Deployed & Working
- **Frontend:** Next.js 14 (App Router) deployed on Vercel  
  - `/` — Home page with hero, stats (ARS/USD), politician card grid, search  
  - `/p/[id]` — Detail page with connection timeline per politician
- **Database:** Supabase (PostgreSQL 17) — project `lobbytracker`, region `sa-east-1` (São Paulo)  
  - Tables: `politicians`, `lobby_groups`, `connections`, `evidence`  
  - RLS enabled — public read-only, no write access  
- **Seed data:** Horacio Rodríguez Larreta (1 politician, 4 lobby groups, 7 connections)

### Key Credentials & IDs ✅ HIGH CONFIDENCE
| What | Value |
|---|---|
| Supabase Project Ref | `xvrlnhwbvyyydnnzctbk` |
| Supabase URL | `https://xvrlnhwbvyyydnnzctbk.supabase.co` |
| Vercel Project ID | `prj_KC4GBo5ApiPqbNjRcjWBFUPT1oMf` |
| Supabase Anon Key | `sb_publishable_zi-E4qkqGxVRRt9Ym8-Rrw_Iq_g2WAP` |
| Supabase Access Token | `sbp_80...3710` (in env — full token in `$SUPABASE_ACCESS_TOKEN`) |
| Vercel Token | Available in `$VERCEL_TOKEN` |
| Deploy command | `cd /home/ubuntu/lobbytracker && vercel --prod --yes` |
| DB SQL endpoint | `POST https://api.supabase.com/v1/projects/xvrlnhwbvyyydnnzctbk/database/query` |

### Source Files (all in `/home/ubuntu/lobbytracker/src/`)
```
src/
├── app/
│   ├── globals.css          # Tailwind + dark theme
│   ├── layout.tsx           # Root layout
│   ├── page.tsx             # Home page (hero, grid, search)
│   └── p/[id]/page.tsx      # Politician detail page
└── lib/
    └── supabase.ts          # Supabase client singleton
```

### Supabase Schema
```sql
politicians (id, name, position, jurisdiction, party, image_url, total_lobby_ars, total_lobby_usd, status, qr_url, bio)
lobby_groups (id, name, acronym, description, website)
connections (id, politician_id FK, lobby_group_id FK, connection_type, amount_ars, amount_usd, date, description)
evidence (id, connection_id FK, source_url, source_name, evidence_type, excerpt)
```

### Recent Fix Applied (this session)
The build was failing on Vercel because Supabase's `.then()` returns `PromiseLike<void>` (not `Promise`), so `.catch()` doesn't exist on it. Fix: converted all Supabase queries from `.then().catch()` to `async/await` with `try/catch` in `page.tsx` line 35 and `p/[id]/page.tsx` line 47.

---

## 3. DECISIONS MADE & WHY

| Decision | Reasoning |
|---|---|
| Supabase in São Paulo (sa-east-1) | Lowest latency from Argentina |
| RLS public read-only | No auth needed, data is public info |
| `async/await` over `.then().catch()` | TypeScript compatibility with Supabase types |
| Vercel CLI deploy (not GitHub) | Project has no git repo connected to Vercel |
| Dark theme (red/black) | Matches "serious investigation" vibe, AIPAC Tracker aesthetic |
| Cards show ARS + USD | User wants dual-currency display |

---

## 4. WHAT REMAINS TO BE DONE

### NEXT TASK #1 (HIGH PRIORITY): Weekly Source Update Agent System ⚠️ MEDIUM
Create an autonomous agent system that runs weekly (cron job) and:
1. Iterates through all politicians in the DB
2. For each, spawns a subagent (`delegate_task`) to search for NEW public developments (legal cases, new contracts, news)
3. Compares findings against existing `connections` to avoid duplicates
4. Inserts new connections with full `evidence` rows (source_url, source_name, excerpt)
5. Updates `total_lobby_ars` and `total_lobby_usd` on affected politicians

**Architecture plan:**
- 1 cron job (weekly) that loads politicians → dispatches subagents in parallel
- Each subagent: web_search → web_extract → compare with DB → insert if new
- Evidence MUST cite real sources (BAC/Compr.ar, Boletín Oficial, court rulings, journalism)
- Use Hermes tools: `terminal`, `web_search`, `web_extract`, `delegate_task`
- Save as a skill: `~/.hermes/skills/lobbytracker-updater/SKILL.md`

**Gotchas:**
- The DB is public read-only. Inserts must use `SUPABASE_ACCESS_TOKEN` via Management API
- Date columns need `::date` casting in SQL (PostgreSQL type safety)
- Supabase pooler host pattern: `aws-0-sa-east-1.pooler.supabase.com:6543`
- This server (Oracle Cloud) can't reach IPv6 direct DB hosts — use pooler or Management API

### NEXT TASK #2 (MEDIUM PRIORITY): Video/GIF Generation from Larreta Short ⚠️ MEDIUM
YouTube short: `https://youtube.com/shorts/xgJPfx4WI1s` — Larreta in a "tetrical" moment. User wants AI-generated remix/GIF for the politician detail page.

**What was attempted:**
- yt-dlp from Oracle Cloud IP → blocked (datacenter IP detection)
- Pixel 6a exit node → device offline for 20+ days
- Web-based downloaders → no reliable API
- deno runtime → couldn't install (no `unzip` on server)

**What the user can do:**
- Download the short from his phone and send as file via Telegram
- OR paste the URL directly into Kling AI / Runway / Pika Labs (these accept YouTube URLs)
- Recommended: **Kling AI** (free tier, klingai.com) or **Runway Gen-3** ($15/mes)

**If the video file becomes available on the server:**
- Convert to GIF: `ffmpeg -i video.mp4 -vf "fps=10,scale=480:-1" output.gif`
- Embed in detail page as visual element
- Use Gemini via OpenRouter to transcribe/describe the scene for editorial text

### NEXT TASK #3 (LOW PRIORITY): Add More Politicians
User wants to expand beyond Larreta. Each politician needs:
- Research (real connections, sources)
- SQL INSERT via Management API
- Card on the home page auto-populates via Supabase query

---

## 5. DO NOT TOUCH LIST

- **Don't change the Supabase project/region** — already optimized for latency
- **Don't modify RLS policies** — public read-only is intentional
- **Don't refactor the card component** — user approved the current design
- **Don't add auth/login** — user explicitly wants public access
- **Don't remove the `status` field** — red/green badge system stays
- **Don't invent data** — every connection must have a real source
- **Don't change the color scheme** — dark red/black is the brand

---

## 6. KNOWN ISSUES & RISKS

| Issue | Severity | Mitigation |
|---|---|---|
| YouTube blocks datacenter IPs | High | Use phone download, web-based AI tools, or residential proxy |
| Pixel 6a exit node offline | Medium | Device needs to be powered on and Tailscale connected |
| Free Supabase plan (2 active projects) | Low | Other projects are paused (INACTIVE) |
| No git repo on server | Medium | Deploy via `vercel --prod` CLI only |
| TypeScript build strictness | Medium | Always test with `npm run build` locally before deploy |

---

## 7. USER PROFILE (Chicho)

- Argentine, lives in Colegiales, Buenos Aires
- Full-stack developer (Vercel, Supabase, Next.js)
- Prefers DIRECT, no-filler responses — skip "Great idea!" pleasantries
- Pushes AI to be autonomous and find solutions, not present roadblocks
- Cost-conscious but values quality (prefers premium models for final output)
- Wife Tina (pregnant, ~31 weeks as of May 2026), dog Chivi
- Uses Telegram as primary interface, no Apple devices
- YouTube Music > Spotify, Asana > Trello

---

## 8. RESUME PROMPT

Copy-paste this into a fresh ChatGPT/Claude session:

---

**START RESUME PROMPT**

You are continuing work on **Lobby Tracker Argentina** — a Next.js 14 web app tracking political connections between Argentine politicians and Israel lobby groups. 

Read the full handoff at: `/home/ubuntu/lobbytracker/HANDOFF.md` on the server, or read the HANDOFF.md file attached to this conversation.

**Server access:** Ubuntu 24.04 ARM64, Oracle Cloud São Paulo. Node.js v22, Python 3.12. SSH via Tailscale at `miopenclaw-vnic.tail9799d2.ts.net`.

**Key credentials (in env):**
- `SUPABASE_ACCESS_TOKEN=sbp_80...` (for Management API)
- `VERCEL_TOKEN` (for deploys)
- Supabase anon key: `sb_publishable_zi-E4qkqGxVRRt9Ym8-Rrw_Iq_g2WAP`
- Supabase project ref: `xvrlnhwbvyyydnnzctbk`
- Vercel project ID: `prj_KC4GBo5ApiPqbNjRcjWBFUPT1oMf`

**Current state:** Site is LIVE at https://lobbytracker.vercel.app with Larreta loaded. Build error fixed (async/await for Supabase). Database has 1 politician, 4 lobby groups, 7 connections.

**Do these things (in order):**

1. **FIRST: Verify you can access everything.** Run `curl -s https://lobbytracker.vercel.app | head -5` and confirm HTTP 200. Then query Supabase: `curl -s "https://xvrlnhwbvyyydnnzctbk.supabase.co/rest/v1/politicians" -H "apikey: sb_publishable_zi-E4qkqGxVRRt9Ym8-Rrw_Iq_g2WAP"` and confirm Larreta appears.

2. **SECOND: Build the weekly source update agent.** Create a skill at `~/.hermes/skills/lobbytracker-updater/SKILL.md` with:
   - A cron job that runs every Sunday
   - Iterates politicians from DB → spawns subagents via `delegate_task`
   - Each subagent: web_search for recent news/legal developments → web_extract sources → compare with existing connections → insert new ones via Supabase Management API
   - Updates `total_lobby_ars` and `total_lobby_usd` on affected politicians
   - Every new connection MUST have an `evidence` row with source_url

3. **THIRD: Ask Chicho** if he downloaded the Larreta YouTube short (https://youtube.com/shorts/xgJPfx4WI1s). If yes, convert to GIF and discuss embedding in the detail page.

**Communication style:** Direct, no filler. Spanish. Chicho hates excuses — find solutions, not roadblocks. If something doesn't work, try 3+ alternatives before reporting failure.

**USER DIRECTIVE:** Verify the site is working, then build the weekly agent system. Propose the most strategic next action after that and wait for confirmation.

**END RESUME PROMPT**

---

## FILE SAVE INFO
Saved to: `/home/ubuntu/lobbytracker/HANDOFF.md`
