Skip to content

Disk hygiene: reclaim_disk.sh and a doctor disk-free row - #2426

Closed
remigiusz-antczak wants to merge 1 commit into
mainfrom
disk-hygiene-1118
Closed

remigiusz-antczak wants to merge 1 commit into
mainfrom
disk-hygiene-1118

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

Adds a disk guard so finished lane worktrees and merged branches no longer pile up until the disk is nearly full.

What changes

  • .claude/skills/agentic-delivery/scripts/reclaim_disk.sh is dry-run by default. It lists linked worktrees that are unlocked, have no modified, untracked or ignored files, have a HEAD reachable from origin/main or another branch, and whose last reflog move is older than RECLAIM_MIN_AGE_HOURS (default 24). It also lists local branches merged into that base. --apply removes exactly the listed items with git worktree remove (never --force) and git branch -D.
  • Skipped with a reason: protected branch names, the main checkout, the current worktree, hidden index changes, and unfinished rebases, merges, cherry-picks, reverts or bisects. A missing reflog counts as young (fail closed).
  • perun_doctor.py gains a disk free row: WARN under 50 GiB, FAIL under 10 GiB, with a hint that names the script.

Tests

5/5. scripts/test_reclaim_disk.py removes each of 12 guards in turn, and each mutant must leak exactly its own expected items (guards_killed=12/12). The four doctor tests still pass. The size gate and fragment gate pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc

…nches; doctor disk-free row

.claude/skills/agentic-delivery/scripts/reclaim_disk.sh lists (dry run by default) linked worktrees
that are unlocked, have no modified, untracked or ignored files, have a HEAD reachable from
origin/main or another branch, and whose last reflog move is older than RECLAIM_MIN_AGE_HOURS
(default 24; non-numeric or below 1 falls back to 24 with a stderr note; clamped at 87600), plus
local branches merged into that base. --apply runs git worktree remove (never --force) and
git branch -D on exactly the listed items. Protected branch names, the main checkout, the current
worktree, hidden index changes (assume-unchanged, skip-worktree) and unfinished rebases, merges,
cherry-picks, reverts or bisects are skipped with a reason. The lock is the only liveness signal:
agent worktrees are locked while running, so an unlocked, clean worktree older than the age is
treated as abandoned. A missing or unparsable reflog counts as young (fail closed).

perun_doctor.py gains a disk free row: WARN under 50 GiB, FAIL under 10 GiB (PERUN_DISK_WARN_GB,
PERUN_DISK_FAIL_GB), with a hint naming the script. operating-discipline.md's teardown section
names both.

scripts/test_reclaim_disk.py builds scenario repos and removes each of 12 guards in turn (checkedout,
dirty, freshbr, hidden, inprogress, locked, main, merged, protected, reach, top, young); each mutant
must leak exactly its own expected items. Registered in scripts/ci-tests.d/reclaim-disk.sh.

size-budget-raise: .claude/skills/agentic-delivery/references/operating-discipline.md 11608→11835 adds the disk-hygiene line to the teardown section

Tests: 5/5 (test_reclaim_disk guards_killed=12/12, test_perun_doctor, test_doctor_orphan_dbs, test_doctor_review_scanners, test_doctor_stale_local_skills); size gate ok (207 files); fragments ok

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc
@remigiusz-antczak

Copy link
Copy Markdown
Collaborator Author

Superseded by #2428 (rebased on current main, one squashed commit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant