# Remove Stale Incident Runs

audience: AI coding agents first.

# Outcome
status: DONE
task IDs: #2
source request: Determine age of Debian1/2/3 `~/runs/incident-blockers-focused*`; preserve any WIP before removing stale run directories. Original execution used `/claudex-workflow` with `gpt-5.6-terra` medium. Owner follow-up on 2026-08-14 authorizes safe preservation and deletion of the remaining damaged or non-Git runs. NEVER recursively scan `~/Projects`.

## Acceptance criteria

- Inspect exact matching paths, timestamps, Git state, branch, commits, remotes, and worktree registration with bounded commands.
- Preserve every unique uncommitted or unpushed change in a clearly named local Git branch before deletion.
- Record branch, commit, source path, and host for every preserved run.
- Remove only exact `~/runs/incident-blockers-focused*` paths after preservation succeeds.
- Report bytes reclaimed per host using filesystem free-space before/after plus exact removed paths.
- Verify paths absent and preservation branches or immutable archive receipts resolve after removal.
- Preserve non-Git runs as owner-readable compressed archives with path manifest, metadata, and SHA-256 verification before deletion.
- Preserve damaged Git runs twice: a complete filesystem archive plus every independently readable Git ref/object export; corruption MUST be recorded, not hidden.

## Preserved WIP

- Any matching run WIP MUST survive as a branch and commit before directory removal.
- All nonmatching runs, projects, sessions, caches, and worktrees remain untouched.

## Constraints

- Use immutable archive receipts for runs that cannot truthfully become valid Git branches; never fabricate Git history from damaged or non-Git content.
- Contact Debian1/2/3 only through registered SSH aliases.
- NEVER run recursive `du` under `~/Projects`.
- NEVER delete before Git preservation and verification.
- Fail closed on non-Git content, commit failure, ambiguous ownership, or branch collision.

## Execution steps

1. Inventory exact matches and age/provenance.
2. Preserve WIP and unique commits on host-local branches.
3. Verify preservation objects and branch refs.
4. Remove exact matching directories.
5. Verify deletion and report reclaimed space.

6. For each remaining run, create a same-host archive under `/home/user/Projects/.wip-archives/incident-blockers-focused/<host>/` using a temporary name, record a sorted null-safe file manifest and SHA-256, then atomically rename only after verification.
7. For damaged Git, separately export every readable ref and object inventory; verify archive extraction into a temporary directory before deletion.
8. Delete only the exact source whose archive and receipt both verify; re-check absence, archive hash, and filesystem free space.

## Current receipt

- 2026-08-13: Exact bounded inspection complete. Debian1 matches had root mtimes 08:08:20 (`base`), 08:31:43 (`-2`), 09:15:43 (`-4`), 09:16:35 (`-5`), and 09:17:51 (`-6`) +03:00. Debian2 `-3` mtime 08:33:26 +03:00. Debian3 had no matches.
- 2026-08-13: Preserved and removed eligible Git-backed Debian1 `base`, `-2`, `-4` into durable bare archives under `/home/user/Projects/.wip-archives/incident-blockers-focused/debian1/`; branches resolve at commits `75787eddd2a35666434082a486b419abab57a99f`, `e7865702744612108a45b8de2ab3a8821c43c113`, and `d19f05d3823f052258bcb267e91261a3a13b1112`. Each original repository was a linked worktree whose only common Git store was inside its deletion target.
- 2026-08-13: Debian1 root available bytes: 22,846,373,888 before → 34,923,184,128 after; reclaimed 12,076,810,240 bytes. Removed paths verified absent. Debian1 `-5` and `-6` remain: no nested Git metadata; fail closed.
- 2026-08-13: Debian2 `-3` was Git-backed with common store inside target but its Git object database had invalid ref `refs/rescued/codex-20260813T050254Z-267600`; `git add -A` failed. No preservation branch or deletion occurred; path remains. Debian2 available bytes 5,488,842,992 before, 5,488,586,752 final; no reclamation.
- 2026-08-13: Debian3 no matches. Root available bytes 13,945,057,280 before and 14,021,902,336 final; no deletion required. Temporary remote helper files removed.

- 2026-08-14: Owner authorized immutable archive preservation for the remaining damaged/non-Git runs. Debian1 `-5` archived as 1,393 files / 10,838,098 bytes, archive SHA-256 `9ca91fcc2f86b6f7fbfe6e07ae7e61247830d7f3d5390e109b52267930e096c3`; Debian1 `-6` archived as 5,330 files / 277,702,055 bytes, SHA-256 `a48bc388a1b3e8791d866afc46a35aaa2008fdf1c40494f8beba6a3a94797b5a`. Both archives were extracted and rsync-compared byte-for-byte before exact source deletion; final archives are 3,534,509 and 249,310,057 bytes.
- 2026-08-14: Debian2 damaged `-3` archived as 27,511 files / 3,668,830,250 bytes, SHA-256 `c6b31e17d800c2844c05847b446c1947e8eb823f96757136a2c56c866e06fc66`. Full filesystem archive preserves damaged Git metadata without fabricating history. Extracted tree matched through null-safe counts, total bytes, and empty `rsync -niaHAX`; final archive is 3,604,758,292 bytes. Source deleted only after two successful archive hash checks.
- 2026-08-14: All three hosts now report zero `~/runs/incident-blockers-focused*` paths. Archives and owner-readable receipts live under `/home/user/Projects/.wip-archives/incident-blockers-focused/<host>/`. Final free space: Debian1 root 24,088,387,584 bytes, scratch 69,465,923,584 bytes; Debian2 root 8,446,218,240 bytes, scratch 40,527,302,656 bytes. Debian3 remained clear and untouched.

## Next executable action

None. Every matching run is either a previously verified Git archive or a verified immutable filesystem archive, and every source path is absent.
