What It Does
- Real-time file synchronization across 6+ Linux hosts
- Git-aware conflict detection and resolution
- AI-powered merge via Claude API fallback
- Daemon-based with 15-second sync intervals
Tech Stack
- Bash (core engine)
- rsync over SSH with persistent sockets
- Git integration (untracked file sync)
- Claude API (conflict resolution)
Problem Statement
Working across multiple Linux machines (WSL instances, bare-metal servers, cloud VMs) creates a constant challenge: keeping shell environments, scripts, project code, and configurations in sync. Traditional solutions (git alone, cloud sync tools) don't handle the nuance of development workflows — untracked files, environment-specific configs, or real-time shell customizations.
Architecture Overview
Sync Engines
| Engine | Purpose | Mode |
|---|---|---|
sync_environment.sh |
Shell environment files (.bashrc, .bash_aliases, .bash_utils) | Daemon (15s loop) + cron |
sync_wsl_linux.sh |
Full WSL ↔ Linux bidirectional sync | On-demand |
sync_project.sh |
Project code with git-aware conflict detection | On-demand (git-only default) |
sync_SCRIPTS.sh |
0_SCRIPTS directory across all hosts | On-demand |
sync_HUBITAT.sh |
Smart home automation configurations | On-demand |
sync_elfege.com.sh |
Portfolio website deployment | On-demand |
sync_arduino.sh |
Arduino/IoT project files | On-demand |
Key Design Decisions
-
Git-Aware Sync
Only untracked files are synced via rsync. Git-tracked files are left to manual git operations, preventing sync conflicts with version control.
-
Single-Instance Guard
PID-based locking prevents duplicate daemons. Each engine yields to higher-priority syncs via
yield_to_other_sync(). -
SSH Persistent Sockets
ControlMaster connections with 60s timeout reduce SSH handshake overhead across frequent sync cycles.
-
AI-Powered Conflict Resolution
When 3-way diff3 merge fails, the Claude API is used as a fallback for intelligent merge decisions — a novel approach to file synchronization.
-
Project-to-Host Mapping
Associative arrays define which projects sync to which hosts, enabling selective deployment without manual configuration per sync.
Management
| Command | Effect |
|---|---|
pause_all.sh |
Pause all sync daemons (writes state file) |
stop_all_syncs.sh |
Kill all running sync processes |
toggle_git_sync_only.sh |
Toggle git-only mode (propagates to all hosts) |