Chat Integrator
Overview
Automatski integriše procesirane medije (audio transkripcije i image summaries) u chat.md fajlove na pravom mjestu po timestamp-u.
Što radi:
- Nalazi sve
.jsonaudio transkripcije u folderu - Nalazi sve
.mdimage summaries u folderu - Ekstraktuje timestamp iz imena fajla
- Ubacuje sadržaj u
chat.mdna hronološki pravom mjestu - Održava postojeći sadržaj chat.md-a
Output:
- Ažuriran
chat.mdsa uključenim audio i slikama na pravim mjestima
When to Use This Skill
User says:
- "Integrate media into chat"
- "Merge audio/images into chat.md"
- "Update chat.md with processed media"
- "Add transcriptions to chat"
Workflow
Simple Usage
Integrate media for specific folder:
python .claude/skills/chat-integrator/scripts/integrate_media.py "gastrohem whatsapp/administracija/20.10 - 27.10/24.10"
Integrate media for specific date (scans all departments):
python .claude/skills/chat-integrator/scripts/integrate_media.py --scan-date 24.10
Integrate media for today:
python .claude/skills/chat-integrator/scripts/integrate_media.py
What Happens
-
Scan folder for processed media:
- Audio:
*.mp3.json,*.ogg.json, etc. - Images:
*.png.md,*.jpg.md, etc.
- Audio:
-
Extract timestamp from filename:
WhatsApp Audio 2025-10-24 at 16.36.50.mp3→[24. 10. 2025., 16:36:50]image.png→ Uses file modification time
-
Read content:
- Audio
.json: Extracttextfield - Image
.md: Extract summary content
- Audio
-
Parse chat.md:
- Read existing entries with timestamps
- Identify insertion points
-
Merge and sort:
- Combine existing + new entries
- Sort by timestamp chronologically
- Write back to
chat.md
Timestamp Format
WhatsApp filename formats (supported):
Format 1: WhatsApp [Audio/Image/Video] YYYY-MM-DD at HH.MM.SS
- WhatsApp Audio 2025-10-24 at 16.36.50.mp3
- WhatsApp Image 2025-10-24 at 22.42.33.png
- WhatsApp Video 2025-10-24 at 14.30.45.mp4
Format 2: [AUDIO/PHOTO/IMAGE/VIDEO/PTT]-YYYY-MM-DD-HH-MM-SS
- AUDIO-2025-10-26-15-00-32.mp3
- PHOTO-2025-10-24-22-42-33.jpg
- IMAGE-2025-10-26-09-15-23.png
- VIDEO-2025-10-24-14-30-45.mp4
- PTT-2025-10-24-18-20-10.ogg
Extraction priority:
- WhatsApp format (Format 1 or 2) - extracts full date & time
- Fallback to file modification time
chat.md format:
[24. 10. 2025., 16:36:50] Sender: message
Entry Format in chat.md
Audio entry:
[24. 10. 2025., 16:36:50] [AUDIO] Adis Kadric: Full transcribed text here...
Image entry:
[24. 10. 2025., 09:15:23] [IMAGE] Mahir Kadic:
Summary of image content...
Key information extracted from image...
Script Reference
integrate_media.py
Purpose: Main script for integrating processed media into chat.md
Arguments:
folder(optional) - Path to specific folder--scan-date DD.MM- Scan all departments for this date--dry-run- Preview changes without writing--backup- Create backup before modifying (default: true)
What it does:
- Finds all
.jsonand.mdfiles (skips chat.md, summary.md) - Extracts timestamps from filenames
- Reads content from each file
- Parses existing chat.md
- Merges entries chronologically
- Writes updated chat.md
Best Practices
- Always run after media processing - First run
gastrohem-media-processor, thenchat-integrator - Use --dry-run first - Preview changes before committing
- Automatic backups - Script creates
chat.md.backupbefore modifying - Run daily - Integrate media daily to keep chat.md up-to-date
- Check results - Review integrated content for accuracy
Error Handling
If timestamp extraction fails:
- Falls back to file modification time
- Logs warning with filename
If chat.md doesn't exist:
- Creates new chat.md with integrated media
If entry already exists:
- Skips duplicate entries (checks by timestamp + content hash)
Example Workflow
User: "Integrate media"
Claude:
- Runs:
python .claude/skills/chat-integrator/scripts/integrate_media.py - Scans today's folders across all departments
- Finds 2 audio .json files and 1 image .md file
- Extracts timestamps and content
- Merges into existing chat.md chronologically
- Reports: "Integrated 3 media entries into chat.md across 2 folders."
Scan to join WeChat group