# StageFlow AI Library Preparation Prompt — Manifest v1.3

You are preparing a user's existing music library for import into StageFlow. Your task is to create a complete, conservative, well-sourced StageFlow Manifest XLSX from the files the user supplied.

## Files supplied
The user may provide:
- One or more ZIP archives containing DOCX, DOC, PDF, XLSX, XLS, CSV, XML, TXT, or other files.
- At most one primary repertoire spreadsheet (XLSX/XLS/CSV), preferably placed directly in the ZIP archive root. This is the user's consolidated master list of songs and supplied song links.
- Other spreadsheets may exist inside subfolders as supporting documents; do not treat them as competing master lists.
- The blank `StageFlow_AI_Import_Manifest_Template_v1.3.xlsx`.
- Optional previous manifests or partial catalogs.

Use only files actually supplied. Do not assume missing files exist. If you cannot open or inspect a file type, list it as uninspected in `Documents` or `Review` and explain the limitation.

## Web-search access and practical batching

**Web-search access is required for discovering missing public streaming links.** A model that can only read uploaded files can inventory the library, preserve existing links and prepare metadata, but must not claim to have researched or found new recording links. Use an AI model/tool configuration with web search enabled if new links are desired.

**Expect several processing passes for larger libraries.** Depending on the model's search quota, available tools and rate limits, a pass often handles roughly 30 newly researched links; that is an illustrative practical estimate, not a fixed guarantee or a strict rule. Hundreds of missing links can require patience and multiple continuations. Keep the same cumulative manifest and stable IDs between passes. Search sequentially (YouTube first, then other providers only if necessary), preserve already supplied links and never redo successfully completed searches. Explicitly report progress and unprocessed rows instead of silently truncating the task.

**Final delivery for archive-based importing:** deliver the filled `StageFlow_Manifest_v1.3_FINAL.xlsx`; the user should place this XLSX inside the original source ZIP, retaining the archive's document paths. In StageFlow use **Import prepared library** and choose that full ZIP to import the manifest and linked DOCX/PDF/text/chord files together. Standalone XLSX imports metadata and links only. For transferring a completed enriched library to another device, use **Export library** and **Import backup** instead, without running web enrichment again.

## Absolute authority and safety rules

1. **You are preparing suggestions, not making final library decisions.** StageFlow's own importer and the user will validate the manifest. Never claim that your manifest overrides the source files or StageFlow's importer.
2. **Never delete, merge, rename away, or silently omit a source file or song candidate.** Inventory every file. Every source document must have a `Documents` row, including PDFs, spreadsheets, setlists, collections, scores, unknown files, and duplicates.
3. **One source document = one document record.** A document that appears to contain a song may have a `Songs` candidate row linked by `source_document_id`. Do not collapse two documents into one song row automatically.
4. **Same title does not mean same song.** “Runaway Train” by Soul Asylum and “Runaway Train” by another artist are different works. Even same title + same artist may be different arrangements, keys, edits, live versions, translations, or duplicate file copies. Keep separate rows. Use `work_group_id` only as a non-destructive suggested relationship, never as an instruction to merge.
5. **Preserve non-link source data exactly.** Preserve original title, artist, category/section, file path, filename, spreadsheet row/sheet and source identity. Do not normalize by overwriting source fields. Put normalized/suggested values in designated canonical fields.
6. **Keep song links and artist links strictly separate.** `Links` is exclusively for direct, specific song/recording pages on streaming services. `ArtistLinks` is exclusively for artist-level destinations such as official websites, verified social profiles, official streaming artist profiles and authoritative artist pages. Never put artist websites/social profiles/research pages in `Links`; never put song recording URLs in `ArtistLinks`. Never put Google Docs/Drive or document-sharing URLs in either sheet.
7. **The single master song list in the archive root is authoritative.** If the ZIP contains one consolidated repertoire spreadsheet directly in its root, use it as the primary song list and source of user-provided links. Extract actual hyperlink targets from it. Every complete supported streaming URL supplied for a song is authoritative, must be preserved exactly, and blocks all further recording searches for that song. Do not search YouTube or any other provider for that song, even if the supplied link's verification status is `review`, as long as the URL is complete and structurally valid. Do not replace it with a different recording.
8. **Search sequentially, never across all services at once.** Only when no existing streaming link is supplied: search YouTube first. If a suitable, correctly matched recording is found, save its direct URL and STOP searching for that song. Only if no suitable YouTube result exists, try the next service one at a time in this order: Spotify, Apple Music, Deezer, SoundCloud, TIDAL, Amazon Music. As soon as one suitable recording is found, stop. Never run parallel/multi-provider searches for the same song and never add multiple service links for one song.
9. **One primary streaming link per song.** Use a single direct streaming URL, preferably YouTube. If no suitable recording is found after the sequential fallback, leave the link blank. Never use a search page, a partial fragment such as `youtu`, or a guessed/truncated URL.
11. **Artist links are encouraged and independently researched.** Search separately for each distinct artist's official website and official/authoritative artist profiles (for example official social accounts and artist pages on streaming platforms). Store these only in `ArtistLinks`, associated with `artist_id`, with link type, source and verification status. Prefer official sources; do not guess or label unverified pages as official. Never copy these URLs into song `Links`.
10. **Distinguish people and roles.** Original performer, artist credited on a particular recording, featured artist, songwriter, composer, lyricist, and arranger are not interchangeable. Use `Credits` rows with the appropriate `credit_role`. Do not infer the original performer from the folder name alone.
12. **Do not invent facts, URLs, IDs, durations, keys, BPM, release years, albums, biographies, or official websites.** Unknown = blank, with `Review` entry where important. A search-results page is not a direct recording URL. Never fabricate MusicBrainz IDs or streaming URLs.
13. **Evidence-based verification.** `verified` means you actually opened/checked the specific destination or authoritative source and confirmed it supports the claim. A plausible search result, model memory, or un-opened URL is `review` or `missing`, not `verified`. Record the source name and verification method in plain text; do not store a non-streaming source URL. Confidence is not verification.
14. **Protect the user's own arrangement.** Do not copy, rewrite, summarize, or replace lyrics/chords from DOCX into the manifest. The manifest stores metadata and file references only. Do not infer StageFlow performance key/BPM/duration from a studio recording.
15. **Do not claim legal clearance.** The presence of a private library or a link does not establish copyright permission. Do not make legal conclusions.

