/msapps-folder-janitor:msapps-folder-janitorfrom MSApps Folder Janitor
Lists and deletes provably-safe clutter in ~/.claude: orphaned project transcripts, empty session-env folders, old backups, and stale changelogs. Shows size and reason before deleting on explicit apply.
Ships in MSApps Folder Janitor. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
~/.claude/ grows quietly. Most of it is session transcripts in projects/, and many of those belong to
folders that no longer exist (deleted git worktrees, scratch directories). Claude Code also leaves empty
session-env/ folders and old .claude.json backups behind. This skill removes only those, and only
after showing the list.
~/.claude, or to remove old or orphaned transcripts.~/.claude/projects or ~/.claude/session-env taking real space./janitor (or bash "${CLAUDE_PLUGIN_ROOT}/scripts/janitor.sh").
Nothing is deleted. Each line is rule<TAB>KB<TAB>path<TAB>reason, then one summary line./janitor apply re-derives the same list and deletes exactly
those paths, then prints removed, failed, KB freed and elapsed seconds.failed is not 0, show the stderr lines; a second dry run
should list nothing that was just removed.| Rule | Path | Eligible when |
|---|---|---|
backup | ~/.claude/backups/.claude.json.backup.* | not among the newest JANITOR_KEEP_BACKUPS (default 1) |
session-env | ~/.claude/session-env/<id>/ | empty and untouched for JANITOR_MIN_AGE_DAYS (default 7) |
changelog | ~/.claude/cache/changelog.md | its newest entry is more than one release behind claude --version (Claude Code fetches it again when needed) |
orphan | ~/.claude/projects/<encoded-path>/ | the cwd recorded in its transcripts does not exist, and no existing folder encodes to its name, and nothing in it changed for JANITOR_MIN_AGE_DAYS |
The orphan rule needs both checks because a project folder name replaces every non-alphanumeric character
with -, so /a/b-c and /a/b/c encode the same. The janitor walks the disk following every folder
whose encoding matches; if any exists, the project is kept.
Unclear means keep. A missing folder on an unmounted disk looks exactly like a deleted one, so the janitor believes "missing" only when it can prove it:
cwd; a project with none (a memory-only project, for example) is always kept;cwd, resolved to its real path (symlinks followed), can be
listed, is not empty, and is on the same device as one of JANITOR_DISK_REFS (default / and $HOME);cwd or that real parent is under a mount root (/Volumes /mnt /media, plus any in
JANITOR_MOUNT_ROOTS), that volume is provably mounted: its folder exists and its device id is known and
differs from the mount root's. An empty leftover folder (an unmounted /mnt/data, a stale /Volumes/X,
or a symlink to one) shares the root disk's device id, so its projects are kept.skills/, plugins/, scheduled-tasks/, CLAUDE.md, settings*.json, history.jsonl, and anything
outside ~/.claude. Every candidate is checked against this before it is listed and again before it is
removed; a path that fails is reported on stderr and skipped.
JANITOR_CLAUDE_DIR — folder to clean (default ~/.claude)JANITOR_KEEP_BACKUPS — backups to keep (default 1)JANITOR_MIN_AGE_DAYS — age threshold for session-env and orphan (default 7)JANITOR_CLAUDE_VERSION — overrides claude --version for the changelog ruleJANITOR_MOUNT_ROOTS — extra space-separated folders whose children are mount points (added to /Volumes /mnt /media, which always apply)JANITOR_DISK_REFS — space-separated paths that define "the local disk" for the orphan rule (default / $HOME; blank means the default)No Notion log, no schedule, no trash folder with a restore window, no transcript compression. Deletion is permanent, which is why the dry run comes first.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub msapps-mobile/claude-plugins --plugin msapps-folder-janitorOther plugins' skills for the same job