Library Health SOP: Agent SOP for library health scanning # Library Health > Agent SOP for scanning broken links, orphan files, duplicates, and playlist coverage. Scan a Rekordbox library for broken links, orphan files, duplicates, and playlist coverage gaps. ### Agent prompt [Section titled “Agent prompt”](#agent-prompt) Paste into your agent to start: ```plaintext Run a full health scan on my library. ``` ## Constraints * **Read-only scanning.** No files are modified, moved, or deleted by these tools. * **Results are point-in-time snapshots.** Run scans after any Rekordbox import/export or file system changes. * **Samplers excluded.** All scans ignore Rekordbox factory sampler files. ## Prerequisites * reklawdbox MCP server connected * No external tools required — all scanning is built-in ## Steps ### 0. Start with read\_library ```plaintext read_library ``` Review `content_roots` and `total_tracks` to understand the library scope. ### 1. Scan for broken links ```plaintext scan_broken_links(path_prefix="/path/to/scope", limit=200) ``` Checks every track in the database for missing files on disk. Use `path_prefix` to scope to a specific directory. `suggest_relocations` (default true) reports suggested relocations when a file with the same name exists elsewhere in the content roots. **If broken links found:** Review suggested relocations. File moves must be done manually in Rekordbox (Preferences > Advanced > Database Management > Relocate) or by correcting the directory structure. ### 2. Scan for orphan files ```plaintext scan_orphan_files(path_prefix="/path/to/scope", limit=200) ``` Finds audio files on disk that are not imported into Rekordbox. Groups results by directory. Use `path_prefix` to scope to a specific directory instead of scanning all content roots. **If orphans found:** These files can be imported into Rekordbox via drag-and-drop, or deleted if no longer wanted. ### 3. Check playlist coverage ```plaintext scan_playlist_coverage(limit=200) ``` Finds tracks not assigned to any playlist. Accepts the shared search filters (`genre`, `artist`, `bpm_min`, `bpm_max`, `path_prefix`, `has_label`, etc.) for scoping to specific subsets of the library. **If uncovered tracks found:** Review and assign to playlists, or accept that some tracks are intentionally unplaylisted. ### 4. Find duplicates ```plaintext scan_duplicates(detection_level="metadata", limit=50) ``` Groups tracks by matching artist + title. Each group includes a `suggested_keep` recommendation based on audio quality (bitrate > sample rate > play count > rating). Use `path_prefix` to scope to a specific directory. For higher confidence, run exact-level detection: ```plaintext scan_duplicates(detection_level="exact", limit=50) ``` This hashes actual audio files and only reports byte-identical duplicates. **If duplicates found:** Remove duplicates manually in Rekordbox. The `suggested_keep` field indicates which copy to retain. ### 5. Summary Report findings across all four scans: broken link count, orphan count, playlist coverage percentage, and duplicate group count. Suggest next steps based on which issues were found.