HiddenBag Pipeline Rework Prompt
Copy this into Claude Code from the hiddenbag-v2 directory:
I need to rework our entire betting picks pipeline. The goal: Discord server (1469086083701542956) becomes the SINGLE SOURCE OF TRUTH for all capper picks flowing into Supabase.
CURRENT STATE (research these files first):
- Schema: FULL_MIGRATION.sql (hb_cappers, hb_picks, hb_discord_messages, hb_game_odds, hb_consensus_snapshots)
- Consensus SQL: C:\Users\mpmmo\dailyai-picks-local\sql\supabase-consensus-v2.sql
- Consensus spec: CONSENSUS-TRACKER-SPEC.md
- Sheets sync: scripts/sheets-to-supabase.py
- Routing config: C:\Users\mpmmo\FULL-LOCAL-PRODUCTION\routing_config.json
- Capper list: cappersnames.txt (79 cappers)
DISCORD SERVER CHANNEL MAP (1469086083701542956 — "THB WORK SPLIT"):
VIP CAPPERS (36 channels):
| Channel | Channel ID | Capper |
|---|---|---|
| king-cap | 1469086490498961609 | King Cap |
| jacav | 1469086512950804520 | JaCav |
| fivestar | 1469086532114579518 | FiveStar |
| razzaq-locks | 1469086559960830063 | Razzaq Locks |
| cesarsportsbets | 1469086599139557495 | Cesar Sports Bets |
| parlaytravy | 1469086632962429081 | Parlay Travy |
| seanperrywins | 1469086664688271564 | Sean Perry Wins |
| yourdailycapper | 1469086685408137360 | Your Daily Capper |
| thecappercollective | 1469086720900206817 | The Capper Collective |
| isellwinners | 1469086744032055448 | I Sell Winners |
| vegasmirabets | 1469087866310365396 | Vegas Mira Bets |
| chamba | 1469087879031685253 | Chamba |
| vinny | 1469087893338456176 | Vinny |
| laformula | 1469087914502787153 | La Formula |
| jaylink | 1469087930357383412 | JayLink |
| vonn | 1469087943447543939 | Vonn |
| anon | 1469087950271680737 | Anon |
| thesportbetking | 1469087974107910257 | The Sport Bet King |
| leeschosenpicks | 1469088038859702499 | Lees Chosen Picks |
| uatb | 1469088054919696425 | UATB |
| monumnetal | 1469088089812238487 | Monumental |
| mrexclusive | 1469088109718143218 | Mr Exclusive |
| ampm | 1469088123714670654 | AMPM |
| afsports | 1469088149513961617 | AF Sports |
| kleos | 1469088159110529024 | Kleos |
| fernpicks | 1469088174423806135 | Fern Picks |
| fredo | 1469088215657877606 | Fredo |
| trustmysystem | 1469088241515892776 | Trust My System |
| cblez | 1469088260130209989 | CBLez |
| beezowins | 1469088289188479140 | Beezo Wins |
| algopicks | 1469088306317758576 | Algo Picks |
| tbsportsbetting | 1469088333874335941 | TB Sports Betting |
| nickycashin | 1469088346373361823 | Nicky Cashin |
| vezinolocks | 1469088375096086535 | Vezino Locks |
| provenwinner | 1469088388245229661 | Proven Winner |
| bonus-vip | 1469088404104020079 | BONUS VIP (multi-capper) |
free cappers (41 channels):
| Channel | Channel ID | Capper |
|---|---|---|
| a11 | 1469426329006116895 | A11 Bets |
| anderspicks | 1469426369409585172 | Anders Picks |
| analyticscapper | 1469426392600023111 | Analytics Capper |
| brandontheprofit | 1469426442734665909 | Brandon The Profit |
| betsharper | 1469426463399739547 | Bet Sharper |
| bulliespicks | 1469426476154622096 | Bullies Picks |
| calebpicks | 1469426490318917828 | Caleb Picks |
| cashcing | 1469426512490004718 | Cash Cing |
| cashitbaby | 1469426532257890496 | Cash It Baby |
| duckinvestments | 1469426564260171887 | Duck Investments |
| platinumlocks | 1469426592437637141 | Platinum Locks |
| profiticscports | 1469426624662343751 | Profitics Sports |
| smartmoneysports | 1469426644577157396 | Smart Money Sports |
| sharpinvestments | 1469426666618097859 | Sharp Investments |
| pickprophet | 1469426697328918784 | Pick Prophet |
| hammering-hank | 1469437872347287722 | Hammering Hank |
| pardonmypick | 1469437894358859979 | Pardon My Pick |
| porterpicks | 1469437922137870367 | Porter Picks |
| kimspicks | 1469437942316535849 | Kims Picks |
| seekingreturns | 1469437955713270103 | Seeking Returns |
| thesharpsheets | 1469437977099895048 | The Sharp Sheets |
| ncsharp | 1469437991318454487 | NC Sharp |
| picks4days | 1469438005839266057 | Picks 4 Days |
| mathewp07 | 1469438035673481286 | Mathew P07 |
| mcbets | 1469438052219748574 | MC Bets |
| learlocks | 1469438071152967782 | Lear Locks |
| propjoe | 1469438090291449907 | Prop Joe |
| darthfader | 1469438110302732471 | Darth Fader |
| outoflinebets | 1469438139641757766 | Out Of Line Bets |
| parlaysafari | 1469438154246197248 | Parlay Safari |
| ttw | 1469438194905907472 | TTW |
| a1fantasy | 1469438231488626698 | A1 Fantasy |
| setpointbets | 1469438251159912479 | Set Point Bets |
| newmarktennis | 1469438354490917127 | Newmark Tennis |
| matchpointbets | 1469438384819933218 | Match Point Bets |
| bonusfree | 1469438421058453659 | BONUS FREE (multi-capper) |
| cody-covers-spreads | 1469721592631267592 | Cody Covers Spreads |
| midwest-mike | 1469721730577596616 | Midwest Mike |
| sensisam | 1469721866443690055 | Sensei Sam |
| itstroywest | 1469722044894675140 | Its Troy West |
| qsportsai | 1469722141766455480 | Q Sports AI |
KNOWN MULTI-CAPPER CHANNELS (require author parsing):
- bonus-vip (1469088404104020079) — VIP bundle, multiple cappers post here
- bonusfree (1469438421058453659) — Free bundle, multiple cappers post here
- thecappercollective (1469086720900206817) — Collective channel
KNOWN CAPPER ALIASES (same person, different names):
| Canonical Name | Known Aliases |
|---|---|
| Monumental | monumnetal, monumental |
| JayLink | jaylink, jaylan1k |
| Vegas Mira Bets | vegasmirabets, vegasmirabet |
| A11 Bets | a11, a11bets |
| Sensei Sam | sensisam, senseisam |
| Picks 4 Days | picks4days, picks4dayzzz |
| Mathew P07 | mathewp07, matthewp07 |
| Profitics Sports | profiticscports, profiticsports |
| Midwest Mike | midwest-mike, midwestmike |
| Cody Covers Spreads | cody-covers-spreads, codycoverspreads |
| Hammering Hank | hammering-hank, hammeringhank |
| Bonus Free | bonusfree, bonus-free |
NEW ARCHITECTURE:
Data Sources (Priority Order):
- Discord Bot listening to server 1469086083701542956 — every channel, every message
- Google Sheets (existing AllPicks/Picks tabs) for sources not in Discord
- Both feed into the SAME Supabase tables
New/Modified Tables Needed:
hb_discord_channels (NEW — track every channel):
- channel_id, channel_name, server_id
- source_type: 'single_capper' | 'multi_capper' | 'algo' | 'aggregate'
- default_capper_id (for single-capper channels)
- is_active, created_at
hb_raw_messages (NEW — store EVERYTHING before parsing):
- message_id, channel_id, author_name, content, attachments_json
- source: 'discord' | 'sheets' | 'telegram'
- parsed_status: 'pending' | 'parsed' | 'failed' | 'skipped'
- parsed_at, error_message
- This is our audit trail — never delete raw data
hb_cappers (MODIFY):
- Add: discord_channel_id, aliases TEXT[] (array of known name variations)
- Add: source_priority ('discord' | 'sheets' | 'telegram')
- Add: auto_detected BOOLEAN (for new cappers found by parser)
hb_picks (MODIFY):
- Add: source_message_id (FK to hb_raw_messages)
- Add: source_type ('discord' | 'sheets' | 'telegram')
- Add: confidence_score (0-100, how sure parser is about the parse)
- Add: parse_method ('regex' | 'vision' | 'manual' | 'sheets_import')
hb_capper_aliases (NEW — solve the fragmentation problem):
- alias_text, canonical_capper_id
- This replaces the current broken duplicate-name system
Multi-Capper Channel Splitting:
Some Discord channels contain picks from MULTIPLE cappers. The bot needs to:
- Check if channel is 'multi_capper' type
- Parse author name / embedded capper name from message content
- Match to hb_capper_aliases → resolve to canonical capper
- If no match, flag as 'new_capper_detected' for review
Pipeline Flow:
Discord Message → hb_raw_messages (store raw) → Parser (regex + vision for images) → hb_picks (normalized, linked to capper) → Consensus SQL (find 2+ cappers on same side) → hb_consensus_snapshots → Auto-grading (scores from hb_game_odds)
CSV Export for Validation:
- Script to dump hb_picks to CSV with: date, capper, sport, team, line, odds, units, result, source, confidence
- Script to dump consensus plays to CSV
- Use these to verify data quality before trusting the pipeline
What I need you to build:
- SQL migration for all new/modified tables above
- Discord bot listener (Node.js, discord.js) that captures every message from the server
- Parser module that extracts picks from messages (handle text + image attachments)
- Alias resolution system for capper name matching
- CSV export scripts for validation
- Migration script to backfill existing hb_picks with source info
- Dashboard page or API endpoint showing: messages collected, parse rate, unmatched cappers, confidence distribution