Skip to main content
skill CX Codex

backup-setup — Claude Code skill: what it does, how to install

The backup-setup skill runs on Claude Code and manages local database snapshots for claude-mem. Sets up automatic backups, checks status, and restores databases.

Apache-2.0 435 installs ★ 118,868 updated 2026-10-24

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add thedotmack/claude-mem --skill backup-setup -a claude-code
Open on GitHub

What backup-setup does

The skill automates database backups through npx claude-mem commands. It writes configuration settings to ~/.claude-mem/settings.json, enforces 0600 file permissions, and restarts the background worker to apply the schedule.

Running the skill requires Node.js and an active claude-mem worker instance on the local machine. If the CLI version lacks backup support or connection fails, the process stops and reports the exact error output.

What it helps with

  • configure automated database backups
  • check backup status and logs
  • restore database from a snapshot
  • trigger an immediate snapshot run

Example prompts for the agent

  • set up backups
  • back up my memories
  • restore my database

How to install backup-setup

1Skills CLI (Vercel)

npx skills add thedotmack/claude-mem --skill backup-setup -a claude-code

2Manually: put the files in place

~/.claude/skills/backup-setup/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/backup-setup/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about backup-setup

How to install backup-setup in Claude Code?

Run these commands in your terminal: npx skills add thedotmack/claude-mem --skill backup-setup -a claude-code and ~/.claude/skills/backup-setup/SKILL.md.

What does backup-setup do?

It sets up, checks, and restores local SQLite database snapshots for claude-mem, managing backup intervals and retention counts.

What is required for backup-setup?

It requires a running claude-mem worker and Node.js installed on your machine.

Source text

SKILL.md · Apache-2.0
---
name: backup-setup
description: Set up, check, or restore local claude-mem database snapshots. Use when the user says "set up backups", "back up my memories", "backup status", or "restore my database".
allowed-tools:
  - Bash
  - Read
  - AskUserQuestion
argument-hint: [setup|restore|status]
---

# Backups (local snapshots)

The installed worker snapshots `~/.claude-mem/claude-mem.db` on a schedule
(`VACUUM INTO`, consistent while sessions run) and keeps the newest N under
`~/.claude-mem/backups/auto/`. Each snapshot is one standalone SQLite file.
Snapshots stay on this machine.

Preserve every unrelated setting and keep `~/.claude-mem/settings.json` mode
`0600`. Never print the file's contents: it holds credentials.

## Routing

Based on `$ARGUMENTS`:
- `setup` or empty: **1. Check status**, then **2. Enable snapshots**
- `restore`: **3. Restore**
- `status`: **1. Check status** only

## 1. Check status

```bash
npx claude-mem backup status
```

- Snapshot details printed: backups run. Report the last snapshot time, the
  snapshot count and any last error; stop unless the user asked for a change
  or a restore.
- "Automatic backups are not enabled": continue to step 2 if setting up.
- A "Last restore" line reports the outcome of the most recent restore.
- "Worker is not running": start it with `npx claude-mem start` and retry.
- "Unknown command: backup" or "Backup status failed: HTTP 404": this
  claude-mem (CLI or running worker) has no backup support yet, so the
  worker would ignore the backup settings.
  Stop. Tell the user that backups are not available in their installed
  version and that `npx claude-mem update` brings them once a release
  includes them. Do not write the settings in step 2, and never say backups
  are on.
- Any other failure ("Backup status failed: HTTP" with another status,
  "Backup request failed: ...", "Backup status failed: invalid JSON
  response", "Backup status failed: unexpected response") or any output not
  listed here: stop. Show the user the exact error line, do not write the
  settings in step 2, and never say backups are on. Do not suggest an
  update: this is an error in a version that has backups, not a missing
  feature.

## 2. Enable snapshots

Ask (or default): interval in hours (default 24, range 1 to 168) and how
many snapshots to keep (default 7, range 1 to 100). Then write the settings
without echoing anything else in the file:

```bash
node - <<'EOF'
const fs = require('fs'), os = require('os'), path = require('path');
const intervalHours = 'PASTE_INTERVAL_HOURS_HERE'; // e.g. '24'
const retainCount = 'PASTE_RETAIN_COUNT_HERE';     // e.g. '7'
const dir = path.join(os.homedir(), '.claude-mem');
const file = path.join(dir, 'settings.json');
fs.mkdirSync(dir, { recursive: true });
const settings = fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, 'utf8')) : {};
const target = settings.env && typeof settings.env === 'object' ? settings.env : settings;
target.CLAUDE_MEM_BACKUP_ENABLED = 'true';
target.CLAUDE_MEM_BACKUP_INTERVAL_HOURS = intervalHours;
target.CLAUDE_MEM_BACKUP_RETAIN_COUNT = retainCount;
fs.writeFileSync(file, JSON.stringify(settings, null, 2) + '\n', { mode: 0o600 });
fs.chmodSync(file, 0o600);
console.log('backups enabled: every ' + intervalHours + 'h, keeping ' + retainCount);
EOF
```

Restart the worker so the schedule starts, then confirm with step 1. Tell
the user backups are on only when that status reports them enabled:

```bash
npx claude-mem restart
npx claude-mem backup status
```

The first automatic snapshot lands about five minutes after the worker
starts. To take one now:

```bash
npx claude-mem backup run
```

## 3. Restore

```bash
npx claude-mem backup list
npx claude-mem restore <file>
npx claude-mem backup status
```

`restore` stages the snapshot and restarts the worker (it also starts a
worker that is not running). The new worker swaps the database in before it
opens it, saves the database it replaced in the same folder as
`claude-mem-<timestamp>-pre-restore.db` (restore that file to undo; it counts
toward the retain count), and records the outcome. With cloud sync on, the
restored database resumes syncing from the snapshot's position and can pull
back changes that reached the cloud after it. `backup status` then prints a "Last restore" line: on success it
names the saved copy; on failure it gives the reason, and the worker kept
the database it had.

## 4. Report

Report the snapshot count, the last snapshot time, any error, and the last
restore outcome if there was one.

© thedotmack · Apache-2.0 · thedotmack/claude-mem

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set30

The whole set →
handoff Generates a structured HANDOFF.md with goals, failed attempts, and next steps. Use it when context degrades or when starting a fresh session. CX Codex +1 804installs screenpipe Searches local screen and audio logs captured by Screenpipe and saves selected findings into claude-mem. Useful when you need to recall meeting notes or app windows. CX Codex +1 660installs childhood The childhood skill stays with a release after publication or deployment, checking shipped artifacts, production behavior, plugins, and late CI signals. CX Codex +1 570installs request-progress request-progress — a skill for Claude Code that groups recent conversations into overall requests and tracks build velocity from memory. Activates on requests to refresh progress or review request status. CX Codex +1 469installs owner-goals The owner-goals Claude Code skill maps an owner’s goals from prompts they wrote themselves. It runs on requests to review personal goals or refresh Goals in My Work. CX Codex +1 468installs community-sweep The community-sweep Claude Code skill reviews open pull requests and issues in claude-mem. Run it to triage community contributions, help finish PRs, or handle new issues. CX Codex +1 192installs claude-mem-install claude-mem-install is a Claude Code skill that sets up the claude-mem system inside Cursor. It configures local or remote workers alongside local host-login or remote inference observers. CX Codex +1 114installs claude-mem claude-mem keeps context alive between Claude sessions: it records tool observations, compresses them into semantic summaries, and feeds them to later sessions. ★ 118,868repo stars

Project sponsors

Companies that keep this analytics open