Backup of conversations to Obsidian
by @laserducktales
Automatic conversation backup system for Obsidian with incremental snapshots, hourly breakdowns, and formatted chat-style markdown. Use when setting up conversation archival, preventing data loss from /new resets, or organizing chat history in Obsidian vault with proper formatting (colored callouts, timestamps, multi-paragraph support).
clawhub install obsidian-conversation-backupπ About This Skill
name: obsidian-conversation-backup description: Automatic conversation backup system for Obsidian with incremental snapshots, hourly breakdowns, and formatted chat-style markdown. Use when setting up conversation archival, preventing data loss from /new resets, or organizing chat history in Obsidian vault with proper formatting (colored callouts, timestamps, multi-paragraph support).
Obsidian Conversation Backup
Automatically backs up Clawdbot conversations to Obsidian with beautiful chat-style formatting. Prevents data loss from /new resets with hourly incremental snapshots.
Features
Quick Setup
Installation
# Extract the skill (if downloaded as .skill file)
unzip obsidian-conversation-backup.skill
cd obsidian-conversation-backupRun installer (interactive)
chmod +x install.sh
./install.sh
The installer will ask for:
Or manual setup:
1. Copy config.example to config
2. Edit config with your paths
3. Make scripts executable: chmod +x scripts/*.sh
Enable Automatic Backups
Add to crontab for hourly backups:
crontab -eAdd this line (runs every hour at :00)
0 * * * * /path/to/obsidian-conversation-backup/scripts/monitor_and_save.sh
Customize Chat Appearance (Optional)
Edit scripts/format_message_v2.jq to change:
[!quote] for user, [!check] for assistant)Usage
Automatic Incremental Backups
Once configured in cron, the system runs automatically:
Every hour:
YYYY-MM-DD-HHmm-incremental.mdExample output:
2026-01-20-1500-incremental.md (messages from last save to now)
2026-01-20-1600-incremental.md (new messages since 15:00)
2026-01-20-1700-incremental.md (new messages since 16:00)
Protection: Max conversation loss = 1 hour
On-Demand Full Snapshot
Save complete conversation anytime:
scripts/save_full_snapshot.sh [topic-name]
Examples:
scripts/save_full_snapshot.sh important-decisions
scripts/save_full_snapshot.sh bug-fix-discussion
scripts/save_full_snapshot.sh # uses "full-conversation" as default
Hourly Breakdown (Organization)
Create organized breakdown by clock hour:
scripts/create_hourly_snapshots.sh YYYY-MM-DD
Example:
scripts/create_hourly_snapshots.sh 2026-01-20
Output:
2026-01-20-1500-hourly.md (15:00-15:59 messages)
2026-01-20-1600-hourly.md (16:00-16:59 messages)
2026-01-20-1700-hourly.md (17:00-17:59 messages)
Use case: End-of-day organization for easy reference
Chat Format
Messages appear as colored Obsidian callouts:
User messages (blue [!quote] callout):
> [!quote] π User Β· 15:30
> This is my message
Assistant messages (green [!check] callout):
> [!check] π¦ Zoidbot Β· 15:31
> This is the response
Features:
for paragraph breaks)> )Token Monitoring
The monitor_and_save.sh script also tracks token usage:
Warnings via Telegram:
Implementation:
# Sends warning only when crossing threshold (one-time)
No repeated warnings
Resets when back under 800k
File Structure
scripts/
βββ monitor_and_save.sh # Hourly incremental backup + token monitoring
βββ save_full_snapshot.sh # On-demand full conversation save
βββ create_hourly_snapshots.sh # Organize by clock hour
βββ format_message_v2.jq # Chat formatting logic
Configuration
Tracking Files
The system uses hidden files to track state:
/root/clawd/.last_save_line_count # For token monitoring
/root/clawd/.last_snapshot_timestamp # For incremental saves
/root/clawd/.token_warning_sent # For warning deduplication
Note: Do not delete these files or incremental backups may duplicate content
Session File Location
Default: /root/.clawdbot/agents/main/sessions/*.jsonl
If your session files are elsewhere, update the SESSION_FILE path in each script.
Troubleshooting
No snapshots being created
1. Check cron is running: crontab -l
2. Verify script has execute permission: chmod +x scripts/*.sh
3. Check logs: Run manually to see errors
Messages breaking out of callouts
format_message_v2.jq has the gsub("\n\n"; "
") line> prefixjq --versionDuplicated content in snapshots
rm /root/clawd/.last_snapshot_timestamp
Empty callout boxes appearing
format_message_v2.jq to filter empty messagesif ($text_content | length) > 0 conditionRequirements
apt-get install jq)Advanced Customization
Change Backup Frequency
Edit crontab:
# Every 2 hours
0 */2 * * * /path/to/monitor_and_save.shEvery 30 minutes
*/30 * * * * /path/to/monitor_and_save.shSpecific times only (9am, 12pm, 6pm, 9pm)
0 9,12,18,21 * * * /path/to/monitor_and_save.sh
Change Minimum Message Threshold
Edit monitor_and_save.sh:
# Change from 10 to 5 messages minimum
if [[ $new_lines -lt 5 ]]; then
Add More Callout Styles
Obsidian callout types:
[!quote] - Blue[!check] - Green[!note] - Cyan[!tip] - Purple[!warning] - Orange[!danger] - RedCustomize Telegram Notifications
Edit monitor_and_save.sh to change warning text or add custom notifications.
Best Practices
1. Run hourly breakdown at end of day - Use as organizational tool, not backup
2. Keep incremental backups running - This is your safety net
3. Test scripts after setup - Run manually first to verify output
4. Backup tracking files - Include .last_snapshot_timestamp in vault backups
5. Use descriptive topic names - For full snapshots, use meaningful names
Example Workflow
Daily routine:
1. Automatic incremental backups run hourly (no action needed)
2. At end of day: scripts/create_hourly_snapshots.sh 2026-01-20
3. Review organized hourly files in Obsidian
4. Delete old incrementals if desired (hourly breakdown covers them)
Before /new reset:
1. Optional: scripts/save_full_snapshot.sh before-reset
2. Run /new safely - conversation is backed up
3. Continue chatting - incrementals resume automatically
Integration with Clawdbot
This skill works with:
Credits
Created by the Clawdbot community for reliable conversation backup and beautiful Obsidian formatting.
π‘ Examples
Automatic Incremental Backups
Once configured in cron, the system runs automatically:
Every hour:
YYYY-MM-DD-HHmm-incremental.mdExample output:
2026-01-20-1500-incremental.md (messages from last save to now)
2026-01-20-1600-incremental.md (new messages since 15:00)
2026-01-20-1700-incremental.md (new messages since 16:00)
Protection: Max conversation loss = 1 hour
On-Demand Full Snapshot
Save complete conversation anytime:
scripts/save_full_snapshot.sh [topic-name]
Examples:
scripts/save_full_snapshot.sh important-decisions
scripts/save_full_snapshot.sh bug-fix-discussion
scripts/save_full_snapshot.sh # uses "full-conversation" as default
Hourly Breakdown (Organization)
Create organized breakdown by clock hour:
scripts/create_hourly_snapshots.sh YYYY-MM-DD
Example:
scripts/create_hourly_snapshots.sh 2026-01-20
Output:
2026-01-20-1500-hourly.md (15:00-15:59 messages)
2026-01-20-1600-hourly.md (16:00-16:59 messages)
2026-01-20-1700-hourly.md (17:00-17:59 messages)
Use case: End-of-day organization for easy reference
βοΈ Configuration
Tracking Files
The system uses hidden files to track state:
/root/clawd/.last_save_line_count # For token monitoring
/root/clawd/.last_snapshot_timestamp # For incremental saves
/root/clawd/.token_warning_sent # For warning deduplication
Note: Do not delete these files or incremental backups may duplicate content
Session File Location
Default: /root/.clawdbot/agents/main/sessions/*.jsonl
If your session files are elsewhere, update the SESSION_FILE path in each script.
π Tips & Best Practices
1. Run hourly breakdown at end of day - Use as organizational tool, not backup
2. Keep incremental backups running - This is your safety net
3. Test scripts after setup - Run manually first to verify output
4. Backup tracking files - Include .last_snapshot_timestamp in vault backups
5. Use descriptive topic names - For full snapshots, use meaningful names