From claude-resources
Kills stale OpenAI Codex plugin processes (orphaned broker/exec) and cleans their temp dirs. Use when builds fail with EMFILE/inotify exhaustion or after killed terminals.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-resources:codex-sweep [--dry-run] [--age <hours>][--dry-run] [--age <hours>]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Scans the process table for stale OpenAI Codex plugin processes and kills them, then removes their dead `cxc-*` temp dirs.
Scans the process table for stale OpenAI Codex plugin processes and kills them, then removes their dead cxc-* temp dirs.
Why they accumulate: the codex plugin spawns one detached broker (app-server-broker.mjs + a codex app-server child) per workspace, and cleanup relies on Claude's SessionEnd hook — which never fires on killed terminals, crashes, or worktree-teammate sessions. Orphans pile up (~3 processes each); on WSL2 they exhaust fs.inotify.max_user_instances=128 and Vite starts failing with EMFILE.
Safe by design: the plugin respawns a broker on demand (ensureBrokerSession self-heal), so a false-positive kill costs at most a ~2s respawn. Brokers belonging to live Claude sessions are detected and kept.
Run directly — no confirmation step needed (unlike /dev-clean-wsl's deletions, kills here cost nothing to redo):
node $HOME/.claude/scripts/codex-sweep.js
Pass through user args:
--dry-run — when the user asks "what would it kill" (lists each broker: pid, age, tier, workspace)--age <hours> — tier-2 idle threshold (default 2h; a SessionStart hook also runs this automatically with --auto = 6h threshold, throttled to once per 6h)--json — machine-readableWhat it kills:
--cwd workspace was deleted; codex app-server orphaned to PPID 1; codex exec orphaned to PPID 1 for >60 minRelay the script's summary line to the user. On --dry-run, show the per-broker table.
After sweeping, verify the pressure dropped:
find /proc/*/fd -lname 'anon_inode:inotify' 2>/dev/null | wc -l
If it recurs, raise the ceiling (see the inotify note in /dev-clean-wsl):
echo 'fs.inotify.max_user_instances=1024' | sudo tee /etc/sysctl.d/60-inotify.conf
sudo sysctl --system
lsof (Mac) or /proc (Linux) lookup failed; tier 1 still ran. Rerun manually.cxc-* dirs survive one cycle after a sweep (10-min mtime floor guards freshly-spawned sessions); the next sweep removes them.npx claudepluginhub takazudo/claude-resources --plugin claude-resourcesInspects, archives, and maintains local Codex state to reduce drag after heavy use. Archives old sessions, rotates logs, prunes stale worktrees, and normalizes path mismatches with backup-first safety.
Kills stale PipeCrew site-view servers left running after session restarts. Discovers all running instances via probe and kills them; supports selective keep flags.
Finds stale and resource-hungry processes, scores waste, and presents cleanup report. Activates on RAM queries or slow machine, or proactively when noticing sluggishness.