# Deployment Cleanup (MANDATORY)

**ALWAYS kill previous instances before launching a new one. NO EXCEPTIONS.**

## The One Command

Use `scripts/launch.sh` for ALL app launches. It handles kill → build → launch atomically.

If not using the script, run this EXACT sequence in a SINGLE bash command:

```bash
pkill -f "launcher|AgentOrchestrator|agor-ptyd|vite.*9760" 2>/dev/null; fuser -k 9760/tcp 2>/dev/null; sleep 2 && ./agor-pty/target/release/agor-ptyd &>/dev/null & sleep 1 && cd ui-electrobun && npx vite dev --port 9760 --host localhost &>/dev/null & sleep 3 && ./node_modules/.bin/electrobun dev &
```

## Rules

- **NEVER** launch without killing first — this causes duplicate windows
- **NEVER** split kill and launch into separate bash calls — the `cd` between them breaks the path
- Kill command MUST include: launcher, AgentOrchestrator, agor-ptyd, vite port 9760
- Free port 9760 with `fuser -k` before starting Vite
- Wait 2s after kill before launching (process cleanup time)
- The `electrobun dev` command MUST run from `ui-electrobun/` directory
