Repository navigation
feat: add on-demand cleanup sweep mode - #319
Merged
Merged
Conversation
- Add `/cleanup sweep` to the cleanup skill: report only pooled copies with measured sizes, wait for one word, run --apply-clean once, re-measure. - List not-owned paths inside clean slots as sudo rm -rf lines for the captain; firstmate never runs sudo. - Extend the skill description, trigger index, and the one-line AGENTS.md pointer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/cleanupkeeps its full report-first review;/cleanup sweepis the on-demand narrow path the captain asked for: one pooled-copy table, one captain word, one clean-tier pass, then measured results.Files changed:
--forcestays forbidden.sudo rm -rf <path>lines for the captain, and firstmate never runs sudo.config/treehouse-sweep-cleanflag is named and the sweep is not attempted.Pipeline fixes
The pipeline caught two misses in the first draft and fixed both in review fix
c078d044:df -h/df -kbefore the pass, not only afterward, so a partly deleted copy that stays listed still shows the observed space change.--apply-cleanwill fail; before a failure it no longer suggests sudo.The document step's README command-table line landed in
40cc0ddf.Why the sweep script is unchanged
bin/fm-treehouse-sweep.shstill classifies only through the ownership proof, and its clean tier is decided by porcelain cleanliness, unpushed commits, and merge reachability (cited: the classification branch inbin/fm-treehouse-sweep.sh). A "contains paths not owned by the current user" flag could not be tested through the script's public interface without root: an unprivileged fixture cannot create a foreign-owned path, and a test-only ownership override in production code is disallowed. The check stays in the skill procedure, wherefind <path> ! -user "$(id -u)"runs read-only on clean rows only, and the apply pass's stop-on-failure behavior is untouched.Follow-up recommendation
--apply-cleanstops the whole pass at the firsttreehouse destroyfailure (cited: thedie "treehouse destroy failed for clean slot $canon"branch), so one root-owned path costs the remaining clean slots in that run (the 2026-11-17 incident: copy 38 failed, nine copies waited for a second pass). A follow-up could continue past a failed slot, report each failure with its exact path, and exit non-zero at the end; this PR leaves that behavior alone.Evidence
After:
/cleanup sweepprints one pooled-copy table, waits for one word, runs--apply-cleanonce, and re-measures with before and after filesystem readings.Dry walkthrough against this machine's live pools (
bin/fm-treehouse-sweep.sh --all,du -sk,find ! -user; no apply run, no removal):Clean-tier reclaim total for that run: 1.7 GiB (1,770,776 KiB) measured by
du -skover the clean rows, and both clean rows passed the not-owned check (findprinted nothing). The opt-in flag was present atconfig/treehouse-sweep-clean. Pool filesystem:/dev/mapper/data-root929G, 660G used, 222G available. Raw capture:data/fm-cleanup-sweep-mode/artifacts/sweep-all-live.txtandsweep-sizes.tsv.bash tests/fm-cleanup-skill.test.sh- both contract tests pass.bin/fm-doc-audience-check.sh-ok surfaces=104 local_links=544.tests/fm-ext-plugin-dest.test.shattachment e2e shard; it is unchanged from base and passed locally, and the single authorized rerun passed with no code change.Merge Danger
Door: Two-way. Reverting restores the previous skill text; nothing else reads the new section.
Blast Radius: Operator-only.
Only agents following the cleanup skill change behavior; this PR adds no script, daemon, trigger, or automatic removal. The one authority rule it leans on (wholesale clean-tier approval) already exists.
Testing
Confirmed that changes affect only natural-language instructions and trigger pointers. No runtime tests or live scenarios were executed, no artifacts were generated, and the previously declined missing-live-validation finding was not repeated.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
.agents/skills/cleanup/SKILL.md:56- The intent requires a clean-tier reclaim figure "taken from the tool's own dry-run report," but this line instead defines it as "the sum of the measured clean rows"; line 58 repeats that substitution. This also conflicts with the existing tool-measured-reclaim rule at line 78. Restore the required measurement source, or obtain explicit approval to change that requirement..agents/skills/cleanup/SKILL.md:61- Capture filesystem usage before applying the sweep as well as afterward. Currently the only df measurement occurs after deletion, and classification reports no sizes. In the stated partial-deletion scenario, the same slot remains listed after losing 23 GB, so comparing removed rows cannot establish space freed. Preserve a before measurement and compare it with the required after measurement, including on failure..agents/skills/cleanup/SKILL.md:57- A foreign-owned path does not establish that deletion will fail: a root-owned regular file inside a user-owned writable directory can be unlinked successfully. This instruction would incorrectly report a guaranteed failure and recommend an unnecessary sudo operation. Describe the result as foreign ownership and a potential deletion obstacle, rather than proof that --apply-clean will stop.🔧 Fix applied.
1 error still open:
.agents/skills/cleanup/SKILL.md:56- The intent requires a clean-tier reclaim figure "taken from the tool's own dry-run report," but this line instead defines it as "the sum of the measured clean rows"; line 58 repeats that substitution. This also conflicts with the existing tool-measured-reclaim rule at line 78. Restore the required measurement source, or obtain explicit approval to change that requirement.git diff --stat 9c930f8418a1e9480dc6e0383c5bac8cb80a2f3e c078d044b6d2ca923db5057439ce1da97f7e7160Inspected the complete change across cleanup skill, trigger index, and AGENTS.md.Readbin/fm-treehouse-sweep.shand relevant existing test fixtures intests/fm-treehouse-sweep.test.sh.🔧 No changes applied.
1 warning still open:
git diff --stat 9c930f8418a1e9480dc6e0383c5bac8cb80a2f3e c078d044b6d2ca923db5057439ce1da97f7e7160Inspected the complete three-file change and existing sweep script interface.Inspectedtests/fm-treehouse-sweep.test.shto assess whether it could demonstrate the changed behavior.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.