Skip to content

Remove Asset Slots Implementation Plan

Created: 2026-05-19 07:25 UTC

Goal

Remove the Asset Slot and Visual Matching system from Presentation Video generation. Scene visuals should be generated from persisted image-generation prompts by the asynchronous presentation worker, and users should replace generated images with uploaded images through the Scene Editor when needed.

Non-Goals

  • Do not introduce a replacement visual-search, asset-ranking, or media recommendation system.
  • Do not migrate existing sceneSlot or slot embedding data; drop it without compatibility handling.
  • Do not remove assetQuery or assetQueryEmbedding; keep them for possible non-slot retrieval/debug use.
  • Do not make Image Gen run inline during scene generation; keep image creation asynchronous through worker/job flow.
  • Do not redesign the Scene Editor upload/replacement workflow beyond removing slot-specific behavior.
  • Do not preserve scripts/visual-matching-report.ts; delete it outright.

Current Behavior

  • Presentation generation can load asset_slot_definitions, pass available scene slots into prompt builders, parse scene_slot, persist sceneSlot, and compute sceneSlotEmbedding.
  • generatePresentationConfig still evaluates RAG media candidates with deterministic Visual Matching, assigns uploaded/source assets to scenes, stores optional visual matching debug traces, and queues AI image generation only when no eligible match is selected or AI generation is explicitly requested.
  • The presentation setup UI maintains Asset Slot state, slot buckets, scene slot views, slot progress, and slot-aware AI generation toggles.
  • Payload registers asset_slot_definitions and slot_affinity_tables, generated types expose those collections, seed data creates them, and migrations include their database structures.
  • package.json exposes pnpm report:visual-matching, backed by scripts/visual-matching-report.ts.

Target Behavior

  • Presentation generation does not load Asset Slot definitions and does not perform Visual Matching.
  • Scene generation persists visualGenerationPrompt for image-capable scenes; the worker creates images asynchronously from those prompts.
  • Uploaded/source visuals are not auto-matched to scenes. They remain available for source grounding and for manual Scene Editor replacement.
  • Scene and job metadata no longer include slot-aware generation options, slot IDs, slot names, slot explanations, or visual matching debug traces.
  • Payload schema no longer includes Asset Slot collections or slot-only fields; assetQuery and assetQueryEmbedding remain.
  • Docs describe the image-generation-first visual path and manual Scene Editor replacement path.
flowchart TD
  setup["Presentation setup"] --> generation["Scene generation"]
  generation --> prompt["Persist visualGenerationPrompt"]
  prompt --> job["Queued presentation_generation_job"]
  job --> worker["presentation-worker"]
  worker --> imageGen["Image Gen model"]
  imageGen --> sceneImage["Generated scene image"]
  upload["User-uploaded image"] --> editor["Scene Editor replacement"]
  sceneImage --> editor
  editor --> final["Final scene visual"]

  slots["Asset Slots"]:::removed
  matching["Visual Matching"]:::removed
  slots -. removed .-> matching
  matching -. removed .-> final

  classDef removed fill:#f7d7d7,stroke:#a33,color:#111

Affected Files And Modules

  • Presentation UI/actions: remove slot UX and slot-aware action inputs from src/components/anuvax/presentation-video/presentation-video-page.tsx, src/app/(frontend)/app/create/actions.ts, and src/app/(frontend)/app/presentation/actions.ts.
  • Prompt/workflow contracts: remove scene-slot prompt requirements from src/mastra/tools/presentation/prompt-builders.ts and any Mastra contracts/workflows that require scene_slot.
  • Worker/scripts: update scripts/presentation-worker.ts, delete scripts/visual-matching-report.ts, and remove the report:visual-matching package script.
  • Payload/schema/tests: update src/collections/anuvax/index.ts, generated src/payload-types.ts, migrations, seed data, and integration fixtures/mocks that include slot collections or slotGenerateAi.

Affected Docs

  • Update docs/core/PresentationVideoWorkflow.md to show async Image Gen as the initial visual path.
  • Update docs/core/PayloadDataModel.md and docs/state/CollectionMap.md to remove Asset Slot collections and slot-only fields.
  • Update docs/state/ServerActionsMap.md, docs/state/WorkflowMap.md, docs/state/ScriptsAndCommands.md, and docs/state/KnownGaps.md for removed Visual Matching behavior and script deletion.
  • Keep docs/web/mkdocs.yml unchanged unless new doc paths are added or renamed.
  • Add or revise Mermaid diagrams in changed core/state docs where flow or relationships change.

