Real-time coordination framework for multiple Claude sessions working on the same project.
The Cross-Session Sync system enables multiple Claude sessions to:
- Share real-time state and progress updates
- Coordinate task division and prevent duplicate work
- Maintain consistency across parallel work streams
- Resolve conflicts automatically
- Track session health and activity
- Unique session identification
- Session lifecycle management
- Health monitoring and heartbeats
- Active session discovery
- File-based state persistence
- Atomic state updates
- Event-driven notifications
- Optimistic locking
- Distributed task queue
- Task claiming and locking
- Progress tracking
- Dependency management
- Version vectors for causality tracking
- Three-way merge for concurrent edits
- Automatic conflict detection
- Manual intervention protocols
# Initialize sync system in your project
./sync-init.sh
# Register a new session
./session-register.sh "session-name"
# Start sync monitoring
./sync-monitor.shcross-session-sync/
βββ README.md # This file
βββ sync-init.sh # Initialize sync system
βββ session-register.sh # Register new session
βββ sync-monitor.sh # Monitor sync status
βββ src/
β βββ session-manager.js # Session lifecycle management
β βββ state-sync.js # State synchronization engine
β βββ task-coordinator.js # Task distribution logic
β βββ conflict-resolver.js # Conflict resolution algorithms
β βββ file-watcher.js # File system monitoring
βββ config/
β βββ sync-config.json # Configuration settings
β βββ session-schema.json # Session data schema
βββ state/
βββ sessions/ # Active session records
βββ tasks/ # Task queue and status
βββ locks/ # Resource locks
βββ history/ # Change history log
- Registration: Session creates unique ID and registers presence
- Discovery: Session discovers other active sessions
- Synchronization: Session syncs with shared state
- Coordination: Session claims tasks and updates progress
- Heartbeat: Session maintains heartbeat for liveness
- Cleanup: Session performs cleanup on termination
Sessions communicate through:
- State files: JSON files in shared directories
- Lock files: Atomic file operations for mutual exclusion
- Event logs: Append-only logs for event streaming
- Heartbeat files: Timestamp files for liveness detection
- Always register sessions before starting work
- Use task claiming to prevent duplicate effort
- Update state frequently for real-time coordination
- Handle conflicts gracefully with automatic resolution
- Clean up resources on session termination
See individual component documentation: