macos-disk-cleanup

macos-disk-cleanup is a skill for Codex from davidtoby/agent-skills. It costs 57 tokens per session (1,324 once invoked), scanned C, original, MIT.

A macOS disk-cleanup workflow that first inspects storage and then removes only specifically allowed caches or explicitly requested local AI models.

In plain words
What is it for?
Use it to inspect available space, identify removable npm or pip download caches, and clean selected Ollama or LM Studio models when deletion is explicitly requested.
Why use it?
It reduces disk usage while protecting source code, personal files, credentials, application data, and other files that may still be in use.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Good fit Use it to inspect available space, identify removable npm or pip download caches, and clean selected Ollama or LM Studio models when deletion is explicitly requested.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/davidtoby/agent-skills/macos-disk-cleanup
Install

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.

Any agent
npx skills add davidtoby/agent-skills --skill macos-disk-cleanup
Clone the repo
git clone --depth 1 https://github.com/davidtoby/agent-skills

Made for: Codex.

Wrote 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.

agentmods badge for macos-disk-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/skills/davidtoby/agent-skills/macos-disk-cleanup/github.svg)](https://agentmods.dev/skills/davidtoby/agent-skills/macos-disk-cleanup)
Your own site
<a href="https://agentmods.dev/skills/davidtoby/agent-skills/macos-disk-cleanup"><img src="https://agentmods.dev/badge/skills/davidtoby/agent-skills/macos-disk-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.

agentmods 80×15 button for macos-disk-cleanup

Your own site · 80×15
<a href="https://agentmods.dev/skills/davidtoby/agent-skills/macos-disk-cleanup"><img src="https://agentmods.dev/badge/skills/davidtoby/agent-skills/macos-disk-cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,324 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00057 $0.01324
Opus 5.5 $0.00023 $0.00530
Sonnet 5.5 $0.00011 $0.00265
Haiku 4.5 $0.00006 $0.00132

Measured 28d ago against content hash 53b013ca3d64, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

macos-disk-cleanup scanned grade C 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 28d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/disk_cleanup.py, scripts/test_disk_cleanup.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

`--report-dir` 可指定全新的报告目录,默认 `~/disk-cleanup-reports/<UTC时间戳>/`。先写审计,再删除。脚本拒绝符号链接、挂载点、非当前用户文件及关联活动进程;不要用 `rm -rf` 绕过拒绝。
skills/macos-disk-cleanup/SKILL.md · 63 lines

How it starts

The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.

macOS 磁盘清理

先盘点,再按当前授权范围清理,核对实际可用空间并交付操作记录。占用大不代表可以删除。调用技能本身不授权删除模型或个人资料;过去的删除授权不适用于新的清理任务。

授权和保留范围

  • 用户要求“执行磁盘清理”时,可检查后清理下表中的 npm / pip 下载缓存,不重复请求泛泛确认。只要求分析、创建或测试技能时,仅扫描。
  • 仅在当前任务明确要求删除时清理 Ollama / LM Studio 模型。已明确授权的项继续执行;未授权的候选项先列出具体路径、占用、用途和后果,等待答复。
  • 保留源码、项目 node_modules / 虚拟环境、文档、桌面、下载、媒体、云同步、聊天附件、应用容器、应用支持数据、凭据(包括 ~/.key)、系统文件、备份和快照。不要清空废纸篓、卸载应用或删除未知大文件来凑释放量。
  • 保留 Ollama 密钥、历史和日志;保留 LM Studio 的 conversations、credentials、config-presets、user-files、bin、extensions 和内部配置。清理模型后重建空模型目录,保留权限。
  • 保留 uv 缓存、npx 运行包、pnpm store、Playwright 浏览器、Docker 数据和推理组件,除非当前任务另有明确授权并完成用途检查。这些可能被服务使用或与环境存在链接关系。
  • 不删除运行中浏览器、飞书等应用的缓存,不自动退出应用、终止推理或安装任务。有关进程阻挡时,说明进程和具体目标,继续不受影响的只读检查,等待用户关闭或授权停止。
  • 不输出密钥、配置密文、对话正文或进程完整参数。脚本只在内存解析进程参数,输出工具名和 PID。不要上传扫描报告或自动发布技能。

流程和脚本

  1. 确认 macOS 和真实用户主目录。用 df -k /System/Volumes/Data 读取 APFS 数据卷可用空间;根卷 Used 不能代表完整数据占用。

  2. 执行默认只读盘点(脚本路径相对本技能目录):

    python3 scripts/disk_cleanup.py
    

    列出四类目标及主目录一层占用,不删除文件。大目录扫描可能耗时,保持进展说明。权限不足时记录扫描不完整,不用管理员权限扩大删除范围。

  3. 按盘点和当前授权选择目标:

    标识 唯一删除范围 后果
    npm-downloads ~/.npm/_cacache 安装包需重新下载,保留 _npx
    pip-downloads ~/Library/Caches/pip/http 和 http-v2 安装包需重新下载,保留 wheels
    ollama-models ~/.ollama/models 全部本地模型删除,再用需下载
    lmstudio-models ~/.lmstudio/models 全部本地模型删除,保留推理组件

    不按整个 .lmstudio 占用承诺模型释放量,其中还包含运行组件和用户资料。

  4. 执行已授权的下载缓存清理:

    python3 scripts/disk_cleanup.py --targets npm-downloads pip-downloads --apply
    

    当前任务明确授权删除模型后,选择相应标识并传入授权标志;标志必须反映真实用户授权:

    python3 scripts/disk_cleanup.py --targets ollama-models lmstudio-models --apply --authorize-model-deletion
    

    --report-dir 可指定全新的报告目录,默认 ~/disk-cleanup-reports/<UTC时间戳>/。先写审计,再删除。脚本拒绝符号链接、挂载点、非当前用户文件及关联活动进程;不要用 rm -rf 绕过拒绝。

  5. 读审计记录,再核对 df 和目标剩余占用。错误时停止对应项,报告实际状态,不将部分成功说成全部完成。protected_paths_preserved 仅验证原有保护路径仍存在,不等于全部文件内容校验或系统稳定性测试。

  6. 报告本轮实际空间变化、最新可用空间、删除类别、保留项、重新下载影响和本地 Markdown / JSON 链接。GiB 为 1024³ 字节;同时给 GB 时明确十进制含义。后台写入和 APFS 共享块会使目标占用之和与实际增量不同。

Read the full file on GitHub · 63 lines

Files

What ships with it

3 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.

Changes

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.

  1. 28d ago First seen · 63 lines · 57 tokens per session scan C 53b013ca3d64

Subscribe to this mod's changes

macos-disk-cleanup is a skill published in the GitHub repository davidtoby/agent-skills (11 stars, last pushed 14d ago), licensed MIT. It adds 57 tokens to every session and 1,324 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-06.

Related

macos-disk-cleanup compared with skills from other repositories

macos-disk-cleanup next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
macos-disk-cleanupdavidtoby/agent-skillsSkill1114d agoMITC57Codex
morph-pptiOfficeAI/OfficeCLISkill34k3d agoApache-2.0A169Claude Code, Codex
officecli-academic-paperiOfficeAI/OfficeCLISkill34k3d agoApache-2.0A141Claude Code, Codex
officecli-pptxiOfficeAI/OfficeCLISkill34k3d agoApache-2.0A106Claude Code, Codex
mailboxagentscope-ai/QwenPawSkill38ktodayApache-2.0A79Claude Code, Codex
channel_messageagentscope-ai/QwenPawSkill38ktodayApache-2.0A58Claude Code, Codex
officecliiOfficeAI/OfficeCLISkill34k3d agoApache-2.0A56Claude Code, Codex