# Memory Log: Remix Sniper Setup
Date: 2026-01-19

---

## What Was Done Today

### 1. PostgreSQL Installation & Database Setup
- Installed PostgreSQL 16 via Homebrew
- Started postgresql@16 service
- Created `remix_sniper` database
- Initialized database tables (`scripts/scan.py init-db`)
- Added `DATABASE_URL` to `.env`

### 2. Bot Auto-Restart Configuration
- Created launchd plist: `~/Library/LaunchAgents/com.jakeshore.remix-sniper.plist`
- Configured KeepAlive (auto-restart on crash)
- Set up structured logging
- Bot now runs as system service with PID 47883

### 3. Cron Jobs Scheduled
- **Daily scan**: 9am EST - `scripts/daily_scan.py`
- **Weekly stats update**: Sunday 10am - `scripts/update_remix_stats.py`
- **Weekly validation report**: Sunday 11am - `scripts/weekly_report.py`

### 4. New Scripts Created

**`scripts/update_remix_stats.py`**
- Updates remix play counts from external APIs
- Supports SoundCloud and YouTube (API keys needed)
- Tracks milestone plays (day 1, 7, 30, 90)

**`scripts/weekly_report.py`**
- Generates weekly validation report
- Shows summary stats, outcomes, validation metrics
- Identifies pending remixes needing updates
- Provides recommendations

### 5. Documentation Created
- `~/projects/remix-sniper/SETUP_SUMMARY.md` - Complete setup summary
- `~/.clawdbot/workspace/remix-sniper-skill.md` - Quick reference for Buba
- Updated `USER.md` with project notes

### 6. Testing
- Verified bot is running (`launchctl list | grep remix-sniper`)
- Ran weekly report script successfully
- Confirmed database connection works

---

## Current System State

### Bot Status
- ✅ Running (PID: 47883)
- ✅ Auto-restart enabled (launchd KeepAlive)
- ✅ 9 Discord commands loaded
- ✅ Logging to `bot.log`

### Database
- ✅ Postgres 16 running
- ✅ `remix_sniper` database created
- ✅ Tables initialized
- ✅ 8 predictions tracked, 1 remix outcome

### Tracking Data
- Location: `~/.remix-sniper/tracking/`
- `predictions.json`: 8 predictions
- `remixes.json`: 1 remix record (test)
- `snapshots/`: Daily chart snapshots

---

## Next Steps / Outstanding Items

### High Priority
1. **Track more remix outcomes** - Need 10+ for meaningful validation
2. **Add Discord webhook URL** - For daily digests and urgent alerts
3. **Test daily scan** - Verify cron job runs tomorrow at 9am

### Medium Priority
1. **Add API keys** for enhanced features:
   - Spotify API (song metadata, audio features)
   - YouTube Data API v3 (remix stats updates)
   - SoundCloud API v2 (remix stats updates)
   - Chartmetric (professional charts)

2. **Refine scoring model** - After 10+ outcomes:
   - Run backtest on existing data
   - Adjust weights based on factor importance
   - Genre-specific tuning (EDM, pop, hip-hop)

3. **Visualization dashboard** - Consider Streamlit or Next.js for:
   - Top opportunities by chart/genre
   - Historical performance of predictions
   - Remix success rates

### Low Priority
1. **Expand data sources**:
   - Beatport (EDM niche)
   - Discogs (label catalog)
   - Hype Machine (indie/underground)

2. **Automated remix creation**:
   - Ableton project template generation
   - Key/BPM info pre-populated
   - Sample pack suggestions

---

## Commands Reference

### Bot Management
```bash
# Check status
launchctl list | grep remix-sniper

# Restart
launchctl restart com.jakeshore.remix-sniper

# View logs
tail -f ~/projects/remix-sniper/bot.log
```

### Manual Operations
```bash
cd ~/projects/remix-sniper
source venv/bin/activate

# Run manual scan
python scripts/scan.py scan --chart all --limit 20

# Run daily scan with alerts
python scripts/daily_scan.py

# Update remix stats
python scripts/update_remix_stats.py

# Generate weekly report
python scripts/weekly_report.py
```

### Database
```bash
# Connect to database
/opt/homebrew/opt/postgresql@16/bin/psql -d remix_sniper

# Restart Postgres
brew services restart postgresql@16
```

---

## Key Files

| File | Purpose |
|------|---------|
| `~/projects/remix-sniper/SETUP_SUMMARY.md` | Complete setup documentation |
| `~/.clawdbot/workspace/remix-sniper-skill.md` | Quick reference for Buba |
| `~/projects/remix-sniper/.env` | Environment variables (API keys) |
| `~/Library/LaunchAgents/com.jakeshore.remix-sniper.plist` | Bot auto-restart config |

---

## Validation Goal

**Track 10+ remix outcomes** for meaningful validation metrics

Current state: 1/10 outcomes tracked (10%)

After each remix:
```bash
cd ~/projects/remix-sniper
source venv/bin/activate
python -c "
from packages.core.tracking.tracker import DatasetTracker
from packages.core.database.models import RemixOutcome

tracker = DatasetTracker()
# Update stats for your remix
tracker.update_remix_stats(remix_id, plays=50000, outcome=RemixOutcome.SUCCESS)
"
```

---

## Notes

- Bot is named "Remi" in Discord (ID: 1462921957392646330)
- Shazam charts are currently the primary data source (Tier 1)
- Spotify API credentials are optional but would enable audio features
- TikTok is the #1 predictor (30% weight) - high importance
