backup-setup

Agent skill for Claude Code, Codex & Cursor from thedotmack/claude-mem · updated

How to install backup-setup

$ npx skills add https://github.com/thedotmack/claude-mem --skill backup-setup
Advertisement

What backup-setup does

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".

SKILL.md

View source

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

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.

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:

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:

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:

npx claude-mem backup run

3. Restore

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.

Advertisement

More in Databases

banner-designDesign banners for social media, ads, website heroes, creative assets, and print. Multiple art direction options with optional generated or supplied visuals. Actions: design, create, generate banner. Platforms: Facebook, Twitter/X, LinkedIn, YouTube, Instagram, Google Display, website hero, print. Styles: minimalist, gradient, bold typography, photo-based, illustrated, geometric, retro, glassmorphism, 3D, neon, duotone, editorial, collage.nextlevelbuilder/ui-ux-pro-max-skillsetup-gbrainSet up gbrain for this coding agent: install the CLI, initialize a local PGLite or Supabase brain, register MCP, capture per-remote trust policy. (gstack)garrytan/gstackdeprecation-and-migrationManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.addyosmani/agent-skillsrevopsWhen the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.coreyhaines31/marketingskillsarchitecture-designerUse when designing new high-level system architecture, reviewing existing designs, or making architectural decisions. Invoke to create architecture diagrams, write Architecture Decision Records (ADRs), evaluate technology trade-offs, design component interactions, and plan for scalability. Use for system design, architecture review, microservices structuring, ADR authoring, scalability planning, and infrastructure pattern selection — distinct from code-level design patterns or database-only design tasks.jeffallan/claude-skills