# Task 3 for Hermes — Env restore-point for the working ComfyUI venv (insurance)

(Same machine/context as the earlier briefs. READ-ONLY on the working venv — do NOT change or reinstall anything in it; it is working. This task only CAPTURES a restore point.)

**Goal:** create a reliable way to restore the ComfyUI Python environment to its current known-good state in minutes, so a future dependency breakage (like the lip-sync one that cost a full day) can be reverted fast.

**The working venv:** `C:\ComfyUI\.venv` (Python 3.12). Load-bearing packages that must be preserved: `numpy==1.26.4`, `opencv-python==4.10.0.84`, `opencv-contrib-python==4.10.0.84`, `insightface==0.7.3`, `onnxruntime-gpu` (CUDAExecutionProvider — just installed), `torch 2.10.0+cu130`. Also: `insightface\app\__init__.py` is patched (`from .mask_renderer import *` → `pass`).

Do all of this — put artifacts in `C:\malin\restore\`:

1. **pip freeze snapshot:** `C:\ComfyUI\.venv\Scripts\python.exe -m pip freeze > C:\malin\restore\comfyui_venv_freeze_<today's date>.txt`. The full reference list.

2. **RESTORE_NOTES.md** — a short human-readable doc capturing: (a) the load-bearing pins above; (b) the insightface mask_renderer patch; (c) HOW the non-standard packages were installed / where they come from (the torch cu130 index URL, the exact onnxruntime-gpu build/source you used for CUDA 13, the insightface 0.7.3 wheel source). A plain `pip install` may not reproduce these bleeding-edge builds, so document the sources.

3. **Full venv backup IF disk allows (gold standard):** check free disk first; if there's comfortable room (the venv is several GB), make a complete copy of `C:\ComfyUI\.venv` to `C:\malin\restore\venv_backup_<date>\` (folder copy or compressed archive). A folder copy restored to the SAME path is the most bulletproof recovery — swap it back and you're instantly working again. If disk is tight, SKIP this and rely on freeze + notes; say which you did and why.

4. **restore_comfyui_env script (.ps1 or .bat)** — for FUTURE use only: reinstalls the load-bearing packages to the exact known-good versions (numpy / opencv / insightface / onnxruntime-gpu) and re-applies the insightface patch. Do NOT run it now (env is working) — just create it and document how to run it.

**Constraints:** capture only — do not modify the working venv.

**Verify + report:** confirm the freeze file exists and actually contains the key packages (grep it for numpy, opencv, insightface, onnxruntime, torch), report the path of every artifact created, state whether you did the full venv backup or skipped it (and why), and give a one-line "to restore, do X" instruction.