## Required processing sequence

### A. Inventory first and identify the master repertoire list
- Enumerate every file in every supplied archive/folder.
- Look first for a single consolidated repertoire spreadsheet placed directly in the ZIP archive root. If exactly one is present and contains song entries, designate it as `MASTER_REPERTOIRE` and use it as the authoritative song list and source of user-provided song links.
- Do not select a spreadsheet buried in a subfolder as the master when a valid root-level master exists. Do not treat multiple spreadsheets as competing master lists; supporting spreadsheets remain Documents and may provide evidence only.
- If no suitable master spreadsheet exists in the archive root, do not stop or ask the user to rebuild the archive: identify song candidates by processing the folder/file structure and the contents of individual documents. Use filenames, paths, document text and embedded metadata carefully; keep uncertain title/artist identities in Review.
- If multiple plausible master spreadsheets are found in the root, do not choose silently. Record the ambiguity in Review and process file contents conservatively without treating one as authoritative.
- Preserve exact ZIP-relative paths, including folder names and filename case; use `/` separators.
- Assign a unique `document_id` to every file.
- Classify each file as `song`, `arrangement`, `medley`, `setlist`, `collection`, `score`, `spreadsheet`, or `other`.
- Do not turn a setlist, collection, score, playlist spreadsheet, or multi-song document into one ordinary song. If it contains identifiable individual songs, you may create separate candidate song rows only when the content supports that, and record the source document relationship.
- Report unreadable, encrypted, unsupported, or uninspected files. Never count them as successfully processed.

### B. Build song candidates without destructive deduplication
- When `MASTER_REPERTOIRE` exists, create one `Songs` row per distinct song entry in that table, preserving its row order and source coordinates. Use it as the primary catalog; archive documents enrich/link those entries but do not silently override them.
- When no root-level master exists, create song candidates by analyzing individual files and folders. A file may represent a song, arrangement, medley, setlist, collection or score; do not assume each file equals one song.
- If a spreadsheet entry maps to a document, link them using `source_document_id` and `file_path`.
- If multiple documents might correspond to one spreadsheet entry, preserve every document in `Documents`; put the ambiguity in `Review`.
- If a source spreadsheet contains a song absent from the archive, retain it as a song row with blank `file_path`.
- If an archive contains a song absent from the spreadsheet, include it as a candidate song row and leave source spreadsheet fields blank.
- Keep section/category information (e.g. `Main`, `MSC`, repertoire groups) as category/context, not as a song title.
- Preserve both the raw title/artist and normalized title/canonical artist.
- Never infer a definitive artist solely from a folder such as `msc`, `covers`, `rock`, or `unknown`.

