Automatically bidirectionally syncs plan files between ~/.claude-glm/plans/ and ~/.claude/plans/ using Unison file synchronizer.
- Bidirectional sync: Changes in either directory are synced to the other
- No infinite loops: Unison maintains state to track which side originated changes
- Conflict resolution: Automatically keeps the newer version of files
- Real-time monitoring: Uses
inotifywaitto detect changes immediately - Runs as a service: Automatically starts on login via systemd
sudo apt update
sudo apt install unison inotify-toolsThe service files are already in place. Just enable and start it:
# Reload systemd to recognize the service
systemctl --user daemon-reload
# Enable auto-start on login
systemctl --user enable claude-plan-sync.service
# Start the service now
systemctl --user start claude-plan-sync.serviceThese aliases are already configured - reload your shell with source ~/.bashrc:
# Service control
plan-sync-start # Start the sync service
plan-sync-stop # Stop the sync service
plan-sync-restart # Restart the sync service
plan-sync-status # View service status
plan-sync-enable # Enable auto-start on login
plan-sync-disable # Disable auto-start
# Logs
plan-sync-logs # Follow the sync activity log
plan-sync-logs-all # Follow the full service log# Start the service
plan-sync-start
# Check if it's running
plan-sync-status
# Watch sync activity in real-time
plan-sync-logs- Monitoring: The service uses
inotifywaitto watch both directories for changes (create, modify, move, delete) - Sync Trigger: When a change is detected, Unison runs to sync both directories
- State Tracking: Unison stores state in
~/.unison/to remember:- The last sync state of each file
- Which replica originated each change
- This prevents infinite sync loops
- Source A:
~/.claude-glm/plans/ - Source B:
~/.claude/plans/
When the same file is modified on both sides between syncs:
- Unison keeps the newer version (based on modification time)
- The older version is overwritten
- No backup copies are kept (configurable)
| File | Location |
|---|---|
| Sync script | ~/.claude-sync-plans/plan-sync.sh |
| Service file | ~/.config/systemd/user/claude-plan-sync.service |
| Sync log | ~/.claude-sync-plans/sync.log |
| Service log | ~/.claude-sync-plans/service.log |
| Unison state | ~/.unison/ |
| Unison profile | ~/.unison/plans.prf |
# Check the service status for errors
plan-sync-status
# View error logs
journalctl --user -u claude-plan-sync.service -n 50# Check if inotify-tools is installed
which inotifywait
# If not, install it:
sudo apt install inotify-tools
# Restart the service
plan-sync-restart# Run unison directly
unison plans# Run unison with verbose output
unison plans -verboseIf sync is behaving strangely, you can reset Unison's state:
# Stop the service first
plan-sync-stop
# Remove Unison state (will rescan all files on next sync)
rm -f ~/.unison/plans*
# Restart service
plan-sync-startThe service uses a profile at ~/.unison/plans.prf with these settings:
root = ~/.claude-glm/plans
root = ~/.claude/plans
batch = true # No prompts
auto = true # Auto-accept non-conflicting changes
prefer = newer # Keep newer version on conflicts
fastcheck = true # Quick detection using size/modtime
copyonconflict = false # Don't create conflict copies
To customize, edit ~/.unison/plans.prf and restart the service.
If you prefer to sync manually instead of running a service:
# Just run unison with the profile
unison plansShows what files are being synced:
tail -f ~/.claude-sync-plans/sync.logShows service-level messages:
tail -f ~/.claude-sync-plans/service.logFull systemd logs:
journalctl --user -u claude-plan-sync.service -f