kkdai

Agent Backup — Development skill for Claude Code

Development community

macOS app to back up coding-agent settings (MCP servers, sessions, memory, skills) to Google Drive with end-to-end encryption, and restore them on another Mac.

How to install Agent Backup

This entry records only its repository, not the path inside it, so there is no exact command to give. Open kkdai/agent-backup and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Agent Backup does

macOS app to back up coding-agent settings (MCP servers, sessions, memory, skills) to Google Drive with end-to-end encryption, and restore them on another Mac. Claude Code first; Codex, Gemini CLI, Copilot next. 備份 coding agent 的 MCP 設定與聊天記錄到 Google Drive,在新 Mac 上還原。

Alternatives in Development

  • Nexting — Remote control for Claude Code, Codex, Grok, and Cursor on Mac or PC 1.3k ★
  • Module 18 Drive.En — Module 18 Lesson 4-4 — Assist Google Drive (drive_ops / gog drive) via prompts 347 ★
  • Cc Pocket — Drive Claude Code or OpenAI Codex from your phone — resume sessions, stream output, approve tool permissions r 101 ★

README

agent-backup-macos

一個 macOS App:把 coding agent(Claude Code、Codex、Gemini CLI、Copilot…)的 MCP 設定與聊天記錄加密備份到 Google Drive,並在另一台 Mac 上還原。

![Agent Backup 總覽](docs/images/overview.png)

App

scripts/build-app.sh --open     # 打包並開啟 build/Agent Backup.app

連接 Google Drive(第一次)

scripts/setup-google-drive.sh

互動式步驟會帶你建立 Google Cloud OAuth client(Desktop app、`drive.file` scope)並登入。

CLI

swift build
B=.build/debug/agent-backup

$B detect                                  # 偵測 agent、session 數、MCP servers
$B backup --to gdrive                      # 備份到 My Drive/AgentBackup(第一次會設定 passphrase)
$B backup --to ~/BackupFolder              # 或備份到本機資料夾
$B snapshots --from gdrive                 # 列出快照

# 還原:預設只顯示計畫(dry run),加 --apply 才寫入
$B restore --from gdrive \
    --map "~/Documents=~/Code" \             # 額外路徑對應(~ 左邊是舊電腦、右邊是新電腦)
    --on-conflict keep|replace|rename \      # 兩邊都改過時的處理方式,預設 keep
    --apply

# 想安全試玩:還原到假的 home
$B restore --from gdrive --home /tmp/fakehome --apply

$B drive status | login | logout           # Google Drive 連線
$B lock --from gdrive                      # 從 Keychain 移除已解鎖的金鑰
  • 所有存到備份位置的東西(檔案內容、快照清單)都用 AES-GCM 加密;Google 只看得到密文。
  • 解鎖後的金鑰會存在本機 Keychain,之後不用每次輸入 passphrase。
  • 環境變數:AGENT_BACKUP_PASSPHRASE(跳過輸入)、AGENT_BACKUP_NO_KEYCHAIN=1(不存 Keychain)。

被覆蓋的檔案會先複製到 `~/Library/Application Support/AgentBackup/rollback/<時間>/`,新建立的檔案列在該資料夾的 `created-files.txt`。

測試

swift test