Skip to content

Gardener

Virgile Thonnier edited this page Aug 29, 2026 · 2 revisions

Gardener

Folder trees rot. Downloads fills up, the same file ends up in three places, folders nest ten levels deep, empty directories linger. The gardener audits that structure and reports it — as findings, never as silent changes.

It is read-only and deterministic: fast Rust heuristics over the catalog and the filesystem, no LLM call, no cost. Acting on a finding is a separate, explicit step.

Two faces

Passive — health badges. A light background thread revisits every indexed root periodically (first pass ~45 s after launch, then every 5 minutes) and caches a health report. The sidebar shows a badge per root: ok, info, or warn, with a one-line headline like "3 duplicates · cluttered (52)".

Active — Analyze. Run Analyze on any folder for the full report of that subtree.

What it looks for

Finding Rule
Exact duplicates Files sharing the same SHA-256 content_hash, grouped.
Cluttered folder More than 40 files sitting directly in the folder, unsorted.
Excessive depth A tree deeper than 6 levels.
Empty folders Directories containing nothing.

Duplicate detection is essentially free: it reuses the hash already computed during indexing, so it is a database query, not a disk scan.

The report also returns the raw numbers — file count, max depth, the list of empty directories, the duplicate groups — so you can judge for yourself rather than trusting a verdict.

Acting on a finding

Findings are inert. To act on one, hand it to the assistant:

"Delete the empty folders in this directory" — or — "keep one copy of each duplicate and remove the rest"

You then get a normal Dry-Run plan: a Before → After diff, per-operation checkboxes, Approve or Discard. Deletions go to SenseTree's local trash, and apply is transactional with rollback.

This indirection is deliberate. Duplicate files are frequently intentional — a backup, a copy sent to someone, an export. An autonomous cleaner would be wrong often enough to be dangerous.

Bounds

  • The walk is capped at 200 000 entries per root, so a pathological tree cannot hang the thread.
  • Analysis is pure observation: no file is opened, moved or modified.
  • Depth and clutter thresholds are fixed constants, identical in the background audit and in Analyze.

Related commands

Command Role
analyze_directory Full report for one folder.
gardener_health The cached per-root report behind the sidebar badges.

Clone this wiki locally