Agent skill

Clean Vm

by axeldelafosse in axeldelafosse/loop

Safely clean the local loop VM by reporting and removing stale loop runs, inactive Next.js or Storybook servers, optional browser windows, and unused loop-created worktrees without disturbing active…

MITAuto-check passedDevelopment

Install Clean Vm

skills CLI
$ npx skills add axeldelafosse/loop --skill clean-vm -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install axeldelafosse/loop clean-vm --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/axeldelafosse/loop.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/clean-vm .claude/skills/clean-vm && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
clean-vm
GitHub stars
281
Token cost
~906 tokens
SKILL.md length
426 words
Files
3 (incl. scripts)
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Safely clean the local loop VM by reporting and removing stale loop runs, inactive Next.js or Storybook servers, optional browser windows, and unused loop-created worktrees without disturbing active…

  • Works in 2 steps: Run a dry run first → Review the report. The script only targets
  • Tasks that involve Git worktrees
  • SKILL.md covers Default Workflow, Safety Rules, What the Script Checks and Manual Fallback, plus 1 more section
  • Runs Python scripts from its folder; calls git, python3 and codex

What it does

Clean Vm is an agent skill from axeldelafosse/loop. Safely clean the local loop VM by reporting and removing stale loop runs, inactive Next.js or Storybook servers, optional browser windows, and unused loop-created worktrees without disturbing active tmux-backed sessions.

Its SKILL.md is about 910 tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including scripts (for example `agents/openai.yaml` and `scripts/clean_vm.py`).

It sits in Development, covering Git worktrees. It works with tmux, Storybook, Next.js and Git. The repository describes itself as: Dead-simple Bun CLI that runs Codex and Claude Code in a loop. The licence is MIT.

When your agent uses it

  • Tasks that involve Git worktrees

Example prompts

  • “/clean-vm”

Requirements

  • Python 3

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Run a dry run first
  2. Review the report. The script only targets

What it can do on your machine

Read from SKILL.md and the folder at commit ecbab1f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • git
    • python3
    • codex

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Clean Vm loads about 906 tokens when it runs. Until then it costs about 57 tokens; SKILL.md has 426 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~57
When it runs · the whole SKILL.md, loaded when a task matches
~906

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from axeldelafosse/loop at commit ecbab1f, republished under its MIT licence (© axeldelafosse). 426 words, ~906 tokens.

Download SKILL.mdSave it as .claude/skills/clean-vm/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
clean-vm
description
Safely clean the local loop VM by reporting and removing stale loop runs, inactive Next.js or Storybook servers, optional browser windows, and unused loop-created worktrees without disturbing active tmux-backed sessions.

Clean VM

Use this skill when repeated loop, Claude, or Codex runs leave the machine in a bad state. Start with the bundled script. It does a dry run by default and only mutates the machine with --apply.

Default Workflow

  1. Run a dry run first:
bash
python3 .agents/skills/clean-vm/scripts/clean_vm.py
  1. Review the report. The script only targets:
  • loop manifests under ~/.loop/runs/<repoId>
  • direct loop __bridge-mcp <runDir> <claude|codex> processes for stale runs
  • loop helper processes tied to stale run dirs
  • Next.js and Storybook servers running inside stale loop worktrees
  • loop-created worktrees from git worktree list --porcelain
  1. Apply the cleanup once the plan looks safe:
bash
python3 .agents/skills/clean-vm/scripts/clean_vm.py --apply
  1. Only close browser windows when the user explicitly wants browser cleanup:
bash
python3 .agents/skills/clean-vm/scripts/clean_vm.py --apply --browsers

Safety Rules

  • Always inspect the dry run before using --apply.
  • Treat loop manifests in ~/.loop/runs as the source of truth for paired runs.
  • Keep any run whose manifest state is submitted, working, reviewing, or input-required and whose pid or tmuxSession is still live.
  • Never mass-kill claude, codex, or node. Kill only per PID after the script proves the process belongs to stale loop state.
  • Never remove the main worktree, the worktree containing the current pwd, or a dirty worktree.
  • The script does not auto-force worktree removal. If a plain git worktree remove fails, it reports the failure and leaves escalation to a manual follow-up.
  • Treat any live tmux session as in use even if the manifest looks stale.
  • Browser cleanup is opt-in and macOS-only.
Show full SKILL.md (190 more words)Show less

What the Script Checks

  • repo identity via git rev-parse --git-common-dir, using the same repo id scheme as loop
  • run manifests under ~/.loop/runs
  • tmux liveness with exact session targets like tmux has-session -t =<name> plus a live-pane check from tmux list-panes
  • helper processes whose command line references a stale run dir
  • direct loop bridge MCP server processes whose run dir is stale or orphaned
  • dev servers matching next dev, next-server, storybook, or start-storybook
  • worktrees from git worktree list --porcelain

Manual Fallback

If the script cannot classify something safely, leave it alone and inspect it manually:

bash
tmux ls 2>/dev/null
tmux list-panes -a -F '#{session_name} #{pane_dead} #{pane_current_command} #{pane_current_path}' 2>/dev/null
git worktree list --porcelain
lsof -nP -iTCP -sTCP:LISTEN | grep -E 'next|storybook|node'
ps -axo pid=,tty=,command= | grep -E 'claude|codex|next dev|storybook'

Useful loop states:

  • active: submitted, working, reviewing, input-required
  • inactive: completed, failed, stopped

