# Video History Storage Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Improve large video handling and history saves so PulseJT loads videos with less memory pressure and records clearer storage status.

**Architecture:** Keep the existing IndexedDB history store, but add metadata fields that describe whether an item has a stored blob, a reloadable file path, and whether it is too large or unsupported for blob storage. Update media loading to prefer file/blob URLs over giant data URLs for local videos.

**Tech Stack:** Adobe CEP panel, vanilla JavaScript modules, IndexedDB, localStorage, browser media APIs.

---

### Task 1: Storage Policy

**Files:**
- Modify: `src/storage.js`

- [x] Add a reusable video/image extension detector.
- [x] Add storage metadata fields: `storageMode`, `storageReason`, `canReloadFromPath`, `largeMedia`, `supportedVideo`.
- [x] Save metadata immediately for large videos without blocking on blob storage.
- [x] Keep full blob storage only for supported media within the size limit.
- [x] Return storage policy info for future diagnostics.

### Task 2: Path-First Video Loading

**Files:**
- Modify: `src/media.js`

- [x] Add file-path URL loading for videos when CEP exposes `file.path`.
- [x] Avoid FileReader data URLs for path-backed supported videos.
- [x] Keep FileReader fallback for no-path files.
- [x] Preserve conversion flow for unsupported formats.

### Task 3: History Display And Reload

**Files:**
- Modify: `src/history.js`
- Modify: `style.css`

- [x] Show compact badges for Blob, Path, Large, and Missing File states.
- [x] Improve reload warning when a path-backed file is missing.
- [x] Keep thumbnail fallback when original media cannot be reloaded.

### Task 4: Docs And Verification

**Files:**
- Modify: `CHANGELOG-CODEX.md`

- [x] Add changelog entry.
- [x] Run syntax checks and build.
- [x] Copy to CEP with backup.
- [x] Verify installed bundle, manifest, and feature strings.
