backup-dr

A command that sets up backups, checks whether data can be restored, and documents disaster-recovery procedures.

In plain words
What is it for?
Use it to configure database backup schedules, test restoring the latest backup, create a recovery runbook, and check backup health and restore-test results.
Why use it?
It helps protect application data and prepare for restoring service after data loss or a major failure.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/alphaaiservice/cortex/backup-dr
Clone the repo
git clone --depth 1 https://github.com/alphaaiservice/cortex
Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 8,795 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00033 $0.08795
Opus 5 $0.00016 $0.04398
Sonnet 5 $0.00007 $0.01759
Haiku 4.5 $0.00003 $0.00880

Measured 2d ago against content hash 4bbd72c41012, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

backup-dr scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf "${BACKUP_PATH}"

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s http://localhost:8000/health
commands/backup-dr.md · 967 lines

How it starts

The opening of the file, as written. The whole thing — 967 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backup & Disaster Recovery

Action: $ARGUMENTS (default: setup)

Parse $ARGUMENTS:

  • setup — Configure automated backups for all detected databases
  • test-restore — Run a restore verification against the latest backup
  • runbook — Generate a disaster recovery runbook
  • status — Show current backup health and last restore test results
  • No argument = setup

Step 0: Detect Data Stores

Before anything, discover what needs backing up.

echo "=== Project Root ==="
pwd

echo "=== Docker Compose Services ==="
cat docker-compose*.yml docker/docker-compose*.yml 2>/dev/null | grep -E "^\s+\w+:" | head -30

echo "=== MySQL/MariaDB ==="
grep -rn "mysql\|mariadb\|DATABASE_URL.*mysql" .env* docker-compose*.yml docker/docker-compose*.yml 2>/dev/null | head -10

echo "=== MongoDB ==="
grep -rn "mongodb\|MONGO_URI\|MONGO_URL" .env* docker-compose*.yml docker/docker-compose*.yml 2>/dev/null | head -10

echo "=== Redis ==="
grep -rn "redis://\|REDIS_URL\|REDIS_HOST" .env* docker-compose*.yml docker/docker-compose*.yml 2>/dev/null | head -10

echo "=== S3/MinIO ==="
grep -rn "minio\|S3_BUCKET\|AWS_S3\|STORAGE_BUCKET" .env* docker-compose*.yml docker/docker-compose*.yml 2>/dev/null | head -10

echo "=== Existing Backup Scripts ==="
find . -maxdepth 3 -name "*backup*" -o -name "*restore*" -o -name "*dump*" 2>/dev/null | grep -v node_modules | grep -v .git

echo "=== Cron Jobs ==="
crontab -l 2>/dev/null || echo "No crontab"
ls /etc/cron.d/*backup* 2>/dev/null || echo "No backup cron jobs"

Build a list of data stores to back up:

  • MySQL/MariaDBmysqldump
  • MongoDBmongodump
  • Redisredis-cli BGSAVE + copy RDB
  • S3/MinIOmc mirror (MinIO Client)
  • File uploadstar or rsync

Step 1: Create Backup Directory Structure

backup/
├── scripts/
│   ├── backup-all.sh              # Master backup orchestrator
│   ├── backup-mysql.sh            # MySQL/MariaDB backup
│   ├── backup-mongodb.sh          # MongoDB backup
│   ├── backup-redis.sh            # Redis RDB snapshot
│   ├── backup-files.sh            # File/upload storage backup
│   ├── restore-mysql.sh           # MySQL restore
│   ├── restore-mongodb.sh         # MongoDB restore
│   ├── restore-redis.sh           # Redis restore
│   ├── restore-files.sh           # File restore
│   ├── verify-backup.sh           # Verify backup integrity
│   └── cleanup-old-backups.sh     # Retention policy enforcement
├── config/
│   ├── backup.env                 # Backup configuration (encrypted)
│   └── retention-policy.yml       # Retention rules
├── logs/
│   └── .gitkeep
└── DR_RUNBOOK.md                  # Disaster recovery procedures

Read the full file on GitHub · 967 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 967 lines · 33 tokens per session scan C 4bbd72c41012

Subscribe to this mod's changes

backup-dr is a command published in the GitHub repository alphaaiservice/cortex (1 stars, last pushed 26d ago), licensed MIT. It adds 33 tokens to every session and 8,795 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.