agentleFS
jp-solumhealthjp-solumhealth/jpstack/mac-performance-triage/SKILL.md

mac-performance-triage

Skill0 starsChanged 18 days agoMITView on GitHub

Use when a Mac is slow, freezing, beachballing, lagging, running hot, or spinning the rainbow wheel; when apps quit or get killed unexpectedly; when the fans are loud or kernel_task is high; when someone asks to "clean up", "speed up", or "free space on" a Mac; or when deciding whether to buy more RAM or a bigger machine. Also use for "why is my laptop so slow", "running out of memory", "out of storage", "should I upgrade my RAM", and post-hoc questions about a freeze that already happened.

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When RAM runs out, macOS compresses pages rather than swapping.

    line 19
  2. Distinctive:

    Read-only: kills nothing, deletes nothing, ~5 seconds.

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Mac Performance Triage

Overview

A slow Mac is almost always a memory-capacity problem wearing a CPU costume.

When RAM runs out, macOS compresses pages rather than swapping. Compression is fast, but every decompression is a CPU stall. Millions of them read as "the laptop is slow" and to top as high CPU — while free memory looks fine and the disk has hundreds of GB free.

Measure the true working set against physical RAM. Everything else is downstream of that number.

Run This First

python3 scripts/mac_triage.py     # add --json for machine-readable

Read-only: kills nothing, deletes nothing, ~5 seconds.

The Core Calculation

macOS never reports true demand directly. Recover it by inverting the compressor's own ratio (vm_stat):

ratio        = "Pages stored in compressor" / "Pages occupied by compressor"
working_set  = (PhysMem_used - compressor_physical) + (compressor_physical × ratio)

A ratio near 2:1 is typical. If working_set exceeds installed RAM, the machine is genuinely oversubscribed and no amount of tidying will fix it.

Signals That Lie

SignalWhy it misleads
memory_pressure "free percentage"Reported 70% free on a machine with 117 MB actually free. Ignore it.
Activity Monitor pressure graphLags badly; stays green through active thrash.
ps %cpuA decaying lifetime average. A process that just started spinning ranks low. Use top -l 2 and read the second sample.
Summed RSS per appDouble-counts memory shared between helper processes. Upper bound only.
Empty /System/Volumes/VM/Normal on Apple Silicon — it prefers compression and creates swap lazily. Not a missing safety net, nothing to fix.
Free disk spaceIrrelevant to speed above ~10% free.

Hard Evidence of Memory Exhaustion

JetsamEvent-*.ips in ~/Library/Logs/DiagnosticReports means the kernel already killed processes to reclaim RAM — conclusive. shutdown_stall-*.ips and lifetime decompressions in the millions corroborate.

Verdict Table

Working set vs RAMVerdict
Under, but free < 1 GB and decompressions in the millionsReboot — thrash accumulated over uptime.
Over by < 25%Fixable in software: quit idle Electron apps, enable Chrome Memory Saver, close unused agent sessions.
Over by > 25%, persisting after the aboveGenuinely undersized; recommend more RAM.

Apple Silicon RAM is soldered, so this is a purchase decision. Report the chip tier (machdep.cpu.brand_string — a bare Apple M4 is base tier and caps lower than Pro/Max) and have the user confirm ceilings with Apple first.

Safety Rules

  1. Never kill by PID. PIDs are recycled; a stale PID may belong to something else by the time it's used. Match by name (pkill -f <pattern>) after previewing with pgrep -fl.
  2. Check capture state before suggesting quits. An active mic tap plus busy cameracaptured means a live call — quitting apps cuts them off. The script flags this.
  3. Don't run log show over long windows. A --last 24h query drove load average from 8 to 21 on a machine already thrashing. Diagnostics must not worsen the problem; read DiagnosticReports files instead.
  4. Never delete user files to fix speed. See below.

Common Mistakes

MistakeCorrection
Treating it as a disk problem"Slow laptop" and "clean up my Mac" arrive together but are unrelated above ~10% free. Report free space as evidence before anyone deletes.
Deleting files to "free things up"Returns zero performance, and Documents holds originals indistinguishable from drafts by size or mtime. Inventory, let the user decide, never sweep-delete.
Quitting apps mid-task1 GB isn't worth a dropped call or lost session. Prefer Chrome's Memory Saver and its Task Manager (⇧⌥Esc) over quitting the browser.
Chasing a 200 MB orphanOrder recommendations by GB. A leaked helper is satisfying to find and irrelevant next to a 5 GB browser.

Reference

references/macos-memory-internals.md — compressor mechanics, jetsam bands, Apple Silicon swap semantics, and the full command inventory.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.