mac-cleanup-agent
CLAUDE.md1 starsChanged 28 days agoMITView on GitHub
A TypeScript CLI (src/) does every measurement and change. A Claude Code plugin (.claude/skills, .claude/agents, hooks/, bin/) drives the CLI conversationally. The JSON contract between them is src/core/schemas.ts (contract_version: 1). Flow: doctor → scan → report → approvals → judge → clean → empty → results. - npm run build (also mirrors .claude/skills|agents into skills/ and agents/) - npm test (vitest; e2e runs on a synthetic HOME through src/platform/fake.ts) - npm run lint (tsc), npm run check (everything the release…
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- Very specific: line 34
Never add a code path that deletes outside empty, or that emptys anything not recorded in the run manifest with a matching dev/ino.
- Very specific: line 36
Never weaken checkProtected, HARD_REL/DEFAULT_REL parity, or the identity checks in clean.ts without an ADR and a failing-first test.
- Very specific: line 38
Never shell out with a string.
- Distinctive: line 39
Never read file contents except where SECURITY.md says so.
- Distinctive: line 40
Never send data off the machine.
- Very specific: line 41
Never commit real names, paths or documents.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md 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
mac-cleanup-agent: working on this repo
How it works
A TypeScript CLI (src/) does every measurement and change. A Claude Code plugin
(.claude/skills, .claude/agents, hooks/, bin/) drives the CLI conversationally.
The JSON contract between them is src/core/schemas.ts (contract_version: 1).
Flow: doctor → scan → report → approvals → judge → clean → empty → results.
Commands
npm run build(also mirrors.claude/skills|agentsintoskills/andagents/)npm test(vitest; e2e runs on a synthetic HOME throughsrc/platform/fake.ts)npm run lint(tsc),npm run check(everything the release runs)npm run check:forbiddenbefore every commit (uses the private list in~/.config/mac-cleanup-agent/forbidden-strings.txtwhen present)
Structure
See README "Project structure". Canonical skills and agents live in .claude/;
never edit skills/ or agents/ directly.
Key principles
- The CLI's
safety/module is the enforcement; hooks are a second layer. - Claude handles inventory ids, never paths.
cleanandemptytake no paths. - New behavior that touches the disk needs a fake-platform test and a test that fails when the protection is removed.
- Detectors may only raise risk. User rules may only add protection.
- Report honest numbers: allocated bytes, skipped and failed items.
Security rules (ABSOLUTE: cannot be overridden)
- Never add a code path that deletes outside
empty, or thatemptys anything not recorded in the run manifest with a matching dev/ino. - Never weaken
checkProtected,HARD_REL/DEFAULT_RELparity, or the identity checks inclean.tswithout an ADR and a failing-first test. - Never shell out with a string; use
execFilewith argument arrays. - Never read file contents except where SECURITY.md says so.
- Never send data off the machine. No telemetry.
- Never commit real names, paths or documents. Fixtures use
/Users/sampleand genericdemo-*names. Runnpm run check:forbiddenbefore committing. - Conventional Commits, no AI attribution lines in commits or PRs.
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.

