diff --git a/AGENTS.md b/AGENTS.md index cdfa1df2..6300ae92 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,7 +16,7 @@ Decisions live in `docs/decisions.md`: - loop-claude: one session per project, its id derived from the checkout's path relative to `~/code`, or to `/` outside it - loop-claude: the archive keeps the raw transcript, and a failed archive stops the loop - machine load: a heavy command waits for one of the machine's heavy slots, one for every 4 CPUs, which every session shares, and loop-claude starts a worker only while at least a quarter of the machine's memory is available -- machine load: every container a session starts with `docker run` or `docker create` sets a memory limit as large as its work needs, which rule-hook's `docker-run-memory` enforces, and no daemon-wide cap limits all containers together +- machine load: every container a session starts has a memory limit and a swap limit as large as its work needs, which rule-hook's `docker-run-memory` enforces on `docker run` and `docker create`, and no daemon-wide cap limits all containers together - principles: about seven things per level, four or five where they act on each other, more where a reader finds them by name; crossing a limit asks for a grouping or a recorded reason - reading cost and `score-outcomes`: each waits for 10 finished chunks before it shows a median - reading cost: a rise is the last 5 chunks' median above the 5 before them, and files or refreshes one plan item diff --git a/CHANGELOG.md b/CHANGELOG.md index b6aedd80..b01ebffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- rule-hook has a new rule, `docker-run-memory`. It blocks a `docker run` or `docker create` with no memory limit and no swap limit, such as `--memory 4g --memory-swap 4g`, sized to what the work needs. `CLAUDE.md` asks for the same limits on a container a script or a compose file starts, which rule-hook can't see. rule-hook's `run-heavy` rule also now reads docker's `--tlscacert`, `--tlscert`, `--tlskey` and buildx's `--builder` as options that take a value, and reads `docker container run` as a run: `docker --tlscacert ca.pem build .` was not blocked outside run-heavy before. - Reviewers now mark a 🔴 or 🟡 `[misread]` where it arose because the implementer misread code that had already shipped. A round's commit title now counts the marked findings, as in `Answer stability round 1: 1 🔴, 2 🟡 (1 misread); …`, and rule-hook's `round-title-counts` blocks a round title without that count. `score-outcomes` shows the count on each finished item, and lists it after the medians for each chunk whose round titles carry it, newest first. A chunk whose round titles predate this change reads as unknown. - Sessions running at once no longer starve the machine. A new tool, `run-heavy `, runs a heavy command, such as a full gate, mutation tests, an e2e run or a `docker build`, once it holds one of the machine's heavy slots: one per 4 CPUs, shared by every session. `CLAUDE.md` has every session run its heavy commands under it, and rule-hook blocks a `docker build` or a mutation run outside it. loop-claude now waits to start a worker while less than a quarter of the machine's memory is available. - larv-review's skill now says a commit answering the external auto-reviewer takes no `Answer round` title, and that `larv-review round-count` doesn't list the auto-reviewer. A worker who followed the skill used to get a "not a pass" warning. diff --git a/CLAUDE.md b/CLAUDE.md index d3a7d3f2..907f52a3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -65,6 +65,7 @@ The rules only reviewers apply, for quality, comments, READMEs and prose, live i - Keep the project's main checkout (e.g. `~/code/log`, never a worktree) current: when it is behind `origin` — a merge landed, or a fetch shows it — run `git pull --ff-only` there instead of reporting the lag, never with `--autostash`: a dirty checkout is a finding to report, not to carry along. - Run a project's language runtime, package manager, and task runner through its container/tooling setup, never directly on the host unless a decision puts them there. Example: `docker compose run --rm app …`. - Tear down test containers after a run. +- Give every container you start a memory limit and a swap limit, as large as its work needs: `--memory 4g --memory-swap 4g` on `docker run`, or `mem_limit` and `memswap_limit` in a compose file, scripts included. rule-hook checks only the `docker run` and `docker create` in your Bash commands. - A heavy command loads the machine for minutes: a full gate, mutation tests, an e2e run, a `docker build`. Run each one under `~/.claude/bin/run-heavy`, as in `~/.claude/bin/run-heavy ./ci.sh`. run-heavy waits for one of the heavy slots that every session on the machine shares. Run it in the background, since the wait can outlast the Bash tool's timeout. - Delegate a task to a subagent only when you need just its conclusion: a search or read across many files, or work independent enough to run in parallel. Keep edits, and whatever you must check line by line, in your own thread: you would read a delegated diff again to check it. Score the task's L as for a `todo.md` item; a task that changes no file, such as a search, is L 1. `` below is the project's model id, such as `claude-opus-5-5`: the one loop-claude's prompt names as the project's, or else your own. Launch the subagent with the model and effort of the first case that fits: 1. A reviewer, a comprehension seat or the security pass: those loop-claude's prompt gives it. Given none, pass no model or effort, so it runs on your model. diff --git a/bin/docker_command.py b/bin/docker_command.py index d01b35bd..f2ea8976 100644 --- a/bin/docker_command.py +++ b/bin/docker_command.py @@ -5,12 +5,14 @@ from shell_command import launched # The options of docker, docker buildx and docker compose that take a value, so the value is not read as a subcommand. DOCKER_VALUED = frozenset({"--ansi", "--builder", "--config", "--context", "--env-file", "--file", "--host", "--log-level", "--parallel", "--profile", "--progress", "--project-directory", "--project-name", "--tlscacert", "--tlscert", "--tlskey", "-c", "-f", "-H", "-l", "-p"}) -# The subcommands that start a container, which takes the memory limit docker run's -m sets. +# The subcommands that make a container, whose memory limits docker reads from the same options. STARTS_CONTAINER = (["container", "create"], ["container", "run"], ["create"], ["run"]) # A size as docker reads one, such as 4g, 512M or 1.5GiB: the pattern go-units' RAMInBytes parses. SIZE = r"\d+(?:\.\d+)*[kKmMgGtTpP]?[iI]?[bB]?" -# -m4g is -m with its value attached; --memory-swap alone sets no limit. +# -m4g is -m with its value attached. ATTACHED_LIMIT = re.compile(rf"(?:-m|--memory=){SIZE}") +# --memory-swap takes a size, or -1 for unlimited swap. +SWAP_LIMIT = re.compile(r"--memory-swap(=.*)?") def docker_subcommand(arguments: list[str]) -> list[str]: @@ -30,12 +32,12 @@ def docker_subcommand(arguments: list[str]) -> list[str]: def unlimited(arguments: list[str]) -> bool: - """Whether docker's arguments start a container, with docker run or docker create, and set it no memory limit. + """Whether docker's arguments make a container, with docker run or docker create, and leave its memory or its swap without a limit. - A -m or --memory with a size among the container's own arguments, past its image, reads as the limit too: telling it apart needs every value-taking option of docker run. Taking only a size keeps python -m pytest from reading as one. + The container's own arguments, past its image, are read too: telling them apart needs every value-taking option of docker run. So a -m 4g there reads as a limit, while python -m pytest does not, since pytest is no size. """ subcommand = docker_subcommand(arguments) - return subcommand in STARTS_CONTAINER and not limited(arguments) and not helped(arguments, subcommand) + return subcommand in STARTS_CONTAINER and not (limited(arguments) and any(SWAP_LIMIT.fullmatch(word) for word in arguments)) and not helped(arguments, subcommand) def limited(arguments: list[str]) -> bool: diff --git a/bin/rule_hook/rules.py b/bin/rule_hook/rules.py index a90a037b..02192686 100644 --- a/bin/rule_hook/rules.py +++ b/bin/rule_hook/rules.py @@ -31,8 +31,8 @@ RULES: dict[RuleName, Rule] = { "git commit takes its message as one -m with no line break; -F, a second -m and a heredoc are blocked", ), "docker-run-memory": Rule( - "a container started with docker run or docker create has a memory limit, as large as its work needs, such as `--memory 4g --memory-swap 4g`, so one runaway container cannot starve the machine; --memory-swap equal to --memory keeps it out of swap", - "docker run, docker create, docker container run and docker container create, whether direct or through a launcher such as nice. A container a script or docker compose starts is not checked", + "a container made with docker run or docker create has a memory limit and a swap limit, as large as its work needs, such as `--memory 4g --memory-swap 4g`, so a runaway container fails alone instead of starving the machine; a swap limit equal to the memory limit keeps it out of swap", + "docker run, docker create, docker container run and docker container create, whether direct or through a launcher such as nice or timeout. A container a script or docker compose starts is not checked", ), "ignorefile-sorted": Rule( "each block of an ignore file is sorted in code-point order, as LC_ALL=C sort does, since its order carries no meaning; where order matters, such as a re-include after its exclude, split the block with a blank line or a comment", @@ -138,7 +138,7 @@ def command_breaches(command: str, simples: list[Simple], home: str) -> list[Bre if heavy(simple.words): breaches.append(Breach("run-heavy", f"run `{' '.join(simple.words)[:80]}` under `~/.claude/bin/run-heavy`, in the background", simple.directory)) if unlimited_container(simple.words): - breaches.append(Breach("docker-run-memory", f"give `{' '.join(simple.words)[:80]}` a memory limit as large as its work needs", simple.directory)) + breaches.append(Breach("docker-run-memory", f"give `{' '.join(simple.words)[:80]}` a memory limit and a swap limit as large as its work needs", simple.directory)) for commit in found: if commit.from_file: breaches.append(Breach("commit-one-line", "pass the message as one -m '', not from a file", commit.directory)) diff --git a/bin/rule_hook/test_rule_hook.py b/bin/rule_hook/test_rule_hook.py index b764aabf..707db4fb 100644 --- a/bin/rule_hook/test_rule_hook.py +++ b/bin/rule_hook/test_rule_hook.py @@ -107,7 +107,7 @@ class CommandBreaches(unittest.TestCase): self.assertEqual(checked("git commit -m 'Answer the question in the README'"), []) def test_a_docker_build_or_a_mutation_run_outside_run_heavy_breaks_run_heavy(self): - for command in ["docker build -t x .", "cd /w && docker buildx build .", "docker compose build", "docker compose -f x.yml --verbose build app", "uvx --with pytest 'mutmut>=3,<4' run", "cargo mutants --in-diff d", "npx stryker run", "vendor/bin/infection --git-diff-lines", "docker compose run --rm app mutmut run", "docker run --rm -m 4g -v /w:/w rust:1.90.0 cargo mutants", "docker compose exec app npx stryker run", "docker run -h box -m 4g rust:1.90.0 cargo mutants", "nice -n 19 docker build .", "env DOCKER_BUILDKIT=1 docker build .", "time -p docker compose build", "docker --tlscacert ca.pem build .", "docker --tlscert c.pem --tlskey k.pem build .", "docker buildx --builder b build .", "docker container run -m 4g rust:1.90.0 cargo mutants", "uvx mutmut --verbose run"]: + for command in ["docker build -t x .", "cd /w && docker buildx build .", "docker compose build", "docker compose -f x.yml --verbose build app", "uvx --with pytest 'mutmut>=3,<4' run", "cargo mutants --in-diff d", "npx stryker run", "vendor/bin/infection --git-diff-lines", "docker compose run --rm app mutmut run", "docker run --rm -m 4g --memory-swap 4g -v /w:/w rust:1.90.0 cargo mutants", "docker compose exec app npx stryker run", "docker run -h box -m 4g --memory-swap 4g rust:1.90.0 cargo mutants", "nice -n 19 docker build .", "env DOCKER_BUILDKIT=1 docker build .", "time -p docker compose build", "docker --tlscacert ca.pem build .", "docker --tlscert c.pem --tlskey k.pem build .", "docker buildx --builder b build .", "docker container run -m 4g --memory-swap 4g rust:1.90.0 cargo mutants", "uvx mutmut --verbose run"]: with self.subTest(command): self.assertEqual(checked(command), ["run-heavy"]) @@ -117,12 +117,12 @@ class CommandBreaches(unittest.TestCase): self.assertEqual(checked(command), []) def test_a_docker_run_or_create_without_a_memory_limit_breaks_docker_run_memory(self): - for command in ["docker run --rm node:24.22.1-alpine3.24 node x.js", "cd /w && docker run -v /w:/w alpine:3.22.2 true", "docker create alpine:3.22.2", "docker container run alpine:3.22.2 true", "docker container create alpine:3.22.2", "nice -n 19 docker run alpine:3.22.2 true", "docker -H unix:///d.sock run alpine:3.22.2 true", "docker run --memory-swap 4g alpine:3.22.2 true", "~/.claude/bin/run-heavy docker run alpine:3.22.2 true", "docker run --rm python:3.13.1 python -m pytest", "docker run alpine:3.22.2 git commit -m x", "timeout 60 docker run alpine:3.22.2 true", "docker run node:24.22.1-alpine3.24 node --help"]: + for command in ["docker run --rm node:24.22.1-alpine3.24 node x.js", "cd /w && docker run -v /w:/w alpine:3.22.2 true", "docker create alpine:3.22.2", "docker container run alpine:3.22.2 true", "docker container create alpine:3.22.2", "nice -n 19 docker run alpine:3.22.2 true", "docker -H unix:///d.sock run alpine:3.22.2 true", "docker run --memory-swap 4g alpine:3.22.2 true", "docker run -m 4g alpine:3.22.2 true", "docker run --memory=4g alpine:3.22.2 sh -c 'x --memory-swap 4g'", "~/.claude/bin/run-heavy docker run alpine:3.22.2 true", "docker run --rm python:3.13.1 python -m pytest", "docker run alpine:3.22.2 git commit -m x", "timeout 60 docker run alpine:3.22.2 true", "docker run node:24.22.1-alpine3.24 node --help"]: with self.subTest(command): self.assertEqual(checked(command), ["docker-run-memory"]) def test_a_docker_run_with_a_memory_limit_or_another_docker_call_passes_docker_run_memory(self): - for command in ["docker run -m 4g alpine:3.22.2 true", "docker run -m4g alpine:3.22.2 true", "docker run --memory 4g alpine:3.22.2 true", "docker run -m 512M alpine:3.22.2 true", "docker run -m 1073741824 alpine:3.22.2 true", "timeout 60 docker run -m 4g alpine:3.22.2 true", "docker run --rm --memory=4g --memory-swap=4g alpine:3.22.2 true", "docker container create -m 1g alpine:3.22.2", "docker run --help", "docker container run --help", "docker --help", "docker ps", "docker images", "docker container ls", "docker compose run --rm app go vet", "docker exec box true", "echo docker run alpine:3.22.2"]: + for command in ["docker run -m 4g --memory-swap 4g alpine:3.22.2 true", "docker run -m4g --memory-swap=4g alpine:3.22.2 true", "docker run --memory 512M --memory-swap -1 alpine:3.22.2 true", "docker run -m 1073741824 --memory-swap 2g alpine:3.22.2 true", "timeout 60 docker run -m 4g --memory-swap 4g alpine:3.22.2 true", "docker run --rm --memory=1.5GiB --memory-swap=1.5GiB alpine:3.22.2 true", "docker container create -m 1g --memory-swap 1g alpine:3.22.2", "docker run --help", "docker container run --help", "docker --help", "docker ps", "docker images", "docker container ls", "docker compose run --rm app go vet", "docker exec box true", "echo docker run alpine:3.22.2"]: with self.subTest(command): self.assertEqual(checked(command), []) diff --git a/bin/shell_command.py b/bin/shell_command.py index 69061760..49537e5e 100644 --- a/bin/shell_command.py +++ b/bin/shell_command.py @@ -1,4 +1,4 @@ -"""A shell command's simple commands, each as its words and the directory it runs in, and the tool each runs, through which launchers.""" +"""A shell command's simple commands, each as its words and the directory it runs in, and which tool a simple command runs through which launchers.""" import dataclasses import posixpath import re @@ -100,7 +100,7 @@ def tool_name(word: str) -> str: def launched(words: list[str], tools: typing.Collection[str]) -> Launch | None: - """The first of tools that the simple command runs, directly or through launchers; None where it runs none of them.""" + """Which of the given tools the simple command runs, directly or through launchers, taking the first one named; None where it doesn't run any of them.""" names = [tool_name(word) for word in words] # Past a launcher, the tool may follow the launcher's own options and assignments, as in nice -n 19 docker build; without one, the command itself is the tool. reachable = names if names[:1] and names[0] in LAUNCHERS else names[:1] diff --git a/docs/decisions.md b/docs/decisions.md index 7bde67ce..b4dc0e70 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -76,9 +76,11 @@ The cap is 5, `bin/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: by the 2026-10-23, lilleman. Serves goal 1.5. On 2026-10-22 ai-sandbox, with 8 CPUs and 16 GiB, thrashed for hours: four to six loops ran mutation tests, full gates, `docker build`s and QEMU-booting e2e tests at once, and nothing told one loop how busy the machine was. lilleman chose both limits; no standard sets either, and GNU parallel's `--memfree`, which does the memory wait's job, has no default. A slot is a file lock, so a session that dies frees its slot. The memory wait reads `/proc/meminfo` only, and off Linux a worker starts at once. `bin/machine_load/` holds the slots and the memory share, `bin/run-heavy` takes a slot, `CLAUDE.md` → "Working with the codebase" has every session use it, and loop-claude's worker waits for the share. rule-hook's rule `run-heavy` blocks a `docker build`, and a run of a mutation tool stability-reviewer names, outside run-heavy, whether direct or inside a container. No program can tell a gate script from a light one, so only `CLAUDE.md` asks a session to run a gate under run-heavy. Valid while one machine runs several loops at once. -## machine load: every container a session starts with `docker run` or `docker create` sets a memory limit as large as its work needs, which rule-hook's `docker-run-memory` enforces, and no daemon-wide cap limits all containers together +## machine load: every container a session starts has a memory limit and a swap limit as large as its work needs, which rule-hook's `docker-run-memory` enforces on `docker run` and `docker create`, and no daemon-wide cap limits all containers together -2026-10-24, lilleman. Serves goal 1.5. On 2026-10-23 ai-sandbox, with 8 CPUs and 7.6 GiB, hung until a hard reset, although its one heavy command held a slot: beside that mutation run, a reviewer's stress probes ran in `docker run` with no memory limit, each to 2 GiB. A limit makes a runaway container fail alone instead of taking the machine with it. The session sizes the limit, since lilleman wants a project to run heavier work where it needs to. rule-hook's rule reads only the commands a session types: a container a script or docker compose starts is out of its sight, and todo item 227 caps the ones a heavy command starts under run-heavy. lilleman turned down a daemon-wide cap, a dockerd `cgroup-parent` with a memory limit, which would see every container, on 2026-10-24: it is host config, and it would cap a project's heavy work too. Valid while sessions start their work in containers on a machine they share. +2026-10-24, lilleman. Serves goal 1.5. On 2026-10-23 ai-sandbox, then with 8 CPUs and 7.6 GiB of memory, hung until a hard reset, although its one heavy command held a slot. Beside that mutation run, a reviewer's stress probes ran in `docker run` with no memory limit, each to 2 GiB. A limit makes a runaway container fail alone instead of taking the machine with it. A swap limit is needed too: without one, docker lets a container swap as much again as its memory limit, and swapping is how the machine hung. The session sizes both limits, since lilleman wants a project to run heavier work where it needs to. rule-hook reads only the `docker run` and `docker create` in a session's Bash commands. A container a script starts is out of its sight, and so is a compose service, whose limits live in its compose file. `CLAUDE.md` → "Working with the codebase" asks a session for limits there, and todo item 227 caps the containers a heavy command starts under run-heavy. + +A daemon-wide cap would see every container: dockerd's `cgroup-parent`, given a memory limit. lilleman turned it down, since it is host config and would cap a project's heavy work too. Valid while sessions start their work in containers on a machine they share. ## principles: about seven things per level, four or five where they act on each other, more where a reader finds them by name; crossing a limit asks for a grouping or a recorded reason diff --git a/todo.md b/todo.md index 655087f9..e02067cd 100644 --- a/todo.md +++ b/todo.md @@ -16,8 +16,6 @@ | 59 | 0.4.0 | | | **Bound a run of unfinished verdicts on one chunk, so a worker and judge that disagree cannot cycle unattended without end.** | 2 | 1 | 3 | 4 | 3 | 1.4 by 6 | 6.0 | | 167 | 0.4.0 | | | **Refuse a `/security-review` or `/claude-security` Skill call below the project's rung, as rule-hook refuses such an Agent call.** | 3 | 2 | 3 | 6 | 2 | 1.1 by 4 | 5.6 | | 6 | 0.4.0 | | decision | **Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.** | 3 | 3 | 3 | 7 | 3 | 1.1 by 5 | 5.3 | -| 228 | 0.4.0 | | | **Block a `docker run` or `docker create` that sets no memory limit, in a rule-hook rule `docker-run-memory`.** | 2 | 1 | 3 | 4 | 3 | 1.5 by 3 | 2.9 | -| 225 | 0.4.0 | | | **Add the value-taking options of docker that `DOCKER_VALUED` lacks, so rule-hook's `run-heavy` rule reads their value as a value and not as the subcommand.** | 1 | 1 | 3 | 3 | 2 | 1.5 by 2 | 2.6 | | 227 | 0.4.0 | | | **Cap the memory of each container a heavy command starts under run-heavy at its slot's share, and have stability-reviewer size a mutation run's concurrency to fit that cap.** | 3 | 2 | 3 | 6 | 5 | 1.5 by 5 | 1.9 | | 1 | 0.5.0 | | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 1 | 2 | 1 | 2 | 1 | | 0.0 | | 219 | 0.5.0 | | | **Name the project's rung `project` in `bin/judge_replay/main.py`, `bin/subagent_rung/main.py` and `bin/review_replay/main.py`, in place of `anchor`, as `bin/model_routing/ladder.py` and `bin/loop_claude` name it.** | 1 | 1 | 3 | 3 | 2 | code health by 2 | 12.0 | @@ -89,19 +87,13 @@ rule-hook checks Agent calls (item 163) but no Skill calls. A worker that invoke Claude Code owns that file and writes it. `trust` reads it, changes it and writes it back, so a write that lands in between is lost. -### 228. Block a `docker run` or `docker create` that sets no memory limit, in a rule-hook rule `docker-run-memory`. - -Part of the 2026-10-23 hang item 227 describes: a reviewer's probes ran in `docker run` with no `--memory`, and each grew to 2 GiB. The rule reads `-m`, `--memory` and `--memory=…`, through the launchers and docker options `bin/rule_hook/heavy_command.py` already reads. A container a script starts, such as a project's `in_image` function, is out of the rule's sight. Test first in `bin/rule_hook/test_rule_hook.py`. - -### 225. Add the value-taking options of docker that `DOCKER_VALUED` lacks, so rule-hook's `run-heavy` rule reads their value as a value and not as the subcommand. - -Found by review of PR #370, against code that moved unchanged into `bin/rule_hook/heavy_command.py`. `DOCKER_VALUED` there lacks `--tlscacert`, `--tlscert` and `--tlskey`, so `docker --tlscacert ca.pem build .` is not blocked outside run-heavy, although `RULES["run-heavy"]` in `bin/rule_hook/rules.py` says a docker build is. It also lacks buildx's `--builder`, so `docker buildx --builder x build` gets through. Test first in `bin/rule_hook/test_rule_hook.py`. Also no test checks the "within two words" limit of `mutation_run`: a mutant that widens it survives mutmut; add one. - ### 227. Cap the memory of each container a heavy command starts under run-heavy at its slot's share, and have stability-reviewer size a mutation run's concurrency to fit that cap. -On 2026-10-23 ai-sandbox, with 8 CPUs and 7.6 GiB, hung in swap until a hard reset. One heavy command held its slot as the `machine load:` decision asks: adf-codec's stability reviewer ran Stryker with concurrency 4, each copy running the whole `node --test` suite, in one container that reached 4 GiB. Beside it, the same reviewer ran stress probes in `docker run` outside run-heavy, each to V8's 2 GiB heap limit. The slots cap how many heavy commands run at once, not how much memory one takes. +On 2026-10-23 ai-sandbox, then with 8 CPUs and 7.6 GiB, hung in swap until a hard reset. One heavy command held its slot, as the decision `machine load: a heavy command waits for one of the machine's heavy slots, …` asks: adf-codec's stability reviewer ran Stryker with concurrency 4, each copy running the whole `node --test` suite, in one container that reached 4 GiB. The container was started by the project's own script, so rule-hook's `docker-run-memory` can't see one like it. The slots cap how many heavy commands run at once, not how much memory one takes. -run-heavy cannot place the command in a cgroup: none is delegated to the user, and dockerd starts the containers outside the command's process tree. So run-heavy puts first on the command's `PATH` a `docker` that adds `--memory` and `--memory-swap`, both at the slot's share, to each `docker run`, `docker create` and `docker container run|create` that sets neither, then runs the real docker. It tells such a call apart with `bin/docker_command.py`'s `unlimited`, which rule-hook's `docker-run-memory` reads too. A container that sets its own `--memory` keeps it, so a project runs heavier work where it needs to (lilleman, 2026-10-24). The share is the memory the `machine load:` decision leaves to heavy commands, three quarters of MemTotal, split evenly across the slots. A `docker compose` service, and a docker named by its full path, keep no cap. Update the `machine load:` decision, run-heavy's help and stability-reviewer's mutation step, which sizes Stryker's or mutmut's concurrency so the run fits the cap. Once run-heavy caps them, let rule-hook's `docker-run-memory` pass a `docker run` under run-heavy, which `shell_command.launched` reports among a call's launchers. Test first in `bin/run_heavy/test_run_heavy.py`. +run-heavy cannot place the command in a cgroup: none is delegated to the user, and dockerd starts the containers outside the command's process tree. So run-heavy puts first on the command's `PATH` a `docker` that adds `--memory` and `--memory-swap`, both at the slot's share, to each `docker run`, `docker create` and `docker container run|create` that leaves either without a limit, then runs the real docker. It tells such a call apart with `bin/docker_command.py`'s `unlimited`, which rule-hook's `docker-run-memory` reads too. A container that sets its own limits keeps them, so a project runs heavier work where it needs to (lilleman, 2026-10-24). A compose service, and a docker named by its full path, keep no cap. + +The slot's share is a new choice, to record in the decision `machine load: every container a session starts has …`: that decision's elder, `machine load: a heavy command waits …`, starts a worker only while a quarter of the memory is available, so the share is the other three quarters of MemTotal, split evenly across the slots. Update both decisions, run-heavy's help and stability-reviewer's mutation step, which sizes Stryker's or mutmut's concurrency so the run fits the cap. Once run-heavy caps them, let `docker-run-memory` pass a `docker run` under run-heavy, which `shell_command.launched` reports among a call's launchers. Test first in `bin/run_heavy/test_run_heavy.py`. ### 1. Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.