git diff --name-only --diff-filter=D "$BASE" "$BAD" -z > /tmp/deleted.paths.z
I diagnosed the incident as a detached/lost-index mass-deletion commit and wrote the recovery runbook to ~/df-consensus-8-recovery.md.
The worker's index no longer reflected HEAD when it staged. With an empty/lost index, git add -A treated every tracked file as deleted and staged those deletions alongside the 7 real edits, so 790f9ba4 = intended changes + hundreds of spurious deletions. Crucially, the 7 intended edits exist only in that commit, so git reset --hard 790f9ba4^ would destroy them — recovery must be additive.
cd "$(git rev-parse --show-toplevel)"
BAD=790f9ba44ffd309909ee0c820a93b188699bd19f
BASE="$(git rev-parse "${BAD}^")"
# 0. preserve the bad commit; extract evidence without mutating history
git tag -f backup/bad-commit "$BAD"
git diff --name-only --diff-filter=D "$BASE" "$BAD" -z > /tmp/deleted.paths.z
git diff --name-only --diff-filter=ACMRTUXB "$BASE" "$BAD" > /tmp/intended.paths # must be 7
# 1. restore the deleted tree from the parent into BOTH index and worktree
xargs -0 -a /tmp/deleted.paths.z git checkout "$BASE" --
# 2. commit the restoration separately (intended edits stay in 790f9ba4)
git commit -m "Restore tracked tree deleted by 790f9ba4 (DF-CONSENSUS-8)"
# -> yields e78bbe93c018271f824c80f6f566f46ebcb17adb
Because only --diff-filter=D paths are restored, the 7 modified files are untouched. The bad commit's edits survive; the restoration is a new commit on top.
git diff --name-status "$BASE"..HEAD # exactly 7 files, zero D
git diff --diff-filter=D --name-only "$BASE"..HEAD # empty
git diff --check "$BASE"..HEAD # clean
git ls-files | wc -l # repository-scale, == base count
gofmt -l . && go build ./... && go vet ./... && go test ./... -short
# GitReins Tier 1 + GitHub CI green; remote parity: 0 0
The full document includes a one-shot script and prevention (seed worker index with git read-tree HEAD, per-task staging, and a pre-commit guard rejecting mass deletions).
The complete deliverable is at ~/df-consensus-8-recovery.md.
# Evidence - Problem class: git-commit-index-wipe-mass-deletion-recovery - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-24T07:23:44.890Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Symptom: a worker commit unexpectedly recorded hundreds of repository deletions while the intended task changed only seven files. Root cause: the worker/index state had lost the tracked tree before commit, so the implementation commit contained the intended edits plus a mass deletion. Recovery: compare the bad commit against its parent, restore the deleted tracked tree from the parent into both index and worktree, commit that restoration separately, and verify the net two-commit diff from the original base contains only the intended task paths. Do not reset away the implementation before extracting or preserving it. Verification: git diff --name-status BASE..HEAD listed exactly seven intended files; git diff --check passed; git ls-files returned the expected repository-scale count; gofmt, focused tests, go build, go vet, the full short suite, GitReins Tier 1, and GitHub CI all passed; remote parity was zero after push.", "environment": "Linux; Git repository with a worker sharing the main worktree and commit hooks", "language": "git", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "git-commit-index-wipe-mass-deletion-recovery", "provider": "openrouter", "solved_at": "2026-09-24T07:23:44.891Z", "version": ""}I diagnosed the incident as a detached/lost-index mass-deletion commit and wrote the recovery runbook to ~/df-consensus-8-recovery.md.
The worker's index no longer reflected HEAD when it staged. With an empty/lost index, git add -A treated every tracked file as deleted and staged those deletions alongside the 7 real edits, so 790f9ba4 = intended changes + hundreds of spurious deletions. Crucially, the 7 intended edits exist only in that commit, so git reset --hard 790f9ba4^ would destroy them — recovery must be additive.
cd "$(git rev-parse --show-toplevel)"
BAD=790f9ba44ffd309909ee0c820a93b188699bd19f
BASE="$(git rev-parse "${BAD}^")"
# 0. preserve the bad commit; extract evidence without mutating history
git tag -f backup/bad-commit "$BAD"
git diff --name-only --diff-filter=D "$BASE" "$BAD" -z > /tmp/deleted.paths.z
git diff --name-only --diff-filter=ACMRTUXB "$BASE" "$BAD" > /tmp/intended.paths # must be 7
# 1. restore the deleted tree from the parent into BOTH index and worktree
xargs -0 -a /tmp/deleted.paths.z git checkout "$BASE" --
# 2. commit the restoration separately (intended edits stay in 790f9ba4)
git commit -m "Restore tracked tree deleted by 790f9ba4 (DF-CONSENSUS-8)"
# -> yields e78bbe93c018271f824c80f6f566f46ebcb17adb
Because only --diff-filter=D paths are restored, the 7 modified files are untouched. The bad commit's edits survive; the restoration is a new commit on top.
git diff --name-status "$BASE"..HEAD # exactly 7 files, zero D
git diff --diff-filter=D --name-only "$BASE"..HEAD # empty
git diff --check "$BASE"..HEAD # clean
git ls-files | wc -l # repository-scale, == base count
gofmt -l . && go build ./... && go vet ./... && go test ./... -short
# GitReins Tier 1 + GitHub CI green; remote parity: 0 0
The full document includes a one-shot script and prevention (seed worker index with git read-tree HEAD, per-task staging, and a pre-commit guard rejecting mass deletions).
The complete deliverable is at ~/df-consensus-8-recovery.md.
# Evidence - Problem class: git-commit-index-wipe-mass-deletion-recovery - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-24T07:23:44.890Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Symptom: a worker commit unexpectedly recorded hundreds of repository deletions while the intended task changed only seven files. Root cause: the worker/index state had lost the tracked tree before commit, so the implementation commit contained the intended edits plus a mass deletion. Recovery: compare the bad commit against its parent, restore the deleted tracked tree from the parent into both index and worktree, commit that restoration separately, and verify the net two-commit diff from the original base contains only the intended task paths. Do not reset away the implementation before extracting or preserving it. Verification: git diff --name-status BASE..HEAD listed exactly seven intended files; git diff --check passed; git ls-files returned the expected repository-scale count; gofmt, focused tests, go build, go vet, the full short suite, GitReins Tier 1, and GitHub CI all passed; remote parity was zero after push.", "environment": "Linux; Git repository with a worker sharing the main worktree and commit hooks", "language": "git", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "git-commit-index-wipe-mass-deletion-recovery", "provider": "openrouter", "solved_at": "2026-09-24T07:23:44.891Z", "version": ""}