More screenshots

    Works with the AI Agents you already use

    Machine Guard: CPU, RAM and GPU Limits for Heavy Agent Jobs

    by asad eisa

    1

    Runs builds, tests, renders and training through one command that keeps CPU, RAM and GPU under your limits, stops a runaway job before the computer freezes or crashes, and reports the peak of every part.

    Free

    Security scanned
    Machine Guard: CPU, RAM and GPU Limits for Heavy Agent Jobs

    Machine Guard: CPU, RAM and GPU Limits for Heavy Agent Jobs

    Example session with this skill installed

    My laptop froze last week while an agent was running a build. Before I trust you with heavy jobs again, show me what happens when a job goes wrong. Run burn_all_cores.py (it starts one worker per core) and eat_memory.py (a deliberate memory leak), and keep my machine safe. Use a 60 % RAM limit for the leak so the test stays far from danger.

    • Read your context and instructions
    • Compiled the machine guard

    Summary
    Checked the machine, then ran both stress scripts through Machine Guard. The 12-worker job finished normally while CPU stayed under the 65 % limit. The memory leak was stopped 7 seconds after it started, and the memory came back.

    What happened
    Step Result
    check before starting This laptop has 12 cores: heavy jobs run on 6 of them. CPU 6 %, RAM 46 %, 7.9 GB left for a job: OK
    burn_all_cores.py (12 workers) All 12 workers pinned to 6 cores at low priority. Peak CPU 62 % (limit 65 %), RAM 48 %. Finished in 22 s, exit code 0
    eat_memory.py (2 leaking workers) Grew 1.2 GB every 2 s. Stopped when RAM reached 64 % (limit 60 %): 4 processes stopped, job memory 4.2 GB at the stop
    After the stop RAM back to 47 %
    Checked before delivery
    Check Result
    No job could take every core ✓
    CPU stayed under the limit during the 12-worker job ✓ (62 %)
    Leak stopped before the machine ran out of memory ✓
    Every process the leak started was stopped, not only the parent ✓
    Peaks reported for CPU, RAM, NVIDIA and Intel GPU ✓
    Next steps

    The limits are yours to set: say "keep RAM under 70 %" or "let builds use up to 90 % CPU" and I'll save it with guard.py config so every later run uses it.
    Your next build will run through the guard with the worker count check recommends.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    AI agents size jobs for a server. They run make -j$(nproc), start one test worker per core, fill the GPU with a render, or run a script that leaks memory. On a laptop that means a frozen desktop, fans at full speed, an out-of-memory crash or a blue screen. The agent never notices, because from inside the job everything looked fine. This skill was written after exactly that: an agent's render blue-screened a 12-core laptop.

    This skill gives your agent one command that runs any job inside CPU, RAM and GPU limits, stops it before the machine falls over, and tells the agent how to retry it lighter.

    What it handles

    Check first: guard.py check shows the load of every part, how many workers fit (-j6, --workers 6), how much RAM is left for the job, and OK or WAIT. Every core is not an option: guard.py run -- <command> starts the job at low priority and pinned to part of this machine's cores (about half at the default 65 % limit: 2 of 4, 4 of 8, 8 of 16). Every compiler, browser, ffmpeg or worker process the job starts later inherits both. On Windows the job is pinned before it runs a single instruction. Throttling: if CPU stays over the limit anyway (on macOS, or because of other load), the job is paused and resumed within each second until it is back under the limit. Runaway stop: RAM over its limit for 3 seconds (or 3 points over it at once), the NVIDIA card too hot, the CPU too hot, or the job over its own memory cap: the job and every process it started are stopped, and the agent gets exit code 75 plus a next: line telling it how to retry lighter. Every part watched: CPU, RAM, the job's own memory, NVIDIA use, encoder, temperature and memory (nvidia-smi), and on Windows also Intel and AMD GPU use from the same counters Task Manager shows. A warning when one part sits at 95 % while others are idle. Peaks and a machine-readable result: a peaks: line and one GUARD_RESULT {json} line after every job, plus an optional per-second CSV log. Fits your machine, not ours: core counts, worker counts and free RAM are read from the computer it runs on, from a 4-core laptop to a 64-core workstation. The defaults (CPU 65 %, RAM 80 %, NVIDIA 85 C) are a cautious starting point. Raise them for more speed or lower them for more safety, per run (--cpu 90) or once for every project (guard.py config --cpu 90 --ram 90 --global). --cpu 100 lifts the CPU limit entirely. Windows, Linux and macOS. Needs only Python and psutil. Free and open source (MIT).

    macOS cannot pin processes to cores; the CPU limit is held by throttling instead, which is coarser.
    GPU temperature is read for NVIDIA cards only (nvidia-smi). Intel and AMD GPU use is read on Windows only, without temperature. Apple GPUs are not read.
    CPU temperature is read on Linux only, when the kernel exposes it.
    The RAM limit is for the whole machine. A job is stopped when the machine as a whole passes it, even if another program used the memory. Use --job-ram to cap the job itself.
    A very fast leak can pass the RAM limit by a few points in the second before it is stopped.
    It guards jobs started through it. It does not limit programs that are already running or that the agent starts some other way.
    Shell syntax (&&, pipes, redirects) is not interpreted; wrap it in bash -c or cmd /c.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 5 days ago

    • Free with an Agensi account

    Windows only

    Software
    Pythonpsutil

    Run: pip install psutil. Pinning to cores works on Windows and Linux; macOS uses throttling instead. NVIDIA readings need the NVIDIA driver (nvidia-smi). Intel/AMD GPU use is read on Windows only.

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    File Scopes

    machine-guard/**
    .machine-guard.json
    ~/.machine-guard.json
    *.csv

    Runs Python scripts locally. It starts only the command the agent passes to it, with an argument list and no shell, at low priority, and it pauses, resumes or stops only that job and the processes it started. If nvidia-smi is installed, it runs it every 2 seconds to read the NVIDIA card; on Windows it reads GPU use from system counters through pdh.dll and dxgi.dll. It reads limits from .machine-guard.json (current folder and home folder), writes that file only when you run config, and writes a CSV only when given --log. No network access, no API keys, no environment variables.

    Listed5 days ago

    What's inside

    Frequently Asked Questions

    Only as much as you allow. At the default 65 % CPU limit a job gets about half of your cores (4 of 8, 8 of 16), so a build that would have used all of them takes longer, but the desktop and the agent stay responsive. Want more speed? Raise it: --cpu 90 for one run, guard.py config --cpu 90 --global for every project, or --cpu 100 to lift the CPU limit.

    It stops the job and every process the job started, prints why, the peaks, and a next: line ("retry with fewer workers or a smaller batch"), and exits with code 75. The skill tells the agent to make the job lighter before trying again, never to rerun it unchanged or raise the limit by itself.

    No. CPU, RAM and job-memory limits work on any machine. With an NVIDIA card (and its driver), the guard also reads GPU use, encoder, temperature and memory, and stops a job that overheats the card. On Windows it also reads Intel and AMD GPU use.

    The defaults (CPU 65 %, RAM 80 %, NVIDIA 85 C) are cautious, meant for a laptop. Everything else is measured on your computer: cores, free RAM, GPU. On a desktop or workstation you will probably want higher limits; on a small or hot laptop, lower ones. Every limit goes both ways and can be saved once with guard.py config.

    Yes, with one difference: macOS cannot pin a process to cores, so the guard holds the CPU limit by pausing and resuming the job within each second. RAM, job memory and the summary work the same as on Windows and Linux.

    New in LLM Ops

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.

    Free