Skip to content

Data Backup

Your content files (src/content/**/*.md) and buddy.config.ts are gitignored to keep personal data out of the public repo. Built-in backup scripts sync content to a separate private data repo.

  1. Create a private repo on GitHub

    Create a new private repository (e.g., my-buddy-data).

  2. Initialize the data repo locally

    Terminal window
    git init ../my-buddy-data
    cd ../my-buddy-data
    git remote add origin git@github.com:YOUR_USERNAME/my-buddy-data.git
  3. Back up your content

    Terminal window
    bun data:backup
  4. Push to your private repo

    Terminal window
    cd ../my-buddy-data && git add -A && git commit -m "backup" && git push

When backup.onEnd is true in buddy.config.ts (the default), ending a session with /mybuddy.end automatically runs a backup.

backup: {
onEnd: true, // Auto-backup on /mybuddy.end
},

Use the Claude Code command or the shell script:

Terminal window
# Via Claude Code
/mybuddy.backup
# Via shell
bun data:backup

To restore content on a new machine after cloning both repos:

Terminal window
bun data:restore

The scripts look for ../my-buddy-data by default. Override with a custom path:

Terminal window
bun data:backup /path/to/your/data-repo
bun data:restore /path/to/your/data-repo

Or set the environment variable:

Terminal window
export BUDDY_DATA_REPO=/path/to/repo