# StageFlow Manifest v1.3 — interoperability specification

**Status:** Experimental beta, 2026-11-18. The StageFlow application includes a local XLSX manifest importer. It validates workbook structure and relationships, then requires explicit user review before any library changes.

## Practical full-archive import workflow (StageFlow v0.3.46.1)

1. Put the consolidated master repertoire list at the root of the original ZIP (if available). Keep original song documents and folder paths unchanged.
2. Give the ZIP, StageFlow AI Import Kit template and prompt to an AI model with **file-reading and web-search access**. Web search is necessary for discovering missing streaming links; it is not needed for merely preserving existing supplied links.
3. Have the model work in resumable batches and save stable song/document IDs in a cumulative manifest. A single processing pass often researches about **30 new links**, depending on model/search quotas; this is a practical estimate, not a guarantee. Large libraries may need multiple passes and patience.
4. Place the final `StageFlow_Manifest_v1.3_FINAL.xlsx` into the source ZIP, retaining paths referenced by `Documents.file_path`.
5. In StageFlow use **+ Import / New → Import prepared library** and select the **complete ZIP**. StageFlow validates the manifest and linked documents before importing. A standalone manifest XLSX imports metadata only; the original DOCX/PDF content cannot be attached from an XLSX alone.
6. Optionally run **Library enrichment → Fetch metadata** manually, then **Export library** for a portable `stageflow-library.zip`.
7. On another device use **Library tools & offline → Import backup** for the completed library ZIP. **Do not use AI manifest import for a StageFlow backup.** Previously saved enrichment does not need to be fetched again.

Importing the full source ZIP and exporting an enriched library are distinct workflows. User content is processed locally, not automatically submitted to any shared catalog.


## Goal
Prepare repertoire metadata and references while preserving source files, the user's selected arrangement links, and distinctions between original works, recordings, covers and performance arrangements. The manifest does not contain lyrics, chord charts, notation or source document contents.

## Workbook contract
The primary artifact is an XLSX workbook with six required data sheets: `Songs`, `Artists`, `Links`, `Review`, `Documents` and `Credits`, plus the optional `ArtistLinks` sheet for artist-level destinations. Guide sheets `START HERE`, `Fields` and `Examples` should also be retained. One header row; data rows follow. The importer ignores guide sheets and reads the six required data sheets plus `ArtistLinks` when present. Older v1.2 manifests without `ArtistLinks` remain valid.

The v1.3 template preserves the v1.0 columns and adds:
- Songs: `source_document_id`, `original_artist_id`, `recording_artist_id`, `work_group_id`, `duplicate_review_status`.
- Documents: `document_id`, `original_filename`, `file_path`, `file_type`, `classification`, `linked_song_id`, `status`, `notes`.
- Credits: `credit_id`, `song_id`, `artist_id`, `credit_role`, `credited_name`, `source_reference`, `confidence`, `notes`.
- ArtistLinks (new optional sheet): `artist_link_id`, `artist_id`, `link_type`, `label`, `url`, `source_name`, `verification_status`, `confidence`, `is_official`, `notes`.

## Stable IDs and relationships
- Songs: unique `song_id` values (for example S0001).
- Artists: unique `artist_id` values (A0001).
- Links: unique `link_id` values (L0001); `entity_type` must be `song`; `entity_id` references a song.
- ArtistLinks: unique `artist_link_id` values (AL0001); `artist_id` references an Artists row.
- Review: unique `review_id` values (R0001).
- Documents: one unique `document_id` per supplied file.
- Credits: unique `credit_id` values (C0001).
- Foreign keys must resolve to the correct entity type. Blank optional foreign keys are allowed.

## Link semantics
Allowed roles for imported song links: `arrangement_reference`, `canonical_recording`, `alternate_recording`. Imported links must be song-level, HTTPS, direct recording pages on supported streaming-service domains. Only one primary streaming URL is retained per song.

Supported streaming providers: YouTube / YouTube Music, Spotify, Apple Music, Deezer, SoundCloud, TIDAL and Amazon Music. No Google Docs, Google Drive, document-sharing URLs, official websites, MusicBrainz, Wikipedia, social profiles, search-result pages, homepages, generic API endpoints or other non-streaming references are allowed in song `Links`.

A single consolidated repertoire spreadsheet placed directly in the ZIP archive root is the master song list when present. Preserve its entries and actual hyperlink targets. Any complete supported streaming URL supplied in that master list is authoritative and must be preserved exactly, regardless of provider or verification status (`review` is acceptable when the URL is structurally valid). Do not search that song on YouTube or any other provider, and do not replace the user's selected recording. If there is no suitable master spreadsheet in the archive root, derive song candidates from the folder/file structure and document contents. If no user-supplied streaming URL exists for a song, search YouTube first; when a suitable direct recording is found, stop. Only if no suitable YouTube result exists, try Spotify, Apple Music, Deezer, SoundCloud, TIDAL and Amazon Music sequentially, one provider at a time, stopping at the first suitable result. Never search all providers in parallel or store multiple provider candidates for one song.

Song `Links` are exclusively streaming destinations for specific recordings. Artist-level URLs are not allowed in `Links`. Artist destinations are encouraged and stored separately in `ArtistLinks`, including official websites, official social profiles and artist pages on streaming services. Each artist link must identify its artist and carry an honest verification status; never infer official status from a name alone. Do not mix song recording URLs into `ArtistLinks`.
 
## Recording facts versus performance settings
`reference_recording_year`, `reference_album`, `reference_duration_seconds`, `reference_key` and `reference_bpm` describe a specific recording. `stage_key`, `stage_bpm` and `stage_duration_seconds` are only explicit user performance values. Never copy recording values into stage settings by inference.

## Master repertoire file
If the archive contains one consolidated repertoire spreadsheet directly in its root, treat it as the authoritative master song list and source of user-provided song links. Other spreadsheets are supporting documents, not competing master lists. If there is no root-level master spreadsheet, analyze the folder structure and individual documents to identify song candidates. If multiple plausible master spreadsheets exist in the root, record the ambiguity in Review rather than choosing silently.

## Document inventory
Every supplied file has exactly one Documents row, including duplicate-looking, unreadable, unsupported and non-song files. Preserve exact filenames and ZIP-relative paths. Never invent file paths. A setlist, collection, score or spreadsheet is not automatically a song. Use Review for ambiguous file-to-song relationships.

## Non-destructive matching
Same title is not proof of identity. Preserve all source rows and documents. Use work_group_id only as a suggested relationship. Do not merge duplicate-looking songs or different arrangements automatically. The StageFlow importer proposes exact title/artist matches but defaults each row to a separate new song; the user must explicitly select an existing song or skip it.

## Importer behavior
StageFlow reads XLSX locally in the browser. It validates the six required data sheets, optional `ArtistLinks`, required columns, unique IDs, supported song-link roles and foreign-key relationships. It imports song title/artist, categories, tags, user stage settings, reference metadata, one primary streaming link per song, artist profile metadata, separate artist profile links and credits. Non-streaming URLs are excluded from song links; artist links are stored in their dedicated sheet. Lyrics, chords and source document bytes are not imported. Unresolved Review rows remain available in the import report. The importer does not upload the workbook to a server.

## Required final audit
Report counts for files discovered/processed/unreadable, song candidates, artists, user arrangement links, canonical links, alternate links, official artist websites, review items and unresolved identities. Verify every original link is preserved, all foreign keys resolve, and no same-title entries were silently merged. Keep statuses honest: confidence is not verification. List limitations and unprocessed files explicitly.
