Memory

workbuddy-multi-device-sync

Try it

Set up automatic configuration sync across multiple Macs using WorkBuddy. Use when the user wants to use WorkBuddy on two or more computers and keep identity, memory, skills, and settings synchronized. Triggers: 多台电脑同步, 双机同步, 两台 Mac 同步 WorkBuddy, sync WorkBuddy across devices, multi-device sync, 换电脑配置同步. Covers Git-based sync via GitHub, auto-sync daemon, and one-click setup for additional machines.

What it does

Set up automatic configuration sync across multiple Macs using WorkBuddy. Use when the user wants to use WorkBuddy on two or more computers and keep identity, memory, skills, and settings synchronized. Triggers: 多台电脑同步, 双机同步, 两台 Mac 同步 WorkBuddy, sync WorkBuddy across devices, multi-device sync, 换电脑配置同步. Covers Git-based sync via GitHub, auto-sync daemon, and one-click setup for additional machines.

The skill document

WorkBuddy Multi-Device Sync

Overview

Enable automatic synchronization of WorkBuddy configuration across multiple Macs using a private GitHub repository. After setup, all machines share the same identity (SOUL.md, IDENTITY.md, USER.md), memory (MEMORY.md), skills, and settings — with zero manual commands. A background daemon syncs every 5 minutes.

What Syncs vs What Doesn't

Syncs (via Git)

  • Identity files: SOUL.md, IDENTITY.md, USER.md
  • Memory: MEMORY.md (user-level, NOT memory/ daily logs)
  • Skills: skills/ directory
  • Config: mcp.json, settings.json
  • Setup scripts: auto-sync.sh, start-sync-daemon.sh, wb-setup-mac-b.sh

Does NOT Sync (machine-specific)

  • binaries/ — 300MB+ platform-specific runtimes, each machine installs its own
  • workbuddy.db — SQLite database (automations, runtime state), concurrent sync corrupts it
  • .mcp.json — localhost port numbers differ per machine
  • sessions/, logs/, traces/ — runtime data, machine-specific
  • credentials/ — each machine logs in independently
  • memory/ — daily work logs, project-specific
  • connectors/, plugins/ — marketplace state, machine-specific

Already Synced (server-side, no action needed)

  • Conversation history
  • Cloud user profile (auto-injected at session start)

Workflow

Phase 1: Set Up Mac A (Primary Machine)

Step 1: Initialize Git in ~/.workbuddy/

# Set git config if not already set
git config --global user.name "$(whoami)"
git config --global user.email "$(whoami)@workbuddy.local"
git config --global init.defaultBranch main

# Initialize repo
cd ~/.workbuddy
git init

Step 2: Create .gitignore

Copy the template from references/gitignore-template to ~/.workbuddy/.gitignore. This excludes all machine-specific files. Review and adjust as needed.

Key exclusions:

  • binaries/ — runtimes
  • workbuddy.db / workbuddy.db-* — SQLite
  • .mcp.json — localhost ports
  • sessions/, logs/, traces/ — runtime data
  • credentials/ — auth tokens
  • memory/ — daily logs
  • .auto-sync.log, .sync-daemon.pid — daemon state

Step 3: Create GitHub Private Repo

Two approaches:

Approach A: GitHub Device Flow (recommended, no SSH needed)

  1. Initiate device flow to get a verification code:
curl -s -X POST "https://github.com/login/device/code" \
  -H "Accept: application/json" \
  -d "client_id=178c6fc778ccc68e1d6a&scope=repo,admin:public_key"

Response contains device_code, user_code, and verification_uri.

  1. Tell the user to open verification_uri and enter user_code.

  2. Poll for authorization:

curl -s -X POST "https://github.com/login/oauth/access_token" \
  -H "Accept: application/json" \
  -d "client_id=178c6fc778ccc68e1d6a&device_code=&grant_type=urn:ietf:params:oauth:grant-type:device_code"

Repeat every 5 seconds until access_token appears in response.

  1. Store credentials:
echo "https://:@github.com" > ~/.git-credentials
chmod 600 ~/.git-credentials
git config --global credential.helper store
  1. Create private repo via API:
curl -s -X POST -H "Authorization: token " \
  -H "Accept: application/vnd.github+json" \
  "https://api.github.com/user/repos" \
  -d '{"name":"wb-sync","private":true,"description":"WorkBuddy config sync"}'

Approach B: Manual setup

  1. User creates a private repo at https://github.com/new (name: wb-sync, private, no README)
  2. User creates a Personal Access Token at https://github.com/settings/tokens/new (scope: repo)
  3. Store credentials as shown above

Step 4: Push to GitHub

cd ~/.workbuddy
git remote add origin https://github.com//wb-sync.git
git add -A
git commit -m "init: WorkBuddy config from $(hostname)"
git push -u origin main

Step 5: Install Auto-Sync

  1. Copy scripts/auto-sync.sh to ~/.workbuddy/auto-sync.sh
  2. Copy scripts/start-sync-daemon.sh to ~/.workbuddy/start-sync-daemon.sh
  3. Make both executable: chmod +x ~/.workbuddy/auto-sync.sh ~/.workbuddy/start-sync-daemon.sh
  4. Start the daemon:
# Must use dangerouslyDisableSandbox or osascript to escape sandbox
osascript -e 'do shell script "/bin/bash ~/.workbuddy/start-sync-daemon.sh"'

Step 6: Add Terminal Hook

Append to ~/.bash_profile (or ~/.zshrc):

# WorkBuddy 双机同步快捷命令
alias wbsync='cd ~/.workbuddy && git add -A && git commit -m "sync $(date +%m%d-%H%M)" && git push origin main'
alias wbpull='cd ~/.workbuddy && git pull origin main'

# WorkBuddy 自动同步 — 守护进程保活 + 终端打开时即时同步
if [ -f ~/.workbuddy/start-sync-daemon.sh ]; then
  bash ~/.workbuddy/start-sync-daemon.sh 2>/dev/null
fi
if [ -t 1 ] && [ -f ~/.workbuddy/auto-sync.sh ]; then
  _wb_now=$(date +%s)
  _wb_last=$(cat ~/.workbuddy/.last-auto-sync 2>/dev/null || echo 0)
  if [ $((_wb_now - _wb_last)) -gt 300 ]; then
    bash ~/.workbuddy/auto-sync.sh >/dev/null 2>&1 &
    echo $_wb_now > ~/.workbuddy/.last-auto-sync
  fi
  unset _wb_now _wb_last
fi

Step 7: Commit and Push Everything

cd ~/.workbuddy
git add -A
git commit -m "add: auto-sync scripts + terminal hook"
git push origin main

Phase 2: Set Up Mac B (Additional Machines)

Prerequisites

  • WorkBuddy installed and launched once (to create ~/.workbuddy/ directory), then quit
  • Terminal access
  • GitHub reachable (directly or via proxy)

One-Liner Setup

Generate a Mac B setup script using scripts/setup-mac-b.sh.template:

  1. Replace , , `` with actual values
  2. Upload the script to the GitHub repo (commit + push from Mac A)
  3. On Mac B, run one command:
curl -sSL -H "Authorization: token " \
  "https://raw.githubusercontent.com//wb-sync/main/wb-setup-mac-b.sh" | bash

The script automatically:

  • Backs up existing Mac B config (if any)
  • Stores GitHub credentials
  • Clones the repo into ~/.workbuddy/
  • Sets up aliases and terminal hook
  • Starts the sync daemon

Alternative: AirDrop

If both Macs are nearby:

  1. AirDrop wb-setup-mac-b.sh from Mac A to Mac B
  2. On Mac B: bash ~/Downloads/wb-setup-mac-b.sh

Phase 3: Verification

# Check daemon is running
cat ~/.workbuddy/.sync-daemon.pid  # should show a PID
kill -0 $(cat ~/.workbuddy/.sync-daemon.pid) && echo "ALIVE" || echo "DEAD"

# Check sync log
tail -5 ~/.workbuddy/.auto-sync.log

# Check git status
cd ~/.workbuddy && git log --oneline -3 && git remote -v

