From omc-lens
Remove inactive omc-lens plugin version directories from the Claude Code plugin cache after explicit user confirmation
How this skill is triggered — by the user, by Claude, or both
Slash command
/omc-lens:cleanup-old-versionsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill prunes stale omc-lens version directories from
This skill prunes stale omc-lens version directories from
~/.claude/plugins/cache/omc-lens/omc-lens/. Each plugin update creates a
new version-stamped directory (e.g. 0.5.7/, 0.5.8/) without removing the
previous ones, so they accumulate over time.
Always ask the user before deleting anything. Never delete the active
version directory (the one currently targeted by the
~/.claude/hud/omc-lens.mjs symlink).
ACTIVE_PATH="$(readlink "$HOME/.claude/hud/omc-lens.mjs" 2>/dev/null || true)"
ACTIVE_VERSION="$(echo "$ACTIVE_PATH" | sed -n 's#.*/cache/omc-lens/omc-lens/\([^/]*\)/.*#\1#p')"
echo "ACTIVE_VERSION=$ACTIVE_VERSION"
echo "ACTIVE_PATH=$ACTIVE_PATH"
If ACTIVE_VERSION is empty, tell the user the symlink could not be
resolved and stop — do not delete anything.
CACHE_ROOT="$HOME/.claude/plugins/cache/omc-lens/omc-lens"
INACTIVE=()
for dir in "$CACHE_ROOT"/*/; do
name="$(basename "$dir")"
[ "$name" = "$ACTIVE_VERSION" ] && continue
INACTIVE+=("$name")
done
echo "Inactive versions: ${INACTIVE[*]:-<none>}"
if [ ${#INACTIVE[@]} -gt 0 ]; then
du -sh "${INACTIVE[@]/#/$CACHE_ROOT/}" 2>/dev/null | awk '{print $1, $2}'
TOTAL=$(du -sk "${INACTIVE[@]/#/$CACHE_ROOT/}" 2>/dev/null | awk '{sum+=$1} END {printf "%.1f MB\n", sum/1024}')
echo "Total reclaimable: $TOTAL"
fi
If INACTIVE is empty, tell the user "Nothing to clean up. Active version
is the only one in cache." and stop.
Use AskUserQuestion with this exact shape:
Substitute N, SIZE, and ACTIVE_VERSION with the values from Step 2.
If the user picks "Keep them" or any non-removal answer, stop without changes.
Only if the user explicitly chose "Remove all inactive versions":
for v in "${INACTIVE[@]}"; do
rm -rf "$CACHE_ROOT/$v" && echo "Removed $v"
done
Report the removed versions and remaining active version to the user.
npx claudepluginhub dokadev/omc-lens --plugin omc-lensClears cached copies of Claude Code plugins from ~/.claude/plugins/cache/, requiring reinstall from registry. Fixes unexpected behavior, corruption, frees disk space, or enables clean reinstalls.
Scans Claude Code config (skills, memory, hooks, permissions, MCP servers, caches) for stale or redundant items and walks the user through confirm-each-deletion cleanup.
Clears the local repository cache (~/.grimoire/librarian/cache/) to reclaim disk space, with user confirmation. Does not touch the curated library/ directory.