Index of every page on this site: llms.txt
All skills
masihmoafi avatar

/clean-system

@c0a5d13
by Masih Moafimasihmoafi/skills10 stars
Run it yourself

Reclaim disk space or clear the clutter Claude Code, Codex and Elpis leave (old chat logs, file history, logs, backups), or name or remove single sessions. Agent clutter goes without asking; caches and Docker need a yes.

Use this Skill: https://skilld.dev/gh/masihmoafi/skills/clean-system

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈59 tokens for metadata: the name and description. ≈591 when used: this file.

Description uses 2.9% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈235 characters, or 2.9%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

System clean-up

1. Agent clutter: clear it without asking (rule 27)

Run python3 clean.py from this folder (dry run), show the per-category totals, then run it with --apply.

  • What it clears: old Claude, Codex and Elpis chat logs, Claude file history and scratch, Codex and Elpis logs, Codex per-run configs, and backups (*.bak, *.pre-*, *.before-*, *backup*) in the agent config folders.
  • One-off targets: add them with --also PATH ....
  • What it always spares:
    • anything touched in the last 24 hours, or open in a running process;
    • memory folders, credentials, live config.toml and settings.json, databases, prompt history;
    • skills, plugins, jobs, plans, ES.md.
  • Everything goes to the trash (gio trash).
  • If an auto-mode classifier blocks --apply, don't work around it. Give the user the exact ! python3 … --apply command to run.

2. Everything else: audit, then ask

Package caches and Docker hold other projects' state, so list the targets with sizes and get the user's yes per category.

  • Caches:
    • uv: du -sh ~/.cache/uv, cleaned by uv cache clean.
    • pip: ~/.cache/pip, cleaned by pip cache purge.
    • conda: ~/miniconda3/pkgs, cleaned by conda clean --all -y.
    • npm: ~/.npm/_cacache, cleaned by npm cache clean --force.
    • pnpm: pnpm store prune. Never delete the store folder.
  • Docker: run docker system df. Images, containers and build cache are separate approvals. Volumes need their own explicit yes because they may hold irreplaceable data.
  • Never target a home directory, workspace root, unresolved variable or broad glob.

3. Verify

Rerun the dry run and df -h /. Report what moved and how much space was freed. Note that it all sits in the trash until the user empties it.

4. Single sessions: name or remove one at a time

For a recent session the user wants named or judged individually, read only its product's own history root (Claude Code ~/.claude/projects/, Codex ~/.codex/sessions/, Elpis ~/.elpis-next/sessions/), list id, short summary, last activity and message count in one table, and propose a 3 to 6 word name from the first meaningful user message. Rename or remove only through the product's own command, never by editing raw logs or indexes, and never the current session or one with a live writer.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    The skill facilitates system maintenance by providing a procedural guide for auditing and cleaning disk space. It utilizes standard command-line tools for package manager and Docker cleanup while strictly enforcing user audit and explicit consent before any destructive actions are performed.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at c0a5d13. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 3 weeks ago

README badge

README badge for masihmoafi/skills/clean-system