If a manifest claims to be active but its pid is gone and its exact tmux session is missing or every pane in that exact session is dead, treat it as stale.

Report

End with a short cleanup report that includes:

  • processes killed, with PID and reason
  • dev servers stopped, with cwd and reason
  • browser actions taken or skipped
  • worktrees pruned or removed
  • anything suspicious you left alone because it was active, dirty, or ambiguous

If any item is ambiguous, prefer skipped over cleaned.

© axeldelafosse, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts) in .agents/skills/clean-vm of axeldelafosse/loop.

  • SKILL.md
  • agents/openai.yaml
  • scripts/clean_vm.py

Open the folder on GitHubat commit ecbab1f

Compare with similar skills

Clean Vm next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Clean Vm compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clean Vm this skillaxeldelafosse/loop281—~906Automated safety check: PassMIT
Mori Agent Bridgevaayne/mori303—~1.7kAutomated safety check: PassMIT
Kanvibe Release Deployrookedsysc/kanvibe143—~12kAutomated safety check: NotesAGPL-3.0
Project Session ManagerYeachan-Heo/oh-my-claudecode40k—~4kAutomated safety check: PassMIT
Multi Agent Orchestrationcat-xierluo/legal-skills713—~6.6kAutomated safety check: PassMIT
Agtx Task Sweepfynnfluegge/agtx1.7k—~1.7kAutomated safety check: PassApache-2.0

Similar skills

  • Use Mori CLI to enable agent-to-agent communication and coordination across Mori-managed panes.

    303 GitHub stars~1.7k tokensUpdated 2 mo ago
    DevelopmentAuto-check passed
  • Kanvibe Release Deploy

    rookedsysc/kanvibe

    A skill your agent uses whenever releasing or deploying KanVibe desktop from a clean, up-to-date dev checkout: ask only for the target version and release-note approval, then let the AI update…

    143 GitHub stars~12k tokensUpdated yesterday
    DevelopmentAuto-check: notes
  • Project Session Manager

    Yeachan-Heo/oh-my-claudecode

    Creates isolated git worktrees, with optional tmux sessions, for PR reviews, issue fixes and feature work across projects and repositories.

    40k GitHub stars~4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Multi Agent Orchestration

    cat-xierluo/legal-skills

    编排两个以上边界独立的本地 worker,使用 Orca Run/Task/Dispatch、独立 worktree/session 或 tmux 回退,由 PM 负责拆解、派发、巡检、429 停滞恢复、独立验收、PR 收口与临时资源清理;也用于用户明确要求“并行推进”“多个 worker”“PM 总控”“Wave Autopilot”或防止 PM…

    713 GitHub stars~6.6k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Agtx Task Sweep

    fynnfluegge/agtx

    Breaks a conversation's results into feature-level tasks and pushes them to the agtx kanban board, where each task gets its own worktree and agent session.

    1.7k GitHub stars~1.7k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed
  • Huashu Agent Swarm

    alchaincyf/huashu-skills

    多Agent蜂群并行协作,纯git自组织,适合大型项目开发。当用户提到"蜂群模式"、"多agent"、"并行开发"、"agent swarm"时使用。

    1.7k GitHub starsUsed in 1 repo~576 tokens
    Agent WorkflowsAuto-check passed

Questions about Clean Vm

What does Clean Vm do?

Safely clean the local loop VM by reporting and removing stale loop runs, inactive Next.js or Storybook servers, optional browser windows, and unused loop-created worktrees without disturbing active…. Clean Vm is an agent skill from axeldelafosse/loop.js or Storybook servers, optional browser windows, and unused loop-created worktrees without disturbing active tmux-backed sessions.

When should I use Clean Vm?

Clean Vm fits situations like: tasks that involve Git worktrees.

How do I install Clean Vm in Claude Code?

Run `npx skills add axeldelafosse/loop --skill clean-vm -a claude-code`. Or copy the skill folder (.agents/skills/clean-vm in axeldelafosse/loop) into .claude/skills/clean-vm in your project. Claude Code loads it when a task matches its description.

How do I install Clean Vm in Codex?

Run `npx skills add axeldelafosse/loop --skill clean-vm -a codex`. Or copy the skill folder (.agents/skills/clean-vm in axeldelafosse/loop) into .agents/skills/clean-vm in your project. Codex loads it when a task matches its description.

Can I use Clean Vm in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add axeldelafosse/loop --skill clean-vm -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/clean-vm, .gemini/skills/clean-vm, .github/skills/clean-vm and .opencode/skills/clean-vm in your project.

What does Clean Vm need to run?

Going by SKILL.md and its folder, Clean Vm needs Python for the scripts in its folder and the command-line tools its instructions call (git, python3 and codex). Our summary lists: Python 3.

Does Clean Vm access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Clean Vm safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Clean Vm use?

Clean Vm is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clean Vm use?

About 906 tokens (SKILL.md is roughly 3.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Clean Vm?

Skills that share tags, products or a category with Clean Vm: Mori Agent Bridge (vaayne/mori, 303 stars), Kanvibe Release Deploy (rookedsysc/kanvibe, 143 stars), Project Session Manager (Yeachan-Heo/oh-my-claudecode, 40k stars) and Multi Agent Orchestration (cat-xierluo/legal-skills, 713 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clean Vm?

axeldelafosse (a GitHub user) maintains it in axeldelafosse/loop, which has 281 GitHub stars. The repository was last updated on April 1, 2026.

Source: axeldelafosse/loop on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.