## 2026-10-09T03:40:17Z
You are Worker 1 for Milestone M1: 2-Tier Quality Gate & Classifier (and M2 finalization).

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

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 detailed architecture designs:
- c:\Projects\KieuStory\.agents\teamwork\explorer_survey_1\survey_pipeline_critic.md
- c:\Projects\KieuStory\.agents\teamwork\explorer_survey_1\handoff.md
- c:\Projects\KieuStory\.agents\teamwork\explorer_survey_3\survey_ep01_production.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:
- Purge single premature video: c:\Projects\KieuStory\04_Assets\videos\ep01_scene01_shot01_10s_v1.mp4
- New module: c:\Projects\KieuStory\05_Production_Pipeline\antigravity_critic_gate.py
- Refactor: c:\Projects\KieuStory\05_Production_Pipeline\production_orchestrator.py
- Fix references: c:\Projects\KieuStory\episodes\ep01\prompts\muse_prompts.json and c:\Projects\KieuStory\02_AI_Prompts\muse_ai_video_prompts.json
- New test suite: c:\Projects\KieuStory\tests\test_critic_gate.py
- READ-ONLY: 04_Assets/characters/ (DO NOT MODIFY OR DELETE)
- PRESERVE: 04_Assets/archive/ep01_legacy_v1/

TASKS TO EXECUTE:
1. Finalize M2 Workspace Cleanliness:
   - Delete c:\Projects\KieuStory\04_Assets\videos\ep01_scene01_shot01_10s_v1.mp4.
   - Run python -m pytest tests/test_m2_hygiene.py -v (verify 6/6 PASS).
2. Implement 05_Production_Pipeline/antigravity_critic_gate.py:
   - Define Pydantic v2 VideoCriticVerdict and sub-models:
     * ShotEvaluation: character_match (bool), character_confidence (float), visual_defects (list[str]), squint_or_extra_limbs (bool), audio_guard_ok (bool), score (float).
     * SceneEvaluation: junction_smoothness (float), axis_180_ok (bool), eyeline_ok (bool), color_continuity (float), trigger_color_match (bool), tempo_ok (bool), trigger_trim_static (bool), score (float).
     * VideoCriticVerdict: overall_score (float, 0.0 to 1.0), approved (bool: score >= 0.8), shot_eval, scene_eval, suggested_action (str: APPROVE, RETAKE_SHOT, APPLY_COLOR_MATCH, TRIM_STATIC), critique_notes (str).
   - Functions:
     * evaluate_shot_gate(shot_id: str, video_path: str, expected_character: str, prompt: str) -> VideoCriticVerdict
     * evaluate_scene_gate(scene_id: str, shot_video_paths: list[str]) -> VideoCriticVerdict
   - Engines:
     * Primary: Google Antigravity SDK (Agent with LocalAgentConfig/response_schema=VideoCriticVerdict).
     * Secondary: Google GenAI client (gemini-2.5-flash with structured output).
     * Offline heuristic fallback: OpenCV/FFprobe evaluating duration, resolution, audio stream, histogram delta between frames, and black/frozen frames.
3. Refactor resolve_start_frame() in 05_Production_Pipeline/production_orchestrator.py:
   - Check character_anchor of current shot vs previous shot from gemini_banana_prompts.json.
   - If shot_num == 1 or current character_anchor != prev character_anchor:
     Classify as Cinematic Cut -> Load independent Start Frame from 04_Assets/characters/ (or Banana prompt). NEVER return prev_tail.
   - If current character_anchor == prev character_anchor:
     Classify as Continuous Take -> Load prev_tail (clean_frame_239.jpg).
4. Correct 11 Misassigned Asset References in Prompts:
   - In episodes/ep01/prompts/muse_prompts.json: update ep01_scene09_shot04 and ep01_scene10_shot03 through shot12 from thuy_kieu_maiden_16yo_720p.png to kim_trong_18yo_720p.png.
   - Sync with 05_Production_Pipeline/episode_manager.py --sync-to-master.
5. Create Authoritative Test Suite tests/test_critic_gate.py:
   - Test VideoCriticVerdict Pydantic schema validation.
   - Test evaluate_shot_gate with valid and defect mock inputs.
   - Test evaluate_scene_gate with junction and 180-degree checks.
   - Test resolve_start_frame classifies Cinematic Cut vs Continuous Take correctly.
   - Test that resolving Kim Trọng shots NEVER returns Thúy Kiều image paths.
6. Run Test Suites & Invariant Checks:
   - python -m pytest tests/test_critic_gate.py -v
   - python -m pytest tests/test_m2_hygiene.py -v
   - pytest tests/test_tier1_features.py -k "not test_render"
7. Output your handoff report to c:\Projects\KieuStory\.agents\teamwork\worker_m1_critic_1\handoff.md with live test outputs and notify parent orchestrator.
