agentleFS
alvaroofernaandezalvaroofernaandez/aval/skills/docker-space-optimizer/SKILL.md

docker-space-optimizer

Skill5 starsChanged 2 days agoMITView on GitHub

Trigger: docker ocupa mucho, liberar espacio docker, build cache, prune, docker disk usage. Diagnose and reclaim Kiri Docker space safely.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run aval docker cleanup (add --dry-run to only list the commands.

    line 36
  2. Distinctive:

    If more space is needed, present destructive candidates as a table and wait for approval.

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Activation Contract

Load when Docker images, build cache, volumes or Kiri's disk use too much space, after large builds, or when free space on / is low.

Hard Rules

  • Kiri is the only runtime. Act only when docker context show is kiri; refuse any other context (the script exits non-zero).
  • Measure BEFORE and AFTER, and report the difference.
  • Safe cleanup needs no confirmation: docker container prune -f, docker image prune -f, docker builder prune -af, docker buildx prune --builder multiarch -af.
  • Destructive cleanup (docker system prune -af --volumes, docker volume rm/prune, docker image prune -a, docker rmi) runs ONLY after listing exactly what will be removed, with sizes, and getting explicit approval.
  • Measure Kiri's real usage with du -sh ~/Library/Application\ Support/Kiri before and after, and report the measured number.
  • Kiri's vm/data.img does NOT shrink by itself after deletes. aval docker cleanup ends with fstrim on the VM's ext4 through a throwaway volume (kiri-fstrim-probe), which returns freed blocks to macOS (verified 2026-11-19: 49.4 → 25.2 GB real). Never mount /dev/vda directly. Report the measured du -h vm/data.img before/after, never an assumed number.
  • Manual trim without pruning: docker volume create kiri-fstrim-probe && docker run --rm --privileged -v kiri-fstrim-probe:/v alpine:3 fstrim -v /v; docker volume rm kiri-fstrim-probe.

Decision Gates

FindingAction
Build cache largeSafe cleanup (script)
Dangling images / stopped containersSafe cleanup (script)
Unused tagged imagesList repo:tag, size, age → ask
Unused volumesList name, size, owning compose project → ask; never prune DB volumes silently
Context ≠ kiriStop; load kiri-health

Execution Steps

  1. Diagnose: df -h /, docker system df, docker system df -v, du -sh ~/Library/Application\ Support/Kiri.
  2. Run aval docker cleanup (add --dry-run to only list the commands; checks context, safe prunes incl. the multiarch builder cache, before/after report).
  3. If more space is needed, present destructive candidates as a table and wait for approval.
  4. Re-measure with step 1 commands.

Output Contract

Return a table: free space on / before/after, Kiri data size before/after (measured), total reclaimed, what was removed, what was kept and why.

References

  • aval docker cleanup — safe cleanup with before/after report.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.