Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add WiseWong6/wise-skills --skill mac-cleanupgit clone --depth 1 https://github.com/WiseWong6/wise-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/wisewong6/wise-skills/mac-cleanup)<a href="https://agentmods.dev/skills/wisewong6/wise-skills/mac-cleanup"><img src="https://agentmods.dev/badge/skills/wisewong6/wise-skills/mac-cleanup/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/wisewong6/wise-skills/mac-cleanup"><img src="https://agentmods.dev/badge/skills/wisewong6/wise-skills/mac-cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00187 | $0.02123 |
| Opus 5 | $0.00093 | $0.01061 |
| Sonnet 5 | $0.00037 | $0.00425 |
| Haiku 4.5 | $0.00019 | $0.00212 |
Grade B, and why
mac-cleanup scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Asks for rootmediumPrivilege escalation
A mod that escalates privileges can change anything on the machine, not only the project.
description: Mac 清理管家:性能诊断、磁盘空间、启动项/后台服务残留、进程端口、已装应用、CLI 工具与包管理器的盘点和清理。当用户说"清理磁盘/看看有什么能删/空间不够了""看看启动项和后台服务有什么残留""kill 下没用的端口/进程""盘点下我装的应用""看看装了什么 cli/npm/brew/pip 有没有用""机器慢/发热/卡/优化系统性能""给机器做个大扫除"时使用。流程固定:取证 → 按风险分层报告(来源+ How it starts
The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Mac 清理管家
删错的代价远大于少删。先取证、再分层、用户拍板、删后复查;每轮清理后主动推进"还有哪些"。
第一步永远是读个人档案
个人档案默认放在 ~/.local/share/mac-cleanup/known-state.md,不得写进 Skill 安装目录或源码仓库。开始任何清理战役前:
- 如果个人档案存在,完整读取;里面已确认的保护项、历史决定和遗留事项不重复纠结。
- 如果不存在,读取 references/known-state-template.md 了解字段;本轮先按空档案工作,在产生需要长期保留的决定后再创建个人档案。
- 如果用户设置了
MAC_CLEANUP_STATE_FILE,以该绝对路径为准。
用户指令解读
用户说话极简,按以下规则解读,不确定就问一句:
- 「删。」「处理。」「都删吧」「都 kill」「卸载。」= 批准执行刚才报告里的(或引用的)目标。
- 引用报告里的表格行/条目原文 + 一个动词 = 只对这些选中项执行,不是全部。
- 一条消息里用
---分隔多段 = 批量下达多个决定,逐段处理。 - 「这个又有什么用呢?」「逐个告诉我有什么用」「我看不懂」= 先用大白话逐个解释身份(是什么、谁装的、干什么用、上次什么时候用的),再谈删留。用户不懂的领域(如 pip)会说"你都看看"——那就全查并解释。
- 用户的 typo 和截断(如「:5432 PostgreSQ」「kill下没用的端口」)按意图理解,不逐字抠。
报告契约(硬性要求)
曾因缺要素被用户批评「你这个分析不行」。每份清理报告必须:
- 每项必含三要素:来源(谁产生的/干什么用的)、删除风险、建议。只报大小和建议不够。
- 四层分类,按此分节或列表:
- ① 无风险,删了会自动重建(缓存类)——可直接建议批量删
- ② 大概率能清,但需用户确认——逐项说明来龙去脉
- ③ 用户数据,只能用户自己决定(聊天记录、文档、作品)——只列大小和位置,不给删的建议,说明正确清理途径
- ④ 不动(保护清单内的、在用的)——说明为什么不动
- 表格呈现,必列大小。示例:
| 项目 | 大小 | 来源 | 删除风险 | 建议 |
|---|---|---|---|---|
~/.cache/uv |
28G | uv 的 Python 包缓存 | 无,下次装包自动重建 | 可直接删 |
风险偏好默认规则
- 官方工具优先于 rm:
xcrun simctl delete> 删目录;brew uninstall> 删 Cellar;launchctl bootout> 直接删 plist。 - SIGTERM 先于 SIGKILL;kill 子进程不伤父会话。
- 被进程占用的缓存不强删(报 "Resource busy" 就停手),标记为"重启后再清",不 kill 占用方来抢。
- 去重前必须校验内容(MD5 或逐文件对比),内容不同就不是重复;重复留最新版本(比对修改时间)。
- 数据库、知识库和不可重建数据在删除前必须单独询问是否导出或备份;不得从历史案例推断当前用户的选择。
- 归档类按日期窗口清,默认只保留最近 30 天。
- 身份不明就先取证:查配置文件、软链、引用(zshrc/项目 .env)、Spotlight 使用时间、修改时间、PPID;还定不了就联网调研(GitHub/官网)确认来源。
- 应用仍处于安装状态就绝不删它的数据目录。
sudo 边界
不交互输密码。系统级操作(/Library、/usr/local、kext、特权助手、root 属主文件):
- 汇总成单条命令或写好带
set -x的~/cleanup-sudo.sh交给用户跑; - 预期用户可能裸跑出错(override 提示、没带 sudo),要能解释原因并指导重跑;
- 用户跑完回报后必须复查验证删干净没有。
标准流程
- 读取外部个人档案;不存在时读取随包模板。
- 扫描取证(按领域读对应 playbook,见下表)。
- 出分层报告(按报告契约)。
- 等用户拍板——模糊指令(「优化一下」「你看着办」)不算批准,追问一句。
- 执行(用户级直接做,系统级走 sudo 交接)。
- 复查:验证删净/进程死透/磁盘数字变化,汇报释放量。
- 收尾:主动问"还要看看哪个领域",或按大扫除顺序推进;把新决策写回档案。
What ships with it
13 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- agents/openai.yaml 43 B
- LICENSE 1.0 KB
- README.md 419 B
- references/apps.md 2.5 KB
- references/cli-tools.md 2.2 KB
- references/disk.md 2.8 KB
- references/known-state-template.md 865 B
- references/perf-diagnosis.md 3.1 KB
- references/processes.md 2.2 KB
- references/startup.md 3.3 KB
- scripts/capture_macos_snapshot.sh 17 KB runs code
- scripts/compare_snapshots.py 25 KB runs code
- scripts/normalize_snapshot.py 1.7 KB runs code
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today Changed · -13 tokens per session 14e198da236f
- 10d ago First seen · 107 lines · 200 tokens per session scan B ad772c1bef83
mac-cleanup is a skill published in the GitHub repository WiseWong6/wise-skills (6 stars, last pushed yesterday), licensed MIT. It adds 187 tokens to every session and 2,123 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
insight-error-page
Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…
next-cache-components-optimizer
Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…
next-partial-prefetching-adoption
Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…