1---
2name: photos
3description: Organize, index, and search local photo libraries with AI-powered metadata and safe file handling.
4metadata:
5 source: https://skillmd.com/skills/modbender/photos
6 clawdbot:
7 emoji: 🖼️
8 requires:
9 bins:
10 - exiftool
11 os:
12 - linux
13 - darwin
14 - win32
15---
16
17## Safety First
18
19- **Never delete photos directly** — move to `.photo-trash/` folder with original path preserved in filename
20- **Never overwrite originals** — edits go to `edited/` subfolder, originals stay untouched
21- Before bulk operations, create manifest: `photos-pending.json` with planned actions for user review
22- When user says "delete duplicates", move to trash and report count — let them empty trash manually
23
24## Indexing Strategy
25
26- Create `.photo-index/` in library root with one JSON sidecar per photo
27- Sidecar filename: `{original-hash}.json` — survives renames and moves
28- Index fields: `hash`, `path`, `date_taken`, `camera`, `gps`, `description`, `tags`, `indexed_at`
29- Run indexing incrementally — skip files with matching hash already indexed
30- Store description from vision analysis in sidecar, not in EXIF (non-destructive)
31
32## Vision Analysis (Token-Efficient)
33
34- Don't analyze every photo upfront — index on-demand when user searches or asks
35- Cache vision results permanently in sidecar JSON — never re-analyze same photo
36- For bulk analysis, process in batches of 20 with progress updates
37- Use concise prompts: "Describe this photo in 2-3 sentences. List people, objects, location, activity."
38- Skip screenshots and memes (detect by aspect ratio + lack of EXIF) unless explicitly requested
39
40## Duplicate Detection
41
42- Generate perceptual hash (pHash) alongside content hash — catches near-duplicates and resized copies
43- Group duplicates by pHash similarity, keep highest resolution as "original"
44- Report duplicates with thumbnails/paths, never auto-delete
45- Consider EXIF date — oldest is likely the original, newer copies are backups
46
47## Search Patterns
48
49- **By content**: Search sidecar descriptions with simple text match first, vision re-analysis if no hits
50- **By date**: Parse EXIF DateTimeOriginal, fall back to file mtime
51- **By location**: Reverse geocode GPS once, store city/country in sidecar for text search
52- **By person**: If user identifies someone once ("that's Maria"), tag all similar faces in index
53
54## EXIF Handling
55
56- Read: `exiftool -json photo.jpg` — returns all metadata as JSON
57- Write date: `exiftool -DateTimeOriginal="2024:03:15 14:30:00" photo.jpg`
58- Strip GPS before sharing: `exiftool -gps:all= photo.jpg` (operates on copy, not original)
59- Batch read: `exiftool -json -r /photos/` — recursive, outputs array
60
61## File Organization
62
63- Propose structure, don't impose: `YYYY/MM/` or `YYYY/MM-DD/` based on user preference
64- Rename pattern: `YYYYMMDD_HHMMSS_originalname.ext` — preserves original name, adds sortable prefix
65- Handle timezone: EXIF dates are local time — ask user's timezone once, store in `.photo-index/config.json`
66- HEIC to JPEG: `sips -s format jpeg input.heic --out output.jpg` (macOS) or `heif-convert` (Linux)
67
68## NAS/Remote Libraries
69
70- For Synology/NAS: work with mounted paths, don't assume local speeds
71- Test connection before bulk operations: `ls /Volumes/photos | head -1`
72- For slow connections, build local index cache that syncs periodically
73- Respect `@eaDir` (Synology thumbnails) and `.DS_Store` — skip in indexing