Agent SOP: Genre Audit
Audit existing genre tags across a Rekordbox collection using cached enrichment and audio evidence.
Agent prompt
Section titled “Agent prompt”Paste into your agent to start:
Audit my existing genre tags.Constraints
- Taxonomy is compiled. The alias map in
genre.rscannot 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
cache_coverage(has_genre=true)Use the scoped entries as evidence-quality signals. Discogs and Beatport
searched coverage includes cached no-matches; has_result is the usable-match
count, and errors are neither searched nor matched. Fill missing core searches
and Stratum analysis where practical:
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)For each bounded enrichment or audio call, start with offset=0, record its
successes and identity-bearing failures, then continue with
offset=page.next_offset while page.has_more is true. The offset indexes the
underlying stable selector, so cached/current prefixes do not consume work
slots. After traversing the scope, retry failed explicit track_ids separately
and re-run cache_coverage(has_genre=true). Stop only when the core searched
and Stratum readiness is sufficient for the audit, or report the unresolved
failures. A cached no-match is searched, not matched. If the library or selector
order changes mid-run, discard the cursor and restart at zero. Keep each
enrichment traversal’s providers, skip_cached, and force_refresh values
fixed. Keep Essentia availability fixed for an audio traversal; if Essentia is
installed or becomes newly available, or if skip_cached changes, restart that
audio scope at zero.
Essentia improves energy and timbral evidence but is not a hard gate. Proceed when coverage is incomplete; the audit will surface low or insufficient confidence for individual review. Retry actual errors, but do not require a match for a legitimately searched release.
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
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:
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:
- Read the evidence and flags from the audit result
- Use artist reputation, label context, and track title to form a recommendation
- 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 the explicit audit_genres offset until all audit tracks
are processed. This classification offset is separate from the enrichment and
audio page.next_offset traversals above.
Report cumulative progress between batches: "Batch 3/N: M audited, X changes staged, Y confirmed."
4. Export
preview_changes()Ask user: “Export these changes to XML?”
write_xml()Report output path, then walk the user through the Rekordbox import:
- Add XML to Rekordbox — Open Preferences → Advanced → rekordbox xml → Imported Library → Browse → select the exported XML file.
- Open the XML view — In the sidebar, click the “Display rekordbox xml” icon. The imported tracks appear under “All Tracks”.
- 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).