Important Notes

  • GitHub SSH port 22 may be blocked in China. Use HTTPS + token instead.
  • LaunchAgent (launchctl load) often fails with "Input/output error" on macOS 12+ under sandbox. The Python subprocess daemon approach in start-sync-daemon.sh is more reliable.
  • Automations (scheduled tasks) are stored in workbuddy.db and do NOT sync. Recreate them on each machine using the automation_update tool.
  • Project workspace memory (/.workbuddy/memory/) is NOT inside ~/.workbuddy/ and must be synced separately (via the project's own Git repo or cloud storage).
  • Token security: The GitHub token is stored in ~/.git-credentials (chmod 600). For shared machines, consider using a token with limited scope and expiration.
  • Daemon recovery: After a machine reboot, the daemon restarts automatically when the user opens a terminal (via the .bash_profile hook) or when WorkBuddy runs any bash command.

Resources

scripts/

  • auto-sync.sh — Sync script called by the daemon every 5 minutes (pull → commit → push)
  • start-sync-daemon.sh — Daemon launcher with PID dedup and Python auto-detection
  • setup-mac-b.sh.template — Mac B one-click setup script template (replace placeholders before use)

references/

  • gitignore-template — The .gitignore file to place in ~/.workbuddy/
  • sync-architecture.md — Detailed architecture explanation and troubleshooting

Related skills

Set up WorkBuddy config sync across 3+ Macs with machine naming, conflict resolution, and status tracking. Supports GitHub or iCloud as backend. Triggers: 多机同步, 三台电脑同步, 多台 Mac 同步 WorkBuddy, multi-machine sync, 3+ devices sync, 多台电脑配置同步, team sync WorkBuddy. Includes machine registry, per-machine commit tagging, stale lock detection, and a status command to see which machines are active.

Set up automatic WorkBuddy config sync across multiple Macs using iCloud Drive. No GitHub account, no token, no SSH key needed — just log into the same iCloud account on all machines. Triggers: iCloud 同步, iCloud 版同步, 不用 GitHub 同步, 苹果云同步 WorkBuddy, iCloud sync WorkBuddy, sync without GitHub. Uses a bare git repo inside iCloud Drive with a background daemon syncing every 5 minutes.

当用户要换电脑、切换设备或在另一台机器继续开发时,帮助把当前 WorkBuddy 项目和工作现场(未提交改动、Git、项目内配置、Agent 规则/Skill 与交接上下文)安全打包成加密工作包,或恢复已有 .wbpack 并接着上次工作。适用于“跨设备项目迁移/接力”“工作现场打包/恢复”“把项目和 Agent 上下文一起带走”等请求;不把单纯云同步、实时多人协作、普通 Git 同步或部署作为主要场景。

【仅限 WorkBuddy 桌面版使用】会话回调(Session Callback)——实现"一个会话调起另一个会话"的能力:外部进程、定时任务(cron job)或另一个 agent 会话,向目标会话注入消息,唤醒其 agent 带完整上下文继续处理。适用于 WorkBuddy 桌面版:监控回传后唤醒主会话推进任务、定时任务回调指定会话、异步任务完成后通知会话、多会话协作接力、替代 openclaw 的 sessions_send 机制。当用户在 WorkBuddy 中提到"会话回调"、"唤醒会话"、"session callback"、"会话调起另一个会话"、"cron 唤醒指定会话"、"向会话注入消息"、"主会话收到提醒后推进"、"sessions_send" 时使用本 skill。注意:本技能依赖 WorkBuddy 本地结构(~/.workbuddy/sessions/、projects/*.jsonl、/api/v1/acp/*),不适用于 openclaw 等其他平台。

2 installs

Audit all installed skills to identify duplicates, platform-mismatched skills, and maintenance candidates. Use when: (1) the user asks to "clean up skills",...

3 installs

PURE LOCAL file backup of this Mac's workspace: mirrors ~/playground, ~/experiment and ~/WorkBuddy into BOTH a fixed local folder and an external drive, incremental and verified, so an interrupted run resumes. Use-when: '备份一下工作区', 'back up my workspace to the external drive', 'what is not backed up yet / 备份状态', 'the drive is plugged in, catch up the backup', '$workspace-backup'. Do-NOT use for: Time Machine repair or restore; git push to a remote; iCloud or cloud sync; database dumps; deleting node_modules to free space (this skill never deletes from the source); or a single-file .bak.