From b346a3572e70896044b8c5d52b237574bd691ca2 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 9 Oct 2026 14:49:34 +0200 Subject: [PATCH] Answer architecture round 2: keep the judge's rules beside its verdicts, name record_ruling's steps, file HistoryChange with the history, give read_utf8 its own module, count a mis-cased round title, and repair the tracked_places docstring --- bin/comprehension_history.py | 10 +++- bin/larv_review/git.py | 3 +- bin/larv_review/main.py | 57 ++++++++++---------- bin/larv_review/rounds.py | 7 +-- bin/larv_review/ruling.py | 9 +++- bin/larv_review/ruling_base.py | 12 +---- bin/larv_review/test_larv_review.py | 7 ++- bin/loop_claude/cycle/judge.py | 34 +++++++++++- bin/loop_claude/cycle/prompts.py | 31 ----------- bin/loop_claude/project/checkout.py | 10 ---- bin/loop_claude/project/premises.py | 2 +- bin/loop_claude/project/records.py | 2 +- bin/loop_claude/project/text_file.py | 13 +++++ bin/loop_claude/test_loop_claude.py | 12 ++--- bin/metric_bench/bench.py | 2 +- bin/repo_checks/test_citations.py | 6 ++- docs/comprehension-history.md | 81 ++++++++++++++++++++++++++++ 17 files changed, 197 insertions(+), 101 deletions(-) create mode 100644 bin/loop_claude/project/text_file.py diff --git a/bin/comprehension_history.py b/bin/comprehension_history.py index 3fa8ead2..a9297da2 100644 --- a/bin/comprehension_history.py +++ b/bin/comprehension_history.py @@ -55,6 +55,14 @@ class Entry: return self.against is not None +@dataclasses.dataclass(frozen=True) +class HistoryChange: + """A merged change on the default branch that touched the history, and the history before and after it.""" + commit: str + before: str + after: str + + @dataclasses.dataclass(frozen=True) class Heading: title: str @@ -109,7 +117,7 @@ def seat_places(body: str, labels: re.Pattern[str]) -> list[Place]: listing = True elif listing and line.startswith("- "): places += bullet_places(line) - elif not line.startswith(" "): + elif line and not line.startswith(" "): listing = False return places diff --git a/bin/larv_review/git.py b/bin/larv_review/git.py index 322b539e..ef16ce64 100644 --- a/bin/larv_review/git.py +++ b/bin/larv_review/git.py @@ -2,8 +2,7 @@ import re import subprocess from failure import Failure -from comprehension_history import HISTORY -from larv_review.ruling_base import HistoryChange +from comprehension_history import HISTORY, HistoryChange def git(*args: str) -> str | Failure: diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index c7ecb91b..ac449e94 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -20,7 +20,7 @@ one change against its first parent. With none, the base is the one the history' ruling names; with no ruling either, it is the merge base of HEAD and the default branch. round-count prints each pass's count: the highest among the titles opening `Answer round -:` of commits the default branch does not hold. It marks each pass at the cap of {cap} rounds, +:`, in any case, of commits the default branch does not hold. It marks each pass at the cap of {cap} rounds, and each name in such a title that is not a pass. It only reports: larv-review asks the human in place of a further round. @@ -90,7 +90,7 @@ from comprehension_history import appended, DIMENSIONS, heading, Heading, HISTOR from larv_review.ruling_base import base from larv_review.rounds import CAP, PASSES, round_counts from larv_review.git import commit_exists, default_branch, file_at, git, history_changes, landed_since_release, top -from larv_review.ruling import counted, fallen, ruling, split, votes +from larv_review.ruling import counted, fallen, overall, ruling, split, votes from failure import Failure from larv_review.scoring import fall_ruling, FLOOR, means, under_floor from todo_table import items, ITEMS_HEADER @@ -107,7 +107,7 @@ def main(argv: list[str]) -> int: return 0 command, *given = argv or [""] if command == "ruling-base" and not given: - done = with_default_branch(ruling_base, stale_ok=False) + done = with_default_branch(show_ruling_base, stale_ok=False) elif command == "round-count" and not given: done = with_default_branch(round_count, stale_ok=True) elif command == "needs-scoring-run" and all(re.fullmatch(r"[0-9]+", id_) for id_ in given): @@ -142,7 +142,7 @@ def with_default_branch(command: typing.Callable[[str], Failure | None], stale_o return command(branch) -def ruling_base(default: str) -> Failure | None: +def show_ruling_base(default: str) -> Failure | None: changes = history_changes(default) if isinstance(changes, Failure): return changes @@ -205,34 +205,35 @@ def record_ruling(votes_file: pathlib.Path, scores_file: pathlib.Path | None = N read = read_seats(votes_file, paired=True) if isinstance(read, Failure): return read - named, given = read - said = votes(given.seats) - if isinstance(said, Failure): - return said - count = counted(given.seats, said) - tally = ", ".join(f"{seat.name} {vote_text(DIMENSIONS[-1], said[seat.name][-1], count[seat.name][-1])}" for seat in given.seats) - overall = [each[-1] for each in count.values()] - if split(overall): + heading_read, seats_read = read + written = votes(seats_read.seats) + if isinstance(written, Failure): + return written + counts = counted(seats_read.seats, written) + tally = ", ".join(f"{seat.name} {vote_text(DIMENSIONS[-1], overall(written[seat.name]), overall(counts[seat.name]))}" for seat in seats_read.seats) + overall_votes = [overall(each) for each in counts.values()] + if split(overall_votes): print(f"Split: {tally}. Launch the maintainability senior and Junior A together, add their lines to the votes file, and run this again.") return None - ruled = ruling(overall) - fell = fallen(count) if ruled != "worse" else [] - if fell and not scores_file: - print(f"Fell: {', '.join(fell)}, in a {ruled} ruling. Launch the four scoring seats on {named.label} at {named.commit}, write their lines to a scores file, and run this again with both files.") + ruled = ruling(overall_votes) + fell = fallen(counts) if ruled != "worse" else [] + if not fell: + if scores_file: + return Failure(f"no dimension fell in this {ruled} ruling, so it takes no scores file") + return recorded_ruling(heading_read, seats_read, written, counts, ruled, tally, [], None) + if not scores_file: + print(f"Fell: {', '.join(fell)}, in a {ruled} ruling. Launch the four scoring seats on {heading_read.label} at {heading_read.commit}, write their lines to a scores file, and run this again with both files.") return None - if scores_file and not fell: - return Failure(f"no dimension fell in this {ruled} ruling, so it takes no scores file") - scoring = None - notes = [] - if scores_file: - scored = read_fall_scores(scores_file, named) - if isinstance(scored, Failure): - return scored - scoring = scored - ruled, why = fall_ruling(ruled, fell, scoring.means) - notes = [why] + scoring = read_fall_scores(scores_file, heading_read) + if isinstance(scoring, Failure): + return scoring + ruled, why = fall_ruling(ruled, fell, scoring.means) + return recorded_ruling(heading_read, seats_read, written, counts, ruled, tally, [why], scoring) + + +def recorded_ruling(heading_read: Heading, seats_read: SeatsFile, written: dict[str, list[str]], counts: dict[str, list[str]], ruled: str, tally: str, notes: list[str], scoring: ScoringRun | None) -> Failure | None: print(f"Ruling: {ruled}. {' '.join(notes + [f'Overall votes as counted: {tally}.'])}") - return append(given.read, ruling_entry(named.title, given.seats, said, count, ruled, notes, scoring)) + return append(seats_read.read, ruling_entry(heading_read.title, seats_read.seats, written, counts, ruled, notes, scoring)) def record_scoring(default: str, scores_file: pathlib.Path, ids: list[int]) -> Failure | None: diff --git a/bin/larv_review/rounds.py b/bin/larv_review/rounds.py index c6d19393..2b68873b 100644 --- a/bin/larv_review/rounds.py +++ b/bin/larv_review/rounds.py @@ -2,13 +2,14 @@ import re CAP = 3 PASSES = ("architecture", "full scan", "security", "stability", "product-owner", "prose") -ROUND = re.compile(r"^Answer (.+?) round ([0-9]+):") +ROUND = re.compile(r"^Answer (.+?) round ([0-9]+):", re.IGNORECASE) def round_counts(titles: list[str]) -> dict[str, int]: - """Each pass's highest round among the branch's `Answer round :` commit titles; a pass with none has 0, and a title naming no known pass adds its name.""" + """Each pass's highest round among the branch's `Answer round :` commit titles; a pass with none has 0, and a title naming no known pass adds its name. Case is ignored, so a mis-cased title still counts.""" counts = dict.fromkeys(PASSES, 0) for title in titles: if named := ROUND.match(title): - counts[named.group(1)] = max(counts.get(named.group(1), 0), int(named.group(2))) + name = named.group(1).lower() + counts[name] = max(counts.get(name, 0), int(named.group(2))) return counts diff --git a/bin/larv_review/ruling.py b/bin/larv_review/ruling.py index 28cc9134..eb21b881 100644 --- a/bin/larv_review/ruling.py +++ b/bin/larv_review/ruling.py @@ -18,12 +18,17 @@ def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure: if unnamed := [place for place in seat.places if not place_dimensions(place)]: return Failure(f"{seat.name}'s place does not open with the dimensions it moves, each one of {', '.join(DIMENSIONS)}, then `: `: {unnamed[0]}") said[seat.name] = line - first, second, *more = (each[-1] for each in counted(seats, said).values()) - if more and first == second: + first, second, *more = (overall(each) for each in counted(seats, said).values()) + if more and not split([first, second]): return Failure(f"{' and '.join(FIRST_SEATS)} both count as {first} overall, which settles the ruling; drop the other seats' lines") return said +def overall(votes: list[str]) -> str: + """The overall vote, which DIMENSIONS lists last.""" + return votes[-1] + + def counted(seats: list[Seat], said: dict[str, list[str]]) -> dict[str, list[str]]: """Each seat's votes as they count: a dimension's vote counts as same unless one of the seat's `path:line` places opens with that dimension, and the overall vote unless the seat names any such place.""" return {seat.name: [vote if names_a_place(seat, name) else "same" for name, vote in zip(DIMENSIONS, said[seat.name])] for seat in seats} diff --git a/bin/larv_review/ruling_base.py b/bin/larv_review/ruling_base.py index 5026d16e..5bf5e30e 100644 --- a/bin/larv_review/ruling_base.py +++ b/bin/larv_review/ruling_base.py @@ -1,14 +1,4 @@ -import dataclasses - -from comprehension_history import entries, Entry - - -@dataclasses.dataclass(frozen=True) -class HistoryChange: - """A merged change on the default branch that touched the history, and the history before and after it.""" - commit: str - before: str - after: str +from comprehension_history import entries, Entry, HistoryChange def measured_commit(changes: list[HistoryChange]) -> str | None: diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index e7c3798f..839d10f7 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -9,8 +9,8 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from comprehension_history import appended, entries, Place, recorded, ruling_entry, ScoringRun, Seat -from larv_review.ruling_base import base, first_ruling, HistoryChange, measured_commit +from comprehension_history import appended, entries, HistoryChange, Place, recorded, ruling_entry, ScoringRun, Seat +from larv_review.ruling_base import base, first_ruling, measured_commit from larv_review.ruling import counted, fallen, ruling, split, votes from failure import Failure from larv_review.scoring import fall_ruling, means, under_floor @@ -169,6 +169,9 @@ class Rounds(unittest.TestCase): counts = round_counts(["Answer prose round 1: x", "Answer full scan round 2: y", "Answer full scan round 1: z", "Answer stability: no round", "Answer stabilty round 1: typo", "Answer security round 1: rename round 2: x", "Rescore: w"]) self.assertEqual((counts["prose"], counts["full scan"], counts["stability"], counts["architecture"], counts["stabilty"], counts["security"]), (1, 2, 0, 0, 1, 1)) + def test_counts_a_mis_cased_title_under_its_pass(self): + self.assertEqual(round_counts(["Answer Architecture round 4: x", "Answer architecture round 3: y"])["architecture"], 4) + class ScoringRunDue(unittest.TestCase): def test_reads_each_rows_id_release_and_tagline(self): diff --git a/bin/loop_claude/cycle/judge.py b/bin/loop_claude/cycle/judge.py index 5d1089aa..814ba085 100644 --- a/bin/loop_claude/cycle/judge.py +++ b/bin/loop_claude/cycle/judge.py @@ -3,15 +3,47 @@ import json import re import typing +from loop_claude.cycle.prompts import ANSWER_DESTINATIONS, ANSWERS_RECORDED from loop_claude.effects import Effects from failure import Failure from claude_code.entries import hit_limit, limit_said, parse_entry, structured_output -from loop_claude.cycle.prompts import JUDGE_RULES +from loop_claude.project.records import HUMAN_RULES from loop_claude.cycle.retry import Limited, retried from loop_claude.stop import Stop # At 3 to 4 characters a token, 100,000 to 133,000 tokens, which leaves a 200,000-token context room for the reply; the largest session rendered here was 364,000 characters on 2026-10-03. JUDGE_PROMPT_CHARS = 400000 +JUDGE_RULES = ( + "Decide whether the human must now be interrupted. interrupt=true when any of these appear:\n" + "- the agent asks the human anything, seeks approval, or says a decision is the human's, and neither " + "README.md nor the records settle the matter\n" + "- it asks again a question a [loop] line already answered\n" + "- it carried on under an assumption that decides the deliverable, that the human could " + "reasonably reject and that neither README.md nor the records settle; a caveat about " + "transient state it then handled is not one\n" + "- it is blocked on something only the human can supply: a credential, a version bump, a choice " + "outside the repo, or a release ready to cut, which only the human may publish\n" + "- it flags that the goals, the plan in todo.md or the task itself is unclear, missing or in need of change\n" + "- it chose between alternatives that neither README.md nor the records discriminate " + "between - neither rules the rejected one out - and the choice materially changes the deliverable\n" + "interrupt=false otherwise. Bookkeeping the agent settled silently - what to document, wording, " + "where a note goes - is not on its own a reason to interrupt. The human may have replied inside the transcript, on a [human] line: judge only what " + "is still open, never a question they already answered there. A [loop] line is what loop-claude told " + "the agent, such as an answer quoted from README.md or the records.\n" + "Where the agent asked or flagged something itself, the question is that one, in the agent's own " + "wording; never construct another from facts it stated.\n" + "Where README.md or the records answer the agent's own question and no [loop] line has " + "quoted that answer yet, set interrupt=false and quote the passage that answers it; the agent is " + "then given that passage in place of the human's reply. An interrupt outranks a quoted answer, and either " + "outranks finished.\n" + "The chunk is the piece of work the agent is on, shipped as one pull request. " + "finished=true when the chunk is complete: merged, or nothing remains that the agent could do on " + f"its own. Even then, it is finished only once {ANSWERS_RECORDED}. An answer counts as recorded " + f"where README.md or the records above hold it, {HUMAN_RULES} included. It also counts where " + f"the transcript shows the agent writing it into {ANSWER_DESTINATIONS}; writing it into " + f"{HUMAN_RULES} does not count. finished=false when work remains that a further run can " + "continue: an open PR, a review not yet run, CI not yet reported, an answer not yet recorded." +) @dataclasses.dataclass(frozen=True) diff --git a/bin/loop_claude/cycle/prompts.py b/bin/loop_claude/cycle/prompts.py index fa277eab..14859400 100644 --- a/bin/loop_claude/cycle/prompts.py +++ b/bin/loop_claude/cycle/prompts.py @@ -5,37 +5,6 @@ QUOTE_SOURCES = "README.md's Goals and Audience, " + ", ".join(RECORD_FILES) + " # Where the worker may write an answer the human typed, so it counts as recorded. ANSWER_DESTINATIONS = "README.md's Goals or Audience, " + ", ".join(RECORD_FILES) + ", todo.md or a comment" ANSWERS_RECORDED = f"every answer the human typed in it that a later chunk could need is recorded in {ANSWER_DESTINATIONS} at the one place it governs" -JUDGE_RULES = ( - "Decide whether the human must now be interrupted. interrupt=true when any of these appear:\n" - "- the agent asks the human anything, seeks approval, or says a decision is the human's, and neither " - "README.md nor the records settle the matter\n" - "- it asks again a question a [loop] line already answered\n" - "- it carried on under an assumption that decides the deliverable, that the human could " - "reasonably reject and that neither README.md nor the records settle; a caveat about " - "transient state it then handled is not one\n" - "- it is blocked on something only the human can supply: a credential, a version bump, a choice " - "outside the repo, or a release ready to cut, which only the human may publish\n" - "- it flags that the goals, the plan in todo.md or the task itself is unclear, missing or in need of change\n" - "- it chose between alternatives that neither README.md nor the records discriminate " - "between - neither rules the rejected one out - and the choice materially changes the deliverable\n" - "interrupt=false otherwise. Bookkeeping the agent settled silently - what to document, wording, " - "where a note goes - is not on its own a reason to interrupt. The human may have replied inside the transcript, on a [human] line: judge only what " - "is still open, never a question they already answered there. A [loop] line is what loop-claude told " - "the agent, such as an answer quoted from README.md or the records.\n" - "Where the agent asked or flagged something itself, the question is that one, in the agent's own " - "wording; never construct another from facts it stated.\n" - "Where README.md or the records answer the agent's own question and no [loop] line has " - "quoted that answer yet, set interrupt=false and quote the passage that answers it; the agent is " - "then given that passage in place of the human's reply. An interrupt outranks a quoted answer, and either " - "outranks finished.\n" - "The chunk is the piece of work the agent is on, shipped as one pull request. " - "finished=true when the chunk is complete: merged, or nothing remains that the agent could do on " - f"its own. Even then, it is finished only once {ANSWERS_RECORDED}. An answer counts as recorded " - f"where README.md or the records above hold it, {HUMAN_RULES} included. It also counts where " - f"the transcript shows the agent writing it into {ANSWER_DESTINATIONS}; writing it into " - f"{HUMAN_RULES} does not count. finished=false when work remains that a further run can " - "continue: an open PR, a review not yet run, CI not yet reported, an answer not yet recorded." -) def fresh(task: str) -> str: diff --git a/bin/loop_claude/project/checkout.py b/bin/loop_claude/project/checkout.py index dc6b4811..b9b698b4 100644 --- a/bin/loop_claude/project/checkout.py +++ b/bin/loop_claude/project/checkout.py @@ -23,13 +23,3 @@ def worktrees(root: str, effects: Effects) -> list[str]: if listing.returncode == 0: found += [line.split(" ", 1)[1] for line in listing.stdout.splitlines() if line.startswith("worktree ")] return sorted(set(found)) - - -def read_utf8(folder: str, name: str, consequence: str) -> str | Stop: - try: - return pathlib.Path(folder, name).read_text(encoding="utf-8") - except OSError as failure: - return Stop(1, f"{name} in {folder}: {failure.strerror} - {consequence}.") - except UnicodeDecodeError as failure: - line = failure.object.count(b"\n", 0, failure.start) + 1 - return Stop(1, f"{name} in {folder} is not UTF-8 on line {line} - {consequence}.") diff --git a/bin/loop_claude/project/premises.py b/bin/loop_claude/project/premises.py index a824c825..a571227f 100644 --- a/bin/loop_claude/project/premises.py +++ b/bin/loop_claude/project/premises.py @@ -1,4 +1,4 @@ -from loop_claude.project.checkout import read_utf8 +from loop_claude.project.text_file import read_utf8 from markdown_sections import sections from loop_claude.stop import Stop diff --git a/bin/loop_claude/project/records.py b/bin/loop_claude/project/records.py index 395a9210..ad97e5f0 100644 --- a/bin/loop_claude/project/records.py +++ b/bin/loop_claude/project/records.py @@ -1,6 +1,6 @@ import pathlib -from loop_claude.project.checkout import read_utf8 +from loop_claude.project.text_file import read_utf8 from loop_claude.stop import Stop # The records: these project files and HUMAN_RULES; the judge reads them beside the README's premises. diff --git a/bin/loop_claude/project/text_file.py b/bin/loop_claude/project/text_file.py new file mode 100644 index 00000000..83d7bc41 --- /dev/null +++ b/bin/loop_claude/project/text_file.py @@ -0,0 +1,13 @@ +import pathlib + +from loop_claude.stop import Stop + + +def read_utf8(folder: str, name: str, consequence: str) -> str | Stop: + try: + return pathlib.Path(folder, name).read_text(encoding="utf-8") + except OSError as failure: + return Stop(1, f"{name} in {folder}: {failure.strerror} - {consequence}.") + except UnicodeDecodeError as failure: + line = failure.object.count(b"\n", 0, failure.start) + 1 + return Stop(1, f"{name} in {folder} is not UTF-8 on line {line} - {consequence}.") diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index d2afc555..d9a3a7d4 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -244,10 +244,10 @@ class Cycles(unittest.TestCase): self.assertEqual(run.run_cycle(self.cycle(fake)), Unfinished("working")) self.assertEqual(self.archived_outcomes(), ["Task: Do it.\n\n2026-09-21T14:13:20Z Verdict: interrupt\n\nWhich one?\n\nEvidence:\n> working\n", "Task: Do it.\n\n2026-09-21T14:13:20Z Verdict: unfinished\n\nEvidence:\n> working\n"]) self.assertIn(str(self.session.id), fake.made("claude_on_terminal")[0]) - prompts = [stdin for args, stdin in fake.made("claude")] - self.assertEqual(len(prompts), 2) - self.assertNotIn("the second", prompts[0]) - self.assertIn("[human] the second", prompts[1]) + judge_prompts = [stdin for args, stdin in fake.made("claude")] + self.assertEqual(len(judge_prompts), 2) + self.assertNotIn("the second", judge_prompts[0]) + self.assertIn("[human] the second", judge_prompts[1]) def test_a_question_the_records_answer_resumes_the_worker_with_the_answer_three_times_a_cycle(self): answered = judged("quoted", answer="Use *A*.") @@ -519,14 +519,14 @@ class ExitContract(unittest.TestCase): ("loop/reload.py", "exec_if_edited", "1", "f'could not reload loop-claude:", "python cannot start for a reload"), ("project/checkout.py", "checkout_root", "1", "f'could not start git:", git), ("project/checkout.py", "checkout_root", "1", "found.stderr.strip()", git), - ("project/checkout.py", "read_utf8", "1", "f'{name} in {folder}:", unreadable), - ("project/checkout.py", "read_utf8", "1", "f'{name} in {folder} is not UTF-8", unreadable), ("project/model_choice.py", "get_or_ask_model", "1", "f'could not save the model in", models_), ("project/model_choice.py", "read_models_file", "1", 'f"could not read {saved}: {getattr(', models_), ("project/model_choice.py", "read_models_file", "1", "f'could not read {saved}: not an object", models_), ("project/premises.py", "read_premises", "1", "f'README.md has no ##", premises_), ("project/premises.py", "read_premises", "1", "f'README.md has ## {name} more than once", premises_), ("project/premises.py", "read_premises", "1", "f'README.md has nothing under", premises_), + ("project/text_file.py", "read_utf8", "1", "f'{name} in {folder}:", unreadable), + ("project/text_file.py", "read_utf8", "1", "f'{name} in {folder} is not UTF-8", unreadable), ] root = pathlib.Path(main.__file__).parents[1] found = [] diff --git a/bin/metric_bench/bench.py b/bin/metric_bench/bench.py index cc767369..93f86e65 100644 --- a/bin/metric_bench/bench.py +++ b/bin/metric_bench/bench.py @@ -85,7 +85,7 @@ def medians(runs: list[RunScores]) -> dict[str, Score]: def tracked_places(places: list[Place], tracked: list[str]) -> tuple[list[Place], list[Place]]: - """Entries written before paths were written from the repository's root shorten a path once they have named its folder: `cycle/run.py` after `bin/loop_claude/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one in the folder of the place tracked_places before it; a place naming no file, or several, is dropped. Returns the tracked_places places and the dropped ones.""" + """Entries written before paths were written from the repository's root shorten a path once they have named its folder: `cycle/run.py` after `bin/loop_claude/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one in the folder of the place resolved before it; a place naming no file, or several, is dropped. Returns the resolved places and the dropped ones.""" found = [] dropped = [] before = "" diff --git a/bin/repo_checks/test_citations.py b/bin/repo_checks/test_citations.py index 426ea9da..7df09d2e 100644 --- a/bin/repo_checks/test_citations.py +++ b/bin/repo_checks/test_citations.py @@ -1,9 +1,13 @@ import pathlib import re import subprocess +import sys import unittest -ROOT = pathlib.Path(__file__).resolve().parents[2] +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from repo_checks.test_python_floor import ROOT + CITATION = re.compile(r'`?CLAUDE\.md`? → ("[^"]+"(?:,? (?:and )?"[^"]+")*)') HEADING = re.compile(r"^#+ (.+?)(?: \(.*\))?$", re.MULTILINE) LEAD = re.compile(r"^(?:- )?\*\*(.+?)(?:\*\*|[:.](?=\*\*| )| —)", re.MULTILINE) diff --git a/docs/comprehension-history.md b/docs/comprehension-history.md index d14ec525..a82060a9 100644 --- a/docs/comprehension-history.md +++ b/docs/comprehension-history.md @@ -809,3 +809,84 @@ Inherited architect, would restructure first: - `bin/larv_review/base.py:1` the module: the ruling base, named like a base class - `bin/larv_review/scoring.py:6` imports: one tool imports another tool's internals from `bin/rank_todo.py` - `bin/loop_claude/loop/main.py:1` the docstring: restates constants it cannot keep true + +## 2026-10-09T12:46:51Z, PR #234 at dde06fc, against 2157f59 + +Ruling: better + +| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall | +|---|---|---|---|---|---| +| Mid A | better | better | better | better | better | +| Inherited architect | better | better | better | better | better | + +Mid A, decided by: + +- Navigation, Locality, Shape: `bin/transcript_archive/location.py:7` `project_archive`: the archive's location lives in one shared package, where reading-cost reached into loop-claude's internals +- Locality, Shape, Self-sufficiency: `bin/loop_claude/cycle/run.py:83` `worker_start`: `worker_args` builds only flags and each prompt is a named function in `bin/loop_claude/cycle/prompts.py:41` +- Locality, Self-sufficiency: `bin/transcript_archive/outcomes.py:10` `finished`: the outcomes format's writer and reader sit in one file +- Shape: `bin/larv_review/ruling.py:42` `split`: `ruling` no longer returns None for a split +- Shape, Locality: `bin/larv_review/main.py:204` `record_ruling`: two plain checks in place of `fall_step`'s strings; plan logic in `bin/larv_review/plan.py:5` +- Navigation: `README.md:77` "Tools": states the import root and the shared packages +- Self-sufficiency: `bin/comprehension_history.py:74` `entries`: a worked example of an entry above the parser +- Self-sufficiency, Shape: `bin/metric_bench/bench.py:88` `tracked_places`: the rename garbled the docstring +- Locality: `bin/loop_claude/cycle/prompts.py:60` `quoted`: duplicates `bin/transcript_archive/outcomes.py:31` `quoted` + +Inherited architect, decided by: + +- Navigation, Locality: `bin/transcript_archive/outcomes.py:10` `finished`: every outcome line and `FINISHED_AT` sit in one module +- Navigation, Locality: `bin/reading_cost/main.py:35` imports: reading-cost no longer reaches into loop-claude's internals +- Navigation, Self-sufficiency: `README.md:77` "Tools": the layout is stated +- Shape, Locality: `bin/todo_table.py:27` `items`: the table format is its own module, not a CLI script used as a library +- Shape: `bin/larv_review/plan.py:5` `scoring_run_due`: the plan trigger with its why, apart from the floor arithmetic +- Locality, Shape: `bin/larv_review/ruling.py:42` `split`: split, ruling and lead are separate +- Locality, Shape: `bin/loop_claude/cycle/prompts.py:41` `fresh`: every prompt text in one module +- Shape: `bin/comprehension_history.py:67` `ScoringRun`: one name no longer covers two concepts +- Self-sufficiency: `bin/larv_review/main.py:5` the help: defines the ratchet, the paired ruling and the scoring run first +- Locality: `bin/loop_claude/cycle/states.py:75` `transition`: the past-the-cap case has its own guard +- Shape: `bin/metric_bench/bench.py:87` `tracked_places`: the docstring reads worse after the rename + +## 2026-10-09T12:46:51Z, PR #234 at dde06fc + +| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall | +|---|---|---|---|---|---| +| Junior A | 7 | 6.5 | 6 | 6 | 6 | +| Mid A | 7.5 | 6.5 | 7 | 6.5 | 7 | +| Maintainability senior | 7 | 6.5 | 7 | 7 | 7 | +| Inherited architect | 7 | 6.5 | 6.5 | 7 | 7 | +| Mean | 7.13 | 6.50 | 6.63 | 6.63 | 6.75 | + +Junior A, hardest first: + +- `bin/larv_review/main.py:204` `record_ruling`: six outcomes, said against count, `[-1]` meaning Overall +- `bin/larv_review/ruling.py:8` `votes`: a parser that also enforces the seat-count rule +- `bin/larv_review/ruling_base.py:14` `measured_commit`: the docstring explains only after the code confused +- `bin/larv_review/plan.py:5` `scoring_run_due`: four ideas at once; `emptied` traced by hand +- `bin/metric_bench/bench.py:87` `tracked_places`: a garbled docstring +- `bin/loop_claude/cycle/states.py:69` `transition`: the quoted-answer cap across three files + +Mid A, hardest first: + +- `skills/larv-review/SKILL.md:55` "Round cap": four subsections pointing at each other +- `bin/larv_review/main.py:204` `record_ruling`: five outcomes; the duplicate check in two places +- `bin/loop_claude/cycle/judge.py:95` `run_judge`: many endings, two quote checks +- `bin/loop_claude/cycle/states.py:69` `transition`: the cap counter rides through three states +- `bin/larv_review/ruling_base.py:14` `measured_commit`: needs the history format and first-parent semantics +- `bin/reading_cost/measure.py:27` `measure`: string-compared timestamps and approximate shell parsing + +Maintainability senior, hardest first: + +- `bin/larv_review/main.py:204` `record_ruling`: five outcomes, competing local names +- `skills/larv-review/SKILL.md:55` "Round cap": a chain of cross-references +- `bin/comprehension_history.py:103` `seat_places`: depends unsaid on `sections` dropping blank lines +- `bin/larv_review/plan.py:5` `scoring_run_due`: four inputs; the rule restated in the help +- `bin/larv_review/ruling_base.py:14` `measured_commit`: why same is safe needs the skill +- `bin/metric_bench/bench.py:87` `tracked_places`: a garbled docstring + +Inherited architect, would restructure first: + +- `bin/larv_review/rounds.py:12` `round_counts`: the round cap lives in prose; a mis-cased title escapes the count +- `bin/loop_claude/cycle/judge.py:17` `Reply`: the judge contract spread over four files +- `bin/loop_claude/project/checkout.py:28` `read_utf8`: a generic reader under the checkout's name +- `bin/test_env.py:5` `isolated_env`: test support named like a test +- `bin/larv_review/git.py:6` imports: the git adapter depends on a domain type +- `bin/loop_claude/cycle/prompts.py:60` `quoted`: two copies, with `STAMP` and the git runner also duplicated