# Void → Disk Doctor integration

Disk Doctor 0.6.0 reuses Void 1.3.0 at commit `daebcaa13988235d62f18b90fe80565caebd9687`. The pinned source is in `vendor/void`; its MIT licence and attribution are retained. This document distinguishes the reused functionality from its desktop presentation.

## Feature mapping

| Void capability | Disk Doctor implementation |
| --- | --- |
| Shared machine installation | Bundled Python + Rust; CLI, MCP clients and a Pi skill reuse one installed runtime and policy/history |
| Bounded provider growth / open-writer diagnostics | Existing Python helper extended; CLI `diagnose` and MCP `diagnostics` share this owner; current-user Linux descriptors only |
| All 15 ecosystem scanners | Same Rust scanner registry and modules; `scan` and MCP `scan` |
| Results, sizes, staleness, risks and offered actions | CLI JSON/table output; MCP scan summaries and `explain_item` |
| Search/filter/select cleanup | Ecosystem, artifact kind, age, path, item, byte limit; exact action label |
| Preview and confirmation | Saved plan with exact entries, 1-hour expiry; user approval required |
| Caution and Danger actions | Caution needs plan approval; Danger also needs exact typed paths |
| Git worktrees, safe removal, branch pruning and artifact trimming | Original scanners, Git checks and executor; `worktrees` and plans |
| Agent logs/transcripts/editor metadata; SQLite VACUUM | Original agent scanner/actions; `agents`, plans, `usage` |
| Models, orphaned blobs, duplicate files | Original scanners/deduplication/executor; `models` and plans |
| Stale projects and recoverable deletion | Original project checks and OS Trash; explicit approved plans |
| History screen | Local persisted receipts through CLI/MCP `history` |
| Settings screen | Same typed `AppConfig`; CLI/MCP settings reader and confirmed merge |
| Guard disk pressure and notifications | Same thresholds/transition rules; `guard check/tick`, hook warnings and persisted state |
| Scheduled automatic policies | Native user scheduler calls the existing helper/Guard; same policy selection, Safe cap and executor; cleanup remains opt-in |
| Claude startup/worktree hook helpers | Upstream helpers retained in engine; plugin owns startup hooks and an opt-in Claude WorktreeRemove handler; `native-hook` bridge checks pause and enabled trim policies |
| Sandbox and developer fixtures | Same `--home`, confined scan, fake-home seeder and injectable Trash |
| Signed updates | Upstream signature/manifest verification stays in core; plugin release owns binary distribution; upstream self-replacement blocked |
| GPUI window, tray, sidebar, reveal-in-Finder, desktop harness | Not shipped: coding-agent tools and local CLI are the requested interface |

The desktop application is not a second implementation to maintain. Its scanner/actions/config/history logic comes from the shared core, which is the component reused here. Native app packaging, tray integration and GUI gestures are outside the plugin surface.

## Local changes to upstream

- Keep engine settings, plans and history separate from an existing Void install.
- Bundle the existing helper and engine with Python for machine releases. Agent registrations point to that runtime; periodic checks do not require an agent. A fresh machine setup starts read-only monitoring.
- Keep growth/volume/process measurement in the existing helper. The native CLI/MCP invokes that exact launcher without accepting arbitrary paths; sandbox homes skip host process inspection.
- Retain worktrees with ignored files at scan and execution time. Qualified build trimming remains a separate reviewed action; a later scan can offer removal after ignored files are gone.
- Expose desktop settings/history/Guard through CLI and MCP; no new hosted service.
- Sandbox plans exclude external cleanup commands, which can follow ambient environment/configuration outside the sandbox. Filesystem, Git and Trash checks remain available.
- Choose native uv prune in a default Safe plan. Full native clean is Caution, raw cache-directory removal Danger. Commands target the scanned uv cache explicitly, offline and without ambient uv configuration.
- Offer exact scanner action labels so users can choose more than the default action.
- Bring desktop-style Danger confirmation into CLI/MCP using an exact path for every Danger entry. The skill requires the user to type it; tool arguments are not independent proof of consent.
- Serialize apply/settings/Guard with an OS lock. Consume plans before execution to prevent replay after a process crash. Check history before cleanup so corrupt receipts cannot silently be replaced.
- Treat moving into Trash as zero reclaimed bytes in reports/history. Logical file deletion sizes and command estimates still do not guarantee a matching increase in free blocks.
- Preserve plugin pause/cleanup-off controls. The legacy qualified uv owner remains the only automatic uv pruner; Guard excludes uv.
- Keep automatic policies off on upgrade. A recurring minute tick respects Guard's configured interval. Growth sampling runs at most once per minute; deeper factor inventory stays at 15 minutes.
- Do not let upstream self-update overwrite the fork. Downloaded/bundled engine bytes are pinned by the helper; explicit local source builds record their own digest.

The [0.6.3 review workflow](RELEASE_0.6.3.md) adds paged scan snapshots, action-based
review groups and caller-provided reasoning retained through plans and receipts.
It uses the existing agent model; it does not add a model backend or arbitrary
file deletion. The release note maps the ideas from Mint, Mole and unix-disk-mcp.

## Code paths

```text
Shared machine installation
  ├─ CLI / generic MCP / registered clients → existing helper → Rust CLI/MCP
  ├─ one policy, history and operation lock across clients
  └─ native user scheduler → existing maintain/sweep → enabled policies only

Legacy coding agent plugin
  ├─ skill → inspect / explain / ask for exact approval
  ├─ MCP → Python launcher → Rust CLI MCP server
  │                          ├─ scanner registry → typed artifact/action results
  │                          ├─ saved plan → confirmation → shared executor
  │                          └─ settings / history / Guard
  └─ trusted hooks → stable helper → existing cron tick
                                     ├─ old owned-temp expiry / qualified uv pruning
                                     └─ Guard → enabled Safe policies → same executor
```

Normal data stays on the developer machine. The agent may receive tool outputs through its own model provider; Disk Doctor does not add telemetry or require the Lupable server. The helper's owner/hash checks are integrity checks, not an OS sandbox. The native engine runs with the developer's permissions.

## Verification

The original release checks ran on Linux x86_64, with synthetic home directories and disposable files. The Rust suite covers scanners, safety gates, Git changes after scan, unpushed/locked worktrees, projects, models, deduplication, saved plans, MCP and update signatures. Added tests cover exact Danger confirmation, consumed plans, settings persistence and validation, corrupted-history refusal, accurate Trash accounting, and enabled Guard policies respecting prior pause/cleanup revocation.

The original 0.3.1 startup recording is retained and labelled with its actual version; it is not evidence for the new engine. The [0.6.0 release handoff](RELEASE_0.6.0.md) records the new installation flow and qualification limits. Native acceptance now also passed on Apple Silicon and Intel macOS, plus Linux ARM64, including a real scheduled run and the frozen diagnostics callback. A separate fresh Mac runner installed from the public HTTPS command and exercised MCP settings successfully. Mac packaging uses one executable to contain framework directory links and verifies the engine against its final processed Mach-O bytes. Windows native Rust tests are failing, so Windows packages remain unreleased. Cursor/Gemini/Windsurf/Pi native applications, every external package manager and live Docker cleanup remain outside this qualification. Native CI jobs must pass before their packages enter a released installer.
