Workflow Map
Last refreshed: 2026-05-20
Canonical IDs
Defined in src/lib/anuva/workflow-graph.ts:
presentationVideoWorkflowragWorkflownarrativeWorkflowslidesWorkflowvisualsWorkflowdirectionWorkflowsceneEditWorkflow
Public Entry Points
Also defined in workflow-graph.ts:
generateScenes: terminal stepcompile, does not run audio.generateAudio: terminal stepaudio, requires preview artifacts.generateVideo: terminal stepfinalize, ensures audio.
flowchart LR
generateScenes["generateScenes"] --> compile["compile"]
generateAudio["generateAudio"] --> audio["audio"]
generateVideo["generateVideo"] --> finalize["finalize"]
compile --> preview["👁️ Preview artifacts"]
audio --> audioReady["🔊 Audio ready"]
finalize --> renderJob["📤 Render handoff"]
Master Workflow
File: src/mastra/workflows/presentationvideo.workflow.ts.
Step order:
prepare-presentation-runintakeresolvesVideoDescriptionBriefdeterministically or throughIntentAgent.ragWorkflowpersisted-rag-contextnarrativePreviewWorkflownarrative-reviewsuspends with VO script preview payload and approved preview script.narrativeExpansionWorkflowvisualsWorkflowslidesWorkflowdirectionWorkflowcompilepersist-scenesassign-visualsqueues generated images for scenes with persisted image prompts.persist-compilationaudiofinalize
flowchart TD
prepare["prepare-presentation-run"] --> intake["intake"]
intake --> intentGate{"Skip IntentAgent?"}
intentGate -->|No| intent["intent-agent"]
intentGate -->|Yes| rag["ragWorkflow"]
intent --> rag
rag --> persisted["persisted-rag-context"]
persisted --> preview["narrativePreviewWorkflow"]
preview --> review["narrative-review suspend"]
review --> resume["resume with approved preview and identity"]
resume --> expand["narrativeExpansionWorkflow"]
expand --> visuals["visualsWorkflow"]
visuals --> slides["slidesWorkflow"]
slides --> direction["directionWorkflow"]
direction --> compile["compile"]
compile --> persistScenes["persist-scenes"]
persistScenes --> assignVisuals["assign-visuals / queue image prompts"]
assignVisuals --> persistCompilation["persist-compilation"]
assignVisuals --> worker["presentation-worker Image Gen"]
worker --> media["generated media assets"]
persistCompilation --> audio["audio"]
audio --> finalize["finalize"]
Subworkflows
src/mastra/workflows/sub/rag.workflow.ts: deterministic knowledge decision orknowledge-agent, thenknowledge.src/mastra/workflows/sub/narrative.workflow.ts:narrativePreviewWorkflowfor approved-script generation, thennarrativeExpansionWorkflowfor post-review scene details.src/mastra/workflows/sub/visuals.workflow.ts:visual-agent, thenvisuals.src/mastra/workflows/sub/slides.workflow.ts: narrative analysis agent, slide plan agent, then slide generation.src/mastra/workflows/sub/direction.workflow.ts: deterministic baseline direction, then optional director refinement.
Per-scene edit/image regeneration actions are adjacent to the master workflow rather than full workflow reruns. They use code-owned prompt builders, call editAgent or visualAgent, mark affected scenes dirty, and require preview regeneration before render readiness.
The create UI uses the narrative-review suspend payload as the VO Script Preview. The suspend payload now carries a preview-only approvedScript artifact rather than semantic scene details. Resume data contains approval plus selected Set/Bot/default Brand Kit, allowing downstream workflows to run only after the user has reviewed the narrative.
flowchart LR
sceneEdit["Scene edit action"] --> builder["Code prompt builder"]
builder --> editAgent["editAgent"]
builder --> visualAgent["visualAgent"]
editAgent --> scene["presentation_scenes dirty"]
visualAgent --> scene
scene --> preview["preview regeneration required"]
Linked Contracts
src/lib/anuva/contracts-v1.ts defines:
VideoDescriptionBriefVoiceoverScriptJsonNarrativeSceneDetailsRevealSceneModelSceneVisualStrategySceneDirectionModelPresentationCompilationConfigStageGateResultWorkflowRunEnvelopeMastraActionMetadataEditAgentInput
Persistence
Workflow execution writes to existing product collections such as presentations, presentation_scenes, presentation_compilations, and presentation_generation_jobs.
The upgrade API, CLI, and worker paths store richer workflow runtime state through the in-memory AnuvaRepository. Durable repository persistence is deferred and should be introduced through a repository storage design rather than Payload V1 collections.
flowchart LR
workflow["presentationVideoWorkflow and upgrade callers"] --> productState["Product Payload collections"]
workflow --> repository["In-memory AnuvaRepository"]
productState --> persisted["presentations, scenes, compilations, generation jobs"]
repository --> runtime["runs, artifacts, quality, sources, conversations"]
repository -. future .-> durable["Durable repository store"]