{"id":"cloud-sync","name":"cloud-sync","summary":"cmem.ai ProでClaude-Memのクラウド同期を設定したり確認したりしてください。ユーザーが「クラウド同期の設定」「メモリーを同期する」「CMEM Pro」「クラウドバックアップ」「同期状況」を指定した場合、またはメモリデータベースのバックアップや cmem.ai アカウントへの同期を希望する場合に使って…","body":"# Cloud Sync (cmem.ai Pro)\n\nThe installed worker syncs through SyncHub. There is one client, one durable\noperation log, and no separate sync daemon. This skill checks status or writes\nthe three connection values issued by **cmem.ai → Connect**.\n\n**Security rule:** never print the sync token, put it in argv, or log it.\nConfirm only its length. Preserve every unrelated setting and keep\n`~/.claude-mem/settings.json` mode `0600`.\n\n## 1. Check status\n\nResolve the worker port and query the always-registered status route:\n\n```bash\nPORT=\"${CLAUDE_MEM_WORKER_PORT:-$(node -e \"const fs=require('fs'),p=require('path'),os=require('os');const uid=(typeof process.getuid==='function'?process.getuid():77);const fallback=String(37700+(uid%100));try{const s=JSON.parse(fs.readFileSync(p.join(os.homedir(),'.claude-mem','settings.json'),'utf-8'));process.stdout.write(String(s.CLAUDE_MEM_WORKER_PORT||fallback));}catch{process.stdout.write(fallback);}\" 2>/dev/null)}\"\ncurl -s \"http://127.0.0.1:${PORT}/api/sync/status\"\n```\n\n- `configured: true` and `hub.reachable: true` → the worker completed an\n  authenticated `GET /v1/sync/status` against SyncHub. Report `deviceId`,\n  pending counts, `lastFlushAt`, `lastError`, and the Hub head/checkpoint;\n  stop unless the user asked to replace the connection.\n- `configured: true` and `hub.reachable: false` → report `hub.error` and say\n  the SyncHub connection is not verified. A zero pending count or\n  `lastError: null` is not success because an empty queue performs no push.\n- `configured: false` → continue.\n- Connection refused, 404, or 503 immediately after restart → retry every\n  three seconds for about 30 seconds before diagnosing the worker.\n\n## 2. Obtain the connection\n\nAsk for all three values shown by **cmem.ai → Connect**:\n\n1. sync token;\n2. user id;\n3. SyncHub URL.\n\nThe Hub URL must be an absolute `https://` URL. Do not substitute the cmem.ai\napplication API URL; the installed client talks only to SyncHub.\n\n## 3. Write installed-client settings\n\nSubstitute the collected values inside this quoted stdin script. Do not echo\nthem before or after running it:\n\n```bash\nnode - <<'EOF'\nconst fs = require('fs'), os = require('os'), path = require('path');\nconst token = 'PASTE_TOKEN_HERE';\nconst userId = 'PASTE_USER_ID_HERE';\nconst hubUrl = 'PASTE_HUB_URL_HERE';\nif (!token || !userId || !/^https:\\/\\/[^\\s]+$/.test(hubUrl)) {\n  console.error('token, user id, and an https SyncHub URL are required');\n  process.exit(1);\n}\nconst dir = path.join(os.homedir(), '.claude-mem');\nconst file = path.join(dir, 'settings.json');\nfs.mkdirSync(dir, { recursive: true });\nconst settings = fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, 'utf8')) : {};\nconst target = settings.env && typeof settings.env === 'object' ? settings.env : settings;\ntarget.CLAUDE_MEM_CLOUD_SYNC_TOKEN = token;\ntarget.CLAUDE_MEM_CLOUD_SYNC_USER_ID = userId;\ntarget.CLAUDE_MEM_CLOUD_SYNC_HUB_URL = hubUrl.replace(/\\/+$/, '');\nfs.writeFileSync(file, JSON.stringify(settings, null, 2) + '\\n', { mode: 0o600 });\nfs.chmodSync(file, 0o600);\nconsole.log(`saved cloud connection: token length ${token.length}, user id length ${userId.length}`);\nEOF\n```\n\nThese are the only required connection keys. The worker mints and persists a\ndevice id on first start and defaults the device name to the hostname.\n\n## 4. Restart and verify\n\n```bash\ncurl -s -X POST \"http://127.0.0.1:${PORT}/api/admin/restart\"\n```\n\nPoll the status route every five seconds for up to 30 seconds while the\nsuccessor starts. Success means `configured: true`, `hub.reachable: true`, and\n`lastError: null`. The local route always makes an authenticated, read-only\nSyncHub status probe, even when every pending count is zero; it never uses a\nlegacy cmem.ai Pro status route and never appends or advances sync state.\nPending counts describe only writes made after the SyncHub launch baseline;\nsetup does not migrate a pre-launch local corpus.\n\nIf `hub.reachable` is false, report `hub.error`. If `lastError` is non-null,\nreport it too. Ask the user to verify the three values in **cmem.ai →\nConnect**. Never include the token.\n\n## 5. Report\n\nReport device id, pending counts, last successful flush, Hub reachability and\ncheckpoint, and any Hub/flush error. End with this privacy note:\n\n> Cloud sync uploads your observation narratives and full prompt text to your\n> cmem.ai account.","author":"@thedotmack","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/thedotmack/claude-mem/tree/main/plugin/skills/cloud-sync","license":"Apache-2.0","category":"writing","lang":"en","tokens":1127,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":["Bash","Read","AskUserQuestion"]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}