| name | memory-backup |
| description | Backup CLAUDE.md, TASKS.md, and memory/ to a private Git repo using `bash .claude/skills/memory-backup/backup.sh`. |
Memory Backup
Run the backup script for the current workspace. It syncs only:
CLAUDE.md
TASKS.md
memory/
Usage
Use Bash to run the script directly:
bash .claude/skills/memory-backup/backup.sh
bash .claude/skills/memory-backup/backup.sh --pull
bash .claude/skills/memory-backup/backup.sh --sync
bash .claude/skills/memory-backup/backup.sh --dry-run
Do not run memory-backup itself as a shell command; it is just the skill name.
Setup
Set MEMORY_BACKUP_DIR in your workspace .env file to the local path of a separate Git clone for your private backup repo.
Example:
MEMORY_BACKUP_DIR=/your/path/to/memory-backups/
Requirements for MEMORY_BACKUP_DIR:
- It must already exist.
- It must be a Git repo.
- It should be clean before each run.
- It should point to a private repo clone with push access configured.
Instructions
The script is the only thing that should perform the backup. Do not manually reconstruct the copy, add, commit, or push flow with ad hoc shell commands unless the user explicitly asks to debug the script itself.
What the script does
- Loads
MEMORY_BACKUP_DIR from the environment or workspace .env
- Verifies the destination is a Git repo separate from the source workspace
- Push mode: mirrors only
CLAUDE.md, TASKS.md, and memory/ into the backup repo, commits only if changed, then pushes
- Pull mode: runs
git pull --ff-only in the backup repo, then copies those files into the workspace
- Sync mode: pull first, then push
- Pull/sync refuse to overwrite local changes under
CLAUDE.md, TASKS.md, or memory/
Notes
- The backup repo keeps the same relative structure for easy restore.
- This command does not back up other files, even if they exist in the workspace.
- If
TASKS.md or memory/ do not exist, the script skips them cleanly.