machogs
AGENTS.md2 starsChanged 2 months agoMITView on GitHub
Instructions for coding agents (Claude Code, Codex, Cursor, and friends) asked to work out why a Mac is slow or its fan is loud. machogs inspects running processes and reports the ones worth closing. The default process, disk, and port reports are read-only. Process and port actions need an explicit kill; cache clearing needs disk clear <path> and is limited to an engine allow-list of rebuildable caches and the Trash. 1. machogs --json --sessions — always start here. It closes…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,691 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- docs/llms.txtllms.txt
- llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 16
Read findings. Each one carries a story — say that, close to verbatim.
- Distinctive: line 19
Ask before closing anything: Wait for the user to agree.
- Very specific: line 32
Use machogs kill for unattended work.
- Very specific: line 38
Never work around the protections: If a process reads protected, the script is refusing on purpose — it belongs to a running coding session.
- Very specific: line 40
Do not kill it by hand with kill -9 instead.
- Very specific: line 41
Never claim the machine is fixed because processes died: If host.swap_pct is above 80, the machine is thrashing and only a reboot fixes it.
- Very specific: line 44
Never say idle findings were making the fan spin: Check cpu. If everything found is near zero, they were wasting memory, not heating the …
- Very specific: line 112
If a user doubts the tool, run machogs --check.
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md 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.
Files
Driving machogs as an agent
Instructions for coding agents (Claude Code, Codex, Cursor, and friends) asked to work out why a Mac is slow or its fan is loud.
The tool
machogs inspects running processes and reports the ones worth closing. The
default process, disk, and port reports are read-only. Process and port actions
need an explicit kill; cache clearing needs disk clear <path> and is limited
to an engine allow-list of rebuildable caches and the Trash.
Use this workflow
machogs --json --sessions— always start here. It closes nothing.- Read
findings. Each one carries astory— say that, close to verbatim. It is already written for a person: it names the app to blame, what the thing is, and what it has cost. Do not translate a pid and a percentage yourself. - Ask before closing anything. Wait for the user to agree.
- Then either:
- hand control back with
machogs fix, which asks the user about each item itself (best when the user is at the keyboard), or machogs kill --json(add--dupesif duplicate servers are part of what the user agreed to) when you are acting for them.
- hand control back with
- Report what actually closed — re-read
findingsand checkaction. In plain (non-JSON) mode the tool prints a receipt: cores freed, CPU time already burned, what it would have cost by tomorrow. Pass that on. It is the part the user cares about, and the battery figure in it is an estimate — keep the hedge, do not promise a number.
Note: machogs fix needs a real terminal and will refuse to run without one.
Use machogs kill for unattended work.
Never do these
- Never run
killbefore the user has seen the findings and agreed. A finding is a suggestion, not a verdict. Processes may hold unsaved work. - Never work around the protections. If a process reads
protected, the script is refusing on purpose — it belongs to a running coding session. Do not kill it by hand withkill -9instead. - Never claim the machine is fixed because processes died. If
host.swap_pctis above 80, the machine is thrashing and only a reboot fixes it. Say so. - Never say idle findings were making the fan spin. Check
cpu. If everything found is near zero, they were wasting memory, not heating the machine. Say that instead — the user will notice if the fan does not change. - Never lower the thresholds to make findings appear.
HOT_CPUandSPIN_CPU_SECONDSexist for testing the detector. Lowering them in real use turns busy processes into false positives you will then kill. - Never clear a cache before showing the disk finding and asking. Only pass
back the exact path from a
safeitem. Never improvise a path, and never usecheckoryoursitems as deletion targets. - Never free a port before showing its owner, project, protections, and note.
A system or protected listener stays. If
noteexplains a setting or service command, relay that instead of trying to kill the process.
Exit codes
Enough to act on without parsing anything.
| Code | Meaning |
0 | clean, or a kill run that finished |
10 | report mode found something a human should look at |
2 | bad arguments |
3 | disk clear refused the path or found no target |
JSON shape
--json prints exactly one object on stdout and nothing else.
{
"mode": "report",
"host": {"load": 4.27, "cores": 10, "swap_used_mb": 13973.88,
"swap_total_mb": 14336.00, "swap_pct": 97, "uptime_days": 20},
"summary": {"reapable": 0, "killed": 0},
"findings": [
{"pid": 57377, "section": "2b", "action": "needs-dupes-flag",
"cpu": 0.0, "cpu_seconds": 4, "age": "01:09:11",
"owner": "ChatGPT", "what": "browser-control helper",
"detail": "duplicate playwright-mcp under ChatGPT",
"story": "ChatGPT quietly started 11 copies of the same browser-control helper. All idle, none cleaned up, oldest sitting there 1 hour."}
]
}action
| Value | What to do |
reapable | kill would take this. Show it to the user first. |
needs-dupes-flag | Only killed if you pass --dupes. Mention that. |
protected | Refused on purpose. Leave it alone. |
never-killed | A live coding session. Report only. |
killed | Actually reaped during this run. |
section
| Id | Meaning |
1 | orphaned runaway — parent died, still burning CPU |
1b | stuck spinner — parent alive, hours of CPU burned, still hot |
2 | leaked MCP server — owning app is gone |
2b | duplicate MCP servers under one app |
3 | stranded headless browser |
4 | zombie app helper — app quit, helpers survived |
5 | Claude Code session — reported, never killed |
Verifying the safety net
If a user doubts the tool, run machogs --check. It lists every automation
process and whether the script would refuse to kill it, and why. It kills
nothing. Anything owned by Codex or Claude Code must read PROTECTED.
Reading the result honestly
summary.reapable counts what kill would take in the mode you ran.
Duplicate MCP servers are not counted unless --dupes was passed, so a run
reporting reapable: 0 can still have findings worth showing the user. Read
findings, not just the summary.
Other jobs worth surfacing
The report forms below are read-only. Their action forms are not.
machogs blame— a scoreboard of which app leaves the most behind on this machine, built from the log over time. Useful when the user asks "why does this keep happening?" Usemachogs blame --jsonto read it, and--since=7d(any whole number of days) to answer "is it still happening?". JSON shape:{"mode":"blame","since","first_seen","apps":[{"app","closed", "cpu_seconds","worst_cpu_seconds","closed_last_7d"}],"total":{"closed","cpu_seconds"}}.closed_last_7dis null when--sinceis set.--app=NAME(any case) narrows it to one app.machogs history --json— the individual closes behind the scoreboard, newest first:{"closes":[{"time","pid","app","what","cpu","cpu_seconds"}]}. Last 20 by default; with--since=Ndeverything in the window. Takes--app=NAME. Use it when the user asks "what did you close?"machogs brag— the same totals as a card the user can paste somewhere. Offer it only if they seem pleased; never push it.machogs disk(ormachogs disk --json) — the read-only storage X-ray for "why is my disk full?". It measures the usual junk spots with averdictper item:safe,check, oryours. Relay thehowfield. After explicit consent,machogs disk clear <exact-safe-path>clears one allow-listed cache or the Trash. The engine refuses all other paths. Takes about 15 seconds.machogs ports/machogs port <n>(both take--json) — who is squatting which port; the answer to "port 3000 already in use".machogs port <n> killfrees a port, with the usual refusals:system: trueand noted launchd squatters (AirPlay's ControlCenter on 5000/7000 — relay thenote, killing it does not stick) are never killed.protected: truemeans a live Claude Code session holds it; tell the user to quit it there. Ask before freeing a port, same as every other kill.
The log they read is ~/Library/Logs/machogs.log, one tab-separated line per
close: time, pid, app to blame, what it was, CPU%, CPU seconds.
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
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.

