Skip to content

SotoAlt/claude-kill-orphans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

kill-orphans

A Claude Code plugin that safely finds and kills orphaned Claude subagent processes to free memory and CPU.

The Problem

Claude Code MCP plugins (especially claude-mem) spawn background subagent processes that can accumulate over time. These orphaned workers keep running indefinitely even after the tasks that created them are long finished, consuming significant RAM (often 2-5 GB) and CPU.

What This Does

The /kill-orphans command:

  1. Scans all Claude processes on your system
  2. Identifies orphaned subagent workers (children of the claude-mem daemon with --output-format stream-json)
  3. Shows you exactly what it found — how many orphans, how much RAM, what project spawned them
  4. Asks for your confirmation before killing anything
  5. Gracefully terminates orphans (SIGTERM, then SIGKILL for survivors)
  6. Reports how much memory was freed

Your active Claude terminal sessions are never touched. The skill distinguishes active sessions (which have a TTY) from orphaned workers (which don't).

Safety

  • Always asks for confirmation before killing any processes
  • Never kills active sessions — only targets background subagent workers
  • Graceful shutdown first — sends SIGTERM, waits 2 seconds, then SIGKILL only for survivors
  • Works from any directory — scans system-wide processes regardless of your current working directory
  • macOS and Linux — uses standard POSIX tools (ps, lsof, kill)

Note: This skill runs ps, lsof, and kill commands on your machine. Review the output before confirming. If you're unsure, choose "No" when prompted — nothing will be killed.

Install

/plugin marketplace add SotoAlt/claude-kill-orphans
/plugin install kill-orphans@sotoalt-tools

Usage

Just run:

/kill-orphans

You'll see output like:

| Category                      | Count | RAM     |
|-------------------------------|-------|---------|
| Orphaned subagents (project)  | 83    | ~2.9 GB |
| Active terminal sessions      | 8     | Safe    |

Kill all 83 orphaned subagents (~2.9 GB)?
> Yes, kill them

When to Use

  • Your machine feels sluggish and Activity Monitor shows many claude processes
  • You've been using Claude Code with MCP plugins for days/weeks without restarting
  • ps aux | grep claude | wc -l shows dozens of processes you don't recognize

Requirements

  • Claude Code CLI installed
  • macOS or Linux (uses ps, lsof, kill)
  • No special permissions needed — only kills processes owned by your user

License

MIT

About

Claude Code plugin to safely kill orphaned subagent processes and free memory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors