Files
claude-projects/claude-config/config/prompts/media-pipeline/MP-26_library_restore_plan.md
T
2026-10-02 00:19:54 -05:00

4.2 KiB

MP-26 — FM-1 library restore PLAN (read-only) (spawned 2026-10-01, main session 771b2744)

Bounded background agent, media_pipeline, tracking row personal_projects #61. Budget: --max-turns 45. PLAN ONLY. Same tool call twice with identical arguments → STOP with a partial wrap-up.

CONTEXT: owner-approved fix order step 2 (2026-10-01): restore library files damaged by FM-1 (file-monitor overwrote existing library episodes). Read /opt/appdata/docker/docker-compose/media-transcoder/design/REVIEW_2026-10-01_full_code_review.md (FM-1 section + retranscode_candidates) and the MP-23 scratch evidence in /tmp/claude-1000/-opt-appdata-docker-Machines-infrastructure-general-questions/771b2744-c468-4a6d-a4dc-a3886d0444b9/scratchpad/mp23/ (fm1_audit.txt etc., if present). Main session confirmed: rename_jobs 545 (YYH 001) and 645 (YYH 101) both → S01E01; 105 destination paths in rename_jobs have >1 distinct source (most are harmless re-renames of the same content). The MP-24 no-overwrite guard is being promoted now (live soon); restores must not depend on the old behaviour.

TASKS

  1. For EVERY rename_jobs destination with >1 distinct source_path (all 105), classify: (H) harmless — same episode re-delivered (same show+episode, e.g. a re-transcode); (D) DAMAGE — a different episode/extra overwrote it. Use names + transcode_jobs rows + ffprobe of the current library file (duration, and compare against each candidate source's duration where the source still exists) to decide what the library file holds NOW. Probe via a throwaway container (no ffprobe on the host): docker run --rm -i -v /media/mediashare:/media/mediashare:ro --entrypoint sh gitea.local/backtalk6858/media-transcoder:latest -c '<ffprobe …>'
  2. For each D: (a) what the library file currently contains (episode identity), (b) which episode is MISSING from the library because of it, (c) whether the missing episode's original source still exists on disk (path), (d) whether the current content is itself a valid episode that belongs at ANOTHER library path (e.g. YYH 101 belongs at its correct season/episode — determine the correct SxxExx using the show's FileBot/TheMovieDB numbering as the library already uses for that show: check neighbouring files), and whether that other path is free or also damaged.
  3. Produce an ordered repair plan with exact actions, each labelled:
    • RENAME-IN-LIBRARY (move a wrongly-placed but valid file to its correct free path) — mv command,
    • RETRANSCODE (source on disk; recipe: source in its original input path with a newer mtime + output absent from 'Media to be Renamed' → requeue peek re-transcodes; FileBot then places it — note the MP-24 guard will PARK it in _conflicts if the slot is still occupied, so order RENAME/park-aside steps first),
    • REDOWNLOAD (no source) — show + episode list for the owner,
    • LOST-EXTRA (OAD/recap/special overwritten; list only). Every command FULL (no abbreviations), with who runs it (files under /media are writable by administrator? check with ls -l + test -w on a sample, report), plus a verification step. Nothing destructive: a library file is never deleted — it is moved aside to '/media/mediashare/MY MEDIA/MY MEDIA/Media to be Renamed/_restore_hold//' first. HARD RULES: READ-ONLY. No mv/cp/rm/touch on any media file, no DB writes, no container changes, no git, no sudo (⏸ OWNER-COMMAND-REQUEST if needed). Bounded probes (≤ 300 files). Mask secrets. OUTPUT: /opt/appdata/docker/docker-compose/media-transcoder/design/RESTORE_PLAN_FM1_2026-10-01.md (summary table + ordered plan + REDOWNLOAD list + LOST-EXTRA list + method notes + per-entry evidence). Append "## MP-26 — 2026-10-01 (background agent)" to /opt/appdata/docker/docker-compose/media-downloader-local/.claude/context.md; run python3 /opt/appdata/docker/.claude/scripts/embed_memory_dir.py --only-recent 5. FINAL message = wrap-up JSON only: status, project "media_pipeline", plan_path, counts {harmless, damaged, rename_in_library, retranscode, redownload, lost_extra}, damaged[] (library_path, contains_now, missing_episode, action), writable_by_administrator (bool + evidence), actions_taken[], actions_failed[], unverified_claims[], next_step, notes.