kojott

Claude Gc — Development skill for Claude Code

Development community

Automatic cleanup for orphaned Claude Code processes that silently eat your RAM.

How to install Claude Gc

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

What Claude Gc does

Automatic cleanup for orphaned Claude Code processes that silently eat your RAM.

Alternatives in Development

  • Pi Reserved Keybindings — Extensions cannot override these shortcuts — they are silently skipped by registerShortcut() 526 ★
  • Hive — Browser-native hive-mind for CLI coding agents — Claude Code, Codex, Gemini, and OpenCode collaborate as real 473 ★
  • Process — Consult Protheus ERP business processes, module workflows, routines and integrations 136 ★

README

claude-gc

Automatic cleanup for orphaned Claude Code processes that silently eat your RAM.

The Problem

Claude Code spawns child processes — subagents, MCP servers, Task tool workers — that don't get cleaned up when you close your terminal. Each orphan consumes **~220MB RAM**. On a typical development server, **100+ orphans** can accumulate in hours, consuming **22GB+** of memory.

This is a known issue:

How It Works

claude-gc uses a multi-layer safety algorithm to clean up two categories of orphans:

Phase 1: Orphaned Claude processes

  1. Find claude processes with no controlling terminal (detached from any session)
  2. Exclude protected processes: chroma-mcp (vector DB), tmux, worker-service/mcp-server daemons, and claude-gc itself
  3. Skip processes younger than 30 minutes (configurable) — they may still be initializing
  4. Walk parent chain up to 3 levels — if a detached process is a child/grandchild/great-grandchild of an active terminal session or background daemon, it's protected
  5. Graceful shutdown: SIGTERM first, wait 2 seconds, then SIGKILL only for survivors

Phase 2: Orphaned MCP server processes

Claude Code spawns MCP servers (python, uv, node, bun, npm) that don't contain "claude" in their name. These are invisible to simple process matching and can accumulate rapidly — **1000+ orphaned python/uv processes** have been observed consuming 75GB+ on a 32GB server, causing OOM kills.

  1. Scan for known MCP patterns (python.*mcp, uv.*mcp, node.*mcp, npm.*exec.*mcp, bun.*worker-service, etc.)
  2. Filter by current user only — never touches processes owned by other users (e.g., Cursor's MCP servers running as