Both _folder_priority and _path_penalty were scanning the entire path string including the basename. A file named 'mytrashed_pic.jpg' in /photos/MobileBackup/ would falsely match the 'trash' token. Now only directory segments are checked; filename never influences keeper selection beyond its actual path location. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>