Claude Code CLI can leave orphaned background processes that consume CPU and memory. This solution automatically kills Claude processes that are no longer attached to a terminal.
Active Claude sessions are attached to a TTY (e.g., s001, s002).
Orphaned processes show ?? in the TTY column. This script kills only the orphaned ones.