Skip to content

disk-hygiene: scan has no output-verbosity flag (~63,000 tokens of children_rollup in one run) #3352

Description

@kyle-sexton

plugins/disk-hygiene v0.20.21. Split out of the audit umbrella. F7, medium.

Problem

No subcommand has an output-verbosity flag. Every scan emits its full children_rollup — one row per immediate child, with every field — regardless of what the caller needs.

A --max-depth 1 scan of a user home directory produced roughly 9,000 tokens of JSON (estimated from output size, not counted). The audited run performed seven such scans, so on the order of 63,000 tokens went into context to surface a frontier the caller then summarized in a paragraph.

The pipe rejection is correct — do not relax it

The obvious workaround is to trim at the call site, and the Bash guard rejects it: pipes, redirects, and shell operators all fail closed. That rejection is load-bearing and should be kept. Shell expansions are exactly the surface a deny-by-default lane exists to close, and an exception for | head is an exception for everything that can be spelled like | head.

So the fix belongs in the engine, not the guard.

Suggested fix

Add --quiet (or --summary) to scan, emitting the decision-relevant fields and omitting the per-child detail:

  • status, target, entries, hinted_entries, unhinted_entries
  • empty_directory_count
  • target_logical_bytes, target_reclaimable_local_bytes
  • truncated_paths
  • errors, policy_sources, os_autoclean

The full children_rollup stays available by default and in the snapshot file on disk, which is where a caller that needs per-child detail should read it — the snapshot is written regardless, so emitting it to stdout as well is pure duplication for the common case.

Worth noting the same argument applies, less urgently, to handoff-verify, whose note block is re-emitted verbatim on every single-path call. On a 17-path run that note was printed 17 times.

Related

Umbrella: #3347. The per-path round-trip that multiplies this: the --path issue filed alongside this one.

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.priority: mediumReal value, no hard deadline; normal backlog flow.status: readyTriaged, unblocked, and fully specified; eligible to pick up.work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions