From 3a0097e95946cba81f023e2af9ffa671e4d743f5 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 3 Dec 2026 14:25:42 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=201:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=203=20=F0=9F=9F=A1=20(0=20misread);=20call=20proj?= =?UTF-8?q?ect-config=20by=20its=20path=20in=20the=20README,=20pin=20the?= =?UTF-8?q?=20run-heavy=20breach,=20say=20who=20has=20the=20tools=20on=20P?= =?UTF-8?q?ATH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- bin/loop_state/paths.py | 5 +++-- bin/metric_bench/test_metric_bench.py | 2 +- bin/repo_checks/test_tools_named_bare.py | 14 +++++++++----- bin/rule_hook/test_rule_hook.py | 4 ++++ workflow-bench/advisor_bench.py | 2 +- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f09ca7d7..240256cf 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ To keep loop-claude's transcripts and the reports small, add a crontab line that Cron runs it with its own `PATH` and environment. Where the `python3` on cron's `PATH` is older than 3.14, or you set `LOOP_CLAUDE_TRANSCRIPTS`, set `PATH` or that variable in the crontab too. -To get loop-claude's questions and stops as DMs from a bot, write the bot's token, your username or member ID and, for Mattermost, the server into `~/.claude-projects/.env`, in the keys `notify --help` names, run `chmod 600` on it, and add `env-file = "~/.claude-projects/.env"` and `notifier = "mattermost"` (or `"slack"`) to the project's config, as Install → "Set up a project" describes. +To get loop-claude's questions and stops as DMs from a bot, write the bot's token, your username or member ID and, for Mattermost, the server into `~/.claude-projects/.env`, in the keys `~/.claude/bin/notify --help` names, run `chmod 600` on it, and add `env-file = "~/.claude-projects/.env"` and `notifier = "mattermost"` (or `"slack"`) to the project's config, as Install → "Set up a project" describes. ### Set up a project @@ -171,7 +171,7 @@ mkdir -p ~/.claude-projects/acme && cd ~/.claude-projects/acme git init $EDITOR config.toml git add config.toml && git commit -m "Add the config" -cd ~/code/acme-billing && project-config +cd ~/code/acme-billing && ~/.claude/bin/project-config ``` The last line prints each setting's path once the config is complete. @@ -228,7 +228,7 @@ It applies only those commits on the newest tag, tests them with `ci.sh`, tags a ## Tools -loop-claude puts the release's tools first on the `PATH` of every claude it starts, so this README and the rules name each tool bare, as in `metric-bench`. Install puts only `loop-claude` on your shell's `PATH`: there, call another by its path, `~/.claude/bin/`, from the project's checkout. The tools under `~/.claude` are the release's; test a change to one from `~/code/claude-config/bin`. The tools are listed in alphabetical order, and the packages under `bin/` follow under their own heading. +loop-claude, do-epic and `task-bench gather` put the release's tools first on the `PATH` of every claude they start, so this README and the rules name each tool bare, as in `metric-bench`. Install puts only `loop-claude` on your shell's `PATH`: there, and in a claude you start from it yourself, call another by its path, `~/.claude/bin/`, from the project's checkout. The tools under `~/.claude` are the release's; test a change to one from `~/code/claude-config/bin`. The tools are listed in alphabetical order, and the packages under `bin/` follow under their own heading. - `chunk-pr open|sync|ready|push|merge|clean|open-epic` opens a chunk's pull request as a draft, brings its branch level with origin's default branch, marks it ready and merges it once its checks pass, with `gh` on a GitHub origin and `tea` elsewhere. Where the project's config sets `epic-branch`, the pull request goes into the epic's working branch instead, `push` pushes later commits and asks the auto-reviewer for a review, and `open-epic` opens the pull request from that branch into the default branch. The chunks of one project merge one at a time: in its turn, `merge` brings the branch level again, finishes the plan items its `--finish` flags name, and waits for the checks. Under `merge = "human"` it then marks the pull request ready and leaves the merge to a person. Once the pull request is merged, `clean` removes the chunk's worktree and branch and fast-forwards the main checkout. `chunk-pr --help` states the steps. - `chunk-preflight` finds the mechanical facts a chunk starts from, and with `--worktree` makes its worktree; `loop-claude` runs it with `--worktree` before it routes each chunk, and `chunk-preflight --help` lists the facts. @@ -336,7 +336,7 @@ Test on the host with `bin/run-tests`, which runs pytest through `uvx`, pinned i CI runs `ci.sh` on every pull request, and `main` doesn't merge anything until it passes. The script runs the same tests on the committed HEAD in a pinned Python container. Run it under `run-heavy` to reproduce a CI failure, with Docker on `PATH` and its socket at `/var/run/docker.sock`, which the container shares. -To mutation-test the lines a branch changes, run `run-heavy mutate-changes --prefix 'uvx --python "$(command -v python3)" --with pytest==9.2.0 --from "mutmut>=3,<4"'` in its checkout. +The commands below name their tools bare, as Tools says. To mutation-test the lines a branch changes, run `run-heavy mutate-changes --prefix 'uvx --python "$(command -v python3)" --with pytest==9.2.0 --from "mutmut>=3,<4"'` in its checkout. To bench how hard the code is to fix a bug in, build the image first, with `run-heavy docker build --quiet --memory 2g --memory-swap 2g -t claude-config-task-bench task-bench-image`. Then run `task-bench --image claude-config-task-bench --prefix 'uvx --python "$(command -v python3)" --with pytest==9.2.0 --from "mutmut>=3,<4"' --test 'python -m pytest -q -p no:cacheprovider -n 4 bin --ignore=bin/adf_codec --ignore=bin/run_tests --ignore=bin/repo_checks/test_types.py --deselect bin/plan/test_touches.py::PredictedTest --deselect bin/loop_effects/test_effects.py::ChildShells'` in this checkout, under `run-heavy`. A scoring run starts it with `--record-figures` added. The bench runs the tests with no network, so the image holds everything they need. The `--test` leaves out the tests that need docker or `uvx`, and `ChildShells`, which needs `docker run --init` to reap its processes: `bin/run-tests` on the host runs those. diff --git a/bin/loop_state/paths.py b/bin/loop_state/paths.py index c624bde7..56eaf347 100644 --- a/bin/loop_state/paths.py +++ b/bin/loop_state/paths.py @@ -10,7 +10,7 @@ RELEASE_ROOT = pathlib.Path(__file__).resolve().parents[2] # Each folder below is named relative to the person's home folder. -# The Claude home: Claude Code's own folder, with its settings and transcripts. A release is deployed into it, so the release's CLAUDE.md, rules/ and agents/ are read from it. +# The Claude home: Claude Code's own folder, with its settings and transcripts. A release is deployed into it, so its CLAUDE.md, rules/ and agents/ are read from it. CLAUDE_HOME = ".claude" # The config folder, which holds one folder per project, and do-epic's. CONFIG_FOLDER = ".claude-projects" @@ -18,8 +18,9 @@ CONFIG_FOLDER = ".claude-projects" STATE_FOLDER = ".local/state" +# Only a claude started through this has the tools on PATH. One a person starts by hand lacks them, as their shell does: short names such as `wait-for` stay out of it, and README.md → Tools says how to call a tool there. def with_release_tools(env: Mapping[str, str]) -> dict[str, str]: - """env with the release's tools first on `PATH`: what every claude the loop starts runs in, so its Bash tool and its hooks find each tool by its bare name.""" + """env with the release's tools first on `PATH`: what every claude the loop or `task-bench` starts runs in, so its Bash tool finds each tool by its bare name, and so does a hook's own script.""" tools = str(RELEASE_ROOT / "bin") rest = env.get("PATH", "") if rest.split(os.pathsep)[0] == tools: diff --git a/bin/metric_bench/test_metric_bench.py b/bin/metric_bench/test_metric_bench.py index 381585d0..ad342178 100644 --- a/bin/metric_bench/test_metric_bench.py +++ b/bin/metric_bench/test_metric_bench.py @@ -228,7 +228,7 @@ class BlackBox(unittest.TestCase): top = self.project("# Comprehension history\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `README.md:1` \"Install\"\n") ran = self.run_tool(top) self.assertEqual((ran.returncode, ran.stdout), (1, "")) - self.assertIn("no scoring run in", ran.stderr) + self.assertRegex(ran.stderr, r"no scoring run in \S+ could be scored; its format is what larv-review writes") def test_exits_1_naming_a_history_it_cannot_read_and_unknown_arguments(self): top = self.project("") diff --git a/bin/repo_checks/test_tools_named_bare.py b/bin/repo_checks/test_tools_named_bare.py index ccc91af2..4c03b9b5 100644 --- a/bin/repo_checks/test_tools_named_bare.py +++ b/bin/repo_checks/test_tools_named_bare.py @@ -6,10 +6,14 @@ from repo_checks import ROOT # A tool spelled by its place in an install folder, as opposed to a source file under bin/, which a reader opens by its path. A session the loop starts has the release's tools on PATH, so prose names a tool bare, and works wherever the release is installed. BY_ITS_FOLDER = re.compile(r"(?:~|\$HOME)/\.claude/bin/[\w.<>-]+(?![\w.<>/-])") -# The files that record what was once so, which nobody runs a command from. -HISTORY = ("CHANGELOG.md", "todo.md", "docs/") -# README.md → Install links loop-claude and compress-archives from a shell and a crontab, which lack the tools, and says how to run any other tool there. -INSTALL = {"~/.claude/bin/loop-claude", "$HOME/.claude/bin/compress-archives", "~/.claude/bin/"} +# The plan, the changelog and the records: their text names a tool as it was spelled when the line was written, and nobody rewrites it. +HISTORY = ("CHANGELOG.md", "docs/", "todo.md") +# The lines a person runs in their own shell or a crontab, which lack the tools: only `loop-claude` is linked onto their `PATH`. +BY_HAND = { + "README.md": {"$HOME/.claude/bin/compress-archives", "~/.claude/bin/", "~/.claude/bin/loop-claude", "~/.claude/bin/notify", "~/.claude/bin/project-config"}, + "presentation/README.md": {"~/.claude/bin/run-heavy"}, + "presentation/build-pdf.py": {"~/.claude/bin/run-heavy"}, +} # settings.json names its hooks and its status line by their folder, and the test of the reviewer hook quotes it. Claude Code reads the file in every session, also one the human starts without the tools on PATH. A hook it cannot find doesn't refuse anything, so a bare name there would switch rule-hook off in that session. SETTINGS = ("settings.json", "bin/review_rules/test_reviewer_context.py") @@ -24,7 +28,7 @@ class ToolsNamedBare(unittest.TestCase): if name.startswith(HISTORY) or name in SETTINGS or name == "bin/repo_checks/test_tools_named_bare.py" or not path.is_file(): continue for number, line in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines(), 1): - found += [f"{name}:{number}: {spelled}" for spelled in BY_ITS_FOLDER.findall(line) if not (name == "README.md" and spelled in INSTALL)] + found += [f"{name}:{number}: {spelled}" for spelled in BY_ITS_FOLDER.findall(line) if spelled not in BY_HAND.get(name, ())] self.assertEqual(found, [], "name each tool bare, as in `todo-item`") diff --git a/bin/rule_hook/test_rule_hook.py b/bin/rule_hook/test_rule_hook.py index eb4ea4f2..fc059234 100644 --- a/bin/rule_hook/test_rule_hook.py +++ b/bin/rule_hook/test_rule_hook.py @@ -128,6 +128,10 @@ class CommandBreaches(unittest.TestCase): with self.subTest(command): self.assertEqual(checked(command), ["run-heavy"]) + def test_the_run_heavy_breach_quotes_the_first_80_characters_of_the_command_and_names_its_folder(self): + command = "docker build -t " + "x" * 80 + " ." + self.assertEqual(breaches(command), [Breach("run-heavy", f"run `{command[:80]}` under `run-heavy`, in the background", "/r")]) + def test_a_heavy_command_under_run_heavy_or_a_light_docker_or_mutmut_call_passes(self): for command in ["~/tools/run-heavy docker build -t x .", "/home/me/.claude/bin/run-heavy uvx mutmut run", "nice -n 19 ~/tools/run-heavy docker build .", "env X=1 run-heavy docker compose run app mutmut run", "docker images", "docker compose run --rm app go vet", "docker compose run app make build", "uvx 'mutmut>=3,<4' results", "echo docker build", "npx prettier --check infection.json5", "echo mutmut run", "env", "docker build --help", "cargo mutants --list", "infection --version", "uvx mutmut a b run", "run-heavy mutate-changes --jobs 2", "mutate-changes --help"]: with self.subTest(command): diff --git a/workflow-bench/advisor_bench.py b/workflow-bench/advisor_bench.py index 7cbb2289..9c73c234 100644 --- a/workflow-bench/advisor_bench.py +++ b/workflow-bench/advisor_bench.py @@ -23,7 +23,7 @@ import typing BENCH = pathlib.Path(__file__).resolve().parent REPO = BENCH.parent -RUN_HEAVY = pathlib.Path(__file__).resolve().parents[1] / "bin/run-heavy" +RUN_HEAVY = REPO / "bin/run-heavy" SUITE = ["uvx", "--python", sys.executable, "--with", "pytest-xdist==3.8.0", "pytest==9.2.0", "-n", "4", "-q"] CASES = { "290": ("cda45a931", "509804da0"),