destructive-sweeps-lean-to-keep
A destructive operation acts only on what it can positively prove is disposable. Enumerate what to DELETE, never what to skip - and refresh the safety signal on every real use. Use when the task involves: sweep, purge, cleanup, delete old, prune, reclaim space, stale files, retention, aged out, rm -rf, git clean, drop the table.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 110
- Forks
- 12
01 前言 Front Matter
- name
- destructive-sweeps-lean-to-keep
- license
- MIT
- description
- A destructive operation acts only on what it can positively prove is disposable. Enumerate what to DELETE, never what to skip - and refresh the safety signal on every real use. Use when the task involves: sweep, purge, cleanup, delete old, prune, reclaim space, stale files, retention, aged out, rm -rf, git clean, drop the table.
02 资源文件 8
- 参考文档agents/openai.yaml738 B
- 参考文档CARD.md4.5 KB
- 参考文档references/execution-loop.md4.7 KB
- 参考文档references/incident-and-rfc-templates.md1.9 KB
- 参考文档references/public-contribution-program.md13.6 KB
- 参考文档references/scenario-templates.md8.1 KB
- 参考文档references/worked-contract.md2.0 KB
- 脚本scripts/contribution-ledger.mjs51.1 KB
03 SKILL.md 正文
Destructive Sweeps Lean To Keep
A destructive operation acts ONLY on what it can positively identify as safe to delete, refreshes its safety signal on every real use, and when in doubt KEEPS.
Written up 2026-07-20 after one sweep deleted the owner's own recorded audio and, separately, deleted an actively-resuming upload mid-use. Both failures came from the same two shapes, and both shapes look completely reasonable while you are writing them.
Why it leans all the way to one side
The two failure directions do not cost the same:
- A false DELETE is unrecoverable. Here it was the owner's own recorded audio, gone.
- A false KEEP is merely disk. It accumulates, and a later, more careful pass reclaims it.
Because the costs are asymmetric, the operation must not sit in the comfortable middle of "delete what looks stale". It leans all the way toward keeping, and buys the small recoverable cost to avoid the large unrecoverable one. A sweep that reclaims 80 percent of what it could have, and has never once destroyed something live, is working correctly.
The two shapes this forbids
1. A deny-list where it must be an allow-list
"Delete every aged directory EXCEPT the names I listed" fails OPEN for any shape nobody thought to list. It deleted an aged future-partition directory and its sentinel, because no one had thought to list them.
Enumerate what to DELETE, never what to skip. The correct boundary admits only what it can positively prove is disposable: an aged directory whose name IS a canonical 32-hex upload id, and nothing else. Malformed names, partials, partition containers, future siblings - all survive, because none of them can be PROVEN disposable. Their survival is the boundary working, not the boundary leaking.
This is the same shape as the checks-that-fail-open skill: a pass condition that is an absence ("not on my
skip list") is satisfied by anything at all, including things that did not exist when the list was
written.
2. A safety signal the code does not refresh
The sweep judged staleness by last write, and the design comment claimed a live upload resets its own clock. A successful re-register and a successful idempotent chunk both wrote nothing - so an actively resuming upload aged out and was deleted mid-use.
The safety signal must be touched on EVERY successful operation, not only the ones that happen to write bytes. And the sweep must not race a resume between its age check and its delete. If that race cannot be cheaply proven closed, widen toward KEEP.
Note where the defect actually lived: in a COMMENT asserting a guarantee the code did not implement.
The author wrote it believing it, which is why the author is the last person able to see it false -
see the proof-covers-the-wrong-thing skill. Make the code deliver what the comment says, or change the
comment. Never leave them disagreeing.
Before you run one, in order
- Canonicalize before you act. A destructive boundary needs a positively validated canonical identifier, not a skip-list. The same shape let a non-canonical path traversal escape once already.
- Say out loud what you can PROVE is disposable. If the sentence needs an "except", it is a deny-list and it is wrong.
- Take the backup in the same breath as the delete, not as a separate earlier step. A gap between snapshot and sweep is a window another writer can fill.
- Check who else is live in the same place. Establish it by reading - process lists, lock files, whatever inventory of running work you have - rather than by asking around and taking silence for an answer. A working tree with somebody else's work in it is not yours to reset.
- Prefer reversible. Push a backup ref, move to a quarantine directory, rename rather than remove. Something you can undo tomorrow is worth far more than the disk it costs tonight.
The one-line test
If this sweep were wrong about one item, could I get it back?
If the answer is no, the boundary must be an allow-list of things positively proven disposable, and everything it cannot classify survives.
04 同仓库更多 Skills
devthrottle-sessions
Talk to the other DevThrottle sessions running across your machines - list them, rename this one, send one of the rare queued messages, read the inbox, reply, open a new session, and close one down. Use when the task involves: message another session, ask another session, list sessions, what sessions are running, spawn a session, rename this session, close this session.
devthrottle-install
Hand the user the documented steps to install or update DevThrottle, and to connect a gateway afterwards. Use when the task involves: install DevThrottle, set up DevThrottle, update DevThrottle, connect a gateway, cc-devthrottle not found, where do the cc tools come from.
proof-covers-the-wrong-thing
A proof can be valid and still say nothing about what you changed - wrong surface, wrong reader, wrong caller, or an untested premise. Name what your evidence does NOT cover. Use when the task involves: prove it, by construction, root cause, reproduced it, repro, guard-local, skipped test, suite is green, premise, assumption, self review, it is settled.
checks-that-fail-open
A check whose pass condition is an ABSENCE certifies a run that never happened. Restate it as a specific PRESENCE - and an empty result is a broken instrument, never a clean run. Use when the task involves: verify, prove it, sweep, grep returned nothing, zero hits, clean run, it passed, no defects, reviewed, delivered, double check, how do we know.
wingman-brief-reviewer
RETIRED 2026-09-16 - do not run it. It reviewed saved wingman turn BRIEFS, whose writer was retired in issue
warning-fixer
Fix compiler warnings using proper null handling and senior developer practices. Use when asked to fix warnings in a file, clean up nullable warnings, or resolve CS warnings. Works one file at a time with test coverage.