Genre Audit SOP: Agent SOP for genre audit # Genre Audit > Agent SOP for auditing existing genre tags against enrichment and audio evidence. Audit existing genre tags across a Rekordbox collection using cached enrichment and audio evidence. ### Agent prompt [Section titled “Agent prompt”](#agent-prompt) Paste into your agent to start: ```plaintext Audit my existing genre tags. ``` ## Constraints * **Taxonomy is compiled.** The alias map in `genre.rs` cannot be changed at runtime. If the user disagrees with a mapping, the agent works around it by using the user’s preferred genre directly. * **No auto-tagging.** Every genre change requires explicit human approval. * **Cache-first.** Audit runs from cached data. If cache is empty for a track, it is flagged as insufficient evidence — do not trigger enrichment mid-audit. * **XML export only.** No direct DB writes. All changes flow through `update_tracks` → `preview_changes` → `write_xml`. ## Prerequisites ```plaintext cache_coverage(has_genre=true) ``` All providers must be at 100% before proceeding. If not, hydrate first: ```plaintext analyze_audio_batch(has_genre=true, skip_cached=true, max_tracks=200) enrich_tracks(has_genre=true, skip_cached=true, providers=["discogs"], max_tracks=50) enrich_tracks(has_genre=true, skip_cached=true, providers=["beatport"], max_tracks=50) ``` Repeat until all providers reach 100%. Report progress between batches. **Recommended:** run `suggest_normalizations()` and stage alias fixes before auditing. This ensures the audit compares against canonical genre names, not aliases that inflate conflict counts. ## Steps ### 1. Audit batch ```plaintext audit_genres(max_tracks=50) ``` The server applies the genre decision tree to tracks that already have genres, comparing the evidence-based result against the current tag. Only conflicts and manual-review tracks appear in results. Report the confidence distribution before review: “This batch: N high, N medium, N low, N insufficient out of N total.” ### 2. Review by confidence tier Process each tier separately, highest confidence first. #### High confidence Present as a numbered list, grouped by suggested genre for scannability: ```plaintext High confidence (12 conflicts): → Deep Techno (5): #1 Artist A — Track X | Techno → Deep Techno (Beatport: Raw/Deep, Discogs: Deep Techno x3) #2 Artist B — Track Y | Techno → Deep Techno (label: Ilian Tape, audio: atmospheric) ... → Tech House (3): #6 Artist C — Track Z | House → Tech House (Beatport: Tech House, Discogs: Tech House x2) ... ``` Ask user: **“Approve all, or reject/change specific numbers.”** Stage approved changes. #### Medium confidence Same numbered-list format. Highlight evidence tensions where sources disagree. Ask user: **“Approve all, or reject/change specific numbers. Say ‘investigate #N’ for any you want more context on.”** For investigated tracks: use artist discography, label roster, and related tracks in the library to form a recommendation. Stage approved changes. #### Low confidence and manual review These need per-track judgment. For each: 1. Read the evidence and flags from the audit result 2. Use artist reputation, label context, and track title to form a recommendation 3. Present reasoning: `Artist on Label — known for [context]. Evidence: [summary]. Recommend: GENRE because [reason].` Present in small groups (3–5) and ask user to approve/reject/change each. Stage approved changes. ### 3. Paginate Repeat Steps 1–2 with `offset` until all tracks are processed. Report cumulative progress between batches: `"Batch 3/N: M audited, X changes staged, Y confirmed."` ### 4. Export ```plaintext preview_changes() ``` Ask user: “Export these changes to XML?” ```plaintext write_xml() ``` Report output path, then walk the user through the Rekordbox import: 1. **Add XML to Rekordbox** — Open Preferences → Advanced → rekordbox xml → **Imported Library** → Browse → select the exported XML file. 2. **Open the XML view** — In the sidebar, click the **“Display rekordbox xml”** icon. The imported tracks appear under “All Tracks”. 3. **Import into collection** — Select all tracks (Cmd+A), right-click → **Import To Collection**. When prompted “Do you want to load information in the tag of the library being imported?”, click **Yes** (tick “Don’t ask me again” for bulk imports).