heinzel-macos-cleanup
Skill94 starsChanged 2 months agoMITView on GitHub
Find and remove leftovers of uninstalled apps on a
- Deletes or force-pushes
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- heinzel-emailSkill
- heinzel-fleet-auditSkill
- heinzel-housekeepingSkill
- heinzel-securitySkill
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
- Very specific: line 22
Never run automatically: Only on explicit user request.
- Very specific: line 39
If the probe fails, do not install anything.
- Very specific: line 57
Ask for the user if the server memory names none.
- Very specific: line 78
Remove: only what the user approved, as described in references/removal.md.
- Distinctive: line 81
Verify absence: Test each approved path again, or rerun the scanner.
≈ “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.
Files
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
- Load overrides. Apply the heinzel override chain (later
wins):
memory/custom-rules/heinzel-macos-cleanup.mdif present.memory/servers/<hostname>/memory.md.memory/servers/<hostname>/rules.mdif present.memory/custom-rules/all.mdis already loaded by the session-start preflight.
Check the scanner runtime. The scanner needs the Python of the Command Line Tools. Probe:
xcode-select -p && /usr/bin/python3 --versionIf the probe fails, do not install anything. On a fresh Mac,
/usr/bin/python3opens an install dialog, and over SSH no one can answer it. Fall back to the manual probes inreferences/locations.mdand say so in the report.Scan. The scanner only reads. It prints JSON.
Local:
/usr/bin/python3 \ .claude/skills/heinzel-macos-cleanup/scripts/scan.py orphansRemote (script on stdin, SSH options from
CLAUDE.md):ssh <options> user@host /usr/bin/python3 - orphans \ < .claude/skills/heinzel-macos-cleanup/scripts/scan.pyLog 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.
/Libraryentries needsudoat removal (references/removal.md).For the uninstall mode, pass
app "<name>"instead oforphans. A name, bundle id or.apppath works. Over SSH, the remote shell splits the arguments again, so quote twice:app "'Microsoft Teams'". If the result listscandidates, ask which path is meant and rerun with that path.- Read
unreadable. Paths listed there need Full Disk Access for the terminal app (or forsshd-keygen-wrapperover SSH). Report them. Do not guess their contents. - 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 inreferences/classification.md. - Report in the format of
references/report-format.md. - Ask per group. Propose removal for
orphanentries and forvendorentries that verification proved orphaned. Never proposeappleorinstalled. Offercacheas a separate group. Offercustomandunclearentries only one by one, with the finding that makes each one safe. - Remove only what the user approved, as described in
references/removal.md. Always move to the Trash. Neverrm -rf. - Verify absence. Test each approved path again, or rerun the scanner. Report what is gone and what failed.
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.mdif 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.
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
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.