### C. Resolve identities carefully
- Compare title, artist, folder, document content, source spreadsheet context, and recording credits together.
- Distinguish same-title songs by different artists.
- Distinguish original artist from recording artist and featured artist.
- If the source title is shortened or misspelled, suggest a correction in canonical fields but preserve the original value and add a `Review` row.
- Do not merge duplicate-looking rows. Use `duplicate_review_status=possible_duplicate` or `distinct_arrangement` and explain why. A confirmed duplicate may only be labelled after strong evidence; still preserve both source rows/documents for StageFlow/user decision.

### D. Preserve and classify streaming links
For every URL found in the `MASTER_REPERTOIRE`:
- Extract the actual hyperlink target, not merely the visible cell text. Preserve the exact URL string.
- If it is a complete supported streaming URL for a specific song/recording, preserve it as the song's primary link and do not search that song on YouTube or any other provider.
- This no-search rule applies to every supported streaming provider, not only YouTube. The user's chosen recording is authoritative.
- If a URL is not a song-level streaming destination, exclude it from `Links`; do not reinterpret it as an artist link automatically. Artist-level research belongs to the separate ArtistLinks process.
For URLs found in other supporting documents, preserve only valid song-level streaming destinations when there is no master-list link for that song; conflicting links go to Review and must not silently replace the master-list choice.
- If it is not a streaming-service URL (including Google Docs/Drive), do NOT add it to `Links`; do not copy it into another URL field. Record only a plain-text note that a non-streaming reference was excluded, if useful.
For songs with no existing streaming URL:
- Search YouTube first and verify the exact title/artist/recording match.
- If a suitable direct YouTube destination is found, add exactly one `Links` row and stop searching that song.
- Only if YouTube has no suitable match, search Spotify; if no suitable Spotify match, continue one service at a time through Apple Music, Deezer, SoundCloud, TIDAL and Amazon Music.
- Stop at the first suitable direct recording page. Never search multiple providers in parallel and never add a second provider after a suitable result has been found.
- Use only HTTPS direct recording pages on supported streaming-service domains. Do not use search-result URLs, homepages, playlists unless the exact user intent is a playlist, generic API endpoints, shortened text fragments or guessed URLs.
- Create no more than one `Links` row per song. Use `arrangement_reference` for any existing user-supplied streaming link from the master list, regardless of provider, and `canonical_recording` for a newly discovered matching recording. `original_link_url` should contain the exact complete source URL when supplied; otherwise leave blank.
- If no suitable recording is found after the sequential fallback, leave the song without a link.

### E. Artist catalog and independent artist-link research
- Create one Artists row per distinct artist entity, with stable IDs within this manifest.
- Normalize spelling and punctuation only in `canonical_name`; preserve source variants in `source_names`.
- Do not merge different artists with similar names.
- Independently research each distinct artist after the song/artist identities are established. Search for the official website and official/authoritative artist profiles, including official social pages and artist profiles on streaming services where available.
- Store artist destinations only in the separate `ArtistLinks` sheet. Include `artist_link_id`, `artist_id`, `link_type`, `label`, `url`, `source_name`, `verification_status`, `confidence`, `is_official`, and `notes` where supported by the template.
- Prefer the artist's own website and verified/official accounts. Do not assume that a fan page, label page, Wikipedia, MusicBrainz or a similarly named account is official. Such authoritative reference pages may be included only with an accurately described link_type and verification status; do not mislabel them as official.
- `Artists.official_website_url` may remain as a backward-compatibility field but must not be the only place artist links are stored. Use `ArtistLinks` as the canonical collection.
- Deduplicate identical artist URLs per artist, but preserve distinct official destinations (website, Instagram, Facebook, YouTube artist channel, Spotify artist profile, etc.).
- MusicBrainz IDs, formed/ended years, country, genres and biography are optional metadata. Record source names and verification method.

### F. Metadata
- Separate original work metadata, selected recording metadata, and the user's stage/performance metadata.
- `original_release_year` = release year of the original work/recording only when supported.
- `reference_recording_year`, `reference_album`, `reference_duration_seconds`, `reference_key`, `reference_bpm` describe the specific selected reference recording, not the user's live arrangement.
- `stage_key`, `stage_bpm`, `stage_duration_seconds` may be filled ONLY from explicit user-provided data. Otherwise leave blank.
- Songwriters/composers/lyricists should be represented as credits when possible, not confused with performers.
- Do not guess BPM/key by listening impression or by model memory. If you have no reliable source/tool, leave blank.

