agentleFS
wintermeyerwintermeyer/heinzel/.claude/skills/heinzel-macos-cleanup/SKILL.md

heinzel-macos-cleanup

Skill94 starsChanged 2 months agoMITView on GitHub

Find and remove leftovers of uninstalled apps on a

  • Deletes or force-pushes

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Never run automatically: Only on explicit user request.

    line 22
  2. Very specific:

    If the probe fails, do not install anything.

    line 39
  3. Very specific:

    Ask for the user if the server memory names none.

    line 57
  4. Very specific:

    Remove: only what the user approved, as described in references/removal.md.

    line 78
  5. Distinctive:

    Verify absence: Test each approved path again, or rerun the scanner.

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

heinzel-macos-cleanup

Two modes on a macOS machine, local or over SSH:

  • Orphans: leftovers of apps that are no longer installed.
  • Uninstall: one installed app with everything it created.

Never run automatically. Only on explicit user request. The heinzel first-connection pipeline still applies first.

Workflow

  1. Load overrides. Apply the heinzel override chain (later wins):
    • memory/custom-rules/heinzel-macos-cleanup.md if present.
    • memory/servers/<hostname>/memory.md.
    • memory/servers/<hostname>/rules.md if present. memory/custom-rules/all.md is already loaded by the session-start preflight.
  2. Check the scanner runtime. The scanner needs the Python of the Command Line Tools. Probe:

    xcode-select -p && /usr/bin/python3 --version

    If the probe fails, do not install anything. On a fresh Mac, /usr/bin/python3 opens an install dialog, and over SSH no one can answer it. Fall back to the manual probes in references/locations.md and say so in the report.

  3. Scan. The scanner only reads. It prints JSON.

    Local:

    /usr/bin/python3 \
      .claude/skills/heinzel-macos-cleanup/scripts/scan.py orphans

    Remote (script on stdin, SSH options from CLAUDE.md):

    ssh <options> user@host /usr/bin/python3 - orphans \
      < .claude/skills/heinzel-macos-cleanup/scripts/scan.py

    Log in as the user whose apps you clean up, never as root: the scanner reads its own user's Library and refuses root. Ask for the user if the server memory names none. /Library entries need sudo at removal (references/removal.md).

    For the uninstall mode, pass app "<name>" instead of orphans. A name, bundle id or .app path works. Over SSH, the remote shell splits the arguments again, so quote twice: app "'Microsoft Teams'". If the result lists candidates, ask which path is meant and rerun with that path.

  4. Read unreadable. Paths listed there need Full Disk Access for the terminal app (or for sshd-keygen-wrapper over SSH). Report them. Do not guess their contents.
  5. Verify every candidate. The scanner classifies by name and bundle id. Before proposing a removal, confirm it on the live system (rules/verify-before-reporting.md). The checks per class are in references/classification.md.
  6. Report in the format of references/report-format.md.
  7. Ask per group. Propose removal for orphan entries and for vendor entries that verification proved orphaned. Never propose apple or installed. Offer cache as a separate group. Offer custom and unclear entries only one by one, with the finding that makes each one safe.
  8. Remove only what the user approved, as described in references/removal.md. Always move to the Trash. Never rm -rf.
  9. Verify absence. Test each approved path again, or rerun the scanner. Report what is gone and what failed.
  10. Log. Journal and local changelog per rules/changelog.md:

    logger -t heinzel "macOS cleanup: 42 leftovers of 9 \
    removed apps moved to Trash (1.2 GB)"

    For the uninstall mode, remove the app from memory/servers/<hostname>/memory.md if it is listed there.

References

  • references/classification.md: scanner classes, the checks that verify them, and the traps behind each rule.
  • references/locations.md: where apps leave files, and manual probes for hosts without the Command Line Tools.
  • references/removal.md: moving to the Trash, root-owned files, launchd jobs, installer receipts, Homebrew casks.
  • references/report-format.md: report layout.

Scope and limits

  • macOS only. Linux package managers remove their own files.
  • The scanner never deletes. Removal stays a proposed, approved step.
  • Empty the Trash only on explicit request. Suggest waiting a few days so that missing data can still be restored.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.