From 7d440c6ee17196e2e0b410a271492f3bee0662b0 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 8 Oct 2026 21:48:05 +0200 Subject: [PATCH] Answer architecture round 1: make cognitive complexity a pure recursion, share a tied top-k cut evenly, count unresolved places, skip a run whose commit is gone, fail on a file that does not parse, link the history's format and its reader both ways, reword item 85's order, and record the worse ruling --- README.md | 2 + bin/metric_bench/bench.py | 25 +++--- bin/metric_bench/main.py | 25 ++++-- bin/metric_bench/places.py | 1 + bin/metric_bench/python_units.py | 129 +++++++++---------------------- bin/test_metric_bench.py | 47 ++++++++--- bin/test_types.py | 2 +- docs/comprehension-history.md | 27 +++++++ skills/larv-review/SKILL.md | 2 +- todo.md | 6 +- 10 files changed, 143 insertions(+), 123 deletions(-) diff --git a/README.md b/README.md index 19fe6931..96db5ea4 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ Rename `## Unreleased` in `CHANGELOG.md` to the version, commit, tag that commit ## Tools +Run each from `~/.claude/bin/`; Install puts only `loop-claude` on `PATH`. + - `loop-claude ` runs a project's next chunk cycle after cycle; `loop-claude --help` states its contract. - `metric-bench [history]` benches cheap static metrics of a project's Python against the places its comprehension history names as hardest; `metric-bench --help` states the metrics and the scores. - `rank_todo.py [--check] [todo.md]` scores and ranks a project's `todo.md`; `rank_todo.py --help` states the format. diff --git a/bin/metric_bench/bench.py b/bin/metric_bench/bench.py index 96a65b8f..b3dcf31c 100644 --- a/bin/metric_bench/bench.py +++ b/bin/metric_bench/bench.py @@ -38,18 +38,20 @@ def co_changed(log: str) -> dict[str, int]: return {path: len(others) for path, others in partners.items()} -def bench(units: list[Unit], places: list[Place], spread: dict[str, int]) -> RunScores | None: - """How well each metric ranks the units the seats named above the rest; None when no named place is a measured unit.""" +def bench(units: list[Unit], places: list[Place], unresolved: int, spread: dict[str, int]) -> RunScores | None: + """How well each metric ranks the units the seats named above the rest; None when the named units are none or all of them. unresolved counts the places that named no tracked file.""" names = {(place.path, place.name) for place in places} named = [unit for unit in units if (unit.path, unit.name) in names] if not named or len(named) == len(units): return None rest = [unit for unit in units if (unit.path, unit.name) not in names] - measured = {(unit.path, unit.name) for unit in named} - unmeasured = len({place for place in places if (place.path, place.name) not in measured}) + found = {(unit.path, unit.name) for unit in named} + unmeasured = unresolved + len({place for place in places if (place.path, place.name) not in found}) scores = {} for metric, value in METRICS.items(): - scores[metric] = Score(auc([value(unit, spread) for unit in named], [value(unit, spread) for unit in rest]), top_k(units, named, lambda unit: value(unit, spread))) + named_values = [value(unit, spread) for unit in named] + rest_values = [value(unit, spread) for unit in rest] + scores[metric] = Score(auc(named_values, rest_values), top_k(named_values, rest_values)) return RunScores(len(units), len(named), unmeasured, scores) @@ -59,10 +61,15 @@ def auc(named: list[int], rest: list[int]) -> float: return wins / (len(named) * len(rest)) -def top_k(units: list[Unit], named: list[Unit], value: Callable[[Unit], int]) -> float: - """The share of the metric's top k units the seats named, k being how many they named; a tie at the cut counts in order of the units.""" - top = sorted(units, key=value, reverse=True)[:len(named)] - return sum(unit in named for unit in top) / len(named) +def top_k(named: list[int], rest: list[int]) -> float: + """The share of the metric's k highest units the seats named, k being how many they named. Units tied at the cut share its remaining seats evenly, as a random order of them would.""" + k = len(named) + cut = sorted(named + rest, reverse=True)[k - 1] + above = sum(value > cut for value in named) + seats = k - above - sum(value > cut for value in rest) + tied_named = sum(value == cut for value in named) + tied = tied_named + sum(value == cut for value in rest) + return (above + seats * tied_named / tied) / k def medians(runs: list[RunScores]) -> dict[str, Score]: diff --git a/bin/metric_bench/main.py b/bin/metric_bench/main.py index 85fe13f1..e932ec81 100644 --- a/bin/metric_bench/main.py +++ b/bin/metric_bench/main.py @@ -15,7 +15,9 @@ medians. Places that name no Python function or method, such as a section of a m counted as unmeasured. Exit 1, saying why, on unknown arguments, or when git cannot start or finds no checkout, the -history cannot be read, a run's commit is missing, or no scoring run names a measured unit. +history cannot be read, a measured file does not parse, or no scoring run names a measured unit. A +run whose commit the checkout lacks, such as a deleted branch's, is skipped and named below the +table. """ import pathlib import subprocess @@ -23,7 +25,7 @@ import sys from metric_bench.bench import bench, co_changed, medians, METRICS, RunScores, Score from failure import Failure -from metric_bench.python_units import measured, python_units +from metric_bench.python_units import measured, python_units, Unit from metric_bench.places import resolved, scoring_runs, ScoringRun @@ -45,15 +47,20 @@ def main(argv: list[str]) -> int: except (OSError, UnicodeDecodeError) as failure: return failed(Failure(f"could not read {history}: {failure}")) rows = [] + gone = [] for run in scoring_runs(text): + if isinstance(git(["cat-file", "-e", f"{run.commit}^{{commit}}"], top), Failure): + gone.append(run.heading) + continue scores = run_scores(run, top) if isinstance(scores, Failure): return failed(scores) if scores: rows.append((run.heading, scores)) + skipped = "".join(f"\nSkipped, its commit is not in {top}: {heading}" for heading in gone) if not rows: - return failed(Failure(f"no scoring run in {history} names a Python function or method the bench measures")) - print(table(rows)) + return failed(Failure(f"no scoring run in {history} names a Python function or method the bench measures; its format: ~/.claude/skills/larv-review/SKILL.md → \"History\"{skipped}")) + print(table(rows) + ("\n" + skipped if skipped else "")) return 0 @@ -62,16 +69,20 @@ def run_scores(run: ScoringRun, top: str) -> RunScores | None | Failure: if isinstance(listed, Failure): return listed tracked = listed.split("\n") - units = [] + units: list[Unit] = [] for path in filter(measured, tracked): source = git(["show", f"{run.commit}:{path}"], top) if isinstance(source, Failure): return source - units += python_units(path, source) + found = python_units(path, source) + if isinstance(found, Failure): + return found + units += found log = git(["log", "--no-merges", "--format=format:@@", "--name-only", run.commit], top) if isinstance(log, Failure): return log - return bench(units, resolved(run.places, tracked), co_changed(log)) + places = resolved(run.places, tracked) + return bench(units, places, len(run.places) - len(places), co_changed(log)) def table(rows: list[tuple[str, RunScores]]) -> str: diff --git a/bin/metric_bench/places.py b/bin/metric_bench/places.py index f38412a8..4cb3e016 100644 --- a/bin/metric_bench/places.py +++ b/bin/metric_bench/places.py @@ -4,6 +4,7 @@ import re from markdown_sections import sections +# The format: skills/larv-review/SKILL.md §3 → "History", which names this reader. RUN = re.compile(r"^(.+), (.+) at ([0-9a-f]{7,40})$") SEAT_PLACES = re.compile(r"^.+, (hardest first|would restructure first):$") # `path:line` or `:line`, then the unit's name where one follows. diff --git a/bin/metric_bench/python_units.py b/bin/metric_bench/python_units.py index 7f1d5a3a..926ce687 100644 --- a/bin/metric_bench/python_units.py +++ b/bin/metric_bench/python_units.py @@ -1,6 +1,9 @@ import ast import collections import dataclasses +import sys + +from failure import Failure FUNCTION = (ast.FunctionDef, ast.AsyncFunctionDef) @@ -20,12 +23,12 @@ def measured(path: str) -> bool: return name.endswith(".py") and not name.startswith("test_") and not name.endswith("_test.py") and "tests" not in folders.split("/") -def python_units(path: str, source: str) -> list[Unit]: - """Each module-level function and each method in source, with its metrics; a source that does not parse has none.""" +def python_units(path: str, source: str) -> list[Unit] | Failure: + """Each module-level function and each method in source, with its metrics.""" try: tree = ast.parse(source) - except (SyntaxError, ValueError): - return [] + except (SyntaxError, ValueError) as failure: + return Failure(f"could not parse {path} on Python {sys.version_info[0]}.{sys.version_info[1]}: {failure}") units = [] for node in tree.body: if isinstance(node, FUNCTION): @@ -61,97 +64,37 @@ def written(node: ast.AST) -> list[ast.expr]: # SonarSource's "Cognitive Complexity" white paper (G. Ann Campbell, 2017), read for Python: a comprehension counts as a loop and each of its `if` clauses as a condition. def cognitive(function: ast.FunctionDef | ast.AsyncFunctionDef) -> int: - counter = Cognitive(function.name) - counter.within(function.body, 0) - return counter.score + return sum(score(node, 0, function.name) for node in function.body) -class Cognitive(ast.NodeVisitor): - def __init__(self, name: str) -> None: - self.name = name - self.nesting = 0 - self.score = 0 +def score(node: ast.AST, nesting: int, name: str) -> int: + """The cognitive complexity node adds at nesting depth nesting, its children included; name is the function's own, a call to it counting as recursion.""" + def inside(nodes: list, depth: int = nesting + 1) -> int: + return sum(score(child, depth, name) for child in nodes) - def within(self, nodes: list, deeper: int = 1) -> None: - self.nesting += deeper - for node in nodes: - self.visit(node) - self.nesting -= deeper + if isinstance(node, ast.If): + return 1 + nesting + branches(node, nesting, name) + if isinstance(node, ast.For | ast.AsyncFor | ast.While): + head = node.test if isinstance(node, ast.While) else node.iter + return 1 + nesting + score(head, nesting, name) + inside(node.body) + (1 + inside(node.orelse) if node.orelse else 0) + if isinstance(node, ast.Try | ast.TryStar): + handlers = sum(1 + nesting + inside(handler.body) for handler in node.handlers) + return inside(node.body, nesting) + handlers + inside(node.orelse, nesting) + inside(node.finalbody, nesting) + if isinstance(node, ast.Match): + return 1 + nesting + score(node.subject, nesting, name) + sum(inside(case.body) for case in node.cases) + if isinstance(node, ast.IfExp): + return 1 + nesting + inside([node.test, node.body, node.orelse]) + if isinstance(node, ast.ListComp | ast.SetComp | ast.DictComp | ast.GeneratorExp): + return sum(1 + nesting + len(generator.ifs) for generator in node.generators) + inside(list(ast.iter_child_nodes(node))) + if isinstance(node, ast.FunctionDef | ast.AsyncFunctionDef | ast.Lambda): + return inside(node.body if isinstance(node.body, list) else [node.body]) + own = 1 if isinstance(node, ast.BoolOp) or isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id == name else 0 + return own + inside(list(ast.iter_child_nodes(node)), nesting) - def structure(self) -> None: - self.score += 1 + self.nesting - def visit_If(self, node: ast.If) -> None: - self.structure() - self.branch(node) - - def branch(self, node: ast.If) -> None: - self.visit(node.test) - self.within(node.body) - if len(node.orelse) == 1 and isinstance(node.orelse[0], ast.If): - self.score += 1 - self.branch(node.orelse[0]) - elif node.orelse: - self.score += 1 - self.within(node.orelse) - - def loop(self, node: ast.For | ast.AsyncFor | ast.While, head: ast.expr) -> None: - self.structure() - self.visit(head) - self.within(node.body) - if node.orelse: - self.score += 1 - self.within(node.orelse) - - def visit_For(self, node: ast.For | ast.AsyncFor) -> None: - self.loop(node, node.iter) - - visit_AsyncFor = visit_For - - def visit_While(self, node: ast.While) -> None: - self.loop(node, node.test) - - def visit_Try(self, node: ast.Try | ast.TryStar) -> None: - self.within(node.body, 0) - for handler in node.handlers: - self.structure() - self.within(handler.body) - self.within(node.orelse, 0) - self.within(node.finalbody, 0) - - visit_TryStar = visit_Try - - def visit_Match(self, node: ast.Match) -> None: - self.structure() - self.visit(node.subject) - for case in node.cases: - self.within(case.body) - - def visit_IfExp(self, node: ast.IfExp) -> None: - self.structure() - self.within([node.test, node.body, node.orelse]) - - def visit_BoolOp(self, node: ast.BoolOp) -> None: - self.score += 1 - self.generic_visit(node) - - def comprehension(self, node: ast.ListComp | ast.SetComp | ast.DictComp | ast.GeneratorExp) -> None: - for generator in node.generators: - self.structure() - self.score += len(generator.ifs) - self.within(list(ast.iter_child_nodes(node))) - - visit_DictComp = visit_GeneratorExp = visit_ListComp = visit_SetComp = comprehension - - def visit_FunctionDef(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: - self.within(node.body) - - visit_AsyncFunctionDef = visit_FunctionDef - - def visit_Lambda(self, node: ast.Lambda) -> None: - self.within([node.body]) - - def visit_Call(self, node: ast.Call) -> None: - if isinstance(node.func, ast.Name) and node.func.id == self.name: - self.score += 1 - self.generic_visit(node) +def branches(node: ast.If, nesting: int, name: str) -> int: + """An if's test and bodies; an elif or else adds 1 at no extra depth.""" + total = score(node.test, nesting, name) + sum(score(child, nesting + 1, name) for child in node.body) + if len(node.orelse) == 1 and isinstance(node.orelse[0], ast.If): + return total + 1 + branches(node.orelse[0], nesting, name) + return total + (1 + sum(score(child, nesting + 1, name) for child in node.orelse) if node.orelse else 0) diff --git a/bin/test_metric_bench.py b/bin/test_metric_bench.py index cdcf60a4..662a6015 100644 --- a/bin/test_metric_bench.py +++ b/bin/test_metric_bench.py @@ -9,8 +9,9 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)) -from metric_bench.bench import auc, bench, co_changed +from metric_bench.bench import auc, bench, co_changed, top_k from metric_bench.python_units import cognitive, measured, python_units, Unit +from failure import Failure from test_loop_claude_black_box import host_env from metric_bench.places import Place, resolved, scoring_runs @@ -59,6 +60,16 @@ class Cognitive(unittest.TestCase): pass """), 1 + 2 + 2 + 1 + 1) + def test_nests_a_while_a_lambda_and_an_inner_function(self): + self.assertEqual(scored(""" + def f(a): + while a: + g = lambda b: 1 if b else 2 + def h(): + if a: + pass + """), 1 + 3 + 3) + def test_counts_a_comprehension_as_a_loop_and_its_conditions(self): self.assertEqual(scored(""" def f(rows): @@ -88,8 +99,10 @@ class Units(unittest.TestCase): def test_measures_python_files_outside_the_tests(self): self.assertEqual([path for path in ["a.py", "bin/test_a.py", "a_test.py", "tests/b.py", "e2e-tests/c.py", "README.md"] if measured(path)], ["a.py", "e2e-tests/c.py"]) - def test_a_source_that_does_not_parse_has_no_units(self): - self.assertEqual(python_units("a.py", "def ("), []) + def test_a_source_that_does_not_parse_is_a_failure_naming_it(self): + failure = python_units("a.py", "def (") + assert isinstance(failure, Failure) + self.assertIn("could not parse a.py", failure.reason) class Places(unittest.TestCase): @@ -107,6 +120,10 @@ class Places(unittest.TestCase): - `skills/x/SKILL.md:77` "Architecture" - `bin/tool/cycle/states.py:69` `transition`, with `cycle/run.py:55` `step` and `:90` `close` + Inherited architect, would restructure first: + + - `bin/tool/cycle/judge.py:31` `run_judge` + ## 2026-10-08T18:37:21Z, PR #228 at 2682668, against 8c9bf09 Mid A, decided by: @@ -117,7 +134,7 @@ class Places(unittest.TestCase): def test_reads_each_scoring_runs_places_and_leaves_paired_rulings_out(self): runs = scoring_runs(self.HISTORY) self.assertEqual([(run.heading, run.commit) for run in runs], [("2026-10-08T12:50:49Z, PR #224 at a58a0a8", "a58a0a8")]) - self.assertEqual(runs[0].places, [Place("skills/x/SKILL.md", None), Place("bin/tool/cycle/states.py", "transition"), Place("cycle/run.py", "step"), Place("cycle/run.py", "close")]) + self.assertEqual(runs[0].places, [Place("skills/x/SKILL.md", None), Place("bin/tool/cycle/states.py", "transition"), Place("cycle/run.py", "step"), Place("cycle/run.py", "close"), Place("bin/tool/cycle/judge.py", "run_judge")]) def test_resolves_a_shortened_path_to_the_file_nearest_the_one_before_it(self): tracked = ["bin/tool/cycle/states.py", "bin/tool/cycle/run.py", "bin/other/cycle/run.py"] @@ -136,16 +153,21 @@ class Bench(unittest.TestCase): def test_co_changed_counts_each_files_distinct_partners(self): self.assertEqual(co_changed("@@\na.py\nb.py\n@@\na.py\nc.py\n@@\na.py"), {"a.py": 2, "b.py": 1, "c.py": 1}) + def test_top_k_shares_the_seats_at_a_tied_cut_evenly(self): + self.assertEqual(top_k([0, 0], [0, 0, 0, 0]), 1 / 3) + self.assertEqual(top_k([5, 1], [1, 1]), 2 / 3) + def test_scores_the_named_units_and_counts_places_no_unit_measures(self): units = [Unit("a.py", "hard", 9, 40, 0), Unit("a.py", "easy", 1, 5, 0), Unit("b.py", "plain", 2, 6, 0)] - run = bench(units, [Place("a.py", "hard"), Place("doc.md", None)], {"a.py": 1}) + run = bench(units, [Place("a.py", "hard"), Place("doc.md", None)], 2, {"a.py": 1}) assert run is not None - self.assertEqual((run.units, run.named, run.unmeasured), (3, 1, 1)) + self.assertEqual((run.units, run.named, run.unmeasured), (3, 1, 3)) self.assertEqual((run.scores["cognitive complexity"].auc, run.scores["cognitive complexity"].top_k), (1.0, 1.0)) - self.assertEqual(run.scores["shared state"].auc, 0.5) + self.assertEqual((run.scores["shared state"].auc, run.scores["shared state"].top_k), (0.5, 1 / 3)) - def test_a_run_naming_no_measured_unit_is_not_scored(self): - self.assertIsNone(bench([Unit("a.py", "f", 1, 1, 0)], [Place("doc.md", None)], {})) + def test_a_run_naming_no_unit_or_every_unit_is_not_scored(self): + self.assertIsNone(bench([Unit("a.py", "f", 1, 1, 0)], [Place("doc.md", None)], 0, {})) + self.assertIsNone(bench([Unit("a.py", "f", 1, 1, 0)], [Place("a.py", "f")], 0, {})) class BlackBox(unittest.TestCase): @@ -187,6 +209,13 @@ class BlackBox(unittest.TestCase): self.assertIn("could not read", self.run_tool(top, str(pathlib.Path(top, "missing.md"))).stderr) self.assertEqual(self.run_tool(top, "--x").returncode, 1) + def test_skips_and_names_a_run_whose_commit_the_checkout_lacks(self): + top = self.project("# Comprehension history\n\n## 2026-10-07T12:00:00Z, PR #0 at 0123456\n\nJunior A, hardest first:\n\n- `a.py:1` `hard`\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `a.py:1` `hard`\n") + ran = self.run_tool(top) + self.assertEqual(ran.returncode, 0, ran.stderr) + self.assertIn("Skipped, its commit is not in", ran.stdout) + self.assertIn("PR #0 at 0123456", ran.stdout.split("Skipped")[1]) + def test_reads_the_checkout_that_holds_a_history_named_from_elsewhere(self): top = self.project("# Comprehension history\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `a.py:1` `hard`\n") ran = self.run_tool(tempfile.gettempdir(), str(pathlib.Path(top, "docs", "comprehension-history.md"))) diff --git a/bin/test_types.py b/bin/test_types.py index 88d6ea30..25721a39 100644 --- a/bin/test_types.py +++ b/bin/test_types.py @@ -11,5 +11,5 @@ class Types(unittest.TestCase): self.assertIsNotNone(floor, "README.md's Install names `Python 3.N or newer`") if shutil.which("uv") is None: self.fail("uv on PATH fetches mypy; see README.md's Test line") - ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "-p", "metric_bench", "-m", "rank_todo", "-p", "reading_cost", "-m", "statusline", "-p", "loop_claude"], capture_output=True, cwd=ROOT / "bin", text=True) + ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "-p", "loop_claude", "-p", "metric_bench", "-m", "rank_todo", "-p", "reading_cost", "-m", "statusline"], capture_output=True, cwd=ROOT / "bin", text=True) self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr) diff --git a/docs/comprehension-history.md b/docs/comprehension-history.md index 30cc0f08..2e832819 100644 --- a/docs/comprehension-history.md +++ b/docs/comprehension-history.md @@ -368,3 +368,30 @@ Inherited architect, decided by: - `skills/larv-review/SKILL.md:35`, `:98` and `:120`: the trigger three times, and seven concepts where there were three - `AGENTS.md:35` "Scoring run": the heading not renamed with the file - `skills/larv-review/SKILL.md:64` "Re-entry" and `:40` the Prose row, `:37` and `:124` "Security", better + +## 2026-10-08T19:48:05Z, PR #229 at 8a2dbd7, against 12d6d75 + +Ruling: worse + +| Seat | Vote | +|---|---| +| Mid A | worse | +| Inherited architect | worse | + +Mid A, decided by: + +- `skills/larv-review/SKILL.md:93` "Paired ruling" → "Base": the base found by a prose `git log` search with two fallbacks +- `skills/larv-review/SKILL.md:95` "Seats" and "Ruling": vote arithmetic written as prose, with no example +- `skills/larv-review/SKILL.md:89` "Architecture": two kinds of run, each with its own trigger, seats and block +- `CLAUDE.md:40` "Quality": a clause folded into a noun phrase +- `bin/metric_bench/places.py:7` `RUN`, `SEAT_PLACES`, `PLACE` and `:30` `scoring_runs`: a second reader of a format defined only in prose, linked from neither side + +Inherited architect, decided by: + +- `skills/larv-review/SKILL.md:93` "Paired ruling" → "Base": "worse than what?" means running the base search in your head +- `skills/larv-review/SKILL.md:95` "Seats" and "Ruling": a two-stage panel and vote arithmetic with nothing to run or test it +- `skills/larv-review/SKILL.md:35`, `:98` "Scoring run" and `:120` "Suspended": the scoring run's trigger written out in four places +- `skills/larv-review/SKILL.md:36` the Full scan and Security rows: each row's trigger depends on the other +- `bin/metric_bench/places.py:7` `RUN`, `SEAT_PLACES`, `PLACE`: a regex reader of the history linked from neither side +- `bin/metric_bench/places.py:59` `resolved`: a result that depends on the place resolved before it +- `bin/metric_bench/python_units.py:69` `Cognitive`: nesting bookkeeping spread over its methods diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index 4aeba287..47dbf1b1 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -108,7 +108,7 @@ Fix a worse ruling at the places the seats voting worse name, and the floor at t Two files of the project keep the records: -- **History.** `docs/comprehension-history.md` keeps every paired ruling and scoring run, appended and never edited. Each opens with a `## , at ` heading naming when the seats finished and the commit they read; a paired ruling's heading ends `, against `. A paired ruling holds a `Ruling: ` line, a table of each seat's vote, and under each seat, labelled `, decided by:`, its places. A scoring run holds a table of each seat's five scores, with a last row holding the four seats' mean of each, and under each seat, labelled `, hardest first:` or, for the architect, `, would restructure first:`, its places. A place is `path:line`, the path written from the repository's root, and the unit's name. Appending re-enters no pass. Resolve a merge conflict in the file by putting the default branch's entries first. +- **History.** `docs/comprehension-history.md` keeps every paired ruling and scoring run, appended and never edited. Each opens with a `## , at ` heading naming when the seats finished and the commit they read; a paired ruling's heading ends `, against `. A paired ruling holds a `Ruling: ` line, a table of each seat's vote, and under each seat, labelled `, decided by:`, its places. A scoring run holds a table of each seat's five scores, with a last row holding the four seats' mean of each, and under each seat, labelled `, hardest first:` or, for the architect, `, would restructure first:`, its places. A place is `path:line`, the path written from the repository's root, and the unit's name. `bin/metric_bench/places.py` reads this format: change both together. Appending re-enters no pass. Resolve a merge conflict in the file by putting the default branch's entries first. - **Entry.** `docs/decisions.md` keeps one entry whose title opens `comprehension floor:`. It holds each decision to ship under the floor, with its scores. A `comprehension floor:` entry written before the history may still hold a scoring run's five scores. The next scoring run moves them, and only them, into the history as its first run: a heading of the date or time the entry gives and whatever it names the run by, its commit included where named, and a table with the mean alone. The rest of the entry stays. diff --git a/todo.md b/todo.md index 22728911..410faec5 100644 --- a/todo.md +++ b/todo.md @@ -60,7 +60,7 @@ A hand-written question bank goes stale as the project grows and leaves everythi ### 85. Move larv-review's mechanical rules — the paired ruling's base and vote count, each pass's round count, the scoring run's trigger and the comprehension history's format — into one tested tool under `bin/`, so the skill says only when to run it and what each answer means. -2026-10-08, lilleman: next after the items that lower token use (73, 77, 78). Every comprehension run since PR #224 named `skills/larv-review/SKILL.md` §3 "Architecture" the hardest place, and PR #228's paired ruling ruled worse on rules a program should hold: the base's `git log` search and fallbacks, the vote arithmetic, a trigger written out three times, and the round count PR #225's seats said only prose enforces. PR #228's reviewers found about twenty edge cases in that text, among them squash against merge commits, entry order, a vote with no place, and a trigger judged before items are removed; tests can hold each, prose could not. Keep the skill's judgement calls in prose, and give the tool the history's format, so the base search does not hang on the wording of a line. The history's reader in `bin/metric_bench/places.py` moves into that tool, so the format has one reader. +2026-10-08, lilleman: next after the items that lower token use (73, 77, 78). Later that day lilleman rescored 73 below this item, and 77 moved to 0.2.0 to wait for data, so only 78 goes first. Every comprehension run since PR #224 named `skills/larv-review/SKILL.md` §3 "Architecture" the hardest place, and PR #228's paired ruling ruled worse on rules a program should hold: the base's `git log` search and fallbacks, the vote arithmetic, a trigger written out three times, and the round count PR #225's seats said only prose enforces. PR #228's reviewers found about twenty edge cases in that text, among them squash against merge commits, entry order, a vote with no place, and a trigger judged before items are removed; tests can hold each, prose could not. Keep the skill's judgement calls in prose, and give the tool the history's format, so the base search does not hang on the wording of a line. The history's reader in `bin/metric_bench/places.py` moves into that tool, so the format has one reader. ### 1. Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume. @@ -187,7 +187,7 @@ Today the folder is the SHA-256 of the transcript's first timestamped line, whic |---|---|---| | Cognitive complexity | 0.66 | 0.26 | | Length | 0.74 | 0.18 | -| Shared state | 0.50 | 0.06 | -| Change spread | 0.64 | 0.17 | +| Shared state | 0.50 | 0.10 | +| Change spread | 0.64 | 0.15 | AUC is 0.5 for a coin toss. Shared state cannot be judged here, since no unit in `bin/` writes state another method shares. Every run's first place was a section of `skills/larv-review/SKILL.md`, which no code metric sees. The rerun needs places from a project in Go or TypeScript, the languages most other projects use, so the bench first measures those languages, run through each project's own tooling. Function and file length stay warnings to look into, never limits: a plain long function can be simple, and a hard one may need five-line pieces.