Closed
Description
Follow-up of #470.
Switch the project's own retention tool and worktree pruner over to the general fork-cleaner, so one tool with one set of refusals cleans every host:
- a thin project config (its folders, patterns and days) in the machine file instead of the project's own script
- an installer and a daily timer for
fork-cleaner run(the first PR has neither: nothing runs it by itself yet) - the kit row in
fork-kit/README.mdand acleanerblock incommon/machine.example.json - any project rule the general tool does not have yet becomes a general rule with tests, not project code
- tune the credential-name check if it keeps too much in practice (it is by name only)
Before the switch: run fork-cleaner plan next to the old tool for a few days and compare what each would delete; anything the new one would delete that the old one kept is a bug until explained.
State question: both tools installed at once (only one timer may run), the old tool's log and state left behind (kept, not migrated), an empty project config (nothing happens).
Metadata
Metadata
Assignees
Labels
No labels
Activity
scuttletoby commentedon Nov 18, 2026
Note for the wiring, from the review of #499 (
fork-cleaner report):The report moves its mark (
<logFile>.reported) as soon as it prints the line. The next report then counts only the deletes after that point. So if the daily-report wiring loses the printed line (a failed send, or output that is dropped), that line's "freed" figure is gone for good.The wiring must do one of these:
--no-markrun plus a separate step that moves the mark.Two reports at once are already safe: the second one exits 1 with "another report is running" and leaves the mark alone.
cleaner: keep a worktree whose branch has no commit
scuttletoby commentedon Nov 18, 2026
Phase 1, first compare on the main dev host (2026-11-18). fork-cleaner is installed from #500 (head cc0bd04, green) in compare mode only: one user timer runs
fork-cleaner daily(plan+report+compare), and nothing is deleted. The numbers below are from its first run. The old retention timer and the old worktree pruner still run as before. Each old tool is compared through its own dry run (plan, andprune-worktreeswithout--apply).Totals: fork-cleaner would delete 219. The old tools would delete 246: retention 240 temp entries, the pruner 6 worktrees.
New only (14): explained, not bugs.
commits only in its reflogrule.Old only (41): fork-cleaner keeps them (stricter by design, plus one timing case).
.gitfile points to a folder that no longer exists. fork-cleaner refuses with "could not read" (git status fails), since it cannot tell what is only there. The old tool deletes by age alone..env; guard refusal).Not compared (the old tools print no path for these):
Found and fixed during the compare:
0000…) ended in "could not read", so every daily run would exit 1. It is now kept asno commit, with a test and a red check. This is commit cc0bd04 in fork-kit/cleaner: installer, daily timer (compare mode), compare, report --out #500.w4-*temp name families, and 79 entries showed as old only. This was the host's thin project config, not the tool. It is fixed in the machine file.Daily exit code stays 1 for now. In compare mode, the 14 new-only entries and the 33 unreadable temp folders each make it 1. That is the intended signal until they are explained or cleared.
cleaner: fix round on the daily timer, compare and installer (#491)
cleaner: format the README tables (#491)
fork-kit/cleaner: installer, daily timer (compare mode), compare, rep…
fork-kit/cleaner: installer, daily timer (compare mode), compare, rep…
fork-kit/cleaner: installer, daily timer (compare mode), compare, rep…
scuttletoby commentedon Nov 18, 2026
Switched to run mode on the main dev host: the two old project timers (retention, worktree pruner) are disabled and
cleaner.daily.modeisrun. The compare's only new-only items were merged worktrees whose reflog commits are all still reachable elsewhere (checked one by one). The two jobs the old tools did that fork-cleaner has no rule for yet are #519.cleaner: kit list and example machine file show every rule (#491)
cleaner: kit list and example machine file show every rule (#491)
cleaner: kit list and example machine file show every rule (#491)
cleaner: kit list and example machine file show every rule (#491) (#564)
fork-kit/cleaner: installer, daily timer (compare mode), compare, rep…
cleaner: kit list and example machine file show every rule (#491) (#564)
cleaner: kit list and example machine file show every rule (#491) (#564)
scuttletoby commentedon Nov 22, 2026
(Reposted 2026-11-22 with private details removed; original 2026-11-18.)
Main dev host, 2026-11-18 (second compare, new version).
Installed: release
ci/v17(195d604, built from main 49a7c5d, so it has #511 compress-cold and #512 agent-scratch with keep first), installed withbootstrap.sh --timeras the README says.self-checkOK. The previous version folder (cc0bd04) is kept.Machine file: only
cleaner.agentScratch: {"enabled": true}was added (defaults otherwise).compressColdis not set, so that rule does nothing. A dated backup is beside the file.Plan (read only): would delete 328 (5.9 GB), kept 118.
agent-scratch has nothing to take yet: every session folder (about 5,800) has an inode time from 2026-11-17 or later, so none is 3 days old. The first ones become old enough around 2026-11-20 23:50 UTC. Nothing is kept first yet. No transcript, live session, build cache, unpushed worktree or path outside the roots is in the plan.
Compare: fork-cleaner 329, old tools 383 (retention 376, prune-worktrees 7). Both 315, old only 68, new only 14.
Daily run (
fork-cleaner daily, compare mode) exited 0: new only 0, old only 84, both 316. All 21 worktrees were kept asin useduring that run. A freshplanright after shows all 21 as deletable again, so something touched them for a short time and the cleaner kept them, as it should. Report line: worktrees 21.7 GB, temp 0.6 GB, agent scratch 42.0 GB, agent tool homes 11.1 GB, T3 data 10.1 GB, cold folders 0.0 GB, build caches no rule yet; freed 0.0 GB.Mode now: still
compare. Run mode would be refused, because both timers inoldTimers(project-retention.timer,project-prune-worktrees.timer) are still enabled and active as user timers. I did not turn them off. Next step: disable those two timers (systemctl --user disable --now ...), then setcleaner.daily.modeto"run". Note that the old pruner also deletes merged branches that have no worktree (14 in its current dry run). fork-cleaner has no rule for that.fork-kit/cleaner: installer, daily timer (compare mode), compare, rep…
cleaner: kit list and example machine file show every rule (#491) (#564)
fork-kit/cleaner: installer, daily timer (compare mode), compare, rep…
cleaner: kit list and example machine file show every rule (#491) (#564)