diff --git a/bin/loop_claude/cycle/prompts.py b/bin/loop_claude/cycle/prompts.py index 259dd9d5..f9650627 100644 --- a/bin/loop_claude/cycle/prompts.py +++ b/bin/loop_claude/cycle/prompts.py @@ -1,8 +1,9 @@ -from model_routing.ladder import climbed, LADDER, position, review_rungs, REVIEWERS, reviewers_rung, ReviewKind, Rung +from model_routing.ladder import climbed, LADDER, position, review_rungs, reviewers_rung, ReviewKind, Rung from model_routing.route import ESCALATION_MARKER, HIGHEST_ESCAPE_AND_IMPACT, Route from loop_claude.routing import escalation_rungs from loop_claude.project.records import HUMAN_RULE_NAMES, RECORD_FILES from markdown_text import listed, quoted +from review_passes import REVIEWERS from claude_code.transcript import Typed # Where the judge may quote an answer from, named as the human and the worker see them; of README.md the judge sees only the premises. diff --git a/bin/model_routing/test_ladder.py b/bin/model_routing/test_ladder.py index cc5cbf34..e4382cf7 100644 --- a/bin/model_routing/test_ladder.py +++ b/bin/model_routing/test_ladder.py @@ -1,14 +1,14 @@ import pathlib import sys -import typing import unittest import unittest.mock sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from model_routing.ladder import highest, LADDER, lowest_worker_rung, planning_rung, position, project_rung, review_floor, review_rungs, ReviewedPass, REVIEWERS, Rung, stepped_up, worker_rung, WORKER_STEPS +from model_routing.ladder import highest, LADDER, lowest_worker_rung, planning_rung, position, project_rung, review_floor, review_rungs, Rung, stepped_up, worker_rung, WORKER_STEPS from model_routing import ladder from todo_table import LEVELS +from review_passes import REVIEWERS OPUS = Rung("claude-opus-5-5", "medium") @@ -105,11 +105,6 @@ class Ladder(unittest.TestCase): def test_keeps_the_seats_and_the_security_pass_on_the_projects_rung_whatever_the_worker_or_e_plus_i(self): self.assertEqual(review_rungs(OPUS, LADDER[-1], 8), {**dict.fromkeys(REVIEWERS, LADDER[-1]), "seat": OPUS, "security": OPUS}) - def test_names_every_kind_of_review_once_each_pass_with_its_agent_under_agents(self): - self.assertEqual(list(REVIEWERS), list(typing.get_args(ReviewedPass))) - agents = pathlib.Path(__file__).resolve().parents[2] / "agents" - self.assertEqual(sorted(REVIEWERS.values()), sorted(path.stem for path in agents.glob("*.md"))) - def test_runs_a_replayed_pass_on_its_replays_rung_below_the_workers_where_the_e_plus_i_steps_no_review_up_and_the_worker_runs_no_higher_than_the_project(self): sonnet, haiku, opus_high = Rung("claude-sonnet-5-5", "high"), LADDER[0], Rung("claude-opus-5-5", "high") with unittest.mock.patch.dict(ladder.REPLAYED, {("prose", "claude-opus-5-5"): haiku, ("stability", "claude-sonnet-5-5"): haiku}): diff --git a/bin/repo_checks/test_reviewer_launches.py b/bin/repo_checks/test_reviewer_launches.py index 5e53652a..ae94e804 100644 --- a/bin/repo_checks/test_reviewer_launches.py +++ b/bin/repo_checks/test_reviewer_launches.py @@ -5,16 +5,13 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from review_passes import PASSES -from model_routing.ladder import REVIEWERS +from review_passes import PASS_AGENTS, PASSES from repo_checks.test_python_floor import ROOT from rule_hook.reviewer_rung import SEAT, SECURITY_OPENER OPENING = re.compile(r"^## Opening\n+```\n([^\n]+?\.)(?: |\n)", re.MULTILINE) -# A row of the pass table: its pass. -PASS_ROW = re.compile(r"^\| (?!Pass \|)([A-Z][a-z-]+(?: [a-z]+)?) \|", re.MULTILINE) -# A row of the pass table whose reviewer is an agent: its pass and that agent. -REVIEWED_ROW = re.compile(r"^\| ([A-Z][a-z-]+) \| ([a-z]+(?:-[a-z]+)*-(?:reviewer|architect|auditor)) \|", re.MULTILINE) +# A row of the pass table: its pass and its reviewer cell. +PASS_ROW = re.compile(r"^\| (?!Pass \|)([A-Z][a-z -]+?) \| ([^|]+?) \|", re.MULTILINE) LARV_REVIEW = (ROOT / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8") PASS_TABLE = LARV_REVIEW.split("## 3. Passes", 1)[1].split("A comment is prose", 1)[0] @@ -22,12 +19,12 @@ PASS_TABLE = LARV_REVIEW.split("## 3. Passes", 1)[1].split("A comment is prose", class ReviewerLaunches(unittest.TestCase): """rule-hook holds a review launch to its rung by recognising it, and `larv-review round-count` counts the passes by name; these fail when what they recognise drifts from what the skills launch.""" - def test_the_passes_are_the_ones_larv_review_s_pass_table_names_in_its_order(self): - self.assertEqual([name.lower() for name in PASS_ROW.findall(PASS_TABLE)], list(PASSES)) - - def test_the_reviewers_are_the_passes_and_agents_larv_review_s_pass_table_names_in_its_order(self): - self.assertEqual({name.lower(): agent for name, agent in REVIEWED_ROW.findall(PASS_TABLE)}, REVIEWERS) - self.assertEqual([name.lower() for name, _ in REVIEWED_ROW.findall(PASS_TABLE)], list(REVIEWERS)) + def test_the_passes_and_their_agents_are_the_ones_larv_review_s_pass_table_names_in_its_order(self): + rows = [(name.lower(), reviewer) for name, reviewer in PASS_ROW.findall(PASS_TABLE)] + self.assertEqual([name for name, _ in rows], list(PASSES)) + for name, reviewer in rows: + with self.subTest(name=name): + self.assertEqual(reviewer == PASS_AGENTS[name], PASS_AGENTS[name] is not None) def test_the_seat_opening_is_the_sentence_that_opens_every_seat_prompt(self): opening = OPENING.search((ROOT / "skills" / "comprehension-panel" / "seat-prompts.md").read_text(encoding="utf-8")) diff --git a/bin/review_passes.py b/bin/review_passes.py index 3c2f8a28..0bb4ce29 100644 --- a/bin/review_passes.py +++ b/bin/review_passes.py @@ -1,7 +1,7 @@ """The passes of larv-review, as skills/larv-review/SKILL.md → "Passes" lists them.""" import typing -# A pass an agent under agents/ reviews, in lower case. A Literal cannot be built from `PASS_AGENTS`, so test_ladder holds the two together. +# A pass an agent under agents/ reviews, in lower case. A Literal cannot be built from `PASS_AGENTS`, so test_review_passes holds the two together. ReviewedPass = typing.Literal["architecture", "principles", "overrides", "stability", "product-owner", "prose"] # Each pass in the order of SKILL.md's pass table, and the agent under agents/ that reviews it; None where a skill or plugin does. The auto-reviewer is left out: larv-review counts its rounds from its reviews on the PR, not from commit titles. PASS_AGENTS: dict[str, str | None] = {"architecture": "systems-architect", "principles": "principles-auditor", "full scan": None, "security": None, "overrides": "override-reviewer", "stability": "stability-reviewer", "product-owner": "product-owner-reviewer", "prose": "prose-reviewer"} @@ -12,5 +12,5 @@ def _reviewed(name: str) -> typing.TypeGuard[ReviewedPass]: return name in typing.get_args(ReviewedPass) -# The passes that have an agent. A pass missing from `ReviewedPass` drops out of it, which test_ladder fails on. +# The passes that have an agent. A pass missing from `ReviewedPass` drops out of it, which test_review_passes fails on. REVIEWERS: dict[ReviewedPass, str] = {name: agent for name, agent in PASS_AGENTS.items() if agent and _reviewed(name)} diff --git a/bin/review_replay/main.py b/bin/review_replay/main.py index 961c3cf6..eb6ccd22 100644 --- a/bin/review_replay/main.py +++ b/bin/review_replay/main.py @@ -47,9 +47,10 @@ from loop_claude.effects import Effects from failure import Failure from rung_replay.search import first_reply, replayed from claude_code.transcript import first_timestamped_line, read_transcript -from model_routing.ladder import LADDER, project_rung, ReviewedPass, REVIEWERS, Rung +from model_routing.ladder import LADDER, project_rung, Rung from claude_code.entries import parse_entry, structured_output from review_folder import REPORTS, review_folder +from review_passes import ReviewedPass, REVIEWERS TOOL = "review-replay" USAGE = f"{TOOL} , one of {', '.join(REVIEWERS)} and a model on the routing ladder" diff --git a/bin/review_replay/test_review_replay.py b/bin/review_replay/test_review_replay.py index 3bc26f96..d73b85b8 100644 --- a/bin/review_replay/test_review_replay.py +++ b/bin/review_replay/test_review_replay.py @@ -19,7 +19,8 @@ from loop_claude.effects import Effects, system_effects from failure import Failure from review_replay import main from rung_replay.search import Miss, Replay, Tried -from model_routing.ladder import REVIEWERS, Rung +from review_passes import REVIEWERS +from model_routing.ladder import Rung TOOL = pathlib.Path(__file__).resolve().parents[1] / "review-replay" REFERENCE = Rung("claude-opus-5-5", "medium") diff --git a/bin/rule_hook/reviewer_rung.py b/bin/rule_hook/reviewer_rung.py index 7d0f9a48..49c4023a 100644 --- a/bin/rule_hook/reviewer_rung.py +++ b/bin/rule_hook/reviewer_rung.py @@ -4,7 +4,8 @@ import typing from rule_hook.rules import Breach from rule_hook.call import Call, text from model_routing.worker_rungs import handed -from model_routing.ladder import position, review_rungs, REVIEWERS, ReviewKind, Rung +from model_routing.ladder import position, review_rungs, ReviewKind, Rung +from review_passes import REVIEWERS # The pass each agent under agents/ reviews. PASS_OF = {agent: kind for kind, agent in REVIEWERS.items()} diff --git a/bin/test_review_passes.py b/bin/test_review_passes.py new file mode 100644 index 00000000..f6ecac93 --- /dev/null +++ b/bin/test_review_passes.py @@ -0,0 +1,18 @@ +import pathlib +import sys +import typing +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)) + +from review_passes import PASS_AGENTS, PASSES, ReviewedPass, REVIEWERS + + +class ReviewPasses(unittest.TestCase): + def test_names_each_pass_that_has_an_agent_once_in_the_literal_and_in_the_list(self): + self.assertEqual(list(REVIEWERS), list(typing.get_args(ReviewedPass))) + self.assertEqual(list(REVIEWERS), [name for name in PASSES if PASS_AGENTS[name]]) + + def test_names_each_agent_under_agents(self): + agents = pathlib.Path(__file__).resolve().parents[1] / "agents" + self.assertEqual(sorted(REVIEWERS.values()), sorted(path.stem for path in agents.glob("*.md"))) diff --git a/todo.md b/todo.md index 5c851038..e6635dc9 100644 --- a/todo.md +++ b/todo.md @@ -6,7 +6,7 @@ `Bar = 0.1` -`Next ID = 216` +`Next ID = 217` ## Items @@ -21,6 +21,7 @@ | 210 | 0.4.0 | | | **Hold the escalation mark in one module that states that one trigger buys one step, so a reader changes it without opening four files.** | 3 | 2 | 3 | 6 | 5 | code health by 9 | 16.2 | | 190 | 0.4.0 | | | **Rewrite the `docs/decisions.md` entries `todo.md: one table …`, `loop-claude: a judge decides …` and `loop-claude: before it opens claude …` as the current state, so a reader no longer replays superseded paragraphs to learn what holds.** | 2 | 2 | 1 | 3 | 3 | code health by 3, 1.4 by 2 | 15.5 | | 82 | 0.4.0 | | principle | **Sort `AGENTS.md`'s decision titles and `docs/decisions.md`'s entries by title.** | 2 | 2 | 1 | 3 | 4 | code health by 4, 1.4 by 4 | 14.6 | +| 216 | 0.4.0 | | | **Make larv-review's round count agree with itself on the auto-reviewer: either title its round commits so `round-count` counts them as a pass, or have SKILL.md say they carry no `Answer round` title.** | 1 | 2 | 3 | 4 | 2 | code health by 2 | 12.0 | | 170 | 0.4.0 | | decision | **Re-tune `WORKER_STEPS` and `REVIEW_STEPS` once 10 chunks have shipped under them, from how well L, E and I order their review rounds and 🔴 findings.** | 2 | 2 | 3 | 5 | 2 | 1.1 by 3, 1.4 by 5 | 10.9 | | 125 | 0.4.0 | | decision | **Give "record", "outcome" and "places" one meaning each across `bin/`, and rename `bin/larv_review/git.py` by what it holds.** | 3 | 1 | 3 | 5 | 5 | code health by 5, 1.4 by 3 | 10.2 | | 198 | 0.4.0 | | decision | **Count, per finished chunk, the findings that arose from misreading code that had already shipped, so code health's counter-signal shows.** | 3 | 2 | 2 | 5 | 5 | code health by 3, 1.1 by 2 | 6.2 | @@ -112,6 +113,10 @@ Found by the prose review of PR #312, which judged both entries to read as amend "Deterministic order", in `principles/technical-principles.md`, raised by the principles audit of PR #224: their order carries no meaning, so two chunks adding a decision conflict at the end, and a reader cannot find a title by scanning. +### 216. Make larv-review's round count agree with itself on the auto-reviewer: either title its round commits so `round-count` counts them as a pass, or have SKILL.md say they carry no `Answer round` title. + +`skills/larv-review/SKILL.md` §3 "Round cap" makes the external auto-reviewer a pass of its own and each review it posts a round, and says each round closes with a commit titled `Answer round : 🔴, 🟡; …`. It also says the auto-reviewer's count is the number of its reviews on the PR. `larv-review round-count` (`bin/larv_review/main.py` `round_count`) answers an `Answer auto-reviewer round :` commit with "auto-reviewer: , not a pass: check the commit title", because `bin/review_passes.py` `PASSES`, the list `bin/test_reviewer_launches` holds SKILL.md's table to, leaves it out on purpose. A worker who follows the skill therefore gets a warning. Found by round 2 of PR #354's principles pass (item 121). The comprehension seats named `PASSES` hard to read: the pass list lives in four places kept in sync by hand. Make `PASSES` easier to read where the change touches it. + ### 170. Re-tune `WORKER_STEPS` and `REVIEW_STEPS` once 10 chunks have shipped under them, from how well L, E and I order their review rounds and 🔴 findings. `docs/decisions.md` → `routing: one ladder…` calls the steps lilleman approved on 2026-10-16 a first guess. Once 10 chunks that each shipped one item scored with L, E and I have merged, read `score-outcomes`' rank correlations for L, E and I and the routed-chunks table of `routing-figures.md`, and propose new steps to lilleman, whose call they are. Only chunks merged since PR #339 set today's steps count: 7 so far, those of items 117, 126, 131, 122, 207, 130 and 154. Start this item when there are 10.