# zep4yrs/disksift architecture

> Architecture diagram of the GitHub repository zep4yrs/disksift, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zep4yrs/disksift
- Repository: https://github.com/zep4yrs/disksift

## Overview

DiskSift is a Tauri desktop disk-usage explorer and safety-focused cleanup tool. The main workflow is scan a volume, explore its size map/tree, classify directories, then clean or migrate selected data and review undo records. The README also documents AI advice, script management, Steam inspection, exclusions, and scheduled safe-only patrols. Sampled source confirms scanner, advisor, Steam inspection, monitoring, and migration behavior; wiring for several Rust commands and unsampled subsystems is represented only where the README documents it.

Main entry points: [`apps/desktop/src/App.tsx`](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/App.tsx) (DiskSift workbench), [`apps/desktop/src/api.ts`](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/api.ts) (Desktop API), [`crates/executor/src/lib.rs`](https://github.com/zep4yrs/disksift/blob/main/crates/executor/src/lib.rs) (Protected executor), [`crates/scanner/src/lib.rs`](https://github.com/zep4yrs/disksift/blob/main/crates/scanner/src/lib.rs) (Disk scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_explore["Scan and Explore"]
  node_app["DiskSift workbench<br/>[App.tsx]"]
  node_bridge["Desktop API<br/>[api.ts]"]
  node_scanner["Disk scanner<br/>[lib.rs]"]
  node_mft["NTFS MFT scan<br/>[mft.rs]"]
  node_views["Tree and treemap<br/>[TreeView.tsx]"]
end

subgraph group_decide["Triage and Scripts"]
  node_triage["Rule triage<br/>[triage.ts]"]
  node_ai_triage["AI triage<br/>[triage-ai.ts]"]
  node_scaffolds["Cleanup scripts<br/>[lib.rs]"]
  node_exclude["Exclusion rules<br/>[lib.rs]"]
end

subgraph group_actions["Safe File Actions"]
  node_executor["Protected executor<br/>[lib.rs]"]
  node_move["Migration engine<br/>[move_engine.rs]"]
  node_records["Undo records<br/>[RecordsView.tsx]"]
  node_patrol["Scheduled patrol<br/>[auto_patrol.rs]"]
end

subgraph group_integrations["Integrations"]
  node_advisor["AI advisor client<br/>[advisorClient.ts]"]
  node_steam["Steam inspector<br/>[lib.rs]"]
end

subgraph group_state["Monitoring and State"]
  node_monitor["USN monitor<br/>[lib.rs]"]
  node_monitor_hook["Monitor event hook<br/>[useMonitor.ts]"]
  node_cache["Triage cache<br/>[triage-cache.ts]"]
end

node_user(("Desktop user"))
node_provider(("AI providers"))
node_trash["Recycle bin"]
node_filesystem["Local volumes"]
node_scheduler(("Windows scheduler"))

node_user -->|"uses"| node_app
node_app -->|"requests operations"| node_bridge
node_bridge -->|"scans volume"| node_scanner
node_scanner -.->|"uses NTFS path"| node_mft
node_scanner -->|"reads metadata"| node_filesystem
node_app -->|"renders scan tree"| node_views
node_app -->|"gets rule verdicts"| node_triage
node_app -->|"starts batch triage"| node_ai_triage
node_ai_triage -->|"requests classification"| node_advisor
node_advisor -->|"sends metadata prompts"| node_provider
node_app -->|"loads and manages scripts"| node_scaffolds
node_triage -->|"uses script rules"| node_scaffolds
node_scanner -->|"prunes excluded paths"| node_exclude
node_app -->|"submits cleanup plan"| node_bridge
node_bridge -->|"dispatches cleanup"| node_executor
node_executor -->|"checks protected paths"| node_exclude
node_executor -->|"moves deleted items"| node_trash
node_executor -->|"writes undo ledger"| node_records
node_app -->|"requests migration"| node_bridge
node_bridge -->|"dispatches migration"| node_move
node_move -->|"copies and verifies"| node_filesystem
node_scheduler -->|"starts safe-only run"| node_patrol
node_patrol -->|"dispatches cleanup"| node_executor
node_app -->|"subscribes to events"| node_monitor_hook
node_monitor_hook -->|"receives USN events"| node_monitor
node_monitor -->|"watches NTFS journal"| node_filesystem
node_monitor_hook -->|"applies tree deltas"| node_app
node_app -->|"reads and writes verdicts"| node_cache
node_app -->|"requests inventory"| node_steam
node_steam -->|"reads Steam metadata"| node_filesystem

click node_app "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/App.tsx"
click node_bridge "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/api.ts"
click node_scanner "https://github.com/zep4yrs/disksift/blob/main/crates/scanner/src/lib.rs"
click node_mft "https://github.com/zep4yrs/disksift/blob/main/crates/scanner/src/mft.rs"
click node_views "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/components/TreeView.tsx"
click node_triage "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/triage.ts"
click node_ai_triage "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/triage-ai.ts"
click node_advisor "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/advisorClient.ts"
click node_scaffolds "https://github.com/zep4yrs/disksift/blob/main/crates/scaffold/src/lib.rs"
click node_exclude "https://github.com/zep4yrs/disksift/blob/main/crates/excludes/src/lib.rs"
click node_executor "https://github.com/zep4yrs/disksift/blob/main/crates/executor/src/lib.rs"
click node_move "https://github.com/zep4yrs/disksift/blob/main/crates/executor/src/move_engine.rs"
click node_records "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/components/RecordsView.tsx"
click node_patrol "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src-tauri/src/auto_patrol.rs"
click node_monitor "https://github.com/zep4yrs/disksift/blob/main/crates/monitor/src/lib.rs"
click node_monitor_hook "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/useMonitor.ts"
click node_cache "https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/triage-cache.ts"
click node_steam "https://github.com/zep4yrs/disksift/blob/main/crates/steam-inspector/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_bridge,node_scanner,node_mft,node_views,node_user toneBlue
class node_triage,node_ai_triage,node_scaffolds,node_exclude toneAmber
class node_executor,node_move,node_records,node_patrol toneMint
class node_advisor,node_steam,node_scheduler toneRose
class node_monitor,node_monitor_hook,node_cache,node_provider,node_trash,node_filesystem toneIndigo
```

## Components

### Scan and Explore

- [DiskSift workbench](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/App.tsx): `apps/desktop/src/App.tsx`
- [Desktop API](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/api.ts): `apps/desktop/src/api.ts`
- [Disk scanner](https://github.com/zep4yrs/disksift/blob/main/crates/scanner/src/lib.rs): `crates/scanner/src/lib.rs`
- [NTFS MFT scan](https://github.com/zep4yrs/disksift/blob/main/crates/scanner/src/mft.rs): `crates/scanner/src/mft.rs`
- [Tree and treemap](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/components/TreeView.tsx): `apps/desktop/src/components/TreeView.tsx`

### Triage and Scripts

- [Rule triage](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/triage.ts): `apps/desktop/src/triage.ts`
- [AI triage](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/triage-ai.ts): `apps/desktop/src/triage-ai.ts`
- [Cleanup scripts](https://github.com/zep4yrs/disksift/blob/main/crates/scaffold/src/lib.rs): `crates/scaffold/src/lib.rs`
- [Exclusion rules](https://github.com/zep4yrs/disksift/blob/main/crates/excludes/src/lib.rs): `crates/excludes/src/lib.rs`

### Safe File Actions

- [Protected executor](https://github.com/zep4yrs/disksift/blob/main/crates/executor/src/lib.rs): `crates/executor/src/lib.rs`
- [Migration engine](https://github.com/zep4yrs/disksift/blob/main/crates/executor/src/move_engine.rs): `crates/executor/src/move_engine.rs`
- [Undo records](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/components/RecordsView.tsx): `apps/desktop/src/components/RecordsView.tsx`
- [Scheduled patrol](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src-tauri/src/auto_patrol.rs): `apps/desktop/src-tauri/src/auto_patrol.rs`

### Integrations

- [AI advisor client](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/advisorClient.ts): `apps/desktop/src/advisorClient.ts`
- [Steam inspector](https://github.com/zep4yrs/disksift/blob/main/crates/steam-inspector/src/lib.rs): `crates/steam-inspector/src/lib.rs`

### Monitoring and State

- [USN monitor](https://github.com/zep4yrs/disksift/blob/main/crates/monitor/src/lib.rs): `crates/monitor/src/lib.rs`
- [Monitor event hook](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/useMonitor.ts): `apps/desktop/src/useMonitor.ts`
- [Triage cache](https://github.com/zep4yrs/disksift/blob/main/apps/desktop/src/triage-cache.ts): `apps/desktop/src/triage-cache.ts`

### Other components

- **Desktop user**
- **AI providers**
- **Recycle bin**
- **Local volumes**
- **Windows scheduler**

## Connections

- Desktop user → DiskSift workbench: uses
- DiskSift workbench → Desktop API: requests operations
- Desktop API → Disk scanner: scans volume
- Disk scanner → NTFS MFT scan: uses NTFS path
- Disk scanner → Local volumes: reads metadata
- DiskSift workbench → Tree and treemap: renders scan tree
- DiskSift workbench → Rule triage: gets rule verdicts
- DiskSift workbench → AI triage: starts batch triage
- AI triage → AI advisor client: requests classification
- AI advisor client → AI providers: sends metadata prompts
- DiskSift workbench → Cleanup scripts: loads and manages scripts
- Rule triage → Cleanup scripts: uses script rules
- Disk scanner → Exclusion rules: prunes excluded paths
- DiskSift workbench → Desktop API: submits cleanup plan
- Desktop API → Protected executor: dispatches cleanup
- Protected executor → Exclusion rules: checks protected paths
- Protected executor → Recycle bin: moves deleted items
- Protected executor → Undo records: writes undo ledger
- DiskSift workbench → Desktop API: requests migration
- Desktop API → Migration engine: dispatches migration
- Migration engine → Local volumes: copies and verifies
- Windows scheduler → Scheduled patrol: starts safe-only run
- Scheduled patrol → Protected executor: dispatches cleanup
- DiskSift workbench → Monitor event hook: subscribes to events
- Monitor event hook → USN monitor: receives USN events
- USN monitor → Local volumes: watches NTFS journal
- Monitor event hook → DiskSift workbench: applies tree deltas
- DiskSift workbench → Triage cache: reads and writes verdicts
- DiskSift workbench → Steam inspector: requests inventory
- Steam inspector → Local volumes: reads Steam metadata
