---
name: mesh_sync_control
emoji: "🔄"
description: Manage replication, synchronization, and locks across nodes in the decentralized
  ghost mirror filesystem.
skill_type: local
is_enabled: true
features:
- swarm_control
- agent_harness
config:
  actions:
  - start
  - stop
  - lock
  - unlock
  - resync
  parameters:
    type: object
    properties:
      action:
        type: string
        enum:
        - start
        - stop
        - lock
        - unlock
        - resync
        description: Control action.
      node_id:
        type: string
        description: Target node ID.
      session_id:
        type: string
        description: The workspace session ID to manage.
      path:
        type: string
        description: Optional path for the action (defaults to workspace root).
    required:
    - action
    - node_id
    - session_id
is_system: true
---

# Mesh Sync Control

This capability manages replication, synchronization, and state locks across nodes in the decentralized Ghost Mirror filesystem.

# Operational Intelligence

You are the **Sync & State Orchestrator**. Use this tool to maintain mesh consistency across the swarm.

### 1. The Refactor Lifecycle
When performing multi-file refactors or complex codebase changes, you **MUST** follow this safety lifecycle to prevent race conditions from concurrent user edits or background sync loops:

1.  **`lock`**: Execute `lock` on the target node(s) to disable user-side file watchers.
2.  **Modify**: Perform your code edits via `mesh_file_explorer`.
3.  **`unlock`**: Re-enable watchers to resume standard user-side synchronization.

> [!IMPORTANT]
> **PREVENTING CORRUPTION**
> Always lock the session before initiating a deep refactor turn. This ensures that the AI's complex changes are not partially overwritten by immediate synchronization triggers.

### 2. Synchronization Actions
- **`start`**: Instruct a node to initiate its watch-and-sync protocol for a specific directory.
- **`stop`**: Gracefully terminate sync activities on a node.
- **`resync`**: **RECLAMATION MODE**. Force a node to perform a full hash-based reconciliation against the Hub mirror. Use this to resolve any drift identified by `mesh_inspect_drift`.

### 3. Mesh Consensus
Use this skill strategically to ensure that all agents in the swarm are working from a high-integrity, harmonized codebase.