Data And Schema Impact

  • Remove AssetSlotDefinitions and SlotAffinityTables collection configs from the AnuvaX collection registry.
  • Remove media fields used only by slot matching: slotCategory and assetSlotEmbedding.
  • Keep media fields assetQuery and assetQueryEmbedding.
  • Remove scene fields used only by slots/Visual Matching: sceneSlot and sceneSlotEmbedding.
  • Do not preserve or migrate existing slot data.
  • Add a drop migration for asset_slot_definitions, asset_slot_definitions_accepted_media_types, slot_affinity_tables, related lock-document relation columns/indexes/FKs, and slot-only enum types.
  • Regenerate Payload types and import map after schema changes.

Ordered Tasks

  • [x] 1. Search current references for asset_slot_definitions, slot_affinity_tables, sceneSlot, scene_slot, slotGenerateAi, assetSlotEmbedding, visual matching, and report:visual-matching.
  • [x] 2. Remove UI state, derived slot data, slot errors, slot progress, and slot-aware generation controls from the presentation page while preserving uploaded visual selection and Scene Editor replacement.
  • [x] 3. Remove listAssetSlotDefinitions and any create/setup action types used only by Asset Slot UX.
  • [x] 4. Update presentation prompt builders and parsing so generated scenes no longer request, parse, validate, or persist scene_slot.
  • [x] 5. Remove Visual Matching candidate scoring, embedding, assignment, debug trace construction, and selected-media auto-attachment from presentation generation.
  • [x] 6. Make image generation queueing unconditional for non-text image scenes that lack attached images/video and have a usable visualGenerationPrompt; persist no slot metadata in compilerIssues.visualGeneration.
  • [x] 7. Remove slotGenerateAi, visualMatchingDebugMode, and Visual Matching options from action inputs, job options, tests, and call sites.
  • [x] 8. Update the worker to consume scene/job visual prompts without slot fields and preserve explicit success/error status behavior.
  • [x] 9. Remove Asset Slot and Slot Affinity Payload collections, slot-only fields, seed data, generated types, import map entries, and add the drop migration.
  • [x] 10. Delete scripts/visual-matching-report.ts and remove report:visual-matching from package.json.
  • [x] 11. Update integration fixtures, mocks, and tests so fake DB collections and compile calls no longer include slot collections or slotGenerateAi.
  • [x] 12. Update core/state docs and confirm docs parity.

Verification Plan

  • Run pnpm generate:types.
  • Run pnpm generate:importmap.
  • Run pnpm lint.
  • Run pnpm typecheck.
  • Run pnpm test:int.
  • Run pnpm test:e2e because presentation setup/generation behavior changes.
  • Run final search: rg -n "asset_slot_definitions|slot_affinity_tables|sceneSlot|scene_slot|slotGenerateAi|assetSlotEmbedding|visual matching|Visual Matching|report:visual-matching" src scripts tests docs package.json -g '!docs/_stale/**'.
  • Inspect the new migration to confirm it removes only Asset Slot/Visual Matching structures and does not touch assetQuery or assetQueryEmbedding.

Docs Parity Checklist

  • [x] Presentation workflow docs describe generated scene images via async worker, not Visual Matching.
  • [x] Payload data model and collection map no longer list Asset Slot collections or slot-only fields.
  • [x] Server actions map no longer documents slot-aware generation arguments or Visual Matching debug behavior.
  • [x] Workflow map reflects Image Gen prompt persistence and asynchronous image creation.
  • [x] Scripts docs no longer list pnpm report:visual-matching.
  • [x] Known gaps no longer implies Asset Slots remain part of the target workflow.

Acceptance Criteria

  • No active runtime code references asset_slot_definitions, slot_affinity_tables, sceneSlot, scene_slot, slotGenerateAi, or assetSlotEmbedding outside historical migrations.
  • Presentation generation never auto-selects uploaded/source visuals through Visual Matching.
  • Non-text image scenes persist image-generation prompts and queue async image generation through the existing presentation job/worker path.
  • Scene Editor image replacement with uploaded media still works.
  • Payload admin no longer exposes Asset Slot or Slot Affinity collections.
  • Generated Payload types no longer include removed slot collections or slot-only fields, while assetQuery and assetQueryEmbedding remain.
  • pnpm report:visual-matching and its script are gone.
  • Required verification commands pass, or failures are documented with exact cause and follow-up.