Logo de Clean Disk

Clean Disk

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

Visão geral

Publicado porpeterpme
Repositórioskills
Nome da habilidadeclean-disk
Estrelas
28
Forks
0
Arquivos incluídos
1
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    Habilidades de IA são Markdown simples, não código específico de um provedor, por isso funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • 1 arquivos incluídos

    Scripts, modelos de documentos e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente leitura e nunca são executados.

  • Código aberto

    Publicada por peterpme no GitHub. Leia o conteúdo-fonte antes de instalar.

Instalação

Instale a habilidade de IA Clean Disk no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL da pasta da habilidade exibida abaixo e confirme.
    https://github.com/peterpme/skills/tree/main/clean-disk
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Nova habilidade → Via URL GitHub, depois cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Clean Disk em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Clean Disk automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Clean Disk não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

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.

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Clean Disk faz?

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.

Por que usar Clean Disk no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. Clean Disk é escrito em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. O TypingMind usa suas próprias chaves de API, então o pagamento é feito diretamente aos provedores, em vez de uma assinatura por licença de usuário, e suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Clean Disk no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/peterpme/skills/tree/main/clean-disk. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Clean Disk?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Clean Disk?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Clean Disk com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Clean Disk é gratuita?

A habilidade é publicada no GitHub por peterpme. Consulte os termos de licenciamento no repositório. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, modelos de documento ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas para chamar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA fornece conhecimento e um processo ao modelo: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