From 6b36f43062acf17284625aaf7c9f879cc12111ef Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 14:21:56 +0100 Subject: [PATCH 01/12] Record a task-bench's figures in the comprehension history with larv-review record-bench, and run the bench beside a scoring run --- README.md | 2 +- bin/larv_review/bench_record.py | 64 +++++++++++++++++++++++++++++ bin/larv_review/main.py | 9 ++++ bin/larv_review/test_larv_review.py | 34 ++++++++++++++- docs/decisions.md | 13 ++++++ docs/reading-cost.md | 4 ++ skills/larv-review/SKILL.md | 3 +- 7 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 bin/larv_review/bench_record.py diff --git a/README.md b/README.md index 15d6349d..a5410a0f 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter. - `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it. - `subagent-rung [--plan] ` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model on the project's routing ladder, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule. -- `task-bench --image --test []` plants bugs that the tests catch, at the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. +- `task-bench --image --test []` plants bugs that the tests catch, at the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. `larv-review record-bench` appends the bench's figures over every bug to the comprehension history, which a scoring run does where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. - `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show ` one item's row and detail; `add …` files an item under the next free ID, `edit …` sets an item's cells or detail, and `move --release ` sets an item's release; `finish ` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`, except for a plan kept in Jira. Each change ranks a markdown plan. `todo-item --help` states the flags. - `touch-predictions record ...` appends what a chunk's items were predicted to touch, under `Touches:` in their details, beside the files and parts its branch touched, to the record the config names as `touch-predictions`; `touch-predictions --help` shows the spelling and how a part is named. `chunk-preflight` reads the same predictions to name the items that may start chunks at once. - `wait-for [] [--timeout ]` waits until a file a background job writes holds a line matching the pattern, and prints it. diff --git a/bin/larv_review/bench_record.py b/bin/larv_review/bench_record.py new file mode 100644 index 00000000..c8eebf69 --- /dev/null +++ b/bin/larv_review/bench_record.py @@ -0,0 +1,64 @@ +"""`larv-review record-bench`: a task-bench's figures over every bug, appended to the comprehension history from the bench's digest. The entry is a report beside the panel's: its heading names no ` at `, so nothing that reads the history's rulings and scoring runs takes it for one.""" +import pathlib +import re + +from failure import Failure +from git_cli.git_repo import git, top +from larv_review.history_commands import held_history +from review_rules.comprehension_history import appended +from review_rules.review_folder import made_review_folder +from task_bench.bench_folder import held +from task_bench.gather import DIGEST +from text_files.utc_stamp import utc + +# The digest's line that names the commits, as task_bench.digest.digest writes it. +SIDES = re.compile(r"^Base ([0-9a-f]{7,40}), head ([0-9a-f]{7,40})\.", re.M) +# How the table's three rows over every bug open: the base, the head and the head's change. +OVER_ALL = "| All |" +COMMIT_LENGTH = 8 + + +def record_bench(home: pathlib.Path, now: float) -> str | Failure: + """Appends the entry of the bench whose digest the chunk's review folder holds, and returns the line the tool prints. It waits for a bench that still runs there.""" + checkout = top() + if isinstance(checkout, Failure): + return checkout + branch = git("rev-parse", "--abbrev-ref", "HEAD") + if isinstance(branch, Failure): + return branch + review = made_review_folder(checkout, home) + if isinstance(review, Failure): + return review + with held(review) as folder: + if isinstance(folder, Failure): + return folder + try: + digest = (folder / DIGEST).read_text(encoding="utf-8") + except FileNotFoundError: + return Failure(f"{folder} holds no digest: run task-bench in this checkout first, and record it before `task-bench gather`") + except (OSError, UnicodeDecodeError) as failure: + return Failure(f"could not read {folder / DIGEST}: {failure}") + entry = bench_entry(digest, branch.strip(), now) + if entry is None: + return Failure(f"{folder / DIGEST} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows") + name, text = entry + read = held_history(home) + if isinstance(read, Failure): + return read + history, found = read + if f", {name}\n" in found.text: + return Failure(f"{history.label} already holds {name}; record each bench once") + written = history.write(appended(found.text, text), found.version) + return written if isinstance(written, Failure) else f"Appended to {history.label}." + + +def bench_entry(digest: str, branch: str, now: float) -> tuple[str, str] | None: + """What the history calls the bench of branch that digest tells of, and its entry, stamped with now: the table's header and its rows over every bug. None where digest is no task-bench digest.""" + sides = SIDES.search(digest) + table = [line for line in digest.splitlines() if line.startswith("|")] + rows = [line for line in table if line.startswith(OVER_ALL)] + if not sides or len(rows) != 3: + return None + base, head = (commit[:COMMIT_LENGTH] for commit in sides.groups()) + name = f"task-bench of {branch}: head {head} against base {base}" + return name, "\n".join([f"## {utc(now)}, {name}", "", *table[:2], *rows]) + "\n" diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index b745e92a..34cbf41a 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -114,6 +114,13 @@ record-ruling and record-scoring append each entry to the history, created when heading of the current UTC time and the seats file's first line. Each commit that line names must be in the checkout. Each exits 1 when the history already holds an entry on what that line reads. +record-bench appends the figures of the task-bench last run in this checkout, a report beside the +panel's entries that no command here reads: the bench's table, cut to its three rows over every bug, +under a heading of the current UTC time and `task-bench of : head against base +`. It reads the digest in the bench's folder, `task-bench` in the chunk's review folder, so +run it before `task-bench gather`, which removes that folder; it waits for a bench that still runs. +It exits 1 where the folder holds no digest, or the history already holds that bench. + places prints the places seats found hard since the newest scored commit: the places of each scoring run on it, and, in each later ruling, each place opening with a dimension, or Overall, that its seat voted worse. @@ -185,6 +192,7 @@ from larv_review.owed import owed_scoring_run from review_rules.review_passes import PASSES, REVIEWERS from larv_review.scoring_due import plan_reasons from larv_review.scoring_setup import prepare_scoring +from larv_review.bench_record import record_bench from larv_review.history_commands import read_agreement, read_places, record_ruling, record_scoring from larv_review.round_title import round_title @@ -234,6 +242,7 @@ COMMANDS = { "record-ruling": Command("record-ruling ", lambda given: len(given) == 1, lambda given: printed(record_ruling(pathlib.Path(given[0]), pathlib.Path.home(), time.time()))), "prepare-scoring": Command("prepare-scoring", no_arguments, lambda given: prepared_scoring()), "record-scoring": Command("record-scoring [...]", lambda given: bool(given) and are_ids(given[1:]), run_record_scoring, ids_from=1), + "record-bench": Command("record-bench", no_arguments, lambda given: printed(record_bench(pathlib.Path.home(), time.time()))), "places": Command("places", no_arguments, lambda given: printed(read_places(pathlib.Path.home()))), "agreement": Command("agreement", no_arguments, lambda given: printed(read_agreement(pathlib.Path.home()))), "reviewer-header": Command("reviewer-header [--rerun]", fits_reviewer_header, run_reviewer_header), diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 177e0189..0603c96c 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -4,6 +4,7 @@ import itertools import json import os import pathlib +import re import subprocess import sys import tempfile @@ -1063,6 +1064,37 @@ class LarvReviewTool(unittest.TestCase): self.assertEqual(ran.returncode, 1) self.assertIn("could not make the review folder", ran.stderr) + def bench_digest(self, text): + folder = pathlib.Path(self.run_tool("review-folder").stdout.strip()) / "task-bench" + folder.mkdir() + (folder / "digest.md").write_text(text) + + def test_record_bench_appends_the_rows_over_every_bug_under_a_heading_that_is_no_ruling_or_scoring_run(self): + table = "| Bug | Side | Passed | Output |\n|---|---|---|---|\n" + rows_over_all = "| All | base | 3/4 | 900 |\n| All | head | 4/4 | 700 |\n| All | change | +1 | -22% |\n" + self.bench_digest(f"# task-bench digest\n\nBase {'a' * 40}, head {'b' * 40}. A bug's name gives its line at the base.\n\n{table}| 1: pick.go:12 | base | 3/4 | 900 |\n| 1: pick.go:12 | head | 4/4 | 700 |\n{rows_over_all}\n## 1: pick.go:12\n\n| not | the | table |\n") + self.commit("history", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING}) + ran = self.run_tool("record-bench") + self.assertEqual((ran.returncode, ran.stdout), (0, f"Appended to {self.checkout / 'docs/comprehension-history.md'}.\n"), ran.stderr) + history = (self.checkout / "docs/comprehension-history.md").read_text() + self.assertRegex(history, rf"\n\n## \d{{4}}-\d\d-\d\dT\d\d:\d\d:\d\dZ, task-bench of chunk: head bbbbbbbb against base aaaaaaaa\n\n{re.escape(table + rows_over_all)}$") + self.assertEqual([entry.heading for entry in entries(history)], ["2026-10-08T12:00:00Z, PR #1 at aaaaaaa"]) + again = self.run_tool("record-bench") + self.assertEqual(again.returncode, 1) + self.assertIn("already holds task-bench of chunk: head bbbbbbbb against base aaaaaaaa", again.stderr) + self.assertEqual((self.checkout / "docs/comprehension-history.md").read_text(), history) + + def test_record_bench_fails_without_a_digest_and_on_one_without_its_commits_or_its_rows_over_every_bug(self): + ran = self.run_tool("record-bench") + self.assertEqual(ran.returncode, 1) + self.assertIn("holds no digest: run task-bench in this checkout first", ran.stderr) + self.bench_digest("# task-bench digest\n\n| Bug | Side |\n|---|---|\n| All | base |\n") + ran = self.run_tool("record-bench") + self.assertEqual(ran.returncode, 1) + self.assertIn("digest.md is no task-bench digest", ran.stderr) + self.assertFalse((self.checkout / "docs/comprehension-history.md").exists()) + self.assertIn("unknown arguments", self.run_tool("record-bench", "x").stderr) + def test_review_folder_fails_outside_a_checkout(self): ran = subprocess.run([sys.executable, str(TOOL), "review-folder"], capture_output=True, cwd=self.checkout.parent, env=self.env, text=True) self.assertEqual(ran.returncode, 1) @@ -1085,7 +1117,7 @@ class LarvReviewTool(unittest.TestCase): def test_help_and_the_usage_line_list_the_same_commands(self): usage = next(line for line in self.run_tool("--help").stdout.splitlines() if line.startswith("usage: larv-review ")) listed = usage.removeprefix("usage: larv-review ").split(" | ") - self.assertEqual([shape.split()[0] for shape in listed], ["review-folder", "ruling-base", "round-count", "needs-scoring-run", "scoring-run-owed", "record-ruling", "prepare-scoring", "record-scoring", "places", "agreement", "reviewer-header", "round-title", "reviewer-context"]) + self.assertEqual([shape.split()[0] for shape in listed], ["review-folder", "ruling-base", "round-count", "needs-scoring-run", "scoring-run-owed", "record-ruling", "prepare-scoring", "record-scoring", "record-bench", "places", "agreement", "reviewer-header", "round-title", "reviewer-context"]) self.assertIn(f"usage: larv-review {' | '.join(listed)}", self.run_tool().stderr) def test_takes_a_local_main_without_origin_and_reads_origin_as_last_fetched_when_the_fetch_fails(self): diff --git a/docs/decisions.md b/docs/decisions.md index a2d0f46c..406548e6 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -45,6 +45,7 @@ Each project principle states one rule that the decisions below apply; their ent - routing: loop-claude reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut - routing: the worker changes rung only as a chunk starts, after every second unfinished verdict, when it names a chunk item that picks a higher rung, or when it cites an escalation trigger the judge finds - task-bench: a bench takes 5 bugs and 5 runs per side, after a 2 × 2 pilot on a new setup, and at no affordable count does a chunk-sized change rise above the noise +- task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats and `larv-review record-bench` records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches - tests: each test earns its keep as the technical principles' test bullet says, and the worker takes a test's expected values from its item, never from the code - the repo may name bender, bender-infra and ai-sandbox - todo.md: an item of the next release predicts the files and parts it will touch under `Touches:` in its detail; chunk-preflight takes, in the plan's order, the items that overlap none taken before them as the chunks that may run at once, and the optional `touch-predictions` record keeps each chunk's prediction beside what it touched @@ -861,6 +862,18 @@ Measured on `fejkdata` (Go, 5 bugs planted in the files `larv-review places` nam - **One finished chunk**: `fejkdata`'s PR #490, base `33b7fa80`, head `5b9c2a14`, which the comprehension panel ruled better on Navigation, Locality and Shape and the same on Self-sufficiency. The bench planted 5 bugs and ran 38 of 50 runs before the machine restarted. The first 3 runs per bug and side, 30 runs, are the ones counted, and all passed. The mean of the bugs' changes was +4.6% in output tokens, +8.9% in cache-read tokens and +3.8% in turns, with the bugs' own changes in cache-read tokens from -41% to +47%. The two token figures sit inside the spread at 5 × 3, 17% and 22%. The turns' +3.8% sits inside their spread at 5 × 5, 14%, and the spread at 5 × 3 can only be wider. The mean of the wall times' changes, +105%, lies above the 86% of that row, from one bug whose head runs took 6.8 times as long at the median. Nobody read its streams to find out why. The head cost slightly more tokens where the panel finds it easier to read, and the wall time can't be judged, so the bench neither confirmed nor contradicted the panel. - **Cost**: 5 bugs × 6 runs took 3.9 hours and 34M cache-read, 1.2M cache-write and 0.3M output tokens; a run takes about 3.5 minutes, and planting 16 to 25 minutes. A 5 × 5 bench is about 3.3 hours and 28M cache-read tokens. Gremlins ran out of 8 GB at the base of PR #490, so the help's example takes 16 GB. +## task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats and `larv-review record-bench` records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches + +2026-11-23, lilleman, through todo item 509. Serves code health, whose signal is the panel's overall score, since a signal only simulated readers give stays unchecked until a measurement stands beside it; and goal 1.4, since the bench runs only where a scoring run already does. + +**A report, not a gate.** The bench's entry sits in the history beside the scoring run's, under a heading no command reads as a ruling or a run. A bench that fails, or a project whose README documents no bench command, doesn't hold up the merge. Once about 10 chunks have recorded both, the human rules whether the bench's figures agree with the panel's scores, and whether the bench then replaces the scoring run or gates a merge. + +**The README names the command**, as it names the project's mutation command: a bench needs the project's image, test command and Gremlins prefix, and a README already says how the project's tools run. + +**The entry keeps the three rows over every bug.** The rows per bug stay in the bench's digest, which `task-bench gather` reads: a bug is planted anew each bench, so its row doesn't compare with a later entry's. + +Valid while task-bench's figures are unproven against the panel's scores. + ## tests: CI runs the suite through `ci.sh` on every pull request, in a pinned Python container, and `main`'s branch protection holds a merge until it passes 2026-11-09, larv-review, through todo item 12. Serves goal 1.1: a merge no longer rests on the worker's word. larv-review's gate was the local run alone, which it skips when the last stability round left the suite green, so an unattended chunk could merge on the worker's own report. gitea.larvit.se's runners labelled `docker-host` run `.gitea/workflows/ci.yml`, which runs `ci.sh` on the committed HEAD in a pinned Python container; the script's header says how. A run takes about 3 minutes. diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 2209859d..98ba4b58 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -3456,3 +3456,7 @@ Read most (opens and searches): - `bin/task_bench/runs.py` 2 - `docs/decisions.md` 2 - `CHANGELOG.md` 1 + +## Reading cost, chunk 5c33cc8bf84f, finished 2026-11-23T13:17:23Z + +41140 new input tokens before the first commit. diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index 91e5c62d..77c80e2d 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -172,9 +172,10 @@ The comprehension check records how hard the project is for its contributor to r - **Seats.** Junior A, Mid A, the maintainability senior and the inherited architect each score the project at the head from 1 to 10 overall and on four dimensions: Navigation, Locality, Shape and Self-sufficiency. Run `~/.claude/bin/larv-review prepare-scoring`. It makes the worktree the seats read and prints each seat's prompt file; launch each seat with its file's text as its prompt. Write their lines into a scores file and run `~/.claude/bin/larv-review record-scoring `, which appends the run to the history and prints the four seats' means. - **Floor item.** Where `record-scoring` prints `Floor:`, a `Next:` line follows: file one floor item, or refresh the open one. A floor item is a plan item meant to bring every mean to the project's readability floor, which `record-scoring`'s `Floor:` line names. File it as one ambitious refactor, not touch-ups. It restructures the area behind the places `larv-review places` prints for this run, chosen where they bear on the lowest dimension, sized to bring every mean to that floor, and quotes those places. Its tagline opens with `Reach the comprehension floor:`, so its own chunk runs a scoring run; while a mean stays under the floor, that run's `Next:` line asks for the next floor item. Mark it `owner`, since the human asked that such a project always hold one, so no score deletes it. Put it in the earliest release the plan names after the one the chunk ships into, or else in the next version after that one that `~/.claude/rules/todo-items.md` allows, so the floor doesn't hold up any release. While one is open, refresh its places and aim from the newest run instead of filing another; the item the chunk ships doesn't count as open. Commit it with the run, as "Record" says. - **Second run.** Where `needs-scoring-run` printed that the chunk `leaves release … with no plan item`, run `prepare-scoring` again and launch the same four seats afresh on the same head. Their scores file's first line is ` rerun at `. Record it with the same `record-scoring` command. +- **Bench.** Where the project's README documents a `task-bench` command, start it when the seats launch, on the same head, in the background under `~/.claude/bin/run-heavy`. Once it ends, run `~/.claude/bin/larv-review record-bench`, which appends the bench's figures to the history, and put its `All` `change` row in the summary. A second run takes no second bench. The bench is a report beside the panel's scores: none of its figures blocks a merge or files an item. Where it fails, say why in the summary and merge without it. A project whose README documents no such command skips it. - **Agreement.** After the second run, run `~/.claude/bin/larv-review agreement` and put its counts in the summary. On `Assumption fails:`, ask the user whether to keep the paired ruling or change the decision `review: the comprehension check records …`. Record the answer as a decision in the repo whose history was counted, with the counts that led to the ask. A later run asks again only when the rulings' rate falls, or the runs' rate rises, against the recorded counts. -**Record.** `docs/comprehension-history.md` keeps every paired ruling and scoring run, which `larv-review` appends; never edit one. Commit what it appends, with the `todo.md` that `record-scoring` re-ranks in one commit titled `Record the comprehension check: …`, and push it; it re-enters no pass, and `chunk-pr merge` waits for the forge's checks it starts. Resolve a merge conflict in the file by putting the default branch's entries first. Put each ruling with its base and votes, and each run's five scores, in the summary. +**Record.** `docs/comprehension-history.md` keeps every paired ruling, scoring run and bench, which `larv-review` appends; never edit one. Commit what it appends, with the `todo.md` that `record-scoring` re-ranks in one commit titled `Record the comprehension check: …`, and push it; it re-enters no pass, and `chunk-pr merge` waits for the forge's checks it starts. Resolve a merge conflict in the file by putting the default branch's entries first. Put each ruling with its base and votes, and each run's five scores, in the summary. **Places.** The header of systems-architect and stability-reviewer names `places.md`, which holds what `~/.claude/bin/larv-review places` prints: the places seats found hard since the newest scored commit. Ask each to report, as a 🟡, each of those places the change touches without making it easier to read, matching a place by its path and the function or section it names, since its line may have moved. Fix such a 🟡, or say in the PR summary why not; that reason settles it in place of a decline's record. -- 2.52.0 From 65398d5e96c1485d221cb9b1ab1bd3b12ef24c5b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 14:29:30 +0100 Subject: [PATCH 02/12] Record a bench in the comprehension history with task-bench record-figures, and run the bench beside a scoring run --- README.md | 2 +- bin/larv_review/main.py | 9 -- bin/larv_review/test_larv_review.py | 34 +----- bin/task_bench/main.py | 15 ++- .../record_figures.py} | 27 +++-- bin/task_bench/test_record_figures.py | 105 ++++++++++++++++++ docs/decisions.md | 4 +- skills/larv-review/SKILL.md | 4 +- 8 files changed, 141 insertions(+), 59 deletions(-) rename bin/{larv_review/bench_record.py => task_bench/record_figures.py} (66%) create mode 100644 bin/task_bench/test_record_figures.py diff --git a/README.md b/README.md index a5410a0f..766d803a 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter. - `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it. - `subagent-rung [--plan] ` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model on the project's routing ladder, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule. -- `task-bench --image --test []` plants bugs that the tests catch, at the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. `larv-review record-bench` appends the bench's figures over every bug to the comprehension history, which a scoring run does where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. +- `task-bench --image --test []` plants bugs that the tests catch, at the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. `task-bench record-figures` appends the bench's figures over every bug to the comprehension history, which a scoring run does where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. - `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show ` one item's row and detail; `add …` files an item under the next free ID, `edit …` sets an item's cells or detail, and `move --release ` sets an item's release; `finish ` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`, except for a plan kept in Jira. Each change ranks a markdown plan. `todo-item --help` states the flags. - `touch-predictions record ...` appends what a chunk's items were predicted to touch, under `Touches:` in their details, beside the files and parts its branch touched, to the record the config names as `touch-predictions`; `touch-predictions --help` shows the spelling and how a part is named. `chunk-preflight` reads the same predictions to name the items that may start chunks at once. - `wait-for [] [--timeout ]` waits until a file a background job writes holds a line matching the pattern, and prints it. diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index 34cbf41a..b745e92a 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -114,13 +114,6 @@ record-ruling and record-scoring append each entry to the history, created when heading of the current UTC time and the seats file's first line. Each commit that line names must be in the checkout. Each exits 1 when the history already holds an entry on what that line reads. -record-bench appends the figures of the task-bench last run in this checkout, a report beside the -panel's entries that no command here reads: the bench's table, cut to its three rows over every bug, -under a heading of the current UTC time and `task-bench of : head against base -`. It reads the digest in the bench's folder, `task-bench` in the chunk's review folder, so -run it before `task-bench gather`, which removes that folder; it waits for a bench that still runs. -It exits 1 where the folder holds no digest, or the history already holds that bench. - places prints the places seats found hard since the newest scored commit: the places of each scoring run on it, and, in each later ruling, each place opening with a dimension, or Overall, that its seat voted worse. @@ -192,7 +185,6 @@ from larv_review.owed import owed_scoring_run from review_rules.review_passes import PASSES, REVIEWERS from larv_review.scoring_due import plan_reasons from larv_review.scoring_setup import prepare_scoring -from larv_review.bench_record import record_bench from larv_review.history_commands import read_agreement, read_places, record_ruling, record_scoring from larv_review.round_title import round_title @@ -242,7 +234,6 @@ COMMANDS = { "record-ruling": Command("record-ruling ", lambda given: len(given) == 1, lambda given: printed(record_ruling(pathlib.Path(given[0]), pathlib.Path.home(), time.time()))), "prepare-scoring": Command("prepare-scoring", no_arguments, lambda given: prepared_scoring()), "record-scoring": Command("record-scoring [...]", lambda given: bool(given) and are_ids(given[1:]), run_record_scoring, ids_from=1), - "record-bench": Command("record-bench", no_arguments, lambda given: printed(record_bench(pathlib.Path.home(), time.time()))), "places": Command("places", no_arguments, lambda given: printed(read_places(pathlib.Path.home()))), "agreement": Command("agreement", no_arguments, lambda given: printed(read_agreement(pathlib.Path.home()))), "reviewer-header": Command("reviewer-header [--rerun]", fits_reviewer_header, run_reviewer_header), diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 0603c96c..177e0189 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -4,7 +4,6 @@ import itertools import json import os import pathlib -import re import subprocess import sys import tempfile @@ -1064,37 +1063,6 @@ class LarvReviewTool(unittest.TestCase): self.assertEqual(ran.returncode, 1) self.assertIn("could not make the review folder", ran.stderr) - def bench_digest(self, text): - folder = pathlib.Path(self.run_tool("review-folder").stdout.strip()) / "task-bench" - folder.mkdir() - (folder / "digest.md").write_text(text) - - def test_record_bench_appends_the_rows_over_every_bug_under_a_heading_that_is_no_ruling_or_scoring_run(self): - table = "| Bug | Side | Passed | Output |\n|---|---|---|---|\n" - rows_over_all = "| All | base | 3/4 | 900 |\n| All | head | 4/4 | 700 |\n| All | change | +1 | -22% |\n" - self.bench_digest(f"# task-bench digest\n\nBase {'a' * 40}, head {'b' * 40}. A bug's name gives its line at the base.\n\n{table}| 1: pick.go:12 | base | 3/4 | 900 |\n| 1: pick.go:12 | head | 4/4 | 700 |\n{rows_over_all}\n## 1: pick.go:12\n\n| not | the | table |\n") - self.commit("history", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING}) - ran = self.run_tool("record-bench") - self.assertEqual((ran.returncode, ran.stdout), (0, f"Appended to {self.checkout / 'docs/comprehension-history.md'}.\n"), ran.stderr) - history = (self.checkout / "docs/comprehension-history.md").read_text() - self.assertRegex(history, rf"\n\n## \d{{4}}-\d\d-\d\dT\d\d:\d\d:\d\dZ, task-bench of chunk: head bbbbbbbb against base aaaaaaaa\n\n{re.escape(table + rows_over_all)}$") - self.assertEqual([entry.heading for entry in entries(history)], ["2026-10-08T12:00:00Z, PR #1 at aaaaaaa"]) - again = self.run_tool("record-bench") - self.assertEqual(again.returncode, 1) - self.assertIn("already holds task-bench of chunk: head bbbbbbbb against base aaaaaaaa", again.stderr) - self.assertEqual((self.checkout / "docs/comprehension-history.md").read_text(), history) - - def test_record_bench_fails_without_a_digest_and_on_one_without_its_commits_or_its_rows_over_every_bug(self): - ran = self.run_tool("record-bench") - self.assertEqual(ran.returncode, 1) - self.assertIn("holds no digest: run task-bench in this checkout first", ran.stderr) - self.bench_digest("# task-bench digest\n\n| Bug | Side |\n|---|---|\n| All | base |\n") - ran = self.run_tool("record-bench") - self.assertEqual(ran.returncode, 1) - self.assertIn("digest.md is no task-bench digest", ran.stderr) - self.assertFalse((self.checkout / "docs/comprehension-history.md").exists()) - self.assertIn("unknown arguments", self.run_tool("record-bench", "x").stderr) - def test_review_folder_fails_outside_a_checkout(self): ran = subprocess.run([sys.executable, str(TOOL), "review-folder"], capture_output=True, cwd=self.checkout.parent, env=self.env, text=True) self.assertEqual(ran.returncode, 1) @@ -1117,7 +1085,7 @@ class LarvReviewTool(unittest.TestCase): def test_help_and_the_usage_line_list_the_same_commands(self): usage = next(line for line in self.run_tool("--help").stdout.splitlines() if line.startswith("usage: larv-review ")) listed = usage.removeprefix("usage: larv-review ").split(" | ") - self.assertEqual([shape.split()[0] for shape in listed], ["review-folder", "ruling-base", "round-count", "needs-scoring-run", "scoring-run-owed", "record-ruling", "prepare-scoring", "record-scoring", "record-bench", "places", "agreement", "reviewer-header", "round-title", "reviewer-context"]) + self.assertEqual([shape.split()[0] for shape in listed], ["review-folder", "ruling-base", "round-count", "needs-scoring-run", "scoring-run-owed", "record-ruling", "prepare-scoring", "record-scoring", "places", "agreement", "reviewer-header", "round-title", "reviewer-context"]) self.assertIn(f"usage: larv-review {' | '.join(listed)}", self.run_tool().stderr) def test_takes_a_local_main_without_origin_and_reads_origin_as_last_fetched_when_the_fetch_fails(self): diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 2d501de6..4347d091 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -2,6 +2,7 @@ r"""Measure how hard a project's code is to fix a bug in, at a base commit and a each several times at both, and print how often the fix passes and what it took. usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ] + task-bench record-figures task-bench gather Run it in a checkout, under ~/.claude/bin/run-heavy, with a long-lived token in CLAUDE_CODE_OAUTH_TOKEN, which `claude setup-token` @@ -52,6 +53,11 @@ in 19 cases of 20, an All change under 12% in output tokens, 16% in cache-read t passed, so the pass rate's noise is unmeasured. `docs/decisions.md` → `task-bench: a bench takes` has the figures. +`task-bench record-figures`, run in the same checkout, appends the bench's figures to the project's comprehension history: the +table's heading and its three All rows, under a heading of the current UTC time and `task-bench of : head +against base `. It is a report beside the panel's scores there, which no tool reads as one of them. It waits for a +bench that still runs, and leaves the bench's folder, so run it before gather. + `task-bench gather`, run in the same checkout, turns the digest into plan items. It starts a claude on the project's rung, the cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in gather-prompt.md beside this file. That claude files an item with `todo-item add` for each place the runs show to be hard, and leaves the plan's file uncommitted. @@ -64,6 +70,8 @@ Exit 1, saying why, on an unknown or repeated argument, a missing --image or --t number from 1, or no token; and where git, docker or Gremlins fails, the seats' places don't name any Go file, the tests fail at a side without a bug, or no mutant becomes a bug. Where the API refuses a run, the bench stops there and exits 1 too, after the table of the runs that finished. +record-figures exits 1, saying why, outside a checkout, without a digest, on a digest without its commits or its three All +rows, where no config names the checkout, and where the history already holds that bench or cannot be written. gather exits 1, saying why, outside a checkout, without a digest, where loop-claude has saved no model for the project or the model is not on its routing ladder, and where its claude fails or hits a usage limit. """ @@ -76,6 +84,7 @@ import pathlib import shutil import sys import tarfile +import time import typing import uuid @@ -94,9 +103,10 @@ from task_bench.figures import figures, Result, Side, SIDES, table from git_cli import git_repo from review_rules.review_folder import made_review_folder, REPORTS from larv_review.history_commands import read_places +from task_bench.record_figures import record_figures from run_heavy.capped_docker import SHARE_VARIABLE -USAGE = "usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ], or task-bench gather" +USAGE = "usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ], task-bench record-figures, or task-bench gather" # A panel of three readers, seated as the README's audience, picked these options on 2026-11-21, each 3 to 0. OPTIONS = ("--base", "--bugs", "--head", "--image", "--prefix", "--runs", "--seed", "--test") COUNTS = {"--bugs": "5", "--runs": "5", "--seed": "1"} @@ -154,6 +164,9 @@ def main(argv: list[str], env: typing.Mapping[str, str], read: typing.Callable[[ home = pathlib.Path(env.get("HOME") or pathlib.Path.home()) if argv[:1] == ["gather"]: report = gather(env, home, claude) if argv == ["gather"] else Failure(f"gather takes no arguments; {USAGE}") + elif argv[:1] == ["record-figures"]: + recorded = record_figures(env, home, time.time()) if argv == ["record-figures"] else Failure(f"record-figures takes no arguments; {USAGE}") + report = recorded if isinstance(recorded, Failure) else [recorded] else: given = options(argv, env) if isinstance(given, Failure): diff --git a/bin/larv_review/bench_record.py b/bin/task_bench/record_figures.py similarity index 66% rename from bin/larv_review/bench_record.py rename to bin/task_bench/record_figures.py index c8eebf69..13b6b79c 100644 --- a/bin/larv_review/bench_record.py +++ b/bin/task_bench/record_figures.py @@ -1,26 +1,31 @@ -"""`larv-review record-bench`: a task-bench's figures over every bug, appended to the comprehension history from the bench's digest. The entry is a report beside the panel's: its heading names no ` at `, so nothing that reads the history's rulings and scoring runs takes it for one.""" +"""`task-bench record-figures`: a bench's figures over every bug, appended to the comprehension history from the bench's digest. The entry is a report beside the panel's: its heading names no ` at `, so nothing that reads the history's rulings and scoring runs takes it for one.""" +import functools import pathlib import re +import typing -from failure import Failure -from git_cli.git_repo import git, top -from larv_review.history_commands import held_history from review_rules.comprehension_history import appended -from review_rules.review_folder import made_review_folder -from task_bench.bench_folder import held from task_bench.gather import DIGEST +from failure import Failure +from git_cli import git_repo +from task_bench.bench_folder import held +from larv_review.history_commands import held_history +from review_rules.review_folder import made_review_folder +from git_cli.git_repo import top from text_files.utc_stamp import utc +# A panel of three readers, seated as the README's audience, picked on 2026-11-23 the subcommand's name, 3 to 0, and the heading's wording, `task-bench of : head against base `, 2 to 1 for the bench's name first. # The digest's line that names the commits, as task_bench.digest.digest writes it. SIDES = re.compile(r"^Base ([0-9a-f]{7,40}), head ([0-9a-f]{7,40})\.", re.M) -# How the table's three rows over every bug open: the base, the head and the head's change. +# How the table's three rows over every bug open, as task_bench.figures.table writes them: the base, the head and the head's change. OVER_ALL = "| All |" COMMIT_LENGTH = 8 -def record_bench(home: pathlib.Path, now: float) -> str | Failure: - """Appends the entry of the bench whose digest the chunk's review folder holds, and returns the line the tool prints. It waits for a bench that still runs there.""" - checkout = top() +def record_figures(env: typing.Mapping[str, str], home: pathlib.Path, now: float) -> str | Failure: + """Appends the entry of the bench whose digest the checkout's review folder holds, stamped with now, and returns the line the tool prints. It waits for a bench that still runs there, and leaves the folder for gather.""" + git = functools.partial(git_repo.git, env=env) + checkout = top(git) if isinstance(checkout, Failure): return checkout branch = git("rev-parse", "--abbrev-ref", "HEAD") @@ -35,7 +40,7 @@ def record_bench(home: pathlib.Path, now: float) -> str | Failure: try: digest = (folder / DIGEST).read_text(encoding="utf-8") except FileNotFoundError: - return Failure(f"{folder} holds no digest: run task-bench in this checkout first, and record it before `task-bench gather`") + return Failure(f"{folder} holds no digest: run task-bench in this checkout first, and record its figures before `task-bench gather`") except (OSError, UnicodeDecodeError) as failure: return Failure(f"could not read {folder / DIGEST}: {failure}") entry = bench_entry(digest, branch.strip(), now) diff --git a/bin/task_bench/test_record_figures.py b/bin/task_bench/test_record_figures.py new file mode 100644 index 00000000..af250ca0 --- /dev/null +++ b/bin/task_bench/test_record_figures.py @@ -0,0 +1,105 @@ +"""`task-bench record-figures`: the entry a bench's digest becomes in the comprehension history, and what it refuses.""" +import contextlib +import io +import pathlib +import subprocess +import sys +import tempfile +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from review_rules.comprehension_history import entries +from failure import Failure +from task_bench import main +from test_env import isolated_env +from task_bench.record_figures import record_figures + +SCORING = "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\n| Seat | Overall |\n|---|---|\n| Mean | 7.00 |\n" +TABLE = "| Bug | Side | Passed | Output |\n|---|---|---|---|\n" +PER_BUG = "| 1: pick.go:12 | base | 3/4 | 900 |\n| 1: pick.go:12 | head | 4/4 | 700 |\n" +OVER_ALL = "| All | base | 3/4 | 900 |\n| All | head | 4/4 | 700 |\n| All | change | +1 | -22% |\n" +DIGEST = f"# task-bench digest\n\nBase {'a' * 40}, head {'b' * 40}. A bug's name gives its line at the base.\n\n{TABLE}{PER_BUG}{OVER_ALL}\n## 1: pick.go:12\n\n| not | the | table |\n" +PROJECT_CONFIG = """checkout = "~/code/calc" +plan = "checkout:todo.md" +working-rules = "checkout:AGENTS.md" +decisions = "checkout:docs/decisions.md" +score-anchors = "checkout:docs/score-anchors.md" +comprehension-history = "checkout:docs/comprehension-history.md" +reading-cost = "checkout:docs/reading-cost.md" +changelog = "checkout:CHANGELOG.md" +goals-and-audience = "checkout:README.md" +principles = "~/principles" +standards = "~/standards" +""" +# 2026-11-23T10:00:00Z +NOW = 1795428000.0 + + +class RecordFiguresTest(unittest.TestCase): + def setUp(self): + folder = tempfile.TemporaryDirectory() + self.addCleanup(folder.cleanup) + self.home = pathlib.Path(folder.name).resolve() / "home" + self.repo = self.home / "code/calc" + self.repo.mkdir(parents=True) + self.env = {**isolated_env(), "HOME": str(self.home)} + subprocess.run(["git", "init", "--quiet", "--initial-branch", "item-7"], cwd=self.repo, env=self.env, check=True) + subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@localhost", "-c", "commit.gpgsign=false", "commit", "--quiet", "--allow-empty", "--message", "Base"], cwd=self.repo, env=self.env, check=True) + config = self.home / ".claude-projects/calc/config.toml" + config.parent.mkdir(parents=True) + config.write_text(PROJECT_CONFIG) + self.bench = self.home / ".local/state/larv-review/code/calc/task-bench" + self.bench.mkdir(parents=True) + self.history = self.repo / "docs/comprehension-history.md" + self.enterContext(contextlib.chdir(self.repo)) + + def recorded(self) -> str: + found = record_figures(self.env, self.home, NOW) + return found.reason if isinstance(found, Failure) else found + + def test_appends_the_rows_over_every_bug_under_a_heading_that_is_no_ruling_or_scoring_run_and_keeps_the_benchs_folder(self): + (self.bench / "digest.md").write_text(DIGEST) + self.history.parent.mkdir() + self.history.write_text("# Comprehension history\n\n" + SCORING) + self.assertEqual(self.recorded(), f"Appended to {self.history}.") + entry = f"## 2026-11-23T10:00:00Z, task-bench of item-7: head bbbbbbbb against base aaaaaaaa\n\n{TABLE}{OVER_ALL}" + self.assertEqual(self.history.read_text(), f"# Comprehension history\n\n{SCORING}\n{entry}") + self.assertEqual([entry.heading for entry in entries(self.history.read_text())], ["2026-10-08T12:00:00Z, PR #1 at aaaaaaa"]) + self.assertEqual((self.bench / "digest.md").read_text(), DIGEST) + + def test_starts_a_history_where_the_project_has_none(self): + (self.bench / "digest.md").write_text(DIGEST) + self.assertEqual(self.recorded(), f"Appended to {self.history}.") + self.assertTrue(self.history.read_text().startswith("# Comprehension history\n\n## 2026-11-23T10:00:00Z, task-bench of item-7: head bbbbbbbb")) + + def test_refuses_a_bench_the_history_already_holds(self): + (self.bench / "digest.md").write_text(DIGEST) + self.recorded() + held = self.history.read_text() + self.assertEqual(self.recorded(), f"{self.history} already holds task-bench of item-7: head bbbbbbbb against base aaaaaaaa; record each bench once") + self.assertEqual(self.history.read_text(), held) + + def test_refuses_without_a_digest(self): + self.assertEqual(self.recorded(), f"{self.bench} holds no digest: run task-bench in this checkout first, and record its figures before `task-bench gather`") + + def test_refuses_a_digest_without_its_commits_or_without_its_three_rows_over_every_bug(self): + for digest in (DIGEST.replace("Base ", "From "), DIGEST.replace("| All | change | +1 | -22% |\n", "")): + with self.subTest(digest=digest): + (self.bench / "digest.md").write_text(digest) + self.assertEqual(self.recorded(), f"{self.bench / 'digest.md'} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows") + self.assertFalse(self.history.exists()) + + def test_the_tool_prints_the_line_and_refuses_arguments(self): + (self.bench / "digest.md").write_text(DIGEST) + with contextlib.redirect_stdout(io.StringIO()) as out: + self.assertEqual(main.main(["record-figures"], self.env), 0) + self.assertEqual(out.getvalue(), f"Appended to {self.history}.\n") + self.assertIn(", task-bench of item-7: head bbbbbbbb against base aaaaaaaa\n", self.history.read_text()) + with contextlib.redirect_stderr(io.StringIO()) as errors: + self.assertEqual(main.main(["record-figures", "x"], self.env), 1) + self.assertEqual(errors.getvalue().split(";")[0], "record-figures takes no arguments") + + +if __name__ == "__main__": + unittest.main() diff --git a/docs/decisions.md b/docs/decisions.md index 406548e6..6b69de62 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -45,7 +45,7 @@ Each project principle states one rule that the decisions below apply; their ent - routing: loop-claude reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut - routing: the worker changes rung only as a chunk starts, after every second unfinished verdict, when it names a chunk item that picks a higher rung, or when it cites an escalation trigger the judge finds - task-bench: a bench takes 5 bugs and 5 runs per side, after a 2 × 2 pilot on a new setup, and at no affordable count does a chunk-sized change rise above the noise -- task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats and `larv-review record-bench` records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches +- task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats and `task-bench record-figures` records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches - tests: each test earns its keep as the technical principles' test bullet says, and the worker takes a test's expected values from its item, never from the code - the repo may name bender, bender-infra and ai-sandbox - todo.md: an item of the next release predicts the files and parts it will touch under `Touches:` in its detail; chunk-preflight takes, in the plan's order, the items that overlap none taken before them as the chunks that may run at once, and the optional `touch-predictions` record keeps each chunk's prediction beside what it touched @@ -862,7 +862,7 @@ Measured on `fejkdata` (Go, 5 bugs planted in the files `larv-review places` nam - **One finished chunk**: `fejkdata`'s PR #490, base `33b7fa80`, head `5b9c2a14`, which the comprehension panel ruled better on Navigation, Locality and Shape and the same on Self-sufficiency. The bench planted 5 bugs and ran 38 of 50 runs before the machine restarted. The first 3 runs per bug and side, 30 runs, are the ones counted, and all passed. The mean of the bugs' changes was +4.6% in output tokens, +8.9% in cache-read tokens and +3.8% in turns, with the bugs' own changes in cache-read tokens from -41% to +47%. The two token figures sit inside the spread at 5 × 3, 17% and 22%. The turns' +3.8% sits inside their spread at 5 × 5, 14%, and the spread at 5 × 3 can only be wider. The mean of the wall times' changes, +105%, lies above the 86% of that row, from one bug whose head runs took 6.8 times as long at the median. Nobody read its streams to find out why. The head cost slightly more tokens where the panel finds it easier to read, and the wall time can't be judged, so the bench neither confirmed nor contradicted the panel. - **Cost**: 5 bugs × 6 runs took 3.9 hours and 34M cache-read, 1.2M cache-write and 0.3M output tokens; a run takes about 3.5 minutes, and planting 16 to 25 minutes. A 5 × 5 bench is about 3.3 hours and 28M cache-read tokens. Gremlins ran out of 8 GB at the base of PR #490, so the help's example takes 16 GB. -## task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats and `larv-review record-bench` records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches +## task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats and `task-bench record-figures` records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches 2026-11-23, lilleman, through todo item 509. Serves code health, whose signal is the panel's overall score, since a signal only simulated readers give stays unchecked until a measurement stands beside it; and goal 1.4, since the bench runs only where a scoring run already does. diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index 77c80e2d..da3a2885 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -172,10 +172,10 @@ The comprehension check records how hard the project is for its contributor to r - **Seats.** Junior A, Mid A, the maintainability senior and the inherited architect each score the project at the head from 1 to 10 overall and on four dimensions: Navigation, Locality, Shape and Self-sufficiency. Run `~/.claude/bin/larv-review prepare-scoring`. It makes the worktree the seats read and prints each seat's prompt file; launch each seat with its file's text as its prompt. Write their lines into a scores file and run `~/.claude/bin/larv-review record-scoring `, which appends the run to the history and prints the four seats' means. - **Floor item.** Where `record-scoring` prints `Floor:`, a `Next:` line follows: file one floor item, or refresh the open one. A floor item is a plan item meant to bring every mean to the project's readability floor, which `record-scoring`'s `Floor:` line names. File it as one ambitious refactor, not touch-ups. It restructures the area behind the places `larv-review places` prints for this run, chosen where they bear on the lowest dimension, sized to bring every mean to that floor, and quotes those places. Its tagline opens with `Reach the comprehension floor:`, so its own chunk runs a scoring run; while a mean stays under the floor, that run's `Next:` line asks for the next floor item. Mark it `owner`, since the human asked that such a project always hold one, so no score deletes it. Put it in the earliest release the plan names after the one the chunk ships into, or else in the next version after that one that `~/.claude/rules/todo-items.md` allows, so the floor doesn't hold up any release. While one is open, refresh its places and aim from the newest run instead of filing another; the item the chunk ships doesn't count as open. Commit it with the run, as "Record" says. - **Second run.** Where `needs-scoring-run` printed that the chunk `leaves release … with no plan item`, run `prepare-scoring` again and launch the same four seats afresh on the same head. Their scores file's first line is ` rerun at `. Record it with the same `record-scoring` command. -- **Bench.** Where the project's README documents a `task-bench` command, start it when the seats launch, on the same head, in the background under `~/.claude/bin/run-heavy`. Once it ends, run `~/.claude/bin/larv-review record-bench`, which appends the bench's figures to the history, and put its `All` `change` row in the summary. A second run takes no second bench. The bench is a report beside the panel's scores: none of its figures blocks a merge or files an item. Where it fails, say why in the summary and merge without it. A project whose README documents no such command skips it. +- **Bench.** Where the project's README documents a `task-bench` command, start it when the seats launch, on the same head, in the background under `~/.claude/bin/run-heavy`. Once it ends, run `~/.claude/bin/task-bench record-figures`, which appends the bench's figures to the history, and put its `All` `change` row in the summary. A second run takes no second bench. The bench is a report beside the panel's scores: none of its figures blocks a merge or files an item. Where it fails, say why in the summary and merge without it. A project whose README documents no such command skips it. - **Agreement.** After the second run, run `~/.claude/bin/larv-review agreement` and put its counts in the summary. On `Assumption fails:`, ask the user whether to keep the paired ruling or change the decision `review: the comprehension check records …`. Record the answer as a decision in the repo whose history was counted, with the counts that led to the ask. A later run asks again only when the rulings' rate falls, or the runs' rate rises, against the recorded counts. -**Record.** `docs/comprehension-history.md` keeps every paired ruling, scoring run and bench, which `larv-review` appends; never edit one. Commit what it appends, with the `todo.md` that `record-scoring` re-ranks in one commit titled `Record the comprehension check: …`, and push it; it re-enters no pass, and `chunk-pr merge` waits for the forge's checks it starts. Resolve a merge conflict in the file by putting the default branch's entries first. Put each ruling with its base and votes, and each run's five scores, in the summary. +**Record.** `docs/comprehension-history.md` keeps every paired ruling and scoring run, which `larv-review` appends, and every bench, which `task-bench record-figures` appends; never edit one. Commit what it appends, with the `todo.md` that `record-scoring` re-ranks in one commit titled `Record the comprehension check: …`, and push it; it re-enters no pass, and `chunk-pr merge` waits for the forge's checks it starts. Resolve a merge conflict in the file by putting the default branch's entries first. Put each ruling with its base and votes, and each run's five scores, in the summary. **Places.** The header of systems-architect and stability-reviewer names `places.md`, which holds what `~/.claude/bin/larv-review places` prints: the places seats found hard since the newest scored commit. Ask each to report, as a 🟡, each of those places the change touches without making it easier to read, matching a place by its path and the function or section it names, since its line may have moved. Fix such a 🟡, or say in the PR summary why not; that reason settles it in place of a decline's record. -- 2.52.0 From 9207a6cf800f44ba1756e838192d0dda5b28f14e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 14:51:11 +0100 Subject: [PATCH 03/12] Test the environment git runs in, an unreadable digest and the history write of task-bench record-figures --- bin/task_bench/record_figures.py | 18 +++++++++-------- bin/task_bench/test_record_figures.py | 28 +++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/bin/task_bench/record_figures.py b/bin/task_bench/record_figures.py index 13b6b79c..6ecf1044 100644 --- a/bin/task_bench/record_figures.py +++ b/bin/task_bench/record_figures.py @@ -9,8 +9,10 @@ from task_bench.gather import DIGEST from failure import Failure from git_cli import git_repo from task_bench.bench_folder import held +from record_store.held import Held from larv_review.history_commands import held_history from review_rules.review_folder import made_review_folder +from record_store.stores import RecordStore from git_cli.git_repo import top from text_files.utc_stamp import utc @@ -46,17 +48,17 @@ def record_figures(env: typing.Mapping[str, str], home: pathlib.Path, now: float entry = bench_entry(digest, branch.strip(), now) if entry is None: return Failure(f"{folder / DIGEST} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows") - name, text = entry read = held_history(home) - if isinstance(read, Failure): - return read - history, found = read - if f", {name}\n" in found.text: - return Failure(f"{history.label} already holds {name}; record each bench once") - written = history.write(appended(found.text, text), found.version) - return written if isinstance(written, Failure) else f"Appended to {history.label}." + return read if isinstance(read, Failure) else appended_to(*read, *entry) +def appended_to(history: RecordStore, held: Held, name: str, entry: str) -> str | Failure: + """Writes entry, of the bench the history calls name, onto held, the history as history's store read it, over held's version; the line the tool prints, or why the entry isn't written.""" + if f", {name}\n" in held.text: + return Failure(f"{history.label} already holds {name}; record each bench once") + written = history.write(appended(held.text, entry), held.version) + return written if isinstance(written, Failure) else f"Appended to {history.label}." + def bench_entry(digest: str, branch: str, now: float) -> tuple[str, str] | None: """What the history calls the bench of branch that digest tells of, and its entry, stamped with now: the table's header and its rows over every bug. None where digest is no task-bench digest.""" sides = SIDES.search(digest) diff --git a/bin/task_bench/test_record_figures.py b/bin/task_bench/test_record_figures.py index af250ca0..a9b78eef 100644 --- a/bin/task_bench/test_record_figures.py +++ b/bin/task_bench/test_record_figures.py @@ -9,11 +9,13 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) +from task_bench.record_figures import appended_to, record_figures from review_rules.comprehension_history import entries from failure import Failure -from task_bench import main +from record_store.held import Held from test_env import isolated_env -from task_bench.record_figures import record_figures +from task_bench import main +from record_store.fakes import MemoryStore SCORING = "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\n| Seat | Overall |\n|---|---|\n| Mean | 7.00 |\n" TABLE = "| Bug | Side | Passed | Output |\n|---|---|---|---|\n" @@ -90,6 +92,28 @@ class RecordFiguresTest(unittest.TestCase): self.assertEqual(self.recorded(), f"{self.bench / 'digest.md'} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows") self.assertFalse(self.history.exists()) + def test_refuses_a_digest_it_cannot_read(self): + (self.bench / "digest.md").mkdir() + self.assertTrue(self.recorded().startswith(f"could not read {self.bench / 'digest.md'}: [Errno "), self.recorded()) + + def test_git_runs_in_the_environment_given(self): + (self.bench / "digest.md").write_text(DIGEST) + other = self.home / "code/other" + other.mkdir() + subprocess.run(["git", "init", "--quiet", "--initial-branch", "elsewhere"], cwd=other, env=self.env, check=True) + subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@localhost", "-c", "commit.gpgsign=false", "commit", "--quiet", "--allow-empty", "--message", "Base"], cwd=other, env=self.env, check=True) + self.env = {**self.env, "GIT_DIR": str(other / ".git"), "GIT_WORK_TREE": str(self.repo)} + with contextlib.redirect_stdout(io.StringIO()): + self.assertEqual(main.main(["record-figures"], self.env), 0) + self.assertIn(", task-bench of elsewhere: head ", self.history.read_text()) + + def test_writes_over_the_version_the_history_was_read_at_and_says_why_a_write_fails(self): + history = MemoryStore(label="history.md", version=5) + self.assertEqual(appended_to(history, Held("", "5"), "task-bench of item-7: head b against base a", "## an entry\n"), "Appended to history.md.") + self.assertEqual(history.overs, ["5"]) + refused = appended_to(history, Held("", "5"), "task-bench of item-8: head b against base a", "## an entry\n") + self.assertEqual(refused.reason if isinstance(refused, Failure) else refused, "someone saved history.md since version 5") + def test_the_tool_prints_the_line_and_refuses_arguments(self): (self.bench / "digest.md").write_text(DIGEST) with contextlib.redirect_stdout(io.StringIO()) as out: -- 2.52.0 From 000ad998972cd77ad3b33b8ac0bd165ebd9b6349 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 15:13:05 +0100 Subject: [PATCH 04/12] Test that task-bench record-figures says why where no config names the checkout --- bin/task_bench/test_record_figures.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/task_bench/test_record_figures.py b/bin/task_bench/test_record_figures.py index a9b78eef..e3272693 100644 --- a/bin/task_bench/test_record_figures.py +++ b/bin/task_bench/test_record_figures.py @@ -96,6 +96,11 @@ class RecordFiguresTest(unittest.TestCase): (self.bench / "digest.md").mkdir() self.assertTrue(self.recorded().startswith(f"could not read {self.bench / 'digest.md'}: [Errno "), self.recorded()) + def test_says_why_where_no_config_names_the_checkout(self): + (self.bench / "digest.md").write_text(DIGEST) + (self.home / ".claude-projects/calc/config.toml").unlink() + self.assertTrue(self.recorded().startswith(f"no config names the checkout {self.repo}"), self.recorded()) + def test_git_runs_in_the_environment_given(self): (self.bench / "digest.md").write_text(DIGEST) other = self.home / "code/other" -- 2.52.0 From 1f33e37fe5f6396d6e0c0557613e58fec0ba4735 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 15:29:49 +0100 Subject: [PATCH 05/12] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 9d2e3f1823e6c8b2d72aa207470db61423dc491e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 15:36:08 +0100 Subject: [PATCH 06/12] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20record=20a?= =?UTF-8?q?=20bench's=20figures=20inside=20the=20bench=20with=20--record-f?= =?UTF-8?q?igures,=20so=20one=20that=20stopped=20or=20an=20older=20digest?= =?UTF-8?q?=20is=20never=20recorded?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/task_bench/main.py | 35 +++++----- bin/task_bench/record_figures.py | 58 ++++++++-------- bin/task_bench/test_record_figures.py | 96 +++++++++++++-------------- bin/task_bench/test_task_bench.py | 32 ++++++++- 4 files changed, 126 insertions(+), 95 deletions(-) diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 4347d091..a00ebbac 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -1,8 +1,7 @@ r"""Measure how hard a project's code is to fix a bug in, at a base commit and at a head: plant bugs its tests catch, have Haiku fix each several times at both, and print how often the fix passes and what it took. -usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ] - task-bench record-figures +usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ] [--record-figures] task-bench gather Run it in a checkout, under ~/.claude/bin/run-heavy, with a long-lived token in CLAUDE_CODE_OAUTH_TOKEN, which `claude setup-token` @@ -53,10 +52,10 @@ in 19 cases of 20, an All change under 12% in output tokens, 16% in cache-read t passed, so the pass rate's noise is unmeasured. `docs/decisions.md` → `task-bench: a bench takes` has the figures. -`task-bench record-figures`, run in the same checkout, appends the bench's figures to the project's comprehension history: the -table's heading and its three All rows, under a heading of the current UTC time and `task-bench of : head -against base `. It is a report beside the panel's scores there, which no tool reads as one of them. It waits for a -bench that still runs, and leaves the bench's folder, so run it before gather. +With --record-figures, a bench that finishes appends its figures to the project's comprehension history: an entry with the +table's header and its three All rows. The entry's heading gives the current UTC time, then `task-bench of : head + against base `, where is the branch checked out, whatever --head names. No tool reads the entry as a +ruling or a scoring run. The bench's last line says where the entry went. A bench that fails or stops doesn't record anything. `task-bench gather`, run in the same checkout, turns the digest into plan items. It starts a claude on the project's rung, the cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in gather-prompt.md beside this file. @@ -70,8 +69,9 @@ Exit 1, saying why, on an unknown or repeated argument, a missing --image or --t number from 1, or no token; and where git, docker or Gremlins fails, the seats' places don't name any Go file, the tests fail at a side without a bug, or no mutant becomes a bug. Where the API refuses a run, the bench stops there and exits 1 too, after the table of the runs that finished. -record-figures exits 1, saying why, outside a checkout, without a digest, on a digest without its commits or its three All -rows, where no config names the checkout, and where the history already holds that bench or cannot be written. +With --record-figures it also exits 1, saying why: before it plants a bug, where no config names the checkout or the history +cannot be read; and after the bench, where the history already holds that branch's bench of those two commits or cannot be +written. The folder then still holds the bench's results. gather exits 1, saying why, outside a checkout, without a digest, where loop-claude has saved no model for the project or the model is not on its routing ladder, and where its claude fails or hits a usage limit. """ @@ -103,12 +103,14 @@ from task_bench.figures import figures, Result, Side, SIDES, table from git_cli import git_repo from review_rules.review_folder import made_review_folder, REPORTS from larv_review.history_commands import read_places -from task_bench.record_figures import record_figures +from task_bench.record_figures import recorded_bench from run_heavy.capped_docker import SHARE_VARIABLE -USAGE = "usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ], task-bench record-figures, or task-bench gather" +USAGE = "usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ] [--record-figures], or task-bench gather" # A panel of three readers, seated as the README's audience, picked these options on 2026-11-21, each 3 to 0. -OPTIONS = ("--base", "--bugs", "--head", "--image", "--prefix", "--runs", "--seed", "--test") +OPTIONS = ("--base", "--bugs", "--head", "--image", "--prefix", "--record-figures", "--runs", "--seed", "--test") +# The one option that takes no value. +RECORD = "--record-figures" COUNTS = {"--bugs": "5", "--runs": "5", "--seed": "1"} # Opens the report's last line, which names the bench's folder. KEPT = "The digest, and each run's result and stream, until `task-bench gather` files plan items from them or the next bench starts: " @@ -164,9 +166,6 @@ def main(argv: list[str], env: typing.Mapping[str, str], read: typing.Callable[[ home = pathlib.Path(env.get("HOME") or pathlib.Path.home()) if argv[:1] == ["gather"]: report = gather(env, home, claude) if argv == ["gather"] else Failure(f"gather takes no arguments; {USAGE}") - elif argv[:1] == ["record-figures"]: - recorded = record_figures(env, home, time.time()) if argv == ["record-figures"] else Failure(f"record-figures takes no arguments; {USAGE}") - report = recorded if isinstance(recorded, Failure) else [recorded] else: given = options(argv, env) if isinstance(given, Failure): @@ -190,6 +189,11 @@ def options(argv: list[str], env: typing.Mapping[str, str]) -> dict[str, str] | return Failure(f"unknown argument {name}") if name in given: return Failure(f"{name} is given twice") + if name == RECORD: + if equals: + return Failure(f"{name} takes no value") + given[name] = "" + continue if not equals and not rest: return Failure(f"{name} needs a value") given[name] = value if equals else rest.pop(0) @@ -235,7 +239,8 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], places: str, hom if isinstance(folder, Failure): return folder clear_left(home / REPORTS) - return bench_in(folder, given, env, places, checkout, sides, git, say) + run = functools.partial(bench_in, folder, given, env, places, checkout, sides, git, say) + return recorded_bench(run, folder, git, home, time.time) if RECORD in given else run() def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[str, str], places: str, checkout: str, sides: dict[Side, str], git: Git, say: typing.Callable[[str], None]) -> list[str] | Failure: diff --git a/bin/task_bench/record_figures.py b/bin/task_bench/record_figures.py index 6ecf1044..5e76b450 100644 --- a/bin/task_bench/record_figures.py +++ b/bin/task_bench/record_figures.py @@ -1,5 +1,4 @@ -"""`task-bench record-figures`: a bench's figures over every bug, appended to the comprehension history from the bench's digest. The entry is a report beside the panel's: its heading names no ` at `, so nothing that reads the history's rulings and scoring runs takes it for one.""" -import functools +"""`task-bench --record-figures`: a bench's figures over every bug, appended to the comprehension history from the bench's digest. The entry is a report beside the panel's: its heading names no ` at `, so nothing that reads the history's rulings and scoring runs takes it for one.""" import pathlib import re import typing @@ -7,16 +6,12 @@ import typing from review_rules.comprehension_history import appended from task_bench.gather import DIGEST from failure import Failure -from git_cli import git_repo -from task_bench.bench_folder import held from record_store.held import Held from larv_review.history_commands import held_history -from review_rules.review_folder import made_review_folder from record_store.stores import RecordStore -from git_cli.git_repo import top +from git_cli.git_repo import Git from text_files.utc_stamp import utc -# A panel of three readers, seated as the README's audience, picked on 2026-11-23 the subcommand's name, 3 to 0, and the heading's wording, `task-bench of : head against base `, 2 to 1 for the bench's name first. # The digest's line that names the commits, as task_bench.digest.digest writes it. SIDES = re.compile(r"^Base ([0-9a-f]{7,40}), head ([0-9a-f]{7,40})\.", re.M) # How the table's three rows over every bug open, as task_bench.figures.table writes them: the base, the head and the head's change. @@ -24,48 +19,51 @@ OVER_ALL = "| All |" COMMIT_LENGTH = 8 -def record_figures(env: typing.Mapping[str, str], home: pathlib.Path, now: float) -> str | Failure: - """Appends the entry of the bench whose digest the checkout's review folder holds, stamped with now, and returns the line the tool prints. It waits for a bench that still runs there, and leaves the folder for gather.""" - git = functools.partial(git_repo.git, env=env) - checkout = top(git) - if isinstance(checkout, Failure): - return checkout +def recorded_bench(run: typing.Callable[[], list[str] | Failure], folder: pathlib.Path, git: Git, home: pathlib.Path, now: typing.Callable[[], float]) -> list[str] | Failure: + """The report of the bench that run runs in folder, plus the line that says where its figures went. It refuses before the bench where the history cannot be read, since a bench takes hours. A bench that fails or stops records nothing.""" branch = git("rev-parse", "--abbrev-ref", "HEAD") if isinstance(branch, Failure): return branch - review = made_review_folder(checkout, home) - if isinstance(review, Failure): - return review - with held(review) as folder: - if isinstance(folder, Failure): - return folder - try: - digest = (folder / DIGEST).read_text(encoding="utf-8") - except FileNotFoundError: - return Failure(f"{folder} holds no digest: run task-bench in this checkout first, and record its figures before `task-bench gather`") - except (OSError, UnicodeDecodeError) as failure: - return Failure(f"could not read {folder / DIGEST}: {failure}") - entry = bench_entry(digest, branch.strip(), now) + if isinstance(unreadable := held_history(home), Failure): + return unreadable + report = run() + if isinstance(report, Failure): + return report + recorded = record_figures(folder, branch.strip(), home, now()) + if isinstance(recorded, Failure): + return Failure(f"the bench finished and {folder} holds its results, but its figures are not recorded: {recorded.reason}") + return [*report, recorded] + + +def record_figures(folder: pathlib.Path, branch: str, home: pathlib.Path, now: float) -> str | Failure: + """Appends the entry of the bench whose digest folder holds, stamped with now, and returns the line the tool prints.""" + try: + digest = (folder / DIGEST).read_text(encoding="utf-8") + except (OSError, UnicodeDecodeError) as failure: + return Failure(f"could not read {folder / DIGEST}: {failure}") + entry = bench_entry(digest, branch, now) if entry is None: return Failure(f"{folder / DIGEST} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows") read = held_history(home) - return read if isinstance(read, Failure) else appended_to(*read, *entry) + return read if isinstance(read, Failure) else bench_appended(*read, *entry) -def appended_to(history: RecordStore, held: Held, name: str, entry: str) -> str | Failure: - """Writes entry, of the bench the history calls name, onto held, the history as history's store read it, over held's version; the line the tool prints, or why the entry isn't written.""" +def bench_appended(history: RecordStore, held: Held, name: str, entry: str) -> str | Failure: + """Writes a bench's entry at the end of the history and returns the line the tool prints. held is the history as its store read it, and name is what the entry's heading calls the bench. It refuses a bench the history already holds.""" if f", {name}\n" in held.text: return Failure(f"{history.label} already holds {name}; record each bench once") written = history.write(appended(held.text, entry), held.version) return written if isinstance(written, Failure) else f"Appended to {history.label}." + def bench_entry(digest: str, branch: str, now: float) -> tuple[str, str] | None: - """What the history calls the bench of branch that digest tells of, and its entry, stamped with now: the table's header and its rows over every bug. None where digest is no task-bench digest.""" + """A bench's name in the history and its entry there, stamped with now: the digest's table header and its three rows over every bug. branch is the branch the bench ran on. None where digest is no task-bench digest.""" sides = SIDES.search(digest) table = [line for line in digest.splitlines() if line.startswith("|")] rows = [line for line in table if line.startswith(OVER_ALL)] if not sides or len(rows) != 3: return None base, head = (commit[:COMMIT_LENGTH] for commit in sides.groups()) + # A panel of three readers, seated as the README's audience, picked this wording on 2026-11-23. Two of the three wanted the bench's name before the commits. name = f"task-bench of {branch}: head {head} against base {base}" return name, "\n".join([f"## {utc(now)}, {name}", "", *table[:2], *rows]) + "\n" diff --git a/bin/task_bench/test_record_figures.py b/bin/task_bench/test_record_figures.py index e3272693..0b065a3c 100644 --- a/bin/task_bench/test_record_figures.py +++ b/bin/task_bench/test_record_figures.py @@ -1,6 +1,5 @@ -"""`task-bench record-figures`: the entry a bench's digest becomes in the comprehension history, and what it refuses.""" +"""`task-bench --record-figures`: the entry a bench's digest becomes in the comprehension history, and what it refuses.""" import contextlib -import io import pathlib import subprocess import sys @@ -9,12 +8,11 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from task_bench.record_figures import appended_to, record_figures +from task_bench.record_figures import bench_appended, recorded_bench from review_rules.comprehension_history import entries from failure import Failure from record_store.held import Held from test_env import isolated_env -from task_bench import main from record_store.fakes import MemoryStore SCORING = "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\n| Seat | Overall |\n|---|---|\n| Mean | 7.00 |\n" @@ -45,90 +43,90 @@ class RecordFiguresTest(unittest.TestCase): self.home = pathlib.Path(folder.name).resolve() / "home" self.repo = self.home / "code/calc" self.repo.mkdir(parents=True) - self.env = {**isolated_env(), "HOME": str(self.home)} - subprocess.run(["git", "init", "--quiet", "--initial-branch", "item-7"], cwd=self.repo, env=self.env, check=True) - subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@localhost", "-c", "commit.gpgsign=false", "commit", "--quiet", "--allow-empty", "--message", "Base"], cwd=self.repo, env=self.env, check=True) + # The project's config is found from the checkout's top, which git names. + subprocess.run(["git", "init", "--quiet"], cwd=self.repo, env={**isolated_env(), "HOME": str(self.home)}, check=True) config = self.home / ".claude-projects/calc/config.toml" config.parent.mkdir(parents=True) config.write_text(PROJECT_CONFIG) self.bench = self.home / ".local/state/larv-review/code/calc/task-bench" self.bench.mkdir(parents=True) self.history = self.repo / "docs/comprehension-history.md" + self.ran = 0 + self.asked: list[tuple[str, ...]] = [] self.enterContext(contextlib.chdir(self.repo)) - def recorded(self) -> str: - found = record_figures(self.env, self.home, NOW) + def git(self, *args: str) -> str | Failure: + self.asked.append(args) + return "item-7\n" + + def left(self, digest: str | None = DIGEST, report: list[str] | Failure = ["the table"]) -> list[str] | Failure: + """A bench that leaves digest in its folder and returns report.""" + self.ran += 1 + if digest is not None: + (self.bench / "digest.md").write_text(digest) + return report + + def recorded(self, run=None) -> list[str] | str: + found = recorded_bench(run or self.left, self.bench, self.git, self.home, lambda: NOW) return found.reason if isinstance(found, Failure) else found + def unrecorded(self, why: str) -> str: + return f"the bench finished and {self.bench} holds its results, but its figures are not recorded: {why}" + def test_appends_the_rows_over_every_bug_under_a_heading_that_is_no_ruling_or_scoring_run_and_keeps_the_benchs_folder(self): - (self.bench / "digest.md").write_text(DIGEST) self.history.parent.mkdir() self.history.write_text("# Comprehension history\n\n" + SCORING) - self.assertEqual(self.recorded(), f"Appended to {self.history}.") + self.assertEqual(self.recorded(), ["the table", f"Appended to {self.history}."]) entry = f"## 2026-11-23T10:00:00Z, task-bench of item-7: head bbbbbbbb against base aaaaaaaa\n\n{TABLE}{OVER_ALL}" self.assertEqual(self.history.read_text(), f"# Comprehension history\n\n{SCORING}\n{entry}") self.assertEqual([entry.heading for entry in entries(self.history.read_text())], ["2026-10-08T12:00:00Z, PR #1 at aaaaaaa"]) self.assertEqual((self.bench / "digest.md").read_text(), DIGEST) + self.assertEqual(self.asked, [("rev-parse", "--abbrev-ref", "HEAD")]) def test_starts_a_history_where_the_project_has_none(self): - (self.bench / "digest.md").write_text(DIGEST) - self.assertEqual(self.recorded(), f"Appended to {self.history}.") + self.recorded() self.assertTrue(self.history.read_text().startswith("# Comprehension history\n\n## 2026-11-23T10:00:00Z, task-bench of item-7: head bbbbbbbb")) + def test_a_bench_that_fails_or_stops_records_nothing_though_it_left_a_digest(self): + self.assertEqual(self.recorded(lambda: self.left(report=Failure("stopped after 2 of 4 runs"))), "stopped after 2 of 4 runs") + self.assertFalse(self.history.exists()) + + def test_refuses_before_the_bench_where_git_names_no_branch_or_no_config_names_the_checkout(self): + self.git = lambda *args: Failure("git failed") + self.assertEqual(self.recorded(), "git failed") + del self.git + (self.home / ".claude-projects/calc/config.toml").unlink() + self.assertTrue(self.recorded().startswith(f"no config names the checkout {self.repo}"), self.recorded()) + self.assertEqual(self.ran, 0) + def test_refuses_a_bench_the_history_already_holds(self): - (self.bench / "digest.md").write_text(DIGEST) self.recorded() held = self.history.read_text() - self.assertEqual(self.recorded(), f"{self.history} already holds task-bench of item-7: head bbbbbbbb against base aaaaaaaa; record each bench once") + self.assertEqual(self.recorded(), self.unrecorded(f"{self.history} already holds task-bench of item-7: head bbbbbbbb against base aaaaaaaa; record each bench once")) self.assertEqual(self.history.read_text(), held) - def test_refuses_without_a_digest(self): - self.assertEqual(self.recorded(), f"{self.bench} holds no digest: run task-bench in this checkout first, and record its figures before `task-bench gather`") - def test_refuses_a_digest_without_its_commits_or_without_its_three_rows_over_every_bug(self): for digest in (DIGEST.replace("Base ", "From "), DIGEST.replace("| All | change | +1 | -22% |\n", "")): with self.subTest(digest=digest): - (self.bench / "digest.md").write_text(digest) - self.assertEqual(self.recorded(), f"{self.bench / 'digest.md'} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows") + self.assertEqual(self.recorded(lambda: self.left(digest)), self.unrecorded(f"{self.bench / 'digest.md'} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows")) self.assertFalse(self.history.exists()) def test_refuses_a_digest_it_cannot_read(self): - (self.bench / "digest.md").mkdir() - self.assertTrue(self.recorded().startswith(f"could not read {self.bench / 'digest.md'}: [Errno "), self.recorded()) + self.assertTrue(self.recorded(lambda: self.left(None)).startswith(self.unrecorded(f"could not read {self.bench / 'digest.md'}: [Errno ")), self.recorded()) - def test_says_why_where_no_config_names_the_checkout(self): - (self.bench / "digest.md").write_text(DIGEST) - (self.home / ".claude-projects/calc/config.toml").unlink() - self.assertTrue(self.recorded().startswith(f"no config names the checkout {self.repo}"), self.recorded()) - - def test_git_runs_in_the_environment_given(self): - (self.bench / "digest.md").write_text(DIGEST) - other = self.home / "code/other" - other.mkdir() - subprocess.run(["git", "init", "--quiet", "--initial-branch", "elsewhere"], cwd=other, env=self.env, check=True) - subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@localhost", "-c", "commit.gpgsign=false", "commit", "--quiet", "--allow-empty", "--message", "Base"], cwd=other, env=self.env, check=True) - self.env = {**self.env, "GIT_DIR": str(other / ".git"), "GIT_WORK_TREE": str(self.repo)} - with contextlib.redirect_stdout(io.StringIO()): - self.assertEqual(main.main(["record-figures"], self.env), 0) - self.assertIn(", task-bench of elsewhere: head ", self.history.read_text()) + def test_says_why_where_the_history_cannot_be_read_once_the_bench_has_run(self): + def run(): + (self.home / ".claude-projects/calc/config.toml").unlink() + return self.left() + self.assertTrue(self.recorded(run).startswith(self.unrecorded(f"no config names the checkout {self.repo}"))) def test_writes_over_the_version_the_history_was_read_at_and_says_why_a_write_fails(self): history = MemoryStore(label="history.md", version=5) - self.assertEqual(appended_to(history, Held("", "5"), "task-bench of item-7: head b against base a", "## an entry\n"), "Appended to history.md.") + self.assertEqual(bench_appended(history, Held("", "5"), "task-bench of item-7: head b against base a", "## an entry\n"), "Appended to history.md.") self.assertEqual(history.overs, ["5"]) - refused = appended_to(history, Held("", "5"), "task-bench of item-8: head b against base a", "## an entry\n") + refused = bench_appended(history, Held("", "5"), "task-bench of item-8: head b against base a", "## an entry\n") self.assertEqual(refused.reason if isinstance(refused, Failure) else refused, "someone saved history.md since version 5") - def test_the_tool_prints_the_line_and_refuses_arguments(self): - (self.bench / "digest.md").write_text(DIGEST) - with contextlib.redirect_stdout(io.StringIO()) as out: - self.assertEqual(main.main(["record-figures"], self.env), 0) - self.assertEqual(out.getvalue(), f"Appended to {self.history}.\n") - self.assertIn(", task-bench of item-7: head bbbbbbbb against base aaaaaaaa\n", self.history.read_text()) - with contextlib.redirect_stderr(io.StringIO()) as errors: - self.assertEqual(main.main(["record-figures", "x"], self.env), 1) - self.assertEqual(errors.getvalue().split(";")[0], "record-figures takes no arguments") - if __name__ == "__main__": unittest.main() diff --git a/bin/task_bench/test_task_bench.py b/bin/task_bench/test_task_bench.py index b42a85e2..5b329620 100644 --- a/bin/task_bench/test_task_bench.py +++ b/bin/task_bench/test_task_bench.py @@ -332,6 +332,36 @@ class BenchTest(unittest.TestCase): self.assertEqual(lines[-3:-1], ["| All | base | 0/1 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | 1 |", "| All | head | 1/1 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | 1 |"]) self.assertEqual([(run["side"], run["run"]) for run in json.loads((folder / "results.json").read_text())["runs"]], [("base", 1), ("head", 1)]) + def project_config(self) -> pathlib.Path: + """Writes the config that puts the project's records in the checkout, and returns its comprehension history's path.""" + config = self.home / ".claude-projects/calc/config.toml" + config.parent.mkdir(parents=True) + records = {"plan": "todo.md", "working-rules": "AGENTS.md", "decisions": "docs/decisions.md", "score-anchors": "docs/score-anchors.md", "comprehension-history": "docs/comprehension-history.md", "reading-cost": "docs/reading-cost.md", "changelog": "CHANGELOG.md", "goals-and-audience": "README.md"} + config.write_text(f'checkout = "{self.repo}"\n' + "".join(f'{name} = "checkout:{path}"\n' for name, path in records.items()) + 'principles = "~/principles"\nstandards = "~/standards"\n') + return self.repo / "docs/comprehension-history.md" + + def test_record_figures_appends_a_finished_benchs_rows_over_every_bug_to_the_comprehension_history(self): + history = self.project_config() + report = self.bench(**{"--record-figures": ""}) + self.assertNotIsInstance(report, Failure, report) + self.assertEqual(report[-1], f"Appended to {history}.") + lines = history.read_text().splitlines() + self.assertRegex(lines[2], rf"^## \d{{4}}-\d\d-\d\dT\d\d:\d\d:\d\dZ, task-bench of item-1: head {self.head[:8]} against base {self.base[:8]}$") + self.assertEqual([line.split(" | ")[:2] for line in lines[6:]], [["| All", "base"], ["| All", "head"], ["| All", "change"]]) + + def test_a_bench_records_no_figures_unless_asked_nor_where_it_stops(self): + history = self.project_config() + self.assertNotIsInstance(self.bench(), Failure) + self.env["FAKE_REFUSED_FROM"] = "3" + self.assertIsInstance(self.bench(**{"--record-figures": ""}), Failure) + self.assertFalse(history.exists()) + + def test_record_figures_refuses_before_any_container_starts_where_no_config_names_the_checkout(self): + found = self.bench(**{"--record-figures": ""}) + self.assertIsInstance(found, Failure) + self.assertTrue(found.reason.startswith(f"no config names the checkout {self.repo}"), found.reason) + self.assertFalse(self.log.exists()) + def test_a_change_to_another_file_neither_moves_nor_drops_the_bug(self): (self.repo / "notes.txt").write_text("one\ntwo\nthree\nfour\nfive\nsix\n") self.commit("Notes") @@ -390,7 +420,7 @@ class MainTest(unittest.TestCase): return main.main(list(argv), {"CLAUDE_CODE_OAUTH_TOKEN": token, "HOME": "/nonexistent"}), errors.getvalue() def test_refuses_an_unknown_repeated_or_valueless_argument(self): - for argv, said in ((["--imgae", "x"], "unknown argument --imgae"), (["--image", "x", "--image=y"], "--image is given twice"), (["--image"], "--image needs a value")): + for argv, said in ((["--imgae", "x"], "unknown argument --imgae"), (["--image", "x", "--image=y"], "--image is given twice"), (["--image"], "--image needs a value"), (["--record-figures=yes"], "--record-figures takes no value"), (["--record-figures", "--record-figures"], "--record-figures is given twice"), (["--record-figures"], "--image is missing")): code, errors = self.run_main(*argv) self.assertEqual((code, errors.startswith(f"{said}; usage: task-bench --image")), (1, True), errors) -- 2.52.0 From febca8b5eef0b00e22bb53181924c3fd40424b0c Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 15:36:08 +0100 Subject: [PATCH 07/12] =?UTF-8?q?Answer=20product-owner=20round=201:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20the=20be?= =?UTF-8?q?nch=20records=20under=20its=20own=20lock,=20and=20the=20skill?= =?UTF-8?q?=20says=20the=20chunk=20waits=20for=20it=20and=20never=20gather?= =?UTF-8?q?s=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/decisions.md | 10 ++++++---- skills/larv-review/SKILL.md | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/decisions.md b/docs/decisions.md index 6b69de62..3f697bfe 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -45,7 +45,7 @@ Each project principle states one rule that the decisions below apply; their ent - routing: loop-claude reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut - routing: the worker changes rung only as a chunk starts, after every second unfinished verdict, when it names a chunk item that picks a higher rung, or when it cites an escalation trigger the judge finds - task-bench: a bench takes 5 bugs and 5 runs per side, after a 2 × 2 pilot on a new setup, and at no affordable count does a chunk-sized change rise above the noise -- task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats and `task-bench record-figures` records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches +- task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats with `--record-figures`, which records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches - tests: each test earns its keep as the technical principles' test bullet says, and the worker takes a test's expected values from its item, never from the code - the repo may name bender, bender-infra and ai-sandbox - todo.md: an item of the next release predicts the files and parts it will touch under `Touches:` in its detail; chunk-preflight takes, in the plan's order, the items that overlap none taken before them as the chunks that may run at once, and the optional `touch-predictions` record keeps each chunk's prediction beside what it touched @@ -862,14 +862,16 @@ Measured on `fejkdata` (Go, 5 bugs planted in the files `larv-review places` nam - **One finished chunk**: `fejkdata`'s PR #490, base `33b7fa80`, head `5b9c2a14`, which the comprehension panel ruled better on Navigation, Locality and Shape and the same on Self-sufficiency. The bench planted 5 bugs and ran 38 of 50 runs before the machine restarted. The first 3 runs per bug and side, 30 runs, are the ones counted, and all passed. The mean of the bugs' changes was +4.6% in output tokens, +8.9% in cache-read tokens and +3.8% in turns, with the bugs' own changes in cache-read tokens from -41% to +47%. The two token figures sit inside the spread at 5 × 3, 17% and 22%. The turns' +3.8% sits inside their spread at 5 × 5, 14%, and the spread at 5 × 3 can only be wider. The mean of the wall times' changes, +105%, lies above the 86% of that row, from one bug whose head runs took 6.8 times as long at the median. Nobody read its streams to find out why. The head cost slightly more tokens where the panel finds it easier to read, and the wall time can't be judged, so the bench neither confirmed nor contradicted the panel. - **Cost**: 5 bugs × 6 runs took 3.9 hours and 34M cache-read, 1.2M cache-write and 0.3M output tokens; a run takes about 3.5 minutes, and planting 16 to 25 minutes. A 5 × 5 bench is about 3.3 hours and 28M cache-read tokens. Gremlins ran out of 8 GB at the base of PR #490, so the help's example takes 16 GB. -## task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats and `task-bench record-figures` records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches +## task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats with `--record-figures`, which records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches -2026-11-23, lilleman, through todo item 509. Serves code health, whose signal is the panel's overall score, since a signal only simulated readers give stays unchecked until a measurement stands beside it; and goal 1.4, since the bench runs only where a scoring run already does. +2026-11-23, lilleman, through todo item 509. Serves code health. Its signal is the panel's overall score, which simulated readers give, and nothing checks that score until a measurement stands beside it. Serves goal 1.4 too, since the bench runs only where a scoring run already does. -**A report, not a gate.** The bench's entry sits in the history beside the scoring run's, under a heading no command reads as a ruling or a run. A bench that fails, or a project whose README documents no bench command, doesn't hold up the merge. Once about 10 chunks have recorded both, the human rules whether the bench's figures agree with the panel's scores, and whether the bench then replaces the scoring run or gates a merge. +**A report, not a gate.** The bench's entry sits in the history beside the scoring run's, under a heading no command reads as a ruling or a run. A bench that fails, or a project whose README documents no bench command, doesn't hold up the merge. A bench that finishes does: the chunk waits for it, since its entry is committed with the scoring run's. Once about 10 chunks have recorded both, the human rules whether the bench's figures agree with the panel's scores, and whether the bench then replaces the scoring run or gates a merge. **The README names the command**, as it names the project's mutation command: a bench needs the project's image, test command and Gremlins prefix, and a README already says how the project's tools run. +**The bench records its own figures**, under the lock it holds on its folder and only once every run has finished. A separate command would record a bench that stopped part-way as if it were whole, and another checkout's bench could remove the folder first. The option keeps the name a panel of three readers, seated as the README's audience, picked 3 to 0 for that command on 2026-11-23. + **The entry keeps the three rows over every bug.** The rows per bug stay in the bench's digest, which `task-bench gather` reads: a bug is planted anew each bench, so its row doesn't compare with a later entry's. Valid while task-bench's figures are unproven against the panel's scores. diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index da3a2885..eeb5477e 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -172,10 +172,10 @@ The comprehension check records how hard the project is for its contributor to r - **Seats.** Junior A, Mid A, the maintainability senior and the inherited architect each score the project at the head from 1 to 10 overall and on four dimensions: Navigation, Locality, Shape and Self-sufficiency. Run `~/.claude/bin/larv-review prepare-scoring`. It makes the worktree the seats read and prints each seat's prompt file; launch each seat with its file's text as its prompt. Write their lines into a scores file and run `~/.claude/bin/larv-review record-scoring `, which appends the run to the history and prints the four seats' means. - **Floor item.** Where `record-scoring` prints `Floor:`, a `Next:` line follows: file one floor item, or refresh the open one. A floor item is a plan item meant to bring every mean to the project's readability floor, which `record-scoring`'s `Floor:` line names. File it as one ambitious refactor, not touch-ups. It restructures the area behind the places `larv-review places` prints for this run, chosen where they bear on the lowest dimension, sized to bring every mean to that floor, and quotes those places. Its tagline opens with `Reach the comprehension floor:`, so its own chunk runs a scoring run; while a mean stays under the floor, that run's `Next:` line asks for the next floor item. Mark it `owner`, since the human asked that such a project always hold one, so no score deletes it. Put it in the earliest release the plan names after the one the chunk ships into, or else in the next version after that one that `~/.claude/rules/todo-items.md` allows, so the floor doesn't hold up any release. While one is open, refresh its places and aim from the newest run instead of filing another; the item the chunk ships doesn't count as open. Commit it with the run, as "Record" says. - **Second run.** Where `needs-scoring-run` printed that the chunk `leaves release … with no plan item`, run `prepare-scoring` again and launch the same four seats afresh on the same head. Their scores file's first line is ` rerun at `. Record it with the same `record-scoring` command. -- **Bench.** Where the project's README documents a `task-bench` command, start it when the seats launch, on the same head, in the background under `~/.claude/bin/run-heavy`. Once it ends, run `~/.claude/bin/task-bench record-figures`, which appends the bench's figures to the history, and put its `All` `change` row in the summary. A second run takes no second bench. The bench is a report beside the panel's scores: none of its figures blocks a merge or files an item. Where it fails, say why in the summary and merge without it. A project whose README documents no such command skips it. +- **Bench.** Where the project's README documents a `task-bench` command, start that command with `--record-figures` when the seats launch, on the same head, in the background under `~/.claude/bin/run-heavy`. A bench that finishes appends its figures to the history. Wait for the bench before the commit "Record" below asks for, though it takes hours, and put the `All` `change` row it prints in the summary. A second run takes no second bench. The bench is a report beside the panel's scores: none of its figures blocks a merge or files an item, so don't run `task-bench gather` on it. Where it fails, say why in the summary and merge without it. - **Agreement.** After the second run, run `~/.claude/bin/larv-review agreement` and put its counts in the summary. On `Assumption fails:`, ask the user whether to keep the paired ruling or change the decision `review: the comprehension check records …`. Record the answer as a decision in the repo whose history was counted, with the counts that led to the ask. A later run asks again only when the rulings' rate falls, or the runs' rate rises, against the recorded counts. -**Record.** `docs/comprehension-history.md` keeps every paired ruling and scoring run, which `larv-review` appends, and every bench, which `task-bench record-figures` appends; never edit one. Commit what it appends, with the `todo.md` that `record-scoring` re-ranks in one commit titled `Record the comprehension check: …`, and push it; it re-enters no pass, and `chunk-pr merge` waits for the forge's checks it starts. Resolve a merge conflict in the file by putting the default branch's entries first. Put each ruling with its base and votes, and each run's five scores, in the summary. +**Record.** `docs/comprehension-history.md` keeps every paired ruling and scoring run, which `larv-review` appends, and every bench, which `task-bench --record-figures` appends; never edit one. Commit what the two append, with the `todo.md` that `record-scoring` re-ranks in one commit titled `Record the comprehension check: …`, and push it; it re-enters no pass, and `chunk-pr merge` waits for the forge's checks it starts. Resolve a merge conflict in the file by putting the default branch's entries first. Put each ruling with its base and votes, and each run's five scores, in the summary. **Places.** The header of systems-architect and stability-reviewer names `places.md`, which holds what `~/.claude/bin/larv-review places` prints: the places seats found hard since the newest scored commit. Ask each to report, as a 🟡, each of those places the change touches without making it easier to read, matching a place by its path and the function or section it names, since its line may have moved. Fix such a 🟡, or say in the PR summary why not; that reason settles it in place of a decline's record. -- 2.52.0 From c1b16e09a3d6c4ca4f23b097ffbe56e1fe6f167a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 15:36:08 +0100 Subject: [PATCH 08/12] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=206=20=F0=9F=9F=A1=20(0=20misread);=20reword=20th?= =?UTF-8?q?e=20help,=20the=20skill's=20bullets,=20the=20README's=20sentenc?= =?UTF-8?q?e,=20the=20comment=20and=20the=20docstrings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 766d803a..83bdfc95 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter. - `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it. - `subagent-rung [--plan] ` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model on the project's routing ladder, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule. -- `task-bench --image --test []` plants bugs that the tests catch, at the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. `task-bench record-figures` appends the bench's figures over every bug to the comprehension history, which a scoring run does where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. +- `task-bench --image --test []` plants bugs that the tests catch, at the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--record-figures`, a bench that finishes appends its figures over every bug to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. - `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show ` one item's row and detail; `add …` files an item under the next free ID, `edit …` sets an item's cells or detail, and `move --release ` sets an item's release; `finish ` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`, except for a plan kept in Jira. Each change ranks a markdown plan. `todo-item --help` states the flags. - `touch-predictions record ...` appends what a chunk's items were predicted to touch, under `Touches:` in their details, beside the files and parts its branch touched, to the record the config names as `touch-predictions`; `touch-predictions --help` shows the spelling and how a part is named. `chunk-preflight` reads the same predictions to name the items that may start chunks at once. - `wait-for [] [--timeout ]` waits until a file a background job writes holds a line matching the pattern, and prints it. -- 2.52.0 From 71cf3ffa2b579e9626c911f85a1e652f1209f299 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 15:41:25 +0100 Subject: [PATCH 09/12] Sort the imports of record_figures.py --- bin/task_bench/record_figures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/task_bench/record_figures.py b/bin/task_bench/record_figures.py index 5e76b450..07467e60 100644 --- a/bin/task_bench/record_figures.py +++ b/bin/task_bench/record_figures.py @@ -6,10 +6,10 @@ import typing from review_rules.comprehension_history import appended from task_bench.gather import DIGEST from failure import Failure +from git_cli.git_repo import Git from record_store.held import Held from larv_review.history_commands import held_history from record_store.stores import RecordStore -from git_cli.git_repo import Git from text_files.utc_stamp import utc # The digest's line that names the commits, as task_bench.digest.digest writes it. -- 2.52.0 From 1360627b4d8e068e41737dc514e3e21ea0a27833 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 16:00:51 +0100 Subject: [PATCH 10/12] =?UTF-8?q?Answer=20product-owner=20round=202:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20fin?= =?UTF-8?q?ding;=20the=20=F0=9F=9F=A2,=20that=20a=20bench=20the=20history?= =?UTF-8?q?=20already=20holds=20is=20refused=20only=20after=20it=20ran,=20?= =?UTF-8?q?stands,=20since=20a=20scoring=20run=20takes=20one=20bench?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From d37a9fbb685e28bc095ed4672fd8e3ffa073bde0 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 16:06:47 +0100 Subject: [PATCH 11/12] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g;=20the=20=F0=9F=9F=A2,=20that=20a=20bench=20it=20could=20not?= =?UTF-8?q?=20record=20prints=20no=20table,=20stands,=20since=20the=20fold?= =?UTF-8?q?er=20it=20names=20holds=20the=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From cf40c8aa8d9d99648f7f2e6719af144b330e850f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 23 Nov 2026 16:07:02 +0100 Subject: [PATCH 12/12] Finish item 509 in the plan --- CHANGELOG.md | 1 + todo.md | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18f0180d..52be774d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- A bench started with `task-bench --record-figures` appends its figures over every bug to the comprehension history once it finishes, and a scoring run in `larv-review` starts the project's bench that way where its README documents a `task-bench` command. The figures are a report beside the panel's scores: none blocks a merge. - `task-bench`'s table prints the mean of the bugs' own head/base changes as its All change, in place of the change of the two All rows' medians, which swung up to three times as far in tokens. The All rows per side stay, so the change row is no longer their difference, and a change from before 0.15.1 can't be compared with one from after it. - `task-bench` now stops with a Failure on a run whose final result says `terminal_reason: "api_error"`, even where it holds no `api_error_status`, so a token the API refuses no longer lets the bench run on for hours with empty runs. - `task-bench`'s `--help` now says how far a bench of a commit against itself swings, in 19 cases of 20, with the default 5 bugs and 5 runs, and that a Gremlins run on a large project needs 16 GB of memory. diff --git a/todo.md b/todo.md index 4dd18db2..5e76f8c0 100644 --- a/todo.md +++ b/todo.md @@ -16,7 +16,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 509 | 0.16.0 | | owner | **Run `task-bench` beside the scoring run in larv-review comprehension check, and record its figures in the comprehension history beside the panel scores.** | 3 | 2 | 3 | 6 | 5 | code health by 5, 1.1 by 3 | 5.6 | | 504 | 0.16.0 | | owner | **Bench new features in `task-bench`, each a spec for Haiku with acceptance tests it never sees and a reference patch that proves it can be built, kept in a `bench-tasks` folder the project config names, starting with six for fejkdata.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 4, code health by 3 | 2.6 | | 505 | 0.16.0 | 504 | owner | **Bench adding source data in `task-bench`: hand Haiku a fake register that a seeded script generates for a made-up country, and check the importer, the data and the licence entry it adds, starting with five tasks for fejkdata.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3, code health by 2 | 2.6 | | 508 | 0.16.0 | | owner | **Plant bugs for `task-bench` in Python, Rust, TypeScript and PHP, from the mutants `mutate-changes` runs for each, so this repo benches itself.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3, code health by 2 | 2.6 | @@ -113,10 +112,6 @@ ## Details -### 509. Run `task-bench` beside the scoring run in larv-review comprehension check, and record its figures in the comprehension history beside the panel scores. - -It stays a report beside the panel until about 10 chunks show whether the two agree; whether it can replace the scoring run or gate a merge is the human's call then. - ### 504. Bench new features in `task-bench`, each a spec for Haiku with acceptance tests it never sees and a reference patch that proves it can be built, kept in a `bench-tasks` folder the project config names, starting with six for fejkdata. Each feature breaks one of the project's goals while it would suit another audience, so none ever turns into a real plan item, lies half-built in the code, or tempts a merge. A stronger model writes the tasks once. A run counts only where the acceptance tests fail at both the base and the head before Haiku starts, and pass with the reference patch. Haiku's copy leaves the folder out. -- 2.52.0