一键导入
clean-vm
// 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.
// 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.
| 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. |
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.
python3 .agents/skills/clean-vm/scripts/clean_vm.py
~/.loop/runs/<repoId>loop __bridge-mcp <runDir> <claude|codex> processes for stale runsgit worktree list --porcelainpython3 .agents/skills/clean-vm/scripts/clean_vm.py --apply
python3 .agents/skills/clean-vm/scripts/clean_vm.py --apply --browsers
--apply.~/.loop/runs as the source of truth for paired runs.submitted, working, reviewing, or input-required and whose pid or tmuxSession is still live.claude, codex, or node. Kill only per PID after the script proves the process belongs to stale loop state.pwd, or a dirty worktree.git worktree remove fails, it reports the failure and leaves escalation to a manual follow-up.git rev-parse --git-common-dir, using the same repo id scheme as loop~/.loop/runstmux has-session -t =<name> plus a live-pane check from tmux list-panesnext dev, next-server, storybook, or start-storybookgit worktree list --porcelainIf the script cannot classify something safely, leave it alone and inspect it manually:
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:
submitted, working, reviewing, input-requiredcompleted, failed, stoppedIf 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.
End with a short cleanup report that includes:
If any item is ambiguous, prefer skipped over cleaned.