[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7586S88YSR99C3NSPRJJ2RB":3,"skill-same:01M7586S88YSR99C3NSPRJJ2RB":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":31,"ownerDescription":33,"updatedAt":34,"install":35,"resources":47},"01M7586S88YSR99C3NSPRJJ2RB","cpu-reduction",null,"Diagnose and clear CPU, memory, and disk contention on the maintainer's dev host. Invoke when the machine is slow, load or swap is high, disk is filling, a Rust build hangs on a target lock, a benchmark needs a quiet host, stale worktree targets have accumulated, or orphaned build\u002Ftest processes are suspected. Covers safe worktree-target cleanup, detached Rust builds, orphaned Node tests and synthetic load generators, the preserve list, and the measure-to-verify loop. For preventing orphan builds, use `rust-build-hygiene`.","nubjs\u002Fnub","nubjs","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6785695?v=4","01M7583N3EYYHSNB6FJQXCDMQH","Nub","01M7583N44MVMSN8385QEF3C8V",4440,"MIT","https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcpu-reduction\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: cpu-reduction\ndescription: >-\n  Diagnose and clear CPU, memory, and disk contention on the maintainer's dev\n  host. Invoke when the machine is slow, load or swap is high, disk is filling,\n  a Rust build hangs on a target lock, a benchmark needs a quiet host, stale\n  worktree targets have accumulated, or orphaned build\u002Ftest processes are\n  suspected. Covers safe worktree-target cleanup, detached Rust builds,\n  orphaned Node tests and synthetic load generators, the preserve list, and the\n  measure-to-verify loop. For preventing orphan builds, use\n  `rust-build-hygiene`.\nmetadata:\n  internal: true\n---\n\n# CPU \u002F disk reduction — clear build & test residue\n\nThe maintainer's Mac is 10 CPUs \u002F 64 GiB. Three residue families need different treatment — diagnose by symptom before sweeping.\n\n| Family | Symptom | Cost | Cause |\n| --- | --- | --- | --- |\n| **Old Rust builds** | a build hangs on `Blocking waiting for file lock`; a few `rustc`\u002F`cargo`\u002F`lld` pegged; disk filling | LOCK contention + CPU + tens of GB of `target\u002F` | detached\u002Forphaned builds that outlived their launcher; abandoned worktree `target\u002F` dirs |\n| **Orphaned node tests** | load floor sits ~20 with nothing building | CPU + swap | `node`\u002F`tsx`\u002F`esbuild`\u002F`tsc -w` reparented to launchd when their harness died |\n| **Orphaned load generators** | load in the **hundreds**; N identical `\u002Fbin\u002Fzsh` at 25–70%, consecutive PIDs, same start second | CPU — starves every build | a probe spawned `(while :; do :; done) &` and died before its cleanup line ran |\n\n**A high load FLOOR with nothing building is almost never active compilation — it is orphaned node processes** (§3). A *hung build* or *filling disk* is the Rust family (§2).\n\n> Prevention beats cleanup: `rust-build-hygiene` is how to spin builds up so they die with you.\n\n## 1. Measure\n\n```sh\nuptime                                   # load; the 1-min figure LAGS — see §7\nsysctl -n hw.ncpu vm.swapusage\nmemory_pressure | grep -i \"free percentage\"\ndf -h ~\u002F.cache                            # disk — worktree target\u002F dirs live here\nps -Ao pid,ppid,pgid,%cpu,%mem,rss,etime,state,comm -r | head -40\n```\n\nLoad well above `hw.ncpu` with nothing building → §3. A build stuck on a lock, or `~\u002F.cache` near full → §2. Start with `make build-status`: it prints which builds hold the machine-wide compile slots, who is queued behind them and for how long, token occupancy, and any build running outside the cap — a build sitting at `Compiling` with no CPU is queued behind the governor, not hung.\n\n## 2. Old Rust builds — locks, orphans, disk\n\n### 2a. Orphaned builds holding a target lock (the hang)\n\nA build that outlived its launcher still holds a target-dir lock, so a live build blocks behind it — often 30+ minutes, reading as \"the build is just slow.\"\n\n```sh\n# builds still running, with age + which target dir\nps -Ao pid,ppid,%cpu,etime,command | grep -Ei 'rustc|cargo|ld64|lld|cc1' | grep -v grep\n# is a build blocked on a lock right now? (check the build log)\ngrep -l 'Blocking waiting for file lock on' \u002Ftmp\u002F*build*.log 2>\u002Fdev\u002Fnull\npkill -f '\u003Ctarget-dir-path>'              # kill the orphaned builds for that target\n```\n\nCause is almost always TWO builds on ONE target dir — most often a stopped agent's **detached** cargo build that `TaskStop` did not reap (TaskStop kills the agent, not its background bash jobs; setsid\u002Fnohup-detached builds reparent to PID 1). Artifacts persist and stay warm — hand the contention-free target to ONE fresh foreground build. Never point two concurrently-building trees at one target dir.\n\n### 2b. Worktree-owned Rust targets eating disk\n\n```sh\n# Audit only. This is the default.\npython3 .claude\u002Fskills\u002Fcpu-reduction\u002Fscripts\u002Fclean-worktree-targets.py\n\n# Repeat every safety check, then delete eligible build output.\npython3 .claude\u002Fskills\u002Fcpu-reduction\u002Fscripts\u002Fclean-worktree-targets.py --apply\n```\n\nIt deletes no worktree, branch, source file, or shared cache. Layouts it covers:\n\n```text\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>\u002Ftarget\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>\u002Faube-target\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>\u002Ftarget-linux\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>-target\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>-launcher-target\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>-target-native\u002F\n```\n\nSpellings vary; the invariant is a top-level target-named directory inside a registered worktree, or a target-named sibling prefixed by that worktree's full basename.\n\nSafety model: the cleaner protects an owner's entire target set when `git status --porcelain` reports any staged, unstaged, or untracked work — an uncommitted worktree is active state. It refuses symlinks, unmatched directories, targets owning the installed `nub-dev`\u002F`nubx-dev` binary, and apply mode while any Rust build is running. Status and process state are rechecked at the deletion boundary.\n\n**Do not remove clean worktree checkouts merely to recover disk.** Build output is regenerable; a checkout and branch are not interchangeable with cache. Remove a checkout only via the `worktree` skill after proving it abandoned and pushed.\n\n**Shared targets stay warm** — they seed fresh worktrees and may own the installed `nub-dev` binary. Never include them in a worktree cleanup; prune only with explicit operator approval:\n\n```text\n~\u002F.cache\u002Fnub\u002Fshared-target\n~\u002F.cache\u002Fnub\u002Fshared-target-\u003Ccontent-hash>\n```\n\n**Judge every reclaim by `df`, never `du`.** APFS clone\u002Fshared-block accounting means summed `du` sizes need not equal the `df` delta, and `du -sh` over the worktree root can take minutes.\n\n```sh\ndf -h \u002FSystem\u002FVolumes\u002FData\n```\n\n### 2c. Orphaned `rustc` at high CPU\n\nRare — Rust builds are noisy but they finish. If `ps` shows a long-`etime` `rustc`\u002F`cc1plus`\u002F`lld` at high %cpu with no parent cargo, it's an orphan; `kill -9` after confirming its `ppid` chain has no live build.\n\n### 2d. Orphaned synthetic load generators (load in the hundreds)\n\nA probe that needs contended measurement sometimes manufactures the contention and then dies before cleanup, leaving busy-loops spinning forever under launchd.\n\nSignature — **all four together**, never `\u002Fbin\u002Fzsh` alone:\n\n```sh\nps -Ao pid=,ppid=,%cpu=,etime=,comm= | awk '$2==1 && $3>20 && $5==\"\u002Fbin\u002Fzsh\"'\nps -o command= -p \u003Cpid>          # full argv reveals the `while :; do :; done` and its dead cleanup\npgrep -P \u003Cpid>                   # NO children — it is not wrapping a real build\n```\n\nConsecutive PIDs + identical start second + `PPID=1` + no children + a spinning loop in the argv = safe to `kill -9`. **Read the full argv first** — an agent's own background `cargo` also runs as `\u002Fbin\u002Fzsh -c source \u003Csnapshot> && …`, and that one *has* children and must be left alone.\n\n**`pgrep -f` can return 0 for everything** when it cannot read other processes' argv under the sandbox. It reports absence, not an error — cross-check with `ps aux | grep` before concluding \"nothing is running.\"\n\nPrevention, in the probe itself:\n\n```sh\nLOADPIDS=$(jobs -p)\ntrap 'kill $LOADPIDS 2>\u002Fdev\u002Fnull' EXIT INT TERM\n```\n\n## 3. Orphaned node test processes (the load floor)\n\nOrphans are `PPID=1`:\n\n```sh\n# every orphaned dev process, with what it costs\nps -Ao pid=,ppid=,%cpu=,rss=,etime=,command= | awk '$2==1' \\\n  | grep -Ei 'nvm\u002Fversions\u002Fnode|\u002Fbin\u002Ftsx|esbuild --service|cache\u002Fnub\u002Fworktrees|tsc -b -w'\n# what it totals\nps -Ao ppid=,user=,rss=,command= | awk '$1==1 && $2==\"colinmcd94\"' \\\n  | grep -Ei 'nvm\u002Fversions\u002Fnode|\u002Fbin\u002Ftsx|esbuild --service|cache\u002Fnub\u002Fworktrees|tsc -b -w' \\\n  | awk '{s+=$3; n++} END {printf \"count=%d  RSS=%.2f GB\\n\", n, s\u002F1048576}'\n```\n\n`PPID=1` also matches ~445 legitimate macOS agents (`\u002FSystem`, `\u002Fusr\u002F*`, `\u002FApplications`). **Always narrow by command pattern; never sweep on `PPID=1` alone.** Two cost shapes: CPU burners (a handful at 60–90%) and memory ballast (hundreds idle at ~0% CPU, ~52 MB RSS each).\n\n## 4. Capture evidence before you kill\n\nA process spinning for days is a reproducible bug; killing it destroys the only live instance.\n\n```sh\nsample \u003Cpid> 3 -mayDie                     # writes \u002Ftmp\u002F\u003Ccomm>_\u003Cts>.sample.txt\nps -Ao pid,ppid,pgid,%cpu,rss,etime,state,lstart,command > ps-snapshot.txt\n```\n\nKnown nub fixture-hang signature:\n\n```\nv8::internal::Isolate::StackOverflow\nv8::internal::ErrorUtils::Construct\nv8::internal::Isolate::CaptureAndSetErrorStack\n```\n\n= infinite recursion → `RangeError: Maximum call stack size exceeded` → source-mapped over a maximally deep stack (nub passes `--enable-source-maps`) → something catches the RangeError and retries → never dies. The fix belongs in the recursion guard + catch site, not the sweep.\n\n## 5. Preserve list — check before killing\n\nStanding instruction: kill anything not doing productive work, but have high confidence it is not in fact productive. **Never kill:**\n\n- Anything holding a listening socket — `lsof -nP -iTCP -sTCP:LISTEN | awk 'NR>1{print $2}' | sort -u`, intersect with candidates (dev servers, the agent harness's own board\u002FUI process, `agent-browser`).\n- `tmux` sessions (they host live `claude` \u002F dispatched workers).\n- `claude` processes and anything whose PPID chains to one.\n- `node --inspect-brk` (a debugger may be attached).\n- Any `cargo`\u002F`rustc` in a LIVE build tree (check the `ppid` chain).\n\nEverything else — orphaned `tsx` runs, `node --watch`, `tsc -b -w`, `esbuild --service --ping`, `nub` fixture runs from `~\u002F.cache\u002Fnub\u002Fworktrees`, detached `cargo`\u002F`rustc` whose launcher is gone — is safe once `PPID=1` and more than a few hours old.\n\n## 6. Sweep — four gotchas\n\n- **`kill $PIDS` silently no-ops with a large PID list** (returns 0, kills nothing). Since `SIGKILL` can't be ignored, \"survived SIGKILL\" always means it was never delivered. Use `awk '{print $1}' candidates.txt | xargs -n 20 kill -9`.\n- **Killing parents reparents their children — sweep in passes.** Re-run identify until the count hits zero.\n- **A `%cpu == 0` filter misses near-zero idlers.** Filter by `PPID=1` + command + age; treat CPU as info, not the predicate.\n- **`SIGTERM` won't be serviced by a process stuck in a JS recursion loop** (event loop unreachable). `SIGTERM` the sleeping Rust parents (temp files to clean); `SIGKILL` straight to spinning node children.\n\n## 7. Verify\n\n```sh\nuptime; sysctl -n vm.swapusage; df -h ~\u002F.cache; ps -Ao pid,%cpu,%mem,etime,comm -r | head -8\n```\n\n**Load average lags** — it reads *higher* right after the kills and decays over minutes. Swap + `memory_pressure` respond faster; trust those first. An `mds_stores` spike after a large sweep is a transient reaction to hundreds of exits.\n\n## 8. Standing risks\n\n- `~\u002F.cache\u002Fnub\u002Fworktrees` disk growth. Pruning the CHECKOUTS reclaims almost nothing — `scripts\u002Frust-build.sh` CoW-clones with `cp -c`, so `du` bills shared APFS blocks to every referencing path. **The `\u003Cname>-target` dirs are the real consumers; hunt orphaned ones first.** Removing a CLEAN worktree is lossless (`git worktree remove` drops the directory; branch and commits stay), so `git status --porcelain` is the whole guard.\n- **Keep stderr visible when a command's failure is what you are diagnosing** — a silenced `git worktree remove … 2>\u002Fdev\u002Fnull` in a loop makes a failed removal look like a CoW accounting effect.\n- Each abandoned fixture run leaks a `nub` + `node` pair. Real fix is upstream (nub should kill its node child on exit; the harness should signal the process group). Until then, `rust-build-hygiene` is how to stop creating the residue.\n","# CPU \u002F disk reduction — clear build & test residue\n\nThe maintainer's Mac is 10 CPUs \u002F 64 GiB. Three residue families need different treatment — diagnose by symptom before sweeping.\n\n| Family | Symptom | Cost | Cause |\n| --- | --- | --- | --- |\n| **Old Rust builds** | a build hangs on `Blocking waiting for file lock`; a few `rustc`\u002F`cargo`\u002F`lld` pegged; disk filling | LOCK contention + CPU + tens of GB of `target\u002F` | detached\u002Forphaned builds that outlived their launcher; abandoned worktree `target\u002F` dirs |\n| **Orphaned node tests** | load floor sits ~20 with nothing building | CPU + swap | `node`\u002F`tsx`\u002F`esbuild`\u002F`tsc -w` reparented to launchd when their harness died |\n| **Orphaned load generators** | load in the **hundreds**; N identical `\u002Fbin\u002Fzsh` at 25–70%, consecutive PIDs, same start second | CPU — starves every build | a probe spawned `(while :; do :; done) &` and died before its cleanup line ran |\n\n**A high load FLOOR with nothing building is almost never active compilation — it is orphaned node processes** (§3). A *hung build* or *filling disk* is the Rust family (§2).\n\n> Prevention beats cleanup: `rust-build-hygiene` is how to spin builds up so they die with you.\n\n## 1. Measure\n\n```sh\nuptime                                   # load; the 1-min figure LAGS — see §7\nsysctl -n hw.ncpu vm.swapusage\nmemory_pressure | grep -i \"free percentage\"\ndf -h ~\u002F.cache                            # disk — worktree target\u002F dirs live here\nps -Ao pid,ppid,pgid,%cpu,%mem,rss,etime,state,comm -r | head -40\n```\n\nLoad well above `hw.ncpu` with nothing building → §3. A build stuck on a lock, or `~\u002F.cache` near full → §2. Start with `make build-status`: it prints which builds hold the machine-wide compile slots, who is queued behind them and for how long, token occupancy, and any build running outside the cap — a build sitting at `Compiling` with no CPU is queued behind the governor, not hung.\n\n## 2. Old Rust builds — locks, orphans, disk\n\n### 2a. Orphaned builds holding a target lock (the hang)\n\nA build that outlived its launcher still holds a target-dir lock, so a live build blocks behind it — often 30+ minutes, reading as \"the build is just slow.\"\n\n```sh\n# builds still running, with age + which target dir\nps -Ao pid,ppid,%cpu,etime,command | grep -Ei 'rustc|cargo|ld64|lld|cc1' | grep -v grep\n# is a build blocked on a lock right now? (check the build log)\ngrep -l 'Blocking waiting for file lock on' \u002Ftmp\u002F*build*.log 2>\u002Fdev\u002Fnull\npkill -f '\u003Ctarget-dir-path>'              # kill the orphaned builds for that target\n```\n\nCause is almost always TWO builds on ONE target dir — most often a stopped agent's **detached** cargo build that `TaskStop` did not reap (TaskStop kills the agent, not its background bash jobs; setsid\u002Fnohup-detached builds reparent to PID 1). Artifacts persist and stay warm — hand the contention-free target to ONE fresh foreground build. Never point two concurrently-building trees at one target dir.\n\n### 2b. Worktree-owned Rust targets eating disk\n\n```sh\n# Audit only. This is the default.\npython3 .claude\u002Fskills\u002Fcpu-reduction\u002Fscripts\u002Fclean-worktree-targets.py\n\n# Repeat every safety check, then delete eligible build output.\npython3 .claude\u002Fskills\u002Fcpu-reduction\u002Fscripts\u002Fclean-worktree-targets.py --apply\n```\n\nIt deletes no worktree, branch, source file, or shared cache. Layouts it covers:\n\n```text\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>\u002Ftarget\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>\u002Faube-target\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>\u002Ftarget-linux\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>-target\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>-launcher-target\u002F\n~\u002F.cache\u002Fnub\u002Fworktrees\u002F\u003Cslug>-target-native\u002F\n```\n\nSpellings vary; the invariant is a top-level target-named directory inside a registered worktree, or a target-named sibling prefixed by that worktree's full basename.\n\nSafety model: the cleaner protects an owner's entire target set when `git status --porcelain` reports any staged, unstaged, or untracked work — an uncommitted worktree is active state. It refuses symlinks, unmatched directories, targets owning the installed `nub-dev`\u002F`nubx-dev` binary, and apply mode while any Rust build is running. Status and process state are rechecked at the deletion boundary.\n\n**Do not remove clean worktree checkouts merely to recover disk.** Build output is regenerable; a checkout and branch are not interchangeable with cache. Remove a checkout only via the `worktree` skill after proving it abandoned and pushed.\n\n**Shared targets stay warm** — they seed fresh worktrees and may own the installed `nub-dev` binary. Never include them in a worktree cleanup; prune only with explicit operator approval:\n\n```text\n~\u002F.cache\u002Fnub\u002Fshared-target\n~\u002F.cache\u002Fnub\u002Fshared-target-\u003Ccontent-hash>\n```\n\n**Judge every reclaim by `df`, never `du`.** APFS clone\u002Fshared-block accounting means summed `du` sizes need not equal the `df` delta, and `du -sh` over the worktree root can take minutes.\n\n```sh\ndf -h \u002FSystem\u002FVolumes\u002FData\n```\n\n### 2c. Orphaned `rustc` at high CPU\n\nRare — Rust builds are noisy but they finish. If `ps` shows a long-`etime` `rustc`\u002F`cc1plus`\u002F`lld` at high %cpu with no parent cargo, it's an orphan; `kill -9` after confirming its `ppid` chain has no live build.\n\n### 2d. Orphaned synthetic load generators (load in the hundreds)\n\nA probe that needs contended measurement sometimes manufactures the contention and then dies before cleanup, leaving busy-loops spinning forever under launchd.\n\nSignature — **all four together**, never `\u002Fbin\u002Fzsh` alone:\n\n```sh\nps -Ao pid=,ppid=,%cpu=,etime=,comm= | awk '$2==1 && $3>20 && $5==\"\u002Fbin\u002Fzsh\"'\nps -o command= -p \u003Cpid>          # full argv reveals the `while :; do :; done` and its dead cleanup\npgrep -P \u003Cpid>                   # NO children — it is not wrapping a real build\n```\n\nConsecutive PIDs + identical start second + `PPID=1` + no children + a spinning loop in the argv = safe to `kill -9`. **Read the full argv first** — an agent's own background `cargo` also runs as `\u002Fbin\u002Fzsh -c source \u003Csnapshot> && …`, and that one *has* children and must be left alone.\n\n**`pgrep -f` can return 0 for everything** when it cannot read other processes' argv under the sandbox. It reports absence, not an error — cross-check with `ps aux | grep` before concluding \"nothing is running.\"\n\nPrevention, in the probe itself:\n\n```sh\nLOADPIDS=$(jobs -p)\ntrap 'kill $LOADPIDS 2>\u002Fdev\u002Fnull' EXIT INT TERM\n```\n\n## 3. Orphaned node test processes (the load floor)\n\nOrphans are `PPID=1`:\n\n```sh\n# every orphaned dev process, with what it costs\nps -Ao pid=,ppid=,%cpu=,rss=,etime=,command= | awk '$2==1' \\\n  | grep -Ei 'nvm\u002Fversions\u002Fnode|\u002Fbin\u002Ftsx|esbuild --service|cache\u002Fnub\u002Fworktrees|tsc -b -w'\n# what it totals\nps -Ao ppid=,user=,rss=,command= | awk '$1==1 && $2==\"colinmcd94\"' \\\n  | grep -Ei 'nvm\u002Fversions\u002Fnode|\u002Fbin\u002Ftsx|esbuild --service|cache\u002Fnub\u002Fworktrees|tsc -b -w' \\\n  | awk '{s+=$3; n++} END {printf \"count=%d  RSS=%.2f GB\\n\", n, s\u002F1048576}'\n```\n\n`PPID=1` also matches ~445 legitimate macOS agents (`\u002FSystem`, `\u002Fusr\u002F*`, `\u002FApplications`). **Always narrow by command pattern; never sweep on `PPID=1` alone.** Two cost shapes: CPU burners (a handful at 60–90%) and memory ballast (hundreds idle at ~0% CPU, ~52 MB RSS each).\n\n## 4. Capture evidence before you kill\n\nA process spinning for days is a reproducible bug; killing it destroys the only live instance.\n\n```sh\nsample \u003Cpid> 3 -mayDie                     # writes \u002Ftmp\u002F\u003Ccomm>_\u003Cts>.sample.txt\nps -Ao pid,ppid,pgid,%cpu,rss,etime,state,lstart,command > ps-snapshot.txt\n```\n\nKnown nub fixture-hang signature:\n\n```\nv8::internal::Isolate::StackOverflow\nv8::internal::ErrorUtils::Construct\nv8::internal::Isolate::CaptureAndSetErrorStack\n```\n\n= infinite recursion → `RangeError: Maximum call stack size exceeded` → source-mapped over a maximally deep stack (nub passes `--enable-source-maps`) → something catches the RangeError and retries → never dies. The fix belongs in the recursion guard + catch site, not the sweep.\n\n## 5. Preserve list — check before killing\n\nStanding instruction: kill anything not doing productive work, but have high confidence it is not in fact productive. **Never kill:**\n\n- Anything holding a listening socket — `lsof -nP -iTCP -sTCP:LISTEN | awk 'NR>1{print $2}' | sort -u`, intersect with candidates (dev servers, the agent harness's own board\u002FUI process, `agent-browser`).\n- `tmux` sessions (they host live `claude` \u002F dispatched workers).\n- `claude` processes and anything whose PPID chains to one.\n- `node --inspect-brk` (a debugger may be attached).\n- Any `cargo`\u002F`rustc` in a LIVE build tree (check the `ppid` chain).\n\nEverything else — orphaned `tsx` runs, `node --watch`, `tsc -b -w`, `esbuild --service --ping`, `nub` fixture runs from `~\u002F.cache\u002Fnub\u002Fworktrees`, detached `cargo`\u002F`rustc` whose launcher is gone — is safe once `PPID=1` and more than a few hours old.\n\n## 6. Sweep — four gotchas\n\n- **`kill $PIDS` silently no-ops with a large PID list** (returns 0, kills nothing). Since `SIGKILL` can't be ignored, \"survived SIGKILL\" always means it was never delivered. Use `awk '{print $1}' candidates.txt | xargs -n 20 kill -9`.\n- **Killing parents reparents their children — sweep in passes.** Re-run identify until the count hits zero.\n- **A `%cpu == 0` filter misses near-zero idlers.** Filter by `PPID=1` + command + age; treat CPU as info, not the predicate.\n- **`SIGTERM` won't be serviced by a process stuck in a JS recursion loop** (event loop unreachable). `SIGTERM` the sleeping Rust parents (temp files to clean); `SIGKILL` straight to spinning node children.\n\n## 7. Verify\n\n```sh\nuptime; sysctl -n vm.swapusage; df -h ~\u002F.cache; ps -Ao pid,%cpu,%mem,etime,comm -r | head -8\n```\n\n**Load average lags** — it reads *higher* right after the kills and decays over minutes. Swap + `memory_pressure` respond faster; trust those first. An `mds_stores` spike after a large sweep is a transient reaction to hundreds of exits.\n\n## 8. Standing risks\n\n- `~\u002F.cache\u002Fnub\u002Fworktrees` disk growth. Pruning the CHECKOUTS reclaims almost nothing — `scripts\u002Frust-build.sh` CoW-clones with `cp -c`, so `du` bills shared APFS blocks to every referencing path. **The `\u003Cname>-target` dirs are the real consumers; hunt orphaned ones first.** Removing a CLEAN worktree is lossless (`git worktree remove` drops the directory; branch and commits stay), so `git status --porcelain` is the whole guard.\n- **Keep stderr visible when a command's failure is what you are diagnosing** — a silenced `git worktree remove … 2>\u002Fdev\u002Fnull` in a loop makes a failed removal look like a CoW accounting effect.\n- Each abandoned fixture run leaks a `nub` + `node` pair. Real fix is upstream (nub should kill its node child on exit; the harness should signal the process group). Until then, `rust-build-hygiene` is how to stop creating the residue.\n",{"name":5,"metadata":24,"description":7},{"internal":25},true,"main","9b734566fd36ceed8379f67a92291bc68af60801",".claude\u002Fskills\u002Fcpu-reduction",71,"https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub","https:\u002F\u002Fnubjs.com","https:\u002F\u002Fgithub.com\u002Fnubjs","The all-in-one Node.js toolkit","2026-11-14 14:11:35",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":25},[37,40,43],{"tool":38,"command":39},"npx","npx skills add nubjs\u002Fnub --skill cpu-reduction",{"tool":41,"command":42},"bunx","bunx skills add nubjs\u002Fnub --skill cpu-reduction",{"tool":44,"command":45},"pnpm","pnpm dlx skills add nubjs\u002Fnub --skill cpu-reduction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcpu-reduction\u002FSKILL.md",[48],{"path":49,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":52,"sourceHtmlUrl":53},"scripts\u002Fclean-worktree-targets.py","SCRIPT","脚本",9682,"https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcpu-reduction\u002Fscripts\u002Fclean-worktree-targets.py",[55,61,67,74,81,88],{"skillNo":56,"name":57,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M758BSH88RVXBG8TPCT427TY","nub","https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002Fskills\u002Fnub\u002FSKILL.md",[],[],{"skillNo":62,"name":57,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M758BKPRHXS5MS27WG908PBG","This project uses nub, a single Rust CLI that runs on the project's installed Node and replaces the everyday Node toolchain. ALWAYS prefer nub over node, bun, npm, npx, pnpm, and yarn for: executing JS\u002FTS files, running package.json scripts, the npx-equivalent, installing dependencies, watch mode, and Node version management. Surfaces whenever you would otherwise reach for node\u002Fbun\u002Fnpm\u002Fnpx or a package manager.","https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002Fsite\u002Fpublic\u002Fskill.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M758BCR8A21H8P4TQ0YRHTC7","worktree","Create and manage isolated git worktrees for parallel build\u002Ftest\u002Flanding work on the nub repo. Invoke (via the Skill tool) whenever you need a fresh worktree to land a change, when you want to know what `.worktreeinclude` does or how to add an entry, or when cleaning up after a merge. Encodes the one-command setup (`nub scripts\u002Fnew-worktree.ts \u003Cslug>` or `node …`) that bakes in the proven recipe — worktree off origin\u002Fmain (vendor\u002Faube is plain in-tree files now, no submodule init), the shared CARGO_TARGET_DIR (`~\u002F.cache\u002Fnub\u002Fshared-target`) that all worktrees reuse, and applying `.worktreeinclude` — plus the eagerly-pull-the-shared-tree discipline and the safe cleanup path. Pairs with the `dev-loop` build skill.","https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fworktree\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M758B9NZ1GQMD1A6B25NK0D9","windows-vm-test","Run ad-hoc Nub tests and debugging probes in the maintainer's existing local Windows 11 ARM64 QEMU\u002FHVF VM when its external disk and runbook are present. Use for interactive win32-arm64 or Windows-on-ARM x64-emulation checks; use ci-adhoc-test for true x64-native behavior or when the local VM is unavailable.","https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwindows-vm-test\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M758B2JHMBB6YJTGYSJR65S4","visual-review","Verify UI\u002Flayout\u002Fstyling changes are correct by computing occlusion, clipping, and alignment from the browser's resolved paint order via the chrome-devtools MCP `evaluate_script` tool — instead of eyeballing a flat screenshot. Invoke BEFORE declaring any UI, site, or styling\u002Flayout change correct. Screenshots have no depth buffer, so z-index\u002Focclusion\u002Fclip bugs are exactly where \"just look at it\" fails; the `evaluate_script` routines below turn those fuzzy visual judgments into deterministic measurements — including optical center-of-mass, which measures the glyph ink's true visual center so differently-sized labels can be aligned by more than eye.","https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fvisual-review\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M758AWPM7CE440NBAYJHD44J","type-declarations","Add, audit, or update @nubjs\u002Ftypes declarations for Nub runtime APIs. Use whenever Nub adds or changes a user-visible global, built-in method, module loader type, or TC39 proposal; when TypeScript or @types\u002Fnode gains an overlapping declaration; and before every release to reconcile runtime changes since the previous tag. Covers conflict-safe global augmentation, compiler-version routing, fixture matrices, and package verification.","https:\u002F\u002Fgithub.com\u002Fnubjs\u002Fnub\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftype-declarations\u002FSKILL.md",[],[]]