Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 76348eac2e | |||
| 8f8d340c09 | |||
| a4fc833b2b | |||
| 59a8fe9f45 | |||
| 74f3199df1 | |||
| d2ca49bf00 | |||
| e3a6ae0e42 | |||
| bad2f0c555 | |||
| d81da4d413 | |||
| 545a57f01c | |||
| 4ab80160b6 | |||
| 2fa7040006 | |||
| 18a73b1bf1 | |||
| 6156e0b9cc | |||
| 08d4be4bae | |||
| b2ddebce7a | |||
| a61afc567d | |||
| 1f31ebd8ac | |||
| b03bfab121 | |||
| 2294916343 | |||
| c010b12c5a | |||
| 6ff139f67c | |||
| 7b0e428eec | |||
| dd7e9b9929 | |||
| 02bde923e5 | |||
| 87ffd81d21 | |||
| 2770de2744 | |||
| 058f4ca7aa | |||
| d55b1e4ad5 | |||
| 4fc822c346 | |||
| cbe99537e2 |
@@ -149,6 +149,9 @@
|
||||
!skills/larv-review/*.md
|
||||
!skills/larv-review/standards/
|
||||
!skills/larv-review/standards/*.md
|
||||
!stability-skip-count/
|
||||
!stability-skip-count/README.md
|
||||
!stability-skip-count/count.py
|
||||
!workflow-bench/
|
||||
!workflow-bench/advisor-judge-prompt.md
|
||||
!workflow-bench/advisor-run-prompt.md
|
||||
|
||||
+3
-1
@@ -2,6 +2,8 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- larv-review skips stability round 2 where round 1 reported a 🔴 and every 🔴 and 🟡 asked only that a named mutant be killed or a named failing test pass, once the tests and the mutation command run clean on the fixes.
|
||||
- `review-replay` now qualifies a rung whose share of a pass's archived findings is no more than 10 points below the mean of two replays on the project's rung, over at least 8 rounds, where it misses no 🔴 that both found. It used to demand every finding the project's rung found again, which the project's rung itself failed. It tries the project's model at each lower effort first, then the ladder below. Its run on the prose pass of Opus 5.5 projects qualified no rung: Opus 5.5 at low effort found 49% against a bar of 66%.
|
||||
- loop-claude records beside each verdict, interrupt and quoted answer the claude-config release and commit that ran it, the tokens the worker, each subagent and the judge spent, by model and kind, with the list prices in force, and any typed answer of yours the judge quotes as reversing a choice the worker took on its own recommendation; `score-outcomes` counts those reversals per finished chunk.
|
||||
- `larv-review prepare-scoring` makes a scoring run's worktree and writes each seat's prompt; `record-scoring` removes both once it has recorded the run.
|
||||
- `deploy-release` moves a checkout whose `settings.json` differs from the release only by a `/model` pick or the key order Claude Code writes, and then says to pick the model again.
|
||||
@@ -11,7 +13,7 @@
|
||||
- `bin/run-tests` runs this repo's test suite as README.md → Test says, prints each failing test with its error and pytest's summary line, and saves the whole log to a file whose path it prints.
|
||||
- `command-patterns [<version>] --calls <file>` saves each Bash call of the release's chunks as a JSON line, with its chunk, pattern, seconds, sizes and text.
|
||||
- `todo-item show <ID>` prints an item's table row and detail from `todo.md`.
|
||||
- A reviewer under `agents/` can start without `CLAUDE.md`: `omitClaudeMd: true` in its frontmatter drops the file, a `SubagentStart` hook hands it the "Shared goal", "Prose" and "Vocabulary" sections, and `larv-review reviewer-header` names the project's principles file. `review-replay <pass> <model> --omit-claude-md` tests whether a pass's reviewer finds as much without it; principles-auditor is the first to pass.
|
||||
- A reviewer under `agents/` can start without `CLAUDE.md`: `omitClaudeMd: true` in its frontmatter drops the file, a `SubagentStart` hook hands it the "Shared goal", "Prose" and "Vocabulary" sections, and `larv-review reviewer-header` names the project's principles file. `review-replay <pass> <model> --omit-claude-md` replays each round three times unchanged and once without `CLAUDE.md`, and a reviewer passes where it missed no more findings without the file than an unchanged replay missed. Five of the six reviewers pass and start without it: principles-auditor, stability-reviewer, prose-reviewer, product-owner-reviewer and systems-architect.
|
||||
- Add `workflow-bench/advisor_bench.py`, a bench of the advisor tool on six archived L 1 and L 2 chunks. Sonnet 5.5 alone passed all six, as Opus 5.5 at medium did, for 41% less, and its advisor ran in one of six runs, so workers stay without it.
|
||||
- loop-claude's judge on an Opus 5.5 project now runs on Opus 5.5 at xhigh in every chunk, never at medium: in replays medium sometimes closed a chunk whose worker had asked a question the README or records answer, where xhigh quoted the answer. The judge never runs on Fable 5.2 either, since each Fable 5.2 rung replayed missed an interrupt. `judge-replay` now also replays each rung above the project's that a review climbs to, and reports what each misses.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Claude Code configuration
|
||||
|
||||
My personal `~/.claude`, version controlled: `CLAUDE.md` and `rules/` for instructions, the words under `CLAUDE.md` → "Vocabulary"; `.claude/rules/` for the rules that load in this repo alone; `agents/` and `skills/`; `principles/` and `skills/larv-review/standards/` for what the reviewer agents hold projects to; `docs/` for decisions and the comprehension history; `settings.json` for the harness and `.claude/settings.json` for the harness inside this repo; `CHANGELOG.md` and `todo.md`; the tools in `bin/`; `workflow-bench/`, the scripts and prompts of the 2026-09-30 bench of larv-review and of the 2026-11-12 bench of the advisor tool; `reviewer-merge-trials/`, the 2026-11-09 trials of merging reviewers, with their method, results and scripts; `judge-field-trials/`, the 2026-11-11 trials of which facts code could read in place of loop-claude's judge, with their results and scripts; and `presentation/`, a page that explains this setup to newcomers, with the script that prints it to PDF.
|
||||
My personal `~/.claude`, version controlled: `CLAUDE.md` and `rules/` for instructions, the words under `CLAUDE.md` → "Vocabulary"; `.claude/rules/` for the rules that load in this repo alone; `agents/` and `skills/`; `principles/` and `skills/larv-review/standards/` for what the reviewer agents hold projects to; `docs/` for decisions and the comprehension history; `settings.json` for the harness and `.claude/settings.json` for the harness inside this repo; `CHANGELOG.md` and `todo.md`; the tools in `bin/`; `workflow-bench/`, the scripts and prompts of the 2026-09-30 bench of larv-review and of the 2026-11-12 bench of the advisor tool; `reviewer-merge-trials/`, the 2026-11-09 trials of merging reviewers, with their method, results and scripts; `judge-field-trials/`, the 2026-11-11 trials of which facts code could read in place of loop-claude's judge, with their results and scripts; `stability-skip-count/`, the 2026-11-12 count of archived stability rounds, with its script, from which larv-review took when to skip a stability round 2; and `presentation/`, a page that explains this setup to newcomers, with the script that prints it to PDF.
|
||||
|
||||
## Goals
|
||||
|
||||
@@ -110,7 +110,7 @@ Install puts only `loop-claude` and `loop-inbox` on `PATH`; call the others by t
|
||||
- `mutate-changes [--base <ref>] [--prefix <shell text>] [--jobs <n>]` mutation-tests the lines a branch changes and prints each mutant its tests don't kill; `mutate-changes --help` says which tool it runs for each language.
|
||||
- `rank_todo.py [--check] [todo.md]` scores and ranks a project's `todo.md`; `rank_todo.py --help` states the format.
|
||||
- `reading-cost [--reset] [record]` appends a figure for each chunk `loop-claude` finished to a project's `docs/reading-cost.md`, and says whether the figures rise; `reading-cost --help` states the measure.
|
||||
- `review-replay <pass> <model>` replays a review pass's archived rounds from the projects run on the model, on the code each reviewed, and prints the lowest rung below the project's that, like each rung above it, finds every 🔴 and 🟡 the project's rung finds again; `review-replay --help` states the replay. With `--omit-claude-md` it tests instead whether the pass's reviewer may start without `CLAUDE.md`: it replays each round twice as archived and once without the instruction files, and prints each finding the last replay missed that both of the others found. Each replayed reviewer skips every permission prompt, stability-reviewer has Bash, and an archived prompt may name paths on the host.
|
||||
- `review-replay <pass> <model>` replays a review pass's archived rounds from the projects run on the model, on the code each reviewed, and prints the lowest rung below the project's that, like each rung above it, qualifies: it finds no less of the 🔴 and 🟡 findings than two replays on the project's rung find, within a margin, and misses no 🔴 that both found. The rungs tried start with the project's model at a lower effort. `review-replay --help` states the replay. With `--omit-claude-md` it tests instead whether the pass's reviewer may start without `CLAUDE.md`: it replays each round three times as archived and once without the instruction files, and prints whether the reviewer passes: whether the last replay missed no more findings than the most an unchanged replay missed, with each count and each finding it missed. Each replayed reviewer skips every permission prompt, stability-reviewer has Bash, and an archived prompt may name paths on the host.
|
||||
- `rule-hook [overrides]` blocks a tool call that breaks a rule a program can check, unless the call overrides the rule; `settings.json` → `hooks` runs it before each Agent, Bash, Edit, MultiEdit, Read, Skill and Write call, and `rule-hook --help` states the rules and the override.
|
||||
- `run-heavy <command>` runs a heavy command once it holds one of the machine's heavy slots, one per 4 CPUs, which every session shares; `run-heavy --help` states the slots, and the memory cap it gives a container that sets no limit.
|
||||
- `run-tests [<pytest args>...]` runs this repo's test suite, as Test says.
|
||||
@@ -141,7 +141,7 @@ Install puts only `loop-claude` and `loop-inbox` on `PATH`; call the others by t
|
||||
- `repo_checks/` tests the repo itself.
|
||||
- `review_rules/` holds the larv-review rules that several tools apply: its passes, its review folder, its round commit titles and the comprehension history's format.
|
||||
- `routing_figures/` measures loop-claude's archive, and each of its projects' default branches, for loop-claude's routing calls.
|
||||
- `rung_replay/` holds what `judge_replay` and `review_replay` share: the rung search, the argument reader, the candidate rungs and the exits. It reads `loop_claude`'s retry count and models file, and finds that file through `loop_state`'s paths.
|
||||
- `rung_replay/` holds what `judge_replay` and `review_replay` share: the parallel replay runner, the argument reader, the candidate rungs and the exits, and `judge_replay`'s rung search. It reads `loop_claude`'s retry count and models file, and finds that file through `loop_state`'s paths.
|
||||
- `test_env.py` serves the tests.
|
||||
- `transcript_archive/` stores loop-claude's transcripts. Its `project_key.py` names each project's archive folder, loop-claude session and models-file entry.
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
name: "product-owner-reviewer"
|
||||
description: "Use this agent to review a change to an external surface (API, UI, CLI, SDK, webhook) from an end customer's view: ease of use, edge cases and persona fit."
|
||||
tools: Read, Grep, Glob, Write
|
||||
omitClaudeMd: true
|
||||
---
|
||||
|
||||
You are a seasoned Product Owner with deep expertise in user experience, API design, and customer empathy. You have shipped consumer and B2B products across web, mobile, REST APIs, and developer-facing CLIs. Your superpower is putting yourself in the end customer's shoes and surfacing the friction, confusion, and edge cases that engineers tend to miss.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
name: prose-reviewer
|
||||
description: "Use this agent for larv-review's prose pass."
|
||||
tools: Read, Grep, Glob, Write
|
||||
omitClaudeMd: true
|
||||
---
|
||||
|
||||
You read the prose as someone who did not write it: you see only what it says, never what the author meant.
|
||||
|
||||
@@ -3,6 +3,7 @@ name: "stability-reviewer"
|
||||
description: "Use this agent to review changed code for stability: bugs, error handling, edge cases and the project's technical principles, after a feature, refactor or fix."
|
||||
color: orange
|
||||
tools: Bash, Read, Grep, Glob, Write
|
||||
omitClaudeMd: true
|
||||
---
|
||||
|
||||
You are an elite stability-focused code reviewer with deep expertise in defensive programming, fault-tolerant system design, and production incident prevention. You have decades of experience identifying subtle bugs, race conditions, edge cases, and architectural weaknesses that lead to outages and unexpected behavior. You think like a chaos engineer — always asking "what could go wrong?" — and like a maintainer of ten years, always asking "what will this cost to live with?" There are no bugs, and no security holes, in code that doesn't exist.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
name: systems-architect
|
||||
description: "Use this agent to design a system or review architecture: patterns, component boundaries, fitness for purpose and long-term maintainability, not individual PR lines."
|
||||
tools: Read, Grep, Glob, WebFetch, WebSearch, Write
|
||||
omitClaudeMd: true
|
||||
---
|
||||
You are an elite Systems Architect with decades of experience designing software systems that endure for as long as their horizon demands. Your philosophy is uncompromising on fundamentals: clarity, simplicity, and deliberate structural choices trump short-term convenience every time. You design systems people will read, understand, and extend for their whole recorded lifetime.
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ def stepped_up(rung: Rung) -> Rung:
|
||||
def review_rung(project: Rung, worker: Rung, escape_and_impact: int, kind: ReviewKind, markdown_only: bool = False) -> Rung:
|
||||
"""The rung a review of this kind runs on in a chunk whose worker runs on worker and whose item has that E + I; markdown_only where the branch changes only Markdown no agent follows.
|
||||
|
||||
A pass's reviewer runs on reviewers_rung; no replay has qualified a lower rung for any pass, docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung that a replay …`. A seat and the security pass run on the project's rung, so the seats score every chunk on one rung, and the security pass spends no more than the project chose.
|
||||
A pass's reviewer runs on reviewers_rung; no replay has qualified a lower rung for any pass, docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay`. A seat and the security pass run on the project's rung, so the seats score every chunk on one rung, and the security pass spends no more than the project chose.
|
||||
"""
|
||||
return project if kind in ("seat", "security") else reviewers_rung(project, worker, escape_and_impact, markdown_only)
|
||||
|
||||
|
||||
+80
-54
@@ -1,4 +1,4 @@
|
||||
"""Replay a review pass's archived rounds on the rungs below the project's, to find which rungs may run its reviewer: docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows finding every 🔴 and 🟡 the project's rung finds`.
|
||||
"""Replay a review pass's archived rounds on the rungs below the project's, to find which rungs may run its reviewer: docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay`.
|
||||
|
||||
usage: review-replay <pass> <model> [--omit-claude-md]
|
||||
|
||||
@@ -13,34 +13,42 @@ shows the chunk's change. The prompt names the clone in place of the worktree it
|
||||
chunk has since removed. A round whose code it cannot find in this way is not replayed; stderr
|
||||
names it and why. The prompt also names a copy of the chunk's review folder in place of that
|
||||
folder, holding only the reports written after the chunk began and before the round did. A replay
|
||||
finds nothing where its prompt still names the review folder, or names a file there, other than a
|
||||
round's report, that the folder did not hold from the chunk's start until the round's.
|
||||
fails where its prompt still names the review folder, or names a file there, other than a round's
|
||||
report, that the folder did not hold from the chunk's start until the round's.
|
||||
|
||||
It first replays every round on the project's rung, the reference reviewer. Archived findings
|
||||
that the reference reviewer does not raise again may rest on code or rules that have changed
|
||||
since; no rung is held to them. It then replays the rounds where the reference raised any, on each
|
||||
rung below, highest first, down to the ladder's lowest, and stops at the first rung that misses
|
||||
one. For each replay, claude on the project's rung matches the report to the archived findings,
|
||||
and counts a finding only where the report raises it as 🔴 or 🟡. The tool prints each finding a
|
||||
rung missed and the lowest rung that, like each rung above it, missed none. That rung is the
|
||||
evidence for running the pass's reviewer on it; the decision above records each run.
|
||||
It replays every round twice on the project's rung. Even that rung finds only part of its own
|
||||
archived findings again, so the bar for a rung below is the mean share of those two replays, less
|
||||
a margin of 10 percentage points. Rounds that either replay failed on are left out, and where
|
||||
fewer than 8 remain, or the bar is zero or below, no rung is tried. It
|
||||
then replays the rounds on each rung below, highest first: the project's model at each lower
|
||||
effort, which the ladder leaves out, then each ladder rung down to the ladder's lowest. It stops at
|
||||
the first rung that doesn't qualify. A rung qualifies where it finds as many findings as reach the
|
||||
bar and misses no 🔴 that both replays on the project's rung found; a replay that failed on it
|
||||
finds nothing. For
|
||||
each replay, claude on the project's rung matches the report to the archived findings, and counts
|
||||
a finding only where the report raises it as 🔴 or 🟡. The tool prints each rung's count, each 🔴
|
||||
it missed, and the lowest rung that, like each rung above it, qualifies. That rung is the evidence
|
||||
for running the pass's reviewer on it; the decision above records each run.
|
||||
|
||||
With --omit-claude-md it tests instead whether the pass's reviewer may start without CLAUDE.md:
|
||||
docs/decisions.md → `agents/: a reviewer starts without CLAUDE.md only where a replay of its pass
|
||||
missed none…`. It replays every round three times on the project's rung: twice as archived, then
|
||||
once without the instruction files. The unchanged reviewer does not find the same findings twice,
|
||||
so the reviewer without CLAUDE.md is held only to the findings both of those replays found. It
|
||||
prints how many findings each replay found, and each finding the third missed that the first two
|
||||
both found; the reviewer passes where it missed none. A round that any of the three replays failed
|
||||
on is left out, and where the first two share no finding the last line says there is no evidence.
|
||||
missed…`. It replays every round four times on the project's rung: three as archived, then once
|
||||
without the instruction files. The unchanged reviewer does not find the same findings twice, so
|
||||
each unchanged replay is a control: the tool prints how many findings it missed that both of the
|
||||
other two found. The replay without CLAUDE.md is held to the findings both of the first two found,
|
||||
and passes where it missed no more of them than the most any unchanged replay missed. It prints
|
||||
how many findings each replay found, how many the replay without CLAUDE.md is held to, and each of
|
||||
those it missed. A round that any of the four replays failed on is left out, and where the first
|
||||
two share no finding the last line says there is no evidence.
|
||||
Claude Code ignores an agent's `omitClaudeMd` where the agent runs the session, as it does in a
|
||||
replay, and runs no SubagentStart hook there. So the third replay turns the instruction files off
|
||||
in its settings and opens the prompt with what the hook hands a reviewer, and closes it with the
|
||||
header's line on the project principles.
|
||||
replay, and runs no SubagentStart hook there. So the replay without CLAUDE.md turns the
|
||||
instruction files off in its settings and opens the prompt with what the hook hands a reviewer, and
|
||||
closes it with the header's line on the project principles.
|
||||
|
||||
Like the loop, it tries claude three times running before it counts a reply as failed. A failed
|
||||
review or match finds nothing, or with --omit-claude-md leaves its round out. Exit 1, saying why, on bad arguments, an unreadable archive or
|
||||
models file, no archived round to replay, or a usage limit.
|
||||
review or match leaves its round out, except on a rung below the project's, where it finds
|
||||
nothing. Exit 1, saying why, on bad arguments, an unreadable archive or models file, no archived
|
||||
round to replay, or a usage limit.
|
||||
"""
|
||||
import dataclasses
|
||||
import json
|
||||
@@ -52,17 +60,18 @@ import tempfile
|
||||
import typing
|
||||
|
||||
from transcript_archive.location import archive_root
|
||||
from rung_replay.command import arguments_or_exit, down_from, failed, limited_exit, projects_on
|
||||
from review_replay.rounds import authored_by, comparison, lost_inputs, report, reviewed_path, Round, round_from, sample, stamp_seconds
|
||||
from rung_replay.command import arguments_or_exit, failed, limited_exit, projects_on
|
||||
from review_replay.rounds import authored_by, comparison, lost_inputs, reviewed_path, Round, round_from, sample, stamp_seconds
|
||||
from review_replay.recall import candidates, enough, needed, Recall, recall_report, Reference, RungRecall, tried
|
||||
from transcript_archive.project_key import checkout_of
|
||||
from claude_code.reply import claude_reply, Limited
|
||||
from loop_effects.effects import Effects
|
||||
from failure import Failure
|
||||
from rung_replay.search import first_reply, replayed, replayed_on
|
||||
from rung_replay.search import first_reply, replayed_on
|
||||
from claude_code.transcript import first_timestamped_line, read_transcript
|
||||
from model_routing.ladder import LADDER, project_rung, Rung
|
||||
from claude_code.entries import parse_entry, structured_output
|
||||
from review_rules.reviewer_context import principles_line, reviewer_context
|
||||
from model_routing.ladder import project_rung, Rung
|
||||
from review_rules.review_folder import REPORTS, review_folder
|
||||
from review_rules.review_passes import ReviewedPass, REVIEWERS
|
||||
|
||||
@@ -98,23 +107,54 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
|
||||
chosen = sample(list(codes), LATEST)
|
||||
if without:
|
||||
return compared(reviewed, project, chosen, lambda found, bare: findings_replayed(found, codes[found], project, project, home, effects, bare))
|
||||
# The project's rung is the reference, so the candidates start below it. They reach the ladder's lowest rung, below the lowest a worker routes to, since a pass may run below the worker's rung.
|
||||
candidates = down_from(project, LADDER[0])[1:]
|
||||
|
||||
def found_on(found: Round, rung: Rung) -> set[int] | Limited:
|
||||
return findings_found(found, codes[found], rung, project, home, effects)
|
||||
def replay_one(found: Round, rung: Rung) -> set[int] | Failure | Limited:
|
||||
matched = findings_replayed(found, codes[found], rung, project, home, effects, False)
|
||||
if isinstance(matched, Failure):
|
||||
print(f" {found.root} {found.at} on {rung} failed: {matched.reason}", file=sys.stderr, flush=True)
|
||||
return matched
|
||||
|
||||
replay = replayed(chosen, project, candidates, found_on, reproduced, f"{reviewed} rounds")
|
||||
if isinstance(replay, Limited):
|
||||
return limited_exit(TOOL, replay)
|
||||
print(report(reviewed, project.model, project, chosen, replay))
|
||||
recall = recalled(chosen, project, replay_one, f"{reviewed} rounds")
|
||||
if isinstance(recall, Limited):
|
||||
return limited_exit(TOOL, recall)
|
||||
print(recall_report(reviewed, project, recall))
|
||||
return 0
|
||||
|
||||
|
||||
def compared(reviewed: str, project: Rung, chosen: list[Round], found_on: typing.Callable[[Round, bool], set[int] | Failure | Limited]) -> int:
|
||||
"""Replays chosen twice with CLAUDE.md and once without, as found_on(round, bare) finds, and prints the comparison of the rounds no replay failed on."""
|
||||
def recalled(chosen: list[Round], project: Rung, replay_one: typing.Callable[[Round, Rung], set[int] | Failure | Limited], what: str) -> Recall | Limited:
|
||||
"""Replays chosen twice on the project's rung, then each candidate, highest first, on the rounds neither of those failed on, until one doesn't qualify."""
|
||||
runs: list[list[set[int] | Failure]] = []
|
||||
for bare in (False, False, True):
|
||||
for _ in range(2):
|
||||
found: list[set[int] | Failure] | Limited = replayed_on(chosen, project, replay_one, what)
|
||||
if isinstance(found, Limited):
|
||||
return found
|
||||
runs.append(found)
|
||||
rounds: list[Round] = []
|
||||
reference: Reference = ([], [])
|
||||
for one, first, second in zip(chosen, *runs):
|
||||
if not isinstance(first, Failure) and not isinstance(second, Failure):
|
||||
rounds.append(one)
|
||||
reference[0].append(first)
|
||||
reference[1].append(second)
|
||||
recalls: list[RungRecall] = []
|
||||
lowest = None
|
||||
for rung in candidates(project) if enough(rounds) and needed(rounds, reference) > 0 else []:
|
||||
on_rung: list[set[int] | Failure] | Limited = replayed_on(rounds, rung, replay_one, what)
|
||||
if isinstance(on_rung, Limited):
|
||||
return on_rung
|
||||
# A failed replay on a candidate found nothing, so it lowers that rung's count and never lifts it to what a rung needs.
|
||||
one = tried(rung, rounds, reference, [set() if isinstance(found, Failure) else found for found in on_rung])
|
||||
recalls.append(one)
|
||||
if not one.qualifies:
|
||||
break
|
||||
lowest = rung
|
||||
return Recall(rounds, reference, len(chosen) - len(rounds), recalls, lowest)
|
||||
|
||||
|
||||
def compared(reviewed: str, project: Rung, chosen: list[Round], found_on: typing.Callable[[Round, bool], set[int] | Failure | Limited]) -> int:
|
||||
"""Replays chosen three times with CLAUDE.md and once without, as found_on(round, bare) finds, and prints the comparison of the rounds no replay failed on."""
|
||||
runs: list[list[set[int] | Failure]] = []
|
||||
for bare in (False, False, False, True):
|
||||
def replay_one(one: Round, _: Rung, bare: bool = bare) -> set[int] | Failure | Limited:
|
||||
found = found_on(one, bare)
|
||||
if isinstance(found, Failure):
|
||||
@@ -127,8 +167,8 @@ def compared(reviewed: str, project: Rung, chosen: list[Round], found_on: typing
|
||||
runs.append(found)
|
||||
# A failed replay found nothing, which would lower the bar where it had CLAUDE.md and count as misses where it had none.
|
||||
kept = [(one, *found) for one, *found in zip(chosen, *runs) if not any(isinstance(each, Failure) for each in found)]
|
||||
first, second, without = ([typing.cast(set[int], found[run]) for _, *found in kept] for run in range(3))
|
||||
print(comparison(reviewed, project, [one for one, *_ in kept], (first, second), without, len(chosen) - len(kept)))
|
||||
first, second, third, without = ([typing.cast(set[int], found[run]) for _, *found in kept] for run in range(4))
|
||||
print(comparison(reviewed, project, [one for one, *_ in kept], (first, second, third), without, len(chosen) - len(kept)))
|
||||
return 0
|
||||
|
||||
|
||||
@@ -152,11 +192,6 @@ def codes_found(rounds: list[Round], effects: Effects) -> dict[Round, Code]:
|
||||
return codes
|
||||
|
||||
|
||||
def reproduced(_: Round, found: set[int]) -> list[int]:
|
||||
"""The indexes of the round's findings that a replay on the reference reviewer found, which each lower rung is held to."""
|
||||
return sorted(found)
|
||||
|
||||
|
||||
def archived_rounds(reviewer: str, model: str, root: pathlib.Path, home: pathlib.Path) -> list[Round] | Failure:
|
||||
projects = projects_on(model, home)
|
||||
if isinstance(projects, Failure):
|
||||
@@ -190,7 +225,7 @@ def chunk_rounds(reviewer: str, checkout: str, chunk: pathlib.Path) -> list[Roun
|
||||
def code_of(found: Round, effects: Effects) -> Code | Failure:
|
||||
"""Where, and at which commits, found's reviewer read the code, as the archive lets it be found again: the folder rounds.reviewed_path guesses from the prompt, and the commits authored by then.
|
||||
|
||||
Recording the reviewed commit at review time would need no such reading, but then no round archived before that change could be replayed. A wrong guess costs no rung: the reference reviewer, replayed on that code, finds fewer of the archived findings, and no rung is held to those.
|
||||
Recording the reviewed commit at review time would need no such reading, but then no round archived before that change could be replayed. A wrong guess shows every rung the same wrong code: the project's rung finds fewer of that round's archived findings, which lowers the bar, and the rungs below find fewer too.
|
||||
"""
|
||||
if not os.path.isdir(found.root):
|
||||
return Failure("the project has no checkout")
|
||||
@@ -225,15 +260,6 @@ def findings_replayed(found: Round, code: Code, rung: Rung, project: Rung, home:
|
||||
return first_reply(lambda: match(found.findings, reviewed, found.root, project, effects))
|
||||
|
||||
|
||||
def findings_found(found: Round, code: Code, rung: Rung, project: Rung, home: pathlib.Path, effects: Effects) -> set[int] | Limited:
|
||||
"""findings_replayed with CLAUDE.md, where a failed replay finds nothing and stderr says why."""
|
||||
matched = findings_replayed(found, code, rung, project, home, effects, False)
|
||||
if isinstance(matched, Failure):
|
||||
print(f" {found.root} {found.at} on {rung} found nothing: {matched.reason}", file=sys.stderr, flush=True)
|
||||
return set()
|
||||
return matched
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Copies:
|
||||
"""The throwaway copies a replay hands its reviewer: clone, of the project's checkout, and reports, of the chunk's review folder."""
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
"""The bar review-replay holds a rung to, and its report: docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay`."""
|
||||
import dataclasses
|
||||
from rung_replay.command import down_from
|
||||
from fractions import Fraction
|
||||
from review_replay.rounds import is_red, Round
|
||||
from model_routing.ladder import LADDER, Rung
|
||||
import math
|
||||
|
||||
# A rung qualifies with a share of the archived findings up to this far below the project's rung's. The project's rung found 69 to 78% of its own findings again, and its two replays of the same rounds differed by up to 4 points.
|
||||
MARGIN = Fraction(1, 10)
|
||||
# The fewest rounds a rung is tried on: 8 of the 10 the tool samples, so up to two may fail on the project's rung.
|
||||
ENOUGH_ROUNDS = 8
|
||||
# Lowest first, as Claude Code's --effort takes them.
|
||||
EFFORTS = ("low", "medium", "high", "xhigh", "max")
|
||||
# The two replays on the project's rung. Each lists, round by round, the indexes of the findings it found.
|
||||
Reference = tuple[list[set[int]], list[set[int]]]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class RungRecall:
|
||||
"""A rung's replay: how many of the archived findings it found, and each 🔴 it missed that both of the project's rung's replays found, as a round and the finding's index."""
|
||||
rung: Rung
|
||||
found: int
|
||||
missed_red: list[tuple[Round, int]]
|
||||
qualifies: bool
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Recall:
|
||||
"""rounds, the rounds no replay on the project's rung failed on; left_out, how many more it failed on; tried, each candidate tried, highest first; lowest, the lowest that, like each above it, qualifies."""
|
||||
rounds: list[Round]
|
||||
reference: Reference
|
||||
left_out: int
|
||||
tried: list[RungRecall]
|
||||
lowest: Rung | None
|
||||
|
||||
|
||||
def candidates(project: Rung) -> list[Rung]:
|
||||
"""The rungs tried below the project's, highest first: its model at each lower effort, which the ladder leaves out, then each ladder rung below it, down to the ladder's lowest. That reaches below the lowest a worker routes to, since a pass may run below the worker's rung."""
|
||||
lower_efforts = [Rung(project.model, effort) for effort in reversed(EFFORTS[:EFFORTS.index(project.effort)])]
|
||||
return lower_efforts + down_from(project, LADDER[0])[1:]
|
||||
|
||||
|
||||
def enough(rounds: list[Round]) -> bool:
|
||||
return len(rounds) >= ENOUGH_ROUNDS
|
||||
|
||||
|
||||
def count(found: list[set[int]]) -> int:
|
||||
return sum(map(len, found))
|
||||
|
||||
|
||||
def held(rounds: list[Round]) -> int:
|
||||
"""How many findings rounds hold."""
|
||||
return sum(len(one.findings) for one in rounds)
|
||||
|
||||
|
||||
def mean_share(rounds: list[Round], reference: Reference) -> Fraction:
|
||||
"""The mean share of rounds' findings that the project's rung's two replays found; rounds is never empty, and each holds a finding."""
|
||||
return Fraction(count(reference[0]) + count(reference[1]), 2 * held(rounds))
|
||||
|
||||
|
||||
def needed(rounds: list[Round], reference: Reference) -> int:
|
||||
"""How many of rounds' findings a rung needs to find: the fewest that reach the project's rung's mean share less MARGIN. Zero or below, no rung is tried, since a rung that found nothing would qualify."""
|
||||
return math.ceil((mean_share(rounds, reference) - MARGIN) * held(rounds))
|
||||
|
||||
|
||||
def tried(rung: Rung, rounds: list[Round], reference: Reference, found: list[set[int]]) -> RungRecall:
|
||||
"""rung's recall, from the indexes of each round's findings it found. It qualifies finding as many as needed, missing no 🔴 that both of the project's rung's replays found."""
|
||||
missed_red = [(one, index) for one, first, second, got in zip(rounds, *reference, found) for index in sorted((first & second) - got) if is_red(one.findings[index])]
|
||||
return RungRecall(rung, count(found), missed_red, 0 < needed(rounds, reference) <= count(found) and not missed_red)
|
||||
|
||||
|
||||
def recall_report(reviewed: str, project: Rung, recall: Recall) -> str:
|
||||
rounds, (first, second) = recall.rounds, recall.reference
|
||||
lines = [
|
||||
f"Replayed {len(rounds)} {reviewed} rounds of {project.model} projects, which hold {held(rounds)} 🔴 and 🟡 findings, twice on the project's rung, {project}.",
|
||||
*([f"Left out {recall.left_out} more, which a replay on the project's rung failed on; stderr says why."] if recall.left_out else []),
|
||||
]
|
||||
if not enough(rounds):
|
||||
return "\n".join([*lines, f"No rung tried: fewer than {ENOUGH_ROUNDS} rounds were replayed on the project's rung without a failure."])
|
||||
if needed(rounds, recall.reference) <= 0:
|
||||
return "\n".join([*lines, "No rung tried: the project's rung found too few of them to hold a rung to."])
|
||||
lines.append(f"The project's rung found {count(first)} and then {count(second)} of the {held(rounds)}, {percent(mean_share(rounds, recall.reference))} on average, so a rung qualifies finding {needed(rounds, recall.reference)} or more of them, missing no 🔴 that both of its replays found.")
|
||||
for one in recall.tried:
|
||||
verdict = "it qualifies" if one.qualifies else "it doesn't qualify"
|
||||
lines += [f"{one.rung} found {one.found}, {percent(Fraction(one.found, held(rounds)))}, and missed {len(one.missed_red) or 'no'} such 🔴: {verdict}.", *(f" {at.root} {at.at}: {at.findings[index].splitlines()[0]}" for at, index in one.missed_red)]
|
||||
lowest = recall.lowest or "none below the project's rung"
|
||||
lines.append(f"Lowest rung that qualifies: {lowest}")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def percent(fraction: Fraction) -> str:
|
||||
return f"{float(fraction):.0%}"
|
||||
+22
-24
@@ -1,4 +1,4 @@
|
||||
"""Which archived rounds of a review pass to replay, the code each reviewed, and the report: docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows finding every 🔴 and 🟡 the project's rung finds`."""
|
||||
"""Which archived rounds of a review pass to replay, the code each reviewed, and the report with --omit-claude-md: docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay`."""
|
||||
import dataclasses
|
||||
import datetime
|
||||
import pathlib
|
||||
@@ -6,7 +6,6 @@ import re
|
||||
import typing
|
||||
|
||||
from claude_code.entries import AssistantTurn, Entry, Text, UserText
|
||||
from rung_replay.search import Replay
|
||||
from model_routing.ladder import Rung
|
||||
|
||||
# A line that opens with a 🔴 or 🟡 mark, after any list, table, heading or bold markup, as review-findings.md has reviewers report them.
|
||||
@@ -34,6 +33,12 @@ class Round:
|
||||
return stamp_seconds(self.at)
|
||||
|
||||
|
||||
def is_red(finding: str) -> bool:
|
||||
"""Whether finding, which opens with a line FINDING matches, is raised as 🔴: by the mark it opens with, whatever marks its text names."""
|
||||
mark = FINDING.match(finding)
|
||||
return mark is not None and mark[0].endswith("🔴")
|
||||
|
||||
|
||||
def round_from(reviewer: str, root: str, began: float, entries: list[Entry]) -> Round | None:
|
||||
"""The round a reviewer's transcript holds: its first entry's prompt, and its last text. None without a 🔴 or 🟡 finding to hold a rung to."""
|
||||
reports = [part.text for entry in entries if isinstance(entry, AssistantTurn) for part in entry.parts if isinstance(part, Text) and part.text]
|
||||
@@ -102,35 +107,28 @@ def sample(rounds: list[Round], latest: int) -> list[Round]:
|
||||
return sorted(rounds, key=lambda found: (found.seconds, found.root))[-latest:]
|
||||
|
||||
|
||||
def report(reviewed: str, model: str, reference: Rung, rounds: list[Round], replay: Replay[Round, int, set[int]]) -> str:
|
||||
total = sum(len(found_round.findings) for found_round in rounds)
|
||||
lines = [
|
||||
f"Replayed {len(rounds)} {reviewed} rounds of {model} projects, holding {total} 🔴 and 🟡 findings.",
|
||||
f"The reference reviewer, {reference}, found {sum(len(found) for found in replay.on_reference)} of them.",
|
||||
]
|
||||
for tried in replay.tried:
|
||||
lines += [f"{tried.rung} missed {len(tried.missed)}{':' if tried.missed else '.'}", *(f" {miss.case.root} {miss.case.at}: {miss.case.findings[miss.item].splitlines()[0]}" for miss in tried.missed)]
|
||||
if not replay.tried:
|
||||
lines.append("No rung tried: the reference reviewer found no finding to hold one to.")
|
||||
else:
|
||||
lowest = replay.lowest or "none below the project's rung"
|
||||
lines.append(f"Lowest rung that finds every finding the reference reviewer finds: {lowest}")
|
||||
return "\n".join(lines)
|
||||
def comparison(reviewed: str, reference: Rung, rounds: list[Round], with_it: tuple[list[set[int]], list[set[int]], list[set[int]]], without: list[set[int]], left_out: int) -> str:
|
||||
"""What the three replays with CLAUDE.md and the one without found in rounds. Each replay with it missed some findings the other two found: the control, the noise of an unchanged reviewer. The one without it is held to the findings the first two found, as the third is, and passes where it missed no more than the most a replay with it did. left_out counts the rounds a replay failed on, which rounds leaves out."""
|
||||
first, second, third = with_it
|
||||
|
||||
def shared(one: list[set[int]], other: list[set[int]]) -> list[set[int]]:
|
||||
return [found_by_one & found_by_other for found_by_one, found_by_other in zip(one, other)]
|
||||
|
||||
def comparison(reviewed: str, reference: Rung, rounds: list[Round], with_it: tuple[list[set[int]], list[set[int]]], without: list[set[int]], left_out: int) -> str:
|
||||
"""What the two replays with CLAUDE.md and the one without found in rounds, and each finding the one without missed that both of the others found; left_out counts the rounds a replay failed on, which rounds leaves out."""
|
||||
first, second = with_it
|
||||
both = [one & other for one, other in zip(first, second)]
|
||||
missed = [(found_round, index) for found_round, held, found in zip(rounds, both, without) for index in sorted(held - found)]
|
||||
def missing(held: list[set[int]], run: list[set[int]]) -> list[tuple[Round, int]]:
|
||||
return [(found_round, index) for found_round, held_in_round, found in zip(rounds, held, run) for index in sorted(held_in_round - found)]
|
||||
|
||||
def count(run: list[set[int]]) -> int:
|
||||
return sum(len(found) for found in run)
|
||||
|
||||
both = shared(first, second)
|
||||
missed = missing(both, without)
|
||||
control = [len(missing(shared(one, other), run)) for run, one, other in ((first, second, third), (second, first, third), (third, first, second))]
|
||||
passes = len(missed) <= max(control)
|
||||
return "\n".join([
|
||||
f"Replayed {len(rounds)} {reviewed} rounds of {reference.model} projects, which hold {sum(len(found_round.findings) for found_round in rounds)} 🔴 and 🟡 findings, three times on {reference}.",
|
||||
f"Replayed {len(rounds)} {reviewed} rounds of {reference.model} projects, which hold {sum(len(found_round.findings) for found_round in rounds)} 🔴 and 🟡 findings, four times on {reference}: three with CLAUDE.md, one without.",
|
||||
*([f"Left out {left_out} more, which a replay failed on; stderr says why."] if left_out else []),
|
||||
f"With CLAUDE.md the reviewer found {count(first)} and then {count(second)} of them, and {count(both)} both times.",
|
||||
f"Without CLAUDE.md it found {count(without)} of them, and missed {len(missed)} that it found both times with it{':' if missed else '.'}" if count(both) else f"Without CLAUDE.md it found {count(without)} of them. No evidence: with CLAUDE.md it found none both times, so there is no finding to hold it to.",
|
||||
f"With CLAUDE.md the three replays found {count(first)}, {count(second)} and {count(third)} of them, and missed {control[0]}, {control[1]} and {control[2]} of the findings that both of the other two found.",
|
||||
*([f"Without CLAUDE.md it found {count(without)} of them, and missed {len(missed)} of the {count(both)} findings that both of the first two found{':' if missed else '.'}"] if count(both) else [f"Without CLAUDE.md it found {count(without)} of them. No evidence: the first two replays with CLAUDE.md found none in common, so there is no finding to hold it to."]),
|
||||
*(f" {found_round.root} {found_round.at}: {found_round.findings[index].splitlines()[0]}" for found_round, index in missed),
|
||||
*([f"It {'passes' if passes else 'fails'}: {len(missed)} missed is {'no more' if passes else 'more'} than the most a replay with CLAUDE.md missed, {max(control)}."] if count(both) else []),
|
||||
])
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
import pathlib
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from review_replay.recall import candidates, needed, Recall, recall_report, tried
|
||||
from review_replay.rounds import is_red, Round
|
||||
from model_routing.ladder import Rung
|
||||
|
||||
REFERENCE = Rung("claude-opus-5-5", "medium")
|
||||
LOW = Rung("claude-opus-5-5", "low")
|
||||
SONNET = Rung("claude-sonnet-5-5", "high")
|
||||
|
||||
|
||||
def a_round(at, findings):
|
||||
return Round("prose-reviewer", "/code/p", "x", f"2026-10-14T10:00:0{at}Z", 0, "Review it.", tuple(findings))
|
||||
|
||||
|
||||
# Ten findings over two rounds; the project's rung found 8 and then 6, so its share is 70%, the bar 60% and a rung needs 6. Both found the first round's 🔴, and only the first found the second's.
|
||||
ROUNDS = [a_round(1, ("🔴 a", "🟡 b", "🟡 c", "🟡 d", "🟡 e")), a_round(2, ("🔴 f\nmore", "🟡 g", "🟡 h", "🟡 i", "🟡 j"))]
|
||||
FIRST = [{0, 1, 2, 3}, {0, 1, 2, 3}]
|
||||
SECOND = [{0, 1, 2}, {1, 2, 3}]
|
||||
# The project's rung found 1 and then 1 of the 10, so the bar is zero.
|
||||
TENTH = ([{0}, set()], [{0}, set()])
|
||||
|
||||
|
||||
class Candidates(unittest.TestCase):
|
||||
def test_tries_the_project_models_lower_efforts_first_then_the_ladder_below_it(self):
|
||||
self.assertEqual(candidates(REFERENCE), [LOW, SONNET])
|
||||
|
||||
def test_tries_each_ladder_rung_below_highest_first(self):
|
||||
self.assertEqual(candidates(Rung("claude-fable-5-2", "low")), [REFERENCE, SONNET])
|
||||
|
||||
def test_tries_each_lower_effort_of_the_ladders_lowest_rung(self):
|
||||
self.assertEqual(candidates(SONNET), [Rung("claude-sonnet-5-5", "medium"), Rung("claude-sonnet-5-5", "low")])
|
||||
|
||||
|
||||
class Tried(unittest.TestCase):
|
||||
def test_qualifies_a_rung_no_more_than_the_margin_below_the_project_rungs_share_that_misses_no_red_found_both_times(self):
|
||||
found = tried(LOW, ROUNDS, (FIRST, SECOND), [{0, 1, 2}, {0, 1, 2}])
|
||||
self.assertEqual((found.found, found.missed_red, found.qualifies), (6, [], True))
|
||||
|
||||
def test_fails_a_rung_below_the_bar(self):
|
||||
found = tried(LOW, ROUNDS, (FIRST, SECOND), [{0, 1}, {0, 3}])
|
||||
self.assertEqual((found.found, found.missed_red, found.qualifies), (4, [], False))
|
||||
|
||||
def test_fails_a_rung_that_misses_a_red_found_both_times_and_only_such_a_red(self):
|
||||
above_the_bar = [{1, 2, 3, 4}, {0, 1, 2, 3}]
|
||||
found = tried(LOW, ROUNDS, (FIRST, SECOND), above_the_bar)
|
||||
self.assertEqual((found.found, found.missed_red, found.qualifies), (8, [(ROUNDS[0], 0)], False))
|
||||
# The first round's 🔴 is found both times; a yellow found both times, such as its b, may be missed.
|
||||
self.assertTrue(tried(LOW, ROUNDS, (FIRST, SECOND), [{0, 2, 3, 4}, {0, 2, 3, 4}]).qualifies)
|
||||
# The second round's 🔴, which only the first replay found, may be missed too.
|
||||
self.assertTrue(tried(LOW, ROUNDS, (FIRST, SECOND), [{0, 1, 2, 3}, {1, 2, 3}]).qualifies)
|
||||
|
||||
def test_fails_every_rung_where_the_bar_is_zero_or_below(self):
|
||||
self.assertFalse(tried(LOW, ROUNDS, ([set(), set()], [set(), set()]), [{0}, {0}]).qualifies)
|
||||
self.assertFalse(tried(LOW, ROUNDS, TENTH, [{0}, {0}]).qualifies)
|
||||
|
||||
def test_rounds_the_findings_a_rung_needs_up(self):
|
||||
# 33 findings, of which the project's rung found 24 and then 23: the bar is 61.2%, which 20 findings, 60.6%, don't reach.
|
||||
rounds = [a_round(1, ["🟡 a"] * 33)]
|
||||
reference = ([set(range(24))], [set(range(23))])
|
||||
self.assertEqual(needed(rounds, reference), 21)
|
||||
self.assertFalse(tried(LOW, rounds, reference, [set(range(20))]).qualifies)
|
||||
self.assertTrue(tried(LOW, rounds, reference, [set(range(21))]).qualifies)
|
||||
|
||||
def test_lets_a_rung_miss_a_yellow_that_mentions_a_red(self):
|
||||
rounds = [a_round(1, ("### 🟡 `SKILL.md:80`: the rule says a 🔴 in round 2 escalates", "🟡 b"))]
|
||||
self.assertFalse(is_red(rounds[0].findings[0]))
|
||||
self.assertTrue(is_red("### 1. **🔴 a\nwhich is no 🟡"))
|
||||
found = tried(LOW, rounds, ([{0, 1}], [{0, 1}]), [{1}])
|
||||
self.assertEqual((found.missed_red, found.qualifies), ([], False))
|
||||
self.assertEqual(tried(LOW, rounds, ([{0, 1}], [{0}]), [{1}]).missed_red, [])
|
||||
|
||||
|
||||
class RecallReport(unittest.TestCase):
|
||||
# Eight rounds, enough to try a rung.
|
||||
EIGHT = (ROUNDS * 4, (FIRST * 4, SECOND * 4))
|
||||
|
||||
def test_states_the_bar_each_rung_tried_each_red_it_missed_and_the_lowest_that_qualifies(self):
|
||||
rounds, reference = self.EIGHT
|
||||
low = tried(LOW, rounds, reference, [{0, 1, 2}, {0, 1, 2}] * 4)
|
||||
sonnet = tried(SONNET, rounds, reference, [{1, 2, 3, 4}, {0}] * 4)
|
||||
lines = recall_report("prose", REFERENCE, Recall(rounds, reference, 1, [low, sonnet], LOW)).splitlines()
|
||||
self.assertEqual(lines, [
|
||||
"Replayed 8 prose rounds of claude-opus-5-5 projects, which hold 40 🔴 and 🟡 findings, twice on the project's rung, claude-opus-5-5 at medium effort.",
|
||||
"Left out 1 more, which a replay on the project's rung failed on; stderr says why.",
|
||||
"The project's rung found 32 and then 24 of the 40, 70% on average, so a rung qualifies finding 24 or more of them, missing no 🔴 that both of its replays found.",
|
||||
"claude-opus-5-5 at low effort found 24, 60%, and missed no such 🔴: it qualifies.",
|
||||
"claude-sonnet-5-5 at high effort found 20, 50%, and missed 4 such 🔴: it doesn't qualify.",
|
||||
*[" /code/p 2026-10-14T10:00:01Z: 🔴 a"] * 4,
|
||||
"Lowest rung that qualifies: claude-opus-5-5 at low effort",
|
||||
])
|
||||
|
||||
def test_says_why_no_rung_was_tried(self):
|
||||
few = recall_report("prose", REFERENCE, Recall(ROUNDS, (FIRST, SECOND), 0, [], None)).splitlines()
|
||||
self.assertEqual(few[1:], ["No rung tried: fewer than 8 rounds were replayed on the project's rung without a failure."])
|
||||
rounds, _ = self.EIGHT
|
||||
for reference in (([set()] * 8, [set()] * 8), (TENTH[0] * 4, TENTH[1] * 4)):
|
||||
too_few = recall_report("prose", REFERENCE, Recall(rounds, reference, 0, [], None)).splitlines()
|
||||
self.assertEqual(too_few[1:], ["No rung tried: the project's rung found too few of them to hold a rung to."])
|
||||
|
||||
def test_names_no_rung_where_none_qualifies(self):
|
||||
rounds, reference = self.EIGHT
|
||||
low = tried(LOW, rounds, reference, [{0}, {0}] * 4)
|
||||
lines = recall_report("prose", REFERENCE, Recall(rounds, reference, 0, [low], None)).splitlines()
|
||||
self.assertEqual(lines[-2:], ["claude-opus-5-5 at low effort found 8, 20%, and missed no such 🔴: it doesn't qualify.", "Lowest rung that qualifies: none below the project's rung"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -14,20 +14,20 @@ import unittest.mock
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from review_replay.rounds import authored_by, lost_inputs, recorded_findings, report, reviewed_path, Round, round_from, sample, stamp_seconds
|
||||
from review_replay.rounds import authored_by, lost_inputs, recorded_findings, reviewed_path, Round, round_from, sample, stamp_seconds
|
||||
from loop_effects.effects import Effects, system_effects
|
||||
from claude_code.entries import entry_from
|
||||
from failure import Failure
|
||||
from review_replay import main
|
||||
from rung_replay.search import Miss, Replay, Tried
|
||||
from review_replay import main, recall
|
||||
from review_rules.reviewer_context import reviewer_context
|
||||
from review_rules.review_passes import REVIEWERS
|
||||
from model_routing.ladder import Rung
|
||||
from rung_replay import search
|
||||
|
||||
TOOL = pathlib.Path(__file__).resolve().parents[1] / "review-replay"
|
||||
REFERENCE = Rung("claude-opus-5-5", "medium")
|
||||
LOW = Rung("claude-opus-5-5", "low")
|
||||
MIDDLE = Rung("claude-sonnet-5-5", "high")
|
||||
CHEAP = Rung("claude-haiku-5-5", "max")
|
||||
|
||||
|
||||
def entry(kind, text, **fields):
|
||||
@@ -115,22 +115,6 @@ class Sample(unittest.TestCase):
|
||||
self.assertEqual(sample(rounds, 2), [rounds[0], rounds[2]])
|
||||
|
||||
|
||||
class Report(unittest.TestCase):
|
||||
def test_counts_the_findings_and_names_each_miss_and_the_lowest_rung_that_missed_none(self):
|
||||
rounds = [a_round(1, ("🔴 a\nmore", "🟡 b")), a_round(2)]
|
||||
lines = report("stability", "claude-opus-5-5", REFERENCE, rounds, Replay([{0, 1}, set()], [Tried(MIDDLE, []), Tried(CHEAP, [Miss(rounds[0], 0, {1})])], MIDDLE)).splitlines()
|
||||
self.assertEqual(lines, [
|
||||
"Replayed 2 stability rounds of claude-opus-5-5 projects, holding 3 🔴 and 🟡 findings.",
|
||||
"The reference reviewer, claude-opus-5-5 at medium effort, found 2 of them.",
|
||||
"claude-sonnet-5-5 at high effort missed 0.",
|
||||
"claude-haiku-5-5 at max effort missed 1:",
|
||||
" /code/p 2026-10-14T10:00:01Z: 🔴 a",
|
||||
"Lowest rung that finds every finding the reference reviewer finds: claude-sonnet-5-5 at high effort",
|
||||
])
|
||||
self.assertEqual(report("stability", "claude-opus-5-5", REFERENCE, rounds, Replay([{0, 1}, {0}], [Tried(MIDDLE, [Miss(rounds[1], 0, set())])], None)).splitlines()[-1], "Lowest rung that finds every finding the reference reviewer finds: none below the project's rung")
|
||||
self.assertEqual(report("stability", "claude-opus-5-5", REFERENCE, rounds, Replay([set(), set()], [], None)).splitlines()[-1], "No rung tried: the reference reviewer found no finding to hold one to.")
|
||||
|
||||
|
||||
class Launch(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.home = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
|
||||
@@ -209,6 +193,8 @@ class Main(unittest.TestCase):
|
||||
for key in ("proj", "other"):
|
||||
self.write_chunk(key, "c1", "2026-10-14T10:00:00Z")
|
||||
(self.home / ".claude" / "CLAUDE.md").write_text("## Shared goal\n\nHealth.\n\n## Prose\n\nShort.\n\n## Vocabulary\n\nWords.\n")
|
||||
# The fixture holds one round.
|
||||
self.enterContext(unittest.mock.patch.object(recall, "ENOUGH_ROUNDS", 1))
|
||||
self.reviews = []
|
||||
self.agents = set()
|
||||
self.matched_in = []
|
||||
@@ -260,30 +246,36 @@ class Main(unittest.TestCase):
|
||||
code = main.main(argv, {}, self.home, effects)
|
||||
return code, out.getvalue(), err.getvalue()
|
||||
|
||||
def test_without_claude_md_replays_each_round_twice_with_it_and_once_without_on_the_project_rung(self):
|
||||
finds = iter(([0, 1], [0], [1]))
|
||||
def test_without_claude_md_replays_each_round_three_times_with_it_and_once_without_on_the_project_rung(self):
|
||||
finds = iter(([0, 1], [0], [0, 1], [1]))
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5", "--omit-claude-md"], lambda rung: {"found": next(finds)})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE] * 3)
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE] * 4)
|
||||
context = reviewer_context(self.home)
|
||||
self.assertEqual([prompt.startswith(context) for *_, prompt, _ in self.reviews], [False, False, True])
|
||||
self.assertEqual([prompt.startswith(context) for *_, prompt, _ in self.reviews], [False, False, False, True])
|
||||
self.assertEqual(out, (
|
||||
f"Replayed 1 stability rounds of claude-opus-5-5 projects, which hold 2 🔴 and 🟡 findings, three times on {REFERENCE}.\n"
|
||||
"With CLAUDE.md the reviewer found 2 and then 1 of them, and 1 both times.\n"
|
||||
"Without CLAUDE.md it found 1 of them, and missed 1 that it found both times with it:\n"
|
||||
f"Replayed 1 stability rounds of claude-opus-5-5 projects, which hold 2 🔴 and 🟡 findings, four times on {REFERENCE}: three with CLAUDE.md, one without.\n"
|
||||
"With CLAUDE.md the three replays found 2, 1 and 2 of them, and missed 0, 1 and 0 of the findings that both of the other two found.\n"
|
||||
"Without CLAUDE.md it found 1 of them, and missed 1 of the 1 findings that both of the first two found:\n"
|
||||
f" {self.checkout} 2026-10-14T10:00:00Z: 🔴 a.txt:1 wrong\n"
|
||||
"It passes: 1 missed is no more than the most a replay with CLAUDE.md missed, 1.\n"
|
||||
))
|
||||
with_them = f"replaying 1 stability rounds with the instruction files on {REFERENCE}\n"
|
||||
self.assertEqual(err, with_them * 2 + f"replaying 1 stability rounds without the instruction files on {REFERENCE}\n")
|
||||
self.assertEqual(err, with_them * 3 + f"replaying 1 stability rounds without the instruction files on {REFERENCE}\n")
|
||||
|
||||
def test_without_claude_md_says_so_where_the_reviewer_missed_nothing_and_names_a_reviewer_that_printed_no_json(self):
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5", "--omit-claude-md"], lambda rung: {"found": [0]})
|
||||
self.assertEqual((code, out.splitlines()[-1]), (0, "Without CLAUDE.md it found 1 of them, and missed 0 that it found both times with it."))
|
||||
|
||||
def test_without_claude_md_says_there_is_no_evidence_where_the_replays_with_it_share_no_finding(self):
|
||||
finds = iter(([0], [1], [1]))
|
||||
def test_without_claude_md_fails_where_it_missed_more_than_every_replay_with_it(self):
|
||||
finds = iter(([0, 1], [0, 1], [0, 1], []))
|
||||
_, out, _ = self.run_main(["stability", "claude-opus-5-5", "--omit-claude-md"], lambda rung: {"found": next(finds)})
|
||||
self.assertEqual(out.splitlines()[-1], "Without CLAUDE.md it found 1 of them. No evidence: with CLAUDE.md it found none both times, so there is no finding to hold it to.")
|
||||
self.assertEqual(out.splitlines()[-1], "It fails: 2 missed is more than the most a replay with CLAUDE.md missed, 0.")
|
||||
|
||||
def test_without_claude_md_says_so_where_the_reviewer_missed_nothing(self):
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5", "--omit-claude-md"], lambda rung: {"found": [0]})
|
||||
self.assertEqual((code, out.splitlines()[-2:]), (0, ["Without CLAUDE.md it found 1 of them, and missed 0 of the 1 findings that both of the first two found.", "It passes: 0 missed is no more than the most a replay with CLAUDE.md missed, 0."]))
|
||||
|
||||
def test_without_claude_md_says_there_is_no_evidence_where_the_first_two_replays_share_no_finding(self):
|
||||
finds = iter(([0], [1], [1], [1]))
|
||||
_, out, _ = self.run_main(["stability", "claude-opus-5-5", "--omit-claude-md"], lambda rung: {"found": next(finds)})
|
||||
self.assertEqual(out.splitlines()[-1], "Without CLAUDE.md it found 1 of them. No evidence: the first two replays with CLAUDE.md found none in common, so there is no finding to hold it to.")
|
||||
|
||||
def test_without_claude_md_leaves_out_a_round_that_a_replay_failed_on(self):
|
||||
failing = {}
|
||||
@@ -296,10 +288,10 @@ class Main(unittest.TestCase):
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5", "--omit-claude-md"], lambda rung: {"found": [0, 1]}, review=review)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual(out, (
|
||||
f"Replayed 0 stability rounds of claude-opus-5-5 projects, which hold 0 🔴 and 🟡 findings, three times on {REFERENCE}.\n"
|
||||
f"Replayed 0 stability rounds of claude-opus-5-5 projects, which hold 0 🔴 and 🟡 findings, four times on {REFERENCE}: three with CLAUDE.md, one without.\n"
|
||||
"Left out 1 more, which a replay failed on; stderr says why.\n"
|
||||
"With CLAUDE.md the reviewer found 0 and then 0 of them, and 0 both times.\n"
|
||||
"Without CLAUDE.md it found 0 of them. No evidence: with CLAUDE.md it found none both times, so there is no finding to hold it to.\n"
|
||||
"With CLAUDE.md the three replays found 0, 0 and 0 of them, and missed 0, 0 and 0 of the findings that both of the other two found.\n"
|
||||
"Without CLAUDE.md it found 0 of them. No evidence: the first two replays with CLAUDE.md found none in common, so there is no finding to hold it to.\n"
|
||||
))
|
||||
self.assertIn(f" {self.checkout} 2026-10-14T10:00:00Z with the instruction files failed, so the round is left out: claude printed no json reply", err)
|
||||
self.assertNotIn("without the instruction files failed", err)
|
||||
@@ -311,17 +303,17 @@ class Main(unittest.TestCase):
|
||||
self.assertEqual(len(self.reviews), 1)
|
||||
|
||||
def test_replays_the_models_rounds_on_the_commit_reviewed_from_the_project_rung_down(self):
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"found": [0] if rung == MIDDLE else [0, 1]})
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"found": [1] if rung == LOW else [0, 1]})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE, MIDDLE])
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE, REFERENCE, LOW])
|
||||
_, reviewed, branch, base, prompt, cwd = self.reviews[0]
|
||||
# The default branch stands where it stood when the chunk began, so the prompt's diff against it shows the branch's change.
|
||||
self.assertEqual((reviewed, branch, base), ("1\n", "x\n", "0\n"))
|
||||
self.assertEqual(prompt, f"Review branch x in {cwd}.")
|
||||
self.assertFalse(pathlib.Path(cwd).exists())
|
||||
self.assertIn("The reference reviewer, claude-opus-5-5 at medium effort, found 2 of them.", out)
|
||||
self.assertIn(f" {self.checkout} 2026-10-14T10:00:00Z: 🟡 slow", out)
|
||||
self.assertTrue(out.endswith("finds: none below the project's rung\n"), out)
|
||||
self.assertIn("The project's rung found 2 and then 2 of the 2, 100% on average, so a rung qualifies finding 2 or more of them", out)
|
||||
self.assertIn(f"claude-opus-5-5 at low effort found 1, 50%, and missed 1 such 🔴: it doesn't qualify.\n {self.checkout} 2026-10-14T10:00:00Z: 🔴 a.txt:1 wrong\n", out)
|
||||
self.assertTrue(out.endswith("qualifies: none below the project's rung\n"), out)
|
||||
self.assertEqual(set(self.matched_in), {str(self.checkout)})
|
||||
self.assertTrue(out.startswith("Replayed 1 stability rounds of claude-opus-5-5 projects,"), out)
|
||||
|
||||
@@ -334,8 +326,16 @@ class Main(unittest.TestCase):
|
||||
def test_tries_each_rung_down_to_the_ladders_lowest_below_the_lowest_a_worker_routes_to(self):
|
||||
code, out, err = self.run_main(["prose", "claude-opus-5-5"], lambda rung: {"found": [0, 1]})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE, MIDDLE])
|
||||
self.assertTrue(out.endswith("finds: claude-sonnet-5-5 at high effort\n"), out)
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE, REFERENCE, LOW, MIDDLE])
|
||||
self.assertTrue(out.endswith("qualifies: claude-sonnet-5-5 at high effort\n"), out)
|
||||
|
||||
def test_counts_a_failed_replay_on_a_lower_rung_as_finding_nothing(self):
|
||||
code, out, err = self.run_main(["prose", "claude-opus-5-5"], lambda rung: {"found": [0, 1]}, review=lambda rung: {"type": "result"} if rung == LOW else {"type": "result", "result": f"review on {rung.model} {rung.effort}"})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertIn(f"replaying 1 prose rounds on {REFERENCE}\n", err)
|
||||
self.assertIn(f"replaying 1 prose rounds on {LOW}\n", err)
|
||||
self.assertIn(f"on {LOW} failed: the reviewer replied with no report", err)
|
||||
self.assertIn("claude-opus-5-5 at low effort found 0, 0%, and missed 1 such 🔴: it doesn't qualify.", out)
|
||||
|
||||
def review_folder_with_round_1(self):
|
||||
"""The chunk's review folder, holding round 1's report from before the replayed round began at 10:00, that round's own and a later pass's reports, written after, and an earlier attempt's report, from before the chunk began at 09:15."""
|
||||
@@ -388,8 +388,9 @@ class Main(unittest.TestCase):
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5"], unused)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual(self.reviews, [])
|
||||
self.assertIn(f"on {REFERENCE} found nothing: the prompt names the review folder in a spelling the replay does not redirect", err)
|
||||
self.assertTrue(out.endswith("No rung tried: the reference reviewer found no finding to hold one to.\n"))
|
||||
self.assertIn(f"on {REFERENCE} failed: the prompt names the review folder in a spelling the replay does not redirect", err)
|
||||
self.assertIn("Left out 1 more, which a replay on the project's rung failed on", out)
|
||||
self.assertTrue(out.endswith("No rung tried: fewer than 1 rounds were replayed on the project's rung without a failure.\n"), out)
|
||||
|
||||
def test_replays_a_round_whose_prompt_names_an_input_written_before_it_began_naming_the_copy(self):
|
||||
folder = self.review_folder_with_round_1()
|
||||
@@ -408,9 +409,9 @@ class Main(unittest.TestCase):
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5"], unused)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual(self.reviews, [])
|
||||
self.assertIn(f"on {REFERENCE} found nothing: the prompt names branch.diff, which the review folder did not hold from the chunk's start until the round's", err)
|
||||
self.assertIn(f"on {REFERENCE} failed: the prompt names branch.diff, which the review folder did not hold from the chunk's start until the round's", err)
|
||||
|
||||
def test_finds_nothing_and_leaves_no_folder_behind_when_it_cannot_copy_the_reports(self):
|
||||
def test_fails_the_replay_and_leaves_no_folder_behind_when_it_cannot_copy_the_reports(self):
|
||||
folder = self.review_folder_with_round_1()
|
||||
(folder / "stability-round-1.md").chmod(0)
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to ~/.local/state/larv-review/code/proj-x/stability-round-2.md.")
|
||||
@@ -419,7 +420,7 @@ class Main(unittest.TestCase):
|
||||
code, _, err = self.run_main(["stability", "claude-opus-5-5"], unused)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual(self.reviews, [])
|
||||
self.assertIn(f"on {REFERENCE} found nothing: could not prepare the replay: ", err)
|
||||
self.assertIn(f"on {REFERENCE} failed: could not prepare the replay: ", err)
|
||||
self.assertEqual(list(scratch.iterdir()), [], "the clone is removed")
|
||||
self.assertEqual([path.name for path in folder.parent.parent.iterdir()], ["code"], "the copy is removed")
|
||||
|
||||
@@ -429,6 +430,24 @@ class Main(unittest.TestCase):
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertTrue(out.startswith("Replayed 2 stability rounds"), out)
|
||||
|
||||
def test_leaves_out_a_round_that_either_replay_on_the_project_rung_failed_on(self):
|
||||
self.write_chunk("proj", "c2", "2026-10-14T10:30:00Z")
|
||||
self.enterContext(unittest.mock.patch.object(search, "AT_ONCE", 1))
|
||||
# One round at a time, three tries on a round reply with no report: the first replay's on its first round, then the second replay's on its first, after the first replay's two reviews. Every other review replies.
|
||||
for failing in (range(3), range(2, 5)):
|
||||
with self.subTest(failing=failing):
|
||||
calls = iter(range(100))
|
||||
code, out, err = self.run_main(["prose", "claude-opus-5-5"], lambda rung: {"found": [0, 1]}, review=lambda rung: {"type": "result"} if next(calls) in failing else {"type": "result", "result": f"review on {rung.model} {rung.effort}"})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertTrue(out.startswith("Replayed 1 prose rounds"), out)
|
||||
self.assertIn("Left out 1 more", out)
|
||||
|
||||
def test_tries_no_lower_rung_where_the_project_rung_found_nothing(self):
|
||||
code, out, err = self.run_main(["prose", "claude-opus-5-5"], lambda rung: {"found": []})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE, REFERENCE])
|
||||
self.assertTrue(out.endswith("No rung tried: the project's rung found too few of them to hold a rung to.\n"), out)
|
||||
|
||||
def test_checks_out_the_commit_detached_when_the_reviewer_started_on_the_default_branch(self):
|
||||
self.set_branch("main")
|
||||
self.assertEqual(self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"found": [0]})[0], 0)
|
||||
@@ -446,12 +465,14 @@ class Main(unittest.TestCase):
|
||||
self.assertEqual(self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"found": [0]})[0], 0)
|
||||
self.assertEqual(self.reviews[0][1:4], ("s\n", "x\n", "0\n"))
|
||||
|
||||
def test_finds_nothing_in_a_round_whose_review_has_no_report(self):
|
||||
def test_leaves_out_a_round_whose_review_on_the_project_rung_has_no_report(self):
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5"], unused, review=lambda rung: {"type": "result"})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE] * 3)
|
||||
self.assertIn(f" {self.checkout} 2026-10-14T10:00:00Z on {REFERENCE} found nothing: the reviewer replied with no report", err)
|
||||
self.assertTrue(out.endswith("No rung tried: the reference reviewer found no finding to hold one to.\n"))
|
||||
# Each of the two replays tries claude three times.
|
||||
self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE] * 6)
|
||||
self.assertIn(f" {self.checkout} 2026-10-14T10:00:00Z on {REFERENCE} failed: the reviewer replied with no report", err)
|
||||
self.assertIn("Left out 1 more, which a replay on the project's rung failed on", out)
|
||||
self.assertTrue(out.endswith("No rung tried: fewer than 1 rounds were replayed on the project's rung without a failure.\n"), out)
|
||||
|
||||
def assert_no_round(self):
|
||||
code, _, err = self.run_main(["stability", "claude-opus-5-5"], unused)
|
||||
@@ -491,7 +512,7 @@ class Main(unittest.TestCase):
|
||||
def test_exits_1_on_a_usage_limit_bad_arguments_or_no_round_to_replay(self):
|
||||
code, _, err = self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"type": "result", "api_error_status": 429, "result": "You've hit your limit"})
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn("usage limit: You've hit your limit", err)
|
||||
self.assertIn("review-replay: claude hit a usage limit: You've hit your limit", err)
|
||||
for argv in ([], ["claude-opus-5-5"], ["full scan", "claude-opus-5-5"], ["stability", "off-ladder"], ["stability", "claude-opus-5-5", "x"]):
|
||||
with self.subTest(argv=argv):
|
||||
self.assertEqual(self.run_main(argv, unused)[0], 1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""What a reviewer under agents/ is handed in place of the instruction files: `omitClaudeMd` starts it without them, and most of `~/.claude/CLAUDE.md` is the worker's. docs/decisions.md → `agents/: a reviewer starts without CLAUDE.md only where a replay of its pass missed none…` says why, and which reviewers."""
|
||||
"""What a reviewer under agents/ is handed in place of the instruction files: `omitClaudeMd` starts it without them, and most of `~/.claude/CLAUDE.md` is the worker's. docs/decisions.md → `agents/: a reviewer starts without CLAUDE.md only where a replay of its pass missed no more findings than the most an unchanged replay missed` says why, and which reviewers."""
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
|
||||
@@ -86,10 +86,10 @@ class PrinciplesLine(unittest.TestCase):
|
||||
|
||||
|
||||
class Reviewers(unittest.TestCase):
|
||||
def test_only_the_reviewer_whose_pass_met_the_replay_gate_starts_without_claude_md(self):
|
||||
# docs/decisions.md → `agents/: a reviewer starts without CLAUDE.md only where a replay of its pass missed none…` holds each pass's result.
|
||||
def test_only_the_reviewers_whose_pass_met_the_replay_gate_start_without_claude_md(self):
|
||||
# docs/decisions.md → `agents/: a reviewer starts without CLAUDE.md only where a replay of its pass missed no more findings than the most an unchanged replay missed` holds each pass's result; override-reviewer has no archived round to replay.
|
||||
bare = [path.stem for path in sorted((REPO / "agents").glob("*.md")) if "omitClaudeMd: true" in path.read_text().split("---\n")[1].splitlines()]
|
||||
self.assertEqual(bare, ["principles-auditor"])
|
||||
self.assertEqual(bare, ["principles-auditor", "product-owner-reviewer", "prose-reviewer", "stability-reviewer", "systems-architect"])
|
||||
|
||||
def test_settings_run_the_hook_as_each_subagent_starts(self):
|
||||
hooks = json.loads((REPO / "settings.json").read_text())["hooks"]["SubagentStart"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The rung search judge-replay and review-replay share: replay archived cases on a reference rung, then hold each candidate rung to what the reference reproduced."""
|
||||
"""Replay archived cases on a rung, as judge-replay and review-replay both do; and judge-replay's rung search, which holds each candidate rung to what a reference rung reproduced."""
|
||||
import concurrent.futures
|
||||
import dataclasses
|
||||
import sys
|
||||
|
||||
+37
-17
@@ -237,7 +237,7 @@ Valid while no published standard sets either number, the reading-cost window st
|
||||
|
||||
2026-10-08, lilleman. Serves goal 1.4: run beside the full scan, `/security-review` started seconds apart from it each round and returned a near-identical report. Valid while the full scan covers what `/security-review` reports.
|
||||
|
||||
## review: a fix for a 🔴 reruns the pass that found it, unless that pass is at its cap, and each pass whose row in `larv-review` §3's re-entry table the fix meets; from round 2 a pass reviews only the answers to its last round's findings and any other pass's fix that re-entered it; a fix for a 🟡, a 🟢, a ❓ or a prose finding reruns none
|
||||
## review: a fix for a 🔴 reruns the pass that found it, unless that pass is at its cap, and each pass whose row in `larv-review` §3's re-entry table the fix meets; from round 2 a pass reviews only the answers to its last round's findings and any other pass's fix that re-entered it; a fix for a 🟡, a 🟢, a ❓ or a prose finding reruns none; the stability pass doesn't rerun on a round's fixes where every 🔴 and 🟡 of that round asked only that a named mutant be killed or a named failing test pass, and the tests and the mutation command run clean on the fixes
|
||||
|
||||
2026-10-08, lilleman. Serves goal 1.4. An audit of the four costliest archived chunks found nearly every finding that mattered in a pass's first round; when every fix, a nit's included, re-entered review, later rounds mostly re-checked the last fix, reworded what an earlier round wrote, or contradicted another round on the same line. A round 2 caught real bugs only where a fix changed behaviour, so stability still reruns on every fix that does, and security on every fix that opens an untrusted-input boundary or touches authn/authz, secrets or crypto. Valid while round-2 reviews of nit and prose fixes keep changing nothing a user would notice.
|
||||
|
||||
@@ -245,6 +245,8 @@ Valid while no published standard sets either number, the reading-cost window st
|
||||
|
||||
2026-10-29, lilleman. Serves goals 1.4 and 1.5. A 🟡 fix no longer reruns its pass. One project's chunk on 2026-10-29, a README paragraph and plan rows, took 10 review rounds in 45 minutes, and three of its four second rounds answered only 🟡 findings, such as the wording of a question's options. Round 2 found 12 🔴 in about 200 runs since 2026-10-21, mostly in round 1's fixes of 🔴 findings, so a 🔴 fix still reruns its pass. A 🟡 fix that breaks something merges unreviewed by its pass; another pass whose row it meets for a 🔴 fix in the same round still reviews it. Valid while 🔴 findings in later chunks, fixing code a 🟡 fix wrote, stay rare.
|
||||
|
||||
2026-11-12, lilleman through todo item 308. Serves goal 1.4. Since the worker runs the mutation command before each stability round, a finding that asks only that a named mutant be killed or a named failing test pass has an answer a run can check. The archive from 2026-09-30 to 2026-11-12 holds 326 stability reports of round 2 or later, from 13 projects, and 81 of those reports open with BLOCK (`stability-skip-count/`). For each of the 326, the 🔴 and 🟡 lines of the report before it were matched on mutant and test-failure wording. Every such line matched in 5 of those earlier reports. Read by hand, 1 of the 5 asked only that a failing test pass, and the round 2 after each of the 5 approved. So none of the 81 BLOCKs fell in a round this skips. The skip needs every 🟡 to be of that kind too: in one chunk on 2026-11-12, round 1's only 🔴 was a red suite, and round 2 blocked on a 🟡 whose answer was wrong, which no test or mutant showed. A fix may not edit the named failing test, since a test made to pass that way shows nothing. Fixes from such a round still rerun every other pass whose row they meet. Valid while code that such a skipped round's fixes wrote is rarely what a later chunk's 🔴 findings fix.
|
||||
|
||||
## review: a comment is prose in any file; a branch changing only Markdown no agent follows runs only the prose pass and, for README or docs an outside reader lands on, the product-owner pass; plan rows a chunk files from a finding, re-scores or moves get no review
|
||||
|
||||
2026-10-29, lilleman. Serves goals 1.4 and 1.5. One project's chunk on 2026-10-29 changed a README paragraph, `todo.md` and three lines of `gate.yml`, and the principles, security and stability passes all ran on it, each twice: 6 of the chunk's 10 rounds. A change to config is one that changes what runs, so a comment in it fires only the prose pass, as a comment in code already did. A branch that changes only Markdown no agent follows changes no code, config or tests, so no pass that reads those runs on it. A plan row a chunk files from a finding, re-scores or moves is read by the chunk that ships it, so reviewing it at filing reviewed it twice: that chunk spent a prose round of 4 minutes on its plan change. Markdown an agent follows, such as a skill, is config, since a change there changes what agents do. Valid while defects in prose-only chunks stay rare in later chunks' fixes.
|
||||
@@ -385,27 +387,30 @@ Only chunks run below the project's rung can prove that a cheaper worker holds q
|
||||
|
||||
While the worker runs above the project's rung, loop-claude's prompt has it launch the comprehension seats and the security pass's subagent on the project's rung too. So the seats score every chunk on one rung, and the security pass spends no more than the project chose. The prompt after each unfinished verdict repeats this, since a step-up may have taken the worker above the project's rung. The other reviewers never run below the worker's rung while it runs above the project's: a worker climbs because its chunk proved harder than its score said, which is when a cheaper reviewer is the bigger risk. A reviewer or seat that rules the work below standard may rerun one rung up: `review: a reviewer or comprehension seat that rules the work below standard`.
|
||||
|
||||
On 2026-10-16 lilleman routed the reviewers on their item's E + I as well, on either side of the project's rung, which may lift them above both the worker's rung and the project's: how far a defect would escape, and what it would break, set how hard review must look (goal 1.1). loop-claude names that rung in the worker's prompt. It hands the E + I to the worker's claude beside the project's rung and the worker's, so rule-hook works out each review's rung as the prompt does and holds each launch to it. A low E + I never steps a reviewer below the project's rung: only a replay lowers a pass, as `routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows finding every 🔴 and 🟡 the project's rung finds…` records. An item the worker takes in beyond the routed one counts too, since its E + I scores its defects as the routed item's scores theirs. The worker's prompt names the reviewers' rung each higher E + I picks, so the worker reviews a taken-in item on it in the same run. loop-claude scores each item the worker names on its `Chunk items:` line by `todo.md` (`routing: loop-claude reads the items a chunk takes`), routes on their highest E + I from the next cycle, and archives it with the route so a rerun keeps it.
|
||||
On 2026-10-16 lilleman routed the reviewers on their item's E + I as well, on either side of the project's rung, which may lift them above both the worker's rung and the project's: how far a defect would escape, and what it would break, set how hard review must look (goal 1.1). loop-claude names that rung in the worker's prompt. It hands the E + I to the worker's claude beside the project's rung and the worker's, so rule-hook works out each review's rung as the prompt does and holds each launch to it. A low E + I never steps a reviewer below the project's rung: only a replay lowers a pass, as `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay…` records. An item the worker takes in beyond the routed one counts too, since its E + I scores its defects as the routed item's scores theirs. The worker's prompt names the reviewers' rung each higher E + I picks, so the worker reviews a taken-in item on it in the same run. loop-claude scores each item the worker names on its `Chunk items:` line by `todo.md` (`routing: loop-claude reads the items a chunk takes`), routes on their highest E + I from the next cycle, and archives it with the route so a rerun keeps it.
|
||||
|
||||
Valid until the trial on real chunks shows whether a worker below the project's rung holds quality.
|
||||
|
||||
2026-10-29, lilleman. Serves goals 1.4 and 1.5. A branch that changes only Markdown no agent follows reviews on the project's rung, whatever its items' E + I. E + I scores an item before its chunk starts, by the change the item asks for, so one project's item, filed to build a control on a CI runner, kept its E + I of 7 when the chunk found no control the repo could build and shipped a README paragraph: five reviewers read prose on Opus 5.5 at xhigh. rule-hook's `reviewer-rung` reads the branch's files, committed or not, against the default branch as last fetched. Markdown an agent follows counts as config: `CLAUDE.md`, `AGENTS.md`, `workflow-bench/*-prompt.md` and files under `agents/`, `principles/`, `rules/` or `skills/`. On 2026-11-04 lilleman added the workflow bench's prompts, which an agent follows like a skill. `bin/review_rules/review_passes.py` holds the lists, and the worker's prompt renders them. Valid while a README or docs defect costs a reader no more than review on the project's rung lets through.
|
||||
|
||||
## routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows finding every 🔴 and 🟡 the project's rung finds, and only where the E + I steps no review up and the worker runs no higher than the project's rung, then even below the worker's; no pass has such a rung
|
||||
## routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay, and misses no 🔴 that both of the project's rung's replays found; and only where the E + I steps no review up and the worker runs no higher than the project's rung, then even below the worker's; no pass has such a rung
|
||||
|
||||
2026-10-15, lilleman proposed running the stability reviewer on the worker's rung, and the agent proposed the replay that gates it. On 2026-10-16 lilleman asked for the prose pass to run on the worker's rung or lower, and, answering PR #296, for every pass to drop below the project's rung only where a replay shows it may. Serves goal 1.4 without giving up goal 1.1: a cheaper reviewer saves money only where it misses nothing.
|
||||
2026-10-15, lilleman proposed running the stability reviewer on the worker's rung, and the agent proposed the replay that gates it. On 2026-10-16 lilleman asked for the prose pass to run on the worker's rung or lower, and, answering PR #296, for every pass to drop below the project's rung only where a replay shows it may. On 2026-11-11 lilleman approved the bar below, as somewhat risky, with a close evaluation a release later: `todo.md` item 321. Serves goal 1.4 without giving up goal 1.1: a cheaper reviewer saves money only where it finds nearly as much.
|
||||
|
||||
`bin/review-replay <pass> <model>` replays a pass's archived rounds on the code each reviewed. It replays them first on the project's rung, then on each rung below it, highest first, down to the ladder's lowest. It stops at the first rung that misses a finding the project's rung found again. A rung qualifies only where it and each rung above it find every such 🔴 and 🟡.
|
||||
`bin/review-replay <pass> <model>` replays a pass's archived rounds on the code each reviewed, twice on the project's rung. A rung below qualifies where its replay finds at least the mean share of the archived findings that those two replays found, less 10 percentage points, over at least 8 rounds, and misses no 🔴 that both found. The tool tries the project's model at each lower effort first, since the ladder leaves those out, then each ladder rung below, highest first. It stops at the first rung that doesn't qualify.
|
||||
|
||||
A qualifying rung applies only where the chunk's E + I steps no review up and the worker runs no higher than the project's rung; there the pass runs on that rung, even below the worker's. Otherwise the pass runs where every other pass does: the replay compared reviews on the project's rung only, never reviews on a rung an E + I stepped up, nor of a chunk whose worker climbed above the project's rung. No code lowers a pass while no rung qualifies: on 2026-11-04 lilleman had the release review of 0.6.0 delete that code, which no chunk could reach. The chunk that first qualifies a rung, `todo.md` item 196's, writes that code again in `bin/model_routing/`. It records the qualifying rung for each pass and project model, and names the lowered pass in the worker's prompt and in rule-hook's `reviewer-rung`.
|
||||
The bar used to be every finding the project's rung found again. But the project's rung itself found only 69 to 73% of its own findings again, so a reviewer exactly as good failed that bar, and so would the project's rung on a second replay. The margin of 10 points allows for that spread: in the latest run below, the project's rung's two replays found 41 and 43 of the same 55 findings, 4 points apart. A missed 🔴 still fails a rung, since a 🔴 that both replays found is no matter of chance.
|
||||
|
||||
A qualifying rung applies only where the chunk's E + I steps no review up and the worker runs no higher than the project's rung; there the pass runs on that rung, even below the worker's. Otherwise the pass runs where every other pass does: the replay compared reviews on the project's rung only, never reviews on a rung an E + I stepped up, nor of a chunk whose worker climbed above the project's rung. No code lowers a pass while no rung qualifies: on 2026-11-04 lilleman had the release review of 0.6.0 delete that code, which no chunk could reach. The chunk that first qualifies a rung writes that code again in `bin/model_routing/`. It records the qualifying rung for each pass and project model, and names the lowered pass in the worker's prompt and in rule-hook's `reviewer-rung`. For a rung off the ladder, such as the project's model at a lower effort, that chunk also sets the `effort` key in the reviewer's frontmatter under `agents/`, which sets the effort per reviewer.
|
||||
|
||||
The runs, each on the latest 10 rounds of Opus 5.5 projects that hold a 🔴 or 🟡:
|
||||
|
||||
- 2026-10-15, stability: 40 findings, 8 of the rounds from this repo. Opus 5.5 at medium, the project's rung, found 29 of them again. Sonnet 5.5 at high missed 13 of those 29, 2 of them 🔴. No rung qualifies.
|
||||
- 2026-10-18, prose: 39 findings. The project's rung found 27 of them again. Sonnet 5.5 at high missed 12 of those 27. No rung qualifies.
|
||||
- 2026-10-18, stability again, since that day's change to the reviewer prompts expired the first run: 29 findings. The project's rung found 20 of them again. Sonnet 5.5 at high missed 11 of those 20, 1 of them 🔴. No rung qualifies.
|
||||
- 2026-10-15, stability, under the old bar: 40 findings, 8 of the rounds from this repo. Opus 5.5 at medium, the project's rung, found 29 of them again. Sonnet 5.5 at high missed 13 of those 29, 2 of them 🔴. No rung qualifies.
|
||||
- 2026-10-18, prose, under the old bar: 39 findings. The project's rung found 27 of them again. Sonnet 5.5 at high missed 12 of those 27. No rung qualifies.
|
||||
- 2026-10-18, stability again, under the old bar, since that day's change to the reviewer prompts expired the first run: 29 findings. The project's rung found 20 of them again. Sonnet 5.5 at high missed 11 of those 20, 1 of them 🔴. No rung qualifies.
|
||||
- 2026-11-12, prose, under the new bar: 8 rounds, 55 findings, after 2 more rounds failed on the project's rung. The project's rung found 41 and then 43 of them, 76%, so the bar was 66%. Opus 5.5 at low effort found 27, 49%, and missed no 🔴 that both replays found. No rung qualifies, and Sonnet 5.5 at high was not tried.
|
||||
|
||||
The prose pass went first: a missed prose finding breaks no behaviour, and a later change fixes it cheaply. Sonnet 5.5 missed 44 to 55% of what the project's rung found again, in the prose pass as in both stability runs. Nothing suggests the other passes' findings are easier to find. So the architecture, principles, overrides and product-owner passes are not replayed yet: a replay would spend money with little chance of a qualifying rung (goal 1.4). `todo.md` item 196 keeps their replays in the plan. Every pass runs where `routing: a chunk's worker runs on the rung its item's L picks` puts every reviewer.
|
||||
The prose pass went first under the new bar: a missed prose finding breaks no behaviour, and a later change fixes it cheaply. Sonnet 5.5 missed 44 to 55% of what the project's rung found again, in the prose pass as in both stability runs, so it is unlikely to reach the new bar either; and Opus 5.5 at low, the likeliest rung, fell 17 points short on the pass whose misses cost least. The architecture, principles, overrides and product-owner passes are not replayed yet: `todo.md` item 196 keeps their replays in the plan.
|
||||
|
||||
Valid until a new model joins the ladder, which calls for a replay of every pass, or a pass's reviewer prompt changes, which calls for a replay of that pass.
|
||||
|
||||
@@ -525,7 +530,7 @@ Valid while a model switch inside a session discards its prompt cache.
|
||||
|
||||
2026-10-12, lilleman. Serves goals 1.2 and 1.3. Anthropic's best-practices page calls `CLAUDE.md` advisory and hooks deterministic, so a rule that must hold every time moves into `bin/rule-hook`, and `CLAUDE.md` keeps it only where the hook cannot check it. A Claude Code hook ties the check to one vendor ("Prefer the vendor-neutral option", `principles/technical-principles.md`), which is the target itself here: this repo configures Claude Code. What the tie buys: the hook blocks before a write lands, Edit and Write calls included, in every project with no per-repo install; a git `commit-msg` hook sees only commits, and CI sees them only after the push. The hook checks each write, so the agent fixes the line it just wrote; checking the staged diff at commit time would also cover files a Bash command writes, at the cost of later feedback. The marker's spelling was picked by a panel of three fresh readers, two to one. Each override is logged in the checkout's git directory, which is never pushed (goal 4). The plan had loop-claude's judge to rule on overrides inside a loop; lilleman approved larv-review's overrides pass in every run, because it rules before merge and an outrageous override still reaches the human through its ask. 2026-10-16, lilleman, answering plan item 166: no marker overrides `reviewer-rung`. 2026-11-04, lilleman: the title points at `rule-hook --help`, which lists every rule no marker overrides from the code, so the title can't drift from it; the comment above each in `bin/rule_hook/rules.py` says why. Valid while a PreToolUse hook that exits 2 blocks the call and hands its stderr to the model, and while an agent commits through Claude Code's Bash tool. 2026-11-11, lilleman: the hook also checks, at a `git commit`, each file the commit would commit against the rules that name a file, since a file a Bash command writes reaches no write check; the feedback comes at the commit, not at the write.
|
||||
|
||||
## agents/: a reviewer starts without `CLAUDE.md` only where a replay of its pass missed none of the findings two unchanged replays both found
|
||||
## agents/: a reviewer starts without `CLAUDE.md` only where a replay of its pass missed no more findings than the most an unchanged replay missed
|
||||
|
||||
2026-11-12, lilleman through todo item 315, implemented by claude. Serves goal 1.4, and applies project principle 1. About 77% of `CLAUDE.md` is the worker's, and each reviewer loaded it whole. `omitClaudeMd: true` in an agent's frontmatter starts it without the user, project and local instruction files. `settings.json` → `hooks.SubagentStart` runs `larv-review reviewer-context`, which hands such a reviewer the three sections of `~/.claude/CLAUDE.md` it needs: "Shared goal", which the agents cite, "Prose" and "Vocabulary". `larv-review reviewer-header` ends its header with a line naming the file that holds the project principles and decision titles, which the reviewer reads first.
|
||||
|
||||
@@ -535,22 +540,37 @@ Three choices in it:
|
||||
- The header names the principles file and doesn't quote it, since the worker types the header into each reviewer's prompt.
|
||||
- The frontmatter is the one switch. The hook and the header read it, so an agent that keeps `CLAUDE.md` is handed neither the sections nor the line.
|
||||
|
||||
The gate: `review-replay <pass> <model> --omit-claude-md` replays 10 archived rounds twice as archived and once without the instruction files. A pass's reviewer keeps `omitClaudeMd` only where the last replay missed none of the findings both of the others found. Two unchanged replays of one pass don't find the same findings: in the table below, each replay found between 22% and 100% of what the other found, and about 70% at the median. So one unchanged replay would not show the noise. A round that a replay fails on is left out of the comparison; the runs below predate that and counted such a replay as finding nothing. Claude Code 2.1.322 ignores `omitClaudeMd` in a main session and fires no `SubagentStart` hook there, and a replay runs the reviewer as one. So the replay sets `CLAUDE_CODE_DISABLE_CLAUDE_MDS` and puts the hook's context and the header's line in the prompt itself.
|
||||
The gate: `review-replay <pass> <model> --omit-claude-md` replays 10 archived rounds three times as archived and once without the instruction files. An unchanged reviewer finds only about 70% of its own findings again, at the median of the first table's replays, so each unchanged replay is a control: count the findings it missed that both of the other two found. The replay without the instruction files is held to the findings both of the first two replays found. A pass's reviewer keeps `omitClaudeMd` only where that replay missed no more of them than the highest of the three control counts. Item 315 first held the replay to no miss at all; the first table below shows four passes failing that, and the second shows unchanged replays missing as many. A round that a replay fails on is left out of the comparison. Claude Code 2.1.322 ignores `omitClaudeMd` in a main session and fires no `SubagentStart` hook there, and a replay runs the reviewer as one. So the replay sets `CLAUDE_CODE_DISABLE_CLAUDE_MDS` and puts the hook's context and the header's line in the prompt itself.
|
||||
|
||||
On 2026-11-12, on claude-opus-5-5 at medium effort:
|
||||
On 2026-11-12, on claude-opus-5-5 at medium effort, first gate (two unchanged replays, no control):
|
||||
|
||||
| Pass | 🔴 and 🟡 archived | Found with `CLAUDE.md`, twice | Both times | Found without | Missed of those found both times |
|
||||
|------|------|------|------|------|------|
|
||||
| architecture | 54 | 32, 33 | 27 | 30 | 4 |
|
||||
| overrides | no archived round | | | | |
|
||||
| principles | 30 | 2, 9 | 2 | 3 | 0 |
|
||||
| stability | 29 | 16, 13 | 11 | 18 | 1 |
|
||||
| product-owner | 23 | 7, 4 | 4 | 8 | 1 |
|
||||
| prose | 68 | 34, 36 | 24 | 39 | 1 |
|
||||
| overrides | no archived round | | | | |
|
||||
| stability | 29 | 16, 13 | 11 | 18 | 1 |
|
||||
|
||||
Only principles-auditor met the gate, so only it has `omitClaudeMd`. Its evidence is thin: two rounds of each replay failed, and two findings were found both times. Without `CLAUDE.md` each replayed reviewer found more findings than it found both times with it, and three of the five found more than in either replay with it. So the misses may be the reviewer's own noise; todo item 340 asks lilleman whether a gate with a control may decide the other five.
|
||||
Only principles-auditor met the first gate. Its evidence is thin: two rounds of each replay failed, and two findings were found both times. Without `CLAUDE.md` each replayed reviewer found more findings than it found both times with it, and three of the five found more than in either replay with it. So the misses may be the reviewer's own noise, which the second gate measures.
|
||||
|
||||
Valid while Claude Code honours `omitClaudeMd` for a subagent and passes `agent_type` to a `SubagentStart` hook, and until item 340 is answered.
|
||||
On 2026-11-12, second gate, with the control (three unchanged replays, then one without). Rounds a replay failed on are left out, so the counts differ from the first table's:
|
||||
|
||||
| Pass | Rounds kept of 10 | 🔴 and 🟡 archived | Found with `CLAUDE.md`, three replays | Missed by each, of what the other two found | Found without | Missed without, of what the first two found | Result |
|
||||
|------|------|------|------|------|------|------|------|
|
||||
| architecture | 9 | 46 | 37, 29, 36 | 2, 8, 1 | 32 | 3 | passes |
|
||||
| overrides | no archived round | | | | | | |
|
||||
| principles | 8 | 19 | 4, 4, 2 | 1, 0, 1 | 4 | 0 | passes |
|
||||
| product-owner | 8 | 21 | 7, 6, 11 | 1, 2, 0 | 7 | 1 | passes |
|
||||
| prose | 9 | 54 | 39, 38, 41 | 4, 4, 0 | 40 | 3 | passes |
|
||||
| stability | 6 | 16 | 6, 10, 8 | 3, 0, 2 | 6 | 2 | passes |
|
||||
|
||||
Every replayed pass passes the second gate. The unchanged replays alone missed up to 8 findings the other two found, so the first gate's one miss in stability, prose and product-owner is no more than an unchanged reviewer misses. The bar is the highest of the three controls. The third replay alone, which is held to the same findings as the replay without `CLAUDE.md`, missed 1 (architecture), 1 (principles), 0 (product-owner), 0 (prose) and 2 (stability); against it alone, architecture (3), product-owner (1) and prose (3) would fail.
|
||||
|
||||
2026-11-12, lilleman: every pass the second gate passed starts without `CLAUDE.md`, so principles-auditor, stability-reviewer, prose-reviewer, product-owner-reviewer and systems-architect have `omitClaudeMd`. override-reviewer keeps `CLAUDE.md`: no archived round of its pass exists to replay. Rerun the gate for a pass whose reviewer starts to miss findings; each pass rests on 6 to 9 rounds and one run.
|
||||
|
||||
Valid while Claude Code honours `omitClaudeMd` for a subagent and passes `agent_type` to a `SubagentStart` hook.
|
||||
|
||||
## rules/: `CLAUDE.md` holds the worker's rules that no file path can scope, and each topic's rules for the worker live in a `rules/` file that Claude Code loads by its `paths:` frontmatter
|
||||
|
||||
|
||||
@@ -1788,3 +1788,31 @@ Read most (opens and searches):
|
||||
- `bin/subagent_rung/main.py` 1
|
||||
- `bin/subagent_rung/test_subagent_rung.py` 1
|
||||
- `ci.sh` 1
|
||||
|
||||
## Reading cost, chunk ae13d485e994, finished 2026-11-12T10:25:08Z
|
||||
|
||||
97469 new input tokens before the first commit.
|
||||
|
||||
Read most (opens and searches):
|
||||
|
||||
- `bin/review_replay/test_review_replay.py` 15
|
||||
- `bin/review_replay/main.py` 11
|
||||
- `docs/decisions.md` 9
|
||||
- `todo.md` 7
|
||||
- `README.md` 4
|
||||
- `bin/model_routing/ladder.py` 4
|
||||
- `bin/review_replay/rounds.py` 4
|
||||
- `bin/review_replay/test_recall.py` 3
|
||||
- `CHANGELOG.md` 2
|
||||
- `skills/larv-review/SKILL.md` 2
|
||||
|
||||
## Reading cost, chunk 6b87a434c0e4, finished 2026-11-12T10:57:13Z
|
||||
|
||||
52887 new input tokens before the first commit.
|
||||
|
||||
Read most (opens and searches):
|
||||
|
||||
- `skills/larv-review/SKILL.md` 3
|
||||
- `docs/decisions.md` 2
|
||||
- `README.md` 1
|
||||
- `bin/review_replay/rounds.py` 1
|
||||
|
||||
@@ -82,10 +82,10 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h
|
||||
- **Round.** A round is one review by a pass's reviewer: the first and each re-entry. The rerun after the architect returns Stage 0 questions ("Architecture" below) and a relaunch one rung up ("Rung up" below) stay in their round.
|
||||
- **Auto-reviewer.** The external auto-reviewer (§4) is a pass of its own, each review it posts, up to the cap, a round. Its count is the number of its reviews on the PR, less its reviews of a `Record the comprehension check:` commit, and `round-count` doesn't list it. A commit that answers one of its rounds takes an ordinary title, not an `Answer <pass> round` one, and a round that didn't change anything gets no commit.
|
||||
- **Count.** Close each round of a pass other than the auto-reviewer with one commit that holds the round's fixes. Title it `Answer <pass> round <n>: <k> 🔴, <m> 🟡 (<j> misread); …`: `<pass>` is the pass's name in lower case, such as `full scan`, `<k>` and `<m>` are the 🔴 and 🟡 findings all the round's reviewers reported, and `<j>` is how many of those they marked `[misread]` (review-findings.md → "Misread"); a reviewer that marks none, such as `/security-review`, adds 0. Example: `Answer stability round 1: 1 🔴, 2 🟡 (1 misread); flag a deleted test`. A round that didn't change anything gets an empty commit (`git commit --allow-empty`). Push the commits when §4 runs next, where there is a remote. `~/.claude/bin/larv-review round-count` prints each pass's count and marks a pass at the cap.
|
||||
- **Done.** A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings", or settled in the PR summary per "Comprehension check" → "Places", or, for the prose pass and a pass at its cap, fixed. Resolve that round's 🟢s and ❓s per "Findings" too.
|
||||
- **Done.** A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings", or settled in the PR summary per "Comprehension check" → "Places", or, for the prose pass and a pass at its cap, fixed. A stability pass whose round's fixes skip the next round per "Re-entry" → "Mechanical answers" is done once that rule's run is clean. Resolve that round's 🟢s and ❓s per "Findings" too.
|
||||
- **Cap.** A pass takes at most two rounds per chunk, and the release review's architecture and principles passes five; don't ask the user for more. Answer its last round's findings per "Findings": those fixes merge once the gate passes, unreviewed by that pass. rule-hook's `round-cap` refuses a round commit that would take a pass past its cap, and no override waives it. A review the auto-reviewer posts after its second isn't a round: fix none of it and rerun no pass for it, but file a security finding it raises per `~/.claude/CLAUDE.md` → "Working loop", and any other 🔴 in `todo.md`.
|
||||
|
||||
**Re-entry.** A fix is a change no pass has seen. A fix for a 🟡, a 🟢, a ❓ or a prose finding reruns no pass, whatever it changes. A round's fixes for 🔴 findings re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4. A pass at its cap doesn't run again ("Round cap" → "Cap").
|
||||
**Re-entry.** A fix is a change no pass has seen. A fix for a 🟡, a 🟢, a ❓ or a prose finding reruns no pass, whatever it changes. A round's fixes for 🔴 findings re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4; "Mechanical answers" below names the one exception. A pass at its cap doesn't run again ("Round cap" → "Cap").
|
||||
|
||||
| The fix | Reruns |
|
||||
|---------|--------|
|
||||
@@ -98,6 +98,8 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h
|
||||
|
||||
A fix meets every row it fits. Prose has no row, so a comment or doc edit inside a fix doesn't rerun any pass. Example: a fix for a stability 🔴 that changes code and a comment reruns Principles and Stability.
|
||||
|
||||
**Mechanical answers.** A stability round's fixes may skip the next stability round. That holds where the round reported a 🔴, and each of its 🔴 and 🟡 findings asked only that a named mutant be killed or a named failing test pass. Run §2's tests and mutation command on the fixes, and fix again per §2 until they leave no failing test and no surviving mutant that changes behaviour. Each named failing test must pass as the round found it, not edited or deleted. Then the stability pass doesn't run again, and the round's answer commit title ends `; tests and mutants clean at <commit>`. The fixes still rerun each other pass whose row they meet. Where the run can't be made clean, or a fix edits a named failing test, the stability pass runs again as the table says.
|
||||
|
||||
**What a round reviews.** An agent under `~/.claude/agents/` reviews the branch in round 1. From round 2 it reviews only the answers to its last round's findings, and each fix from another pass that re-entered its pass. Prompt it with the path of its last round's report and each finding's answer: the fix's diff, or the reason it was dismissed. Give it each other pass's fix as `git diff <the commit before that fix> <the fix's commit>`, since the fixes may be unpushed, with the finding it answered. It reports only an answer that is plainly wrong or worse than the change it answered, so its pass converges in its second round. Other reviewers review the branch as their tool does.
|
||||
|
||||
**Rung up.** A reviewer rules the work below standard when its report holds systems-architect's BLOCK or a finding against `standards/quality.md`. A comprehension seat does when `record-ruling` counts one of its votes as worse.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Stability skip count
|
||||
|
||||
This count asks one question: would skipping stability round 2 have skipped a round that blocked, where round 1's findings each asked only that a named mutant be killed or a named failing test pass?
|
||||
It ran on 2026-11-12, over loop-claude's archive in `~/.claude/loop-claude-transcripts/`. `docs/decisions.md` → `review: a fix for a 🔴 reruns the pass that found it…` records what was decided from it, and `skills/larv-review/SKILL.md` §3 → "Re-entry" → "Mechanical answers" holds the rule.
|
||||
|
||||
## Terms
|
||||
|
||||
- **Report:** a stability-reviewer run in the archive, with the round number its launch names.
|
||||
- **Report before:** the previous report in the same archived cycle.
|
||||
- **Mechanical:** a finding that asks only that a named mutant be killed or a named failing test pass.
|
||||
|
||||
## Method
|
||||
|
||||
`python3 -I stability-skip-count/count.py` prints the totals, then each report of round 2 or later whose report before held a 🔴 and had every 🔴 and 🟡 line match mutant or test-failure wording, with that report's opening line and the report before's findings. The match casts wide; reading each printed round by hand decides which are mechanical. It reads only reports begun before its `UNTIL`, so a rerun on this machine prints the same counts. It needs the archive, which only the machine that ran the cycles holds.
|
||||
|
||||
## Results
|
||||
|
||||
- 326 reports of round 2 or later, from 13 projects; 81 open with BLOCK.
|
||||
- 5 reports before matched, and the round 2 after each of the 5 approved, so no BLOCK falls in a round the skip could skip.
|
||||
- Read by hand, 1 of the 5 is mechanical: fejkdata, 2026-11-04, a pin test that fails. The other 4 matched on wording alone: a test's structure, a workflow condition, a failing type check and a missed timing target.
|
||||
@@ -0,0 +1,81 @@
|
||||
"""Count the archived stability rounds of round 2 or later, their BLOCKs, and the rounds the skip in larv-review §3 → "Re-entry" → "Mechanical answers" could skip, printing each of those for reading by hand."""
|
||||
import collections
|
||||
import json
|
||||
import pathlib
|
||||
import re
|
||||
import sys
|
||||
|
||||
ARCHIVE = pathlib.Path.home() / ".claude/loop-claude-transcripts"
|
||||
# The count recorded in README.md and docs/decisions.md read the reports that began before this; later ones would change it.
|
||||
UNTIL = "2026-11-12T10:50:00Z"
|
||||
# A line that opens a 🔴 or 🟡 finding, after any list, number or heading marks.
|
||||
FINDING = re.compile(r"^\s*(?:[-*]\s*|\d+\.\s*|#+\s*)*(?:\*\*)?(🔴|🟡)")
|
||||
# Wording of a finding that names a surviving mutant or a failing test. It casts wide; the hand reading decides.
|
||||
MECHANICAL = re.compile(r"surviv|mutant|fail(s|ing|ed)? (test|on)|test (fails|failed|failing)|tests? (still )?fail|\bred\b|suite (is red|fails)", re.I)
|
||||
# A report whose verdict line, at the start of a line, says BLOCK. A verdict stated mid-sentence isn't counted, so each printed round shows its opening line too.
|
||||
BLOCK = re.compile(r"^\W*(Verdict:?\s*)?\**BLOCK", re.M)
|
||||
|
||||
|
||||
def text_of(message: dict) -> str:
|
||||
"""The text parts of a transcript message."""
|
||||
content = message.get("content")
|
||||
if isinstance(content, str):
|
||||
return content
|
||||
return "\n".join(part.get("text", "") for part in content or [] if isinstance(part, dict) and part.get("type") == "text")
|
||||
|
||||
|
||||
def parsed(transcript: str) -> list[dict]:
|
||||
"""A transcript's entries, one JSON object a line. str.splitlines would also split at the U+2028 a message may hold. A transcript of a cycle still running may end in a line half written, which is left out."""
|
||||
lines = [line for line in transcript.split("\n") if line.strip()]
|
||||
try:
|
||||
return [json.loads(line) for line in lines]
|
||||
except json.JSONDecodeError:
|
||||
return [json.loads(line) for line in lines[:-1]]
|
||||
|
||||
|
||||
def rounds() -> list[dict]:
|
||||
"""Each archived stability-reviewer run: its project, its cycle folder, when it began, the round its launch names, whether its last text opens with BLOCK, and its finding lines."""
|
||||
found = []
|
||||
for meta_path in ARCHIVE.glob("*/*/session/*/subagents/*.meta.json"):
|
||||
meta = json.loads(meta_path.read_text())
|
||||
if meta.get("agentType") != "stability-reviewer":
|
||||
continue
|
||||
entries = parsed(meta_path.with_name(meta_path.name.removesuffix(".meta.json") + ".jsonl").read_text())
|
||||
users = [entry for entry in entries if entry.get("type") == "user"]
|
||||
prompt = text_of(users[0]["message"]) if users else ""
|
||||
texts = [text_of(entry["message"]) for entry in entries if entry.get("type") == "assistant"]
|
||||
last = next((text for text in reversed(texts) if text.strip()), "")
|
||||
number = re.search(r"[Rr]ound (\d+)", meta.get("description", "") + " " + prompt[:600])
|
||||
found.append({
|
||||
"project": meta_path.parts[-6],
|
||||
"cycle": meta_path.parts[-5],
|
||||
"at": entries[0].get("timestamp", "") if entries else "",
|
||||
"round": int(number.group(1)) if number else 0,
|
||||
"block": bool(BLOCK.search(last)),
|
||||
"opens": last.strip().split("\n")[0][:120],
|
||||
"findings": [line.strip() for line in last.splitlines() if FINDING.match(line)],
|
||||
})
|
||||
return found
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Print the totals, then each report of round 2 or later where the report before it, in the same cycle, held a 🔴 and every 🔴 and 🟡 line of that report before reads as mechanical."""
|
||||
if not ARCHIVE.is_dir():
|
||||
sys.exit(f"No archive at {ARCHIVE}: the count reads loop-claude's transcripts on the machine that ran them.")
|
||||
every = [run for run in rounds() if run["at"] < UNTIL]
|
||||
later = [run for run in every if run["round"] >= 2]
|
||||
print(f"{len(later)} reports of round 2 or later, {sum(run['block'] for run in later)} opening with BLOCK, from {len({run['project'] for run in later})} projects")
|
||||
by_cycle = collections.defaultdict(list)
|
||||
for run in every:
|
||||
by_cycle[(run["project"], run["cycle"])].append(run)
|
||||
for runs in by_cycle.values():
|
||||
runs.sort(key=lambda run: run["at"])
|
||||
for before, run in zip(runs, runs[1:]):
|
||||
reds = [line for line in before["findings"] if "🔴" in line[:12]]
|
||||
if run["round"] >= 2 and reds and all(MECHANICAL.search(line) for line in before["findings"]):
|
||||
print(f"\n{run['project']} {run['at'][:16]} round {run['round']}, opening: {run['opens']}")
|
||||
for line in before["findings"]:
|
||||
print(f" before: {line[:300]}")
|
||||
|
||||
|
||||
main()
|
||||
@@ -12,10 +12,6 @@
|
||||
|
||||
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 340 | 0.9.0 | | question | **Decide whether a reviewer may start without `CLAUDE.md` where its replay misses no more findings than an unchanged replay does.** | 2 | 2 | 3 | 5 | 4 | 1.4 by 5 | 1.7 |
|
||||
| 331 | 0.9.0 | | question | **Reword four decisions to expire when the rungs their replays tested change, not whenever a model joins the ladder.** | 1 | 1 | 1 | 1 | 2 | 1.4 by 2 | 0.9 |
|
||||
| 318 | 0.9.0 | | | **Let `review-replay` qualify a rung whose recall is no lower than the project's rung's own replay, and replay Opus 5.5 at low effort on the prose pass.** | 3 | 2 | 3 | 6 | 4 | 1.4 by 5 | 1.7 |
|
||||
| 308 | 0.9.0 | | | **Skip a stability round 2 whose every must-fix finding named a surviving mutant or a failing test, both of which the worker now checks before review.** | 3 | 2 | 3 | 6 | 4 | 1.4 by 3, 1.5 by 2 | 1.6 |
|
||||
| 319 | 0.9.0 | | | **Start a fresh session with a brief of the chunk when a rung step changes the worker's model, in place of resuming the old session.** | 3 | 2 | 3 | 6 | 4 | 1.1 by 2, 1.4 by 2 | 1.4 |
|
||||
| 309 | 0.9.0 | | | **Run a scoring run's second pass on one head with two seats in place of four, once `larv-review agreement` shows the seats agree with each other more than a run agrees with its rerun.** | 2 | 2 | 2 | 4 | 2 | 1.4 by 3 | 1.3 |
|
||||
| 299 | 0.9.0 | | | **Replay the archived judge verdicts through code rules and a classifier trained locally on the archive, and file an item for each verdict kind one of them decides with no missed interrupt.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3 | 1.2 |
|
||||
@@ -25,6 +21,7 @@
|
||||
| 341 | 0.9.0 | | | **Hand each worker's claude a lower Read limit through `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`, kept only where replays of the archived review rounds find what two unchanged replays find.** | 2 | 2 | 3 | 5 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 310 | 0.9.0 | | | **Compact a waiting worker's session shortly before its prompt cache expires, only when the human has not answered an interrupt by then.** | 3 | 2 | 3 | 6 | 4 | 1.4 by 3 | 1.0 |
|
||||
| 298 | 0.9.0 | | | **Send the judge only the decision entries and the transcript tail a verdict needs, and keep the cut only where `judge-replay` changes no verdict kind.** | 3 | 3 | 3 | 7 | 4 | 1.4 by 2, 1.5 by 1 | 1.0 |
|
||||
| 331 | 0.9.0 | | | **Reword four decisions to expire when the rungs their replays tested change, not whenever a model joins the ladder.** | 1 | 1 | 1 | 1 | 2 | 1.4 by 2 | 0.9 |
|
||||
| 327 | 0.9.0 | | | **Have `larv-review` print a round commit's title prefix, counted from the round's report, and have rule-hook refuse a round title whose counts differ from it.** | 3 | 2 | 3 | 6 | 4 | 1.1 by 1, 1.4 by 1 | 0.7 |
|
||||
| 303 | 0.10.0 | | defect | **Archive each judge run's prompt and json reply beside the verdict it gave, so judge cost, replays and backups cover the judge as they cover the worker.** | 2 | 2 | 3 | 5 | 3 | 1.4 by 3, 3 by 2 | 4.8 |
|
||||
| 304 | 0.10.0 | 303 | defect | **Archive each review-replay and judge-replay run's transcript beside its result, so a replay that decided a rung can be checked and re-priced later.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 2, 3 by 2 | 4.4 |
|
||||
@@ -34,7 +31,8 @@
|
||||
| 338 | 0.10.0 | | owner | **Script each step that 0.9.0's chunks repeated by hand and a program can compute, filing one item per step, and file this audit again for the next release.** | 1 | 2 | 1 | 2 | 2 | 1.4 by 3, 1.5 by 3 | 2.6 |
|
||||
| 288 | 0.10.0 | | | **Point the two reading-cost decisions at code health and goal 1.4's counter-signal, in place of the goal 1.1 they cite.** | 1 | 2 | 1 | 2 | 1 | code health by 1, 1.4 by 1 | 2.6 |
|
||||
| 77 | 0.10.0 | | | **Teach `bin/metric-bench` Go and TypeScript, rerun it once two projects' comprehension histories name places, and bring into review only a metric that tracks the panel.** | 4 | 2 | 1 | 5 | 6 | 1.1 by 7, 1.4 by 7 | 2.4 |
|
||||
| 321 | 0.10.0 | 318 | | **Evaluate the review passes that run on a rung item 318 qualified, against the chunks before them, and revert any pass whose findings or later fixes worsened.** | 1 | 2 | 1 | 2 | 2 | 1.1 by 3, 1.4 by 2 | 2.3 |
|
||||
| 196 | 0.10.0 | | decision | **Replay the architecture, principles, overrides and product-owner passes with `review-replay` on Opus 5.5 projects, record each run in the review-replay routing decision, and, where a run qualifies a rung, add back the code that lowers a pass to it.** | 2 | 2 | 3 | 5 | 2 | 1.4 by 3 | 1.3 |
|
||||
| 321 | 0.10.0 | 196 | decision | **Evaluate the review passes that run on a rung `review-replay` qualified, against the chunks before them, and revert any pass whose findings or later fixes worsened.** | 1 | 2 | 1 | 2 | 2 | 1.1 by 3, 1.4 by 2 | 2.3 |
|
||||
| 273 | 0.10.0 | | decision | **Re-tune the E + I steps of `REVIEW_STEPS` for 6 to 8 once 10 finished chunks have scored an E + I of 6 or more, from how well E + I orders their review rounds and 🔴 findings.** | 1 | 2 | 2 | 3 | 2 | 1.1 by 2, 1.4 by 3 | 2.3 |
|
||||
| 268 | 0.10.0 | | | **End a run whose release is ready to cut with a notice on loop-claude's terminal, in place of an interrupt that waits for an answer.** | 2 | 2 | 3 | 5 | 3 | 1 by 5 | 2.2 |
|
||||
| 171 | 0.10.0 | | decision | **Group the routing figures' review rounds by the reviewers' rung as well as the worker's, so a call blames a rung only for rounds its own reviews raised.** | 3 | 2 | 2 | 5 | 4 | 1.2 by 3, 1.4 by 3 | 2.0 |
|
||||
@@ -51,7 +49,6 @@
|
||||
| 5 | 0.10.0 | | decision | **Key a project on its checkout's full path, and refuse to start while another session uses that key.** | 4 | 2 | 3 | 7 | 5 | 1.1 by 6 | 1.6 |
|
||||
| 291 | 0.10.0 | | owner | **Let `principles/technical-principles.md` → "Sane defaults" allow a library whose README goals ask that it work with no config to default the clock and randomness in its public constructor, where a documented option overrides each.** | 1 | 2 | 3 | 4 | 1 | 1.2 by 3 | 1.4 |
|
||||
| 156 | 0.10.0 | | decision | **Drop `rank_todo.py`'s ranking of an old-shape table once no project under `~/code` holds one.** | 2 | 1 | 3 | 4 | 4 | 1.1 by 4 | 1.4 |
|
||||
| 196 | 0.10.0 | | decision | **Replay the architecture, principles, overrides and product-owner passes with `review-replay` on Opus 5.5 projects, record each run in the review-replay routing decision, and, where a run qualifies a rung, add back the code that lowers a pass to it.** | 2 | 2 | 3 | 5 | 2 | 1.4 by 3 | 1.3 |
|
||||
| 260 | 0.10.0 | | decision | **Compare the first 20 chunks whose worker got the reading rule with the 20 before them, on review rounds past each pass's first, unfinished verdicts, 🔴, 🟡 and misread findings, dollars and hours per chunk, and drop the rule where any rose.** | 1 | 2 | 1 | 2 | 2 | 1.4 by 3 | 1.3 |
|
||||
| 51 | 0.10.0 | | principle | **Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints.** | 2 | 1 | 3 | 4 | 5 | 1.1 by 5 | 1.3 |
|
||||
| 201 | 0.10.0 | | owner | **Save the human's tmux setups and restore them after a reboot, so work is up and running again quickly.** | 3 | 2 | 1 | 4 | 4 | 1.5 by 4 | 1.3 |
|
||||
@@ -70,37 +67,6 @@
|
||||
|
||||
## Details
|
||||
|
||||
### 340. Decide whether a reviewer may start without `CLAUDE.md` where its replay misses no more findings than an unchanged replay does.
|
||||
|
||||
Item 315's gate kept `omitClaudeMd` only where a replay without `CLAUDE.md` found every finding that two unchanged replays both found. Read so, five passes failed it on 2026-11-12: stability missed 1 of 11, prose 1 of 24, product-owner 1 of 4, architecture 4 of 27, and overrides had no archived round to replay. The decision `agents/: a reviewer starts without CLAUDE.md only where a replay of its pass missed none of the findings two unchanged replays both found` holds the figures.
|
||||
|
||||
The question for lilleman: does a miss that small show a loss, or the reviewer's own noise? The unchanged reviewer finds only about 70% of its findings again, so a third unchanged replay would also miss some that the other two found, and the gate as written can't tell the two apart.
|
||||
|
||||
Recommended: give `review-replay --omit-claude-md` a control. It replays each round three times unchanged and once without `CLAUDE.md`, and prints for each unchanged replay how many findings it missed that the other two found. The reviewer may start without `CLAUDE.md` where its own count is no higher than the highest of those three. Then run it for the five passes, and add `omitClaudeMd: true` to each agent that passes; the hook and the header already serve any agent that has it. Each run costs four replays of 10 rounds on the project's model.
|
||||
|
||||
### 331. Reword four decisions to expire when the rungs their replays tested change, not whenever a model joins the ladder.
|
||||
|
||||
The architect's 🔀 answer on PR #493 (item 292): four decisions expire "when a new model joins the ladder". Fable 5.2 joined above every project model's rung, and none of these replays tested a rung above the project's, so the event fired with nothing new to test. Every later ladder rebuild would fire all four again.
|
||||
|
||||
- `review: each pass keeps a reviewer of its own`: the merge trials ran on Opus 5.5 at medium. Reword the "Valid" line to name that rung.
|
||||
- `review: the principles audit runs only in the release review…`: its trial ran on the project's rung. Reword the line to name that rung.
|
||||
- `routing: a review pass runs below the project's rung only on a rung that a replay…`: `review-replay` tests only rungs below the project's rung. Have the line expire when those rungs change, the event item 196 names ("until a cheaper model joins the ladder").
|
||||
- `routing: on a model judge-replay covered, the judge runs…`: the replays tested the project's rung and below, and each rung above it that a review climbs to. Have the line expire when those rungs change.
|
||||
|
||||
Recommendation: reword all four as above. They are decisions the repo held before item 292, so the rewording is lilleman's call.
|
||||
|
||||
### 318. Let `review-replay` qualify a rung whose recall is no lower than the project's rung's own replay, and replay Opus 5.5 at low effort on the prose pass.
|
||||
|
||||
Today a rung qualifies only if it re-finds every finding the project's rung found. The project's rung itself re-finds only 69 to 73% of its own findings on a replay (29 of 40, 27 of 39, 20 of 29), so even a reviewer exactly as good would fail, and "no pass has such a rung" says less than it seems. Qualify a rung when its share of the archived findings is no lower than the project's rung's own replay share, within a margin, over enough rounds, and it misses no 🔴 that both project-rung runs found. Then replay Opus 5.5 at low effort on the prose pass first, the pass whose misses cost least; the `effort` frontmatter key sets it per reviewer.
|
||||
|
||||
lilleman approved on 2026-11-11 as somewhat risky, with a close evaluation in the next release: item 321. Revise the decision `routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows finding every 🔴 and 🟡 the project's rung finds…`, and its title at the head of `docs/decisions.md`.
|
||||
|
||||
### 308. Skip a stability round 2 whose every must-fix finding named a surviving mutant or a failing test, both of which the worker now checks before review.
|
||||
|
||||
Rounds past the first cost $846 of the $9,154 the archive measured from 2026-09-30 to 2026-11-11; stability's were $281 over 440 runs. Now that the worker runs `mutate-changes` before each stability round (`skills/larv-review/SKILL.md` §2 → "Mutation tests"), a 🔴 that named a surviving mutant or a failing test has a mechanical answer: a run of `mutate-changes` on the fix shows the mutant killed, or the test passes. A round 2 whose every 🔴 and 🟡 is of that kind needs no reviewer.
|
||||
|
||||
Round 2 still matters elsewhere: 53 of 241 archived stability reports of round 2 or later open with BLOCK. So first count, from the archived round 2s, the BLOCKs that a run of `mutate-changes` and the tests on the fix would not have raised, and ship the skip only if none falls in a round it would skip. Evidence: one review round scored F1 0.376 and a second 0.26 to 0.30 with more false positives (arXiv 2603.16244, `claude -p` with Opus 4.6, 30 artifacts). Revise larv-review §3 → "Re-entry" and the decision `review: a fix for a 🔴 reruns the pass that found it…`.
|
||||
|
||||
### 319. Start a fresh session with a brief of the chunk when a rung step changes the worker's model, in place of resuming the old session.
|
||||
|
||||
On SWE-bench Verified with Haiku 4.5 and Opus 4.7, handing the strong model the weak model's transcript solved 69.2% at $1.61 a task; starting the strong model fresh solved 79.2% at $0.90 (arXiv 2608.24358, The Handoff Tax). A model switch also rereads the whole context uncached (Claude Code prompt caching docs). A worker that steps from Sonnet 5.5 to Opus 5.5 by `--resume` is the raw handoff; an effort-only step within one model keeps the cache and isn't. The escalated subagent, which starts fresh with the trigger's evidence, already follows the pattern that won.
|
||||
@@ -141,7 +107,7 @@ Raised by item 312's research round, 2026-11-12. Over the 53 chunks archived sin
|
||||
|
||||
loop-claude can hand it as it hands `CLAUDE_CODE_AUTO_COMPACT_WINDOW`, and subagents inherit it, the principles auditors included. The choice of 2026-10-27 that the principles audit reads the project whole holds as long as it pages through what it reads.
|
||||
|
||||
The replay: give `review-replay` a way to set the variable, then replay the archived prose, stability, product-owner and principles rounds at 5,000 tokens, beside two unchanged replays of the same rounds. Keeps quality where each pass finds every finding the two unchanged replays both find, or meets item 340's control where that has landed. Keep it only where the replays' Read characters also fall; item 311's stability replay can share the baseline runs.
|
||||
The replay: give `review-replay` a way to set the variable, then replay the archived prose, stability, product-owner and principles rounds at 5,000 tokens, beside two unchanged replays of the same rounds. Keeps quality where each pass finds every finding the two unchanged replays both find, or misses no more than the most an unchanged replay misses, as `review-replay --omit-claude-md` counts it. Keep it only where the replays' Read characters also fall; item 311's stability replay can share the baseline runs.
|
||||
|
||||
### 310. Compact a waiting worker's session shortly before its prompt cache expires, only when the human has not answered an interrupt by then.
|
||||
|
||||
@@ -155,6 +121,17 @@ Probe first that `claude -p "/compact" --resume <id>` compacts a session: the Ag
|
||||
|
||||
153 `Judge cost:` entries total $109.76, a median of about $0.76 a verdict at every rung, and the cost follows the size of the records, not the transcript: about 76k characters in log and 188k in claude-config. In 224 of 251 recent verdicts (89%) the evidence sits in the worker's final message. A missed interrupt is the costly error, so the bar is zero changed interrupts and zero new rejections across the replay. The judge is about 4.5% of dollars, so the saving is small; each cycle also gets faster.
|
||||
|
||||
### 331. Reword four decisions to expire when the rungs their replays tested change, not whenever a model joins the ladder.
|
||||
|
||||
The architect's 🔀 answer on PR #493 (item 292): four decisions expire "when a new model joins the ladder". Fable 5.2 joined above every project model's rung, and none of these replays tested a rung above the project's, so the event fired with nothing new to test. Every later ladder rebuild would fire all four again.
|
||||
|
||||
- `review: each pass keeps a reviewer of its own`: the merge trials ran on Opus 5.5 at medium. Reword the "Valid" line to name that rung.
|
||||
- `review: the principles audit runs only in the release review…`: its trial ran on the project's rung. Reword the line to name that rung.
|
||||
- `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay…`: `review-replay` tests only rungs below the project's rung. Have the line expire when those rungs change, the event item 196 names ("until a cheaper model joins the ladder").
|
||||
- `routing: on a model judge-replay covered, the judge runs…`: the replays tested the project's rung and below, and each rung above it that a review climbs to. Have the line expire when those rungs change.
|
||||
|
||||
lilleman approved rewording all four as above on 2026-11-12.
|
||||
|
||||
### 327. Have `larv-review` print a round commit's title prefix, counted from the round's report, and have rule-hook refuse a round title whose counts differ from it.
|
||||
|
||||
The 0.8.0 audit (item 284) measured, over the 35 chunks that shipped 0.7.0: 72 commit calls in 33 chunks titled `Answer <pass> round <n>: R 🔴, Y 🟡 (K misread); <what changed>`, about 11k command tokens, most of them the summary. Each worker counts R, Y and K by hand. All three are in the round's report, `<pass>-round-<n>.md` in the review folder: R and Y are its finding headings, and K counts the findings the reviewer marked `[misread]`, as `bin/review_rules/round_titles.py` says. That module parses the counts for `score-outcomes`, which reports them as goal 1.1's signal, and rule-hook's `round_cap.py` checks only the round number, so nothing checks today that the counts match the report. Of the 8 titles whose report the audit could match, none miscounted; one report wrote its markers at line start rather than in `###` headings, so the reports' format varies by reviewer.
|
||||
@@ -243,9 +220,13 @@ Claude's misses ranked the named units at a coin toss. Top k scores 0.50 by chan
|
||||
|
||||
Claude's answers overlapped the truth by a median Jaccard index of 0.76. A run took in 62,643 new input tokens and cost $0.70; it did not record which model answered. Grep answers these questions whatever the code's shape, so no question enters review; a new question bench would need questions that take understanding the code, not finding it.
|
||||
|
||||
### 321. Evaluate the review passes that run on a rung item 318 qualified, against the chunks before them, and revert any pass whose findings or later fixes worsened.
|
||||
### 196. Replay the architecture, principles, overrides and product-owner passes with `review-replay` on Opus 5.5 projects, record each run in the review-replay routing decision, and, where a run qualifies a rung, add back the code that lowers a pass to it.
|
||||
|
||||
lilleman, 2026-11-11: item 318's new bar is a risk, so check it closely a release later. Compare the first 20 chunks reviewed on each newly qualified rung with the 20 before: review rounds past the first, 🔴 and 🟡 per chunk, misread findings, and later fixes that `score-outcomes` counts (defects that escaped review). Revert a pass to the project's rung where any of those worsened beyond the spread of the 20 before.
|
||||
Item 159's chunk, PR #322, replayed only the prose and stability passes. Sonnet 5.5 at high missed 44 to 55% of what the project's rung found again in each, so the agent judged a replay of the other four unlikely to qualify a rung. The product-owner review of PR #322 asked that the plan keep them, so the ranking decides when they run. Each run costs hours of reviewer replays (goal 1.4), so the score keeps it low until a cheaper model joins the ladder. `docs/decisions.md` → `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay…` records the runs so far. The release review of 0.6.0 deleted the code that lowered a pass, since no rung had qualified; the decision says where it goes back.
|
||||
|
||||
### 321. Evaluate the review passes that run on a rung `review-replay` qualified, against the chunks before them, and revert any pass whose findings or later fixes worsened.
|
||||
|
||||
The prose pass's replay under item 318's new bar, on 2026-11-12, qualified no rung, so this item waits for item 196's replays of the other passes. lilleman, 2026-11-11: that bar is a risk, so check it closely a release later. Compare the first 20 chunks reviewed on each newly qualified rung with the 20 before: review rounds past the first, 🔴 and 🟡 per chunk, misread findings, and later fixes that `score-outcomes` counts (defects that escaped review). Revert a pass to the project's rung where any of those worsened beyond the spread of the 20 before.
|
||||
|
||||
### 273. Re-tune the E + I steps of `REVIEW_STEPS` for 6 to 8 once 10 finished chunks have scored an E + I of 6 or more, from how well E + I orders their review rounds and 🔴 findings.
|
||||
|
||||
@@ -357,10 +338,6 @@ The key names the project's session, archive folder and models entry. `project_k
|
||||
|
||||
While `rank_todo.py` ranks two shapes, projects follow two sets of scoring rules, against goal 1.3. Once every project has reshaped, drop `OLD_SHAPE`'s weighing from `bin/release_plan/ranking.py`, `RESHAPE`, and the old shape's lines in `rank_todo.py --help` and `rules/todo-items.md`. Keep `todo_table` reading old tables: `score_outcomes` reads every past merge's `todo.md`. PR #283's paired ruling found the old-shape path made `ranking.py`'s `score`, `Scoring.weights`, `unknown_columns` and `todo_table.py`'s `Moves` harder to read; leave each easier, with one shape and moves that are always moves, and the Moves cell's rules in one place. Release 0.3.0's seats named `ranking.py`'s `score`, `weigh` and `rank` and `todo_table.py`'s `OLD_SHAPE` for the same fork: "every rule exists twice for the old table shape" (Mid A). Make `weigh` and `rank` easier to read too.
|
||||
|
||||
### 196. Replay the architecture, principles, overrides and product-owner passes with `review-replay` on Opus 5.5 projects, record each run in the review-replay routing decision, and, where a run qualifies a rung, add back the code that lowers a pass to it.
|
||||
|
||||
Item 159's chunk, PR #322, replayed only the prose and stability passes. Sonnet 5.5 at high missed 44 to 55% of what the project's rung found again in each, so the agent judged a replay of the other four unlikely to qualify a rung. The product-owner review of PR #322 asked that the plan keep them, so the ranking decides when they run. Each run costs hours of reviewer replays (goal 1.4), so the score keeps it low until a cheaper model joins the ladder. `docs/decisions.md` → `routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows finding every 🔴 and 🟡 the project's rung finds…` records the runs so far. The release review of 0.6.0 deleted the code that lowered a pass, since no rung had qualified; the decision says where it goes back.
|
||||
|
||||
### 260. Compare the first 20 chunks whose worker got the reading rule with the 20 before them, on review rounds past each pass's first, unfinished verdicts, 🔴, 🟡 and misread findings, dollars and hours per chunk, and drop the rule where any rose.
|
||||
|
||||
Start once 20 chunks have run under the rule. The rule is `READING_RULE` in `bin/loop_claude/cycle/prompts.py`, which every fresh worker prompt holds; `git log --first-parent -S READING_RULE` on the default branch finds the merge that added it. A chunk got it when its first worker started after that merge. Measure as `docs/decisions.md` → `loop-claude: the worker's claude compacts its context before it fills a 200k window…` measured the window: rounds past each pass's first and the 🔴, 🟡 and misread counts from the round commit titles, unfinished verdicts from the outcomes files, hours from the worker's first message to its last, and dollars from the chunk's `cost-state` entry. Compare means, since the decision weighs the rule by all spend.
|
||||
|
||||
Reference in New Issue
Block a user