# TraceRepair-Agent V1: Executable Research Plan **Working title:** Scaling Long-Form Video Generation through Agentic Diagnosis and Minimal Trajectory Repair **Version:** V1.0 **Date:** 2026-08-10 **Status:** Implementation-ready research specification ## Compact Outline - Build 30–90 second, multi-shot video projects from 4–15 second shots. - Use MiniMax H3 to inject one controlled trajectory error into one shot while protecting all unrelated content. - Give the repair agent only the corrupted project and its production context; hide the clean source and injection instruction. - Let the agent choose among `KEEP`, `H3_EDIT`, and `SHOT_REGENERATE`, then verify, retry, or roll back. - Evaluate joint repair correctness, protected-content preservation, long-range coherence, cost, and repair span. - Explicitly test and control generator-specific leakage caused by using H3 for both injection and repair. --- ## 1. Executive Decision V1 will study **sparse trajectory-error repair in long-form, multi-shot video projects**. A trajectory error is a wrong motion or state transition whose incorrectness becomes clear only when the target shot is interpreted together with its local or cross-shot context. Examples include a character entering from the wrong side, reaching the wrong destination, reversing direction across a cut, or violating an object handoff. MiniMax H3 Ref2VA will be used as a **candidate error injector** and a **candidate repair tool**. Its output is never trusted automatically: every injected sample must pass target-error, preservation, naturalness, and solvability gates. MAGI-2 Preview is not a direct video editor and is therefore optional in V1; it can only serve as an expensive full-shot regeneration backend from a still-image anchor. The central research question is: > Can an agent scale short-video generators into a reliable long-form production system by diagnosing sparse trajectory failures, choosing the smallest viable repair action, and verifying the result without access to the original correct shot? ### V1 paper hypothesis An agent that maintains an explicit cross-shot state ledger and uses verification-guided, adaptive repair will achieve a better **correctness–preservation–cost trade-off** than fixed editing, one-shot planning, or full-project regeneration. This is a hypothesis to test, not a result to claim in advance. ### Non-goals for V1 - End-to-end generation of a feature-length film. - Pixel-perfect local editing guarantees from H3. - Arbitrary dialogue, identity, lighting, and physics repair in one benchmark. - Training a new foundation video model. - Claiming novelty until the final related-work and concurrent-work audit is complete. --- ## 2. Task Definition ### 2.1 Input project A clean project is \[ P^* = (B, R, S^*, L^*) \] where: - \(B\) is a short story or production brief; - \(R\) is a reference pack containing character, object, location, and style anchors; - \(S^*=\{s_1,\ldots,s_n\}\) is an ordered sequence of clean shots; - \(L^*\) is a canonical state ledger describing relevant entities at shot boundaries. V1 projects contain **4–10 shots** and last **30–90 seconds**. Each shot lasts **4–15 seconds**, matching the operating range of H3. ### 2.2 Controlled corruption The injector selects one target shot \(s_k\) and one error specification \(e\), then uses H3 to produce a corrupted shot \(\tilde{s}_k\). The resulting project is \[ \tilde{P} = (B, R, \{s_1,\ldots,\tilde{s}_k,\ldots,s_n\}, \tilde{L}). \] Each error specification contains: 1. **Target error:** the single fact that must become wrong. 2. **Protected facts:** facts that must remain unchanged. 3. **Evidence window:** shots needed to prove that the error exists. 4. **Repairability constraints:** allowed actions and acceptable outputs. ### 2.3 Blind repair setting The repair agent receives: - the corrupted project \(\tilde{P}\); - the brief \(B\); - the reference pack \(R\); - shot boundaries and ordinary production metadata. The agent does **not** receive: - the original clean target shot \(s_k\); - the injected-error description; - the H3 injection prompt; - the clean ledger entries that directly reveal the answer. The agent returns a repaired project \(\hat{P}\) and an auditable repair trace containing diagnosis, evidence, chosen action, tool parameters, verification results, retries, and final acceptance decision. ### 2.4 Optimization target V1 will report a metric vector rather than hide trade-offs in one arbitrary scalar: \[ (\text{Repair Success},\ \text{Protected-Fact Preservation},\ \text{Coherence},\ \text{Cost},\ \text{Latency},\ \text{Repair Span}). \] The primary success event is strict: > The target error is repaired **and** all critical protected facts pass. --- ## 3. V1 Error Ontology V1 starts with five trajectory-error families that are visually testable and plausible for H3 editing. | ID | Error family | Example | Required context | Preferred injection | |---|---|---|---|---| | T1 | Direction reversal | A runner moves left although the plan requires right | One shot or adjacent shot | H3 edit | | T2 | Entry/exit mismatch | A character exits frame-right and re-enters from frame-right after a cut | Two adjacent shots | Edit one boundary shot | | T3 | Wrong endpoint | A character walks to the wrong door or object | One shot plus brief/reference | H3 edit or shot regenerate | | T4 | Route/waypoint violation | A vehicle passes on the wrong side of a landmark | One shot plus scene layout | H3 edit; retain only if controllable | | T5 | Handoff/state-transition violation | An object moves to the wrong person or location | Two to three shots | Edit one shot or regenerate | ### Scope rule Each V1 example contains exactly **one primary trajectory error**. Samples with additional identity, count, camera, scene, or causal errors are rejected rather than assigned multiple labels. ### Pilot calibration rule An error family remains in V1 only if the pilot shows that: - the target error can be injected reliably; - unrelated content can be preserved at an acceptable rate; - independent raters can identify the error and its evidence window; - the error cannot be solved from a generator watermark or low-level artifact alone. T4 is expected to be the hardest family and may be deferred if H3 cannot follow route constraints reliably. --- ## 4. H3-Based Error Injection Pipeline ```mermaid flowchart LR A[Clean multi-shot project] --> B[Build canonical state ledger] B --> C[Sample one target error] C --> D[Write target + protected facts] D --> E[Generate N H3 edit candidates] E --> F{Target error present?} F -- No --> E F -- Yes --> G{Protected facts retained?} G -- No --> E G -- Yes --> H{Natural and uniquely labeled?} H -- No --> E H -- Yes --> I[Human audit and accept] I --> J[Freeze benchmark record] ``` ### 4.1 Step A — Select a clean project The clean sequence must already satisfy the brief and contain no target-family trajectory failure. Two annotators inspect the sequence before it becomes an injection source. The project is segmented at shot boundaries, and all entities relevant to the planned corruption are entered in the state ledger. ### 4.2 Step B — Build the canonical state ledger For each relevant entity and shot boundary, store only observable or brief-grounded facts: - screen position and movement direction; - world-relative origin, destination, and optional waypoint; - object ownership and contact state; - entry and exit side; - action phase and completion state; - confidence and visual evidence timestamp. The ledger is privileged evaluator data. A separately reconstructed ledger is available to the agent, but the clean ledger is not. ### 4.3 Step C — Compile the injection specification The injection compiler produces a structured record: ```json { "error_id": "T2_ENTRY_EXIT_MISMATCH", "target_shot": "shot_05", "evidence_shots": ["shot_04", "shot_05"], "target_error": "The woman enters shot_05 from frame-right instead of frame-left.", "protected_facts": [ "The woman's identity and clothing remain unchanged.", "The station platform, lighting, and camera remain unchanged.", "The man in the background keeps the same action.", "Shot duration and dialogue remain unchanged." ], "forbidden_changes": [ "No new people or objects.", "No camera cut or camera-motion change." ] } ``` ### 4.4 Step D — Generate H3 candidates Use H3 Ref2VA with the clean target shot as the source video. Generate multiple candidates with different seeds and, when necessary, small prompt variants. A canonical prompt template is: ```text Use