# TraceRepair-Agent TraceRepair-Agent is a schema-first research scaffold for finding and minimally repairing sparse narrative trajectory errors in multi-shot videos. The repair agent sees only a public corrupted project. Clean shots, injection prompts, target labels, seeds, and canonical evaluation ledgers stay in a separate private runtime. This first milestone deliberately contains no live MiniMax H3 or MAGI-2 call. It defines the contracts, isolation boundaries, deterministic fake adapters, revision journal, bounded repair loop, and offline evaluation seam required to test the research idea safely before paying for generation. ## Core flow ```text PRIVATE: clean project + error spec -> inject candidate -> accept/reject -> PUBLIC corrupted manifest PUBLIC ONLY: manifest -> inspect -> build estimated ledger -> diagnose -> KEEP | H3_EDIT | SHOT_REGENERATE -> verify -> commit / retry / rollback OFFLINE ONLY: public output + private truth -> benchmark evaluation ``` The operational verifier is intentionally blind. It cannot import or receive private benchmark truth. Only the offline evaluator may join public output with the private manifest. ## Repository map - `src/trace_repair/core`: immutable identifiers, enums, hashing, and errors. - `src/trace_repair/domain`: public/private manifests and run records. - `src/trace_repair/ports`: protocol boundaries for inspection, generation, verification, storage, and evaluation. - `src/trace_repair/narrative`: deterministic narrative contracts, evidence alignment, constraint checks, first-divergence localization, reinspection. - `src/trace_repair/application`: injection, blind repair, and private evaluation use cases. - `src/trace_repair/adapters`: deterministic fakes, storage, provider stubs, and the ViMax project bridge. - `src/trace_repair/bootstrap`: separately constructed injection, repair, and evaluation runtimes. - `schemas`, `configs`, `examples`: machine-checkable contracts and fixtures. - `docs/adr`, `docs/research`: architecture decisions and framework audit. ## Upstream strategy The orchestration shape is adapted from HKUDS/ViMax v1.2.0 at commit `05a48943878312d88fe5a016c12a9654940ecc43` under MIT. We reuse the ideas of a typed tool registry, bounded tool loop, provider ports, session memory, and artifact checklists. We replace boolean staleness and file-existence reuse with immutable revisions, hashes, explicit dependencies, transactional commit and rollback, and strict public/private benchmark isolation. See `docs/adr/0001-vimax-upstream-and-runtime-split.md` and `THIRD_PARTY_NOTICES.md`. ## Milestone status This repository is currently an **offline scaffold**. Do not interpret provider stubs as claims that a model endpoint is integrated. The intended next step is to make the deterministic fake end-to-end test pass, then add H3 behind the existing generation port without changing domain contracts. See `STATUS.md` for the current checkpoint and `ROADMAP.md` for the sequence of minimal milestones. ## Friday GPT 30K 文本语料与实验产物索引(2026-09) > 本节只补充实验产物的定位和使用边界,不改变上文的架构、公开/私有隔离或 milestone 描述。特别地,本节所述的 30K 语料是 **Friday GPT 生成的未渲染文本**,不是 H3/Ref2VA 视频产物,也不代表新样本已经通过视频 evaluator。 ### 当前可直接使用的交付包 `outputs/friday_prompt_delivery_30k_v1/` 是面向消费方整理的自包含 prompt 交付目录: | 文件 | 实际内容 | 用法 | |---|---|---| | `top_historical_test_prompts_4of5.jsonl` | 历史多轮试验中全局最高接受率的 2 条 test prompt(各 4/5)。 | 读取 `h3_execution_prompt`。 | | `family_champion_test_prompts.jsonl` | 覆盖四个轨迹家族的 4 条 champion test prompt;历史汇总为 14/20。 | 包含接受率、来源 release、选择理由和 prompt。 | | `base_prompts_1200.jsonl` | 1,200 条干净 base prompt。 | 以 `base_id` 作为关联键。 | | `injection_prompts_30000.jsonl` | 最终 30,000 条 trajectory-injection prompt。 | 读取 `prompt`;用 `base_id` 关联 base。 | | `manifest.json` | 来源文件哈希、case 分配、数量和完整性检查。 | 用于程序化追溯。 | | `SHA256SUMS` | 交付包数据文件的 SHA-256。 | 用 `sha256sum -c SHA256SUMS` 验证。 | | `README.md` | 交付包字段与使用约定。 | 交付包的最小入口。 | 四个家族的最终分配为: - `pilot_t2_kitchen_exit_left_009`:9,000 条; - `pilot_t3_fox_stop_cliff_018`:9,000 条; - `pilot_t2_kitchen_alt_exit_013`:6,000 条; - `pilot_t4_robot_wrong_side_004`:6,000 条。 交付包已校验:30,000 个唯一 `prompt_id`、1,200 个唯一 `base_id`,且全部 `base_id` 关联可解析;每条记录带有 `text_only_unrendered: true`。 ### 原始语料、历史 champion 与文档 - 原始、可恢复的 Friday 文本语料: `runs/trajectory_text/friday_base_to_injection_30k_v1/` - `base_prompts.jsonl`:1,200 条带完整生成元数据的 base 记录; - `injection_texts.jsonl`:30,000 条带完整生成元数据的 injection 记录; - `manifest.json`:完成状态和模型/分配信息。 - 历史高接受率 champion 的组合 release: `runs/trajectory_text/friday_h3_prompt_champions_v20_4case/` - `report.md`:四条 test prompt 与历史接受率摘要; - `manifest.json`:来源、prompt 哈希与选择理由; - `corpus_verifier.json`:跨 release 去重和语料校验结论(`PASS`)。 - 本轮 30K 文本生产的完整中文总结: `docs/friday_base_to_injection_30k_summary_zh.md`。 - Friday 轨迹试验的时间线、视频反馈和审计记录: `docs/friday_trajectory_audit_worklog.md`。 - 执行流程说明(中文):`docs/v1_execution_plan_zh.md`。 ### 生成与请求准备脚本 - `scripts/evaluation/generate_friday_base_injection_corpus.py`:append-only、可恢复的两阶段 Friday GPT 生产器;先生成干净 base,再生成关联 injection,并执行本地文本契约检查。 - `scripts/h3/prepare_gpt_trajectory_pilot.py`:H3 请求清单准备器;支持 `--seed-start` 生成连续、可复现的 seed 范围。该能力本身不会调用 H3。 ### 历史与未执行产物的边界 - `runs/injection/acceptance_first_30k_v1/` 是早期生成的 30,000 个 **seed-level H3 请求清单**(4 个 champion 各 7,500 个;seed `3000001–3030000`)。它标记为 `pilot_only: true`、`benchmark_eligible: false`,未作为本轮文本语料执行 H3。 - 历史视频和 pilot 证据保留在 `outputs/`、`runs/injection/pilot_*` 和 `runs/evaluation/`;它们用于可追溯性,不应与上述 30K 未渲染文本混为同一类结果。 - `runs/trajectory_text/` 中保留多代 `friday_h3_rewrite_*` 版本,便于追溯 prompt 修订;它们不是当前 30K 交付入口。 当前没有删除、移动或覆盖任何历史产物。后续若进入视频阶段,应从交付包按 case 抽取小规模样本运行 H3 与既有 evaluator,再以实际视频接受率决定是否扩大,而不能从历史 14/20 或文本契约通过直接外推到 30K。