agentleFS
bnishitbnishit/machogs/AGENTS.md

machogs

AGENTS.md2 starsChanged 46 days 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 code style.

    Of the AGENTS.md files we read, the 35,266 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.

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
  1. Very specific:

    Read findings. Each one carries a story — say that, close to verbatim.

    line 16
  2. Distinctive:

    Ask before closing anything: Wait for the user to agree.

    line 19
  3. Very specific:

    Use machogs kill for unattended work.

    line 32
  4. Very specific:

    Never work around the protections: If a process reads protected, the script is refusing on purpose — it belongs to a running coding session.

    line 45
  5. Very specific:

    Do not kill it by hand with kill -9 instead.

    line 47
  6. Very specific:

    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.

    line 48
  7. Very specific:

    Never say idle findings were making the fan spin: Check cpu. If everything found is near zero, they were wasting memory, not heating the …

    line 51
  8. Very specific:

    If a user doubts the tool, run machogs --check.

    line 122

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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.

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

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

  1. machogs --json --sessions — always start here. It closes nothing.
  2. Read findings. Each one carries a story — 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.
  3. Ask before closing anything. Wait for the user to agree.
  4. 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 --dupes if duplicate servers are part of what the user agreed to) when you are acting for them.
  5. Report what actually closed — re-read findings and check action. 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.

The native app has a separate opt-in automatic cleanup mode for confirmed abandoned automation helpers and tools from chats gone still (section 2c). This is not permission for an agent to close other findings. --abandoned-only reports only the strict automatic candidates; kill --abandoned-only --target=PID:IDENTITY rechecks those exact candidates. The app observes them for five continuous minutes first. It never auto-closes connected helpers or live sessions and never force-kills automatic candidates.

Never do these

  • Never run kill before 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 with kill -9 instead.
  • 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. 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_CPU and SPIN_CPU_SECONDS exist for testing the detector. Lowering them in real use turns busy processes into false positives you will then kill.
  • Never remove a coding copy before showing machogs worktrees and asking. Pass back only the exact path of a safe item. A keep item has unsaved work; never remove it by hand with git worktree remove --force instead.
  • Never clear a cache before showing the disk finding and asking. Only pass back the exact path from a safe item. Never improvise a path, and never use check or yours items as deletion targets.
  • Never free a port before showing its owner, project, protections, and note. A system or protected listener stays. If note explains a setting or service command, relay that instead of trying to kill the process.

Exit codes

Enough to act on without parsing anything.

CodeMeaning
0clean, or a kill run that finished
10report mode found something a human should look at
2bad arguments
3disk 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

ValueWhat to do
reapablekill would take this. Show it to the user first.
needs-dupes-flagOnly killed if you pass --dupes. Mention that.
protectedRefused on purpose. Leave it alone.
never-killedA live coding session. Report only.
killedActually reaped during this run.

section

IdMeaning
1orphaned runaway — parent died, still burning CPU
1bstuck spinner — parent alive, hours of CPU burned, still hot
2leaked MCP server — owning app is gone
2bduplicate MCP servers under one app
3stranded headless browser
4zombie app helper — app quit, helpers survived
5Claude 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?" Use machogs blame --json to 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_7d is null when --since is 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=Nd everything 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 (or machogs disk --json) — the read-only storage X-ray for "why is my disk full?". It measures the usual junk spots with a verdict per item: safe, check, or yours. Relay the how field. 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> kill frees a port, with the usual refusals: system: true and noted launchd squatters (AirPlay's ControlCenter on 5000/7000 — relay the note, killing it does not stick) are never killed. protected: true means 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.

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.