An OpenClaw skill that syncs your workspace across multiple machines using git branches and GitHub PRs.
Your OpenClaw workspace holds memory files, notes, and configuration that accumulate over time. If you run OpenClaw on more than one machine, those workspaces diverge. This skill gives your agent a workflow to merge them back together — with intelligent deduplication for memory files and human confirmation for real conflicts.
Each machine gets its own git branch (e.g., macbook, server). During normal use, the agent commits workspace changes to its machine's branch. When you want to sync, the agent creates a PR for each branch into main, merges them, and resets all branches to the merged state. Next time any machine starts a session, it pulls main and has the combined workspace.
macbook ──commits──► origin/macbook ──PR──► main ◄──PR── origin/server ◄──commits── server
│
all branches reset
│
┌───────┴───────┐
macbook server
(in sync) (in sync)
- git with SSH access to GitHub
- GitHub CLI (
gh) — authenticated viagh auth login - A private GitHub repo to store your workspace
Clone the skill into your workspace:
cd ~/.openclaw/workspace/skills
git clone https://github.com/matthiasroder/claw-sync.gitDo this once on each machine.
cd ~/.openclaw/workspace
git init
git remote add origin git@github.com:YOUR_USERNAME/YOUR_REPO.gitFrom whichever machine you set up first:
git add -A
git commit -m "Initial commit"
git branch -M main
git push -u origin mainOn each machine, set a unique name:
cd ~/.openclaw/workspace
git config openclaw.branch "macbook" # on your laptop
git config openclaw.branch "server" # on your serverbranch=$(git config openclaw.branch)
git checkout -b "$branch"
git push -u origin "$branch"
git checkout mainThis hook pulls the latest main before each session starts, so the agent always begins with the most recent synced state. Copy it from this repo into your OpenClaw hooks directory:
cp -r ~/.openclaw/workspace/skills/claw-sync/hooks/workspace-pull ~/.openclaw/hooks/Add a Workspace Sync section to your AGENTS.md (or equivalent agent instructions file). This tells the agent how to commit changes to its machine's branch during normal use, and where to find the sync skill when you ask for it.
## Workspace Sync
This workspace is synced between installations via GitHub. Each installation
has its own branch. `main` is the merged canonical state.
- **Session start:** Automated via `workspace-pull` hook (fetches + checks out `main`)
- **After modifying workspace files:** Commit and push to your branch:
```bash
branch=$(git config openclaw.branch)
git checkout "$branch" && git add -A && git commit -m "Update $(date +%Y-%m-%d)" && git push origin "$branch" && git checkout main
- **To sync installations:** User says "sync workspaces" → see `skills/claw-sync/SKILL.md`Without this, the agent won't know to commit workspace changes to the machine branch, and the sync skill won't have anything to merge.
You have OpenClaw on two machines: macbook and server. Both have been used independently for a few days.
During normal sessions, the agent commits workspace changes to the machine's branch. This happens automatically (configured in your AGENTS.md), or you can do it manually:
# On macbook
cd ~/.openclaw/workspace
branch=$(git config openclaw.branch) # "macbook"
git checkout "$branch"
git add -A
git commit -m "Update 2026-02-13"
git push origin "$branch"
git checkout main# On server
cd ~/.openclaw/workspace
branch=$(git config openclaw.branch) # "server"
git checkout "$branch"
git add -A
git commit -m "Update 2026-02-13"
git push origin "$branch"
git checkout mainAt this point, origin/macbook and origin/server each have changes that main doesn't.
On either machine, tell your agent:
"sync workspaces"
The agent (following SKILL.md) does the following:
- Commits and pushes any uncommitted changes on the current machine's branch
- Fetches all branches from origin
- Checks which branches are ahead of main:
git log --oneline main..origin/macbook → 2 commits git log --oneline main..origin/server → 3 commits - Creates a PR for each branch that has changes:
gh pr create --base main --head macbook --title "Sync macbook → main (2026-02-13)" gh pr create --base main --head server --title "Sync server → main (2026-02-13)" - Merges each PR, resolving conflicts using the deduplication rules below. If a conflict is ambiguous, the agent asks you.
- Resets all branches to main:
git checkout main && git pull origin main git push origin main:macbook main:server
Next time either machine starts a session, the workspace-pull hook pulls main — which now contains the merged changes from both machines.
When the agent encounters conflicts in workspace files during merge, it follows these rules:
| Situation | Resolution |
|---|---|
| Same event described twice | Keep the more detailed version |
| Same fact in MEMORY.md | Keep one copy, prefer more recent/accurate |
| Different events on same date | Combine under labeled sections (## macbook / ## server) |
| Conflicting information | Ask the user |
| Environment-specific content | Keep both, clearly labeled per machine |
| Uncertain about anything | Ask the user |
MIT