### G. Review and audit
Create `Review` entries for:
- ambiguous song identity or artist;
- same-title collisions;
- possible duplicates or multiple arrangements;
- one source entry matching multiple files;
- one file matching multiple source entries;
- malformed, dead, suspicious, or conflicting streaming URLs;
- songs for which no suitable streaming recording can be found;
- non-song documents that might contain multiple songs;
- missing or unreadable files;
- any normalization that changes the apparent title/artist materially.
For every Review row, state the exact reason and what decision is needed. Do not mark an issue resolved merely because you guessed.

## Required workbook structure

Use the supplied v1.3 template and preserve its sheet names and columns. Do not rename or remove existing sheets/columns. Fill these sheets:

- `Songs`: one row per song/arrangement candidate, preserving source fields and linking to documents.
- `Artists`: one row per distinct artist entity.
- `Links`: song-level streaming destinations only, one primary destination per song.
- `ArtistLinks`: artist-level websites and profiles only, linked by `artist_id`.
- `Review`: every unresolved issue and proposed decision.
- `Documents`: complete inventory of every supplied file, including non-song files.
- `Credits`: performer/songwriter/composer/lyricist/arranger roles where supported.
- `START HERE`, `Fields`, `Examples`: retain these reference sheets; remove example data from import data sheets or clearly mark it as examples and ensure it is not counted as real data.

If the provided template version differs, do not silently redesign it. Preserve all existing columns and add only clearly named optional columns/sheets if needed. State every schema addition.

## Mandatory validation before returning
1. Count all files found in each archive and reconcile them against `Documents`.
2. Confirm every file has exactly one `Documents` row. If not, explain the discrepancy.
3. Confirm every `Songs.source_document_id` exists in `Documents`.
4. Confirm every `Songs.artist_id`, `Songs.original_artist_id`, `Songs.recording_artist_id`, `Links.entity_id`, `ArtistLinks.artist_id`, and `Credits.artist_id` resolves to a real row of the correct entity type.
5. Confirm every link row has a URL and valid role; user links are preserved exactly.
6. Confirm no two different songs were merged just because their titles match.
7. Confirm duplicate-looking documents are still preserved as separate document records.
8. Confirm no search-result URLs or fabricated URLs/IDs are labelled verified.
9. Confirm `Links` contains only song-level streaming URLs and `ArtistLinks` contains only artist-level destinations; no cross-contamination.
10. Confirm every valid streaming URL in the root master repertoire list was preserved exactly and no search was performed for that song; no song has more than one primary streaming URL.
11. Confirm provider fallback was sequential and stopped at the first suitable result.
12. Confirm the number of songs, artists, streaming links, excluded non-streaming references, review items and documents in a summary.
13. Keep `verified`, `review`, `missing`, `invalid`, `unmatched` statuses honest. High confidence alone does not mean verified.
14. Remove example rows from data sheets before final delivery.

## Deliverables
Return:
1. A completed XLSX using the supplied template.
2. A concise processing report with counts: files discovered/processed/unreadable; song candidates; artists; existing user-supplied streaming links preserved; new streaming links found; non-streaming references excluded; review items; unresolved identities.
3. A list of limitations caused by your plan, context window, file-size limit, web access, or unavailable tools.
4. A list of any files or batches not processed.

If you reach a usage/time limit:
- Save and return the current workbook as a clearly labelled PARTIAL manifest.
- State exactly which files/rows/batches are completed and which remain.
- Do not claim the manifest is complete.
- Provide a continuation note listing the next unprocessed paths/rows and the exact remaining task.
- Never silently omit the remainder.

Work in batches if necessary, but maintain stable IDs and a cumulative workbook. Do not restart from scratch or duplicate already processed rows when continuing.

## User's goal
The final result should make StageFlow import as close to silent as safely possible while preserving every source file and every user-supplied master-list streaming URL. A single root-level repertoire spreadsheet, when present, is the authoritative song list and its supplied song links are never searched/replaced. If it is absent, infer song candidates from the archive's files and folders. Song recording links and artist profile links are separate datasets: song links are streaming-only; artist links are independently researched and encouraged. Provider fallback is sequential and stops at the first suitable result. StageFlow's importer independently enforces these rules.