Repository navigation
Description
What happened
I ran /disk-hygiene:clean across a whole WSL home directory. An orchestrator session drove it and dispatched subagents to do the scanning. The audit finished, but four things made this use harder than it should be. The installed version was 0.28.9. I re-checked each point below against origin/main (0.28.14) and none of them has changed.
Related work that already exists: #4009 (closed, added --sizes-only and the fan-out worker brief), #4004 (open, a home-directory audit on Windows), #2618 and #4228 (belt scope and subagent reach), #3348 and #4261 (guard denial text).
1. The skill cannot be invoked by a model, so an orchestrator cannot run even the read-only audit
plugins/disk-hygiene/skills/clean/SKILL.md:5 sets disable-model-invocation: true, and the description says "manual-only". An orchestrator session or a subagent therefore cannot load the skill. The worker I dispatched had to call scripts/hygiene.py scan directly, without the skill's instructions, and rebuild the flags from the worker brief.
Expected: the read-only audit (scan, classify, report) can be started by a model, so a session can delegate an audit. --execute and the removal lane stay user-only.
Suggested direction: split the read-only audit into a model-invocable skill or action, and keep the --execute path behind the existing user-only confirmation gate.
2. Whole-home scans hit the entry cap and there is no automatic split
Repro: run a whole-home inventory with --confirmed-large-scan. It exits 2 with:
snapshot exceeds 250000 entries; rerun with --max-depth or split the audit into bounded subtrees
The cap is MAX_SNAPSHOT_ENTRIES = 250_000 at skills/clean/scripts/hygiene.py:34, raised at hygiene.py:2009. Selecting children with --root-children hits the same cap when the selected children are large. There is no multi-target form and no automatic split, so the worker divided home into four runs by hand and merged the results. --sizes-only returns exact totals but writes no per-entry inventory (entries: 0, no findings), so every audit needs a second pass over each subtree. Each scan took minutes.
Expected: one command that audits a large tree, either by accepting several targets or by splitting on the depth-1 frontier itself and returning a documented set of snapshots.
Suggested direction: an --auto-split option (or a documented orchestration helper) that uses the --sizes-only frontier to plan bounded subtree scans, runs them, and reports coverage. At a minimum, make the cap error name the largest children so the caller can choose the split.
3. Guard ergonomics: the engine gate blocks read-only inspection and does not say which token failed
The denial text is accurate about scope: it says the gate is always on and that "/disk-hygiene:clean need not have been invoked" (skills/clean/scripts/destructive_guard.py:1838). Two things still cost retries:
- Any command that contains the engine filename is gated, including read-only inspection of the plugin's own source. While preparing this report,
git showof the engine file,cpof it, andgrepover it were each denied. A pipe such as| tailafter an engine call is denied for the same reason. The only way around it was a glob that avoids spelling the filename. - Required flags must open the invocation in declaration order (
--target, then--output), then optional flags follow in any order (lib/engine_grammar.py:17-25; flag declarations near lines 158-219). Putting--root-childrenbefore--outputis denied, although argparse would accept it. The denial lists the allowed shapes and the interpreter, but never states the ordering rule or which token broke it.
Suggested direction: (a) allow read-only inspection commands (grep, git show, cat, cp) that only name the engine as an operand, or say in the denial that such commands are gated; (b) have the denial name the failing token and state the rule, for example "required flags first: --target, --output".
4. Output shape and ownership gaps
- The snapshot carries per-entry
hintswith aconfidence_ceiling, but no per-tier counts or bytes. A summary such as "how many medium-tier entries, how many bytes" needsjqover the whole file. Atier_countsblock (count and reclaimable bytes per ceiling) in the snapshot and in the stdout summary would remove that step for orchestrators. - The baseline hint
common-temp-file(skills/clean/reference/baseline-policy.json:27, pattern*.tmp, ceilingmedium) matches~/.codex/.tmp, a 55 MB directory the codex CLI manages. The hint reason says "provenance and live ownership still need proof", so this is by design, but nothing in the engine identifies the owner. This is the same shape as disk-hygiene:clean — audit of a real home-directory run (Windows, v0.23.3): 726 bytes engine-eligible against ~60 GB product-managed; 9 decisions and 1 bug #4004 and disk-hygiene: add a gated managed-state lane with a bundled owner registry #4006 (owner registry). A small known-owner list (.codex,.claude, and similar) that annotates or lowers matches would cut false leads. --project-diris optional (hygiene.pystanding_policy_pathsskips the project layer when it is absent), but SKILL.md andreference/fan-out-worker-brief.mdshow--project-dir "${CLAUDE_PROJECT_DIR}"in every template. From a session whose project is not the target, for example a home-directory session, there is no guidance on whether to omit it. One sentence in the worker brief would settle it.
Activity
kyle-sexton commentedon Sep 29, 2026
Found while running disk-hygiene and repo-hygiene over a whole WSL machine from an orchestrating session with subagents.
Additional evidence for items 1 and 3, from an independent check of 0.28.13 against
origin/main(0.28.14). Nothing below is fixed onmain.Item 1: even with a model-invocable audit, a delegated worker cannot build a valid command.
hook_python,data_root) comes from aUserPromptExpansionhook inhooks/hooks.jsonwhose matcher isdisk-hygiene:clean$. It fires only when a person types the command, so no orchestrator or subagent ever receives it.skills/clean/reference/fan-out-worker-brief.mdgives workers scan templates containing literal${CLAUDE_PLUGIN_ROOT},${CLAUDE_PLUGIN_DATA},${CLAUDE_PROJECT_DIR}and<hook-python>. A worker cannot expand them, because the guard rejects shell expansion. Today the only way to learn the real values is to send a command the guard will deny and read them from the denial text. SKILL.md (around lines 115-117) describes that step for the probe, but the brief does not.--data-rootmust match "the plugin data directory the belt authorized". Inside a subagent, the plugin-level engine gate enforces it, not the frontmatter belt.${CLAUDE_PLUGIN_DATA}/runs/". The guard deniesmkdir, and the engine already creates the parent of--outputitself (write_jsoncallsmkdir(parents=True, exist_ok=True),hygiene.py:285onmain). Following the step as written produces a denied call.Desired addition: the parent fills
hook_python,data_root, the engine path and the run directory into the brief before spawning, and/or the brief documents a one-call bootstrap through the argument-free kill-switch probe. SKILL.md:159 should say "choose a unique run directory path; the engine creates it".Item 3: the gate is the hooks.json
iffilter, and a search string is enough to trip it.The plugin-level registration is
"if": "Bash(*hygiene.py*)", so the substring anywhere in the command routes it to the engine-gate check. Besidesgit showandgrep, agh issue list --search "... hygiene.py ..."was denied too. Related: #4218 (same fault, PowerShell lane).kyle-sexton commentedon Sep 29, 2026
This was generated by AI during triage.
Triage: human-gated
Summary: Four independent items bundled: (1) a model-invocable read-only audit skill, (2)
--auto-splitor a cap error naming the largest children, (3) guard ergonomics (denial names the failing token; allow read-only mentions of the engine name; overlaps #4218), (4) doc/output nits. Confirmed on main: the skill isdisable-model-invocation: true, the run-dir instruction conflicts with the guard, and the guard's*hygiene.py*substring gate fires on a plain grep.Open question: (1) Is a second, model-invocable read-only audit skill wanted, given manual-only was deliberate? (3) How far may the guard relax?
Evidence that settles it: the maintainer's policy decision on (1) and (3)
RECOMMENDED: split into four issues. Item 4 is delegable now: the skill and fan-out brief say the engine creates the run dir, the parent fills hook_python/data_root/engine path into the brief, and
--project-diris optional. Item 3 folds into #4218; the known-owner list overlaps #4004/#4006.kyle-sexton commentedon Sep 29, 2026
Owner decision (2026-09-29): Split this issue into four separate issues now. Items 1 (a model-invocable read-only audit skill) and 3 (relaxing the engine guard for read-only mentions) are decided with evidence: an agent gathers whether a read-only-only skill can be made unable to reach --execute, and which read-only command heads may name the engine, and posts it here. Items 2 and 4 (cap error naming the largest children; docs and output nits) proceed as their own issues.
Next: an agent files the four issues, posts the evidence for items 1 and 3 on this issue, then stops. Because the guard and deletion safety are security-class, the owner makes the final call on items 1 and 3.
kyle-sexton commentedon Sep 30, 2026
Owner decision (2026-09-29) followed: the issue is split into four, and the evidence for items 1 and 3 is below. This comment changes no code.
The four new issues
--auto-split, or name the largest children in the 250k cap error (item 2)--project-dirwording (item 4)Item 1 evidence: can a read-only-only skill be made unable to reach
--execute?Checked at
074e08088(origin/mainwhen checked; nothing underplugins/disk-hygienediffers at the current head). I randestructive_guard.pydirectly with synthetic Bash payloads, in both--mode engine-gate(plugin-level, always on) and--mode belt(skill frontmatter), using the hook's absolute interpreter and the plugin data root.scan --target ... --output <run dir>/s.json --data-root ...preview --snapshot ... --plan ... --data-root ...apply --execute --snapshot ... --plan ... --confirm-tier high --approval-token ... --report ... --data-root ...allowtoapply --execute. It returnsaskin both modes, so the harness must put a permission prompt to the user. This is the only deterministic barrier in front of deletion. It is a property of the guard, not ofdisable-model-invocation, so a model-invocable skill that shells out to the same engine meets the sameask.apply. It admits theapplyshape (asask) whether or not/disk-hygiene:cleanwas invoked; its denial text says so. The current model-invocation ban therefore does not make deletion unreachable: any session can already run thescan,previewandapplyshapes.applyrefuses unless--execute,--confirm-tier(equal to the plan's tier) and--approval-token(equal to the token a freshpreviewcomputes;hygiene.pyaround lines 4549-4556) all hold. A model can derive the token by runningpreview, so the token is a consistency check, not consent. Consent is theaskprompt plus the AskUserQuestion step in SKILL.md.applyshape would not cover subagents. SKILL.md lines 213-221 record that skill-frontmatter hooks do not reach subagents (basis disk-hygiene: small items: recycle-or-permanent choice, absolute protect globs, belt does not reach subagents, SKILL.md understates Bash allowlist #4228, Claude Code 2.1.278, not re-probed here), and the orchestrator case in this issue is a subagent. So "structurally unable to reach--execute" can only be enforced at the plugin level (a new guard mode) or in the engine (a read-only subcommand set).askbehaves when no one can answer (a headless--bgrun, orbypassPermissions). AGENTS.md notes a hookaskcan open a dialog nobody answers. The answer decides whetheraskalone is enough for an unattended orchestrator.What this supports: a model-invocable audit skill that only documents the
scanshapes adds no deletion reach beyond what exists today, but it cannot be made structurally unable to reachapply. The choice for the owner is whether the existingaskplus the token is an acceptable floor, or whether a plugin-level read-only mode must exist first.Item 3 evidence: which read-only command heads may name the engine?
Same method,
engine-gatemode. Thehooks.jsonfilter is"if": "Bash(*hygiene.py*)". In the guard, a mention only defers when it is provably not an invocation (_engine_gate_relevant,destructive_guard.py:688); anything the parser cannot prove is a mention fails closed into the gate.git show origin/main:<relative path to engine>git grep -n foo -- <relative path>,git log -p -- <path>,git diff -- hygiene.pygrep -n foo <relative path>rg foo hygiene.py,echo hygiene.py(bare name)grep,cat,head,rg,cpwith the absolute engine path as operandgit show <relative path> | head -50;after a mention)git show ... > /tmp/x.pygh issue list --search "hygiene.py in:body"gh issue view 5214 --comments | grep hygiene.pysudo grep x hygiene.py/usr/bin/ls <engine path>,/usr/bin/stat <engine path>scanfollowed by| tail -5scanwith--outputbefore--target, or--root-childrenbefore--outputWhat decides the outcome:
;, substitution) or any shape the literal parser cannot prove is a mention.lib/engine_grammar.py:17-25).hygien'e'.py) defers in engine-gate mode, including for theapplyshape (so theasknever fires from this gate), while the belt denies it. Agreporcatallowance would sit next to that gap, but any rule that admits operators after a mention widens the same fail-open class.Final call
The engine guard and deletion safety are security-class, so the final call on items 1 and 3 stays with the owner, and #5214 stays open with
needs-human. I opened no PR and changed no code. #5517 and #5520 proceed as their own issues.feat(disk-hygiene): policy overlay v2 with preselect rules, age thres…
fix(disk-hygiene): name the largest top-level children in the snapsho…
docs(disk-hygiene): fix run-directory, fan-out brief and --project-di…
kyle-sexton commentedon Sep 30, 2026
Owner decision (2026-09-30): close as completed per consensus batch 4 (three read-only researchers, unanimous or majority; record in .work/drain/consensus-proposals-4.json). The owner: "I don't want anything blocked. I want us to keep chewing through the PRs and issues till we're at zero."
feat(disk-hygiene): attended deep inventory with justified KEEP reaso…
fix(disk-hygiene): name the failing token and flag-order rule in the …
refactor(disk-hygiene): share the unreferenced plugin-cache-version l…
feat(guardrails): let user-listed roots through block-root-delete-tar…