Add Model
Manual Invocation
This skill is for explicit /add-model use only. Do not auto-start it from a
casual model-port mention. The setup-only workflow is
../add-model-01-prep/SKILL.md.
Goal
Port a new FastVideo model family, model variant, or first-class reusable
component so it can be loaded through FastVideo's native model, config, stage,
registry, preset, and test infrastructure.
FastVideo has one pipeline architecture: stage-based composition via
ComposedPipelineBase. Vary the stages and modules, not the architecture.
Scope Shapes
Use this skill for either shape:
| Shape |
Required output |
| Full model family or variant |
Native components, conversion if needed, pipeline config/class, presets, registry, smoke test, local parity tests, example, quality regression. |
| First-class component contribution |
Native component class/config, bucket export, component parity test, and a documented downstream pipeline that will consume it. Skip pipeline/preset/registry rows only when the contribution is intentionally component-only. |
If upstream ships many variants, lock scope before coding. "Base model" means
checkpoint variant, not a modality subset. If the base checkpoint produces
audio, pose, depth, masks, or other output heads, either support those outputs
or get explicit user agreement to drop them.
Required Input
Start from an add-model-01-prep handoff, or equivalent fields matching
contracts/prep_handoff.md.
Before Phase 0, read the shared rules and all relevant schemas:
shared/common_rules.md
contracts/prep_handoff.md
contracts/port_state.md
contracts/escape_hatch.md
contracts/component_context.md
contracts/parity_status.md
contracts/conversion_request.md
contracts/conversion_handoff.md
contracts/component_skill_handoff.md
contracts/pipeline_context.md
contracts/pipeline_handoff.md
contracts/final_handoff.md
Hard Rules
- Follow
shared/common_rules.md for token/auth safety, state files, escape
hatches, production import boundaries, and skip/pass semantics.
- If the prep handoff is missing or ambiguous, stop and run
../add-model-01-prep/SKILL.md.
- If a needed component is not ported, do not ship the pipeline that needs it.
- Wan is grandfathered for missing local parity; do not copy its missing-test
precedent for new work.
Escape Hatches
Follow shared/common_rules.md and contracts/escape_hatch.md. The main
orchestrator should ask only when no phase skill can safely continue under the
shared rules.
Files Map
| Area |
Paths |
| DiT |
fastvideo/models/dits/<family>.py, fastvideo/configs/models/dits/<family>.py, bucket __init__.py. |
| VAE |
fastvideo/models/vaes/<arch_or_family>.py, fastvideo/configs/models/vaes/<arch_or_family>.py, bucket __init__.py. Name by shared arch when reusable (oobleck.py, autoencoder_kl.py), otherwise by family (wanvae.py). |
| Encoder / conditioner / scheduler / upsampler |
Native class/config in the matching fastvideo/models/<bucket>/ and fastvideo/configs/models/<bucket>/ bucket. |
| Lazy loader wrapper |
Optional fastvideo/models/<bucket>/<family>_loader.py or similar thin nn.Module wrapper when a component is fetched from an external HF repo and should be hidden from host-pipeline state-dict matching. |
| Conversion |
scripts/checkpoint_conversion/<family>_to_diffusers.py only when needs_conversion=yes. |
| Pipeline |
fastvideo/pipelines/basic/<family>/<family>_pipeline.py plus sibling files for variants whose components or required modules differ. |
| Pipeline config |
fastvideo/configs/pipelines/<family>.py or fastvideo/pipelines/basic/<family>/pipeline_configs.py. |
| Stages |
fastvideo/pipelines/basic/<family>/stages/ only for model-specific stage subclasses. |
| Presets / registry |
fastvideo/pipelines/basic/<family>/presets.py, fastvideo/registry.py. |
| Tests |
Component parity under tests/local_tests/<bucket>/; pipeline smoke/parity under tests/local_tests/pipelines/; CI-backed quality tests under fastvideo/tests/. |
| Example |
examples/inference/basic/basic_<family>*.py, one per public mode/variant. |
Phase 0: Scope And Handoff Gate
- Validate every required handoff field.
- Resolve
needs_conversion=unknown before component work:
python ".agents/skills/add-model-01-prep/scripts/inspect_hf_layout.py" \
"<hf-or-local-path>" \
--json
- List first-PR scope across both axes:
- Variant axis: base, distill, SR/refine, causal, DMD, I2V, V2V, etc.
- Modality axis: video, image, audio, pose, depth, masks, text, etc.
- For component-only work, explicitly name the downstream full-pipeline PR or
planned consumer.
- Confirm
official_env_status is imports_ok or
private_deps_need_stubs. If it is blocked, return to
../add-model-01-prep/SKILL.md before parity scaffolding.
- Confirm
local_tests_readme exists and records official setup, HF weights,
dependency changes, and planned parity commands for reviewers.
- Confirm
port_state_file exists, follows contracts/port_state.md, and has
rows for open questions/issues found during prep.
- If there are multiple official implementations, choose the one whose
architecture matches the published weights. A blessed library port can be a
better parity reference than a highly configurable research repo; document
the choice in tests.
Phase 1: Reference And Architecture Study
Read the official pipeline call path before writing code.
Record:
- Required modules from
model_index.json or equivalent: transformer, VAE,
text encoders, tokenizers, scheduler, image encoders, audio VAE, vocoder,
conditioners, upsamplers.
- Input/output modalities and every dedicated DiT output head.
- Text/image/audio encoding flow, latent shape, dtype, scaling, packing,
scheduler/timestep math, guidance math, VAE normalization, and decode flow.
- Whether the official code relies on private deps, custom ops, or special
kernels that parity tests must stub.
Arch config rule:
ArchConfig fields must match the emitted per-component config, especially
transformer/config.json, one-to-one.
- Pipeline knobs do not belong on the DiT arch config: inference steps, CFG
scales, flow shift, FPS, VAE stride, text target length, data-proxy knobs,
eval defaults, and sampling defaults go on
PipelineConfig, presets, or
stages.
- If the HF repo is raw or has empty configs, synthesize
transformer/config.json from the official Python model-config class, not
from data/eval config classes.
Phase 2: Early Parity Scaffolding
Create component parity tests before or alongside implementation. Use
../add-model-02-parity/SKILL.md and its templates/component_parity_test.py.
The official reference must import in the current FastVideo environment, or the
prep handoff must identify private deps that will be stubbed locally for tests.
Use local_tests_readme as the reviewer-facing source for setup commands and
update its planned test table as parity scaffolds are added.
This phase is early by design:
- Official loading can be implemented from the reference study.
- FastVideo loading can target planned standardized class/config/loader paths.
- Tests may initially skip because the FastVideo class or converted weights do
not exist yet.
- The scaffold must still contain real official loading, deterministic inputs,
output extraction, and concrete tensor comparisons. No unconditional skips,
no shape-only tests.
Use subagents here: dispatch one parity-test subagent per required component,
including components that may be reused. Their output becomes the red/skip
target that porting or reuse-verification subagents make pass later.
Phase 3: Reuse Gate And Component Dispatch
Build a component inventory before implementation:
| Field |
Meaning |
| Component |
transformer, VAE, text encoder, image encoder, scheduler, conditioner, upsampler, vocoder, etc. |
| Official definition |
Repo-relative source file, class/function name, and relevant line/range if known. |
| Official instantiation |
Repo-relative pipeline/config/factory call site plus constructor args and runtime flags. |
| FastVideo target |
Existing class to reuse or new bucket/file/config to add. |
| Parity test |
Required local test path, including reused components. |
| Status |
reuse_pending, reuse_proven, port_pending, non_skip_pass, or blocked. |
Reuse is allowed only from the checked-out FastVideo tree. Do not wait for or
depend on an open PR adding a native class; add the native port directly in this
PR if the current tree cannot be reused.
Reuse decision:
- Record exact official definition and instantiation evidence for every
component.
- If an existing FastVideo class and config match both definition and
instantiation, pass that reused target to the bucket-specific skill in
mode=prototype and require reuse evidence plus key/shape dumps.
- If either definition or instantiation differs, port the component directly as
FastVideo-native code through the bucket-specific skill.
- Reused components still require non-skip component parity against the exact
official instantiation used by the target pipeline.
Porting subagent dispatch:
- Dispatch one subagent per component after Phase 2 parity scaffolds exist.
- Use
../add-model-03-port-dit/SKILL.md for DiTs/transformers.
- Use
../add-model-04-port-vae/SKILL.md for VAEs.
- Use
../add-model-05-port-encoder/SKILL.md for text, image, audio, or compound
encoders/conditioners that fit the encoder config bucket.
- Use
../add-model-06-port-generic/SKILL.md for schedulers, upsamplers,
vocoders, adapters, preprocessors, or unknown components.
- Each subagent owns one component only and must loop on that component's local
parity test until it produces a non-skip PASS or returns a precise blocker.
Every component subagent must receive a complete packet matching
contracts/component_context.md. If any required path is unknown, pass unknown
plus the exact search already performed. Do not silently omit ambiguous official
files or prototype concerns.
Bucket, layer, and attention rules live in the bucket-specific skills and
fastvideo/layers/AGENTS.md.
Phase 4: Native Component Prototype
Conversion needs a FastVideo state-dict surface. Use the Phase 3
bucket-specific skill in mode=prototype for every required component, including
reused components.
Prototype success criteria:
- the FastVideo-native or reused class/config can import and instantiate with the
exact official architecture args;
- official and FastVideo key/shape dumps exist for every stateful component;
local_tests_readme and port_state_file record prototype status and concerns;
- the returned handoff matches
contracts/component_skill_handoff.md.
Do not chase numerical parity in Phase 4. Prototype mode ends when conversion has
the key/shape surface it needs, or when the component skill returns a precise
blocker or escape hatch.
Phase 5: Param Mapping And Weight Conversion
Use ../add-model-07-conversion/SKILL.md after Phase 4 prototypes exist.
Send a request matching contracts/conversion_request.md; consume the returned
contracts/conversion_handoff.md update before Phase 6.
Use the prep handoff's needs_conversion value:
no: verify the source already has the component layout FastVideo loaders can
consume, then record any passthrough components.
yes: write scripts/checkpoint_conversion/<family>_to_diffusers.py and
output converted_weights/<family>/.
unknown: return to Phase 0.
The conversion skill owns source-layout handling, mapping derivation, config and
model_index.json emission, passthrough assets, strict-load verification, and
Phase 6 retry requests. Component skills must not patch conversion scripts or
converted weights ad hoc.
Phase 6: Component Parity Debug
This is the expected expensive loop. Dispatch one subagent per required
component, including reused components, using the bucket-specific skill in
mode=parity-debug.
Each subagent gets:
- the complete component context packet from Phase 3/4;
- updated conversion mapping notes and strict-load result from Phase 5;
- any prototype concerns or unknowns that were not resolved before conversion.
The bucket-specific skills own parity-debug tactics. If a failure belongs to
conversion, route it through ../add-model-07-conversion/SKILL.md with a retry
request matching contracts/conversion_request.md, then resume the component
skill with the updated conversion handoff.
When a component failure narrows to layer-by-layer numerical drift, load
../add-model-08-trace/SKILL.md before writing custom hooks. It uses
fastvideo/hooks/activation_trace.py; canonical env vars and JSONL format are
documented in docs/contributing/activation_trace.md.
Phase 6 ends only when every required component handoff reports
parity_status=non_skip_pass, or when a precise blocker or escape hatch is
recorded in port_state_file.
Phase 7: Pipeline, Stages, And Variants
Do not start Phase 7 until every required component, reused or ported, has a
non-skip local parity PASS from Phase 6. If any component parity test is still
scaffold_skip, debug_red, blocked, or missing, resume Phase 6 first.
Use ../add-model-09-pipeline/SKILL.md for pipeline definition and parity-debug.
Send a complete packet matching contracts/pipeline_context.md; consume the
returned contracts/pipeline_handoff.md before moving to quality regression or
final handoff.
The pipeline skill owns:
- pipeline class, stage chain, and optional model-specific stages;
- pipeline config, presets, registry updates, and examples;
- official args/defaults/presets comparison before setting FastVideo defaults;
- pipeline smoke and parity tests;
- continuous pipeline parity-debug until non-skip PASS or precise blocker;
- updates to
local_tests_readme and port_state_file.
The pipeline handoff must explicitly cover stage order, variants, modality and
output-head handling, config/preset/registry/example status, smoke/parity tests,
and any return-to-Phase-6 evidence.
Phase 8: PipelineConfig, Presets, Registry, Examples
This phase is implemented through ../add-model-09-pipeline/SKILL.md after the
Phase 7 component-parity gate passes. Accept the pipeline handoff only if it
covers configs, presets, registry detection/exact class resolution, examples,
new SamplingParam fields for public kwargs/defaults, and local smoke/parity
status. Detailed rules live in ../add-model-09-pipeline/SKILL.md.
Phase 9: Parity Activation And Local Verification
Local parity is author-run, not CI-enforced. CI may only run package-level
quality tests later. Before handoff, Phase 2 scaffolds must be activated into
non-skip PASS results.
Order is mandatory:
- Run conversion if needed.
- Run component parity for every required component, including reused ones.
- Run pipeline smoke.
- Run pipeline parity.
- Run the basic example.
If pipeline smoke or parity points back to component implementation,
strict-load, or conversion mapping, return to Phase 6 or Phase 5 rather than
patching around the issue in the pipeline.
Skip policy:
- Follow
shared/common_rules.md: a committed local test may skip for absent
clones/weights, but a local skip is not a verified pass.
Use the commands and tolerance guidance from ../add-model-02-parity/SKILL.md for
component checks and from ../add-model-09-pipeline/SKILL.md for pipeline smoke,
pipeline parity, and examples. Record exact commands, status, and blockers in
local_tests_readme and port_state_file.
Phase 10: Quality Regression
Video outputs:
- Add
fastvideo/tests/ssim/test_<family>_similarity.py when output video
quality must be preserved.
- Seed references through
seed-ssim-references after the test exists.
Audio outputs:
- SSIM does not apply. Use an audio-specific regression metric such as
mel-spectrogram L1, multi-resolution STFT, CLAP cosine, or a project-approved
learned metric.
- Document the metric and hardware/runtime assumptions in the test.
Joint AV outputs:
- Keep video and audio regression checks separate unless there is a validated
joint metric.
Phase 11: Post-Parity Review And Handoff
After parity is green, run a hot-path review before handoff:
- Hoist constant tensor allocations out of sampler/denoising loops.
- Replace per-step
randn_like churn with preallocated buffers plus
.normal_() when safe.
- Move
torch.backends.* flag changes to one-shot setup/load paths.
- Delete
batch.extra writes that nothing reads.
- Derive magic constants from configs when possible.
Pre-handoff checklist:
[ ] Prep handoff is complete and committed nowhere with token values.
[ ] Conversion was run if needed and output loads with real weights.
[ ] Every required component, reused or newly ported, has a non-skip local parity PASS.
[ ] `local_tests_readme` lists every component parity test, command, status, and blocker if any.
[ ] `port_state_file` has every open question/issue either resolved or listed as an explicit blocker.
[ ] Any `next_step=ask_user` has a matching `escape_hatch` block and `E###` row.
[ ] Pipeline smoke has a non-skip local PASS.
[ ] Pipeline parity has a non-skip local PASS against the official reference.
[ ] Basic example runs and writes a non-corrupt output.
[ ] Video SSIM or audio-specific quality regression is added or explicitly deferred.
[ ] Runtime production code has no diffusers/transformers model-class imports.
[ ] Production comments are WHY-focused; examples have user-story docstrings.
[ ] Post-parity hot-path pass is complete.
Ask before deleting any reference clone or staged weights created by
add-model-01-prep. Leave .gitignore entries so future parity assets stay
untracked. Never commit the clone, weights, .env, credentials, or anything
matching *secret*.
References
../add-model-01-prep/SKILL.md for user-input collection, HF inspection,
weight staging, reference cloning, and setup handoff.
contracts/ for canonical handoff schemas used by prep, parity, conversion,
component porting, escape hatches, and final handoff.
../add-model-02-parity/SKILL.md for early component parity scaffolds and
activation templates.
../add-model-07-conversion/SKILL.md for Phase 5 mapping, conversion scripts,
monolithic checkpoint splitting, and strict-load checks.
../add-model-03-port-dit/SKILL.md, ../add-model-04-port-vae/SKILL.md,
../add-model-05-port-encoder/SKILL.md, and
../add-model-06-port-generic/SKILL.md for component subagent implementation
and parity-debug loops.
../add-model-09-pipeline/SKILL.md for pipeline definition, config/preset/
registry/example wiring, smoke tests, and pipeline parity-debug.
fastvideo/layers/AGENTS.md for native layer selection and state-dict surface
guidance.
docs/contributing/coding_agents.md for narrative context.
docs/design/overview.md for pipeline/config/registry architecture.
fastvideo/pipelines/basic/wan/ for standard T2V/I2V/DMD/Causal variants.
fastvideo/pipelines/basic/ltx2/ for non-standard stages and audio/video
patterns.
tests/local_tests/pipelines/test_gamecraft_pipeline_parity.py for pipeline
parity shape.
tests/local_tests/transformers/test_ltx2.py,
tests/local_tests/vaes/test_ltx2_vae.py, and
tests/local_tests/encoders/test_ltx2_gemma_parity.py for component parity.
scripts/checkpoint_conversion/convert_ltx2_weights.py for modern conversion
script shape.
scripts/checkpoint_conversion/wan_to_diffusers.py for legacy regex mapping
reference only.
Changelog
| Date |
Change |
| 2026-04-24 |
Initial FastVideo add-model workflow. |
| 2026-04-30 |
Split external setup into add-model-01-prep. |
| 2026-04-30 |
Rewrote as manual /add-model phase workflow and incorporated prior review decisions. |
| 2026-04-30 |
Extracted early parity scaffolding into add-model-02-parity and moved it before conversion/component implementation. |
| 2026-04-30 |
Added component reuse proof gate, bucket-specific porting skills, and parity PASS requirement for reused components. |
| 2026-04-30 |
Split prototype, conversion, and parity-debug phases; added conversion skill for monolithic and separate checkpoint layouts. |
| 2026-04-30 |
Extracted handoff schemas into contracts/ for shared use across skills. |
| 2026-04-30 |
Added pipeline skill contract and Phase 7 component-parity gate. |
| 2026-04-30 |
Added escape-hatch contract for user decisions and ask_user handoffs. |
1---2name: add-model3description: Manual /add-model workflow for implementing a FastVideo model or first-class component port after add-model-01-prep has staged reference code and weights. Organizes the port into numbered phases with conversion rules, component policies, parity gates, and handoff checks.4---56# Add Model78## Manual Invocation910This skill is for explicit `/add-model` use only. Do not auto-start it from a11casual model-port mention. The setup-only workflow is12`../add-model-01-prep/SKILL.md`.1314## Goal1516Port a new FastVideo model family, model variant, or first-class reusable17component so it can be loaded through FastVideo's native model, config, stage,18registry, preset, and test infrastructure.1920FastVideo has one pipeline architecture: stage-based composition via21`ComposedPipelineBase`. Vary the stages and modules, not the architecture.2223## Scope Shapes2425Use this skill for either shape:2627| Shape | Required output |28|---|---|29| Full model family or variant | Native components, conversion if needed, pipeline config/class, presets, registry, smoke test, local parity tests, example, quality regression. |30| First-class component contribution | Native component class/config, bucket export, component parity test, and a documented downstream pipeline that will consume it. Skip pipeline/preset/registry rows only when the contribution is intentionally component-only. |3132If upstream ships many variants, lock scope before coding. "Base model" means33checkpoint variant, not a modality subset. If the base checkpoint produces34audio, pose, depth, masks, or other output heads, either support those outputs35or get explicit user agreement to drop them.3637## Required Input3839Start from an `add-model-01-prep` handoff, or equivalent fields matching40`contracts/prep_handoff.md`.4142Before Phase 0, read the shared rules and all relevant schemas:4344- `shared/common_rules.md`45- `contracts/prep_handoff.md`46- `contracts/port_state.md`47- `contracts/escape_hatch.md`48- `contracts/component_context.md`49- `contracts/parity_status.md`50- `contracts/conversion_request.md`51- `contracts/conversion_handoff.md`52- `contracts/component_skill_handoff.md`53- `contracts/pipeline_context.md`54- `contracts/pipeline_handoff.md`55- `contracts/final_handoff.md`5657## Hard Rules5859- Follow `shared/common_rules.md` for token/auth safety, state files, escape60 hatches, production import boundaries, and skip/pass semantics.61- If the prep handoff is missing or ambiguous, stop and run62 `../add-model-01-prep/SKILL.md`.63- If a needed component is not ported, do not ship the pipeline that needs it.64- Wan is grandfathered for missing local parity; do not copy its missing-test65 precedent for new work.6667## Escape Hatches6869Follow `shared/common_rules.md` and `contracts/escape_hatch.md`. The main70orchestrator should ask only when no phase skill can safely continue under the71shared rules.7273## Files Map7475| Area | Paths |76|---|---|77| DiT | `fastvideo/models/dits/<family>.py`, `fastvideo/configs/models/dits/<family>.py`, bucket `__init__.py`. |78| VAE | `fastvideo/models/vaes/<arch_or_family>.py`, `fastvideo/configs/models/vaes/<arch_or_family>.py`, bucket `__init__.py`. Name by shared arch when reusable (`oobleck.py`, `autoencoder_kl.py`), otherwise by family (`wanvae.py`). |79| Encoder / conditioner / scheduler / upsampler | Native class/config in the matching `fastvideo/models/<bucket>/` and `fastvideo/configs/models/<bucket>/` bucket. |80| Lazy loader wrapper | Optional `fastvideo/models/<bucket>/<family>_loader.py` or similar thin `nn.Module` wrapper when a component is fetched from an external HF repo and should be hidden from host-pipeline state-dict matching. |81| Conversion | `scripts/checkpoint_conversion/<family>_to_diffusers.py` only when `needs_conversion=yes`. |82| Pipeline | `fastvideo/pipelines/basic/<family>/<family>_pipeline.py` plus sibling files for variants whose components or required modules differ. |83| Pipeline config | `fastvideo/configs/pipelines/<family>.py` or `fastvideo/pipelines/basic/<family>/pipeline_configs.py`. |84| Stages | `fastvideo/pipelines/basic/<family>/stages/` only for model-specific stage subclasses. |85| Presets / registry | `fastvideo/pipelines/basic/<family>/presets.py`, `fastvideo/registry.py`. |86| Tests | Component parity under `tests/local_tests/<bucket>/`; pipeline smoke/parity under `tests/local_tests/pipelines/`; CI-backed quality tests under `fastvideo/tests/`. |87| Example | `examples/inference/basic/basic_<family>*.py`, one per public mode/variant. |8889## Phase 0: Scope And Handoff Gate90911. Validate every required handoff field.922. Resolve `needs_conversion=unknown` before component work:9394```bash95python ".agents/skills/add-model-01-prep/scripts/inspect_hf_layout.py" \96 "<hf-or-local-path>" \97 --json98```991003. List first-PR scope across both axes:101 - Variant axis: base, distill, SR/refine, causal, DMD, I2V, V2V, etc.102 - Modality axis: video, image, audio, pose, depth, masks, text, etc.1034. For component-only work, explicitly name the downstream full-pipeline PR or104 planned consumer.1055. Confirm `official_env_status` is `imports_ok` or106 `private_deps_need_stubs`. If it is `blocked`, return to107 `../add-model-01-prep/SKILL.md` before parity scaffolding.1086. Confirm `local_tests_readme` exists and records official setup, HF weights,109 dependency changes, and planned parity commands for reviewers.1107. Confirm `port_state_file` exists, follows `contracts/port_state.md`, and has111 rows for open questions/issues found during prep.1128. If there are multiple official implementations, choose the one whose113 architecture matches the published weights. A blessed library port can be a114 better parity reference than a highly configurable research repo; document115 the choice in tests.116117## Phase 1: Reference And Architecture Study118119Read the official pipeline call path before writing code.120121Record:122123- Required modules from `model_index.json` or equivalent: transformer, VAE,124 text encoders, tokenizers, scheduler, image encoders, audio VAE, vocoder,125 conditioners, upsamplers.126- Input/output modalities and every dedicated DiT output head.127- Text/image/audio encoding flow, latent shape, dtype, scaling, packing,128 scheduler/timestep math, guidance math, VAE normalization, and decode flow.129- Whether the official code relies on private deps, custom ops, or special130 kernels that parity tests must stub.131132Arch config rule:133134- `ArchConfig` fields must match the emitted per-component config, especially135 `transformer/config.json`, one-to-one.136- Pipeline knobs do not belong on the DiT arch config: inference steps, CFG137 scales, flow shift, FPS, VAE stride, text target length, data-proxy knobs,138 eval defaults, and sampling defaults go on `PipelineConfig`, presets, or139 stages.140- If the HF repo is raw or has empty configs, synthesize141 `transformer/config.json` from the official Python model-config class, not142 from data/eval config classes.143144## Phase 2: Early Parity Scaffolding145146Create component parity tests before or alongside implementation. Use147`../add-model-02-parity/SKILL.md` and its `templates/component_parity_test.py`.148The official reference must import in the current FastVideo environment, or the149prep handoff must identify private deps that will be stubbed locally for tests.150Use `local_tests_readme` as the reviewer-facing source for setup commands and151update its planned test table as parity scaffolds are added.152153This phase is early by design:154155- Official loading can be implemented from the reference study.156- FastVideo loading can target planned standardized class/config/loader paths.157- Tests may initially skip because the FastVideo class or converted weights do158 not exist yet.159- The scaffold must still contain real official loading, deterministic inputs,160 output extraction, and concrete tensor comparisons. No unconditional skips,161 no shape-only tests.162163Use subagents here: dispatch one parity-test subagent per required component,164including components that may be reused. Their output becomes the red/skip165target that porting or reuse-verification subagents make pass later.166167## Phase 3: Reuse Gate And Component Dispatch168169Build a component inventory before implementation:170171| Field | Meaning |172|---|---|173| Component | transformer, VAE, text encoder, image encoder, scheduler, conditioner, upsampler, vocoder, etc. |174| Official definition | Repo-relative source file, class/function name, and relevant line/range if known. |175| Official instantiation | Repo-relative pipeline/config/factory call site plus constructor args and runtime flags. |176| FastVideo target | Existing class to reuse or new bucket/file/config to add. |177| Parity test | Required local test path, including reused components. |178| Status | `reuse_pending`, `reuse_proven`, `port_pending`, `non_skip_pass`, or `blocked`. |179180Reuse is allowed only from the checked-out FastVideo tree. Do not wait for or181depend on an open PR adding a native class; add the native port directly in this182PR if the current tree cannot be reused.183184Reuse decision:1851861. Record exact official definition and instantiation evidence for every187 component.1882. If an existing FastVideo class and config match both definition and189 instantiation, pass that reused target to the bucket-specific skill in190 `mode=prototype` and require reuse evidence plus key/shape dumps.1913. If either definition or instantiation differs, port the component directly as192 FastVideo-native code through the bucket-specific skill.1934. Reused components still require non-skip component parity against the exact194 official instantiation used by the target pipeline.195196Porting subagent dispatch:197198- Dispatch one subagent per component after Phase 2 parity scaffolds exist.199- Use `../add-model-03-port-dit/SKILL.md` for DiTs/transformers.200- Use `../add-model-04-port-vae/SKILL.md` for VAEs.201- Use `../add-model-05-port-encoder/SKILL.md` for text, image, audio, or compound202 encoders/conditioners that fit the encoder config bucket.203- Use `../add-model-06-port-generic/SKILL.md` for schedulers, upsamplers,204 vocoders, adapters, preprocessors, or unknown components.205- Each subagent owns one component only and must loop on that component's local206 parity test until it produces a non-skip PASS or returns a precise blocker.207208Every component subagent must receive a complete packet matching209`contracts/component_context.md`. If any required path is unknown, pass `unknown`210plus the exact search already performed. Do not silently omit ambiguous official211files or prototype concerns.212213Bucket, layer, and attention rules live in the bucket-specific skills and214`fastvideo/layers/AGENTS.md`.215216## Phase 4: Native Component Prototype217218Conversion needs a FastVideo state-dict surface. Use the Phase 3219bucket-specific skill in `mode=prototype` for every required component, including220reused components.221222Prototype success criteria:223224- the FastVideo-native or reused class/config can import and instantiate with the225 exact official architecture args;226- official and FastVideo key/shape dumps exist for every stateful component;227- `local_tests_readme` and `port_state_file` record prototype status and concerns;228- the returned handoff matches `contracts/component_skill_handoff.md`.229230Do not chase numerical parity in Phase 4. Prototype mode ends when conversion has231the key/shape surface it needs, or when the component skill returns a precise232blocker or escape hatch.233234## Phase 5: Param Mapping And Weight Conversion235236Use `../add-model-07-conversion/SKILL.md` after Phase 4 prototypes exist.237Send a request matching `contracts/conversion_request.md`; consume the returned238`contracts/conversion_handoff.md` update before Phase 6.239240Use the prep handoff's `needs_conversion` value:241242- `no`: verify the source already has the component layout FastVideo loaders can243 consume, then record any passthrough components.244- `yes`: write `scripts/checkpoint_conversion/<family>_to_diffusers.py` and245 output `converted_weights/<family>/`.246- `unknown`: return to Phase 0.247248The conversion skill owns source-layout handling, mapping derivation, config and249`model_index.json` emission, passthrough assets, strict-load verification, and250Phase 6 retry requests. Component skills must not patch conversion scripts or251converted weights ad hoc.252253## Phase 6: Component Parity Debug254255This is the expected expensive loop. Dispatch one subagent per required256component, including reused components, using the bucket-specific skill in257`mode=parity-debug`.258259Each subagent gets:260261- the complete component context packet from Phase 3/4;262- updated conversion mapping notes and strict-load result from Phase 5;263- any prototype concerns or unknowns that were not resolved before conversion.264265The bucket-specific skills own parity-debug tactics. If a failure belongs to266conversion, route it through `../add-model-07-conversion/SKILL.md` with a retry267request matching `contracts/conversion_request.md`, then resume the component268skill with the updated conversion handoff.269270When a component failure narrows to layer-by-layer numerical drift, load271`../add-model-08-trace/SKILL.md` before writing custom hooks. It uses272`fastvideo/hooks/activation_trace.py`; canonical env vars and JSONL format are273documented in `docs/contributing/activation_trace.md`.274275Phase 6 ends only when every required component handoff reports276`parity_status=non_skip_pass`, or when a precise blocker or escape hatch is277recorded in `port_state_file`.278279## Phase 7: Pipeline, Stages, And Variants280281Do not start Phase 7 until every required component, reused or ported, has a282non-skip local parity PASS from Phase 6. If any component parity test is still283`scaffold_skip`, `debug_red`, `blocked`, or missing, resume Phase 6 first.284285Use `../add-model-09-pipeline/SKILL.md` for pipeline definition and parity-debug.286Send a complete packet matching `contracts/pipeline_context.md`; consume the287returned `contracts/pipeline_handoff.md` before moving to quality regression or288final handoff.289290The pipeline skill owns:291292- pipeline class, stage chain, and optional model-specific stages;293- pipeline config, presets, registry updates, and examples;294- official args/defaults/presets comparison before setting FastVideo defaults;295- pipeline smoke and parity tests;296- continuous pipeline parity-debug until non-skip PASS or precise blocker;297- updates to `local_tests_readme` and `port_state_file`.298299The pipeline handoff must explicitly cover stage order, variants, modality and300output-head handling, config/preset/registry/example status, smoke/parity tests,301and any return-to-Phase-6 evidence.302303## Phase 8: PipelineConfig, Presets, Registry, Examples304305This phase is implemented through `../add-model-09-pipeline/SKILL.md` after the306Phase 7 component-parity gate passes. Accept the pipeline handoff only if it307covers configs, presets, registry detection/exact class resolution, examples,308new `SamplingParam` fields for public kwargs/defaults, and local smoke/parity309status. Detailed rules live in `../add-model-09-pipeline/SKILL.md`.310311## Phase 9: Parity Activation And Local Verification312313Local parity is author-run, not CI-enforced. CI may only run package-level314quality tests later. Before handoff, Phase 2 scaffolds must be activated into315non-skip PASS results.316317Order is mandatory:3183191. Run conversion if needed.3202. Run component parity for every required component, including reused ones.3213. Run pipeline smoke.3224. Run pipeline parity.3235. Run the basic example.324325If pipeline smoke or parity points back to component implementation,326strict-load, or conversion mapping, return to Phase 6 or Phase 5 rather than327patching around the issue in the pipeline.328329Skip policy:330331- Follow `shared/common_rules.md`: a committed local test may skip for absent332 clones/weights, but a local skip is not a verified pass.333334Use the commands and tolerance guidance from `../add-model-02-parity/SKILL.md` for335component checks and from `../add-model-09-pipeline/SKILL.md` for pipeline smoke,336pipeline parity, and examples. Record exact commands, status, and blockers in337`local_tests_readme` and `port_state_file`.338339## Phase 10: Quality Regression340341Video outputs:342343- Add `fastvideo/tests/ssim/test_<family>_similarity.py` when output video344 quality must be preserved.345- Seed references through `seed-ssim-references` after the test exists.346347Audio outputs:348349- SSIM does not apply. Use an audio-specific regression metric such as350 mel-spectrogram L1, multi-resolution STFT, CLAP cosine, or a project-approved351 learned metric.352- Document the metric and hardware/runtime assumptions in the test.353354Joint AV outputs:355356- Keep video and audio regression checks separate unless there is a validated357 joint metric.358359## Phase 11: Post-Parity Review And Handoff360361After parity is green, run a hot-path review before handoff:362363- Hoist constant tensor allocations out of sampler/denoising loops.364- Replace per-step `randn_like` churn with preallocated buffers plus365 `.normal_()` when safe.366- Move `torch.backends.*` flag changes to one-shot setup/load paths.367- Delete `batch.extra` writes that nothing reads.368- Derive magic constants from configs when possible.369370Pre-handoff checklist:371372```text373[ ] Prep handoff is complete and committed nowhere with token values.374[ ] Conversion was run if needed and output loads with real weights.375[ ] Every required component, reused or newly ported, has a non-skip local parity PASS.376[ ] `local_tests_readme` lists every component parity test, command, status, and blocker if any.377[ ] `port_state_file` has every open question/issue either resolved or listed as an explicit blocker.378[ ] Any `next_step=ask_user` has a matching `escape_hatch` block and `E###` row.379[ ] Pipeline smoke has a non-skip local PASS.380[ ] Pipeline parity has a non-skip local PASS against the official reference.381[ ] Basic example runs and writes a non-corrupt output.382[ ] Video SSIM or audio-specific quality regression is added or explicitly deferred.383[ ] Runtime production code has no diffusers/transformers model-class imports.384[ ] Production comments are WHY-focused; examples have user-story docstrings.385[ ] Post-parity hot-path pass is complete.386```387388Ask before deleting any reference clone or staged weights created by389`add-model-01-prep`. Leave `.gitignore` entries so future parity assets stay390untracked. Never commit the clone, weights, `.env`, credentials, or anything391matching `*secret*`.392393## References394395- `../add-model-01-prep/SKILL.md` for user-input collection, HF inspection,396 weight staging, reference cloning, and setup handoff.397- `contracts/` for canonical handoff schemas used by prep, parity, conversion,398 component porting, escape hatches, and final handoff.399- `../add-model-02-parity/SKILL.md` for early component parity scaffolds and400 activation templates.401- `../add-model-07-conversion/SKILL.md` for Phase 5 mapping, conversion scripts,402 monolithic checkpoint splitting, and strict-load checks.403- `../add-model-03-port-dit/SKILL.md`, `../add-model-04-port-vae/SKILL.md`,404 `../add-model-05-port-encoder/SKILL.md`, and405 `../add-model-06-port-generic/SKILL.md` for component subagent implementation406 and parity-debug loops.407- `../add-model-09-pipeline/SKILL.md` for pipeline definition, config/preset/408 registry/example wiring, smoke tests, and pipeline parity-debug.409- `fastvideo/layers/AGENTS.md` for native layer selection and state-dict surface410 guidance.411- `docs/contributing/coding_agents.md` for narrative context.412- `docs/design/overview.md` for pipeline/config/registry architecture.413- `fastvideo/pipelines/basic/wan/` for standard T2V/I2V/DMD/Causal variants.414- `fastvideo/pipelines/basic/ltx2/` for non-standard stages and audio/video415 patterns.416- `tests/local_tests/pipelines/test_gamecraft_pipeline_parity.py` for pipeline417 parity shape.418- `tests/local_tests/transformers/test_ltx2.py`,419 `tests/local_tests/vaes/test_ltx2_vae.py`, and420 `tests/local_tests/encoders/test_ltx2_gemma_parity.py` for component parity.421- `scripts/checkpoint_conversion/convert_ltx2_weights.py` for modern conversion422 script shape.423- `scripts/checkpoint_conversion/wan_to_diffusers.py` for legacy regex mapping424 reference only.425426## Changelog427428| Date | Change |429|---|---|430| 2026-04-24 | Initial FastVideo add-model workflow. |431| 2026-04-30 | Split external setup into `add-model-01-prep`. |432| 2026-04-30 | Rewrote as manual `/add-model` phase workflow and incorporated prior review decisions. |433| 2026-04-30 | Extracted early parity scaffolding into `add-model-02-parity` and moved it before conversion/component implementation. |434| 2026-04-30 | Added component reuse proof gate, bucket-specific porting skills, and parity PASS requirement for reused components. |435| 2026-04-30 | Split prototype, conversion, and parity-debug phases; added conversion skill for monolithic and separate checkpoint layouts. |436| 2026-04-30 | Extracted handoff schemas into `contracts/` for shared use across skills. |437| 2026-04-30 | Added pipeline skill contract and Phase 7 component-parity gate. |438| 2026-04-30 | Added escape-hatch contract for user decisions and `ask_user` handoffs. |