You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
disk-hygiene: a .vhd/.vhdx that backs a mounted volume gets no protection and its full size counts as reclaimable #5228
C:\Users\X\DevDrives\Dev.vhdx backs the mounted D: drive. The audit gave it protected_reasons: [] and counted all 18.3 GiB as reclaimable. Deleting it would destroy the D: volume. The 0.28.14 tree has no virtual-disk handling: a case-insensitive search for vhd, virtual disk, mounted volume and backing file across the whole plugin returns zero matches.
Evidence
skills/clean/reference/baseline-policy.json: protections are exact names (.git, Documents, ...) and name globs (OneDrive - *); no disk-image extensions.
skills/clean/scripts/hygiene.py:742-744: the protection sets copied from the baseline are the only built-in ones.
SKILL.md already rejects a "non-root mount target" (line 76), so mounted volumes are a known concept for targets, but not for files that back them.
Expected
.vhd, .vhdx, .vmdk, .vdi, .qcow2, .img and WSL ext4.vhdx are never eligible by name alone.
On Windows, a VHD/VHDX that is currently attached (Get-DiskImage / Get-VHD reports Attached) gets a protected reason naming the mounted drive letter.
Baseline protected_name_globs for image extensions plus an attach probe in the scan that adds protected_reasons: ["attached-virtual-disk:D:"]; count the bytes under unverifiable rather than reclaimable.
Related: #1804 (closed, cloud-sync placeholders: same byte-accounting shape), #984 (closed, non-OS volumes such as Dev Drive), #1806 (bytes cannot express "unknown").
Windows Get-DiskImage route on melo-desk-001: the attached VHDX names its drive letter
I ran this read-only on melo-desk-001's native Windows lane, as the console user KyleSexton, not elevated. The host runs Windows 11 Pro 10.0.26200 with Windows PowerShell 5.1.26100.9444. The plugin is disk-hygiene 0.34.3 from the installed cache, marketplace commit a96488c31, which contains #5531. Nothing was attached, detached, mounted, deleted or moved.
1. What is attached and present
The script is .work/fleet-probes/5228.ps1 on the WSL side, run with powershell.exe -NoProfile.
Get-Disk | ? BusType -eq 'File Backed Virtual' returns one disk: disk 1, Msft Virtual Disk, Location C:\Users\KyleSexton\DevDrives\Dev.vhdx, 1024 GB, Online. Its partition 2 is D: (ReFS, label Dev).
wsl.exe -l -v shows Ubuntu-26.04 and docker-desktop, both Running.
I searched every fixed drive for *.vhd *.vhdx *.vmdk *.vdi *.qcow2 *.img with cmd /c dir /s /b /a-d. C: took 79 s and D: took 15 s. The search found 10 images. None are .vmdk, .vdi or .qcow2, and one is an .img.
2. The engine's probe, run verbatim on each image
I took the WINDOWS_DISK_IMAGE_PROBE text from hygiene.py and ran it the same way the engine does:
encoded as UTF-16LE base64 and passed to powershell.exe -NoProfile -NonInteractive -EncodedCommand
with DISK_HYGIENE_IMAGE=<path> set
with the engine's filter applied to the output: drop \\?\ lines and strip the trailing \
Image
Size MB
State on this host
Probe stdout
rc
Reason the engine adds
C:\Users\KyleSexton\DevDrives\Dev.vhdx
18,724
backs D:
attached, D:\, \\?\Volume{46276f5d-…}\
0
attached-virtual-disk:D:
%LOCALAPPDATA%\wsl\{673ac4db-…}\ext4.vhdx
105,136
root disk of the Running Ubuntu-26.04 (Lxss BasePath); this probe ran from that distro
detached
0
none (only virtual-disk)
%LOCALAPPDATA%\Docker\wsl\disk\docker_data.vhdx
37,139
Docker Desktop data disk, docker-desktop Running
detached
0
none
%LOCALAPPDATA%\Docker\wsl\main\ext4.vhdx
96
Docker Desktop; in use not confirmed
detached
0
none
%LOCALAPPDATA%\Temp\E065C16A-…\swap.vhdx
2,692
WSL2 swap disk, WSL running
detached
0
none
C:\Program Files\WSL\system.vhd
357
detached
0
none
C:\Program Files\WSL\tools\modules.vhd
159
detached
0
none
C:\Program Files\WSL\tools\initrd.img
2.7
not a disk image
Get-DiskImage : The file or directory is corrupted and unreadable.
3. The engine itself, through /disk-hygiene:clean in a Windows-lane session
I ran one headless turn: claude.exe -p --permission-mode auto "/disk-hygiene:clean Read-only snapshot only ... --max-depth 1 ...". It used Claude Code 2.1.286, took 6 turns and 38 s, and cost $0.52.
its children_rollup row has reclaimable_local_bytes: 0
The second target, C:/Users/KyleSexton/AppData/Local/wsl/{673ac4db-a2e3-459e-882c-1ec71b253aa2}, was refused twice, once in double quotes and once in single quotes, with "Disk-hygiene engine gate: this specific engine invocation is gated". The only difference from the allowed call is the {…} in the path. That suggests the gate rejects a target containing braces, though the message names no reason. That folder is where WSL keeps each distro's ext4.vhdx, so the engine could not show ext4.vhdx at engine level.
To get an engine-level reading for an image the probe reports detached, I ran a second turn from a fresh folder. The prompt was the same, and the target was the brace-free C:\Users\KyleSexton\AppData\Local\Docker\wsl\disk. It took 4 turns and 20 s, and cost $0.45. Its snapshot (.../runs/20260930-docker-wsl-disk/snapshot.json) records docker_data.vhdx like this:
protected_reasons: ["virtual-disk"], with no attached-* reason
size_qualifiers: ["virtual-disk"]
logical_size: 38943064064
its children_rollup row has reclaimable_local_bytes: 0
target_reclaimable_local_bytes: 0
Against the issue's Expected list
Image extensions are never eligible by name alone. Met on Windows. Dev.vhdx and docker_data.vhdx both carry the virtual-disk hard protection.
An attached VHD/VHDX names its mounted drive letter. Met, in the engine's own snapshot: attached-virtual-disk:D:.
A detached image's bytes are not reclaimable. Met at engine level: docker_data.vhdx (probe: detached) is under the virtual-disk qualifier with 0 reclaimable bytes.
Neither of these fails a criterion as the issue words them.
A running distro's disk reads as detached.Get-DiskImage reports detached for the root ext4.vhdx of the Running Ubuntu-26.04, the distro this probe ran from, so that disk is certainly in use by the WSL2 VM. It reports the same for docker_data.vhdx and WSL's swap.vhdx. A read-only [IO.File]::Open test could not tell in-use from idle: every image opened for read, Dev.vhdx included. The engine therefore adds no attached reason for these disks. The virtual-disk protection and the 0 reclaimable bytes still apply, so nothing becomes deletable. The issue defines "attached" as Get-DiskImage reporting Attached, which these disks do not. The consequence is that a snapshot cannot tell an in-use WSL disk from an orphan, which matters for the swap low hint.
The engine gate refuses a brace-bearing --target. As described in section 3, the gate denies the folder WSL keeps each distro's disk in.
reference/safety-model.md still records Get-DiskImage as "unobserved on Windows". It is now observed on melo-desk-001 (2026-09-30), with the results above.
Follow-ups that do not block this issue (Kyle may split them into new issues)
Item 1: document it as a known limit, or add a WSL-aware attach check, for example running distros mapped to their Lxss BasePath. This also matters for the optional swap low hint.
Item 2: fix the engine gate so it accepts a brace-bearing --target.
Update the Get-DiskImage verification record in safety-model.md to "observed on Windows".
Every required Expected item is now met at engine level, so I am closing this as completed. Raw output is in .work/fleet-probes/ on melo-desk-001's WSL side: 5228-probe.txt, 5228-engine.jsonl and 5228-engine2.jsonl.
Activity
feat(disk-hygiene): report the volume an attached disk image backs, f…
chore(disk-hygiene): release 0.30.0
fix(disk-hygiene): record the Get-DiskImage basis and probe a disk im…
fix(disk-hygiene): read a WSL image with no loop device as unverified…
fix(disk-hygiene): protect Hyper-V checkpoint disks (.avhd, .avhdx) a…
docs(disk-hygiene): rewrap the virtual-disk changelog entry
feat(disk-hygiene): protect virtual-disk images and report the volume…
kyle-sexton commentedon Oct 1, 2026
Windows Get-DiskImage route on melo-desk-001: the attached VHDX names its drive letter
I ran this read-only on melo-desk-001's native Windows lane, as the console user
KyleSexton, not elevated. The host runs Windows 11 Pro 10.0.26200 with Windows PowerShell 5.1.26100.9444. The plugin is disk-hygiene 0.34.3 from the installed cache, marketplace commita96488c31, which contains #5531. Nothing was attached, detached, mounted, deleted or moved.1. What is attached and present
The script is
.work/fleet-probes/5228.ps1on the WSL side, run withpowershell.exe -NoProfile.Get-Disk | ? BusType -eq 'File Backed Virtual'returns one disk: disk 1,Msft Virtual Disk, LocationC:\Users\KyleSexton\DevDrives\Dev.vhdx, 1024 GB, Online. Its partition 2 isD:(ReFS, labelDev).wsl.exe -l -vshowsUbuntu-26.04anddocker-desktop, both Running.*.vhd *.vhdx *.vmdk *.vdi *.qcow2 *.imgwithcmd /c dir /s /b /a-d. C: took 79 s and D: took 15 s. The search found 10 images. None are.vmdk,.vdior.qcow2, and one is an.img.2. The engine's probe, run verbatim on each image
I took the
WINDOWS_DISK_IMAGE_PROBEtext fromhygiene.pyand ran it the same way the engine does:powershell.exe -NoProfile -NonInteractive -EncodedCommandDISK_HYGIENE_IMAGE=<path>set\\?\lines and strip the trailing\C:\Users\KyleSexton\DevDrives\Dev.vhdxD:attached,D:\,\\?\Volume{46276f5d-…}\attached-virtual-disk:D:%LOCALAPPDATA%\wsl\{673ac4db-…}\ext4.vhdxUbuntu-26.04(LxssBasePath); this probe ran from that distrodetachedvirtual-disk)%LOCALAPPDATA%\Docker\wsl\disk\docker_data.vhdxdocker-desktopRunningdetached%LOCALAPPDATA%\Docker\wsl\main\ext4.vhdxdetached%LOCALAPPDATA%\Temp\E065C16A-…\swap.vhdxdetachedC:\Program Files\WSL\system.vhddetachedC:\Program Files\WSL\tools\modules.vhddetachedC:\Program Files\WSL\tools\initrd.imgGet-DiskImage : The file or directory is corrupted and unreadable.virtual-disk-attach-unverifiedC:\Program Files\Docker\Docker\resources\wsl\ext4.vhdxdetachedC:\Program Files\Docker\Docker.backup\resources\wsl\ext4.vhdxdetachedEach probe took 741-1000 ms.
3. The engine itself, through
/disk-hygiene:cleanin a Windows-lane sessionI ran one headless turn:
claude.exe -p --permission-mode auto "/disk-hygiene:clean Read-only snapshot only ... --max-depth 1 ...". It used Claude Code 2.1.286, took 6 turns and 38 s, and cost $0.52.The skill ran this scan:
The snapshot entry for
Dev.vhdx:protected_reasons: ["attached-virtual-disk:D:", "virtual-disk"]size_qualifiers: ["virtual-disk"]logical_size: 19633537024children_rolluprow hasreclaimable_local_bytes: 0The second target,
C:/Users/KyleSexton/AppData/Local/wsl/{673ac4db-a2e3-459e-882c-1ec71b253aa2}, was refused twice, once in double quotes and once in single quotes, with "Disk-hygiene engine gate: this specific engine invocation is gated". The only difference from the allowed call is the{…}in the path. That suggests the gate rejects a target containing braces, though the message names no reason. That folder is where WSL keeps each distro'sext4.vhdx, so the engine could not showext4.vhdxat engine level.To get an engine-level reading for an image the probe reports
detached, I ran a second turn from a fresh folder. The prompt was the same, and the target was the brace-freeC:\Users\KyleSexton\AppData\Local\Docker\wsl\disk. It took 4 turns and 20 s, and cost $0.45. Its snapshot (.../runs/20260930-docker-wsl-disk/snapshot.json) recordsdocker_data.vhdxlike this:protected_reasons: ["virtual-disk"], with noattached-*reasonsize_qualifiers: ["virtual-disk"]logical_size: 38943064064children_rolluprow hasreclaimable_local_bytes: 0target_reclaimable_local_bytes: 0Against the issue's Expected list
Dev.vhdxanddocker_data.vhdxboth carry thevirtual-diskhard protection.attached-virtual-disk:D:.docker_data.vhdx(probe:detached) is under thevirtual-diskqualifier with 0 reclaimable bytes.lowhint. Optional ("can be"), not part of feat(disk-hygiene): protect virtual-disk images and report the volume an attached image backs #5531, and not checked.Found
Neither of these fails a criterion as the issue words them.
detached.Get-DiskImagereportsdetachedfor the rootext4.vhdxof the RunningUbuntu-26.04, the distro this probe ran from, so that disk is certainly in use by the WSL2 VM. It reports the same fordocker_data.vhdxand WSL'sswap.vhdx. A read-only[IO.File]::Opentest could not tell in-use from idle: every image opened for read,Dev.vhdxincluded. The engine therefore adds no attached reason for these disks. Thevirtual-diskprotection and the 0 reclaimable bytes still apply, so nothing becomes deletable. The issue defines "attached" asGet-DiskImagereporting Attached, which these disks do not. The consequence is that a snapshot cannot tell an in-use WSL disk from an orphan, which matters for the swaplowhint.--target. As described in section 3, the gate denies the folder WSL keeps each distro's disk in.reference/safety-model.mdstill recordsGet-DiskImageas "unobserved on Windows". It is now observed on melo-desk-001 (2026-09-30), with the results above.Follow-ups that do not block this issue (Kyle may split them into new issues)
BasePath. This also matters for the optional swaplowhint.--target.Get-DiskImageverification record insafety-model.mdto "observed on Windows".Every required Expected item is now met at engine level, so I am closing this as completed. Raw output is in
.work/fleet-probes/on melo-desk-001's WSL side:5228-probe.txt,5228-engine.jsonland5228-engine2.jsonl.docs(disk-hygiene): record that Get-DiskImage reads running WSL disks…
fix(disk-hygiene): accept braces inside quoted words in the engine ga…