limited-run
Skill0 starsChanged 10 days agoMITView on GitHub
Use when the user types /limited-run, when about to start a dev server, watcher, build, test run, docker container or any long command on a machine shared with other agent sessions, when RAM runs low or the PC slows down, when an earlier turn left node, vite, vitest, jest, java, gradle or python processes running, or before ending a turn or a session that started processes.
In this repository12 other files it gives its agents.
- chrome-bidiSkill
- claude-model-effortSkill
- clean-codeSkill
- clean-commitsSkill
- drive-projectSkill
- other-model-effortSkill
- progress-boardSkill
- resource-guardSkill
- stop-resume-agentsSkill
- strip-ai-tracesSkill
- using-git-worktreesSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 39
Every dev server, watcher, build, test run and container goes through run.py start.
- Very specific: line 56
Stop each task the moment its result is in hand: the page loaded, the test passed or failed, the build finished.
- Very specific: line 58
Before ending a turn or a session, run list and stop what is left.
- Very specific: line 60
Never stop a process this tool did not start, even one that looks like a leftover: another session may own it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Running task processes with a cap, then closing them
Several agent sessions share one machine. Each process an agent starts takes RAM and CPU from all the others until someone stops it, and a dev server or watcher left behind keeps doing so for hours. So every task process starts with a RAM cap and low priority, is tracked, and is stopped as soon as its result is in hand.
<skill> is this folder. The script needs Python 3, standard library only:
python -I "<skill>/scripts/run.py" start [--ram-mb N] [--name NAME] [--cwd DIR] -- <command...>
python -I "<skill>/scripts/run.py" list
python -I "<skill>/scripts/run.py" stop NAME|PID
python -I "<skill>/scripts/run.py" stop --allstart runs the command, waits for it and returns its exit code (2 is a refusal, 1 a failure of the tool,
128 plus the signal number when the launcher was stopped). It prints one line first:
limited-run: <name> pid <pid>, cap <N> MB, below normal priority. The default cap is half of the free RAM,
between 512 and 4096 MB; --ram-mb 0 drops the memory cap and keeps the low priority. The default name is the
command's first word plus a counter (npm-1); a name already used by a live task is refused.
| System | What start does |
| Windows | A Job Object holds the whole tree: one RAM cap for all its processes together, below normal priority, and the tree dies with the launcher, even when the launcher is killed. The command starts suspended and joins the job before it runs, so no child escapes. |
| Linux, macOS | New session, nice 10, and RLIMIT_AS at the cap. That limit applies to each process on its own, not to the tree, and it counts address space: node and JVMs reserve far more than they use, so give them --ram-mb 0 and the runtime's own cap below. |
Ctrl+C or SIGTERM on the launcher stops the whole tree and removes the record. Records live in
<system temp>/limited-run/ (or the folder in LIMITED_RUN_STATE); list drops those whose launcher died.
Rules
These hold for every agent, in every project.
Every dev server, watcher, build, test run and container goes through
run.py start. When the agent cannot wrap a command (a tool runs it for you), give the runtime its own cap, picked from free RAM the same way:Runtime Cap node, vite, next node --max-old-space-size=<MB>, orNODE_OPTIONS=--max-old-space-size=<MB>java -Xmx<MB>m; gradle:org.gradle.jvmargs=-Xmx<MB>mingradle.propertiesvitest, jest --maxWorkers=2make, cargo -j2turbo, lerna --concurrency 2; pnpm:--workspace-concurrency 2; nx:--parallel=2docker docker run --memory <MB>m --cpus 1; compose:mem_limitandcpusunder the serviceInside
run.py startthe runtime cap still helps: set the node heap or-Xmxto about three quarters of the cap, since the cap counts the whole process and the heap is only part of it.- A long-lived process (server, watcher) runs in the agent's background mode, still wrapped:
run_in_backgroundin Claude Code, or the agent's equivalent. Never&alone,nohuporstart /bwithout the wrapper. - Stop each task the moment its result is in hand: the page loaded, the test passed or failed, the build
finished.
stop <name>stops the whole tree. - Before ending a turn or a session, run
listandstopwhat is left. A task kept on purpose for the user (a preview they are looking at) is named in the reply with the command that stops it. - Never stop a process this tool did not start, even one that looks like a leftover: another session may own
it.
stoponly acts on records this tool wrote, and checks the process is still the one recorded.
Following this from other agents
Claude Code reads this folder as a skill. Codex CLI, Gemini CLI and Qwen Code do not load skills: add one line
to their instructions file (AGENTS.md for Codex CLI, GEMINI.md for Gemini CLI, QWEN.md for Qwen Code),
global or per project, for example:
Start every server, watcher, build and test run as described in <absolute path>/limited-run/SKILL.md, and stop them before ending.Any other agent that reads an instructions file takes the same line. Hooks that enforce this are not part of the skill.
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.

