# Execution Policy

This file owns universal production behavior after the mandatory intake in
`../SKILL.md` has been resolved. It does not redefine intake choices, channel
identity or format beats.

## Intake Record

Before production, retain four resolved values in the working notes:

- Channel profile.
- Output language.
- Template strategy.
- Template set, when the chosen strategy requires one.

Record mode flags separately: default `auto-run`, optional `review-first`,
`quiet` or `verbose`.

Persist resolved values to `videos/<project-name>/run-state.json` using the
state helper described in `run-state.md`. For an existing project, inspect
state before asking questions again or generating new artifacts.

For a batch request, persist shared intake and mode once in
`videos/_queues/<batch-id>/queue.json` after the gate is resolved, then use
each item's linked `run-state.json` for production truth.

## Progress Behavior

- `auto-run`: continue from resolved intake to a near-final single-video draft.
- `review-first`: pause after source/evidence and script direction are clear,
  before consequential build or render work.
- `quiet`: provide milestone-level progress messages only.
- `verbose`: include reasoning, source choices, diagnostics and QA details.

Reporting detail never changes a required stop or check.

## Universal Production Sequence

1. Initialize or inspect run state after intake has been resolved.
2. Verify the common template asset contract in
   `templates/assets/required-assets.json`. Missing TikTok profile-card files,
   avatar/brand image, cursor, SFX, required template sets or declared default
   `.mp3`/`.mp4`/`.gif` files block template selection and production.
3. Resolve the original/official first-party source set for factual proof,
   then inspect any user-supplied article or social link for audience hooks,
   benefits or pain points to turn into a topic-first opening and verify or
   qualify against the original source.
4. Select channel and preset overrides through the routing matrix.
5. Establish script, publish title, post caption, hashtags, proof points and
   scene roles; store the ready-to-post metadata in `PUBLISH.md`.
6. Before generating narration for Vietnamese or any non-ASCII language on
   Windows/PowerShell, make the shell and helper process UTF-8 safe
   (`chcp 65001`, `$OutputEncoding = [System.Text.UTF8Encoding]::new()`,
   `PYTHONIOENCODING=utf-8`, or an equivalent non-PowerShell UTF-8 path). Then
   re-open `voiceover.txt` or `SCRIPT.md` as UTF-8 and verify real diacritics
   survived; do not send mojibake or replacement-question-mark text to TTS.
7. Generate narration using the chosen channel settings and measure its true
   duration before final scene timing.
8. Construct a deterministic HyperFrames composition with local assets (utilizing `npx hyperframes preview` for real-time visual inspection). TikTok outro/profile UI, avatar, cursor and follow-click SFX must come from the common asset contract or from documented approved replacements. Before preview handoff or render, remove accidental HyperFrames Studio drag/resize metadata from public media containers and lock video/image inserts to CSS layout (`aspect-ratio`, `object-fit`, flex/grid flow, stable padding) so media cannot jump away from its scene text or proof frame.
9. Validate according to `quality-gates.md`, then render via `npx hyperframes render videos/<project-name> -o videos/<project-name>/renders/<project-name>.mp4` and report the output path together with the publish title and hashtags from `PUBLISH.md`.

## HyperFrames Runtime Boundary

HyperFrames is mandatory for all nAvid workflows that create, preview, inspect,
QA or render visual output. Do not substitute Remotion, raw ffmpeg-only video
assembly, slideshow exporters, screen recordings or ad hoc HTML capture as the
primary composition/runtime path. External tools may generate assets, audio,
screenshots or diagnostics, but the deliverable composition and rendered video
must pass through `npx hyperframes preview`, `npx hyperframes inspect` when
layout QA is needed, and `npx hyperframes render`.

## Retry And Stop Rules

Automatically retry a transient or mechanical failure when the retry preserves
the requested content, asset meaning and output quality. Examples include a
temporary render invocation failure or repeating a deterministic inspection.
Record attempts in state and permit no more than three total attempts for a
single safe operation. Exhaustion marks the stage `failed`.

Stop for user choice when a fallback would change:

- Voice/provider, narration meaning or language.
- Evidence source, attribution or factual confidence.
- Visual legibility, template quality or brand treatment.
- Rights/safety posture or publishability.

Stop rather than publish a factual claim whose trustworthy supporting source
cannot be established.

For a video centered on the original subject, do not expose a supplementary
source in the public output merely because it was supplied for research. If a
hook raises a promise stronger than the original source establishes, frame it
as a question or claim to examine, then state the official explanation.

When a fallback is proposed, mark the affected stage `blocked` and record the
original choice, proposal, reason and quality impact. Resume only after an
explicit run-scoped approval event.

## Compatibility Boundaries

- Reference/remake inputs are accepted, but they require the risk stop above;
  later editorial-media policy defines the complete sourcing treatment.
- Batch intent is delivered through `batch-queue.md`: dispatch items
  sequentially, validate item state before resume and keep failed or blocked
  outcomes visible while independent later items may continue.
- Template approval and expanded scene-module rules are owned by
  `template-library.md`. Approval is internal library maintenance; package
  publication and runtime synchronization remain separate requested release
  operations.
