Synchronize configuration versions across OpenClaw multi-agent deployments.
Tracks changes in a master workspace using sentinel version files and CHANGELOG,
then dispatches to downstream agents via sessions_send or file-based pending_sync
fallback. Each agent independently checks for updates on startup (BOOTSTRAP.md)
and heartbeat (HEARTBEAT.md). Designed for users running 2+ specialized agents
who need consistent system/agent/OpenClaw configurations.
Triggers on: sync, configure, version management, multi-agent coordination.
Keep configuration consistent across multiple OpenClaw agents using version tracking, CHANGELOG-based change detection, and automatic sync dispatch with journal-backed two-phase commit.
⚡ Quick Start (30 seconds to running):
bash
# Step 1: Install
clawhub install agent-config-sync
# Step 2: Run setup wizard (interactive, no manual editing needed)
cd ~/.openclaw/skills/agent-config-sync
bash scripts/wizard.sh
# Step 3: Done! 🎉
# - Agent registry auto-detected
# - Sync infrastructure created
# - HEARTBEAT integration added
# - All agents ready to receive syncs
Non-interactive? Use bash scripts/wizard.sh --auto to auto-detect everything.
Prefer manual? See Installation below for step-by-step instructions.
New in v1.5: Interactive setup wizard (scripts/wizard.sh), --auto mode for init_sync.sh (zero-config auto-detection), enhanced SYNC.md with quick start guide and cheat sheet, simplified onboarding.
New in v1.4: Full version conflict management — dispatch lock, loop detection, self-upgrade isolation, batch mode, rollback snapshots, TTL-based expiry, offline catch-up, and agent-side version collapse. See Version Conflict Management for details.
Security: This skill writes to agent workspaces across your OpenClaw deployment. Read the full SECURITY.md for permission scope, path validation, cross-agent isolation, and user consent flow. Key highlights:
All scripts require --confirm for write operations (use --dry-run to preview first)
Only paths under ~/.openclaw/workspace-* are allowed (path validation enforced)
Each agent can only read/write its own workspace files
No network access, no external API calls, no credential access
⚙️ Customization Variables
Option A (Recommended): Run the setup wizard
bash
cd ~/.openclaw/skills/agent-config-sync
bash scripts/wizard.sh
The wizard auto-detects your agents and generates agent-registry.json — no manual editing.
Option B: Manual configuration
Edit references/agent-registry.json — this is the only file you need to change for your deployment:
Variable
Location
Example
Description
workspace_root
vars in registry
~/.openclaw
Base path for all agent workspaces
master_agent
vars in registry
amaster
ID of your coordination/master agent
master_memory
vars in registry
${workspace_root}/workspace-amaster/memory
Path to master's memory directory
(each agent)
agents in registry
See below
Add/remove/rename agents to match your setup
Example — after customization for user "Alice" with agents alice-dev, alice-biz, alice-ops:
Change vars.master_agent to your coordination agent's ID
Replace the agents entries with your own agents
Adjust vars.workspace_root if your OpenClaw workspace is not ~/.openclaw
See the Customization Variables table above, or the English quickstart at references/quickstart.md.
Step 3: Initialize Sync Infrastructure
bash
cd ~/.openclaw/skills/agent-config-sync
# Preview what will be created (safe, no changes required)
bash scripts/init_sync.sh --dry-run
# Run the real setup (--confirm required for write operations)
bash scripts/init_sync.sh --confirm
⚠️ Safety: --confirm is required for any write operation. Without it, the script exits with a prompt explaining how to preview with --dry-run first. --dry-run mode does not need --confirm.
This creates:
Version sentinel files (.current_system_version, .last_sync_version) in master's memory/
CHANGELOG.md with structured format
.sync_journal.jsonl for sync atomicity
SYNC.md, bootstrapped BOOTSTRAP.md, and HEARTBEAT.md sync checks in each agent workspace
Step 4: Add HEARTBEAT Item to Master Agent
Copy the HEARTBEAT item from references/sync-setup.md into your master agent's HEARTBEAT.md. This is item 12 — the heartbeat check that detects version mismatches and dispatches syncs.
Step 5: Verify Setup
bash
# Check version files
cat ~/.openclaw/workspace-<master>/memory/.current_system_version # should be v1.0
# Check agent sync files
ls ~/.openclaw/workspace-*/SYNC.md
Version Conflict Management (v1.4)
Conflict Types
Type
Scenario
Frequency
Impact
Concurrent Change
Two agents submit version changes simultaneously
High
Medium
Cross-Session Stale
Agent restarts and finds outdated pending_sync files
Medium
Low
Offline Catch-Up
Agent misses one or more sync cycles
Medium
High
Self-Reference (Self-Upgrade)
agent-config-sync's own files need updating
Low
High
Multi-Agent Coordination
Change requires specific ordering across agents
Medium
Medium
Rollback
Need to revert a problematic version change
Low
High
Conflict Detection Mechanisms
Mechanism
Location
What It Detects
Version Sentinel Comparison
Master HEARTBEAT item 12
.current_system_version ≠ .last_sync_version
Dispatch Lock
Master HEARTBEAT item 12
Concurrent dispatch prevention (< 2min window)
Loop Detection
Master HEARTBEAT item 12
3+ consecutive same-version journal records
TTL Expiry Check
Agent BOOTSTRAP/HEARTBEAT
now > 过期时间 → delete stale pending_sync
Version Folding
Agent side
Multiple pending_sync_*.md files → fold by version
.agent_sync_version Gap
Agent side
Local version < current system version → offline gap
Self-Protect Blacklist
Master dispatch
CHANGELOG impact range includes sync's own files
Snapshot Verification
Agent rollback
SHA256 checksums on restored files
Agent-Side Pending Sync Priority Matrix
When an agent discovers multiple pending_sync_*.md files, it processes them in this order:
text
Priority Type Handle
───────── ──────────────── ──────────────────────────────
1 (first) Expired files Delete immediately (now > 过期时间)
2 Superseded files Delete (lower version number, depends_on chain covered)
3 Isolated syncs Must process before normal syncs (self-upgrade isolation)
4 Revert syncs Revert to target version from snapshot
5 (last) Normal syncs Apply in version order, respecting depends_on chain
Version Collapse Rule: If multiple pending_sync_v3.1, pending_sync_v3.2, pending_sync_v3.3 exist AND v3.3's **前置** chain covers all intermediate versions → apply only v3.3 and delete v3.1/v3.2.
When an agent discovers multiple pending_sync_*.md files (e.g., after being offline or during a period of rapid changes), it uses version collapse to avoid processing every intermediate version. The goal is to safely "jump" from the agent's current version to the latest applicable version in a single step.
Decision Flow
text
Agent discovers N pending_sync_*.md files (N ≥ 1):
1. PARSE all file headers:
- Extract: 版本, 前置, 生成时间, 过期时间, 类型
2. CLEANUP expired:
FOR EACH file:
IF now > 过期时间:
DELETE file
LOG "Stale sync expired: <filename>"
3. DETECT superseded:
SORT remaining files by 版本 DESC
FOR EACH file from latest to earliest:
Walk depends_on chain from latest version
IF current version is in chain → all older files are superseded
DELETE all files whose version < latest_version AND covered by chain
4. CLASSIFY remaining files:
GROUP by 类型:
- isolated_sync → process BEFORE normal syncs
- revert_sync → restore from snapshot
- pending_sync → normal version upgrade
5. ORDER execution:
isolated_sync files (ascending version)
↓
revert_sync files (ascending target version)
↓
normal pending_sync files (ascending version, respecting depends_on chain)
6. EXECUTE each file:
a. CHECK depends_on: IF 前置 > .agent_sync_version → ERROR (chain broken, request Master)
b. CREATE snapshot: mkdir .sync_snapshots/<VERSION>_pre/ + backup affected files
c. APPLY changes from CHANGELOG
d. UPDATE .agent_sync_version = 版本
e. DELETE processed file
7. VERIFY:
Check .agent_sync_version matches latest processed version
Confirm no remaining pending_sync files (or that remaining files have valid depends_on > current)
Revert takes priority; if revert target > current, normal syncs after
Corrupt file (unparseable header)
Skip, log error, request Master re-dispatch
Same version, 2 files (duplicate)
Keep newest by 生成时间, delete older
Self-Upgrade Isolation (v1.4)
Problem
agent-config-sync's own files (SKILL.md, scripts/, SECURITY.md, etc.) may need updating. But if the sync system dispatches changes to itself through normal channels, it can trigger self-referential sync loops.
Solution: Isolated Sync Flow
When a CHANGELOG entry's impact range includes paths in the self_protect.blacklist:
Detection: Master HEARTBEAT item 12 checks if the change affects agent-config-sync itself
Isolation: Generates isolated_sync_<VERSION>_<SHA>.md in Master's memory/ directory
Notification: Appends a notice to each agent's BOOTSTRAP.md (not dispatched via normal flow)
Agent Action: On next startup, agent detects the BOOTSTRAP notice and requests the isolated sync
No sentinel file: Does not use pending_sync file mechanism — avoids normal dispatch loop
Paths listed in blacklist are quarantined from normal dispatch. Any CHANGELOG entry affecting these paths triggers the isolated sync flow instead.
Batch Mode (v1.4)
Overview
When multiple rapid changes occur within a time window, batch mode merges them into a single cumulative dispatch instead of triggering one sync per version.
Configuration
json
"batch": {
"mode": "auto",
"window_sec": 300
}
Behavior
HEARTBEAT detects version mismatch
Instead of immediate dispatch, opens a batch window (default: 5 min)
All version bumps within the window are accumulated
When window closes → merge all changes into one pending_sync file
Uses highest version number among batched changes
Combines all CHANGELOG sections
Merge Rules
Sort all batched versions → use the highest version
Concatenate CHANGELOG entries in version order
Generate single SHA256 signature over combined content
Single dispatch covers all intermediate changes
Rollback Mechanism (v1.4)
Overview
When a version change causes problems, the system supports controlled rollback to a previous version using pre-sync snapshots.
Rollback Flow
text
1. TRIGGER (Master):
- Set .current_system_version to the rollback target version
- HEARTBEAT detects: current < last_sync → recognizes as rollback
- Creates revert_sync_<FROM>_to_<TO>_<SHA>.md in each agent workspace
2. APPLY (Agent):
- Detects revert_sync file on HEARTBEAT/BOOTSTRAP check
- Restores files from memory/.sync_snapshots/<TARGET>_pre/
- Verifies SHA256 checksums from snapshot_manifest.json
- Updates .agent_sync_version to target version
- Deletes revert_sync file
3. VERIFY (All):
- .current_system_version == .last_sync_version (stable state)
- No pending_sync or revert_sync files remain
All version entries must follow the structured format defined in references/sync-setup.md:
markdown
## vX.Y (YYYY-MM-DD)
**Change Type**: <category>
**Affected Agents**: <which agents>
**Author**: <who made the change>
**Priority**: normal | high | critical
### Added / Changed / Deprecated
- <description>
Language
Scripts support --lang en and --lang zh (default). Use --lang en for English output:
bash
bash scripts/init_sync.sh --lang en
bash scripts/force_sync.sh --lang en ~/memory v1.0 v1.1
Usage Scenarios
Scenario A: Adding a new model to all agents
Situation: You want all agents to switch to a new default model.
Update CHANGELOG.md in master's memory directory:
markdown
## v3.2 (2026-05-16)
**Change Type**: ⚙️ OpenClaw Config
**Affected Agents**: all
**Author**: AMaster
**Priority**: high
### Changed
- Default model switched to deepseek-v4-pro for all agents
- Fallback model set to deepseek-v3
Bump the version:
bash
echo "v3.2" > memory/.current_system_version
Next HEARTBEAT (every 5 min): version mismatch detected → dispatches to all agents. Agents update their model configs accordingly.
Agents delete their pending_sync_v3.2_<sha>.md after applying.
Scenario B: Coordinated code deployment
Situation: You fix a bug in shared code used by multiple agents.
Fix the bug, tell the master agent to record the change.
Master updates CHANGELOG.md with the version entry, bumps .current_system_version.
HEARTBEAT dispatches. Online agents receive via sessions_send; offline agents get pending_sync files.
All agents verify version before running the shared system.
Daily Operations
Recording a Change
Whenever a config or system change affects multiple agents:
Edit CHANGELOG.md in master's memory/ directory — add a new ## vX.Y section
Bump the version — echo "vX.Y" > memory/.current_system_version
The change is dispatched automatically on the next master heartbeat
Force-Syncing Immediately
bash
cd ~/.openclaw/skills/agent-config-sync
# Preview the version change
bash scripts/force_sync.sh --dry-run ~/.openclaw/workspace-<master>/memory v3.0 v3.1
# Execute (--confirm required for write operations)
bash scripts/force_sync.sh --confirm ~/.openclaw/workspace-<master>/memory v3.0 v3.1
After running, the next heartbeat detects current (v3.1) != last_sync (v3.0) and dispatches.
Checking Sync Status
bash
# Check version sentinel files
cat ~/.openclaw/workspace-<master>/memory/.current_system_version
cat ~/.openclaw/workspace-<master>/memory/.last_sync_version
# Check journal for recent sync records
tail -5 ~/.openclaw/workspace-<master>/memory/.sync_journal.jsonl
# Check for pending syncs on an agent
ls ~/.openclaw/workspace-<agent>/pending_sync_*.md
Demo Mode (Learning)
bash
cd ~/.openclaw/skills/agent-config-sync
bash scripts/init_sync.sh --demo --lang en
Creates a complete demo deployment in /tmp/ showing the full file structure without touching real workspaces.
⚠️ force_sync.sh only creates the version mismatch — actual rollback requires reverting the changes in CHANGELOG and agent configs manually.
🌐 Internationalization
This skill supports both Chinese and English environments:
Resource
Chinese
English
SKILL.md (this file)
—
✅ Full English
references/quickstart.md
—
✅ English quickstart for new users
references/sync-setup.md
✅ Full Chinese
— (code pseudocode is language-agnostic)
references/sync-journal.md
✅ Full Chinese
— (JSONL format is language-agnostic)
scripts/init_sync.sh
--lang zh (default)
--lang en
scripts/force_sync.sh
--lang zh (default)
--lang en
Registry agent names
name_zh field
name field
Generated SYNC.md
Chinese template
English template (via --lang en)
Generated CHANGELOG.md
Chinese template
English template (via --lang en)
Using English:
bash
# Install and initialize in English
bash scripts/init_sync.sh --lang en
# Demo in English
bash scripts/init_sync.sh --lang en --demo
New English-speaking users should start with references/quickstart.md.
Upgrading
From v1.0 to v1.1
agent-registry.json introduced (previously agent list was hardcoded)
pending_sync files now use version-named format (pending_sync_v3.1_a1b2c3.md) instead of single pending_sync.md
Journal-based two-phase commit added
No breaking changes — existing sentinel files and CHANGELOG format unchanged
From v1.1 to v1.2
Registry is now single source of truth: scripts read agent list from agent-registry.json instead of command-line args
Bilingual scripts: --lang en|zh flag on both init_sync.sh and force_sync.sh
New flags: --dry-run (preview), --demo (learning mode), --help
English quickstart: references/quickstart.md added
agent-registry.json format changed: added vars section with placeholders
Migration steps (v1.1 → v1.2)
Update agent-registry.json:
json
// Add this at the top of your existing agent-registry.json:
"vars": {
"workspace_root": "~/.openclaw",
"master_agent": "amaster",
"master_memory": "${vars.workspace_root}/workspace-${vars.master_agent}/memory"
},
// Update workspace paths to use placeholders:
"agents": {
"acode": {
"workspace": "${vars.workspace_root}/workspace-acode" // <-- use placeholder
}
}
Verify with dry-run: bash scripts/init_sync.sh --dry-run