Cc Reaper banner
theQuert theQuert

Cc Reaper

Development community

Description

Three-layer automated cleanup for orphan Claude Code processes (subagents, MCP servers, plugins)

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

cc-reaper

Automated cleanup for orphan Claude Code processes (subagents, MCP servers, plugins) that leak memory after sessions end.

The Problem

Claude Code spawns subagent processes and MCP servers for each session. When sessions end (especially abnormally), these processes become orphans (PPID=1) and keep consuming RAM and CPU — often 200-400 MB each, with some (like Cloudflare's MCP server) hitting 550%+ CPU. With multiple sessions over a day, this can accumulate to 7+ GB of wasted memory.

This is a [widely reported issue](https://github.com/anthropics/claude-code/issues/20369) affecting macOS and Linux users.

What leaks

Process Type Pattern Typical Size
Subagents claude --output-format stream-json 180-300 MB each
MCP servers (short-lived) npx mcp-server-cloudflare, npm exec mcp-*, etc. 40-110 MB each
claude-mem worker worker-service.cjs --daemon (bun) 100 MB
Agent browser sessions agent-browser-darwin-arm64, Chrome-for-Testing with agent-browser-chrome-* profiles 100-600 MB each
Puppeteer headless Chrome Chrome/Chrome Helper with puppeteer_dev_chrome_profile-* profiles Can pin CPU/GPU
Codex background sessions node /usr/local/bin/codex, @openai/codex/.../codex --yolo Session + MCP tree

| File descriptors | VM processes, settings.json, MCP stdio pipes | ~6,200 FDs/hr leak rate |

**Not killed**: User apps and system services such as ChatGPT.app, cmux.app, Bitdefender, Spotlight (`mdworker`/`mds_stores`), normal Chrome browsing, and web dev servers are protected. Long-running MCP servers shared across sessions (Supabase, Stripe, claude-mem, chroma-mcp, sequential-thinking variants) are also protected. (Cloudflare's MCP server is **not** protected — it tends to orphan and pin ~100% CPU, so it is reaped like any other orphan.) Stale browser/Codex cleanup only targets orphaned or old automation processes.

Solution: Three-Layer Defense

PGID-based process group