From macos-ops
Diagnose macOS memory usage and identify what's consuming RAM. Use when the system is slow, swap is high, or Activity Monitor shows suspicious numbers.
How this skill is triggered — by the user, by Claude, or both
Slash command
/macos-ops:diagnose-memoryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Systematic diagnosis of macOS memory pressure using terminal commands. Activity Monitor is often misleading (shows virtual memory, not actual RAM) — these commands show the truth.
Systematic diagnosis of macOS memory pressure using terminal commands. Activity Monitor is often misleading (shows virtual memory, not actual RAM) — these commands show the truth.
Check free memory and paging activity:
vm_stat
Key lines to interpret:
Pages free × 16384 = free bytes (divide by 1073741824 for GB)Pages active = memory in active usePageouts > 0 means system is swapping to diskPages purged indicates aggressive memory reclamationCheck swap usage:
sysctl vm.swapusage
Swap above 80% indicates severe memory pressure. Above 95% means the system is thrashing.
Top processes by real memory (RSS):
ps -eo rss,pid,command | sort -k1 -rn | head -30
RSS (Resident Set Size) = actual physical RAM used. Ignore virtual memory (VSZ) — Electron apps reserve 1800+ GB virtual but use only 40-160 MB physical.
Sum memory by application name:
ps -eo rss,command | awk '{split($2,a,"/"); name=a[length(a)]; mem[name]+=$1} END {for(n in mem) printf "%8.1f MB %s\n", mem[n]/1024, n}' | sort -rn | head -20
Count processes for a specific app (e.g., Cursor, Code, claude):
ps aux | grep -ci "[C]ursor"
The [C] bracket trick excludes the grep process itself from results.
Sum RSS for a specific app:
ps -eo rss,command | grep -i "[C]ursor" | awk '{sum+=$1} END {printf "%.2f GB\n", sum/1048576}'
Inspect what an extension host or helper process has loaded:
lsof -p <PID> | grep '\.dylib\|\.node\|\.so' | head -20
Useful for finding heavy native libraries (e.g., ONNX Runtime at 21 MB per process).
Electron apps (VS Code, Cursor, Chrome) spawn per-window/workspace processes. Key multipliers:
List extension host processes with memory:
ps -eo rss,command | grep -i "extensionHost\|extension-host" | awk '{printf "%6.0f MB %s\n", $1/1024, $0}'
After identifying the culprits, common fixes:
ps aux | grep -i "[c]laude" | grep -v grepMonitor improvement after cleanup:
sysctl vm.swapusage
ps -eo rssCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cheapsteak/cheapsteak-agent-plugins --plugin macos-ops