Files
BFM-decomp/tools
Drew T c0e64f48b6 feat(phase-30 S48): tools/recover_drafts.py — the transcript IS the backup
Today a 28-agent wave lost 21 adversarially-verified drafts to a shared output
directory, and I wrote them off before Drew asked whether the workflow results
could just be analysed. They were all recoverable, for zero agent tokens.

Encodes the method that worked 21/21, including the two shortcuts that do NOT:
- taking each Write's content recovers only single-write drafts (8/21 — agents
  refine);
- taking an Edit's new_string as a file yields a FRAGMENT, not a file.
So it replays the mutation history per (agent, file_path), snapshots after
every mutation, emits newest-first, and also scans Bash heredocs (the 21st
draft never used Write/Edit at all). --gate runs match_one newest-first and
keeps the first MATCH.

Self-test on wf_d804f25a-f6f: 3/3 including the heredoc case.
2026-08-11 21:12:44 -06:00
..