Логотип Clean Disk

Clean Disk

Спільнота
peterpme
clean-disk

Use when a machine is low on disk space, when worktrees, Rust targets, build folders, Xcode DerivedData or caches should go ("clean up disk", "close out their worktrees"), for the scheduled Disk cleanup run, or to set daily cleanup up on a machine. Runs `disk-clean`. Not for app bundle size, CI runner disk or personal files.

Огляд

Видавецьpeterpme
Репозиторійskills
Назва навичкиclean-disk
Зірки
28
Форки
0
Файли в пакеті
1
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 1

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Опубліковано на GitHub користувачем peterpme. Перегляньте вихідний вміст перед установленням.

Встановлення

Установіть навичку ШІ Clean Disk у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до Плагіни → Навички.
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/peterpme/skills/tree/main/clean-disk
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Нова навичка → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/peterpme/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/clean-disk .claude/skills/clean-disk
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Clean Disk в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Clean Disk, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції Markdown, а не код для певного постачальника, тому навичка Clean Disk не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож невикористана навичка нічого не коштує.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Clean disk

Goal: no machine runs out of disk because of agent leftovers, and Peter never has to ask. One run is disk-clean --apply, then a short report.

disk-clean (scripts/disk-clean in this skill, linked onto PATH as disk-clean by npm run sync) holds every deletion rule. Run disk-clean --help for them. Do not delete things by hand that the script would not delete. In particular:

  • Never remove a main checkout, delete a branch, or touch ~/Downloads, ~/Documents, Photos or the Finder trash (~/.Trash).
  • Never rm -rf a worktree. The script uses git worktree remove, saves uncommitted changes first, and keeps the branch.
  • Do not run mo clean (Mole). It stops at its developer-tools step (after Corepack) and never finishes. disk-clean runs mo purge --yes, which finishes in about a minute.
  • ~/Library/Developer/CoreDevice/DeviceFS is a mounted view of a connected iPhone, not local data. Ignore its size.
  • Put gtimeout 120 on any du you run yourself.

Run

A scheduled run uses disk-clean --apply --skip-if-free-over 100G. A machine with more than 100 GB free has nothing to gain, so the daily check ends in one line (disk-clean SKIPPED: ..., exit 0) without scanning or removing anything. A manual run, or any run Peter asks for, leaves the flag off. If the scheduled run prints SKIPPED, report that line and stop.

  1. Run disk-clean --apply. It prints each removal with its reason and size, then the free space before and after. When Peter asks interactively, apply right away too: everything it removes can be regenerated or is backed up.

  2. If anything is FAILED, read the reason. Fix it only if the fix is clearly safe, such as a stale index.lock with no git process running. Otherwise report it.

  3. If free space is still under 100 GB or 15% of the disk, measure the next biggest items with gtimeout 120 du -sh on these, and report the top ones with the exact command that would free each:

    ItemCommand
    node_modules in a main checkout not touched for 30+ daysrm -rf <repo>/node_modules (reinstall later)
    ~/Library/pnpmpnpm store prune already ran; the rest is in use
    ~/Library/Developer/CoreSimulator/Devicesxcrun simctl delete <udid> for simulators no longer needed
    ~/.android/avddelete AVDs no longer needed in Android Studio's Device Manager
    Dockerdocker system prune
    ~/.TrashEmpty Trash in Finder
    ~/.rustup/toolchainsrustup toolchain uninstall <old nightly>

    Do not run these yourself. They are Peter's call.

Worktree rules

The script only touches worktrees under agent paths: ~/.t3/worktrees, <repo>/.claude/worktrees, ~/.codex/worktrees, .codex-worktrees and ~/.cursor/worktrees. Sibling clones such as ~/Projects/x/repo-feature are left alone.

A tree is removed once it has been idle long enough for its kind. Idle time counts from the newest of: a file edit in the tree, a commit, checkout or reset (the last reflog entry), and activity in its T3 thread.

