Skip to content

Remove Anuva Prompts Change Breakdown

Created: 2026-05-19 04:37 UTC

Summary

Presentation Creation should stop using prompts stored in the anuva_prompts Payload collection and stop depending on src/lib/anuvax-prompts for generation prompts. The creation flow should route through Mastra presentationVideoWorkflow and its related agents, tools, and inline code prompts. Additional Mastra agents, workflows, tools, or inline prompt builders may be added when the current workflow does not yet cover a UI capability.

This breakdown does not implement the change. It identifies the likely work, affected surfaces, risks, and questions that should be resolved before writing the implementation plan.

Target Flow

flowchart TD
  ui["Presentation Creation UI"] --> action["Presentation server action"]
  action --> workflow["presentationVideoWorkflow"]
  workflow --> intent["intentAgent inline instructions"]
  workflow --> rag["ragWorkflow and RAG tools"]
  workflow --> narrative["narrativeWorkflow"]
  workflow --> visuals["visualsWorkflow and media tools"]
  workflow --> slides["slidesWorkflow"]
  workflow --> direction["directionWorkflow"]
  workflow --> persisted["Persist scenes, compilation, jobs"]

  oldCollection["anuva_prompts collection"]:::legacy
  oldHelpers["src/lib/anuvax-prompts"]:::legacy
  oldCollection -. remove from creation path .-> oldHelpers
  oldHelpers -. no dependency .-> action

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

Current Touchpoints

The current codebase has both workflow-backed and pre-upgrade prompt-backed paths.

  • src/app/(frontend)/app/presentation/actions.ts imports formatRagContext, renderPromptTemplate, resolvePrompt, and resolveVideoUseCaseId from src/lib/anuvax-prompts.
  • generatePresentationVideoScenesWithWorkflow already invokes presentationVideoWorkflow and records workflow metadata.
  • generatePresentationDescription, the older scene/config generation path, per-scene voiceover/caption/image assistant actions, and some queue metadata still call resolvePrompt or helpers from src/lib/anuvax-prompts.
  • src/app/(frontend)/app/rag/actions.ts uses anuva_prompts for RAG image/video description refinement. This is adjacent to, but not strictly Presentation Creation UI.
  • scripts/presentation-worker.ts uses anuva_prompts as a fallback prompt source for scene image generation.
  • scripts/seed.ts seeds anuva_prompts.
  • src/collections/anuvax/index.ts registers the AnuvaPrompts collection, and generated Payload types include it.
  • docs/core/PayloadDataModel.md and docs/state/CollectionMap.md still document anuva_prompts as prompt/config support data.

Grouped Changes

1. Presentation Creation UI routing

The creation flow should have one canonical generation route: Mastra presentationVideoWorkflow.

Likely work:

  • Identify the client calls from src/app/(frontend)/app/create/presentation/page.tsx and related components into src/app/(frontend)/app/presentation/actions.ts.
  • Confirm whether the UI still calls any pre-workflow generation action for scenes/config.
  • Retire or redirect older generation actions that call resolvePrompt for initial presentation creation.
  • Keep action return shapes stable where the UI expects ActionResult and PresentationCompileResult payloads.

Explanation:

The user goal is not just to remove a collection lookup. It is to prevent the Presentation Creation UI from splitting generation between old prompt records and the new workflow. The UI should trigger workflow contracts rather than orchestrating old prompts itself.

Likely affected code:

  • src/app/(frontend)/app/create/presentation/page.tsx
  • src/app/(frontend)/app/presentation/actions.ts
  • src/app/api/presentations/[id]/generate/route.ts
  • src/app/api/presentations/[id]/description/route.ts
  • src/mastra/anuvax-adapter.ts
  • src/mastra/workflows/presentationvideo.workflow.ts

2. Inline prompt ownership in Mastra workflow code

Prompts needed by creation should live in code as agent instructions, workflow prompt builders, or tool inputs rather than anuva_prompts documents.

Likely work:

  • Extend src/mastra/agents/presentationvideo-agent-contracts.ts or nearby prompt-builder helpers for any missing creation behavior.
  • Keep prompt builders typed around contracts such as VideoDescriptionBrief, VoiceoverScriptJson, RevealSceneModel, SceneDirectionModel, and PresentationCompilationConfig.
  • Preserve deterministic validation and normalization in tools instead of moving it into free-form prompts.
  • Add new agents/workflows/tools only where the current workflow cannot support a creation UI capability.

Explanation:

The existing presentationVideoWorkflow already has inline buildIntentPrompt and agent definitions. The change should continue that pattern and avoid a new prompt registry unless a code-native, typed helper is needed.

