# Stock-Postgres surgical incident recovery companion

> Project brief for Claude Code from NixInc Ideas: https://nixinc.co/ideas/2026-09-14-stock-postgres-surgical-incident-recovery-companion
> Scored 6.3/10 on 14 Sept 2026, verdict WATCH. Prices are as of the dates shown.

## What we're building
When rows are deleted or corrupted in production Postgres, ordinary point-in-time recovery rewinds the whole database and can take it offline, undoing unrelated writes.

## Who pays
Platform lead, database reliability engineer or SRE lead at a SaaS company running production PostgreSQL and paying for backups or PITR.

## What they already pay
- Supabase, PITR, 7-day retention (approximately): $100/mo (as of 14 Sept 2026)
- Supabase, PITR, 14-day retention (approximately): $200/mo (as of 14 Sept 2026)
- Supabase, PITR, 28-day retention (approximately): $400/mo (as of 14 Sept 2026)

## Milestone 0: the 72-hour test, before any code
Recruit 20 platform/SRE leads and show a clickable workflow: choose incident transaction/time → restore sidecar → inspect row-level diff → approve repair. Ask each for the last real accidental-write incident and their current recovery steps; do not pitch AI-agent protection.

- Pass line: At least six qualified interviews, three buyers reporting the same row-level recovery gap in the last 12 months, and two written commitments to a paid pilot for that exact workflow.
- Stop rule: Stop if fewer than two buyers commit, if ordinary PITR plus pg_dump/manual diff is acceptable, or if reliable recovery requires replacing/forking Postgres. Do not build before the threshold.

Do not start milestone 1 until the pass line is met.

## Milestone 1: the smallest version worth shipping
A clickable workflow, not working software: pick the incident transaction or time, restore to a sidecar, inspect a row-level diff, approve a repair. Show it to 20 platform or SRE leads and ask for their last real accidental-write incident and how they recovered.

## Skip in v1
Forking Postgres, causal rollback that needs read-dependency capture, AI-agent protection pitches, and any promise to recreate writes that failed during the incident.

## Needs
A test Postgres instance with WAL archiving and a backup tool such as pgBackRest or Barman, a mockup tool, and contacts among platform and SRE leads and Postgres consultancies.

## How to work in this repo
1. Plan before you edit: say which files change, the smallest change that works and how you will check it, then wait for a yes.
2. One task at a time, small enough to read in one diff.
3. After each change, run the checks, then say what changed, what you tested and what still needs a person to look at.
4. Check it like a first-time customer: run the real thing and try the empty, error and success paths.
5. Keep secrets out of the repo and out of chat. Environment files stay local.
6. Ask before installing dependencies, touching payments or sign-in, or deleting files.
7. Do not build anything listed under "Skip in v1".
