## 2026-10-09T03:18:09Z
You are Worker 2 for Milestone M2: Archival & Workspace Hygiene Remediation.

Your working directory is: c:\Projects\KieuStory\.agents\teamwork\worker_m2_hygiene_2

MANDATORY FIRST STEP:
Read c:\Projects\KieuStory\.agents\teamwork\ORIGINAL_REQUEST.md completely. Do not skip this.
Read c:\Projects\KieuStory\.agents\teamwork\orchestrator_1\PROJECT.md.
Read the root cause analysis and remediation instructions:
- c:\Projects\KieuStory\.agents\teamwork\explorer_m2_remediation_1\analysis.md
- c:\Projects\KieuStory\.agents\teamwork\explorer_m2_remediation_1\handoff.md
- c:\Projects\KieuStory\.agents\teamwork\auditor_m2_1\handoff.md

MANDATORY INTEGRITY WARNING:
DO NOT CHEAT. All implementations must be genuine. DO NOT hardcode test results, create dummy/facade implementations, or circumvent the intended task. A teamwork_preview_auditor will independently verify your work. Integrity violations WILL be detected and your work WILL be rejected.

EXCLUSIVE WRITE OWNERSHIP:
- Termination of rogue background processes
- Cleanup of c:\Projects\KieuStory\04_Assets\videos\ep01_*.mp4 and c:\Projects\KieuStory\04_Assets\keyframes\ep01_*
- Hardening of c:\Projects\KieuStory\05_Production_Pipeline\run_shot.py and c:\Projects\KieuStory\05_Production_Pipeline\muse_invpw_driver.py
- Test runner: tests\test_m2_hygiene.py
- READ-ONLY: 04_Assets/characters/ (MUST NOT modify or delete)
- PRESERVE: 04_Assets/archive/ep01_legacy_v1/ (do not delete the 184 archived videos, README.md, or exports/)

TASKS TO EXECUTE DETERMINISTICALLY:
1. Terminate Rogue Processes:
   Kill PID 41044, PID 65208, and any process running `production_orchestrator.py` or `run_shot.py` in the background. Verify they are terminated.
2. Purge Lingering and Premature Ep01 Assets:
   - Remove any premature `ep01_*.mp4` files in `04_Assets/videos/`.
   - Remove all directories starting with `ep01` in `04_Assets/keyframes/` (including `ep01_scene10_shot14` and any `ep01_scene01_shot*`).
   - Remove root keyframe file `04_Assets/keyframes/ep01_scene03_start_720p.png` if present.
3. Harden Pipeline Against Eager Keyframe Directory Creation:
   - In `05_Production_Pipeline/run_shot.py` (lines ~295-299): Move `shot_kf_dir.mkdir(parents=True, exist_ok=True)` inside the `if ret and tail_frame is not None:` block so empty directories are never created when no frame is extracted.
   - In `05_Production_Pipeline/muse_invpw_driver.py` (lines ~88-90): Ensure `keyframe_dir.mkdir(parents=True, exist_ok=True)` only executes when a valid frame exists.
4. Verify Clean Slate & Run Test Suite Immediately:
   - Run `python -m pytest tests/test_m2_hygiene.py -v` (MUST be 100% 6/6 PASS).
   - Run `python tests/test_m2_hygiene.py` (MUST be 100% 6/6 PASS).
   - Run `python 05_Production_Pipeline\production_orchestrator.py --status --episode ep01` (MUST report 0 / 192 shots rendered).
   - Run `python 05_Production_Pipeline\episode_manager.py --status`.
   - Run `pytest tests/test_tier1_features.py -k "not test_render"` to verify 0 regressions.
5. Invariant Verification:
   Confirm all 62 character files in `04_Assets/characters/` are intact and all 184 videos in `04_Assets/archive/ep01_legacy_v1/` are intact.

OUTPUT REQUIREMENTS:
- Capture live, verbatim terminal test outputs and include them in your handoff report.
- Write your handoff report to c:\Projects\KieuStory\.agents\teamwork\worker_m2_hygiene_2\handoff.md.
- Send a message to parent orchestrator when complete.
