Skip to content
Directory
GitHub Star
Evidence, tags & source code

Cold Recovery for a Personal Agent: Restore Original Reports from PostgreSQL Backup ​

If a personal research Agent loses its entire host, remote Git can restore code but not reports users already saw. Even a database backup may be insufficient without the compatible schema, storage permissions and referenced report files.

This is a cold-restore design that never overwrites the original database or sends real messages. Assume PostgreSQL stores jobs, report revisions and delivery records. Independently stored files need matching protected backups.

Define scope and an isolated target ​

Before backup, record database version, required extensions, roles, application artifact and migrations. Select three synthetic IDs: a committed report, an executed task and a delivered notification. Preserve their content digests and state rather than merely counting rows.

PostgreSQL pg_dump exports one database, not all cluster-wide roles and tablespaces. Recover roles from controlled configuration or independent secure backups. Verify corresponding object storage and decryption capability for external artifacts. Store backups independently of the host that might fail.

Restore into an isolated empty database ​

These commands assume verified libpq service entries, a source used for read-only export, and a separate empty target. Prepare compatible extensions, versions, roles and restore privileges. Never put passwords into commands, and restore only trusted backups.

sh
umask 077
pg_dump --format=custom --no-owner --file=research.dump "service=research_source"
sha256sum research.dump > research.dump.sha256
sha256sum -c research.dump.sha256
pg_restore --list research.dump
# Only after independently verifying the isolated target is empty:
pg_restore --exit-on-error --single-transaction --no-owner --no-privileges \
  --dbname="service=research_restore_sandbox" research.dump

Do not use --clean or overwrite an existing database. With --no-owner and --no-privileges, the restoring role owns objects and original grants are not reproduced; configure and verify least-privilege application access separately. A successful script exit proves only that database operation.

Verify recovered user outcomes ​

Before starting a new process, disable schedules, external notifications and model calls. Check the isolated environment identity so the test cannot read or write the source database.

ReadbackAcceptance
Original report IDSame revision and digest as the backup, correct access
Original task IDInspectable execution identity and state; unknown does not become pending
Original delivery IDKnown or unknown receipt preserved, no automatic resend
External attachmentsCorrect object version and digest, no broadened access

RPO concerns tolerated loss of recovery points; RTO concerns tolerated time to service recovery. Select backup frequency and archival strategy accordingly. A logical export duration is not measured service recovery. Record actual RPO/RTO in a complete rehearsal and evaluate WAL archiving or point-in-time recovery if required.

This is an independent exercise, not an actual restore of a real database. Open ETF Agent documents deployment recovery; further improvements are in the application roadmap. Combine it with release identity to distinguish artifact rollback from business-state recovery.

Engineering notes, evidence and boundaries. · Contact: hpoenixf@foxmail.com · WeChat: hpoenixf0510