KindRemoved afterMeaning
Merged1 idle dayThe branch's PR is merged or closed, the T3 thread is deleted or archived, or (with no tracked edits) every commit is already in origin's default branch or a production, release/*, stable or <app>-production-<version> branch. Squash and rebase merges count.
Clean3 idle days (--days)No uncommitted or untracked files. Removing it loses nothing because the branch stays, so an open PR or open T3 thread doesn't keep it.
Dirty14 idle daysShown as watch from day 3. Changes are backed up before removal.
  • Never removed: locked trees, and trees a process is running in.
  • Backups: before a tree with uncommitted changes is removed, the changes are saved to ~/.local/state/disk-clean/backups/<date>-<repo>-<tree>/ and kept 60 days. A detached commit that no branch holds is saved on a rescued/<tree>-<sha> branch.

Cache rules

ItemRule
Project build foldersmo purge --yes: Mole's purge of build, dist, Pods, .venv and similar in projects with no file changed in 7 days
Xcode DerivedDataRemoved when its project folder is gone (such as a removed worktree) or it has been idle 7 days
trash-cli trashItems deleted 3+ days ago
Simulator runtimesRemoved when unused for 14 days and a newer runtime of the same family exists (a device-specific runtime such as iOS-27-2-iPhone19-4 is its own family)
Simulatorsxcrun simctl delete unavailable
pnpmpnpm store prune
uvuv cache prune, waiting at most 60 s for uv's lock. A long-running uvx MCP server holds that lock; then archives older than 14 days are removed directly.
Size capsEmptied when over the cap and not in use: uv 10 GB, Gradle 10 GB (skipped while a Gradle daemon runs), Yarn global cache 5 GB, npm 5 GB

To restore one, follow README.txt in its backup folder: git worktree add <dir> <branch>, then git -C <dir> apply --index changes.patch and tar -xzf untracked.tar.gz -C <dir>. To keep a tree out of cleanup, git worktree lock <path>.

If repos live outside ~/Projects, ~/skills and ~/dotfiles, pass each extra directory with --root <dir>, or set DISK_CLEAN_ROOTS (colon-separated).

Report

Lead with the answer:

**Disk cleanup, <machine>, <date>:** freed <N> GB, <free> GB free (<pct>% of disk).

| Removed | Count | Size |
|---|---|---|
| Worktrees (dead or idle) | | |
| Rust target folders | | |
| Build folders (Mole), DerivedData, runtimes, trash, caches | | |

Backed up before removal: <tree → backup folder, or none>
Watch: <trees with tracked edits that will be removed at 14 days, with idle days, or none>
Needs your call: <FAILED items, or the biggest remaining items with commands when free space is low>

Write the Needs your call: line only when something there needs Peter; otherwise leave it out. When nothing was removed and free space is fine, report one line. Where the machine has a cleanup for scheduled-run threads, a run thread is deleted a few minutes after it finishes unless its report has a Needs your call: line. history.log keeps the record.

Set up on a machine

Every machine with T3 Code gets its own daily run, because the cleanup is local.

  1. Confirm disk-clean --help works. If it doesn't, run git -C ~/skills pull --ff-only && npm --prefix ~/skills run sync. If it still doesn't, this skill isn't merged to main yet: stop, because every scheduled run would fail.

  2. Run disk-clean (a dry run) and check that the removals make sense for this machine. Add --root dirs if repos live elsewhere.

  3. Call schedule_task with:

    • projectId: the "No project" (scratch) project from t3_project_list;

    • bindToCurrentThread: false;

    • title: "Disk cleanup";

    • schedule: {type: "fixed_time", timeOfDay: "07:00"};

    • this prompt, with any --root arguments added:

      [t3-sentinel-run] Run the clean-disk skill: one scheduled disk-clean --apply --skip-if-free-over 100G run on this machine, then the report (one line if it prints SKIPPED). If disk-clean is not on PATH, reply in one line starting with "Needs your call:" that the skill isn't installed, and stop.

  4. If ~/.t3/sentinel/config.json exists, add the returned scheduledTaskId to its cleanup_task_ids list, so finished run threads are deleted. The [t3-sentinel-run] tag keeps the watchdog from treating the run as agent work.

  5. Report the next run time.

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Clean Disk?

Use when a machine is low on disk space, when worktrees, Rust targets, build folders, Xcode DerivedData or caches should go ("clean up disk", "close out their worktrees"), for the scheduled Disk cleanup run, or to set daily cleanup up on a machine. Runs `disk-clean`. Not for app bundle size, CI runner disk or personal files.

Навіщо використовувати Clean Disk у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Clean Disk — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Clean Disk у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/peterpme/skills/tree/main/clean-disk. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Clean Disk?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Clean Disk?

Зі скількома забажаєте. Якщо модель підтримує навички, ви можете використовувати з нею Clean Disk — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama та інші — усе в TypingMind із власними ключами API.

Чи безкоштовна навичка ШІ Clean Disk?

Навичку опубліковано на GitHub: peterpme. Умови ліцензування дивіться в репозиторії. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це багаторазовий набір інструкцій, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти для виклику — код, який десь виконується й повертає результат. Натомість навичка ШІ надає моделі знання та порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