# Scripts Migration Plan

## Current State: 629 Scripts
- **Core operational:** heartbeat, auto-compact, email checking
- **Project-specific:** Figma automation, image generation, Notion sync
- **Legacy/temp:** Multiple versions, abandoned experiments
- **Agent/skill scripts:** Embedded within agent directories

## Target Structure

```
scripts/
├── core/           # System operations (heartbeat, compaction, email)
├── figma/          # Figma API automation
├── notion/         # Notion integration
├── discord/        # Discord operations & webhooks
├── images/         # Image processing & generation
├── taste/          # Taste board pipeline
├── email/          # Email operations
├── visual-capture/ # Screenshot & visual processing
├── utils/          # General utilities
├── legacy/         # Deprecated scripts (for reference)
└── tmp/            # Temporary/experimental (auto-cleanup)
```

## Migration Steps

### Phase 1: Identify Active vs Legacy
- [ ] Core scripts (heartbeat, compaction) → already organized
- [ ] Figma scripts → consolidate from work/internal-ce/tech/figma-scripts/
- [ ] Dedup scripts across tmp/, utils/, legacy/
- [ ] Remove versioned files (keep latest only)

### Phase 2: Consolidate by Purpose
- [ ] All image generation → images/
- [ ] All taste board → taste/
- [ ] All Notion operations → notion/
- [ ] All Discord operations → discord/

### Phase 3: Clean Legacy
- [ ] Archive clearly obsolete scripts
- [ ] Remove duplicates (tmp/ has many copies)
- [ ] Document active scripts in each directory

### Phase 4: Skills Integration
- [ ] Keep agent-specific scripts in agent dirs
- [ ] Move shared utilities to scripts/utils/
- [ ] Create symlinks where needed

## Priority Actions

1. **Immediate:** Remove tmp/ duplicates (saves ~200 files)
2. **High:** Consolidate Figma scripts (scattered across 3 locations)
3. **Medium:** Organize image processing pipeline
4. **Low:** Archive legacy versions

## Risk Assessment
- **Low risk:** tmp/ cleanup (clearly experimental)
- **Medium risk:** Figma consolidation (active development)
- **High risk:** Core script moves (system dependencies)