AGENT SKILL

disk-magician

Use when diagnosing disk capacity or growth and when previewing repository-gated cache, temp, or worktree cleanup.

License 许可
MIT
最近更新
2026-11-12
Stars
★ 6
Forks
0

01 前言 Front Matter

name
disk-magician
description
Use when diagnosing disk capacity or growth and when previewing repository-gated cache, temp, or worktree cleanup.

03 SKILL.md 正文

Disk Magician — Claude Skill

This skill teaches Claude how to use disk_magician to audit disk space, identify growth regressions, and perform cleanups.

Measurement rule

All Disk Magician measurements, reports, cleanup previews, and candidate scans follow ../disk-root-cause/SKILL.md § Mandatory 100 MiB directory descent. A large directory total or prefix bucket locates where to investigate; it cannot stand in for child measurements, leaf age, or reclaim eligibility. Candidate size filters such as DISK_MAGICIAN_SCRATCH_MIN_KB only prioritize already traversed candidates; they never limit descent.

Skill Integration & Commands

  • Which procedure: a quick capacity check runs the zero-du triage in ../disk-audit/SKILL.md. A reclaimable-amount estimate, root-cause investigation, or cleanup-target decision runs the full forensic procedure in ../disk-root-cause/SKILL.md. Do not stop at a quick check when the request needs attribution. On the quick path, escalate when precomputed data is missing or its owner reports it stale or incomplete; follow the probe result rather than a fixed interval.

  • Default forensic diagnosis (attribution only): For a root-cause, floor, growth, or reclaim-estimate request, follow ../disk-root-cause/SKILL.md after the quick probes. Run the full three-lane diskm audit unless a current report proves complete 100 MiB leaf coverage for every requested path and period; directory-aggregate snapshots do not prove this coverage. Use resolved portions, name unfinished paths, and do not estimate reclaim from incomplete paths.

  • Cleanup previews: Use the canonical preview interfaces before choosing a cleanup target:

    diskm clean --dry-run
    diskm clean-all --dry-run
    diskm worktree-hygiene
    

    worktree-hygiene is report-only by default. For a narrower preview, use the selected diskm cleanup command with its documented dry-run mode.

    Never report the cleanup stack exhausted while free space remains below target. If a run reports 0 B reclaimed, inspect the per-target skip reasons (such as kept:lease-busy, kept:recent-activity, or kept:admin-unknown when emitted) and the current lock holder before concluding there are no eligible targets.

Safety Constraints & Guardrails

  • Recency: Follow each canonical cleanup command's current per-tool mtime, activity, lease, owner, and Git safety rules. Do not add a 14-day floor or override an owner's rule.
  • Action gates: A live request or existing standing authorization covers the same action, targets, and outcome across its steps. Complete that work with the canonical diskm command and satisfy its documented gates. Flags such as WORKTREE_APPROVED=1 activate a command gate; they do not grant authority. Ask before expanding to new actions or targets not covered by the request.
  • Never-delete list: Never delete, quarantine, truncate, or prune ~/.codex/sessions, ~/.codex/sessions_archive/, ~/.codex/state*.sqlite, ~/.codex/log, or ~/.claude/projects by any command. The normal cleanup path is not an exception. Read-only metadata measurement may follow the 100 MiB descent rule without reading file contents.

04 同仓库更多 Skills