# Prompts and provenance

Récit does not generate images. It describes them, and it keeps track of where each one comes from.

## A prompt is an entry

```md
--- id=p-rooftop-wave entry=prompt subject=lorem set=rooftop-night shot=medium pose=waving aspect=9:16

Lorem greets the crowd before the first song.
```

`subject`, `set`, `shot`, `pose`, `expression` and `style` name entries and ids of the bible; the
body is the action of the image. The text given to an image tool is built from the bible: the style
identity, the character identity word for word, the set, the shot, the pose, the action, then the
`avoid` list. Text in an image is always avoided, so a scene's words stay text and translate.

## Consistency

A seed gives weak consistency and does not survive a change of model; reference images give strong
consistency. Attach the canonical reference to every prompt, keep the identity block unchanged, and
ask for a turnaround sheet (front, three-quarter, side, back) when you can.

## Provenance

Next to every image, a JSON file with the same name plus `.json` (`cover.png.json`) says where the
image comes from:

```json
{
  "$schema": "https://recit.dev/schema/v1/asset.json",
  "kind": "asset",
  "version": 1,
  "asset": "cover.png",
  "prompt": "p-rooftop-wave",
  "origin": "ai",
  "tool": "lorem-generator",
  "model": "lorem-model",
  "date": "2026-10-24",
  "seed": 42,
  "references": ["cast/lorem-canonical.png"],
  "author": "Lorem Ipsum",
  "license": "CC-BY-4.0",
  "aiGenerated": true
}
```

- `origin` is `human`, `ai` or `mixed`; `aiGenerated` says the same thing for other tools.
- `mediaType` is the optional MIME type of the file (`image/png`, `video/mp4`, `audio/wav`).
- `duration` is the optional duration of a video or audio file, in seconds.
- `speechVoice` is the optional synthetic voice id, distinct from a character's `voice` trait.
- `timings` is the optional list of characters of a voice and when each is heard (`text`, `start`
  and `end`, in seconds), as the speech provider timed it; `recit render` reads it to cut the
  subtitles of a scene whose `audio=` is that voice into one cue per phrase.
- An image marked `aiGenerated: true` carries the "AI-generated" mention in its metadata and its
  visible credits.
- A C2PA manifest present in an input image is never stripped.

### The generation request

When a plugin runs a media job ([AI jobs](/documentation/plugins/ai#media)), `recit ai` represents
each call as a serialised generation request validated by `ai-request.json`
(`AiGenerationRequestSchema` of `@recit/core/plugin`, `recit schema ai-request`, preview): it hashes
and caches every request under `.recit/cache/ai/`: an `image`, `speech` or `sound` output as it
comes, a `video` once its `poll` is done, and an identical `video` request then never reaches the
provider. Raw input bytes never enter the request: every input media file is recorded by its SHA-256
digest and MIME type. Its four `oneOf` branches are discriminated by `modality` (`"image"`,
`"speech"`, `"video"` and `"sound"`): `width`, `height` and `references` belong to the `image`
request, `edit` (`edit.image` and optional `edit.mask`) is added on that `image` request only when
editing an existing image, `text`, `voice`, `style` and `language` belong to `speech`, and top-level
`image` is the optional first frame of a `video` request:

| Key                   | Branch                    | Description                                                                              |
| --------------------- | ------------------------- | ---------------------------------------------------------------------------------------- |
| `modality`            | all                       | `"image"`, `"speech"`, `"video"` or `"sound"` (required)                                 |
| `provider`            | all                       | Non-empty id of the media provider, such as `"gemini"` (required)                        |
| `model`               | all                       | Non-empty model id (required)                                                            |
| `prompt`              | `image`, `video`, `sound` | Prompt text sent to the provider (required)                                              |
| `aspect`              | `image`, `video`          | Optional aspect ratio string (`"16:9"`, `"1:1"`…) when the provider takes one            |
| `width`               | `image`                   | Optional output width in pixels (positive integer, image request)                        |
| `height`              | `image`                   | Optional output height in pixels (positive integer, image request)                       |
| `seed`                | `image`, `video`, `sound` | Optional integer seed                                                                    |
| `references`          | `image`                   | Optional array of reference images the output must follow (image request)                |
| `references.sha256`   | `image`                   | 64-character lowercase hex SHA-256 of a reference image (required on each item)          |
| `references.mimeType` | `image`                   | Non-empty MIME type of a reference image (required on each item)                         |
| `edit`                | `image` (edit)            | Optional edit payload on an `image` request when editing an existing image               |
| `edit.image`          | `image` (edit)            | Source image to edit (required when `edit` is present)                                   |
| `edit.image.sha256`   | `image` (edit)            | 64-character lowercase hex SHA-256 of `edit.image` (required)                            |
| `edit.image.mimeType` | `image` (edit)            | Non-empty MIME type of `edit.image` (required)                                           |
| `edit.mask`           | `image` (edit)            | Optional mask image for the edit                                                         |
| `edit.mask.sha256`    | `image` (edit)            | 64-character lowercase hex SHA-256 of `edit.mask` (required when `edit.mask` is present) |
| `edit.mask.mimeType`  | `image` (edit)            | Non-empty MIME type of `edit.mask` (required when `edit.mask` is present)                |
| `text`                | `speech`                  | Text synthesised to speech (required on `speech`)                                        |
| `voice`               | `speech`                  | Optional provider voice id                                                               |
| `style`               | `speech`                  | Optional style direction when the speech provider accepts one                            |
| `language`            | `speech`                  | Optional BCP 47 language tag                                                             |
| `duration`            | `video`, `sound`          | Optional positive duration in seconds                                                    |
| `image`               | `video`                   | Optional first-frame image when the video provider takes one                             |
| `image.sha256`        | `video`                   | 64-character lowercase hex SHA-256 of the first-frame `image` (required when present)    |
| `image.mimeType`      | `video`                   | Non-empty MIME type of the first-frame `image` (required when present)                   |

## Registering an image

```sh
recit assets register cast/rooftop-wave.png --prompt p-rooftop-wave --origin ai --tool lorem-generator --seed 42
```

The command (`recit assets register <file> --prompt <id>`, with `--origin`, `--tool`, `--seed`…)
writes `cast/rooftop-wave.png.json`, with `promptHash`, the fingerprint of the prompt text when the
image was registered. When the bible changes that prompt, `recit validate` warns that the image is
stale. An image next to the bible with no provenance file is a warning, an error with `--strict`.
Both checks run when `recit validate` reads a story that declares `cast:`; validating the bible
alone (`recit validate cast.md`) does not run them.

With `--strict`, a file whose provenance says `origin: ai` or `mixed` also needs a `license`:
without one, `recit validate --strict` on a story that declares `cast:` fails with
`scenario-asset-no-license` and names the provenance file to complete (validating the bible alone,
`recit validate --strict cast.md`, does not run this check). The check reads the images next to the
bible and its audio and video files (`.wav`, `.mp3`, `.ogg`, `.m4a`, `.mp4`, `.webm`).

## The register of the assets

```sh
recit assets report cast.md
```

`recit assets report <bible|story>` lists the images beside the bible, one row each, and one row per
prompt that has no image yet. Each row says its file, its prompt, its status (`present`, `stale`
when the prompt changed since, `registered` with a provenance but no prompt of the bible,
`unregistered` without a provenance file, `missing`), and what the provenance says: `origin`, `ai`
(`yes` when a model made or helped make it), `tool`, `model`, `author`, `license` and `date`. It is
the review sheet of a story world, and the list a publisher needs for the AI Act.

The rows go to `data/assets.json` beside the report, rewritten at each run. The report itself,
`assets.story.md` beside the bible (`-o` to put it elsewhere), is a `format: report` story that
reads them: key figures (images made with AI, stale, missing, without provenance), then the table.
It is written once and never overwritten, so you can edit it; `--lang fr` writes it in French (the
language of the bible by default), `--title` names it.

## Building the prompts

`recit prompts build cast.md` writes one `<id>.txt` and a `prompts.json` in `prompts/`; with
`--placeholders` it also writes a `<id>.placeholder.svg` for each prompt with no image, and
`--template <name>` picks one of the `scenario.promptTemplates` of `recit.config.ts`.

### Image by image (preview)

A prompt whose subject is a described character can name one of its animations (`animation=hello`):
`recit prompts build --frames` then writes one prompt and one pose guide per key of it, and
`recit assets register <folder>` registers the images that come back by their names. The whole path
is in [Images of an animation](/documentation/scenario/animation-frames).

## Placeholders

Until an image exists, the story renders anyway. In `examples/scenario-lorem` the placeholders are
` ```pixel ` sprites of the character, with a caption naming the prompt they stand for.
