Cluster Synchronization
Relevant source files
The following files were used as context for generating this wiki page:
Cluster Synchronization provides secure, cross-device end-to-end synchronization of the Agent workspace. It bridges coordinates between multiple instances to ensure data consistency across primary and secondary nodes.
The system synchronizes prompt profiles, chat history sessions, Model Context Protocol (MCP) broker configurations, and developer API keys. It treats the local instance as a node within a larger cluster topology.
Sources: src/components/SyncCluster.tsx:43-46, src/components/SyncCluster.tsx:112-118
Security Architecture
The synchronization model employs a symmetric encryption strategy. The client compiles and hashes all data before transmission to cloud nodes. Plain-text data never leaves the local environment.
Sources: src/components/SyncCluster.tsx:49-53
Encryption Standards
The system uses the following cryptographic primitives:
- PBKDF2: Used for 256-bit passphrase hashing.
- AES-256-GCM: Used for encrypting state payloads directly on the client.
- Symmetric Keys: Generated as hex strings with the prefix
AGENT-PBKDF2-.
Sources: src/components/SyncCluster.tsx:52-53, src/components/SyncCluster.tsx:18-22, src/utils/ai.ts:160-164
Key Generation Process
You generate a "Security Coordinate" key to bridge instances. The system produces a random four-part hexadecimal string to form the cluster code.
const handleGenerateKey = () => {
const randomHex = Array.from({ length: 4 }, () =>
Math.floor(Math.random() * 0xfffffff).toString(16).toUpperCase()
).join('-');
const newCode = `AGENT-PBKDF2-${randomHex}`;
setSyncCode(newCode);
setPassphrase('SymmetricPBKDF2HashVerified');
onUpdatePassphrase(newCode);
onTriggerSync();
};
Sources: src/components/SyncCluster.tsx:18-28
Data Flow and Synchronization
The sync workflow follows a Pull/Push model. When you trigger a sync, the system compiles the current datastore state, encrypts it, and pushes it to secure cloud registers.
Synchronization Logic
The following diagram illustrates the flow of data from the local client to the sync cluster.
The diagram shows the transition from raw workspace data through encryption to cloud storage and eventual restoration on a secondary instance.
Sources: src/components/SyncCluster.tsx:49-53, src/utils/ai.ts:160-167
Synced Datastores
The system synchronizes four primary categories of data:
| Datastore | Description |
|---|---|
| Prompt Profiles | Custom presets and behavior overlays. |
| Chat History | Compiled conversation caches and session states. |
| MCP Broker Configs | Indexed ports and addresses for system tools. |
| Secret Key Maps | Developer API keys and sensitive maps. |
Sources: src/components/SyncCluster.tsx:112-118
Cluster Topology and Monitoring
The system maintains a visual representation of active nodes. It tracks the status of the "Primary Desktop" (usually the active node) and "Secondary Laptop" (synced instances).
Sources: src/components/SyncCluster.tsx:94-110
Monitoring Components
- Sync Console Log: Provides real-time feedback on push/pull operations and success states.
- Title Bar Indicator: Displays a
Syncing cluster...message and spinner during active operations. - Resource Monitor: While not directly sync-related, it appears in the same navigation context to show system health.
Sources: src/components/SyncCluster.tsx:123-130, src/components/TitleBar.tsx:64-69, src/components/Sidebar.tsx:188-210
Interaction Sequence
This sequence diagram describes the interaction between the User Interface and the Sync Cluster components.
This diagram depicts the manual sync trigger process resulting in an encrypted push to cloud storage.
Sources: src/components/SyncCluster.tsx:78-89, src/components/SyncCluster.tsx:125-130
Implementation Details
The SyncProfile data structure tracks the current state of synchronization, including the passphrase, sync code, and operation logs.
Sources: src/components/SyncCluster.tsx:6-12
Component Integration
The sync feature is integrated into the primary navigation Sidebar under the "Sync Cluster" (Shield icon) panel.
Sources: src/components/Sidebar.tsx:48, src/components/Sidebar.tsx:64
Background Persistence
The Agent application maintains sync subscriptions as a background process. If you close the main window, the core process minimizes to the system tray to ensure local filesystem MCP mappings and remote sync subscriptions remain active.
Sources: src/components/TitleBar.tsx:88-97
Cluster Synchronization ensures that elite AI terminal assistants maintain a consistent "Sleek System Operator" persona and workspace configuration across the entirety of a developer's hardware cluster.
Sources: src/data.ts:40-45, src/components/SyncCluster.tsx:58-61