Watch Mode
Overview
Section titled “Overview”Watch mode runs a daemon that automatically backs up your memory file when changes are detected. Supports compression, logging, and automatic pruning of old backups.
# Default: backup every 5 minutes, keep 10 backupsnpx toon-memory watch
# Custom interval (in minutes)npx toon-memory watch 10
# Enable gzip compressionnpx toon-memory watch -c
# Enable file loggingnpx toon-memory watch -l
# Keep max 20 backupsnpx toon-memory watch -m 20
# All options combinednpx toon-memory watch 15 -c -l -m 20
# Press Ctrl+C to stopOptions
Section titled “Options”| Option | Description | Default |
|---|---|---|
[interval] |
Backup interval in minutes | 5 |
-c, --compress |
Enable gzip compression | off |
-l, --log [path] |
Enable file logging | off |
-m, --max-backups <n> |
Max backups to keep (0=unlimited) | 10 |
Example Output
Section titled “Example Output”$ npx toon-memory watch 15 -c -l -m 20
🧠 toon-memory watch
Watching memory file every 15 minutes...Max backups: 20Compression: enabledLogging: enabled (.opencode/memory/watch.log)Press Ctrl+C to stop
📦 Backup #1 created: 2026-07-11T16-00-00-000Z📦 Backup #2 created: 2026-07-11T16-15-00-000Z🗑️ Pruned 1 old backup(s)^C✅ Watch stopped. 2 backups created.How It Works
Section titled “How It Works”- Watches
.opencode/memory/data.toonfor changes - When content changes, creates a timestamped backup
- Backups are stored in
.opencode/memory/backups/ - Only creates backup when content actually changes
- If max-backups is exceeded, oldest backups are pruned
- Optional gzip compression reduces backup size by ~60-80%
- Optional logging writes events to a file
Backup Files
Section titled “Backup Files”.opencode/memory/backups/├── backup-2026-07-11T16-00-00-000Z.toon├── backup-2026-07-11T16-15-00-00-000Z.toon.gz # compressed└── backup-2026-07-11T16-30-00-000Z.toonUse Cases
Section titled “Use Cases”- Long coding sessions — Auto-backup while you work
- Pre-deployment — Run before important changes
- CI/CD — Backup before automated changes
- Low disk space — Use
-cfor compression - Debugging — Use
-lto log backup events