You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
You are creating an implementation plan for the following idea.
code
Idea:
vibecomfy: model-alias-registry v1 — collapse the four duplicated materialize_model heredoc blocks in runpod_corpus_matrix.py and the inline name-normalization rules in runpod_matrix_remote.py into one declarative YAML registry. No resolver service, no runtime indirection. Just a flat file that staging and normalization both read from.
Model staging and aliasing knowledge is currently spread across:
Four near-identical heredoc Python blocks in scripts/runpod_corpus_matrix.py (lines ~380, ~447, ~521, ~647) that each define a local materialize_model(repo, filename, targets, min_size) function and a hardcoded downloads = [...] list. Adding a new model means editing all four (or remembering which one applies). Drift is inevitable.
Inline name-normalization rules in scripts/runpod_matrix_remote.py (lines ~143–195) that hardcode "if value is ltx-2.3-22b-dev.safetensors map it to X" branching — one branch per known alias. Adding a new model that ships under multiple node-pack names means appending another elif branch.
Module-level constants at the top of scripts/runpod_matrix_remote.py (lines 12–19) — LTX_CHECKPOINT, LTX_TEXT_ENCODER, etc. — that pin canonical names per model. These are referenced from the normalization branches.
Workflow-embedded URLs that the materializer already extracts via vibecomfy/model_assets.py (this work is done; do not redo it). But the staging path on RunPod still doesn't read from those — it uses the hardcoded heredoc lists instead.
The result: a "downloaded but invisible" failure class (entry model_layout in docs/hiddenswitch_incompatibilities.md) where a model is correctly downloaded but lives at the wrong path for the node pack that needs it. Each new node pack adds another inline branch instead of declaring its expected paths once.
Assistant
I couldn't read the vibecomfy source from this worktree (the harness is scoped to vibecomfy-registry, and the actual vibecomfy/ package lives a level up). I'm relying on the brief's "Verified facts" section for line numbers and module shape, and calling that out in assumptions.
Assistant
Plan submitted. Phase 1 builds the schema, loader, and tests; Phase 2 swaps in the loader at the four heredoc sites, the alias cascade, and the constants; Phase 3 validates via unit tests, dry-run, and a parity matrix run gated on a zero find models -type f diff.
Four questions raised — most load-bearing is whether the YAML needs to be bundled into the RunPod payload alongside runpod_matrix_remote.py, since that affects Step 6's wiring. Key assumption flagged: I trusted the brief's "Verified facts" line numbers because this worktree is scoped to vibecomfy-registry and can't read the vibecomfy package directly.
User
Assistant
Reviewing the flags first: none suggest the plan targets the wrong code or root cause — they all surface concrete parity gaps in the proposed mechanics (collision rule too strict, alias matcher too limited, no gating on entries). The fix is to extend the schema and loader, not redesign. Same files, same intent.
Assistant
Revised. Three flags resolved by extending the schema (added alias_match matchers and per-entry gates) and softening the collision rule to unlink-before-link parity. Tests and the matrix parity run now explicitly cover each flag's regression case. No structural redesign — same files, same intent.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
One YAML file that staging and normalization both consume. Five mechanical steps:
Define a YAML schema: canonical model id → source (HF repo + filename or generic URL) → list of (node_pack, target_path) pairs that should be created via hardlink/symlink → minimum size for sanity check → optional list of accepted alias names that should be normalized to the canonical filename.
Author the registry by extracting the existing four downloads = [...] lists and the existing alias branches from the two scripts. Verify exhaustively against current matrix behavior.
Replace the four heredoc materialize_model blocks in runpod_corpus_matrix.py with a single loader that reads the YAML and runs the same hardlink-or-symlink, size-check, fail-loud logic.
Replace the alias-normalization branches in runpod_matrix_remote.py with a single lookup against the YAML's aliases field.
Add a one-shot vibecomfy models stage <registry.yaml> CLI command that any local dev box (not just RunPod) can use to materialize the registry into a target models root.
The registry is append-only and flat. No resolver service. No background daemon. No precedence rules across multiple registries. One file, in repo, edited via PR.
Verified facts (do not re-research)
scripts/runpod_corpus_matrix.py contains the four heredoc blocks: lines 380, 447, 521, 647. Each defines materialize_model(repo, filename, targets, min_size) with the same body (hardlink-or-symlink fallback, size check) and a different downloads = [...] list scoped to a different matrix phase.
scripts/runpod_corpus_matrix.py:67 already pip-installs huggingface_hub[hf_xet]>=0.32.0, so hf_hub_download is available.
scripts/runpod_matrix_remote.py:12-19 declares the LTX/Flux module constants. Lines 143–195 contain the cascade of if value == "X": inputs[key] = "Y" normalization branches (LTX-specific). Lines 376–379 contain Wan-specific equivalents.
vibecomfy/model_assets.py already extracts (name, subdir, url) triples from upstream Comfy-Org workflow JSONs. Those triples populate READY_REQUIREMENTS["models"] in materialized scratchpads. The registry should complement that mechanism, not replace it: the registry covers models whose canonical staging path differs across node packs (LTX, Wan, ACE Step), while the model-assets path covers the simple "URL embedded in the workflow" case.
vibecomfy/fetch.py already exists with download_many and atomic-rename semantics. The registry CLI should reuse vibecomfy.fetch for non-HF URLs and huggingface_hub.hf_hub_download for HF entries (matching the heredoc behavior).
The doc entry Model name and directory conventions differ across node packs in docs/hiddenswitch_incompatibilities.md (Root cause: model_layout) is the spec for what this registry exists to solve.
Steps
S1: YAML schema
Single file at vibecomfy/registry/models.yaml (or data/models.yaml — pick one and document). Schema per entry:
yaml
- id: ltx_2_3_22b_dev_fp8 # canonical id, used for cross-references
source:
kind: huggingface # or "url"
repo: Lightricks/LTX-Video # for kind=huggingface
filename: ltx-2.3-22b-dev-fp8.safetensors
# url: https://... # for kind=url (uses vibecomfy.fetch)
min_size: 1_000_000_000 # bytes, fail loud if smaller
targets: # paths to materialize via hardlink-or-symlink
- node_pack: lightricks
path: models/diffusion_models/ltx-2.3-22b-dev-fp8.safetensors
- node_pack: kjnodes
path: models/checkpoints/ltx-2.3-22b-dev-fp8.safetensors
aliases: # accepted names that normalize to canonical
- ltx-2.3-22b-dev.safetensors
- LTX23_22B_dev.safetensors
notes: |
Multi-pack model. Lightricks expects diffusion_models/, KJNodes expects checkpoints/.
The schema must be expressive enough to reproduce every download in the four existing heredoc blocks AND every alias branch in runpod_matrix_remote.py. If any current behavior cannot be expressed, the schema is wrong — extend it before proceeding.
S2: Author the registry
Read all four downloads = [...] lists in runpod_corpus_matrix.py. Convert each to a registry entry. Preserve min_size exactly.
Read every alias branch in runpod_matrix_remote.py (the if value == X: inputs[key] = Y and value in {A, B}: ... blocks). Convert each to an aliases: list under the canonical entry.
Read the module-level constants (LTX_CHECKPOINT, etc.) and confirm each maps to a registry entry's id.
The registry must be complete enough that S3 and S4 can be dropped in without behavioral change. If the registry is incomplete, S3/S4 will silently break workflows.
S3: Replace heredoc blocks in runpod_corpus_matrix.py
Add a small loader: vibecomfy/registry/models_loader.py. Functions:
stage_entry(entry: ModelEntry, *, models_root: Path) -> list[Path] — hardlink-or-symlink into every targets[].path under models_root, run size check, raise on mismatch. Pure mirror of the existing heredoc behavior.
stage_many(entries: list[ModelEntry], *, models_root: Path, ids: list[str] | None = None) -> None — stage all (or a subset by id).
In runpod_corpus_matrix.py, replace each of the four heredoc blocks with a single call:
Each phase passes the subset of ids it needs. The four phases stay distinct (different model subsets) but share the loader.
S4: Replace alias normalization in runpod_matrix_remote.py
Add a function in vibecomfy/registry/models_loader.py: normalize_alias(value: str, *, registry: list[ModelEntry], node_pack: str | None = None) -> str | None — returns the canonical filename if value matches any entry's aliases (optionally constrained by node_pack), else None.
In runpod_matrix_remote.py, replace the cascade of if value == X: inputs[key] = Y branches with one call to normalize_alias. If it returns a value, use it; otherwise leave the input untouched (current behavior preserves unknown values).
The module constants (LTX_CHECKPOINT, etc.) become thin wrappers that look up the canonical filename by id from the registry. Keep them for source-code readability; they no longer carry the source of truth.
For HF entries, use huggingface_hub.hf_hub_download (matching heredoc behavior — falls back to authentication via HF_TOKEN env var if set).
For URL entries, use vibecomfy.fetch.download (already exists).
--dry-run prints what would be staged and where, with size checks against any already-present files.
Register in vibecomfy/cli.py.
Out of scope (do NOT add)
A resolver service. No HTTP API, no background process, no caching layer beyond what huggingface_hub already provides.
Auto-detection of node packs from installed Python packages.
SHA256 verification (vibecomfy/.megaplan-idea.md already defers this to a follow-up; same applies here).
A "models doctor" that gates execution. Doctor work is deferred per the hiddenswitch_incompatibilities.md decision; the registry is consumed by staging only, not by submit-gating.
Multi-registry composition (overlay registries, project-local overrides). One file.
Migration of vibecomfy/model_assets.py extraction logic — that path stays as-is for workflow-embedded URLs.
A web UI / inspector.
Design constraints
Flat file: a single YAML, source-of-truth for all model staging/aliasing. Append-only in normal operation; edits go through PRs.
No new top-level deps: pyyaml is in the matrix's pip install line; confirm it's also in pyproject.toml. If not, add it (it's tiny).
Reversibility: keep the heredoc blocks behind a --legacy-staging flag for one release cycle in case the registry has a gap that needs an emergency revert. Remove after one passing matrix run.
Behavioral parity: every download and alias the matrix currently handles must be representable. The registry is wrong if it cannot reproduce the current behavior bit-for-bit.
Loud failure: if a registry entry is referenced by id but missing, fail at load time, not at stage time. If a target path collides with an unrelated existing file (not a symlink/hardlink we own), fail rather than overwriting.
Doc cross-reference: when adding a new entry to the registry, the PR description must reference the model_layout row in hiddenswitch_incompatibilities.md (per the Contributing rules in that doc) if the addition was driven by a documented incompatibility.
No prereq clauses
This brief has no hard-halt prereqs. Independent of the validator brief (#1), the watchdog/override/fixture subagents (#2/#3/#4), and the doc-discipline work (#6, already shipped). Ship as soon as ready.
Validation evidence to produce
A full RunPod matrix run completes with the registry-driven staging, producing the same set of staged files as the previous heredoc behavior. Diff find models -type f before/after. Zero diff is the bar.
The 14 existing runtime-green workflows still go green.
A new fictional workflow that uses the same model under a third node-pack name can be supported by appending one aliases: line and one targets: entry to the registry — no code changes elsewhere.
Unit tests in tests/test_models_registry.py: load+roundtrip a sample registry, stage with mocked hf_hub_download, normalize aliases (hits and misses), reject collisions with non-owned files.
Open questions
Should the registry live at vibecomfy/registry/models.yaml (next to the loader) or data/models.yaml (a top-level data dir)? Lean toward vibecomfy/registry/models.yaml for proximity to the loader; revisit if other registries appear.
Should normalize_alias be node-pack-aware (i.e., scope which alias maps activate based on the workflow's source family)? V1: no — global alias namespace. Revisit if two node packs ship the same alias pointing to different canonical models, which would require disambiguation.
Should the loader cache the parsed registry in-memory across calls within a single process? Yes — parse once per process, stash on a module-level singleton or pass through explicitly. Avoid re-parsing per stage call.
code
Project directory:
/Users/user_c042661f/Documents/reigh-workspace/.megaplan-worktrees/vibecomfy-registry
No prior clarification artifact exists. Identify ambiguities, ask clarifying questions, and state your assumptions inside the plan output.
Requirements:
- If the engineering brief suggests an approach, use it as your starting hypothesis — but before committing, consider if there's a simpler or more fundamental fix. The brief is well-researched input, not a final answer.
- If the brief is absent, incomplete, or says "skip", inspect the repository yourself before planning.
- Stay focused on the requested idea. If repo exploration surfaces unrelated issues or docs, ignore them and return to the task.
- Prefer source code, tests, and directly relevant config files. Avoid `.megaplan/`, prior plan artifacts, and unrelated `docs/` or ops/deployment material unless the task explicitly depends on them.
- Stop exploring once you have enough evidence to name the concrete touch points and validation path. Do not keep browsing after you can write the plan.
- Produce a concrete implementation plan in markdown.
- Define observable success criteria as objects with `criterion` (string) and `priority` (`must`, `should`, or `info`):
- `must` — hard gate. The reviewer will block on failure. Use for correctness, functional requirements, and verifiable outcomes (e.g., "all existing tests pass", "API returns 200 for valid input"). Every `must` criterion must have a clear yes/no answer.
- `should` — quality target. The reviewer flags but does not block. Use for subjective goals, numeric guidelines, and best-effort improvements (e.g., "file under ~300 lines", "no deeply nested conditionals", "each function has a single responsibility").
- `info` — documented for humans, reviewer skips. Use for criteria that cannot be verified in this pipeline (e.g., "13 manual smoke tests pass", "stakeholder sign-off obtained").
- Each success criterion should include a `requires` field listing the capabilities needed for verification. Valid capability strings: `run_shell`, `read_files`, `run_tests`, `parse_diff`, `read_build_output`, `run_linter` (container), `drive_browser`, `inspect_runtime_ui`, `observe_runtime_logs`, `subjective_judgment`, `verify_physical_device` (human). `must` criteria MUST have non-empty `requires`. Example: `{"criterion": "All tests pass", "priority": "must", "requires": ["run_tests"]}`.
- Use the `questions` field for ambiguities that would materially change implementation.
- Use the `assumptions` field for defaults you are making so planning can proceed now.
- Prefer cheap validation steps early.
- Keep the plan proportional to the task. A 1-line fix needs a 2-step plan (apply fix + run tests), not a 5-step investigation.
- If user notes answer earlier questions, incorporate them into the draft plan instead of re-asking them.
- Fix the problem fully. Do not limit scope just to avoid breaking existing tests — update the tests too if needed.
- Prefer the simplest, most direct fix. No fallbacks, type conversions, or defensive wrappers without concrete evidence they are needed.
- If the task or issue hints suggest a specific approach, follow it. Only deviate with concrete counter-evidence.
Plan template — simple format (adapt to the actual repo and scope):
md
# Implementation Plan: [Title]
## Overview
Summarize the goal, current repository shape, and the constraints that matter.
## Main Phase
### Step 1: Audit the current behavior (`megaplan/prompts.py`)
**Scope:** Small
1. **Inspect** the current implementation and call out the exact insertion points (`megaplan/prompts.py:29`).
### Step 2: Add the first change (`megaplan/evaluation.py`)
**Scope:** Medium
1. **Implement** the smallest viable change with exact file references (`megaplan/evaluation.py:1`).
2. **Capture** any tricky behavior with a short example.
```python
issues = validate_plan_structure(plan_text)
```
### Step 3: Wire downstream behavior (`megaplan/handlers.py`, `megaplan/workers.py`)
**Scope:** Medium
1. **Update** the runtime flow in the touched files (`megaplan/handlers.py:400`, `megaplan/workers.py:199`).
### Step 4: Prove the change (`tests/test_evaluation.py`, `tests/test_megaplan.py`)
**Scope:** Small
1. **Run** the cheapest targeted checks first (`tests/test_evaluation.py:1`).
2. **Finish** with broader verification once the wiring is in place (`tests/test_megaplan.py:1`).
## Execution Order
1. Update prompts and mocks before enforcing stricter validation.
2. Land higher-risk wiring after the validator and tests are ready.
## Validation Order
1. Start with focused unit tests.
2. Run the broader suite after the flow changes are in place.
For complex plans, use multiple phases:
md
## Phase 1: Foundation — Dependencies, DB, Types
### Step 1: Install dependencies (`package.json`)
...
### Step 2: Create database migration (`supabase/migrations/`)
...
## Phase 2: Core Integration
### Step 3: Port the main component (`src/components/`)
...
Template guidance:
Simple plans: use ## Main Phase with ### Step N: sections underneath.
Complex plans: use multiple ## Phase N: sections, each containing ### Step N: steps. Step numbers are global (not per-phase).
The flat ## Step N: format (without phases) also works for backwards compatibility.
Key invariants: one H1 title, one ## Overview, numbered step sections (### Step N: or ## Step N:), and at least one ordering section.
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
You are revising an implementation plan after critique and gate feedback.
vibecomfy: model-alias-registry v1 — collapse the four duplicated materialize_model heredoc blocks in runpod_corpus_matrix.py and the inline name-normalization rules in runpod_matrix_remote.py into one declarative YAML registry. No resolver service, no runtime indirection. Just a flat file that staging and normalization both read from.
Model staging and aliasing knowledge is currently spread across:
Four near-identical heredoc Python blocks in scripts/runpod_corpus_matrix.py (lines ~380, ~447, ~521, ~647) that each define a local materialize_model(repo, filename, targets, min_size) function and a hardcoded downloads = [...] list. Adding a new model means editing all four (or remembering which one applies). Drift is inevitable.
Inline name-normalization rules in scripts/runpod_matrix_remote.py (lines ~143–195) that hardcode "if value is ltx-2.3-22b-dev.safetensors map it to X" branching — one branch per known alias. Adding a new model that ships under multiple node-pack names means appending another elif branch.
Module-level constants at the top of scripts/runpod_matrix_remote.py (lines 12–19) — LTX_CHECKPOINT, LTX_TEXT_ENCODER, etc. — that pin canonical names per model. These are referenced from the normalization branches.
Workflow-embedded URLs that the materializer already extracts via vibecomfy/model_assets.py (this work is done; do not redo it). But the staging path on RunPod still doesn't read from those — it uses the hardcoded heredoc lists instead.
The result: a "downloaded but invisible" failure class (entry model_layout in docs/hiddenswitch_incompatibilities.md) where a model is correctly downloaded but lives at the wrong path for the node pack that needs it. Each new node pack adds another inline branch instead of declaring its expected paths once.
Goal
One YAML file that staging and normalization both consume. Five mechanical steps:
Define a YAML schema: canonical model id → source (HF repo + filename or generic URL) → list of (node_pack, target_path) pairs that should be created via hardlink/symlink → minimum size for sanity check → optional list of accepted alias names that should be normalized to the canonical filename.
Author the registry by extracting the existing four downloads = [...] lists and the existing alias branches from the two scripts. Verify exhaustively against current matrix behavior.
Replace the four heredoc materialize_model blocks in runpod_corpus_matrix.py with a single loader that reads the YAML and runs the same hardlink-or-symlink, size-check, fail-loud logic.
Replace the alias-normalization branches in runpod_matrix_remote.py with a single lookup against the YAML's aliases field.
Add a one-shot vibecomfy models stage <registry.yaml> CLI command that any local dev box (not just RunPod) can use to materialize the registry into a target models root.
The registry is append-only and flat. No resolver service. No background daemon. No precedence rules across multiple registries. One file, in repo, edited via PR.
Verified facts (do not re-research)
scripts/runpod_corpus_matrix.py contains the four heredoc blocks: lines 380, 447, 521, 647. Each defines materialize_model(repo, filename, targets, min_size) with the same body (hardlink-or-symlink fallback, size check) and a different downloads = [...] list scoped to a different matrix phase.
scripts/runpod_corpus_matrix.py:67 already pip-installs huggingface_hub[hf_xet]>=0.32.0, so hf_hub_download is available.
scripts/runpod_matrix_remote.py:12-19 declares the LTX/Flux module constants. Lines 143–195 contain the cascade of if value == "X": inputs[key] = "Y" normalization branches (LTX-specific). Lines 376–379 contain Wan-specific equivalents.
vibecomfy/model_assets.py already extracts (name, subdir, url) triples from upstream Comfy-Org workflow JSONs. Those triples populate READY_REQUIREMENTS["models"] in materialized scratchpads. The registry should complement that mechanism, not replace it: the registry covers models whose canonical staging path differs across node packs (LTX, Wan, ACE Step), while the model-assets path covers the simple "URL embedded in the workflow" case.
vibecomfy/fetch.py already exists with download_many and atomic-rename semantics. The registry CLI should reuse vibecomfy.fetch for non-HF URLs and huggingface_hub.hf_hub_download for HF entries (matching the heredoc behavior).
The doc entry Model name and directory conventions differ across node packs in docs/hiddenswitch_incompatibilities.md (Root cause: model_layout) is the spec for what this registry exists to solve.
Steps
S1: YAML schema
Single file at vibecomfy/registry/models.yaml (or data/models.yaml — pick one and document). Schema per entry:
yaml
- id: ltx_2_3_22b_dev_fp8 # canonical id, used for cross-references
source:
kind: huggingface # or "url"
repo: Lightricks/LTX-Video # for kind=huggingface
filename: ltx-2.3-22b-dev-fp8.safetensors
# url: https://... # for kind=url (uses vibecomfy.fetch)
min_size: 1_000_000_000 # bytes, fail loud if smaller
targets: # paths to materialize via hardlink-or-symlink
- node_pack: lightricks
path: models/diffusion_models/ltx-2.3-22b-dev-fp8.safetensors
- node_pack: kjnodes
path: models/checkpoints/ltx-2.3-22b-dev-fp8.safetensors
aliases: # accepted names that normalize to canonical
- ltx-2.3-22b-dev.safetensors
- LTX23_22B_dev.safetensors
notes: |
Multi-pack model. Lightricks expects diffusion_models/, KJNodes expects checkpoints/.
The schema must be expressive enough to reproduce every download in the four existing heredoc blocks AND every alias branch in runpod_matrix_remote.py. If any current behavior cannot be expressed, the schema is wrong — extend it before proceeding.
S2: Author the registry
Read all four downloads = [...] lists in runpod_corpus_matrix.py. Convert each to a registry entry. Preserve min_size exactly.
Read every alias branch in runpod_matrix_remote.py (the if value == X: inputs[key] = Y and value in {A, B}: ... blocks). Convert each to an aliases: list under the canonical entry.
Read the module-level constants (LTX_CHECKPOINT, etc.) and confirm each maps to a registry entry's id.
The registry must be complete enough that S3 and S4 can be dropped in without behavioral change. If the registry is incomplete, S3/S4 will silently break workflows.
S3: Replace heredoc blocks in runpod_corpus_matrix.py
Add a small loader: vibecomfy/registry/models_loader.py. Functions:
stage_entry(entry: ModelEntry, *, models_root: Path) -> list[Path] — hardlink-or-symlink into every targets[].path under models_root, run size check, raise on mismatch. Pure mirror of the existing heredoc behavior.
stage_many(entries: list[ModelEntry], *, models_root: Path, ids: list[str] | None = None) -> None — stage all (or a subset by id).
In runpod_corpus_matrix.py, replace each of the four heredoc blocks with a single call:
Each phase passes the subset of ids it needs. The four phases stay distinct (different model subsets) but share the loader.
S4: Replace alias normalization in runpod_matrix_remote.py
Add a function in vibecomfy/registry/models_loader.py: normalize_alias(value: str, *, registry: list[ModelEntry], node_pack: str | None = None) -> str | None — returns the canonical filename if value matches any entry's aliases (optionally constrained by node_pack), else None.
In runpod_matrix_remote.py, replace the cascade of if value == X: inputs[key] = Y branches with one call to normalize_alias. If it returns a value, use it; otherwise leave the input untouched (current behavior preserves unknown values).
The module constants (LTX_CHECKPOINT, etc.) become thin wrappers that look up the canonical filename by id from the registry. Keep them for source-code readability; they no longer carry the source of truth.
For HF entries, use huggingface_hub.hf_hub_download (matching heredoc behavior — falls back to authentication via HF_TOKEN env var if set).
For URL entries, use vibecomfy.fetch.download (already exists).
--dry-run prints what would be staged and where, with size checks against any already-present files.
Register in vibecomfy/cli.py.
Out of scope (do NOT add)
A resolver service. No HTTP API, no background process, no caching layer beyond what huggingface_hub already provides.
Auto-detection of node packs from installed Python packages.
SHA256 verification (vibecomfy/.megaplan-idea.md already defers this to a follow-up; same applies here).
A "models doctor" that gates execution. Doctor work is deferred per the hiddenswitch_incompatibilities.md decision; the registry is consumed by staging only, not by submit-gating.
Multi-registry composition (overlay registries, project-local overrides). One file.
Migration of vibecomfy/model_assets.py extraction logic — that path stays as-is for workflow-embedded URLs.
A web UI / inspector.
Design constraints
Flat file: a single YAML, source-of-truth for all model staging/aliasing. Append-only in normal operation; edits go through PRs.
No new top-level deps: pyyaml is in the matrix's pip install line; confirm it's also in pyproject.toml. If not, add it (it's tiny).
Reversibility: keep the heredoc blocks behind a --legacy-staging flag for one release cycle in case the registry has a gap that needs an emergency revert. Remove after one passing matrix run.
Behavioral parity: every download and alias the matrix currently handles must be representable. The registry is wrong if it cannot reproduce the current behavior bit-for-bit.
Loud failure: if a registry entry is referenced by id but missing, fail at load time, not at stage time. If a target path collides with an unrelated existing file (not a symlink/hardlink we own), fail rather than overwriting.
Doc cross-reference: when adding a new entry to the registry, the PR description must reference the model_layout row in hiddenswitch_incompatibilities.md (per the Contributing rules in that doc) if the addition was driven by a documented incompatibility.
No prereq clauses
This brief has no hard-halt prereqs. Independent of the validator brief (#1), the watchdog/override/fixture subagents (#2/#3/#4), and the doc-discipline work (#6, already shipped). Ship as soon as ready.
Validation evidence to produce
A full RunPod matrix run completes with the registry-driven staging, producing the same set of staged files as the previous heredoc behavior. Diff find models -type f before/after. Zero diff is the bar.
The 14 existing runtime-green workflows still go green.
A new fictional workflow that uses the same model under a third node-pack name can be supported by appending one aliases: line and one targets: entry to the registry — no code changes elsewhere.
Unit tests in tests/test_models_registry.py: load+roundtrip a sample registry, stage with mocked hf_hub_download, normalize aliases (hits and misses), reject collisions with non-owned files.
Open questions
Should the registry live at vibecomfy/registry/models.yaml (next to the loader) or data/models.yaml (a top-level data dir)? Lean toward vibecomfy/registry/models.yaml for proximity to the loader; revisit if other registries appear.
Should normalize_alias be node-pack-aware (i.e., scope which alias maps activate based on the workflow's source family)? V1: no — global alias namespace. Revisit if two node packs ship the same alias pointing to different canonical models, which would require disambiguation.
Should the loader cache the parsed registry in-memory across calls within a single process? Yes — parse once per process, stash on a module-level singleton or pass through explicitly. Avoid re-parsing per stage call.
code
Current plan (markdown):
# Implementation Plan: vibecomfy model-alias-registry v1
Overview
Collapse the four duplicated materialize_model heredoc blocks in scripts/runpod_corpus_matrix.py and the inline alias-normalization rules in scripts/runpod_matrix_remote.py into a single declarative YAML registry consumed by both staging and normalization. No resolver service, no runtime indirection — one flat file in repo, edited via PR.
The work is mechanical: define the schema, author the registry from existing call sites, add a small loader/CLI, and replace the four heredoc blocks plus the alias-cascade with calls into the loader. The bar is bit-for-bit behavioral parity with the current matrix run; a --legacy-staging escape hatch ships in the same PR and is removed after one passing matrix run.
Source-repo touch points (per brief's verified facts; this worktree does not contain the vibecomfy package — execution will happen in /Users/user_c042661f/Documents/reigh-workspace/vibecomfy):
Step 1: Audit current behavior and confirm dep state (scripts/runpod_corpus_matrix.py, scripts/runpod_matrix_remote.py, pyproject.toml)
Scope: Small
Open the four heredoc blocks at the lines named in the brief (scripts/runpod_corpus_matrix.py:380, :447, :521, :647) and capture, for each, the repo, filename, targets, and min_size of every downloads entry into a scratch list. This list is the source-of-truth input for Step 3.
Openscripts/runpod_matrix_remote.py:12-19 and write down the constant → canonical-filename mapping (LTX_CHECKPOINT, LTX_TEXT_ENCODER, etc.). Open lines 143–195 and 376–379 and capture every alias-rewrite branch as (observed_value, canonical_value, key_context).
Confirmpyyaml is declared in pyproject.toml (the matrix pip-installs it; the registry CLI imports it). Note whether it needs to be added.
A frozen ModelEntry dataclass mirroring the schema from the brief: id, source (kind=huggingface|url, repo/filename or url), min_size, targets: list[Target] where Target = (node_pack: str, path: str), aliases: list[str], optional notes.
load_registry(path: str | Path) -> list[ModelEntry] — parses YAML, validates required fields, fails loud on duplicate ids or duplicate aliases, caches the parsed result on a module-level _REGISTRY_CACHE: dict[Path, list[ModelEntry]] keyed by resolved absolute path (per brief's open-question lean).
stage_entry(entry, *, models_root: Path, source_path: Path) -> list[Path] — for each target, resolve models_root / target.path, ensure parent dir exists, attempt os.link(source_path, target_full), fall back to os.symlink on cross-filesystem OSError, then os.stat and assert >= entry.min_size. If target_full already exists and is not a symlink/hardlink pointing at the same inode, raise RegistryCollisionError. Return the list of created paths.
stage_many(entries, *, models_root: Path, ids: list[str] | None, downloader) -> None — for each entry, call downloader(entry) to obtain source_path (HF or URL), then stage_entry. downloader is injected so unit tests can mock it without touching huggingface_hub or network.
normalize_alias(value: str, *, registry: list[ModelEntry]) -> str | None — flat lookup over a precomputed {alias: canonical_filename} map (built once and memoized on the registry list via a _alias_index attribute or a sibling cache dict). Returns None if no match. V1: not node-pack-aware (per brief's open-question lean).
Define custom exceptions RegistryLoadError, RegistryCollisionError, RegistrySizeError for loud, distinguishable failures.
Step 3: Author the registry (vibecomfy/registry/models.yaml)
Scope: Medium
Translate every downloads entry captured in Step 1.1 into a ModelEntry YAML record. Preserve min_size exactly. For each model that appears in multiple heredoc blocks with overlapping targets, dedupe into one entry whose targets is the union.
Add the aliases: list per entry from Step 1.2's captured rewrites. Confirm every constant in scripts/runpod_matrix_remote.py:12-19 resolves to exactly one entry id.
Diff-check by writing a one-off comparison script (kept in scratch, not committed) that loads the registry and prints, for each phase in runpod_corpus_matrix.py, the union of (repo, filename, target_path, min_size) tuples; assert it equals the union derived directly from the heredoc blocks. Behavioral parity must be bit-for-bit before proceeding.
python
from vibecomfy.registry.models_loader import load_registry
reg = load_registry("vibecomfy/registry/models.yaml")
tuples = {(e.source.repo, e.source.filename, t.path, e.min_size)
for e in reg for t in e.targets}
Step 4: Unit tests (tests/test_models_registry.py)
Scope: Small
Add tests that cover:
load_registry round-trip on a fixture YAML (tests/fixtures/sample_registry.yaml).
load_registry rejects duplicate ids and duplicate aliases with RegistryLoadError.
stage_entry with a fake source file uses hardlink when same FS, falls back to symlink when os.link raises OSError(errno=EXDEV) (monkeypatched).
stage_entry raises RegistrySizeError when stat size < min_size.
stage_entry raises RegistryCollisionError when target exists and is not owned (i.e., not a symlink/hardlink to the source inode).
normalize_alias hit (returns canonical), miss (returns None), and cache reuse on second call.
stage_many with a mocked downloader invokes stage_entry per id when ids= is passed.
Runpytest tests/test_models_registry.py -x and iterate to green before touching any caller.
Implement--dry-run: skip downloader; for each target, print <status> <models_root/target.path> where status is present-ok, present-size-mismatch, or missing, then exit 0.
Wireregister(subparsers) into vibecomfy/cli.py alongside existing subcommands.
Step 6: Replace the four heredoc blocks (scripts/runpod_corpus_matrix.py)
Scope: Medium
Determine per-phase id subsets by mapping each old downloads list to the registry ids authored in Step 3. Document this mapping inline as a comment near each call site so future readers see why each phase passes a specific subset.
Replace each heredoc at scripts/runpod_corpus_matrix.py:380, :447, :521, :647 with a single shell-out:
matching the existing $PY -m ... invocation pattern used in the surrounding RunPod heredocs. (Module entry point dispatches to the same vibecomfy models stage logic as Step 5.)
Add a --legacy-staging CLI flag at the top of runpod_corpus_matrix.py that, when set, retains the original heredoc blocks. Default is the new path; legacy is only an emergency revert per the brief's reversibility constraint.
Step 7: Replace the alias cascade (scripts/runpod_matrix_remote.py)
Scope: Medium
Add at module top: _REGISTRY = load_registry(_REGISTRY_PATH) where _REGISTRY_PATH is resolved relative to the script (or via env var, mirroring how the script is shipped to the pod).
Replace the cascade at lines 143–195 (LTX) and 376–379 (Wan) with a single call:
python
canonical = normalize_alias(value, registry=_REGISTRY)
if canonical is not None:
inputs[key] = canonical
Unknown values are left untouched (preserves current behavior).
Convert the module constants at lines 12–19 (LTX_CHECKPOINT, LTX_TEXT_ENCODER, etc.) into thin wrappers that look up the canonical filename by id from _REGISTRY (e.g., LTX_CHECKPOINT = _by_id("ltx_2_3_22b_dev_fp8").source.filename). Keep the constant names — they're for source-code readability — but the registry is now the source of truth.
Phase 3: Validation
Step 8: Local validation (tests/test_models_registry.py, vibecomfy/cli.py)
Scope: Small
Runpytest tests/test_models_registry.py -x — must be green.
Runpython -m vibecomfy.cli models stage vibecomfy/registry/models.yaml --dry-run --models-root /tmp/fake_root and verify it prints missing for every target without raising.
Runpython -c "import scripts.runpod_matrix_remote" (or the script's existing --help) to confirm the module-top load_registry call doesn't break import-time behavior.
Step 9: Matrix parity run
Scope: Small
Run the full RunPod corpus matrix end-to-end (scripts/runpod_corpus_matrix.py) with the registry-driven path.
Difffind models -type f | sort | sha256sum (or equivalent) before and after the change. Zero diff is the bar; non-zero means the registry is missing an entry or has a wrong path and must be corrected before the PR ships.
Confirm the 14 existing runtime-green workflows remain green.
Manually verify one fictional case from the brief: appending one aliases: line and one targets: entry for a third node-pack name supports the new pack with no code changes elsewhere.
Execution Order
Phase 1 (Steps 1–4): authoring the registry and loader is the foundation; tests must be green before any caller is touched.
Phase 2 (Steps 5–7): CLI first (Step 5), then the matrix script (Step 6), then the remote script (Step 7). Each can be merged-and-reverted independently if Step 9 finds a gap.
Phase 3 (Steps 8–9): local checks before matrix. The matrix run is expensive — only invoke once Steps 1–7 are complete and unit tests pass.
Validation Order
Unit tests on the loader (Step 4 / Step 8.1) — cheap, catches schema and mechanical errors.
Dry-run CLI against the authored registry (Step 8.2) — confirms YAML parses and target paths resolve.
Module-import sanity on runpod_matrix_remote.py (Step 8.3) — confirms the _REGISTRY load doesn't break the remote-side script.
Full matrix parity run with find -type f diff (Step 9) — the load-bearing behavioral check. Zero diff is the gate.
Re-run the 14 existing workflows for runtime parity.
code
Current plan metadata:
{
"version": 1,
"timestamp": "2026-04-26T14:18:10Z",
"hash": "sha256:3f1f533b01b73aa5ae1bf687b5f76f54a5a293a30943a29270884ca228e974c9",
"questions": [
"Should the --legacy-staging flag ship in this PR (per the brief's reversibility constraint) and be removed in a follow-up after one passing matrix run, or is the same PR allowed to remove the heredoc blocks outright?",
"For runpod_matrix_remote.py, the script runs on the RunPod pod \u2014 is vibecomfy/registry/models.yaml already shipped to the pod alongside the script, or does Step 7 need to also bundle/copy the YAML into the pod payload? (If the latter, this changes Step 6 to also stage the YAML.)",
"Does vibecomfy/cli.py use argparse subparsers, click, typer, or a hand-rolled dispatcher? Step 5's register(subparsers) shape assumes argparse \u2014 needs adjusting if different.",
"Is there an existing tests/ layout and pytest config in vibecomfy (conftest, fixtures dir conventions) that the new tests/test_models_registry.py should follow?"
],
"success_criteria": [
{
"criterion": "vibecomfy/registry/models.yaml, vibecomfy/registry/models_loader.py, vibecomfy/commands/models.py, and tests/test_models_registry.py exist and are committed",
"priority": "must",
"requires": [
"read_files"
]
},
{
"criterion": "load_registry raises a distinct error on duplicate ids and on duplicate aliases",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "stage_entry creates a hardlink when source and target are on the same filesystem and falls back to symlink on EXDEV, and raises a size error when the staged file is smaller than min_size",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "stage_entry raises a collision error when the target path exists and is not a symlink/hardlink owned by the registry (i.e., not pointing at the source inode)",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "normalize_alias returns the canonical filename on a registered alias and None on an unknown value, and the alias index is built once per registry instance (not on every call)",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "All four heredoc materialize_model blocks in scripts/runpod_corpus_matrix.py (~lines 380, 447, 521, 647) are replaced with calls into the registry loader; the only remaining heredoc-style staging is gated behind --legacy-staging",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "The alias cascade in scripts/runpod_matrix_remote.py (lines 143\u2013195 and 376\u2013379) is replaced with a single normalize_alias call; module-level constants at lines 12\u201319 are derived from the registry by id rather than hardcoded strings",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": " passes",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": " exits 0 and lists every target with a status",
"priority": "must",
"requires": [
"run_shell"
]
},
{
"criterion": "Importing does not raise at import time with the registry-driven load in place",
"priority": "must",
"requires": [
"run_shell"
]
},
{
"criterion": "Full RunPod corpus matrix run produces a listing identical to the pre-change run (zero diff)",
"priority": "info",
"requires": [
"subjective_judgment"
]
},
{
"criterion": "All 14 existing runtime-green workflows remain green after the change",
"priority": "info",
"requires": [
"subjective_judgment"
]
},
{
"criterion": "Adding a third node-pack name for an existing model requires only one line and one entry in \u2014 no code changes elsewhere",
"priority": "should",
"requires": [
"subjective_judgment"
]
},
{
"criterion": " is declared in (added if missing) so the registry loader does not depend on the matrix pip-install line",
"priority": "must",
"requires": [
"read_files"
]
},
{
"criterion": "Loader, CLI command, and tests each stay under ~300 lines and avoid deeply nested conditionals",
"priority": "should",
"requires": [
"read_files",
"subjective_judgment"
]
}
],
"assumptions": [
"The brief's 'Verified facts' (line numbers in and , existence of , , and ) are accurate and current \u2014 this worktree is scoped to and cannot read the vibecomfy package directly.",
"Open question on registry path resolved per the brief's lean: file lives at next to the loader.",
"Open question on node-pack-aware normalization resolved per the brief's lean: V1 is a global alias namespace; revisit only if two packs ship the same alias pointing at different canonicals.",
"Open question on caching resolved per the brief's lean: parse once per process, memoized via a module-level dict keyed by resolved absolute path.",
" ships in the same PR as a one-release-cycle escape hatch and is removed in a follow-up after one passing matrix run, per the brief's reversibility constraint.",
" uses argparse subparsers (the most common Python convention); Step 5 will be adjusted if the actual dispatcher is click/typer/hand-rolled.",
"The YAML registry file is already (or trivially can be) shipped to the RunPod pod alongside ; Step 7's call resolves a path relative to the script.",
" with matches the auth behavior in the existing heredoc blocks. If the heredocs use a different auth pattern, Step 5 will mirror that instead.",
"Tests live under at the vibecomfy package root and use plain pytest; existing fixture conventions will be followed if discovered during Step 1.",
"Behavioral parity is verified by content-hash diff (Step 9.2). If the matrix produces non-deterministic file ordering or timestamps, the diff will be sorted-and-hashed per file rather than per directory listing."
],
"structure_warnings": []
}
code
Gate summary:
{
"recommendation": "ITERATE",
"rationale": "Light robustness: single revision pass to incorporate critique feedback.",
"signals_assessment": "",
"warnings": [],
"settled_decisions": []
}
code
Open significant flags:
[
{
"id": "FLAG-001",
"severity": "significant",
"status": "open",
"concern": "Model staging: the proposed collision rule will break existing sequential matrix phases that intentionally restage the same target path from a later download.",
"evidence": "scripts/runpod_corpus_matrix.py currently unlinks any existing target before linking the downloaded file in every materialize_model block. There is already a shared target path: the core phase stages Comfy-Org/flux2-devsplit_files/vae/flux2-vae.safetensors to models/vae/flux2-vae.safetensors, and the GGUF phase later stages Comfy-Org/flux2-klein-9Bsplit_files/vae/flux2-vae.safetensors to the same path. The plan's stage_entry says an existing target that is not a symlink/hardlink to the same source raises RegistryCollisionError, so an all-scope run can fail where the current behavior overwrites/relinks."
},
{
"id": "FLAG-002",
"severity": "significant",
"status": "open",
"concern": "Alias normalization: an exact alias lookup cannot reproduce the current pattern-based LTX rewrites.",
"evidence": "scripts/runpod_matrix_remote.py does more than exact string aliases: it maps any string whose slash-normalized value ends with taeltx2_3.safetensors to LTX_PREVIEW_VAE, and for values containing both ltx-2.3-22b-distilled and transformer_only it strips the path to the basename. The plan's normalize_alias(value) is a flat {alias: canonical_filename} exact lookup, so workflows using path-prefixed variants that currently normalize would be left untouched."
},
{
"id": "FLAG-003",
"severity": "significant",
"status": "open",
"concern": "Conditional downloads: the plan does not preserve the current HF_TOKEN/scope gate for the LTX HDR IC-LoRA model.",
"evidence": "The LTX heredoc appends Lightricks/LTX-2.3-22b-IC-LoRA-HDR only when HF_TOKEN is set and the scope is not ltx_official_public or ltx_iclora_public; otherwise it prints a skip message. The plan describes static per-phase --ids subsets from the registry. If the HDR id is always included, public/no-token runs can fail on a gated model; if it is omitted, tokened non-public runs lose an existing staged asset."
}
]
code
Requirements:
- Before addressing individual flags, check: does any flag suggest the plan is targeting the wrong code or the wrong root cause? If so, consider whether the plan needs a new approach rather than adjustments. Explain your reasoning.
- Update the plan to address the significant issues.
- Keep the plan readable and executable.
- Return flags_addressed with the exact flag IDs you addressed.
- Include `changes_summary` as a short plain-English summary of what changed in the revision. If there were no concrete flags, say that explicitly (for example: `No critique flags were raised; refined wording and kept the plan aligned for execution.`).
- Preserve or improve success criteria quality. Each criterion must have a `priority` of `must`, `should`, or `info`. Promote or demote priorities if critique feedback reveals a criterion was over- or under-weighted.
- Verify that the plan remains aligned with the user's original intent, not just internal plan quality.
- Remove unjustified scope growth. If critique raised scope creep, narrow the plan back to the original idea unless the broader work is strictly required.
- Maintain the structural template: H1 title, ## Overview, phase sections with numbered step sections, ## Execution Order or ## Validation Order.
- CRITICAL: Your entire revised plan markdown (all sections) must be output as the `plan` field in the structured output. The prose response must not contain the plan text.
- CRITICAL: Return only the structured JSON object for the schema fields `plan`, `changes_summary`, `flags_addressed`, `assumptions`, `success_criteria`, and `questions`. Do not add commentary before or after the JSON object.
Plan template — simple format (adapt to the actual repo and scope):
md
# Implementation Plan: [Title]
## Overview
Summarize the goal, current repository shape, and the constraints that matter.
## Main Phase
### Step 1: Audit the current behavior (`megaplan/prompts.py`)
**Scope:** Small
1. **Inspect** the current implementation and call out the exact insertion points (`megaplan/prompts.py:29`).
### Step 2: Add the first change (`megaplan/evaluation.py`)
**Scope:** Medium
1. **Implement** the smallest viable change with exact file references (`megaplan/evaluation.py:1`).
2. **Capture** any tricky behavior with a short example.
```python
issues = validate_plan_structure(plan_text)
```
### Step 3: Wire downstream behavior (`megaplan/handlers.py`, `megaplan/workers.py`)
**Scope:** Medium
1. **Update** the runtime flow in the touched files (`megaplan/handlers.py:400`, `megaplan/workers.py:199`).
### Step 4: Prove the change (`tests/test_evaluation.py`, `tests/test_megaplan.py`)
**Scope:** Small
1. **Run** the cheapest targeted checks first (`tests/test_evaluation.py:1`).
2. **Finish** with broader verification once the wiring is in place (`tests/test_megaplan.py:1`).
## Execution Order
1. Update prompts and mocks before enforcing stricter validation.
2. Land higher-risk wiring after the validator and tests are ready.
## Validation Order
1. Start with focused unit tests.
2. Run the broader suite after the flow changes are in place.
For complex plans, use multiple phases:
md
## Phase 1: Foundation — Dependencies, DB, Types
### Step 1: Install dependencies (`package.json`)
...
### Step 2: Create database migration (`supabase/migrations/`)
...
## Phase 2: Core Integration
### Step 3: Port the main component (`src/components/`)
...
Template guidance:
Simple plans: use ## Main Phase with ### Step N: sections underneath.
Complex plans: use multiple ## Phase N: sections, each containing ### Step N: steps. Step numbers are global (not per-phase).
The flat ## Step N: format (without phases) also works for backwards compatibility.
Key invariants: one H1 title, one ## Overview, numbered step sections (### Step N: or ## Step N:), and at least one ordering section.