# Session Closure Checklist

When closing a major Unspooled development session with many accumulated fixes:

## 1. Commit

```bash
cd ~/Unspooled
git add -A
git commit -m "fix: <categories> — N files, +A/-B

CRITICAL (OOM/crash): ...
HIGH (security/performance): ...
FOCUS: ..."
```

Message categories: CRITICAL, HIGH, FOCUS, PERF. Include file counts.

## 2. Update SSOT Docs

### PROJECT_STATE.md
- [ ] Last commit hash, total files, branch
- [ ] APK size (verify with `ls -lh`)
- [ ] "Recent fixes" section → replace with current session's fixes
- [ ] "Known Issues" → remove items that are now fixed
- [ ] Player architecture → update DebridHttpDataSourceFactory status, buffer gating, TOCTOU
- [ ] Security section → update encrypted prefs, token storage, cleartext defense
- [ ] Scraper section → update live status, network security range

### ARCHITECTURE.md
- [ ] Network security section → update cleartext allow-list domains
- [ ] Player layer → update DebridHttpDataSourceFactory wired status
- [ ] Player HTTP section → update token injection details

## 3. Memory Hygiene

Target: 50-70% usage (not 80%+).

- [ ] Scan for stale entries (fixed bugs, completed tasks)
- [ ] Deduplicate overlapping entries
- [ ] Merge: license + copy rules, focus patterns + focus fixes
- [ ] Keep only durable facts
- [ ] User profile: remove duplicates, merge

Stale patterns to watch for:
- "TvLazyRow not available" (handled by LazyRow + focusGroup)
- "DebridHttpDataSourceFactory not wired" (now wired)
- Old branch names or commit hashes
- "Recent fixes" from sessions older than current

## 4. Verify Build

```bash
JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ./gradlew :app:assembleDebug
```

Must be `BUILD SUCCESSFUL` before reporting complete.

## 5. Verify Scraper (if scraper changes were made)

```bash
curl -s http://192.168.1.50:3091/health | jq '.status'
```

Must return `"ok"`.
