# Backup health

`brigadestack work backup` reads local backup summary files and routes backup risk into your daily tasks. It only reads the summary files. BrigadeStack does not run `restic`, mount storage, prune, restore, notify chat, or change remote backup state.

The local config is gitignored:

```text
.brigade/backups.toml
```

Create it with:

```bash
brigadestack work backup init
```

## Commands

```bash
brigadestack work backup contract
brigadestack work backup contract --json
brigadestack work backup status
brigadestack work backup status --json
brigadestack work backup doctor
brigadestack work backup doctor --json
brigadestack work backup import-issues
brigadestack work backup import-issues --json
brigadestack work backup closeout --reason "reviewed"
brigadestack work backup closeout --defer
brigadestack work backup closeout --json
```

`contract` prints the canonical backup summary producer JSON contract. `status` summarizes configured destinations. `doctor` checks local backup summary files for stale snapshots, failed or stale checks, failed or stale prunes, missing summaries, overdue or failed restore rehearsals, and unsafe private fields. `import-issues` writes those risks into the local work inbox with source `backup-health`. `closeout` writes local closeout metadata to mark current backup issues reviewed (`--reason`) or deferred (`--defer`).

## Config Shape

Each destination is a TOML table:

```toml
[[destination]]
id = "nas"
kind = "nas"
command_label = "local backup summary producer"
summary_path = ".brigade/backups/nas-summary.json"
snapshot_stale_hours = 36
check_stale_hours = 168
prune_stale_hours = 168
restore_rehearsal_stale_days = 90
enabled = true
```

Fields:

- `id`: stable destination id such as `nas` or `cloud`.
- `kind`: destination family label.
- `command_label`: safe label for the external producer. Do not include secrets or real remote paths.
- `summary_path`: local JSON summary path.
- `snapshot_stale_hours`: warn when the latest snapshot is older than this threshold.
- `check_stale_hours`: warn when the latest check is older than this threshold.
- `prune_stale_hours`: warn when the latest prune is older than this threshold.
- `restore_rehearsal_stale_days`: warn when the latest restore rehearsal is older than this threshold.
- `enabled`: true or false.

## Summary JSON

Minimal safe summary:

```json
{
  "destination_label": "NAS backup",
  "latest_snapshot_at": "2026-05-30T06:00:00+00:00",
  "latest_check_at": "2026-05-29T12:00:00+00:00",
  "latest_check_result": "ok",
  "latest_prune_at": "2026-05-29T12:30:00+00:00",
  "latest_prune_result": "ok",
  "latest_restore_rehearsal_at": "2026-05-01T12:00:00+00:00",
  "latest_restore_rehearsal_result": "ok",
  "summary": "NAS backup is current.",
  "evidence_path": ".brigade/backups/nas-evidence.json"
}
```

Accepted successful results include `ok`, `success`, `passed`, and `pass`.

## Keep secrets out of summaries

Do not put real hostnames, remote names, mount paths, repository paths, webhook URLs, channel ids, tokens, passwords, or backup secrets into public templates or backup summary JSON. BrigadeStack warns on unsafe field names and reports the field names and omits their values.