Likely affected code:

  • src/mastra/agents/presentationvideo-agent-contracts.ts
  • src/mastra/agents/*.agent.ts
  • src/mastra/workflows/presentationvideo.workflow.ts
  • src/mastra/workflows/sub/*.workflow.ts
  • src/mastra/tools/presentation/index.ts
  • src/mastra/tools/compiler/index.ts
  • src/lib/anuva/contracts-v1.ts

3. Remove legacy prompt helper dependencies from presentation code

Presentation code should no longer import or call src/lib/anuvax-prompts for creation behavior.

Likely work:

  • Replace resolvePrompt usage in presentation generation paths with workflow calls or inline prompt builders.
  • Replace formatRagContext with a non-legacy helper if it remains useful as plain formatting, or move the formatting into Mastra/RAG tooling.
  • Replace resolveVideoUseCaseId with a relationship utility that is not coupled to the legacy prompt module.
  • Update integration test mocks that currently mock @/lib/anuvax-prompts/*.

Explanation:

Even if anuva_prompts remains in the schema temporarily, Presentation Creation should not depend on the old helper module. Utility functions that are still useful should be moved to neutral modules so imports do not imply prompt registry usage.

Likely affected code:

  • src/lib/anuvax-prompts/render.ts
  • src/lib/anuvax-prompts/resolve.ts
  • src/app/(frontend)/app/presentation/actions.ts
  • tests/integration/helpers/presentation-harness.ts
  • tests/integration/helpers/mock-runtime.ts

4. Per-scene assistants and image generation path decision

The current per-scene actions use anuva_prompts for voiceover edits, caption edits, and image prompt regeneration. These are related to the Presentation Video surface but may or may not be part of "Presentation Creation UI" for this change.

Likely work:

  • Decide whether edit actions should move to Mastra editAgent and partial scene edit workflow now.
  • Decide whether image regeneration should use visualAgent, a dedicated inline prompt builder, or a tool-level prompt builder.
  • Preserve stale preview/audio markers after edits.
  • Preserve AI interaction metering metadata with explicit workflow and step IDs.

Explanation:

Leaving these paths on anuva_prompts would satisfy a narrow "initial creation" interpretation but leave the presentation surface partially dependent on legacy prompts. Moving them now increases scope but aligns with the agentic upgrade direction.

Likely affected code:

  • src/app/(frontend)/app/presentation/actions.ts
  • src/mastra/agents/edit.agent.ts
  • src/mastra/agents/visual.agent.ts
  • src/lib/anuva/orchestration-service.ts
  • src/app/api/presentations/[id]/scenes/[sceneId]/edit/route.ts

5. Worker and queued generation cleanup

The presentation worker currently uses anuva_prompts as a fallback for image prompt generation.

Likely work:

  • Prefer scene-level visualGenerationPrompt emitted by the workflow.
  • Replace the fallback with a code inline prompt builder or Mastra visual tool path.
  • Keep robust fallback text for image generation if agent calls fail or no prompt exists.

Explanation:

The workflow-generated visual strategy should be the primary source for generated image prompts. The worker should not reach back into old Payload prompt records.

Likely affected code:

  • scripts/presentation-worker.ts
  • src/mastra/tools/presentation/index.ts
  • src/mastra/tools/media/index.ts

6. Payload collection and seed data scope

The anuva_prompts collection exists as Payload schema and seed data. Removing it entirely is larger than disconnecting creation from it.

Likely work if the collection is removed:

  • Remove AnuvaPrompts from src/collections/anuvax/index.ts.
  • Generate a migration that drops the table and enum types only if the project accepts removal from the active database.
  • Regenerate src/payload-types.ts and the Payload import map if needed.
  • Remove prompt seed data from scripts/seed.ts.
  • Update docs that list the collection.

Likely work if the collection is retained temporarily:

  • Mark it as legacy or unused in docs.
  • Remove creation code dependencies while leaving schema and seed cleanup for a later change.

Explanation:

Schema removal affects generated types, migrations, seed behavior, and any existing admin data. It should be an explicit decision, not a side effect of rerouting the UI.

Likely affected code/docs:

  • src/collections/anuvax/index.ts
  • src/payload-types.ts
  • src/migrations/*
  • scripts/seed.ts
  • docs/core/PayloadDataModel.md
  • docs/state/CollectionMap.md

7. Adjacent RAG prompt usage

RAG library actions use anuva_prompts for image user context edits and video section edits.

Likely work:

  • Decide whether these are out of scope because the request targets Presentation Creation UI.
  • If in scope, replace them with RAG-specific inline prompt builders, Mastra tools, or agents.
  • Keep returned JSON shape for user_facing_description, asset_query, and video time bounds.

Explanation:

These paths are not the creation UI, but they are source-preparation paths that feed presentation generation. They may need a follow-up cleanup to fully remove anuva_prompts from runtime usage.

Likely affected code:

  • src/app/(frontend)/app/rag/actions.ts
  • src/mastra/tools/rag/index.ts
  • src/mastra/workflows/sub/rag.workflow.ts

Affected Product Surfaces

  • Presentation setup and generation under src/app/(frontend)/app/create/presentation.
  • Presentation edit and preview workflows under src/app/(frontend)/app/videos/[id].
  • Background image/audio generation through presentation_generation_jobs.
  • Payload admin only if the anuva_prompts collection is removed or hidden.
  • RAG library only if adjacent prompt usage is included in scope.

Likely Affected Tests

  • Integration tests around presentation actions in tests/integration.
  • Test harness mocks in tests/integration/helpers.
  • Unit tests for src/lib/anuva contracts or orchestration if new workflow services are added.
  • E2E presentation workflow tests if UI route behavior changes.

Expected verification for implementation:

  • pnpm lint
  • pnpm typecheck
  • pnpm test:int
  • pnpm test:e2e if route-level creation behavior changes
  • pnpm generate:types and pnpm generate:importmap if Payload schema changes

Likely Docs Impact

  • docs/core/PresentationVideoWorkflow.md: update current server action and workflow ownership.
  • docs/core/MastraAgentsAndTools.md: document any new agents/tools or prompt-builder locations.
  • docs/core/PayloadDataModel.md: remove or mark anuva_prompts depending on schema decision.
  • docs/state/CollectionMap.md: remove or mark anuva_prompts depending on schema decision.
  • docs/state/ServerActionsMap.md: update presentation action behavior if old actions are removed or redirected.
  • docs/state/WorkflowMap.md: update if workflow sequence or related sub-workflows change.
  • docs/state/KnownGaps.md: close or adjust any gap about workflow-only presentation creation.

Risks

  • Removing old prompt-backed paths may break UI flows that still expect incremental description generation or direct scene editing responses.
  • Moving prompts inline can accidentally reduce admin configurability if anuva_prompts was still used for production tuning.
  • Removing the Payload collection requires migration care and can affect existing data, locks, generated types, and seed expectations.
  • The old helper module includes generic utilities mixed with prompt lookup; deleting it without moving neutral utilities can create avoidable churn.
  • Per-scene edit behavior may need a partial edit workflow that is not fully complete yet.
  • Worker fallback behavior must remain resilient when generated scenes do not have a usable visualGenerationPrompt.
  • Existing tests mock legacy helpers, so passing tests may require harness updates before code behavior can be verified.

Dependencies

  • Current Mastra API usage should be verified through the repo-local Mastra skill before workflow or agent changes.
  • Provider/model names should remain on shared constants unless an implementation plan explicitly changes them.
  • Payload schema removal depends on migration strategy and the active hosted database assumptions.
  • The final implementation should preserve workspace boundaries and AI interaction metering.

Out Of Scope

  • Rebuilding the entire Presentation Video workflow.
  • Introducing a new database compatibility layer for old prompt records.
  • Changing billing, coin conversion, or provider pricing behavior.
  • Changing render output semantics beyond what is required to remove legacy prompt usage.
  • Migrating historical anuva_prompts content into a new CMS prompt management product.
  • Removing stale docs under docs/_stale.

Questions

Q1. Should this change remove the anuva_prompts Payload collection and table, or only remove Presentation Creation runtime dependencies on it?

Answer: Remove the anuva_prompts Payload collection and table

Q2. Should adjacent RAG library actions that use anuva_prompts be included in this change, or should this change only cover the Presentation Creation and Presentation Video surfaces?

Answer: Adjacent RAG library actions that use anuva_prompts should be included in this change

Q3. Should per-scene voiceover, caption, and image assistant actions be moved to Mastra agents/workflows now, or is the initial creation path the only required scope?

Answer: Per-scene voiceover, caption, and image assistant actions should be moved to Mastra agents/workflows now

Q4. Should old prompt-backed presentation actions be deleted when no longer called, or kept as deprecated wrappers that forward into presentationVideoWorkflow until the UI and tests settle?

Answer: Old prompt-backed presentation actions should kept as deprecated wrappers that forward into presentationVideoWorkflow until the UI and tests settle

Q5. Is admin-configurable prompt editing intentionally going away for Presentation Video, or should a future code-native prompt versioning approach be planned separately?

Answer: Admin-configurable prompt editing is intentionally going away