# Scripts Audit Report - March 9, 2026

## 🔥 CRITICAL SCRIPTS - DO NOT MOVE THESE
*Referenced in cron, HEARTBEAT.md, AGENTS.md, or active workflows*

### Heartbeat/Automation (Cron)
- `true-compact-sessions.py` - **CRON: every 15min** 
- `heartbeat-night.sh` - **CRON: 7PM**
- `heartbeat-night-pulse.sh` - **CRON: 11PM, 3AM** 
- `heartbeat-day.sh` - **CRON: 7AM**
- `auto-compact-sessions.py` - **HEARTBEAT.md reference**
- `check-kitt-email.py` - **HEARTBEAT.md reference**
- `qmd-compact.py` - **AGENTS.md reference**

### Core Workflows  
- `compress-images.js` - **MEMORY.md + agent references**
- `team-show.cjs` - **MEMORY.md reference**
- `figma-relay-web.cjs` - **MEMORY.md reference**
- `memory-compact-monthly.py` - **SPEC.md reference** 
- `memory-dedup-check.py` - **SPEC.md reference**

### Agent-Referenced Scripts
- `taste-screenshots.py` - **Julia AGENTS.md**
- `scrape-brandnew.js` - **Julia AGENTS.md**

## 📊 SCRIPT CATEGORIES (by filename pattern)

### Figma Automation (24 scripts)
```
figma-*.cjs, figma-*.js
```
**Examples:** `figma-cleanup-and-rebuild.cjs`, `figma-competitive-gap.cjs`, `figma-push-all-slides.cjs`

### Taste Board Management (12 scripts) 
```
taste-*.py
```
**Examples:** `taste-full-sync.py`, `taste-smart-capture.py`, `taste-microlink-covers.py`

### Notion Integration (8 scripts)
```
notion-*.py, notion_*.py  
```
**Examples:** `notion-sync.py`, `notion_inspo_cleanup.py`, `rebuild_notion_fast.py`

### Image Processing (8 scripts)
```
*image*.py, *image*.js, gen-*.py
```
**Examples:** `image_analyzer.py`, `compress-images.js`, `gen-bug-hunt-final.py`

### Email/Calendar (6 scripts)
```
*email*.py, *cal*.py
```
**Examples:** `check-kitt-email.py`, `email-cal-scan.py`, `read_email.py`

### Discord/Social (5 scripts)
```
discord-*.*, twitter_*.py
```
**Examples:** `discord-post-update.sh`, `twitter_post.py`, `twitter_search.py`

### Build/Deploy (15 scripts)
```
build-*.*, update-*.*, fix-*.*
```
**Examples:** `build-slides-6-15.cjs`, `update-comms-pillars.cjs`, `cleanup-and-build.cjs`

### Legacy/Test Scripts (~30 scripts)
```
test-*.*, *-v2.*, *-v3.*, blur_clients*.py
```
**Examples:** `test-slides-api.py`, `blur_clients_v8.py`, `figma-test-props.cjs`

## 🚨 DEPENDENCIES MAP

### Scripts That Call Other Scripts
- Need to check: build scripts, automation chains
- Potential issue: hard-coded paths in shell scripts

### External References Found
- **HEARTBEAT.md** → 3 scripts
- **AGENTS.md** → 2 scripts  
- **MEMORY.md** → 3 scripts
- **SPEC.md** → 6 scripts
- **Cron jobs** → 5 scripts
- **Agent files** → 4 scripts

## 📋 REORGANIZATION RECOMMENDATIONS

### Phase 1: Safe Categorization (No Path Changes)
Create subdirectories, COPY scripts (don't move yet):

```
scripts/
├── core/               # Critical automation - DON'T TOUCH
│   ├── auto-compact-sessions.py
│   ├── true-compact-sessions.py
│   ├── check-kitt-email.py
│   ├── heartbeat-*.sh
│   └── qmd-compact.py
├── figma/              # All figma-* scripts
├── taste/              # All taste-* scripts  
├── notion/             # All notion-* scripts
├── images/             # Image processing & generation
├── email/              # Email automation
├── discord/            # Discord utilities
├── legacy/             # test-*, blur_*, *-v[2-9]*
└── utils/              # Reusable utilities
```

### Phase 2: Update References  
- Update HEARTBEAT.md paths
- Update AGENTS.md paths
- Update cron jobs
- Update any hardcoded imports

### Phase 3: Remove Originals
Only after verifying everything works.

## 🎯 NEXT STEPS

1. **Create the subdirectory structure** 
2. **COPY (not move) scripts** to new locations
3. **Test critical workflows** (heartbeats, email)
4. **Update one reference file at a time**
5. **Remove originals only after full verification**

**Risk Level: MEDIUM** - Many interdependencies, but clear separation possible.