agentleFS
ch0615ch0615/claude-skills-public/skills/automation-review/SKILL.md

automation-review

Skill1 starsChanged 5 months agoMITView on GitHub

Mandatory RAM-safety pre-flight for any scheduled task, cron job, launchd agent, Cowork task, or Claude routine — picks the lightest runtime, prevents agent-session leaks, and covers launchd/iCloud/FDA gotchas. Trigger on "scheduled task", "cron", "launchd", "routine", "automation", "Mac RAM/slow", or "agent leak".

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. sidchaudhary/gtm-skills★ 3same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 12 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    The lesson: every recurring automation must run on the *lightest runtime that can do the job*.

    line 56
  2. Distinctive:

    Keep the automation inventory current and confirm a watchdog/reaper covers the fleet.

    line 85
  3. Distinctive:

    Before creating any recurring job, answer: does each run genuinely require an LLM?

    line 91
  4. Very specific:

    Fleet size: keep combined agent-routine fires well under ~10/day so a watchdog backstop can absorb any leak.

    line 125
  5. Distinctive:

    Concurrency: avoid overlapping long-running routines.

    line 127
  6. Distinctive:

    Cloud first: prefer a cloud routine for anything that doesn't need the local machine.

    line 129
  7. Distinctive:

    Deterministic wrapper: If the job's entire body is a fixed command (sync a file, hit an API, run a build), there's no reason for an LLM to …

    line 140
  8. Distinctive:

    Run a lightweight watchdog/reaper on its own low-frequency schedule (e.g.

    line 194
  9. Distinctive:

    When asked to create or change any recurring automation, OR to audit existing ones:

    line 214
  10. Very specific:

    Create the plist (see templates/launchd_job.plist) or the cloud routine.

    line 230
  11. Very specific:

    Test-run; confirm LastExitStatus = 0, no lingering process, expected log output.

    line 233
  12. Distinctive:

    If replacing an agent-based routine, disable the old one.

    line 235
  13. Distinctive:

    Update your Automation Inventory (see below) and any incident/handoff log.

    line 238
  14. Distinctive:

    Keep a single registered table of every automation you run — one place, updated in the same change whenever you add, remove, or convert a …

    line 245
  15. Distinctive:

    The watchdog is a backstop, not a budget: Keep the fleet small regardless.

    line 286

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

Automation Review & RAM-Safety Skill

Mandatory pre-flight review for every new or changed background automation — scheduled tasks / routines, Cowork tasks, cron jobs, and launchd agents — to prevent runaway agent-session leaks that can thrash a machine into an out-of-memory livelock. Chooses the lightest correct runtime for each job and enforces the hard-won launchd / permissions / cloud-sync gotchas below.

Prerequisites: Load any shared formatting/privacy rules your project defines before using this skill (optional — this skill works standalone).

This review is MANDATORY. Apply it BEFORE creating or modifying ANY recurring or scheduled automation, and whenever auditing existing ones. Do not create a scheduled task, routine, cron, or launchd job without running this review first.


When to Use

Trigger on (and ALWAYS before creating/editing any background automation):

  • "scheduled task", "routine", "cron", "crontab", "launchd", "launch agent", "plist"
  • "Cowork task", "background task", "/schedule", "schedule this", "automate", "automation"
  • "every N minutes/hours", "daily/hourly/weekly job", "recurring", "watcher", "watchdog"
  • "remind me every", "run this on a schedule", "set up a job", "set up a cron"
  • "computer is slow", "RAM", "memory", "swap", "too many agent processes", "livelock", "OOM"
  • Auditing or reviewing existing automations for resource use

Background — Why This Skill Exists (a real incident)

This skill exists because of a real failure mode, generalized here so the lesson transfers:

  • Symptom reported: "my machine is unresponsive, RAM is pegged." Real cause: an OOM livelock, not slow scripts.
  • Over a hundred leftover agent sessions — each a full coding-agent process that loads a couple dozen MCP servers — never exited, holding several GB of RAM on a 16 GB machine. Swap hit 100%; even SIGKILL couldn't keep up (processes stuck in uninterruptible swap-wait). Only a reboot cleared it.
  • Root cause: two scheduled agent routines fired constantly and each spawned a fresh agent session per run that never exited:
    • a "sync" job every 20 min = ~72 agent spawns/day
    • a "watcher" job every 30 min = ~48 agent spawns/day → ~120 agent spawns/day combined
  • The commands they ran were tiny and deterministic (a one-line shell script; a small Python poller). The waste was wrapping a one-line deterministic command in a full LLM agent session.
  • Fix: de-agented both to a lightweight local scheduler (launchd/cron), and installed a watchdog backstop that reaps stale sessions before they can pile up again.

The lesson: every recurring automation must run on the lightest runtime that can do the job. An agent runtime is the heaviest option and the one that leaked. Default away from agents.


Capabilities

1. Runtime Classification

  • Decide whether each run genuinely needs an LLM, or is deterministic.
  • Map the job to the lightest correct runtime (cloud → launchd/cron → agent routine).

2. De-Agenting

  • Convert a routine whose work is deterministic (or has one small NL step) into a launchd/cron job + deterministic wrapper.
  • Move single NL steps (relay/parse/format) into code (a messaging API call, a template fill).

3. launchd Authoring

  • Produce correct launch agents that survive the cloud-sync / permissions / bare-PATH / local-log traps below.

4. Frequency & Fleet Budgeting

  • Enforce frequency limits per runtime and keep the agent fleet small.

5. Verification

  • Confirm a job runs, exits cleanly (no lingering process), and delivers (incl. a notification selftest where relevant).

6. Inventory & Backstop

  • Keep the automation inventory current and confirm a watchdog/reaper covers the fleet.

The Core Decision — Which Runtime?

Before creating any recurring job, answer: does each run genuinely require an LLM? Be skeptical — most "routines" are deterministic.

Does each run need natural-language judgment?
 │
 ├─ NO — fixed command (run a script, sync a file, hit an API, publish a build)
 │      → launchd (local) or cron.  NOT an agent routine.
 │        [e.g. a "sync a queue into a file" job]
 │
 ├─ MOSTLY NO — deterministic core + ONE small NL step (relay/parse/format a message)
 │      → De-agent: move the NL step into a deterministic wrapper, run on launchd/cron.
 │        [e.g. a "watch a data feed → notify me" job: keep the polling deterministic and
 │         relay any alert lines through a scripted notification call]
 │
 ├─ YES — truly reasons over open-ended input every run (reads messages/photos, decides,
 │        writes prose, multi-tool judgment)
 │      → An agent-based scheduled task is justified — apply the Agent-Routine Budget below.
 │
 └─ And: does the data live in the cloud / not need the local machine (no local files,
        no local messaging app, no local-only apps)?
        → Prefer a CLOUD routine (zero local RAM). Matches "cloud by default" for anything
          that doesn't need the local machine.

Runtime preference order (lightest first): cloud routine → launchd / cron → agent-based scheduled task. Pick the lightest that works.


Agent-Routine Budget (only when an LLM is truly needed)

  • Frequency: at most a few per day. NEVER sub-hourly on an agent runtime — sub-hourly deterministic work goes to launchd/cron.
  • Fleet size: keep combined agent-routine fires well under ~10/day so a watchdog backstop can absorb any leak.
  • Concurrency: avoid overlapping long-running routines.
  • Lifecycle: assume the session may not exit cleanly; never depend on it exiting.
  • Cloud first: prefer a cloud routine for anything that doesn't need the local machine.
  • Close resident chats when done — some coding-agent tools persist chat/task sessions and auto-restore them on app launch, each holding a resident agent process. Close what you're not using.

De-Agent Patterns

Two patterns cover almost every case:

  1. Deterministic wrapper. If the job's entire body is a fixed command (sync a file, hit an API, run a build), there's no reason for an LLM to be in the loop at all — wrap the command directly in launchd/cron.
  2. ONE API call with a deterministic fallback, for the single NL step. If the only "intelligent" part of a routine is relaying, parsing, or lightly formatting output for a human (e.g., "watch this feed and text me when something changes"), don't spend a whole agent session on it. Write a small script that:
    • runs the deterministic core (the actual poll/sync/check),
    • emits a simple machine-parsable marker for anything that needs to go to a human (e.g. lines prefixed SEND\t),
    • and relays only those lines through a direct API/CLI call (a messaging API, a webhook, a notification command) — no agent session required. See templates/imessage_relay_wrapper.py for a worked example of this pattern (it uses macOS Messages via osascript, but the shape — deterministic core, marker lines, one scripted send step — applies to any notification channel).

launchd Conversion Playbook (the hard-won gotchas)

These are macOS-specific (launchd), but the concepts (permission scoping, sandboxed log paths, bare environments, verifying exit + lifecycle) generalize to cron/systemd elsewhere. Critical rules:

  1. Run through /bin/bash — never call /usr/bin/python3 or node directly as the launchd target — if your scripts or data live in a cloud-synced folder (iCloud Drive, Dropbox, Google Drive, etc). macOS Full Disk Access (FDA) is commonly granted to a shell like /bin/bash but not to arbitrary interpreters; a direct python/node target can fail reading a cloud-synced path with "Operation not permitted." bash reads the cloud-synced script and its python/node child inherits access. Use a tiny bash launcher that execs the interpreter (see templates/launchd_job.plist's comments and pattern).
  2. Local log paths only (e.g. ~/Library/Logs/...), never a cloud-synced path — launchd opens the log file at spawn time, before the cloud-sync client has necessarily mounted/synced that path. A cloud-synced log path makes the job fail to start (exit 78, empty log).
  3. Pin PATH — launchd starts jobs with a bare, minimal PATH. Set your language runtime (node/python via nvm/pyenv, etc.) plus standard bins in EnvironmentVariables, or export PATH inside the bash launcher.
  4. Schedule with StartCalendarInterval (an array of {Minute} dicts to emulate */N) or StartInterval.
  5. Notifications from launchd (e.g. iMessage on macOS) → osascript (grant the launcher Automation → Messages permission once). See templates/imessage_relay_wrapper.py for the pattern; swap in whatever notification channel you use (email API, Slack webhook, etc.) if you're not on macOS.
  6. Test before trusting: launchctl bootstrap gui/$UID <plist> → launchctl kickstart -k gui/$UID/<label> → confirm LastExitStatus = 0, no lingering PID, and the log shows expected output.
  7. Disable the old agent-based routine (whatever "disable" looks like in your scheduler) so it doesn't double-run. Keep its definition around for a while (reversible) rather than deleting it immediately.

The Watchdog Backstop

Run a lightweight watchdog/reaper on its own low-frequency schedule (e.g. every 15 min) whose only job is to catch a leak you introduce later. A reasonable shape:

  • No-ops under some healthy baseline count of sessions (e.g. under 15).
  • Above that threshold, reaps only OLD (e.g. >1 h) and currently-IDLE sessions, down to a floor (e.g. 10), always sparing the newest/active ones.
  • Prevents a livelock from a future mistake; does not fix one already in progress (only a restart/reboot does, once swap is pinned).
  • It is the last line of defense — not a license to spawn freely.

Quick manual check anytime (adjust the process match string to your agent tool):

pgrep -f 'your-agent-binary-name' | wc -l   # healthy: a handful

Process

When asked to create or change any recurring automation, OR to audit existing ones:

Step 1: Classify

  • Walk the Core Decision tree. Most "routines" are deterministic — confirm whether an LLM is truly needed each run.

Step 2: Choose the runtime

  • Pick the lightest that works: cloud routine → launchd/cron → agent-based scheduled task.

Step 3: Apply budget & gotchas

  • Agent runtime → enforce the Agent-Routine Budget (frequency, fleet size, cloud preference).
  • launchd → apply the launchd Conversion Playbook.

Step 4: Implement

  • De-agenting an NL step → write the deterministic wrapper (see templates/imessage_relay_wrapper.py).
  • Create the plist (see templates/launchd_job.plist) or the cloud routine.

Step 5: Verify

  • Test-run; confirm LastExitStatus = 0, no lingering process, expected log output. For notification jobs, run a labeled selftest and confirm delivery.
  • If replacing an agent-based routine, disable the old one.

Step 6: Register

  • Update your Automation Inventory (see below) and any incident/handoff log.
  • Re-confirm the watchdog still covers the fleet.

Automation Inventory (keep one, keep it current)

Keep a single registered table of every automation you run — one place, updated in the same change whenever you add, remove, or convert a job. Without this, it's easy to lose track of what's running and at what frequency, which is exactly how the original incident compounded. A minimal shape:

launchd/cron (local, near-zero RAM):

  • com.<you>.<job-name> — schedule, one-line description of what it does, and (if converted) a note like "was the <old-name> agent routine".

Agent-based scheduled tasks still justified (each genuinely reasons over NL):

  • <task-name> (frequency) — one line on why it needs an LLM every run.

Disabled / migrated to launchd:

  • list of old agent-routine names retired by a launchd/cron conversion, so nobody re-creates them by accident.

Templates

  • launchd_job.plist — annotated launch-agent template (bash entry point for FDA-style permission scoping, local logs, pinned PATH, calendar schedule).
  • review_checklist.md — the pre-flight checklist to run before shipping any automation.
  • imessage_relay_wrapper.py — deterministic pattern for de-agenting a "run a command → relay its messages to a notification channel" step (parse SEND lines → send), so it can run on launchd/cron instead of an agent.

Important Notes

  • Default away from agents. The agent runtime is the heaviest option and the one that leaked in the original incident. Justify it explicitly every time; prefer launchd/cron or cloud.
  • Sub-hourly ⇒ never an agent. Anything firing more than hourly must be launchd/cron or cloud.
  • launchd + cloud-synced paths needs a shell entry point with full permissions; logs must be local. These two traps cost the most debugging time on macOS.
  • Verify lifecycle, not just output. A job that runs is not enough — confirm it EXITS (no lingering process).
  • Cloud-by-default for anything that doesn't need the local machine.
  • The watchdog is a backstop, not a budget. Keep the fleet small regardless.

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.