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
sceneSlotor slot embedding data; drop it without compatibility handling. - Do not remove
assetQueryorassetQueryEmbedding; 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, parsescene_slot, persistsceneSlot, and computesceneSlotEmbedding. generatePresentationConfigstill 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_definitionsandslot_affinity_tables, generated types expose those collections, seed data creates them, and migrations include their database structures. package.jsonexposespnpm report:visual-matching, backed byscripts/visual-matching-report.ts.
Target Behavior
- Presentation generation does not load Asset Slot definitions and does not perform Visual Matching.
- Scene generation persists
visualGenerationPromptfor 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;
assetQueryandassetQueryEmbeddingremain. - 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, andsrc/app/(frontend)/app/presentation/actions.ts. - Prompt/workflow contracts: remove scene-slot prompt requirements from
src/mastra/tools/presentation/prompt-builders.tsand any Mastra contracts/workflows that requirescene_slot. - Worker/scripts: update
scripts/presentation-worker.ts, deletescripts/visual-matching-report.ts, and remove thereport:visual-matchingpackage script. - Payload/schema/tests: update
src/collections/anuvax/index.ts, generatedsrc/payload-types.ts, migrations, seed data, and integration fixtures/mocks that include slot collections orslotGenerateAi.
Affected Docs
- Update
docs/core/PresentationVideoWorkflow.mdto show async Image Gen as the initial visual path. - Update
docs/core/PayloadDataModel.mdanddocs/state/CollectionMap.mdto remove Asset Slot collections and slot-only fields. - Update
docs/state/ServerActionsMap.md,docs/state/WorkflowMap.md,docs/state/ScriptsAndCommands.md, anddocs/state/KnownGaps.mdfor removed Visual Matching behavior and script deletion. - Keep
docs/web/mkdocs.ymlunchanged 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
AssetSlotDefinitionsandSlotAffinityTablescollection configs from the AnuvaX collection registry. - Remove media fields used only by slot matching:
slotCategoryandassetSlotEmbedding. - Keep media fields
assetQueryandassetQueryEmbedding. - Remove scene fields used only by slots/Visual Matching:
sceneSlotandsceneSlotEmbedding. - 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, andreport: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
listAssetSlotDefinitionsand 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 incompilerIssues.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.tsand removereport:visual-matchingfrompackage.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:e2ebecause 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
assetQueryorassetQueryEmbedding.
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, orassetSlotEmbeddingoutside 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
assetQueryandassetQueryEmbeddingremain. pnpm report:visual-matchingand its script are gone.- Required verification commands pass, or failures are documented with exact cause and follow-up.