Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e705fd8867 | |||
| d5a9576fff | |||
| c8c3702eb8 | |||
| 6a617f5a2c | |||
| 3f7f4e74fc | |||
| 7b10fd6e58 | |||
| d97846c60e | |||
| 0a26bcb807 | |||
| 9a260d22c0 | |||
| 14e6756a53 | |||
| 7e29dc0014 | |||
| 95fb0d03cf | |||
| 5c37027046 | |||
| 9066f477a4 | |||
| 41e91e341c | |||
| 913accfe14 | |||
| fba48f324c | |||
| 62faf321ce | |||
| 76348eac2e | |||
| 8f8d340c09 | |||
| a4fc833b2b | |||
| 59a8fe9f45 | |||
| 74f3199df1 | |||
| d2ca49bf00 | |||
| e3a6ae0e42 | |||
| bad2f0c555 | |||
| d81da4d413 | |||
| 545a57f01c | |||
| 4ab80160b6 | |||
| 2fa7040006 | |||
| 18a73b1bf1 | |||
| 6156e0b9cc | |||
| 08d4be4bae | |||
| b2ddebce7a | |||
| a61afc567d | |||
| 1f31ebd8ac |
@@ -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
|
||||
|
||||
+5
-1
@@ -2,6 +2,10 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- larv-review takes an item as a floor item only where its tagline opens with `Reach the comprehension floor:`. A tagline that quotes the floor elsewhere, such as in a decision title, no longer makes its chunk due a scoring run. Reword each open floor item's tagline in every project's `todo.md` to open with the phrase.
|
||||
|
||||
## 0.9.0
|
||||
|
||||
- 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.
|
||||
@@ -13,7 +17,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, 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 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. `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.
|
||||
@@ -134,7 +134,7 @@ Install puts only `loop-claude` and `loop-inbox` on `PATH`; call the others by t
|
||||
- `loop_state/` holds the files loop-claude and loop-inbox share: the question files (`waiting/`), the files a running loop lists itself in (`running_loops.py`, `session_lock.py`), their paths, and `hand_over.py`, which opens claude for `/talk`. A change to any of them changes both tools.
|
||||
- `machine_load/` takes the machine's heavy slots, its shared lock files, for `run_heavy`, and reads the memory share that loop-claude waits for. It also gives `mutate_changes` a slot's CPU count.
|
||||
- `mattermost_dm/` sends the human a Mattermost DM, for `mattermost-dm` and for loop-claude through `loop_effects`.
|
||||
- `model_routing/` holds the routing ladder, which loop-claude, `rule_hook`, both replay tools and `subagent-rung` read.
|
||||
- `model_routing/` holds the routing ladder, which loop-claude, `rule_hook`, both replay tools and `subagent-rung` read, and the list prices, which `routing_figures` and `transcript_archive` read.
|
||||
- `rank_todo.py`, `settings_filter.py` and `statusline.py` are tools of one file each, tested beside them.
|
||||
- `records/` reads a Markdown file's `##` sections, quotes a passage and joins names into a list, stamps times in UTC, and replaces a file in one step, private where it is new.
|
||||
- `release_plan/` reads `todo.md`'s items table and release versions, says which release is next and whether it is ready to cut (`release_standing.py`), and ranks the plan (`ranking.py`, with its score formula in `formula.py` and its blocker order in `blockers.py`). `plan_file.py` reads, ranks, checks and writes a `todo.md`, for `larv_review`, `rank_todo.py`, `rule_hook` and `todo_item`.
|
||||
@@ -149,7 +149,7 @@ Install puts only `loop-claude` and `loop-inbox` on `PATH`; call the others by t
|
||||
|
||||
Test on the host with `bin/run-tests`, which runs pytest through `uvx`, pinned in `bin/run_tests/main.py`. It prints each failing test with its error and pytest's summary line, and saves the whole output to a file whose path it prints. It passes on any test paths or pytest options it is given, such as `bin/run-tests bin/chunk_pr -x`. It needs `uv` on `PATH`, which fetches pytest, pytest-xdist and mypy. pytest-xdist runs the tests in one worker per CPU of a heavy slot (`docs/decisions.md` → `bin/: the tools support only the latest stable Python, …`). `python3 -m unittest discover -s bin -p 'test_*.py'` runs the same tests one at a time. Test the bench's scripts with `python3 -m unittest discover -s workflow-bench -p 'test_*.py'`.
|
||||
|
||||
CI runs `ci.sh` on every pull request, and `main` merges nothing until it passes. The script runs the same tests on the committed HEAD in a pinned Python container; run it under `run-heavy` to reproduce a CI failure, with Docker on `PATH`.
|
||||
CI runs `ci.sh` on every pull request, and `main` doesn't merge anything until it passes. The script runs the same tests on the committed HEAD in a pinned Python container; run it under `run-heavy` to reproduce a CI failure, with Docker on `PATH`.
|
||||
|
||||
To mutation-test the lines a branch changes, run `~/.claude/bin/run-heavy ~/.claude/bin/mutate-changes --prefix 'uvx --python "$(command -v python3)" --with pytest==9.2.0 --from "mutmut>=3,<4"'` in its checkout.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ pull request only while its head is the commit checked out, so push before you r
|
||||
open pushes the branch, setting its upstream, and opens a draft pull request into origin's
|
||||
default branch. <title> is one line, as ~/.claude/CLAUDE.md → "Git, commits, and PRs"
|
||||
says, and <body> is the pull request's summary. Where the branch's pull request is open
|
||||
already, it opens no second one. On origin's default branch it refuses, pushing nothing.
|
||||
already, it opens no second one. On origin's default branch it refuses without pushing anything.
|
||||
sync fetches origin and merges its default branch into the branch checked out, where the
|
||||
branch does not hold it already, and prints which it did. Then, where the worktree's root
|
||||
holds a todo.md, it runs `rank_todo.py --check` on it and prints the result, failing where
|
||||
@@ -35,7 +35,7 @@ clean acts once the forge reports the branch's pull request merged at the com
|
||||
by any merge method. It fetches origin, fast-forwards the main checkout to origin's
|
||||
default branch, removes the chunk's worktree, then deletes the local branch; origin's
|
||||
branch stays. Where the worktree has uncommitted or untracked files, it refuses and
|
||||
touches nothing. Where the main checkout has uncommitted or untracked files, another
|
||||
doesn't touch anything. Where the main checkout has uncommitted or untracked files, another
|
||||
branch checked out, or commits origin's default branch lacks, it leaves that as it was,
|
||||
still removes the worktree and the branch, and fails saying why.
|
||||
|
||||
@@ -79,7 +79,7 @@ def main(argv: list[str]) -> int:
|
||||
|
||||
|
||||
def step(argv: list[str], run: Run) -> str | Failure:
|
||||
"""Run the step argv names: the line to print, or a Failure. A malformed argv runs nothing."""
|
||||
"""Run the step argv names: the line to print, or a Failure. A malformed argv doesn't run anything."""
|
||||
match argv:
|
||||
case ["open", title, *body] if len(body) <= 1 and not title.startswith("-"):
|
||||
return Failure("give a title of one line") if not one_line(title) else opened(title, body[0] if body else "", run)
|
||||
@@ -115,7 +115,7 @@ def checkout(run: Run) -> tuple[Forge, str, str] | Failure:
|
||||
|
||||
|
||||
def default_branch(run: Run) -> str | Failure:
|
||||
"""origin's default branch, such as main."""
|
||||
"""origin's default branch, such as main. It differs from git_cli's default_ref, which falls back to a local main or master and asks origin where nothing is recorded. A pull request's base is origin's alone, so this fails instead, and says how to record it."""
|
||||
default = run(["git", "symbolic-ref", "--short", "refs/remotes/origin/HEAD"])
|
||||
if isinstance(default, Failure):
|
||||
return Failure(f"origin records no default branch; set it with `git remote set-head origin --auto`: {default.reason}")
|
||||
|
||||
@@ -117,7 +117,7 @@ def printed(shown: str, done: Ran | Failure) -> str:
|
||||
if isinstance(done, Failure):
|
||||
return f"`{shown}` {done.reason}"
|
||||
output = "\n".join(part.strip() for part in (done.stdout, done.stderr) if part.strip())
|
||||
return f"`{shown}` exited {done.code}, printing:\n\n{quoted(output)}" if output else f"`{shown}` exited {done.code}, printing nothing."
|
||||
return f"`{shown}` exited {done.code}, printing:\n\n{quoted(output)}" if output else f"`{shown}` exited {done.code}, printing no output."
|
||||
|
||||
|
||||
def levels(item: Item) -> str:
|
||||
|
||||
@@ -443,7 +443,7 @@ class Render(unittest.TestCase):
|
||||
said = rendered(item_facts(tools=[("rank_todo.py --check todo.md", Ran(0, "ranked\n", "")), ("reading-cost", Ran(1, "", "")), ("larv-review needs-scoring-run 3", Ran(1, "out\n", "err\n")), ("larv-review places", Failure("could not finish: timed out"))]))
|
||||
self.assertIn("`rank_todo.py --check todo.md` exited 0", said)
|
||||
self.assertIn("> ranked", said)
|
||||
self.assertIn("`reading-cost` exited 1, printing nothing", said)
|
||||
self.assertIn("`reading-cost` exited 1, printing no output", said)
|
||||
self.assertIn("> out\n> err", said)
|
||||
self.assertIn("`larv-review places` could not finish: timed out", said)
|
||||
|
||||
|
||||
@@ -145,6 +145,15 @@ def tool_calls(entries: typing.Iterable[Entry]) -> list[tuple[AssistantTurn, Too
|
||||
return [(entry, part) for entry in entries if isinstance(entry, AssistantTurn) for part in entry.parts if isinstance(part, ToolCall)]
|
||||
|
||||
|
||||
def messages(entries: typing.Iterable[Entry]) -> list[list[AssistantTurn]]:
|
||||
"""The assistant turns grouped by message, in the order each message first appears. A message's usage repeats in each of its entries, so read it from the first of a group: none of 1,681 multi-entry messages in the archive of 2026-10-28 differed."""
|
||||
grouped: dict[str, list[AssistantTurn]] = {}
|
||||
for entry in entries:
|
||||
if isinstance(entry, AssistantTurn):
|
||||
grouped.setdefault(entry.message_id or entry.uuid, []).append(entry)
|
||||
return list(grouped.values())
|
||||
|
||||
|
||||
def field(found: dict, key: str) -> str:
|
||||
return value if isinstance(value := found.get(key), str) else ""
|
||||
|
||||
@@ -222,7 +231,7 @@ def tool_result(part: object) -> ToolResult | None:
|
||||
def result_text(content: object) -> str:
|
||||
if isinstance(content, str):
|
||||
return content
|
||||
# Claude Code may split one text across blocks, even inside a line, so the blocks join with nothing between them.
|
||||
# Claude Code may split one text across blocks, even inside a line, so the blocks join without anything between them.
|
||||
return "".join(part_text(part) or "" for part in content) if isinstance(content, list) else ""
|
||||
|
||||
|
||||
@@ -256,7 +265,7 @@ def rejected_until(event: dict) -> int | None:
|
||||
return resets_at if isinstance(resets_at, int) and not isinstance(resets_at, bool) else None
|
||||
|
||||
|
||||
# A count Claude Code left out or wrote as another type adds nothing, so one odd entry leaves the rest of a figure standing.
|
||||
# A count Claude Code left out or wrote as another type doesn't add anything, so one odd entry leaves the rest of a figure standing.
|
||||
def usage_count(usage: dict, field: str) -> int:
|
||||
"""One token count of a message's usage: {"input_tokens": 2, "cache_creation_input_tokens": 14541, "output_tokens": 8, ...}"""
|
||||
value = usage.get(field)
|
||||
|
||||
@@ -148,6 +148,13 @@ class EntryKinds(unittest.TestCase):
|
||||
uuid="u", parts=(entries.Text("Starting."), entries.ToolCall("toolu_1", "Bash", {"command": "ls"})), message_id="msg_1", model="claude-opus-5-5", usage={"input_tokens": 2},
|
||||
))
|
||||
|
||||
def test_messages_group_the_turns_that_share_a_message_id_and_fall_back_to_the_uuid_where_there_is_none(self):
|
||||
first = entries.AssistantTurn(uuid="a", message_id="msg_1", usage={"input_tokens": 1})
|
||||
other = entries.AssistantTurn(uuid="b", message_id="msg_2")
|
||||
again = entries.AssistantTurn(uuid="c", message_id="msg_1", usage={"input_tokens": 2})
|
||||
bare = entries.AssistantTurn(uuid="d")
|
||||
self.assertEqual(entries.messages([first, entries.HumanTurn(text="hi"), other, again, bare]), [[first, again], [other], [bare]])
|
||||
|
||||
def test_parses_tool_results_and_cost_states_and_reads_queued_notifications_and_other_kinds_as_plain_entries(self):
|
||||
self.assertEqual(entries.entry_from(human([{"type": "tool_result", "tool_use_id": "toolu_1", "content": "hi", "is_error": True}])), entries.ToolResults(results=(entries.ToolResult("toolu_1", "hi", True),)))
|
||||
self.assertEqual(entries.entry_from(queued("<task-notification>done</task-notification>", "task-notification")), entries.Entry())
|
||||
|
||||
@@ -52,7 +52,7 @@ def segments(command: str) -> list[list[str]]:
|
||||
- a file descriptor before a redirect, as in `2>&1`, stays a word;
|
||||
- a heredoc's body is dropped;
|
||||
- variables, aliases and functions are not expanded;
|
||||
- a line with an unbalanced quote yields nothing."""
|
||||
- a line with an unbalanced quote doesn't yield anything."""
|
||||
text = uncommented(HEREDOC.sub(lambda heredoc: heredoc.group(0).split("\n", 1)[0], command))
|
||||
tokens = lexed(text)
|
||||
if tokens is None:
|
||||
|
||||
@@ -34,7 +34,7 @@ def deploy(checkout: str) -> str | Failure:
|
||||
if isinstance(git("merge-base", "--is-ancestor", "HEAD", tag, cwd=checkout), Failure):
|
||||
return Failure(f"{tag} doesn't hold the checkout's commit, so the move would drop work no release holds: cut a release that holds it first")
|
||||
settings_changed = isinstance(git("diff", "--quiet", "HEAD", tag, "--", "settings.json", cwd=checkout), Failure)
|
||||
# The tag holds each uncommitted change, so undoing them loses nothing, and lets the checkout below take the tag's copy.
|
||||
# The tag holds each uncommitted change, so undoing them doesn't lose anything, and lets the checkout below take the tag's copy.
|
||||
# A settings.json the clean filter shows unchanged may still differ on disk, by a model pick or Claude Code's key order, which checkout refuses to overwrite; the pick is asked for again below.
|
||||
tracked = git("ls-files", "--", "settings.json", cwd=checkout)
|
||||
if isinstance(tracked, Failure):
|
||||
|
||||
@@ -17,7 +17,7 @@ the move would drop work no release holds. Untracked files, such as Claude Code'
|
||||
memory, stay as they are.
|
||||
|
||||
--cut runs in the development clone, and refuses where that clone's origin isn't <checkout>'s. It cuts the next release, as chunk-preflight works it out, and
|
||||
refuses, changing nothing, unless that release holds no item in todo.md, its release review has
|
||||
refuses without changing anything, unless that release holds no item in todo.md, its release review has
|
||||
landed and changes are unreleased. The release names the version; the tool doesn't choose one.
|
||||
1. On a fresh origin/main, it renames ## Unreleased in CHANGELOG.md to the version, commits that
|
||||
titled `Cut release <version>`, and pushes it as the branch release-<version>. The clone's own
|
||||
|
||||
@@ -76,7 +76,7 @@ class Guarded(unittest.TestCase):
|
||||
|
||||
|
||||
class StalledOrigin(unittest.TestCase):
|
||||
"""A checkout whose origin, run through git's ext transport, answers nothing for 10 s, and which records no default branch for it."""
|
||||
"""A checkout whose origin, run through git's ext transport, doesn't answer for 10 s, and which records no default branch for it."""
|
||||
|
||||
def setUp(self):
|
||||
temp = tempfile.TemporaryDirectory()
|
||||
|
||||
+73
-39
@@ -1,6 +1,6 @@
|
||||
"""Hold larv-review's mechanical rules: the chunk's review folder, the paired ruling's base and vote count, each pass's rounds, the scoring run's trigger and setup; the comprehension history's format, its latest places and its count of how often seats agree; and the header of each reviewer's prompt.
|
||||
|
||||
usage: larv-review review-folder | ruling-base | round-count | needs-scoring-run [<item ID>...] | scoring-run-owed | record-ruling <votes file> | prepare-scoring [--preloaded <text>] | record-scoring <scores file> [<item ID>...] | places | agreement | reviewer-header <pass> [--rerun] | reviewer-context
|
||||
usage: larv-review {commands}
|
||||
|
||||
The comprehension check records how hard a project is to read, two ways, and no score blocks a merge. In a
|
||||
paired ruling, simulated readers, the seats, read the branch's head beside a base and vote better,
|
||||
@@ -32,8 +32,8 @@ each name in such a title that is not a pass.
|
||||
|
||||
needs-scoring-run takes the IDs of the todo.md items the chunk ships, none when it ships none, and
|
||||
prints why the chunk is due a scoring run, or `No scoring run due.` It is due when the chunk ships
|
||||
an item whose tagline names the comprehension floor. It is also due when the chunk leaves a release
|
||||
with no item in the checkout's todo.md, once the shipped items are set aside, and work has landed
|
||||
a floor item, one whose tagline opens with `Reach the comprehension floor:`. It is also due when the
|
||||
chunk leaves a release with no item in the checkout's todo.md, once the shipped items are set aside, and work has landed
|
||||
towards that release; bin/larv_review/plan.py's `work_landed` and `landed_towards` say when. A release the checkout's
|
||||
todo.md marks renamed in its ## Renamed section, as `- 0.2.1 renamed to 0.3.0`, is due none.
|
||||
A chunk is also due one while no scoring run in the default branch's history is newer than the
|
||||
@@ -43,7 +43,7 @@ docs/decisions.md opts out of the comprehension check is never due one.
|
||||
scoring-run-owed prints `No scoring run owed.` or exits 1 naming the runs the chunk owes and has
|
||||
not recorded. chunk-pr merge runs it and refuses to merge on exit 1, so a due line read earlier in
|
||||
the chunk can't stand in for it. It applies needs-scoring-run's rule to the checkout's todo.md and the committed history, against the
|
||||
merge base with the default branch, so a default branch that has moved on adds nothing: the items
|
||||
merge base with the default branch, so a default branch that has moved on doesn't add anything: the items
|
||||
the merge base's todo.md holds and the checkout's does not count as shipped. A chunk that empties a
|
||||
release owes two runs, any other due chunk one. The chunk has recorded the scoring runs that its
|
||||
committed docs/comprehension-history.md holds beyond the merge base's. A project that opts out or
|
||||
@@ -78,7 +78,7 @@ better, same or worse. Each place opens with the names from the seat's line that
|
||||
`, ` and followed by `: `. A dimension's vote counts as same unless one of the seat's places opens
|
||||
with that dimension and holds a `path:line` in backticks; the overall vote counts as same unless any
|
||||
place holds one. The printed votes say so. When the two counted overall votes differ, it appends
|
||||
nothing and prints `Split:`, saying to add the maintainability senior's and Junior A's lines.
|
||||
no line and prints `Split:`, saying to add the maintainability senior's and Junior A's lines.
|
||||
Otherwise the ruling is the overall vote that leads each other vote by two or more, else same. It
|
||||
prints `Ruling:` and appends the ruling.
|
||||
|
||||
@@ -97,8 +97,8 @@ record-scoring takes the scores file of a run needs-scoring-run calls, whose fir
|
||||
`, against`, and the same item IDs, and exits 1 when they call no run. It appends the seats' scores
|
||||
and their means, rounded half up to two decimals, prints the means and, when a mean is under the
|
||||
floor of {floor}, a line opening `Floor:` naming each one. A line opening `Next:` follows it. It
|
||||
says to file a floor item, one whose tagline holds `comprehension floor`, aimed at the lowest of the
|
||||
four dimensions. Where the checkout's todo.md holds such an item other than those given, it says to
|
||||
says to file a floor item aimed at the lowest of the four dimensions, and names the tagline's opening
|
||||
`Reach the comprehension floor:`. Where the checkout's todo.md holds such an item other than those given, it says to
|
||||
refresh that item instead. Then it ranks the checkout's todo.md as rank_todo.py does, since the
|
||||
overall sets the weight of code health, the goal every project shares, and exits 1 where
|
||||
rank_todo.py would, with the run recorded. Last, it removes what prepare-scoring set up, so a
|
||||
@@ -167,45 +167,79 @@ from larv_review.scoring_setup import prepare_scoring
|
||||
from larv_review.history_commands import record_ruling, record_scoring, show_agreement, show_places
|
||||
from larv_review.reviewer_header import reviewer_header
|
||||
|
||||
USAGE = "usage: larv-review review-folder | ruling-base | round-count | needs-scoring-run [<item ID>...] | scoring-run-owed | record-ruling <votes file> | prepare-scoring [--preloaded <text>] | record-scoring <scores file> [<item ID>...] | places | agreement | reviewer-header <pass> [--rerun] | reviewer-context"
|
||||
|
||||
class Command(typing.NamedTuple):
|
||||
"""One subcommand: how the usage line spells it, whether the arguments after its name fit, and what it does with them. Where it ends in item IDs, ids_from is the number of arguments before them, so main can name the arguments that aren't IDs."""
|
||||
shape: str
|
||||
fits: typing.Callable[[list[str]], bool]
|
||||
run: typing.Callable[[list[str]], Failure | None]
|
||||
ids_from: int | None = None
|
||||
|
||||
|
||||
ITEM_ID = re.compile(r"[0-9]+")
|
||||
|
||||
|
||||
def no_arguments(given: list[str]) -> bool:
|
||||
return not given
|
||||
|
||||
|
||||
def are_ids(given: list[str]) -> bool:
|
||||
return all(ITEM_ID.fullmatch(id_) for id_ in given)
|
||||
|
||||
|
||||
def run_needs_scoring_run(given: list[str]) -> Failure | None:
|
||||
return with_default_branch(lambda default: needs_scoring_run(default, [int(id_) for id_ in given]), stale_ok=False)
|
||||
|
||||
|
||||
def fits_prepare_scoring(given: list[str]) -> bool:
|
||||
return not given or len(given) == 2 and given[0] == "--preloaded"
|
||||
|
||||
|
||||
def run_record_scoring(given: list[str]) -> Failure | None:
|
||||
return with_default_branch(lambda default: record_scoring(default, pathlib.Path(given[0]), [int(id_) for id_ in given[1:]]), stale_ok=False)
|
||||
|
||||
|
||||
def fits_reviewer_header(given: list[str]) -> bool:
|
||||
return bool(given) and given[0] in REVIEWERS and given[1:] in ([], ["--rerun"])
|
||||
|
||||
|
||||
def run_reviewer_header(given: list[str]) -> Failure | None:
|
||||
return with_default_branch(lambda default: reviewer_header(default, given[0], given[1:] == ["--rerun"]), stale_ok=True)
|
||||
|
||||
|
||||
# One row per subcommand: main, USAGE and `--help` all read this table.
|
||||
COMMANDS = {
|
||||
"review-folder": Command("review-folder", no_arguments, lambda given: make_review_folder()),
|
||||
"ruling-base": Command("ruling-base", no_arguments, lambda given: with_default_branch(show_ruling_base, stale_ok=False)),
|
||||
"round-count": Command("round-count", no_arguments, lambda given: with_default_branch(round_count, stale_ok=True)),
|
||||
"needs-scoring-run": Command("needs-scoring-run [<item ID>...]", are_ids, run_needs_scoring_run, ids_from=0),
|
||||
"scoring-run-owed": Command("scoring-run-owed", no_arguments, lambda given: with_default_branch(owed, stale_ok=False)),
|
||||
"record-ruling": Command("record-ruling <votes file>", lambda given: len(given) == 1, lambda given: record_ruling(pathlib.Path(given[0]))),
|
||||
"prepare-scoring": Command("prepare-scoring [--preloaded <text>]", fits_prepare_scoring, lambda given: prepared_scoring(given[1] if given else None)),
|
||||
"record-scoring": Command("record-scoring <scores file> [<item ID>...]", lambda given: bool(given) and are_ids(given[1:]), run_record_scoring, ids_from=1),
|
||||
"places": Command("places", no_arguments, lambda given: show_places()),
|
||||
"agreement": Command("agreement", no_arguments, lambda given: show_agreement()),
|
||||
"reviewer-header": Command("reviewer-header <pass> [--rerun]", fits_reviewer_header, run_reviewer_header),
|
||||
"reviewer-context": Command("reviewer-context", no_arguments, lambda given: printed(hook_reply(sys.stdin.read(), pathlib.Path.home()))),
|
||||
}
|
||||
SHAPES = " | ".join(command.shape for command in COMMANDS.values())
|
||||
USAGE = f"usage: larv-review {SHAPES}"
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
if argv in (["-h"], ["--help"]):
|
||||
print(__doc__.strip().format(cap=CAP, release_cap=RELEASE_REVIEW_CAP, floor=FLOOR, pairs=MIN_PAIRS))
|
||||
print(__doc__.strip().format(commands=SHAPES, cap=CAP, release_cap=RELEASE_REVIEW_CAP, floor=FLOOR, pairs=MIN_PAIRS))
|
||||
return 0
|
||||
command, *given = argv or [""]
|
||||
if command == "review-folder" and not given:
|
||||
done = make_review_folder()
|
||||
elif command == "ruling-base" and not given:
|
||||
done = with_default_branch(show_ruling_base, stale_ok=False)
|
||||
elif command == "round-count" and not given:
|
||||
done = with_default_branch(round_count, stale_ok=True)
|
||||
elif command == "needs-scoring-run" and all(re.fullmatch(r"[0-9]+", id_) for id_ in given):
|
||||
done = with_default_branch(lambda default: needs_scoring_run(default, [int(id_) for id_ in given]), stale_ok=False)
|
||||
elif command == "scoring-run-owed" and not given:
|
||||
done = with_default_branch(owed, stale_ok=False)
|
||||
elif command == "record-ruling" and len(given) == 1:
|
||||
done = record_ruling(pathlib.Path(given[0]))
|
||||
elif command == "prepare-scoring" and (not given or len(given) == 2 and given[0] == "--preloaded"):
|
||||
done = prepared_scoring(given[1] if given else None)
|
||||
elif command == "record-scoring" and given and all(re.fullmatch(r"[0-9]+", id_) for id_ in given[1:]):
|
||||
done = with_default_branch(lambda default: record_scoring(default, pathlib.Path(given[0]), [int(id_) for id_ in given[1:]]), stale_ok=False)
|
||||
elif command == "places" and not given:
|
||||
done = show_places()
|
||||
elif command == "agreement" and not given:
|
||||
done = show_agreement()
|
||||
elif command == "reviewer-header" and given[:1] and given[0] in REVIEWERS and given[1:] in ([], ["--rerun"]):
|
||||
done = with_default_branch(lambda default: reviewer_header(default, given[0], given[1:] == ["--rerun"]), stale_ok=True)
|
||||
elif command == "reviewer-context" and not given:
|
||||
done = printed(hook_reply(sys.stdin.read(), pathlib.Path.home()))
|
||||
elif command in ("needs-scoring-run", "record-scoring") and given:
|
||||
named = given[1:] if command == "record-scoring" else given
|
||||
print(f"{command} takes item IDs, the numbers in todo.md's ID column, not {' '.join(id_ for id_ in named if not re.fullmatch(r'[0-9]+', id_))}; {USAGE}", file=sys.stderr)
|
||||
return 1
|
||||
elif not argv:
|
||||
if not argv:
|
||||
print(USAGE, file=sys.stderr)
|
||||
return 1
|
||||
name, *given = argv
|
||||
command = COMMANDS.get(name)
|
||||
if command and command.fits(given):
|
||||
done = command.run(given)
|
||||
elif command and command.ids_from is not None and (named := [id_ for id_ in given[command.ids_from:] if not ITEM_ID.fullmatch(id_)]):
|
||||
print(f"{name} takes item IDs, the numbers in todo.md's ID column, not {' '.join(named)}; {USAGE}", file=sys.stderr)
|
||||
return 1
|
||||
else:
|
||||
print(f"unknown arguments {' '.join(argv)}; {USAGE}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
@@ -10,7 +10,7 @@ from release_plan.todo_table import items, NoItemsTable
|
||||
def owed_scoring_run(default: str) -> Failure | None:
|
||||
"""A Failure saying which scoring runs the chunk owes and has not recorded; None where it owes none.
|
||||
|
||||
The chunk owes the runs `plan_reasons` calls, two where it empties a release, else one. It has recorded the scoring runs its committed history holds beyond those at the merge base, so a default branch that has moved on since the branch began counts for nothing. A project with no plan owes none. A missing run blocks the merge and a low score never does, which keeps the decision `review: the comprehension check records …`: it bars only scores from blocking.
|
||||
The chunk owes the runs `plan_reasons` calls, two where it empties a release, else one. It has recorded the scoring runs its committed history holds beyond those at the merge base, so a default branch that has moved on since the branch began doesn't count. A project with no plan owes none. A missing run blocks the merge and a low score never does, which keeps the decision `review: the comprehension check records …`: it bars only scores from blocking.
|
||||
"""
|
||||
checkout = top()
|
||||
if isinstance(checkout, Failure):
|
||||
|
||||
@@ -3,7 +3,7 @@ import pathlib
|
||||
from release_plan.release_standing import Cut, default_plan, LastCut, next_release, Unknown
|
||||
from failure import Failure
|
||||
from git_cli.git_repo import file_at, top
|
||||
from larv_review.scoring import FLOOR_ITEM
|
||||
from larv_review.scoring import is_floor_item
|
||||
from release_plan.todo_table import Item, items, NoItemsTable, renames
|
||||
from release_plan.ranking import OPTED_OUT
|
||||
from release_plan.release import Release, version
|
||||
@@ -17,7 +17,7 @@ EMPTIED_WORDS = "with no plan item"
|
||||
def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed_release: Release | None, renamed: set[Release], unmeasured: str | None = None) -> list[str] | Failure:
|
||||
"""Why the plan calls a scoring run, empty when it does not.
|
||||
|
||||
A chunk that ships an item naming the floor is due one, so it can prove the floor met. So is a chunk that empties a release after work has landed towards it, so no release ends unmeasured. A release the chunk's plan marks renamed is due none. A chunk after a release `unmeasured_cut` names is due one too, so a release cut with no scoring run is caught up.
|
||||
A chunk that ships a floor item is due one, so it can prove the floor met. So is a chunk that empties a release after work has landed towards it, so no release ends unmeasured. A release the chunk's plan marks renamed is due none. A chunk after a release `unmeasured_cut` names is due one too, so a release cut with no scoring run is caught up.
|
||||
|
||||
before is the default branch's plan and after the chunk's. ships holds the IDs of the items the chunk ships. landed_release is the next release where work has landed towards it, else None (`landed_towards`). renamed holds the releases the chunk's plan marks renamed. unmeasured is `unmeasured_cut`'s answer.
|
||||
"""
|
||||
@@ -25,7 +25,7 @@ def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], lan
|
||||
if unknown := sorted(set(ships) - set(plan)):
|
||||
return Failure(f"neither plan holds item {', '.join(map(str, unknown))}")
|
||||
shipped = [plan[id_] for id_ in ships]
|
||||
reasons = [f"ships item {item.id}, which names the comprehension floor" for item in shipped if FLOOR_ITEM in item.tagline.lower()]
|
||||
reasons = [f"ships item {item.id}, a floor item" for item in shipped if is_floor_item(item)]
|
||||
if unmeasured:
|
||||
reasons.append(f"follows {unmeasured}")
|
||||
for release in emptied(before, after, shipped, renamed):
|
||||
|
||||
@@ -3,8 +3,13 @@ import decimal
|
||||
from review_rules.comprehension_history import DIMENSIONS, FLOOR
|
||||
from release_plan.todo_table import Item
|
||||
|
||||
# A floor item's tagline holds these words, and plan.scoring_run_due keys on them too, so each floor item's chunk runs a scoring run.
|
||||
FLOOR_ITEM = "comprehension floor"
|
||||
# A floor item's tagline opens with this phrase, which a tagline quoting or mentioning the floor never does; a floor item's chunk runs a scoring run.
|
||||
FLOOR_ITEM = "Reach the comprehension floor:"
|
||||
|
||||
|
||||
def is_floor_item(item: Item) -> bool:
|
||||
"""Whether the item's tagline, which keeps its `**` bold markers, opens with FLOOR_ITEM."""
|
||||
return item.tagline.removeprefix("**").startswith(FLOOR_ITEM)
|
||||
|
||||
|
||||
def means(lines: list[list[str]]) -> list[decimal.Decimal]:
|
||||
@@ -32,6 +37,6 @@ def floor_step(found: list[decimal.Decimal], plan: list[Item], ships: list[int])
|
||||
names = " and ".join(filter(None, [", ".join(lowest[:-1]), lowest[-1]]))
|
||||
aim = f"{names}, the lowest dimension{'s' if len(lowest) > 1 else ''}"
|
||||
rule = 'as larv-review §3 → "Floor item" says.'
|
||||
if open_items := [item for item in plan if FLOOR_ITEM in item.tagline.lower() and item.id not in ships]:
|
||||
if open_items := [item for item in plan if is_floor_item(item) and item.id not in ships]:
|
||||
return f"Next: refresh floor item {open_items[0].id} to lift {aim}, with this run's places, and file no other, {rule}"
|
||||
return f"Next: file one floor item, a refactor lifting {aim}, until every mean reaches {FLOOR}, {rule}"
|
||||
return f"Next: file one floor item, a refactor lifting {aim}, with a tagline that opens with `{FLOOR_ITEM}`, until every mean reaches {FLOOR}, {rule}"
|
||||
|
||||
@@ -4,8 +4,9 @@ import pathlib
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from review_rules.comprehension_history import DIMENSIONS
|
||||
from failure import Failure
|
||||
from records.markdown_text import FENCE, listed
|
||||
from records.markdown_text import FENCE, listed, section
|
||||
from git_cli.git_repo import git
|
||||
from review_rules.review_folder import made_review_folder, review_folder
|
||||
|
||||
@@ -18,31 +19,13 @@ SEATS = (
|
||||
("maintainability-senior", "Senior, maintainability", "Report: Junior A, Mid A and the maintainability senior"),
|
||||
("inherited-architect", "Architect, inherited", "Report: the inherited architect"),
|
||||
)
|
||||
# The dimensions a seat scores beside the overall, which comes last in DIMENSIONS.
|
||||
PANEL_DIMENSIONS = DIMENSIONS[:-1]
|
||||
VALUE_NAMES = ("language", "kind", "domain", "domain docs", "3am question")
|
||||
FORBIDDEN_FILES = ("todo.md", "docs/decisions.md", "docs/comprehension-history.md", "docs/reading-cost.md")
|
||||
FORBIDDEN = "todo.md, docs/decisions.md, docs/comprehension-history.md or docs/reading-cost.md (the plan, the decision log, past panels' records and past chunks' reading cost)"
|
||||
TEST_FILE = re.compile(r"(^|/)(tests?/|test_[^/]*$|[^/]*_test\.[^/]*$|[^/]*\.(test|spec)\.[^/]*$)")
|
||||
TEST_FILES = "test files being `test_*`, `*_test.*`, `*.test.*`, `*.spec.*` and those under a `test` or `tests` folder"
|
||||
HEADING = re.compile(r"^(#+)\s+(.*?)\s*$")
|
||||
|
||||
|
||||
def section(text: str, title: str) -> list[str] | None:
|
||||
"""The lines under the first heading whose text fullmatches the pattern title, up to the next heading of its level or above; None where none does."""
|
||||
found: list[str] | None = None
|
||||
level = 0
|
||||
fenced = False
|
||||
for line in text.splitlines():
|
||||
if FENCE.match(line):
|
||||
fenced = not fenced
|
||||
heading = None if fenced else HEADING.match(line)
|
||||
if found is None:
|
||||
if heading and re.fullmatch(title, heading.group(2)):
|
||||
found, level = [], len(heading.group(1))
|
||||
elif heading and len(heading.group(1)) <= level:
|
||||
break
|
||||
else:
|
||||
found.append(line)
|
||||
return found
|
||||
|
||||
|
||||
def bullets(lines: list[str]) -> list[list[str]]:
|
||||
@@ -62,12 +45,18 @@ def bullets(lines: list[str]) -> list[list[str]]:
|
||||
return groups
|
||||
|
||||
|
||||
ANCHOR = re.compile(r"- \*\*\d+ — ")
|
||||
DIMENSION = re.compile(r"- \*\*([^*]+)\*\* — ")
|
||||
|
||||
|
||||
def score_bullets(skill: str) -> tuple[list[str], list[str]] | Failure:
|
||||
"""The six anchor bullets and the four dimension bullets of SKILL.md → "The score", without bold, each on one line."""
|
||||
groups = [[line.replace("**", "") for line in group] for group in bullets(section(skill, "The score") or [])]
|
||||
if [len(group) for group in groups[:2]] != [6, 4]:
|
||||
return Failure(f"{PANEL / 'SKILL.md'} → \"The score\" no longer opens with six anchor bullets and then four dimension bullets")
|
||||
return groups[0], groups[1]
|
||||
"""The six anchor bullets and the four dimension bullets of SKILL.md → "The score", without bold, each on one line. A bullet is an anchor or a dimension by how it opens, `- **<n> — ` or `- **<name>** — `; the other bullets in the section are skipped, and the dimensions must come in the panel's order."""
|
||||
lines = [line for group in bullets(section(skill, "The score") or []) for line in group]
|
||||
anchors = [line.replace("**", "") for line in lines if ANCHOR.match(line)]
|
||||
dimensions = [(match[1], line) for line in lines if (match := DIMENSION.match(line))]
|
||||
if len(anchors) != 6 or tuple(name for name, _ in dimensions) != PANEL_DIMENSIONS:
|
||||
return Failure(f"{PANEL / 'SKILL.md'} → \"The score\" no longer holds six bullets opening `- **<n> — ` and one opening `- **<name>** — ` for each of {listed(list(PANEL_DIMENSIONS), 'and')}, in that order")
|
||||
return anchors, [line.replace("**", "") for _, line in dimensions]
|
||||
|
||||
|
||||
def project_values(text: str, source: str) -> dict[str, str] | Failure:
|
||||
|
||||
@@ -118,10 +118,11 @@ class Seats(unittest.TestCase):
|
||||
|
||||
def test_floor_step_files_one_item_at_the_lowest_dimension_unless_one_is_open(self):
|
||||
found = [decimal.Decimal(mean) for mean in ("7.38", "6.63", "7.00", "6.50", "6.88")]
|
||||
floor_item = item(5, (0, 2, 0), "**Restructure the reload, lifting Locality to the comprehension floor.**")
|
||||
floor_item = item(5, (0, 2, 0), "**Reach the comprehension floor: restructure the reload, lifting Locality.**")
|
||||
with self.subTest("none open"):
|
||||
step = floor_step(found, [item(1, (0, 1, 0))], [])
|
||||
self.assertTrue(step.startswith("Next: file one floor item"), step)
|
||||
self.assertIn("with a tagline that opens with `Reach the comprehension floor:`,", step)
|
||||
self.assertIn(" Self-sufficiency, the lowest dimension,", step)
|
||||
self.assertIn('"Floor item"', step)
|
||||
with self.subTest("one open"):
|
||||
@@ -134,6 +135,9 @@ class Seats(unittest.TestCase):
|
||||
with self.subTest("a tie names both"):
|
||||
tied = [decimal.Decimal(mean) for mean in ("7.38", "6.50", "7.00", "6.50", "6.88")]
|
||||
self.assertIn(" Locality and Self-sufficiency, the lowest dimensions,", floor_step(tied, [], []))
|
||||
with self.subTest("a tagline that only mentions the floor is no floor item"):
|
||||
quoting = item(6, (0, 2, 0), "**Rename the decision `comprehension floor: …` in the log.**")
|
||||
self.assertTrue(floor_step(found, [quoting], []).startswith("Next: file one floor item"))
|
||||
with self.subTest("none under the floor"):
|
||||
self.assertIsNone(floor_step([decimal.Decimal("7.00")] * 5, [floor_item], []))
|
||||
with self.subTest("only the overall under the floor"):
|
||||
@@ -357,9 +361,13 @@ class ScoringRunDue(unittest.TestCase):
|
||||
self.assertIsInstance(items("# todo\n"), Failure)
|
||||
self.assertIsInstance(items(todo("| 0 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |")), Failure)
|
||||
|
||||
def test_is_due_for_an_item_naming_the_floor(self):
|
||||
plan = [item(1, (0, 1, 0), "**Lift the project to the Comprehension floor.**"), item(2, (0, 1, 0))]
|
||||
self.assertEqual(scoring_run_due(plan, plan, [1], (0, 1, 0), set()), ["ships item 1, which names the comprehension floor"])
|
||||
def test_is_not_due_for_an_item_whose_tagline_only_mentions_the_floor(self):
|
||||
plan = [item(1, (0, 1, 0), "**Call a scoring run for an item whose tagline makes the comprehension floor its target.**"), item(2, (0, 1, 0))]
|
||||
self.assertEqual(scoring_run_due(plan, plan, [1], (0, 1, 0), set()), [])
|
||||
|
||||
def test_is_due_for_a_floor_item(self):
|
||||
plan = [item(1, (0, 1, 0), "**Reach the comprehension floor: lift the project.**"), item(2, (0, 1, 0))]
|
||||
self.assertEqual(scoring_run_due(plan, plan, [1], (0, 1, 0), set()), ["ships item 1, a floor item"])
|
||||
self.assertIsInstance(scoring_run_due(plan, plan, [9], (0, 1, 0), set()), Failure)
|
||||
|
||||
def test_is_due_when_the_chunk_ships_a_releases_last_item(self):
|
||||
@@ -433,7 +441,7 @@ class Shortfall(unittest.TestCase):
|
||||
|
||||
def test_a_chunk_that_empties_a_release_owes_two_runs_and_any_other_reason_one(self):
|
||||
emptied = ["leaves release 0.1.0 with no plan item"]
|
||||
floor = ["ships item 2, which names the comprehension floor"]
|
||||
floor = ["ships item 2, a floor item"]
|
||||
self.assertIn("owes 2 scoring runs and the branch's committed history records 1", shortfall(emptied + floor, 1).reason)
|
||||
self.assertIn("owes 1 scoring run and", shortfall(floor, 0).reason)
|
||||
self.assertIn("records 0:", shortfall(floor, -1).reason)
|
||||
@@ -535,10 +543,10 @@ class LarvReviewTool(unittest.TestCase):
|
||||
def test_a_scoring_run_the_floor_calls_is_owed_once(self):
|
||||
row = "| 1 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |"
|
||||
other = "| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |"
|
||||
self.commit("Plan the floor item", {"todo.md": todo(row, "| 2 | 0.2.0 | | **Reach the comprehension floor.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", other)})
|
||||
self.commit("Plan the floor item", {"todo.md": todo(row, "| 2 | 0.2.0 | | **Reach the comprehension floor: do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", other)})
|
||||
self.git("push", "-q", "origin", "HEAD:main")
|
||||
self.commit("Ship it", {"todo.md": todo(row, other)})
|
||||
self.assertIn("names the comprehension floor", self.run_tool("scoring-run-owed").stderr)
|
||||
self.assertIn("a floor item", self.run_tool("scoring-run-owed").stderr)
|
||||
self.commit("Record a run", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING})
|
||||
self.assertEqual(self.run_tool("scoring-run-owed").returncode, 0)
|
||||
|
||||
@@ -621,9 +629,9 @@ class LarvReviewTool(unittest.TestCase):
|
||||
history = "# Comprehension history\n\n"
|
||||
due = "Scoring run due: the chunk follows v0.0.2, cut with no scoring run since v0.0.1.\n"
|
||||
self.release("v0.0.2", "2026-10-20T12:00:00Z", {"docs/comprehension-history.md": history + paired("2026-10-21T12:00:00Z", "better") + "\n" + SCORING.replace("2026-10-08T12:00:00Z", "2026-10-09T12:00:00Z")})
|
||||
self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, due, "a ruling, and a run at the earlier tag's own second, end nothing")
|
||||
self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, due, "a ruling, and a run at the earlier tag's own second, don't end anything")
|
||||
self.release("v0.0.3", "2026-10-21T12:00:00Z", {"docs/comprehension-history.md": history + SCORING.replace("2026-10-08T12:00:00Z", "2026-10-30")})
|
||||
self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, due.replace("v0.0.2", "v0.0.3").replace("v0.0.1", "v0.0.2"), "a run whose time doesn't parse ends nothing")
|
||||
self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, due.replace("v0.0.2", "v0.0.3").replace("v0.0.1", "v0.0.2"), "a run whose time doesn't parse doesn't end anything")
|
||||
|
||||
def test_an_unmeasured_release_is_judged_by_the_default_branch_alone_and_names_a_release_over_its_candidate(self):
|
||||
self.release("v0.0.1", "2026-10-09T12:00:00Z")
|
||||
@@ -746,7 +754,7 @@ class LarvReviewTool(unittest.TestCase):
|
||||
def test_record_scoring_refreshes_the_open_floor_item_unless_the_chunk_ships_it(self):
|
||||
line = "Navigation 7, Locality 6.5, Shape 7, Self-sufficiency 7, Overall 7"
|
||||
seats = "".join(f"\n{seat}: {line}\n" for seat in ("Junior A", "Mid A", "Maintainability senior", "Inherited architect"))
|
||||
self.plan(second="**Lift Locality to the comprehension floor.**")
|
||||
self.plan(second="**Reach the comprehension floor: lift Locality.**")
|
||||
ran = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats), "1")
|
||||
self.assertEqual(ran.returncode, 0, ran.stderr)
|
||||
self.assertIn("\nNext: refresh floor item 2 to lift Locality, the lowest dimension,", ran.stdout)
|
||||
@@ -779,6 +787,41 @@ class LarvReviewTool(unittest.TestCase):
|
||||
self.assertFalse((self.checkout.parent / ".local" / "state" / "larv-review" / "proj" / "scoring").exists())
|
||||
self.assertEqual(len(self.git("worktree", "list").splitlines()), 1)
|
||||
|
||||
VALUES = {"AGENTS.md": "## Scoring run\n\n- Language: Python\n- Kind: a CLI\n- Domain: parsing\n- Domain docs: the spec\n- 3am question: the parse hangs\n"}
|
||||
|
||||
def test_prepare_scoring_puts_the_preloaded_text_it_is_given_in_the_seats_prompts(self):
|
||||
self.commit("Values", self.VALUES)
|
||||
prepared = self.run_tool("prepare-scoring", "--preloaded", "the files the harness loaded")
|
||||
self.assertEqual(prepared.returncode, 0, prepared.stderr)
|
||||
prompts = [path.read_text() for path in (self.checkout.parent / ".local" / "state" / "larv-review").rglob("*.md") if "scoring" in path.parts]
|
||||
self.assertTrue(any("the files the harness loaded" in prompt for prompt in prompts), prepared.stdout)
|
||||
|
||||
def test_prepare_scoring_refuses_a_preloaded_flag_without_its_text_and_any_other_arguments(self):
|
||||
self.commit("Values", self.VALUES)
|
||||
for given in (["--preloaded"], ["text"], ["text", "--preloaded"], ["--preloaded", "text", "more"], ["--other", "text"]):
|
||||
with self.subTest(given=given):
|
||||
ran = self.run_tool("prepare-scoring", *given)
|
||||
self.assertEqual((ran.returncode, ran.stdout), (1, ""))
|
||||
self.assertTrue(ran.stderr.startswith("unknown arguments prepare-scoring"), ran.stderr)
|
||||
|
||||
def test_record_scoring_without_a_scores_file_and_an_empty_item_ID_print_the_usage_line(self):
|
||||
bare = self.run_tool("record-scoring")
|
||||
self.assertEqual(bare.returncode, 1)
|
||||
self.assertTrue(bare.stderr.startswith("unknown arguments record-scoring; usage: larv-review "), bare.stderr)
|
||||
empty = self.run_tool("needs-scoring-run", "")
|
||||
self.assertEqual(empty.returncode, 1)
|
||||
self.assertIn("takes item IDs", empty.stderr)
|
||||
|
||||
def test_the_commands_that_judge_a_branch_refuse_a_failed_fetch_instead_of_reading_origin_as_last_fetched(self):
|
||||
self.git("remote", "set-url", "origin", str(self.checkout.parent / "gone.git"))
|
||||
seats = self.seats_file(f"PR #2 at {self.start}\n")
|
||||
for given in (["ruling-base"], ["needs-scoring-run"], ["needs-scoring-run", "1"], ["scoring-run-owed"], ["record-scoring", seats], ["record-scoring", seats, "1"]):
|
||||
with self.subTest(given=given):
|
||||
ran = self.run_tool(*given)
|
||||
self.assertEqual(ran.returncode, 1)
|
||||
self.assertNotIn("reading origin as last fetched", ran.stderr)
|
||||
self.assertEqual(ran.stdout, "")
|
||||
|
||||
def test_reports_a_plan_it_cannot_read_yet_keeps_the_run(self):
|
||||
# This checkout has no README.md beside its todo.md.
|
||||
ran = self.record_sevens()
|
||||
@@ -872,6 +915,23 @@ class LarvReviewTool(unittest.TestCase):
|
||||
def test_review_folder_takes_no_arguments(self):
|
||||
self.assertIn("unknown arguments", self.run_tool("review-folder", "x").stderr)
|
||||
|
||||
def assert_names_the_non_id(self, named, *args):
|
||||
ran = self.run_tool(*args)
|
||||
self.assertEqual(ran.returncode, 1)
|
||||
self.assertIn(f"takes item IDs, the numbers in todo.md's ID column, not {named};", ran.stderr)
|
||||
|
||||
def test_needs_scoring_run_names_the_argument_that_is_not_an_item_id(self):
|
||||
self.assert_names_the_non_id("x", "needs-scoring-run", "3", "x")
|
||||
|
||||
def test_record_scoring_names_the_argument_after_its_file_that_is_not_an_item_id(self):
|
||||
self.assert_names_the_non_id("y1", "record-scoring", "scores.md", "4", "y1")
|
||||
|
||||
def test_help_and_the_usage_line_list_the_same_commands(self):
|
||||
usage = next(line for line in self.run_tool("--help").stdout.splitlines() if line.startswith("usage: larv-review "))
|
||||
listed = usage.removeprefix("usage: larv-review ").split(" | ")
|
||||
self.assertEqual([shape.split()[0] for shape in listed], ["review-folder", "ruling-base", "round-count", "needs-scoring-run", "scoring-run-owed", "record-ruling", "prepare-scoring", "record-scoring", "places", "agreement", "reviewer-header", "reviewer-context"])
|
||||
self.assertIn(f"usage: larv-review {' | '.join(listed)}", self.run_tool().stderr)
|
||||
|
||||
def test_takes_a_local_main_without_origin_and_reads_origin_as_last_fetched_when_the_fetch_fails(self):
|
||||
self.commit("Answer prose round 1: a")
|
||||
self.git("remote", "set-url", "origin", str(self.checkout.parent / "gone.git"))
|
||||
|
||||
@@ -9,7 +9,7 @@ import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from larv_review.scoring_setup import bullets, CLAUDE_MD, file_globs, preloaded_files, prepare_scoring, project_values, removed_setup, score_bullets, section
|
||||
from larv_review.scoring_setup import bullets, CLAUDE_MD, file_globs, preloaded_files, prepare_scoring, project_values, removed_setup, score_bullets
|
||||
from failure import Failure
|
||||
from test_env import isolated_env
|
||||
|
||||
@@ -27,6 +27,21 @@ class ScoreBullets(unittest.TestCase):
|
||||
self.assertEqual([line.split(" — ")[0] for line in dimensions], ["- Navigation", "- Locality", "- Shape", "- Self-sufficiency"])
|
||||
self.assertEqual(dimensions[1], "- Locality — understanding and changing one piece without holding the rest: hidden state, order dependence, action at a distance.")
|
||||
|
||||
def test_reads_the_bullets_by_how_they_open_whatever_else_the_section_holds(self):
|
||||
skill = SKILL.read_text()
|
||||
with_extra = skill.replace("## The score\n\n", "## The score\n\n- A bullet before the anchors.\n\n", 1)
|
||||
self.assertEqual(score_bullets(with_extra), score_bullets(skill))
|
||||
|
||||
def test_fails_where_an_anchor_is_missing(self):
|
||||
self.assertIsInstance(score_bullets(SKILL.read_text().replace("- **10 — Duress-proof.**", "- Dropped:", 1)), Failure)
|
||||
|
||||
def test_fails_where_a_dimension_is_missing(self):
|
||||
self.assertIsInstance(score_bullets(SKILL.read_text().replace("- **Shape** —", "- Dropped:", 1)), Failure)
|
||||
|
||||
def test_fails_where_a_fifth_dimension_is_added(self):
|
||||
skill = SKILL.read_text()
|
||||
self.assertIsInstance(score_bullets(skill.replace("- **Shape** —", "- **Extra** — a new one.\n- **Shape** —", 1)), Failure)
|
||||
|
||||
|
||||
class ProjectValues(unittest.TestCase):
|
||||
def test_reads_each_spelling_the_projects_use(self):
|
||||
@@ -56,13 +71,6 @@ class FileGlobs(unittest.TestCase):
|
||||
self.assertEqual(file_globs(paths), "`bin/**` except test files, `docs/**`, `README.md` and `ci.sh`, test files being `test_*`, `*_test.*`, `*.test.*`, `*.spec.*` and those under a `test` or `tests` folder")
|
||||
|
||||
|
||||
class Section(unittest.TestCase):
|
||||
def test_holds_deeper_headings_and_fenced_lines_and_ends_at_its_own_level(self):
|
||||
text = "# P\n\n## Scoring run\n\na\n\n### Sub\n\n```\n## fenced\n```\n\n## Next\n\nb\n"
|
||||
self.assertEqual(section(text, "Scoring run"), ["", "a", "", "### Sub", "", "```", "## fenced", "```", ""])
|
||||
self.assertIsNone(section(text, "Missing"))
|
||||
|
||||
|
||||
class Bullets(unittest.TestCase):
|
||||
def test_joins_continuations_and_splits_runs_at_other_lines(self):
|
||||
lines = [" stray", "- a ", " more", "Text", "- b", "", "- c"]
|
||||
|
||||
@@ -10,7 +10,7 @@ def unmeasured_cut(default: str, checkout: str) -> str | None | Failure:
|
||||
|
||||
The reason ends once a run follows the earlier tag, so it asks only after a release was cut with none; it lets the chunk that finds the gap record the run.
|
||||
|
||||
A scoring run counts by the time its history heading records, against the tag's commit time; a heading whose time doesn't parse counts for nothing, so the run is asked for again.
|
||||
A scoring run counts by the time its history heading records, against the tag's commit time; a heading whose time doesn't parse doesn't count, so the run is asked for again.
|
||||
"""
|
||||
# Sorts v1.0.0-rc.1 below v1.0.0, as release.newest_tag does.
|
||||
tags = git("-c", "versionsort.suffix=-", "tag", "--list", "v*", "--merged", default, "--sort=-v:refname", cwd=checkout)
|
||||
|
||||
@@ -41,7 +41,7 @@ class Talked:
|
||||
|
||||
|
||||
def interrupt(question: str, answer_here: bool, session: WorkerSession, questions: pathlib.Path, effects: Effects) -> str | Talked | Stop:
|
||||
"""Prints question for the human and returns their answer: where answer_here, the first line typed at loop-claude's terminal or in loop-inbox, stripped, or Talked once they typed in the worker's claude session, which TALK opens; else Talked once they typed in that session, which opens at once on the terminal. loop-inbox lists the question meanwhile. A Stop where loop-claude is off a terminal, or they type nothing, or the input ends."""
|
||||
"""Prints question for the human and returns their answer: where answer_here, the first line typed at loop-claude's terminal or in loop-inbox, stripped, or Talked once they typed in the worker's claude session, which TALK opens; else Talked once they typed in that session, which opens at once on the terminal. loop-inbox lists the question meanwhile. A Stop where loop-claude is off a terminal, or they type no answer, or the input ends."""
|
||||
say(f"\n{question}", effects)
|
||||
on_terminal = effects.on_terminal()
|
||||
if on_terminal:
|
||||
@@ -60,7 +60,7 @@ def interrupt(question: str, answer_here: bool, session: WorkerSession, question
|
||||
|
||||
|
||||
def first_answer(ask: Ask, questions: pathlib.Path, effects: Effects) -> str | OpenOnTerminal | OpenInInbox | Stop:
|
||||
"""The first answer to ask, from loop-claude's terminal or loop-inbox: the line typed, stripped, or where claude is to open for it. A Stop where they type nothing, or the input ends."""
|
||||
"""The first answer to ask, from loop-claude's terminal or loop-inbox: the line typed, stripped, or where claude is to open for it. A Stop where they type no answer, or the input ends."""
|
||||
try:
|
||||
# Annotated since mypy infers input_or's T as object from the lambda.
|
||||
answer: str | Answer = effects.input_or(ASK_ANSWER, lambda: answered(questions, ask))
|
||||
@@ -110,4 +110,4 @@ def human_typed(transcript_path: str, held_open: typing.Callable[[], Stop | None
|
||||
entries = read_transcript(transcript_path)
|
||||
if isinstance(entries, Failure):
|
||||
return Stop(1, f"could not tell whether you typed anything: {entries.reason}")
|
||||
return None if human_turns(entries) > before else needs_human(ANSWER_QUESTION, "the interrupt ended with nothing typed")
|
||||
return None if human_turns(entries) > before else needs_human(ANSWER_QUESTION, "the interrupt ended without anything typed")
|
||||
|
||||
@@ -76,7 +76,7 @@ class Reply:
|
||||
answered_before: str = dataclasses.field(metadata={"description": "With interrupt true, a [human] line from earlier in the chunk that answered the question the worker asks now, quoted verbatim, without elisions. Empty otherwise."})
|
||||
left_open: str = dataclasses.field(metadata={"description": "With answered_before set, the words of that line that leave open what the question asks, quoted verbatim; the question ends with them. Empty otherwise."})
|
||||
question: str = dataclasses.field(metadata={"description": "With interrupt true, the single question to put to the human. With a quoted answer, the worker's question that the answer field answers. Empty otherwise."})
|
||||
# True opens claude's session at once, in place of the one-line answer (run.ask). The judge decides it, since loop-claude computes the plan's standing (release_standing.chunk_item) only when it routes a chunk on the ladder afresh: it would miss a release ready to cut in a resumed chunk or off the ladder. A wrong ruling costs the human one typed /talk, or answering in claude, which stops the loop if they leave it with nothing typed.
|
||||
# True opens claude's session at once, in place of the one-line answer (run.ask). The judge decides it, since loop-claude computes the plan's standing (release_standing.chunk_item) only when it routes a chunk on the ladder afresh: it would miss a release ready to cut in a resumed chunk or off the ladder. A wrong ruling costs the human one typed /talk, or answering in claude, which stops the loop if they leave it without typing anything.
|
||||
release_ready: bool = dataclasses.field(metadata={"description": "With interrupt true, whether the question is about a release ready to cut, which only the human may publish. False otherwise."})
|
||||
# Finds the answer that reverses a choice the worker took on its own recommendation. score-outcomes counts these answers per chunk: they are the counter-signal the 2026-11-08 entry of docs/decisions.md → `loop-claude: a judge decides each interrupt and each quoted answer…` stays valid by.
|
||||
reversed: str = dataclasses.field(metadata={"description": "The latest [human] line that overrides a choice the worker took on its own recommendation and recorded with its reason, quoted verbatim, without elisions. Empty where none does; a line that answers a question the worker left open doesn't override anything."})
|
||||
|
||||
@@ -181,7 +181,7 @@ def annotation_of(cycle: Cycle, transcript_path: str, entries: list[Entry], judg
|
||||
if isinstance(subagents, Failure):
|
||||
return subagents
|
||||
spent = spend.spent(since, entries, subagents, judge_of(cycle).model, judged.tokens)
|
||||
return outcomes.Annotation(cycle.config, spend.spent_block(since, spent), judged.reversed)
|
||||
return outcomes.Annotation(cycle.config, outcomes.spent_block(since, spent), judged.reversed)
|
||||
|
||||
|
||||
def ruling_outcome(cycle: Cycle, ruling: Interrupt | QuotedAnswer, quoted_answers: int, annotation: outcomes.Annotation) -> str:
|
||||
|
||||
@@ -7,16 +7,12 @@ import json
|
||||
import pathlib
|
||||
import typing
|
||||
|
||||
from claude_code.entries import AssistantTurn, Entry
|
||||
from claude_code.entries import AssistantTurn, Entry, messages
|
||||
from failure import Failure
|
||||
from routing_figures.prices import PRICES
|
||||
from claude_code.transcript import read_transcript
|
||||
from transcript_archive.outcomes import SPENT
|
||||
from transcript_archive.outcomes import Spender
|
||||
from claude_code.tokens import Tokens, tokens_of
|
||||
|
||||
KINDS = "input, cache write 5m, cache write 1h, cache read, output"
|
||||
# Who spent, such as `worker`, `judge` or `Explore "Search the hooks"`, and the model they ran on.
|
||||
Spender = tuple[str, str]
|
||||
WORKER = "worker"
|
||||
JUDGE = "judge"
|
||||
|
||||
@@ -38,14 +34,10 @@ def spent(since: str, worker: list[Entry], subagents: list[Subagent], judge_mode
|
||||
|
||||
|
||||
def thread_spend(entries: list[Entry], since: str) -> dict[str, Tokens]:
|
||||
"""Each model's tokens in one transcript's messages written after since. A message's usage repeats in each entry of it, so each message counts once, by its id."""
|
||||
"""Each model's tokens in one transcript's messages written after since. Each message counts once."""
|
||||
start = moment(since) if since else None
|
||||
counted: dict[str, AssistantTurn] = {}
|
||||
for entry in entries:
|
||||
if isinstance(entry, AssistantTurn) and entry.model and (start is None or later(entry.timestamp, start)):
|
||||
counted.setdefault(entry.message_id or entry.uuid, entry)
|
||||
found: dict[str, Tokens] = {}
|
||||
for turn in counted.values():
|
||||
for turn, *_ in messages(entry for entry in entries if isinstance(entry, AssistantTurn) and entry.model and (start is None or later(entry.timestamp, start))):
|
||||
found[turn.model] = found.get(turn.model, Tokens()).plus(tokens_of(turn.usage))
|
||||
return found
|
||||
|
||||
@@ -54,7 +46,7 @@ def moment(stamp: str) -> datetime.datetime:
|
||||
return datetime.datetime.fromisoformat(stamp)
|
||||
|
||||
|
||||
# An outcome's stamp runs to the second, so a message written earlier in that second would count in both stretches. In practice none is, since the judge runs for seconds after the worker's last message.
|
||||
# An outcome's stamp runs to the second, so a message written earlier in that second would count in both stretches. The worker writes none then, since the judge runs for seconds after its last message. A subagent or a /talk session still running may write one, and that message is then counted twice.
|
||||
def later(timestamp: str, start: datetime.datetime) -> bool:
|
||||
"""Whether timestamp is after start; False where it is no time, or names no time zone to compare by."""
|
||||
try:
|
||||
@@ -84,13 +76,3 @@ def subagent_name(transcript: pathlib.Path) -> str:
|
||||
# One line for the type, since a line break could forge an archive line such as `Config: `; json.dumps escapes the description's.
|
||||
kind, description = " ".join(str(meta.get("agentType") or "subagent").split()), str(meta.get("description") or "")
|
||||
return f"{kind} {json.dumps(description, ensure_ascii=False)}" if description else kind
|
||||
|
||||
|
||||
def spent_block(since: str, found: dict[Spender, Tokens]) -> str:
|
||||
"""The archive's block for what the stretch spent, then the list prices in force for each model in it; empty where nothing was spent."""
|
||||
if not found:
|
||||
return ""
|
||||
spenders = [f"- {name}, {model}: {', '.join(map(str, (tokens.input, tokens.write_5m, tokens.write_1h, tokens.read, tokens.output)))}" for (name, model), tokens in found.items()]
|
||||
priced = [f"- {model}: {price.input:g}, {price.write_5m:g}, {price.write_1h:g}, {price.read:g}, {price.output:g}" for model in dict.fromkeys(model for _, model in found) if (price := PRICES.get(model))]
|
||||
prices = ["", f"List prices in dollars per million tokens of {KINDS}:", *priced] if priced else []
|
||||
return "\n".join([f"{SPENT}{since or 'the chunk began'}, in tokens of {KINDS}:", *spenders, *prices])
|
||||
|
||||
@@ -26,7 +26,6 @@ from loop_claude.stop import Stop
|
||||
from loop_claude.direct_message import tell
|
||||
|
||||
|
||||
|
||||
def main(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launcher: pathlib.Path, cwd: pathlib.Path, effects: Effects) -> int:
|
||||
try:
|
||||
stop = run_loop(argv, env, paths, launcher, cwd, effects)
|
||||
|
||||
@@ -59,7 +59,7 @@ def raise_calls(root: pathlib.Path, new: list[Call], rung: Rung, loop: Loop) ->
|
||||
if not loop.effects.on_terminal():
|
||||
say("Not on a terminal: the calls are raised again at the next measurement.", loop.effects)
|
||||
return None
|
||||
prompt = f"Put these calls for a routing change from loop-claude's figures to the human, and change nothing until they answer:\n{bullets}The figures are in {root / archive.FIGURES}. The ladder, its steps and the delegation rule are docs/decisions.md → `routing:`, and a change to them is the human's. Record what they decide in this checkout, the development clone, as ~/.claude/CLAUDE.md says; the next chunk of this repo files the plan item for these calls."
|
||||
prompt = f"Put these calls for a routing change from loop-claude's figures to the human, and don't change anything until they answer:\n{bullets}The figures are in {root / archive.FIGURES}. The ladder, its steps and the delegation rule are docs/decisions.md → `routing:`, and a change to them is the human's. Record what they decide in this checkout, the development clone, as ~/.claude/CLAUDE.md says; the next chunk of this repo files the plan item for these calls."
|
||||
ask = Ask(loop.effects.new_id(), str(loop.session.id), loop.root, question, loop.effects.now(), OpenOnTerminal())
|
||||
with listed(loop.listed.folder, ask, loop.effects):
|
||||
unstarted = hand_over(ClaudeCommand(claude_args(rung, [prompt]), str(loop.paths.config_clone), {}), loop.effects)
|
||||
|
||||
@@ -122,7 +122,7 @@ Exit 2, when the human is needed to go on:
|
||||
- stdin or stdout is not a terminal, when a model must be picked or an interrupt answered
|
||||
- the input ends while a model is picked
|
||||
- an interrupt's answer is empty, or the input ends before one is typed
|
||||
- the claude opened for /talk, here or in loop-inbox, or for a release ready to cut, ends with
|
||||
nothing typed
|
||||
- the claude opened for /talk, here or in loop-inbox, or for a release ready to cut, ends without
|
||||
anything typed
|
||||
- the judge rules a chunk unfinished 6 cycles running; rerun to give it 6 more
|
||||
Rerunning resumes any open session."""
|
||||
|
||||
@@ -16,5 +16,5 @@ def read_premises(root: str) -> str | Failure:
|
||||
if len(bodies) > 1:
|
||||
return Failure(f"README.md has ## {name} more than once - no premises.")
|
||||
if not bodies[0]:
|
||||
return Failure(f"README.md has nothing under ## {name} - no premises.")
|
||||
return Failure(f"README.md has no text under ## {name} - no premises.")
|
||||
return f"## Goals\n{found['Goals'][0]}\n\n## Audience\n{found['Audience'][0]}"
|
||||
|
||||
@@ -342,7 +342,7 @@ class Premises(unittest.TestCase):
|
||||
b"# P\n## Goals\n1. g\xff\n## Audience\nme\n": "README.md in {root} is not UTF-8 on line 3 - no premises.",
|
||||
b"# P\n## Audience\nme\n": "README.md has no ## Goals heading - no premises.",
|
||||
b"# P\n## Goals\n1. g\n": "README.md has no ## Audience heading - no premises.",
|
||||
b"# P\n## Goals\n\n## Audience\nme\n": "README.md has nothing under ## Goals - no premises.",
|
||||
b"# P\n## Goals\n\n## Audience\nme\n": "README.md has no text under ## Goals - no premises.",
|
||||
b"# P\n## Goals\n1. g\n## Audience\nme\n## Audience\nyou\n": "README.md has ## Audience more than once - no premises.",
|
||||
}
|
||||
(checkout.root / "sub").mkdir()
|
||||
@@ -801,7 +801,7 @@ class Interrupt(unittest.TestCase):
|
||||
transcript.unlink()
|
||||
run = checkout.run([*asked, interrupt()], terminal_input="/talk\n", before_typing=ANSWERING)
|
||||
self.assertEqual((run.code, run.roles()), (2, ["worker", "judge", "interrupt"]))
|
||||
self.assertTrue(run.stderr.strip().endswith("the human is needed to answer the question above, but the interrupt ended with nothing typed"))
|
||||
self.assertTrue(run.stderr.strip().endswith("the human is needed to answer the question above, but the interrupt ended without anything typed"))
|
||||
|
||||
run = checkout.run([worker(say="A or B?"), judge(interrupt=True, evidence="A or B?", question="A or B?", vanish=True)], terminal_input="/talk\n", before_typing=ANSWERING)
|
||||
self.assertEqual((run.code, run.roles()), (1, ["worker", "judge"]))
|
||||
|
||||
@@ -862,7 +862,7 @@ class Interrupts(unittest.TestCase):
|
||||
self.assertEqual(answer, "Use B.")
|
||||
self.assertIn(f"loop-inbox cannot show this question: cannot make {self.paths.waiting}: File exists", said)
|
||||
stop, _ = self.put(FakeEffects(inputs=["/talk"], on_terminal_claude=[0]))
|
||||
self.assertEqual(stop, Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed"))
|
||||
self.assertEqual(stop, Stop(2, "the human is needed to answer the question above, but the interrupt ended without anything typed"))
|
||||
|
||||
def test_makes_way_only_warns_where_loop_inbox_cannot_list_the_open_claude(self):
|
||||
self.paths.waiting.parent.mkdir(parents=True)
|
||||
@@ -892,7 +892,7 @@ class Interrupts(unittest.TestCase):
|
||||
send(self.paths.waiting, self.ask(), ClaudeEnded())
|
||||
fake = FakeEffects(inputs=[self.opening])
|
||||
stop, _ = self.put(fake, effects=dataclasses.replace(fake.effects(), alive=alive, sleep=ended))
|
||||
self.assertEqual((stop, looked, slept), (Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed"), [INBOX], [POLL_SECONDS]))
|
||||
self.assertEqual((stop, looked, slept), (Stop(2, "the human is needed to answer the question above, but the interrupt ended without anything typed"), [INBOX], [POLL_SECONDS]))
|
||||
|
||||
def test_stops_when_loop_inbox_is_gone_with_nothing_typed(self):
|
||||
looked = []
|
||||
@@ -902,7 +902,7 @@ class Interrupts(unittest.TestCase):
|
||||
return pid == INBOX and len(looked) == 1
|
||||
fake = FakeEffects(inputs=[self.opening])
|
||||
stop, _ = self.put(fake, effects=dataclasses.replace(fake.effects(), alive=alive))
|
||||
self.assertEqual((stop, looked, fake.made("sleep")), (Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed"), [INBOX, INBOX], [POLL_SECONDS]))
|
||||
self.assertEqual((stop, looked, fake.made("sleep")), (Stop(2, "the human is needed to answer the question above, but the interrupt ended without anything typed"), [INBOX, INBOX], [POLL_SECONDS]))
|
||||
|
||||
def test_lists_the_claude_open_on_its_terminal_in_loop_inbox_while_it_runs(self):
|
||||
for typed, answer_here in (([" /talk "], True), ([], False)):
|
||||
@@ -919,7 +919,7 @@ class Interrupts(unittest.TestCase):
|
||||
fake = FakeEffects(inputs=["/talk"], on_terminal_claude=[0])
|
||||
stop, _ = self.put(fake)
|
||||
self.assertEqual(fake.made("claude_on_terminal")[0][:4], ["--model", "m", "--effort", "high"])
|
||||
self.assertEqual(stop, Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed"))
|
||||
self.assertEqual(stop, Stop(2, "the human is needed to answer the question above, but the interrupt ended without anything typed"))
|
||||
|
||||
def test_hands_the_claude_that_takes_the_terminal_the_workers_environment(self):
|
||||
fake = FakeEffects(inputs=["/talk"], on_terminal_claude=[0])
|
||||
@@ -994,7 +994,7 @@ class RoutingCheck(unittest.TestCase):
|
||||
self.assertIn(f"- {call}", (self.root / "routing-figures.md").read_text())
|
||||
((args),) = fake.made("claude_on_terminal")
|
||||
self.assertEqual(args[:6], ["--model", "m", "--effort", "high", "--permission-mode", "bypassPermissions"])
|
||||
self.assertIn(f"change nothing until they answer:\n- {call}", args[6])
|
||||
self.assertIn(f"don't change anything until they answer:\n- {call}", args[6])
|
||||
self.assertEqual(fake.terminal_environments, [{"CLAUDE_CODE_SANDBOXED": "1"}])
|
||||
self.assertEqual(fake.terminal_folders, [str(self.home / "code" / "claude-config")], "the development clone, since ~/.claude holds only a release")
|
||||
self.assertIn("Record what they decide in this checkout, the development clone", args[6])
|
||||
@@ -1051,7 +1051,7 @@ class RoutingCheck(unittest.TestCase):
|
||||
with contextlib.redirect_stderr(io.StringIO()) as said, unittest.mock.patch.object(state, "mark_raised", return_value=Failure("full")):
|
||||
self.assertIsNone(routing_check.raise_calls(self.root, new, Rung("m", "high"), self.loop(fake)))
|
||||
((args),) = fake.made("claude_on_terminal")
|
||||
self.assertIn(f"change nothing until they answer:\n- {new[0].sentence()}\n- {new[1].sentence()}\nThe figures", args[6])
|
||||
self.assertIn(f"don't change anything until they answer:\n- {new[0].sentence()}\n- {new[1].sentence()}\nThe figures", args[6])
|
||||
self.assertIn(f"call for a routing change:\n- {new[0].sentence()}\n- {new[1].sentence()}\n", said.getvalue())
|
||||
self.assertIn("routing figures: full", said.getvalue())
|
||||
[sent] = fake.dms
|
||||
@@ -1690,14 +1690,14 @@ class Spend(unittest.TestCase):
|
||||
|
||||
def test_renders_the_spend_then_the_list_prices_of_each_model_it_knows(self):
|
||||
found = {("worker", "claude-opus-5-5"): Tokens(1, 2, 3, 4, 5), ("judge", "unpriced"): Tokens(input=6)}
|
||||
self.assertEqual(spend.spent_block("2026-11-01T10:00:00Z", found), """Spent since 2026-11-01T10:00:00Z, in tokens of input, cache write 5m, cache write 1h, cache read, output:
|
||||
self.assertEqual(outcomes.spent_block("2026-11-01T10:00:00Z", found), """Spent since 2026-11-01T10:00:00Z, in tokens of input, cache write 5m, cache write 1h, cache read, output:
|
||||
- worker, claude-opus-5-5: 1, 2, 3, 4, 5
|
||||
- judge, unpriced: 6, 0, 0, 0, 0
|
||||
|
||||
List prices in dollars per million tokens of input, cache write 5m, cache write 1h, cache read, output:
|
||||
- claude-opus-5-5: 4, 5, 8, 0.2, 20""")
|
||||
self.assertEqual(spend.spent_block("", {("judge", "unpriced"): Tokens(input=6)}), "Spent since the chunk began, in tokens of input, cache write 5m, cache write 1h, cache read, output:\n- judge, unpriced: 6, 0, 0, 0, 0")
|
||||
self.assertEqual(spend.spent_block("", {}), "")
|
||||
self.assertEqual(outcomes.spent_block("", {("judge", "unpriced"): Tokens(input=6)}), "Spent since the chunk began, in tokens of input, cache write 5m, cache write 1h, cache read, output:\n- judge, unpriced: 6, 0, 0, 0, 0")
|
||||
self.assertEqual(outcomes.spent_block("", {}), "")
|
||||
|
||||
def test_keeps_the_whole_typed_answer_that_holds_the_judges_quote_and_its_tokens(self):
|
||||
shown = "[human] Use A.\n[human] No, keep the old name. Use X.\nworking: keep the new name"
|
||||
|
||||
@@ -12,7 +12,7 @@ of its question as fits; the loop's terminal shows it whole. Answer as on the lo
|
||||
line is sent, and the rest is dropped; a longer answer goes through /talk.
|
||||
- /talk opens the worker's claude session here, with `claude --resume`, as /talk does on the loop's
|
||||
terminal. Once that claude ends, the loop goes on if you typed there, and the judge rules on what
|
||||
you typed; if you typed nothing, the loop stops.
|
||||
you typed; if you typed no answer, the loop stops.
|
||||
- Enter alone, or Esc, goes back to the list; unlike on the loop's terminal, it doesn't stop the loop.
|
||||
|
||||
The loop takes whichever answer comes first, here or on its terminal, so it keeps working with no
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The files loop-claude and loop-inbox share: a running loop lists itself (running_loops.py, session_lock.py) and its question (waiting/), and both read the same paths (paths.py) and open claude for the human the same way (hand_over.py).
|
||||
|
||||
A change here changes both tools. It imports nothing from loop_claude/.
|
||||
A change here changes both tools. It doesn't import anything from loop_claude/.
|
||||
"""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""What a message costs at list prices: the weights that split a chunk's recorded cost between its messages."""
|
||||
"""What a message costs at list prices. They weight how a chunk's recorded cost splits between its messages, and a Spent block records them beside what a stretch spent, so a wrong price stays wrong in every outcome written after it."""
|
||||
import dataclasses
|
||||
|
||||
from claude_code.tokens import tokens_of
|
||||
@@ -20,7 +20,7 @@ class Price:
|
||||
return self.input * 2
|
||||
|
||||
|
||||
# Anthropic's list prices as the claude-api skill lists them (cached 2026-10-06, and Fable 5.2's on 2026-11-03), with Opus 5.5's cache prices from `docs/decisions.md` → `loop-claude: the worker's claude compacts…`. Haiku 5.5's cache read is assumed at a tenth of its input, and its dearer prompts above 200k tokens are left out. Where a chunk records its cost, only the proportions between one model's messages matter, so these may be a little off.
|
||||
# Anthropic's list prices as the claude-api skill lists them (cached 2026-10-06, and Fable 5.2's on 2026-11-03), with Opus 5.5's cache prices from `docs/decisions.md` → `loop-claude: the worker's claude compacts…`. Haiku 5.5's cache read is assumed at a tenth of its input, and its dearer prompts above 200k tokens are left out. Keep each price current with that list: the prices are archived as the ones in force.
|
||||
PRICES = {
|
||||
# Archived chunks that ran on Fable 5.1 are still priced from here.
|
||||
"claude-fable-5-1": Price(10, 0.25, 50),
|
||||
@@ -0,0 +1,17 @@
|
||||
import pathlib
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from model_routing.ladder import LADDER
|
||||
from model_routing.prices import PRICES
|
||||
|
||||
|
||||
class Prices(unittest.TestCase):
|
||||
def test_every_model_on_the_ladder_has_a_price_since_a_model_without_one_is_left_out_of_every_figure(self):
|
||||
self.assertEqual(sorted({rung.model for rung in LADDER} - set(PRICES)), [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
+2
-2
@@ -9,7 +9,7 @@ sorts the items by release; within a release, question rows come first, then sec
|
||||
the rest, each group by score from highest, then by ID. Then it moves each blocker, an item
|
||||
another's Blocked by cell names, that ranks below an item it blocks to just above the first such
|
||||
item. Orders the details to match. Writes each item's R, and adds the Blocked by and R columns to a
|
||||
table without them. --check writes nothing and fails when the file is not ranked as it would be.
|
||||
table without them. --check doesn't write anything and fails when the file is not ranked as it would be.
|
||||
|
||||
A valid todo.md; ## Details and each item's detail are optional:
|
||||
|
||||
@@ -69,7 +69,7 @@ A valid todo.md; ## Details and each item's detail are optional:
|
||||
item starts, so no blocker may sit in a later release, and no item may block itself or form a
|
||||
loop. An ID at or above Next ID fails; one below it that the table no longer holds was finished
|
||||
or deleted, and is dropped.
|
||||
- ## Items holds the table and nothing else: an order goes in the scores or the Blocked by column.
|
||||
- ## Items holds only the table: an order goes in the scores or the Blocked by column.
|
||||
- The table holds the columns above. One missing L, E or I fails, and so does one with a column this
|
||||
version does not know, since writing it would drop that column.
|
||||
- A table in the old shape, with C, A, G and Goals columns in place of L, E, I and Moves, still
|
||||
|
||||
@@ -2,14 +2,12 @@ import collections
|
||||
import dataclasses
|
||||
import re
|
||||
|
||||
from claude_code.entries import AssistantTurn, Entry, parse_entry, tool_calls, ToolCall, usage_count
|
||||
from claude_code.entries import AssistantTurn, Entry, messages, parse_entry, tool_calls, ToolCall, usage_count
|
||||
from git_cli.git_command import commits
|
||||
from reading_cost.shell_reads import Reads, shell_reads
|
||||
from command_lines.shell_command import resolved, simple_commands
|
||||
|
||||
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Reading:
|
||||
"""What the worker and its subagents took in before the worker's first commit: tokens counts the new input tokens, and files counts how often each tracked file was opened or searched, by its path in the checkout."""
|
||||
@@ -46,8 +44,7 @@ def commit_time(worker: list[Entry], home: str) -> str | None:
|
||||
|
||||
|
||||
def tokens_in(turns: list[AssistantTurn]) -> int:
|
||||
usages = {turn.message_id or turn.uuid: turn.usage for turn in turns}
|
||||
return sum(usage_count(usage, "input_tokens") + usage_count(usage, "cache_creation_input_tokens") for usage in usages.values())
|
||||
return sum(usage_count(first.usage, "input_tokens") + usage_count(first.usage, "cache_creation_input_tokens") for first, *_ in messages(turns))
|
||||
|
||||
|
||||
def reads_of(call: ToolCall, cwd: str, home: str) -> Reads:
|
||||
|
||||
@@ -2,10 +2,12 @@ import re
|
||||
import typing
|
||||
|
||||
FENCE = re.compile(r"^ {0,3}(`{3,}|~{3,})", re.M)
|
||||
HEADING = re.compile(r"^(#+)\s+(.*?)\s*$")
|
||||
|
||||
|
||||
def sections(text: str) -> dict[str, list[str]]:
|
||||
blocks: list[tuple[str | None, list[str]]] = []
|
||||
def fenced_lines(text: str) -> list[tuple[str, bool]]:
|
||||
"""Each line of text with whether a code fence holds it, the fence's own lines included. A fence closes only on a line of its own marker, as long as the opener or longer."""
|
||||
found = []
|
||||
opener = ""
|
||||
for line in text.splitlines():
|
||||
if fence := FENCE.match(line):
|
||||
@@ -14,7 +16,13 @@ def sections(text: str) -> dict[str, list[str]]:
|
||||
opener = marker
|
||||
elif marker[0] == opener[0] and len(marker) >= len(opener) and not line[fence.end():].strip():
|
||||
opener = ""
|
||||
fenced = bool(opener or fence)
|
||||
found.append((line, bool(opener or fence)))
|
||||
return found
|
||||
|
||||
|
||||
def sections(text: str) -> dict[str, list[str]]:
|
||||
blocks: list[tuple[str | None, list[str]]] = []
|
||||
for line, fenced in fenced_lines(text):
|
||||
if not fenced and line.startswith("## "):
|
||||
blocks.append((line.strip()[3:], []))
|
||||
elif not fenced and line.startswith("# "):
|
||||
@@ -28,6 +36,22 @@ def sections(text: str) -> dict[str, list[str]]:
|
||||
return found
|
||||
|
||||
|
||||
def section(text: str, title: str) -> list[str] | None:
|
||||
"""The lines under the first heading whose text fullmatches the pattern title, up to the next heading of its level or above, blank lines kept; None where none does."""
|
||||
found: list[str] | None = None
|
||||
level = 0
|
||||
for line, fenced in fenced_lines(text):
|
||||
heading = None if fenced else HEADING.match(line)
|
||||
if found is None:
|
||||
if heading and re.fullmatch(title, heading.group(2)):
|
||||
found, level = [], len(heading.group(1))
|
||||
elif heading and len(heading.group(1)) <= level:
|
||||
break
|
||||
else:
|
||||
found.append(line)
|
||||
return found
|
||||
|
||||
|
||||
# Blockquoted, so a passage holding blank lines still ends visibly where the text after it starts.
|
||||
def quoted(passage: str) -> str:
|
||||
return "\n".join(f"> {line}" for line in passage.splitlines())
|
||||
|
||||
@@ -21,6 +21,17 @@ class Sections(unittest.TestCase):
|
||||
self.assertEqual(markdown_text.quoted("merged\n\nPR #1"), "> merged\n> \n> PR #1")
|
||||
|
||||
|
||||
class Section(unittest.TestCase):
|
||||
def test_holds_deeper_headings_and_fenced_lines_and_ends_at_its_own_level(self):
|
||||
text = "# P\n\n## Scoring run\n\na\n\n### Sub\n\n```\n## fenced\n```\n\n## Next\n\nb\n"
|
||||
self.assertEqual(markdown_text.section(text, "Scoring run"), ["", "a", "", "### Sub", "", "```", "## fenced", "```", ""])
|
||||
self.assertIsNone(markdown_text.section(text, "Missing"))
|
||||
|
||||
def test_a_fence_closes_only_on_its_own_marker_here_too(self):
|
||||
text = "## A\n````md\n```\n## Quoted\n````\n## B\n"
|
||||
self.assertEqual(markdown_text.section(text, "A"), ["````md", "```", "## Quoted", "````"])
|
||||
|
||||
|
||||
class Listed(unittest.TestCase):
|
||||
def test_joins_names_with_commas_and_the_conjunction_before_the_last(self):
|
||||
self.assertEqual(markdown_text.listed(["a"], "and"), "a")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The formula todo.md states its score in: arithmetic over an item's scores, parsed so that it can hold nothing else, and evaluated to a float."""
|
||||
"""The formula todo.md states its score in: arithmetic over an item's scores, parsed so that it can't hold anything else, and evaluated to a float."""
|
||||
import ast
|
||||
import math
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class Shape:
|
||||
"""A shape of the items table: its columns, and how its goals cell reads and writes."""
|
||||
# The score columns, in the order the table holds them.
|
||||
score_columns: tuple[str, ...]
|
||||
# The columns a reader does without: a missing BLOCKED_BY reads as blocked by nothing, a missing score column as that score unset, and a missing Score column as not yet ranked.
|
||||
# The columns a reader does without: a missing BLOCKED_BY reads as not blocked, a missing score column as that score unset, and a missing Score column as not yet ranked.
|
||||
optional: tuple[str, ...]
|
||||
# The columns rank_todo.py needs to rank a row, so no chunk starts on an item whose risk is unscored.
|
||||
risk_columns: tuple[str, ...]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import pathlib
|
||||
|
||||
# Each module here checks a convention of the repo's own files, as a linter does, so it reads source or Markdown. technical-principles.md bans scanning source only in a test of a unit's behaviour.
|
||||
|
||||
# The checkout root.
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[2]
|
||||
|
||||
+24
-267
@@ -24,7 +24,7 @@ then replays the rounds on each rung below, highest first: the project's model a
|
||||
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
|
||||
finds none. 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
|
||||
@@ -32,63 +32,44 @@ 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 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
|
||||
none. 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
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import typing
|
||||
|
||||
from transcript_archive.location import archive_root
|
||||
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 review_replay.rounds import archived_rounds, Round, sample
|
||||
from rung_replay.command import arguments_or_exit, failed, limited_exit
|
||||
from review_replay.replay import codes_found, findings_replayed
|
||||
from review_replay.omit_comparison import compared
|
||||
from loop_effects.effects import Effects
|
||||
from failure import Failure
|
||||
from rung_replay.search import first_reply, replayed_on
|
||||
from claude_code.transcript import first_timestamped_line, read_transcript
|
||||
from claude_code.entries import parse_entry, structured_output
|
||||
from review_rules.reviewer_context import principles_line, reviewer_context
|
||||
from claude_code.reply import Limited
|
||||
from model_routing.ladder import project_rung, Rung
|
||||
from review_rules.review_folder import REPORTS, review_folder
|
||||
from review_replay.recall import recall_report, recalled
|
||||
from review_rules.review_passes import ReviewedPass, REVIEWERS
|
||||
|
||||
TOOL = "review-replay"
|
||||
OMIT = "--omit-claude-md"
|
||||
# Starts claude without its instruction files, as `omitClaudeMd` starts a subagent.
|
||||
NO_CLAUDE_MD = ["--settings", json.dumps({"env": {"CLAUDE_CODE_DISABLE_CLAUDE_MDS": "1"}})]
|
||||
USAGE = f"{TOOL} <pass> <model> [{OMIT}], <pass> one of {', '.join(REVIEWERS)} and <model> a model on the routing ladder"
|
||||
LATEST = 10
|
||||
MATCH_SCHEMA = {"type": "object", "properties": {"found": {"type": "array", "items": {"type": "integer"}}}, "required": ["found"], "additionalProperties": False}
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Code:
|
||||
"""Where a round's reviewer read the code, the commit it read, the default branch, and where that branch stood as the chunk began."""
|
||||
path: str
|
||||
reviewed: str
|
||||
default: str
|
||||
base: str
|
||||
|
||||
|
||||
def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, effects: Effects) -> int:
|
||||
@@ -104,7 +85,11 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
|
||||
return failed(TOOL, f"no archived {reviewed} round of projects on {project.model} in {archive_root(home, env)} holds a 🔴 or 🟡 on code it can find")
|
||||
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))
|
||||
report = compared(reviewed, project, chosen, lambda found, bare: findings_replayed(found, codes[found], project, project, home, effects, bare))
|
||||
if isinstance(report, Limited):
|
||||
return limited_exit(TOOL, report)
|
||||
print(report)
|
||||
return 0
|
||||
|
||||
def replay_one(found: Round, rung: Rung) -> set[int] | Failure | Limited:
|
||||
matched = findings_replayed(found, codes[found], rung, project, home, effects, False)
|
||||
@@ -119,57 +104,6 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
|
||||
return 0
|
||||
|
||||
|
||||
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 _ 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 twice 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, True):
|
||||
def replay_one(one: Round, _: Rung, bare: bool = bare) -> set[int] | Failure | Limited:
|
||||
found = found_on(one, bare)
|
||||
if isinstance(found, Failure):
|
||||
print(f" {one.root} {one.at} {'without' if bare else 'with'} the instruction files failed, so the round is left out: {found.reason}", file=sys.stderr, flush=True)
|
||||
return found
|
||||
|
||||
found: list[set[int] | Failure] | Limited = replayed_on(chosen, project, replay_one, f"{reviewed} rounds {'without' if bare else 'with'} the instruction files")
|
||||
if isinstance(found, Limited):
|
||||
return limited_exit(TOOL, found)
|
||||
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)))
|
||||
return 0
|
||||
|
||||
|
||||
def pass_and_model(argv: list[str]) -> tuple[ReviewedPass, Rung, bool] | None:
|
||||
"""The pass, the project's rung of the model, and whether OMIT follows, as argv names them in `<pass> <model> [--omit-claude-md]`; None for any other argv."""
|
||||
if argv[2:] not in ([], [OMIT]) or len(argv) < 2:
|
||||
@@ -177,180 +111,3 @@ def pass_and_model(argv: list[str]) -> tuple[ReviewedPass, Rung, bool] | None:
|
||||
reviewed = next((kind for kind in REVIEWERS if kind == argv[0]), None)
|
||||
project = project_rung(argv[1])
|
||||
return (reviewed, project, argv[2:] == [OMIT]) if reviewed and project else None
|
||||
|
||||
|
||||
def codes_found(rounds: list[Round], effects: Effects) -> dict[Round, Code]:
|
||||
"""The code each round reviewed, as code_of finds it; stderr names each round left out, and why."""
|
||||
codes = {}
|
||||
for found in rounds:
|
||||
if isinstance(code := code_of(found, effects), Failure):
|
||||
print(f"{found.root} {found.at} is left out: {code.reason}", file=sys.stderr, flush=True)
|
||||
else:
|
||||
codes[found] = code
|
||||
return codes
|
||||
|
||||
|
||||
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):
|
||||
return projects
|
||||
found = []
|
||||
try:
|
||||
for key in projects:
|
||||
for chunk in sorted(path for path in (root / key).glob("*") if path.is_dir()):
|
||||
found += chunk_rounds(reviewer, checkout_of(key, home), chunk)
|
||||
except (OSError, UnicodeDecodeError, ValueError) as failure:
|
||||
return Failure(f"could not read the archive {root}: {failure}")
|
||||
return found
|
||||
|
||||
|
||||
def chunk_rounds(reviewer: str, checkout: str, chunk: pathlib.Path) -> list[Round]:
|
||||
copies = sorted(chunk.glob("*.jsonl"))
|
||||
began = parse_entry(first_timestamped_line(copies[0].read_bytes())) if copies else None
|
||||
if not began or not began.timestamp:
|
||||
return []
|
||||
found = []
|
||||
for meta in sorted(chunk.glob("session/*/subagents/*.meta.json")):
|
||||
described = json.loads(meta.read_text(encoding="utf-8"))
|
||||
if not isinstance(described, dict) or described.get("agentType") != reviewer:
|
||||
continue
|
||||
entries = read_transcript(str(meta.with_name(meta.name.removesuffix(".meta.json") + ".jsonl")))
|
||||
if not isinstance(entries, Failure) and (one := round_from(reviewer, checkout, stamp_seconds(began.timestamp), entries)):
|
||||
found.append(one)
|
||||
return found
|
||||
|
||||
|
||||
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 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")
|
||||
path = reviewed_path(found.prompt, found.root, os.path.exists)
|
||||
if path is None:
|
||||
return Failure("the prompt names neither one removed worktree nor the checkout")
|
||||
default = effects.git("symbolic-ref", "--short", "refs/remotes/origin/HEAD", cwd=found.root)
|
||||
if isinstance(default, Failure):
|
||||
return default
|
||||
default = default.strip().removeprefix("origin/")
|
||||
log = effects.git("log", "--format=%H %at", f"refs/remotes/origin/{default}", cwd=found.root)
|
||||
main_line = effects.git("log", "--first-parent", "--format=%H %at", f"refs/remotes/origin/{default}", cwd=found.root)
|
||||
if isinstance(log, Failure):
|
||||
return log
|
||||
if isinstance(main_line, Failure):
|
||||
return main_line
|
||||
reviewed, base = authored_by(commit_log(log), found.seconds), authored_by(commit_log(main_line), found.began)
|
||||
if reviewed is None or base is None:
|
||||
return Failure("no commit was authored by then")
|
||||
return Code(path, reviewed, default, base)
|
||||
|
||||
|
||||
def commit_log(listed: str) -> list[tuple[str, float]]:
|
||||
return [(commit, float(authored)) for commit, authored in (line.split() for line in listed.splitlines())]
|
||||
|
||||
|
||||
def findings_replayed(found: Round, code: Code, rung: Rung, project: Rung, home: pathlib.Path, effects: Effects, bare: bool) -> set[int] | Failure | Limited:
|
||||
"""The indexes of the round's findings that its replay on rung reports, as claude on the project's rung matches them, or the Failure of the review or the match; where bare, the replay runs without CLAUDE.md, as `launch` says."""
|
||||
reviewed: str | Failure | Limited = first_reply(lambda: review(found, code, rung, home, effects, bare))
|
||||
if isinstance(reviewed, (Failure, Limited)):
|
||||
return reviewed
|
||||
return first_reply(lambda: match(found.findings, reviewed, found.root, project, effects))
|
||||
|
||||
|
||||
@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."""
|
||||
clone: str
|
||||
reports: str
|
||||
|
||||
|
||||
# The shell makes and removes the clone itself, and is tested on a temporary home as judge-replay's is; rounds.py's core takes the filesystem as an argument.
|
||||
def review(found: Round, code: Code, rung: Rung, home: pathlib.Path, effects: Effects, bare: bool) -> str | Failure | Limited:
|
||||
try:
|
||||
(home / REPORTS).mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
with tempfile.TemporaryDirectory(prefix="review-replay-", ignore_cleanup_errors=True) as clone, tempfile.TemporaryDirectory(prefix="review-replay-", dir=home / REPORTS, ignore_cleanup_errors=True) as reports:
|
||||
return reviewed_in(found, code, rung, Copies(clone, reports), home, effects, bare)
|
||||
except OSError as failure:
|
||||
return Failure(f"could not prepare the replay: {failure}")
|
||||
|
||||
|
||||
def reviewed_in(found: Round, code: Code, rung: Rung, copies: Copies, home: pathlib.Path, effects: Effects, bare: bool) -> str | Failure | Limited:
|
||||
"""The report of found's reviewer on rung, replayed on code cloned into copies.clone, with its review folder copied into copies.reports; without CLAUDE.md where bare."""
|
||||
folder = pathlib.Path(review_folder(str(home), code.path))
|
||||
copy_reports(found, folder, copies.reports)
|
||||
prompt = redirected(found.prompt, home, folder, code.path, copies)
|
||||
if isinstance(prompt, Failure):
|
||||
return prompt
|
||||
if lost := lost_inputs(prompt, copies.reports, lambda name: (pathlib.Path(copies.reports) / name).exists()):
|
||||
return Failure(f"the prompt names {', '.join(lost)}, which the review folder did not hold from the chunk's start until the round's")
|
||||
if isinstance(cloned := clone_reviewed(found, code, copies.clone, effects), Failure):
|
||||
return cloned
|
||||
launched = launch(found.reviewer, rung, prompt, copies.clone, home, bare)
|
||||
if isinstance(launched, Failure):
|
||||
return launched
|
||||
reply = claude_reply(effects.claude, launched[0], copies.clone, launched[1], "claude")
|
||||
if isinstance(reply, Failure | Limited):
|
||||
return reply
|
||||
return reply["result"] if isinstance(reply.get("result"), str) else Failure("the reviewer replied with no report")
|
||||
|
||||
|
||||
def launch(reviewer: str, rung: Rung, prompt: str, clone: str, home: pathlib.Path, bare: bool) -> tuple[list[str], str] | Failure:
|
||||
"""claude's arguments and prompt for reviewer on rung. Where bare, it starts without CLAUDE.md, and the prompt holds what the SubagentStart hook and the header's last line hand such a reviewer."""
|
||||
args = ["--agent", reviewer, *rung.flags()]
|
||||
if not bare:
|
||||
return args, prompt
|
||||
context = reviewer_context(home)
|
||||
if isinstance(context, Failure):
|
||||
return context
|
||||
return [*args, *NO_CLAUDE_MD], "\n".join([f"{context}\n\n{prompt}", *([principles] if (principles := principles_line(clone)) else [])])
|
||||
|
||||
|
||||
def copy_reports(found: Round, folder: pathlib.Path, reports: str) -> None:
|
||||
"""Copies into reports each report written to folder after found's chunk began and before its round did."""
|
||||
# The round's own report, any later one, and one from an earlier attempt at the item in the same worktree would each hand the reviewer the findings it is to find.
|
||||
for written in folder.iterdir() if folder.is_dir() else ():
|
||||
if written.is_file() and found.began <= written.stat().st_mtime < found.seconds:
|
||||
shutil.copy2(written, reports)
|
||||
|
||||
|
||||
def redirected(prompt: str, home: pathlib.Path, folder: pathlib.Path, worktree: str, copies: Copies) -> str | Failure:
|
||||
"""prompt naming copies.reports in place of the review folder, in either spelling, and copies.clone in place of the worktree; a Failure where it still names the review folder."""
|
||||
# Replace the folder's path first: outside home it contains the worktree's path, which replacing the worktree's would otherwise turn into the clone's.
|
||||
prompt = prompt.replace(str(folder), copies.reports).replace(f"~/{folder.relative_to(home)}", copies.reports).replace(worktree, copies.clone)
|
||||
# A spelling the rewrite misses, such as $HOME/, would leave the reviewer the live folder and the findings in it.
|
||||
if REPORTS in prompt.replace(copies.reports, ""):
|
||||
return Failure("the prompt names the review folder in a spelling the replay does not redirect")
|
||||
return prompt
|
||||
|
||||
|
||||
def clone_reviewed(found: Round, code: Code, clone: str, effects: Effects) -> Failure | None:
|
||||
"""Clones found's checkout into clone, on the commit its reviewer read, with the default branch where it stood as the chunk began."""
|
||||
for command in (
|
||||
("clone", "--quiet", "--shared", "--no-checkout", found.root, clone),
|
||||
("-C", clone, "update-ref", f"refs/remotes/origin/{code.default}", code.base),
|
||||
("-C", clone, "update-ref", f"refs/heads/{code.default}", code.base),
|
||||
("-C", clone, "checkout", "--quiet", *(("-B", found.branch) if found.branch and found.branch != code.default else ("--detach",)), code.reviewed),
|
||||
):
|
||||
if isinstance(ran := effects.git(*command, cwd=found.root), Failure):
|
||||
return ran
|
||||
return None
|
||||
|
||||
|
||||
def match(findings: tuple[str, ...], replay_report: str, root: str, rung: Rung, effects: Effects) -> set[int] | Failure | Limited:
|
||||
numbered = "\n\n".join(f"{n}. {finding}" for n, finding in enumerate(findings, 1))
|
||||
prompt = (
|
||||
"A code reviewer reported the numbered findings below. Another reviewer then reviewed the same change; its report follows them. "
|
||||
"List the number of each finding that the other report also raises as 🔴 or 🟡: the same defect, at the same place or from the same cause, however it is worded. "
|
||||
"A finding it raises only as 🟢 or ❓, or not at all, is not listed.\n\n"
|
||||
f"The findings:\n{numbered}\n\nThe other report:\n{replay_report}"
|
||||
)
|
||||
args = ["--json-schema", json.dumps(MATCH_SCHEMA), *rung.flags(), "--tools", ""]
|
||||
reply = claude_reply(effects.claude, args, root, prompt, "claude")
|
||||
if isinstance(reply, Failure | Limited):
|
||||
return reply
|
||||
output = structured_output(reply)
|
||||
numbers = output.get("found") if isinstance(output, dict) else None
|
||||
if not isinstance(numbers, list) or not all(isinstance(n, int) for n in numbers):
|
||||
return Failure(f"the match replied: {json.dumps(reply)}")
|
||||
return {n - 1 for n in numbers if 1 <= n <= len(findings)}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
"""The experiment behind review-replay's --omit-claude-md: three replays of a pass's rounds with CLAUDE.md, one without, and the report that holds the one without to what the others found: 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`."""
|
||||
import sys
|
||||
import typing
|
||||
|
||||
from failure import Failure
|
||||
from claude_code.reply import Limited
|
||||
from rung_replay.search import replayed_on
|
||||
from review_replay.rounds import Round
|
||||
from model_routing.ladder import Rung
|
||||
|
||||
|
||||
def compared(reviewed: str, project: Rung, chosen: list[Round], found_on: typing.Callable[[Round, bool], set[int] | Failure | Limited]) -> str | Limited:
|
||||
"""Replays chosen three times with CLAUDE.md and once without, as found_on(round, bare) finds, and reports the comparison of the rounds no replay failed on; the Limited where claude hit its usage limit."""
|
||||
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):
|
||||
print(f" {one.root} {one.at} {'without' if bare else 'with'} the instruction files failed, so the round is left out: {found.reason}", file=sys.stderr, flush=True)
|
||||
return found
|
||||
|
||||
found: list[set[int] | Failure] | Limited = replayed_on(chosen, project, replay_one, f"{reviewed} rounds {'without' if bare else 'with'} the instruction files")
|
||||
if isinstance(found, Limited):
|
||||
return found
|
||||
runs.append(found)
|
||||
# A failed replay found no findings, which would lower the bar where it had CLAUDE.md and count as misses where it had none.
|
||||
kept = rounds_without_failure(chosen, runs)
|
||||
first, second, third, without = ([found[run] for _, found in kept] for run in range(4))
|
||||
return comparison(reviewed, project, [one for one, _ in kept], (first, second, third), without, len(chosen) - len(kept))
|
||||
|
||||
|
||||
def rounds_without_failure(chosen: list[Round], runs: list[list[set[int] | Failure]]) -> list[tuple[Round, list[set[int]]]]:
|
||||
"""Each round of chosen that no run failed on, with what each run found in it."""
|
||||
kept = []
|
||||
for one, *found in zip(chosen, *runs):
|
||||
finds = [each for each in found if not isinstance(each, Failure)]
|
||||
if len(finds) == len(found):
|
||||
kept.append((one, finds))
|
||||
return kept
|
||||
|
||||
|
||||
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 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, 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 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 []),
|
||||
])
|
||||
@@ -1,10 +1,14 @@
|
||||
"""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 failure import Failure
|
||||
from fractions import Fraction
|
||||
from review_replay.rounds import is_red, Round
|
||||
from model_routing.ladder import LADDER, Rung
|
||||
from claude_code.reply import Limited
|
||||
import math
|
||||
from rung_replay.search import replayed_on
|
||||
import typing
|
||||
|
||||
# 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)
|
||||
@@ -60,7 +64,7 @@ def mean_share(rounds: list[Round], reference: Reference) -> Fraction:
|
||||
|
||||
|
||||
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."""
|
||||
"""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 none would qualify."""
|
||||
return math.ceil((mean_share(rounds, reference) - MARGIN) * held(rounds))
|
||||
|
||||
|
||||
@@ -91,3 +95,33 @@ def recall_report(reviewed: str, project: Rung, recall: Recall) -> str:
|
||||
|
||||
def percent(fraction: Fraction) -> str:
|
||||
return f"{float(fraction):.0%}"
|
||||
|
||||
|
||||
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 _ 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 none, 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)
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
"""Replay one archived review round on one rung: the code the round reviewed, found again in a throwaway clone, the reviewer's report on it, and the match of that report to the round's archived findings: 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 json
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from review_replay.rounds import authored_by, lost_inputs, reviewed_path, Round
|
||||
from claude_code.reply import claude_reply, Limited
|
||||
from git_cli.git_repo import default_ref
|
||||
from loop_effects.effects import Effects
|
||||
from failure import Failure
|
||||
from rung_replay.search import first_reply
|
||||
from review_rules.reviewer_context import principles_line, reviewer_context
|
||||
from review_rules.review_folder import REPORTS, review_folder
|
||||
from model_routing.ladder import Rung
|
||||
from claude_code.entries import structured_output
|
||||
|
||||
# Starts claude without its instruction files, as `omitClaudeMd` starts a subagent.
|
||||
NO_CLAUDE_MD = ["--settings", json.dumps({"env": {"CLAUDE_CODE_DISABLE_CLAUDE_MDS": "1"}})]
|
||||
MATCH_SCHEMA = {"type": "object", "properties": {"found": {"type": "array", "items": {"type": "integer"}}}, "required": ["found"], "additionalProperties": False}
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Code:
|
||||
"""Where a round's reviewer read the code, the commit it read, the default branch, and where that branch stood as the chunk began."""
|
||||
path: str
|
||||
reviewed: str
|
||||
default: str
|
||||
base: str
|
||||
|
||||
|
||||
def codes_found(rounds: list[Round], effects: Effects) -> dict[Round, Code]:
|
||||
"""The code each round reviewed, as code_of finds it; stderr names each round left out, and why."""
|
||||
codes = {}
|
||||
for found in rounds:
|
||||
if isinstance(code := code_of(found, effects), Failure):
|
||||
print(f"{found.root} {found.at} is left out: {code.reason}", file=sys.stderr, flush=True)
|
||||
else:
|
||||
codes[found] = code
|
||||
return codes
|
||||
|
||||
|
||||
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 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")
|
||||
path = reviewed_path(found.prompt, found.root, os.path.exists)
|
||||
if path is None:
|
||||
return Failure("the prompt names neither one removed worktree nor the checkout")
|
||||
ref = default_ref(cwd=found.root, guarded=True, run=effects.git)
|
||||
if isinstance(ref, Failure):
|
||||
return ref
|
||||
default = ref.removeprefix("origin/")
|
||||
log = effects.git("log", "--format=%H %at", f"refs/remotes/origin/{default}", cwd=found.root)
|
||||
main_line = effects.git("log", "--first-parent", "--format=%H %at", f"refs/remotes/origin/{default}", cwd=found.root)
|
||||
if isinstance(log, Failure):
|
||||
return log
|
||||
if isinstance(main_line, Failure):
|
||||
return main_line
|
||||
reviewed, base = authored_by(commit_log(log), found.seconds), authored_by(commit_log(main_line), found.began)
|
||||
if reviewed is None or base is None:
|
||||
return Failure("no commit was authored by then")
|
||||
return Code(path, reviewed, default, base)
|
||||
|
||||
|
||||
def commit_log(listed: str) -> list[tuple[str, float]]:
|
||||
return [(commit, float(authored)) for commit, authored in (line.split() for line in listed.splitlines())]
|
||||
|
||||
|
||||
def findings_replayed(found: Round, code: Code, rung: Rung, project: Rung, home: pathlib.Path, effects: Effects, bare: bool) -> set[int] | Failure | Limited:
|
||||
"""The indexes of the round's findings that its replay on rung reports, as claude on the project's rung matches them, or the Failure of the review or the match; where bare, the replay runs without CLAUDE.md, as `launch` says."""
|
||||
reviewed: str | Failure | Limited = first_reply(lambda: review(found, code, rung, home, effects, bare))
|
||||
if isinstance(reviewed, (Failure, Limited)):
|
||||
return reviewed
|
||||
return first_reply(lambda: match(found.findings, reviewed, found.root, project, effects))
|
||||
|
||||
|
||||
@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."""
|
||||
clone: str
|
||||
reports: str
|
||||
|
||||
|
||||
# The shell makes and removes the clone itself, and is tested on a temporary home as judge-replay's is.
|
||||
def review(found: Round, code: Code, rung: Rung, home: pathlib.Path, effects: Effects, bare: bool) -> str | Failure | Limited:
|
||||
try:
|
||||
(home / REPORTS).mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
with tempfile.TemporaryDirectory(prefix="review-replay-", ignore_cleanup_errors=True) as clone, tempfile.TemporaryDirectory(prefix="review-replay-", dir=home / REPORTS, ignore_cleanup_errors=True) as reports:
|
||||
return reviewed_in(found, code, rung, Copies(clone, reports), home, effects, bare)
|
||||
except OSError as failure:
|
||||
return Failure(f"could not prepare the replay: {failure}")
|
||||
|
||||
|
||||
def reviewed_in(found: Round, code: Code, rung: Rung, copies: Copies, home: pathlib.Path, effects: Effects, bare: bool) -> str | Failure | Limited:
|
||||
"""The report of found's reviewer on rung, replayed on code cloned into copies.clone, with its review folder copied into copies.reports; without CLAUDE.md where bare."""
|
||||
folder = pathlib.Path(review_folder(str(home), code.path))
|
||||
copy_reports(found, folder, copies.reports)
|
||||
prompt = redirected(found.prompt, home, folder, code.path, copies)
|
||||
if isinstance(prompt, Failure):
|
||||
return prompt
|
||||
if lost := lost_inputs(prompt, copies.reports, lambda name: (pathlib.Path(copies.reports) / name).exists()):
|
||||
return Failure(f"the prompt names {', '.join(lost)}, which the review folder did not hold from the chunk's start until the round's")
|
||||
if isinstance(cloned := clone_reviewed(found, code, copies.clone, effects), Failure):
|
||||
return cloned
|
||||
launched = launch(found.reviewer, rung, prompt, copies.clone, home, bare)
|
||||
if isinstance(launched, Failure):
|
||||
return launched
|
||||
reply = claude_reply(effects.claude, launched[0], copies.clone, launched[1], "claude")
|
||||
if isinstance(reply, Failure | Limited):
|
||||
return reply
|
||||
return reply["result"] if isinstance(reply.get("result"), str) else Failure("the reviewer replied with no report")
|
||||
|
||||
|
||||
def launch(reviewer: str, rung: Rung, prompt: str, clone: str, home: pathlib.Path, bare: bool) -> tuple[list[str], str] | Failure:
|
||||
"""claude's arguments and prompt for reviewer on rung. Where bare, it starts without CLAUDE.md, and the prompt holds what the SubagentStart hook and the header's last line hand such a reviewer."""
|
||||
args = ["--agent", reviewer, *rung.flags()]
|
||||
if not bare:
|
||||
return args, prompt
|
||||
context = reviewer_context(home)
|
||||
if isinstance(context, Failure):
|
||||
return context
|
||||
return [*args, *NO_CLAUDE_MD], "\n".join([f"{context}\n\n{prompt}", *([principles] if (principles := principles_line(clone)) else [])])
|
||||
|
||||
|
||||
def copy_reports(found: Round, folder: pathlib.Path, reports: str) -> None:
|
||||
"""Copies into reports each report written to folder after found's chunk began and before its round did."""
|
||||
# The round's own report, any later one, and one from an earlier attempt at the item in the same worktree would each hand the reviewer the findings it is to find.
|
||||
for written in folder.iterdir() if folder.is_dir() else ():
|
||||
if written.is_file() and found.began <= written.stat().st_mtime < found.seconds:
|
||||
shutil.copy2(written, reports)
|
||||
|
||||
|
||||
def redirected(prompt: str, home: pathlib.Path, folder: pathlib.Path, worktree: str, copies: Copies) -> str | Failure:
|
||||
"""prompt naming copies.reports in place of the review folder, in either spelling, and copies.clone in place of the worktree; a Failure where it still names the review folder."""
|
||||
# Replace the folder's path first: outside home it contains the worktree's path, which replacing the worktree's would otherwise turn into the clone's.
|
||||
prompt = prompt.replace(str(folder), copies.reports).replace(f"~/{folder.relative_to(home)}", copies.reports).replace(worktree, copies.clone)
|
||||
# A spelling the rewrite misses, such as $HOME/, would leave the reviewer the live folder and the findings in it.
|
||||
if REPORTS in prompt.replace(copies.reports, ""):
|
||||
return Failure("the prompt names the review folder in a spelling the replay does not redirect")
|
||||
return prompt
|
||||
|
||||
|
||||
def clone_reviewed(found: Round, code: Code, clone: str, effects: Effects) -> Failure | None:
|
||||
"""Clones found's checkout into clone, on the commit its reviewer read, with the default branch where it stood as the chunk began."""
|
||||
for command in (
|
||||
("clone", "--quiet", "--shared", "--no-checkout", found.root, clone),
|
||||
("-C", clone, "update-ref", f"refs/remotes/origin/{code.default}", code.base),
|
||||
("-C", clone, "update-ref", f"refs/heads/{code.default}", code.base),
|
||||
("-C", clone, "checkout", "--quiet", *(("-B", found.branch) if found.branch and found.branch != code.default else ("--detach",)), code.reviewed),
|
||||
):
|
||||
if isinstance(ran := effects.git(*command, cwd=found.root), Failure):
|
||||
return ran
|
||||
return None
|
||||
|
||||
|
||||
def match(findings: tuple[str, ...], replay_report: str, root: str, rung: Rung, effects: Effects) -> set[int] | Failure | Limited:
|
||||
numbered = "\n\n".join(f"{n}. {finding}" for n, finding in enumerate(findings, 1))
|
||||
prompt = (
|
||||
"A code reviewer reported the numbered findings below. Another reviewer then reviewed the same change; its report follows them. "
|
||||
"List the number of each finding that the other report also raises as 🔴 or 🟡: the same defect, at the same place or from the same cause, however it is worded. "
|
||||
"A finding it raises only as 🟢 or ❓, or not at all, is not listed.\n\n"
|
||||
f"The findings:\n{numbered}\n\nThe other report:\n{replay_report}"
|
||||
)
|
||||
args = ["--json-schema", json.dumps(MATCH_SCHEMA), *rung.flags(), "--tools", ""]
|
||||
reply = claude_reply(effects.claude, args, root, prompt, "claude")
|
||||
if isinstance(reply, Failure | Limited):
|
||||
return reply
|
||||
output = structured_output(reply)
|
||||
numbers = output.get("found") if isinstance(output, dict) else None
|
||||
if not isinstance(numbers, list) or not all(isinstance(n, int) for n in numbers):
|
||||
return Failure(f"the match replied: {json.dumps(reply)}")
|
||||
return {n - 1 for n in numbers if 1 <= n <= len(findings)}
|
||||
+33
-17
@@ -1,12 +1,16 @@
|
||||
"""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`."""
|
||||
"""Which archived rounds of a review pass to replay, and the code each reviewed: 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 json
|
||||
import pathlib
|
||||
import re
|
||||
import typing
|
||||
|
||||
from claude_code.entries import AssistantTurn, Entry, Text, UserText
|
||||
from model_routing.ladder import Rung
|
||||
from claude_code.entries import AssistantTurn, Entry, parse_entry, Text, UserText
|
||||
from transcript_archive.project_key import checkout_of
|
||||
from failure import Failure
|
||||
from claude_code.transcript import first_timestamped_line, read_transcript
|
||||
from rung_replay.command import projects_on
|
||||
|
||||
# A line that opens with a 🔴 or 🟡 mark, after any list, table, heading or bold markup, as review-findings.md has reviewers report them.
|
||||
FINDING = re.compile(r"^[\s#>*+|-]*(?:\d+[.)]\s*)?[*_]*\s*(?:🔴|🟡)")
|
||||
@@ -107,19 +111,31 @@ def sample(rounds: list[Round], latest: int) -> list[Round]:
|
||||
return sorted(rounds, key=lambda found: (found.seconds, found.root))[-latest:]
|
||||
|
||||
|
||||
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 archived_rounds(reviewer: str, model: str, root: pathlib.Path, home: pathlib.Path) -> list[Round] | Failure:
|
||||
projects = projects_on(model, home)
|
||||
if isinstance(projects, Failure):
|
||||
return projects
|
||||
found = []
|
||||
try:
|
||||
for key in projects:
|
||||
for chunk in sorted(path for path in (root / key).glob("*") if path.is_dir()):
|
||||
found += chunk_rounds(reviewer, checkout_of(key, home), chunk)
|
||||
except (OSError, UnicodeDecodeError, ValueError) as failure:
|
||||
return Failure(f"could not read the archive {root}: {failure}")
|
||||
return found
|
||||
|
||||
def count(run: list[set[int]]) -> int:
|
||||
return sum(len(found) for found in run)
|
||||
|
||||
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"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" {found_round.root} {found_round.at}: {found_round.findings[index].splitlines()[0]}" for found_round, index in missed),
|
||||
])
|
||||
def chunk_rounds(reviewer: str, checkout: str, chunk: pathlib.Path) -> list[Round]:
|
||||
copies = sorted(chunk.glob("*.jsonl"))
|
||||
began = parse_entry(first_timestamped_line(copies[0].read_bytes())) if copies else None
|
||||
if not began or not began.timestamp:
|
||||
return []
|
||||
found = []
|
||||
for meta in sorted(chunk.glob("session/*/subagents/*.meta.json")):
|
||||
described = json.loads(meta.read_text(encoding="utf-8"))
|
||||
if not isinstance(described, dict) or described.get("agentType") != reviewer:
|
||||
continue
|
||||
entries = read_transcript(str(meta.with_name(meta.name.removesuffix(".meta.json") + ".jsonl")))
|
||||
if not isinstance(entries, Failure) and (one := round_from(reviewer, checkout, stamp_seconds(began.timestamp), entries)):
|
||||
found.append(one)
|
||||
return found
|
||||
|
||||
@@ -18,7 +18,7 @@ from review_replay.rounds import authored_by, lost_inputs, recorded_findings, re
|
||||
from loop_effects.effects import Effects, system_effects
|
||||
from claude_code.entries import entry_from
|
||||
from failure import Failure
|
||||
from review_replay import main, recall
|
||||
from review_replay import main, recall, replay
|
||||
from review_rules.reviewer_context import reviewer_context
|
||||
from review_rules.review_passes import REVIEWERS
|
||||
from model_routing.ladder import Rung
|
||||
@@ -124,17 +124,17 @@ class Launch(unittest.TestCase):
|
||||
self.clone.mkdir()
|
||||
|
||||
def test_runs_the_reviewer_as_archived_with_claude_md(self):
|
||||
self.assertEqual(main.launch("prose-reviewer", REFERENCE, "Review it.", str(self.clone), self.home, False), (["--agent", "prose-reviewer", *REFERENCE.flags()], "Review it."))
|
||||
self.assertEqual(replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.clone), self.home, False), (["--agent", "prose-reviewer", *REFERENCE.flags()], "Review it."))
|
||||
|
||||
def test_drops_claude_md_and_hands_the_reviewer_what_the_hook_and_the_header_would(self):
|
||||
(self.clone / "AGENTS.md").write_text("")
|
||||
args, prompt = main.launch("prose-reviewer", REFERENCE, "Review it.", str(self.clone), self.home, True)
|
||||
args, prompt = replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.clone), self.home, True)
|
||||
self.assertEqual(args, ["--agent", "prose-reviewer", *REFERENCE.flags(), "--settings", json.dumps({"env": {"CLAUDE_CODE_DISABLE_CLAUDE_MDS": "1"}})])
|
||||
self.assertEqual(prompt, f"{reviewer_context(self.home)}\n\nReview it.\nPrinciples: read {self.clone}/AGENTS.md first, for the project principles and the decision titles.")
|
||||
|
||||
def test_fails_without_the_sections_to_hand_over(self):
|
||||
(self.home / ".claude" / "CLAUDE.md").write_text("")
|
||||
self.assertIsInstance(main.launch("prose-reviewer", REFERENCE, "Review it.", str(self.clone), self.home, True), Failure)
|
||||
self.assertIsInstance(replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.clone), self.home, True), Failure)
|
||||
|
||||
|
||||
class Match(unittest.TestCase):
|
||||
@@ -145,14 +145,14 @@ class Match(unittest.TestCase):
|
||||
self.asked.append((args, cwd, prompt))
|
||||
return subprocess.CompletedProcess(args, 0, stdout, "")
|
||||
|
||||
return main.match(("🔴 a", "🟡 b"), "the other report", "/code/p", REFERENCE, dataclasses.replace(system_effects(), claude=claude))
|
||||
return replay.match(("🔴 a", "🟡 b"), "the other report", "/code/p", REFERENCE, dataclasses.replace(system_effects(), claude=claude))
|
||||
|
||||
def test_asks_for_the_numbered_findings_the_other_report_raises_as_json_with_no_tools(self):
|
||||
self.run_match("{}")
|
||||
[(args, cwd, prompt)] = self.asked
|
||||
self.assertEqual(cwd, "/code/p")
|
||||
self.assertIn("1. 🔴 a\n\n2. 🟡 b\n\nThe other report:\nthe other report", prompt)
|
||||
self.assertEqual(json.loads(args[args.index("--json-schema") + 1]), main.MATCH_SCHEMA)
|
||||
self.assertEqual(json.loads(args[args.index("--json-schema") + 1]), replay.MATCH_SCHEMA)
|
||||
self.assertEqual(args[args.index("--tools") + 1], "")
|
||||
self.assertEqual(args[args.index("--model"):args.index("--model") + 4], REFERENCE.flags())
|
||||
|
||||
@@ -246,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 = {}
|
||||
@@ -282,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)
|
||||
@@ -492,7 +498,7 @@ class Main(unittest.TestCase):
|
||||
|
||||
def test_leaves_out_a_round_whose_checkout_names_no_default_branch(self):
|
||||
run_git(self.checkout, "remote", "set-head", "origin", "-d")
|
||||
self.assert_left_out("git symbolic-ref --short refs/remotes/origin/HEAD: ")
|
||||
self.assert_left_out("origin records no default branch")
|
||||
|
||||
def test_leaves_out_a_round_whose_checkout_is_gone(self):
|
||||
shutil.rmtree(self.checkout)
|
||||
|
||||
@@ -9,7 +9,7 @@ from records.utc_stamp import utc
|
||||
ARCHITECT = "Inherited architect"
|
||||
DECIDED_BY = "decided by"
|
||||
DIMENSIONS = ("Navigation", "Locality", "Shape", "Self-sufficiency", "Overall")
|
||||
# The comprehension floor, which every dimension and the overall should reach; docs/decisions.md → "comprehension floor" says it blocks nothing.
|
||||
# The comprehension floor, which every dimension and the overall should reach; docs/decisions.md → "comprehension floor" says it doesn't block anything.
|
||||
FLOOR = decimal.Decimal("7.0")
|
||||
HARDEST_FIRST = "hardest first"
|
||||
HEADING = re.compile(r"^([^,]+), (.+) at ([0-9a-f]{7,40})(?:, against ([0-9a-f]{7,40}))?$")
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""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
|
||||
import re
|
||||
|
||||
from failure import Failure
|
||||
from review_rules.review_passes import REVIEWERS
|
||||
from records.markdown_text import section
|
||||
|
||||
# The sections of ~/.claude/CLAUDE.md a reviewer needs, in the file's order: the code-health goal the agents cite, the bar its own prose meets, and the words its reports use.
|
||||
SECTIONS = ("Shared goal", "Prose", "Vocabulary")
|
||||
@@ -16,15 +18,10 @@ def reviewer_context(home: pathlib.Path) -> str | Failure:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read {path}: {failure}")
|
||||
found: dict[str, list[str]] = {}
|
||||
lines: list[str] = []
|
||||
for line in text.splitlines():
|
||||
if line.startswith("## "):
|
||||
lines = found.setdefault(line[3:].strip(), [])
|
||||
lines.append(line)
|
||||
if missing := [name for name in SECTIONS if name not in found]:
|
||||
found = {name: section(text, re.escape(name)) for name in SECTIONS}
|
||||
if missing := [name for name, lines in found.items() if lines is None]:
|
||||
return Failure(f"{path} holds no section {', '.join(missing)}")
|
||||
return "\n\n".join(["You start without `~/.claude/CLAUDE.md`. These sections of it hold for you:", *("\n".join(found[name]).strip() for name in SECTIONS)])
|
||||
return "\n\n".join(["You start without `~/.claude/CLAUDE.md`. These sections of it hold for you:", *("\n".join([f"## {name}", *lines]).strip() for name, lines in found.items() if lines is not None)])
|
||||
|
||||
|
||||
def starts_bare(agent: str, home: pathlib.Path) -> bool:
|
||||
@@ -40,7 +37,7 @@ def starts_bare(agent: str, home: pathlib.Path) -> bool:
|
||||
|
||||
|
||||
def hook_reply(given: str, home: pathlib.Path) -> str:
|
||||
"""What the SubagentStart hook prints for its input given: the context for a reviewer that starts without the instruction files, nothing for any other agent."""
|
||||
"""What the SubagentStart hook prints for its input given: the context for a reviewer that starts without the instruction files, and no text for any other agent."""
|
||||
try:
|
||||
read = json.loads(given)
|
||||
except ValueError:
|
||||
|
||||
@@ -26,6 +26,10 @@ class ReviewerContext(unittest.TestCase):
|
||||
def test_holds_the_shared_goal_prose_and_vocabulary_sections_and_none_of_the_workers(self):
|
||||
self.assertEqual(reviewer_context(self.home), "You start without `~/.claude/CLAUDE.md`. These sections of it hold for you:\n\n## Shared goal\n\nCode health.\n\n## Prose\n\nWrite short.\n\n## Vocabulary\n\n- **chunk** — a unit.")
|
||||
|
||||
def test_a_heading_inside_a_code_fence_does_not_end_a_section(self):
|
||||
(self.home / ".claude" / "CLAUDE.md").write_text("## Shared goal\n\n```\n## Not a heading\n```\n\nstill the goal\n\n## Prose\n\np\n\n## Vocabulary\n\nv\n")
|
||||
self.assertIn("## Shared goal\n\n```\n## Not a heading\n```\n\nstill the goal\n\n## Prose", reviewer_context(self.home))
|
||||
|
||||
def test_fails_on_a_missing_section_or_file(self):
|
||||
(self.home / ".claude" / "CLAUDE.md").write_text("## Prose\n\nWrite short.\n")
|
||||
self.assertEqual(reviewer_context(self.home), Failure(f"{self.home / '.claude' / 'CLAUDE.md'} holds no section Shared goal, Vocabulary"))
|
||||
@@ -86,10 +90,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"]
|
||||
|
||||
@@ -110,7 +110,7 @@ def entries(path: pathlib.Path) -> list[Entry]:
|
||||
|
||||
|
||||
def subagent(transcript: pathlib.Path) -> Subagent:
|
||||
"""The subagent, named by the .meta.json Claude Code writes beside its transcript: {"agentType": "Explore", "toolUseId": "toolu_01…", ...}. A meta missing or unreadable names nothing."""
|
||||
"""The subagent, named by the .meta.json Claude Code writes beside its transcript: {"agentType": "Explore", "toolUseId": "toolu_01…", ...}. A meta missing or unreadable doesn't name anything."""
|
||||
path = transcript.with_name(transcript.name.removesuffix(".jsonl") + ".meta.json")
|
||||
try:
|
||||
meta = json.loads(path.read_text(encoding="utf-8"))
|
||||
|
||||
@@ -3,8 +3,8 @@ import collections
|
||||
import dataclasses
|
||||
import typing
|
||||
|
||||
from claude_code.entries import AssistantTurn, CostState, Entry, ToolCall
|
||||
from routing_figures.prices import listed
|
||||
from claude_code.entries import messages as claude_messages, CostState, Entry, ToolCall
|
||||
from model_routing.prices import listed
|
||||
|
||||
DIMENSIONS = ("project", "subagent type", "rung", "tool")
|
||||
# Each of DIMENSIONS to its labels' dollars.
|
||||
@@ -33,17 +33,12 @@ class Spent(typing.NamedTuple):
|
||||
|
||||
def messages(entries: list[Entry]) -> list[Message]:
|
||||
"""The assistant messages, counted once each, each with the tools whose results it took in, or `prompt` where it took none in."""
|
||||
# A message's usage is the same in each of its entries (none of 1,681 multi-entry messages in the archive of 2026-10-28 differed), so the first is kept, where reading_cost's tokens_in keeps the last.
|
||||
kept: dict[str, tuple[AssistantTurn, list[str]]] = {}
|
||||
for entry in entries:
|
||||
if isinstance(entry, AssistantTurn):
|
||||
found = kept.setdefault(entry.message_id or entry.uuid, (entry, []))
|
||||
found[1].extend(part.name for part in entry.parts if isinstance(part, ToolCall))
|
||||
counted = []
|
||||
before = [PROMPT]
|
||||
for turn, called in kept.values():
|
||||
for turns in claude_messages(entries):
|
||||
turn = turns[0]
|
||||
counted.append(Message(turn.timestamp, before, turn.model, listed(turn.model, turn.usage)))
|
||||
before = called or [PROMPT]
|
||||
before = [part.name for each in turns for part in each.parts if isinstance(part, ToolCall)] or [PROMPT]
|
||||
return counted
|
||||
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ def answer(checked: Checked, what: str, now: float) -> int:
|
||||
if checked.blocked:
|
||||
return 2
|
||||
logs = [(breach, reason, log_path(breach.directory)) for breach, reason in checked.overridden]
|
||||
# Resolve every log before writing any, so a call that ends blocked has logged nothing.
|
||||
# Resolve every log before writing any, so a call that ends blocked hasn't logged anything.
|
||||
unloggable = [f"{breach.rule}: {log.reason}" for breach, _, log in logs if isinstance(log, Failure)]
|
||||
if not unloggable:
|
||||
for breach, reason, log in logs:
|
||||
|
||||
@@ -55,7 +55,7 @@ RULES: dict[RuleName, Rule] = {
|
||||
),
|
||||
# A reviewer only reports, so no marker waives it.
|
||||
"reviewer-report": Rule(
|
||||
f"a reviewer writes nothing but its report, with Write, into a file under ~/{REPORTS}/",
|
||||
f"a reviewer writes only its report, with Write, into a file under ~/{REPORTS}/",
|
||||
"a Write, Edit or MultiEdit call from inside an agent under agents/",
|
||||
overridable=False,
|
||||
),
|
||||
|
||||
@@ -860,9 +860,9 @@ class Hook(unittest.TestCase):
|
||||
for rule in ["action-pin", "commit-one-line", "docker-run-memory", "ignorefile-sorted", "image-pin", "no-ai-attribution", "repeat-read", "reviewer-report", "reviewer-rung", "round-cap", "round-title-counts", "run-heavy", "todo-rank-check"]:
|
||||
with self.subTest(rule):
|
||||
self.assertIn(f" {rule}\n The rule: ", helped)
|
||||
self.assertIn("reviewer-report\n The rule: a reviewer writes nothing but its report", helped)
|
||||
self.assertIn("reviewer-report\n The rule: a reviewer writes only its report", helped)
|
||||
self.assertRegex(helped, r" reviewer-report\n( .*\n){2} Takes no override\.\n")
|
||||
self.assertRegex(helped, r" image-pin\n( .*\n){2} \S", "a rule a marker waives says nothing of overrides")
|
||||
self.assertRegex(helped, r" image-pin\n( .*\n){2} \S", "a rule a marker waives doesn't say anything of overrides")
|
||||
|
||||
|
||||
class TodoRankCheck(unittest.TestCase):
|
||||
@@ -900,7 +900,7 @@ class TodoRankCheck(unittest.TestCase):
|
||||
|
||||
def test_its_own_rank_todo_failing_silently_names_the_script_and_exit(self):
|
||||
checkout = self.changed_plan(f"{self.folder}/clone", "import sys\nsys.exit(3)\n")
|
||||
self.assertEqual(self.details(checkout), [f"{checkout}/bin/rank_todo.py --check failed with exit 3 and printed nothing"])
|
||||
self.assertEqual(self.details(checkout), [f"{checkout}/bin/rank_todo.py --check failed with exit 3 and printed no output"])
|
||||
|
||||
def test_its_own_rank_todo_running_past_the_limit_is_named(self):
|
||||
checkout = self.changed_plan(f"{self.folder}/clone", "import signal\nsignal.pause()\n")
|
||||
|
||||
@@ -36,7 +36,7 @@ def check_failures(top: str, todo: pathlib.Path, own: pathlib.Path) -> list[str]
|
||||
return [f"{script} --check could not run: {failure}"]
|
||||
if ran.returncode == 0:
|
||||
return []
|
||||
return ran.stderr.splitlines() or [f"{script} --check failed with exit {ran.returncode} and printed nothing"]
|
||||
return ran.stderr.splitlines() or [f"{script} --check failed with exit {ran.returncode} and printed no output"]
|
||||
|
||||
|
||||
def same_repo(top: str, own: pathlib.Path) -> bool:
|
||||
|
||||
@@ -61,7 +61,7 @@ def main(argv: list[str], env: typing.Mapping[str, str], cpus: int | None, memor
|
||||
|
||||
|
||||
def capping(memory: Memory | None, slots: int, env: typing.Mapping[str, str]) -> dict[str, str]:
|
||||
"""What the command's environment needs for its docker to cap each container it makes at the slot's share of memory; nothing where the memory is unknown, as off Linux, or where PATH finds no docker to cap."""
|
||||
"""What the command's environment needs for its docker to cap each container it makes at the slot's share of memory; none where the memory is unknown, as off Linux, or where PATH finds no docker to cap."""
|
||||
path = env.get("PATH", "")
|
||||
if memory is None or shutil.which("docker", path=without_path_entry(path)) is None:
|
||||
return {}
|
||||
|
||||
@@ -61,7 +61,7 @@ def replayed(
|
||||
if isinstance(on_reference, Limited):
|
||||
return on_reference
|
||||
held = [(case, aim) for case, reply in zip(cases, on_reference) if (aim := reproduced(case, reply))]
|
||||
# With nothing to hold a rung to, no rung would miss anything.
|
||||
# Without anything to hold a rung to, no rung would miss anything.
|
||||
if not held:
|
||||
return Replay(on_reference, [], None)
|
||||
climbed: list[Tried[Case, Aim, Answer]] = []
|
||||
|
||||
@@ -111,7 +111,7 @@ UNMERGED = [
|
||||
"Chunks that left no merge commit:",
|
||||
"",
|
||||
"- Each is the run of commits on the default branch that share one commit time, since a rebase merge replays a pull request's commits at once. Its guesses come from the todo.md before its first commit.",
|
||||
"- Two pull requests merged in the same second read as one chunk, so a pull request that shipped nothing adds its lines, files and rounds to the chunk it shares a time with.",
|
||||
"- Two pull requests merged in the same second read as one chunk, so a pull request that shipped no item adds its lines, files and rounds to the chunk it shares a time with.",
|
||||
"- A run whose commits all kept their author time was never replayed: it was pushed or fast-forwarded as committed. It may hold only part of its pull request, so the medians and the rank correlations leave it out.",
|
||||
"- Rebase drops a round's commit that changed no file, so their rounds and findings are at least what history shows, and the medians count the rebased ones as shown.",
|
||||
]
|
||||
|
||||
@@ -48,7 +48,7 @@ SHOWN = ("L", "E", "I", "R", "S", "C")
|
||||
|
||||
|
||||
def results_of(chunk: BranchChunk, numstat: str, details: dict[int, str], tree: dict[str, int]) -> list[Result]:
|
||||
"""What one chunk measured for each item it shipped, from `git diff --numstat` of its change; none where it changed nothing but the plan and the records. details holds each item's detail in the todo.md the chunk started from, and tree each file's lines before the chunk, as file_lines reads them."""
|
||||
"""What one chunk measured for each item it shipped, from `git diff --numstat` of its change; none where it changed only the plan and the records. details holds each item's detail in the todo.md the chunk started from, and tree each file's lines before the chunk, as file_lines reads them."""
|
||||
changed = [row.split("\t", 2) for row in numstat.splitlines()]
|
||||
work = [row for row in changed if len(row) == 3 and row[2] not in NOT_WORK]
|
||||
if not work:
|
||||
|
||||
@@ -244,7 +244,7 @@ Reversals: the human's typed answers that reversed a choice the worker took on i
|
||||
def test_ends_with_how_it_reads_chunks_merged_by_rebase_only_where_it_measured_one(self):
|
||||
text = report_text([result(1, 5, 3, None, landing="rebase")], [], None, [])
|
||||
self.assertIn("\n\nChunks that left no merge commit:\n\n- Each is the run of commits", text.split("Median outcome")[1])
|
||||
self.assertIn("a pull request that shipped nothing adds its lines, files and rounds", text)
|
||||
self.assertIn("a pull request that shipped no item adds its lines, files and rounds", text)
|
||||
self.assertIn("at least what history shows, and the medians count the rebased ones as shown.", text)
|
||||
self.assertIn("Chunks that left no merge commit", report_text([result(1, 5, 3, None, landing="push")], [], None, []))
|
||||
self.assertNotIn("Chunks that left no merge commit", report_text([result(1, 5, 3, None)], [], None, []))
|
||||
|
||||
@@ -7,7 +7,7 @@ a defect, a level from 1 to 4 scored as for a todo.md item. It prints the rung t
|
||||
the model's cheapest rung, the project's rung, in the Agent tool's words, such as `model sonnet,
|
||||
effort high`. --plan, for a task that files or scores todo.md items, prints the project's rung where
|
||||
that L picks a lower one, as ~/.claude/rules/todo-items.md lets only the project's rung or above
|
||||
plan. For a model off the routing ladder, the tool prints nothing on stdout, says so on stderr and
|
||||
plan. For a model off the routing ladder, the tool doesn't print anything on stdout, says so on stderr and
|
||||
exits 0; launch the subagent with no model or effort.
|
||||
|
||||
Exit 1, saying why, on bad arguments.
|
||||
|
||||
@@ -12,20 +12,20 @@ The cells take the format rank_todo.py --help states; the letter flags take uppe
|
||||
add takes Next ID as the item's ID and raises Next ID by one. It writes the row, with the tagline
|
||||
in bold and each | in it escaped, and the detail it reads from stdin, if any, under ## Details.
|
||||
The detail may hold no ## or ### heading.
|
||||
It prints `Filed item <ID>.` It writes nothing where ranking fails or scores the item under the bar.
|
||||
It prints `Filed item <ID>.` It doesn't write anything where ranking fails or scores the item under the bar.
|
||||
|
||||
finish removes the item's row and its detail. With --changelog it adds the bullet first under
|
||||
CHANGELOG.md's ## Unreleased, or a ## heading that says unreleased, creating the section, or the
|
||||
file, where missing. It refuses where that section holds ### subsections: add the bullet by hand.
|
||||
Where CHANGELOG.md exists, finish needs --changelog or --no-changelog, so no bullet is left out by
|
||||
mistake. It prints `Finished item <ID>.` It writes nothing while docs/decisions.md cites the item.
|
||||
mistake. It prints `Finished item <ID>.` It doesn't write anything while docs/decisions.md cites the item.
|
||||
|
||||
show reads only todo.md. It prints the items table's header and divider, item <ID>'s row, and its detail
|
||||
from its ### heading to the next item's, sub-headings included. It fails, saying so, where todo.md has
|
||||
no row for <ID>.
|
||||
|
||||
Exit 2 on bad arguments, and 1, saying why, on any other failure. A message opening `not filed:`
|
||||
or `not finished:` means it wrote nothing.
|
||||
or `not finished:` means it didn't write anything.
|
||||
"""
|
||||
import argparse
|
||||
import pathlib
|
||||
@@ -127,7 +127,7 @@ def finish(args: argparse.Namespace, folder: pathlib.Path) -> str | Failure:
|
||||
def finish_texts(args: argparse.Namespace, todo: pathlib.Path, changelog: pathlib.Path) -> tuple[ranking.Ranked, str | None] | Failure:
|
||||
"""What finish writes: todo ranked without item args.id, and changelog's new text, None where finish leaves it as is."""
|
||||
if changelog.exists() and args.changelog is None and not args.no_changelog:
|
||||
return Failure("CHANGELOG.md exists beside todo.md; pass --changelog <bullet>, or --no-changelog where the repo publishes nothing")
|
||||
return Failure("CHANGELOG.md exists beside todo.md; pass --changelog <bullet>, or --no-changelog where the repo doesn't publish anything")
|
||||
texts = plan_file.read_all(todo)
|
||||
if isinstance(texts, Failure):
|
||||
return texts
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import re
|
||||
import typing
|
||||
|
||||
from model_routing.prices import PRICES
|
||||
from records.markdown_text import quoted
|
||||
from records.utc_stamp import STAMPED
|
||||
from claude_code.tokens import Tokens
|
||||
from model_routing.route import WorkerLine
|
||||
|
||||
TASK = "Task: "
|
||||
@@ -31,8 +33,11 @@ JUDGE_COST_AT = re.compile(rf"^{re.escape(JUDGE)}(.+)\n{re.escape(JUDGE_COST)}([
|
||||
|
||||
# The claude-config release and commit that ran the cycle, on the line before JUDGE, such as `Config: v0.8.0 (<sha>)`.
|
||||
CONFIG = "Config: "
|
||||
# Opens the block of what the work since the previous outcome that recorded a spend spent; an outcome that spent nothing has none.
|
||||
# Opens the block of what the work since the previous outcome that recorded a spend spent; an outcome that didn't spend anything has none.
|
||||
SPENT = "Spent since "
|
||||
KINDS = "input, cache write 5m, cache write 1h, cache read, output"
|
||||
# Who spent, such as `worker`, `judge` or `Explore "Search the hooks"`, and the model they ran on.
|
||||
Spender = tuple[str, str]
|
||||
# Opens the quote of a typed answer of the human's that reversed a choice the worker took on its own recommendation.
|
||||
REVERSED = "Reversed:"
|
||||
REVERSED_AT = re.compile(rf"^{re.escape(REVERSED)}\n((?:> .*\n)*> .*)", re.MULTILINE)
|
||||
@@ -41,7 +46,7 @@ REVERSED_AT = re.compile(rf"^{re.escape(REVERSED)}\n((?:> .*\n)*> .*)", re.MULTI
|
||||
class Annotation(typing.NamedTuple):
|
||||
"""What a verdict, an interrupt or a quoted answer records beside its judge lines, so a change to the setup can be judged before and after: docs/decisions.md → `loop-claude: each verdict records the claude-config release and commit that ran it…`. Each part is left out where empty; the cycle always gives config."""
|
||||
config: str = ""
|
||||
# The block spend.spent_block renders.
|
||||
# The block spent_block renders.
|
||||
spent: str = ""
|
||||
# The human's whole typed answer that holds the judge's quote of the reversal, as loop-claude checked it.
|
||||
reversed: str = ""
|
||||
@@ -54,6 +59,17 @@ def annotation_lines(annotation: Annotation) -> str:
|
||||
return f"{reversed_block}{spent_block}{config_line}"
|
||||
|
||||
|
||||
# Nothing reads a Spent block yet: the first tool that derives dollars from one adds its parser here, beside this writer.
|
||||
def spent_block(since: str, found: dict[Spender, Tokens]) -> str:
|
||||
"""The archive's block for what the stretch spent, then the list prices in force for each model in it that has one; empty where nothing was spent."""
|
||||
if not found:
|
||||
return ""
|
||||
spenders = [f"- {name}, {model}: {', '.join(map(str, (tokens.input, tokens.write_5m, tokens.write_1h, tokens.read, tokens.output)))}" for (name, model), tokens in found.items()]
|
||||
priced = [f"- {model}: {price.input:g}, {price.write_5m:g}, {price.write_1h:g}, {price.read:g}, {price.output:g}" for model in dict.fromkeys(model for _, model in found) if (price := PRICES.get(model))]
|
||||
prices = ["", f"List prices in dollars per million tokens of {KINDS}:", *priced] if priced else []
|
||||
return "\n".join([f"{SPENT}{since or 'the chunk began'}, in tokens of {KINDS}:", *spenders, *prices])
|
||||
|
||||
|
||||
def reversals(outcomes: str) -> list[str]:
|
||||
"""Each reversing answer the outcomes quote, unquoted, in the order they were written."""
|
||||
return [unquoted(found[1]) for found in REVERSED_AT.finditer(outcomes)]
|
||||
|
||||
@@ -67,7 +67,7 @@ def waited(file: str, pattern: str | None, timeout: float, clock: Clock = time)
|
||||
if text is None:
|
||||
return Failure(f"{file} did not appear in {timeout:g} s")
|
||||
last = line_in(text, None)
|
||||
wanted = f"no line matching `{pattern}`" if pattern is not None else "nothing"
|
||||
wanted = f"no line matching `{pattern}`" if pattern is not None else "no text"
|
||||
return Failure(f"{file} held {wanted} after {timeout:g} s" + (f"; its last line: {last}" if last is not None else ""))
|
||||
clock.sleep(min(POLL_SECONDS, left))
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class WaitFor(unittest.TestCase):
|
||||
def test_an_empty_file_gives_up_saying_it_held_nothing_and_no_last_line(self):
|
||||
self.file.write_text("")
|
||||
clock = Clock()
|
||||
self.assertEqual(main.waited(str(self.file), None, 3, clock), Failure(f"{self.file} held nothing after 3 s"))
|
||||
self.assertEqual(main.waited(str(self.file), None, 3, clock), Failure(f"{self.file} held no text after 3 s"))
|
||||
self.assertEqual(clock.now, 3)
|
||||
|
||||
def test_sleeps_only_the_time_left_before_the_timeout(self):
|
||||
|
||||
@@ -3528,3 +3528,152 @@ Inherited architect, would restructure first:
|
||||
- Locality: `bin/chunk_pr/main.py:42` `forge`: the forge helpers live in `chunk_preflight` and `deploy_release`, so a second forge needs edits in four packages
|
||||
- Shape: `bin/records/__init__.py:1` `records`: one name for three concepts, as `cut` and `Plan` also name several
|
||||
- Locality: `bin/loop_claude/cycle/run.py:86` `archived`: the archive helpers that `loop/close.py` imports sit in the cycle runner
|
||||
|
||||
## 2026-11-12T18:40:20Z, PR #510 at 62faf32
|
||||
|
||||
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||
|---|---|---|---|---|---|
|
||||
| Junior A | 6.5 | 5 | 5.5 | 4.5 | 5.5 |
|
||||
| Mid A | 7 | 6 | 6.5 | 5 | 6 |
|
||||
| Maintainability senior | 7 | 6 | 6 | 5 | 6 |
|
||||
| Inherited architect | 6.5 | 7.5 | 6 | 5.5 | 6.5 |
|
||||
| Mean | 6.75 | 6.13 | 6.00 | 5.00 | 6.00 |
|
||||
|
||||
Junior A, hardest first:
|
||||
|
||||
- Locality, Shape: `bin/loop_claude/routing.py:84` `next_route`: item rung, floor, cap, escalation mark and unfinished count spread over four modules, and the reasons sit in the decision log
|
||||
- Locality: `bin/loop_claude/cycle/judge.py:196` `quotes_checked`: each check silently demotes the verdict's type, and `INTERRUPT_RULES` is policy held as a prompt string
|
||||
- Locality, Shape: `bin/loop_claude/cycle/run.py:154` `rule`: one function reads, judges, archives and steps up in an order a comment alone states
|
||||
- Self-sufficiency: `skills/larv-review/SKILL.md:35` "Passes": about 200 lines of nested conditions whose terms are defined at the end of CLAUDE.md
|
||||
- Shape: `bin/larv_review/main.py:173` `main`: a 150-line docstring doubles as the spec of about 12 subcommands in one elif chain
|
||||
- Locality, Shape: `bin/release_plan/ranking.py:304` `score`: two table shapes and a hidden comprehension-history input
|
||||
- Locality: `bin/larv_review/scoring_setup.py:156` `prepare_scoring`: code parses two Markdown files, so a prose edit can break it
|
||||
|
||||
Mid A, hardest first:
|
||||
|
||||
- Locality, Shape: `bin/loop_claude/routing.py:84` `next_route`: rung, floor, cap, mark and unfinished count feed one choice across four files
|
||||
- Self-sufficiency: `skills/larv-review/SKILL.md:76` "Round cap": a rule engine in English whose numbers are repeated in code, CLAUDE.md and `--help`
|
||||
- Locality: `bin/loop_claude/cycle/prompts.py:61` `review_launches`: the worker's text is assembled from rung choices and has to be run in the head
|
||||
- Shape: `bin/command_lines/shell_command.py:46` `segments`: a hand-written shell tokenizer whose regexes stay opaque
|
||||
- Locality: `bin/rule_hook/repeat_read.py:119` `shown_lines`: depends on Claude Code's transcript format
|
||||
- Locality: `bin/loop_claude/cycle/judge.py:196` `quotes_checked`: five quote checks with different failure modes
|
||||
- Shape: `bin/release_plan/release_standing.py:145` `next_release`: many tag, rename and changelog cases in a six-way union
|
||||
- Shape: `reviewer-merge-trials/driver.py:1` `driver`: one-off scripts that break the repo's tab and naming conventions
|
||||
|
||||
Maintainability senior, hardest first:
|
||||
|
||||
- Locality, Shape: `bin/release_plan/release_standing.py:145` `next_release`: six cases held at once, `Cut` against `cut`, and a compound `is_earliest` condition
|
||||
- Shape: `bin/release_plan/ranking.py:304` `score`: `SHAPE` against `OLD_SHAPE` threaded through nearly every function
|
||||
- Locality: `bin/loop_claude/routing.py:84` `next_route`: rung arithmetic split with `escalation_mark.py`
|
||||
- Locality: `bin/loop_claude/cycle/judge.py:196` `quotes_checked`: each layer silently downgrades the verdict
|
||||
- Locality, Shape: `bin/loop_claude/cycle/run.py:154` `rule`: order-dependent steps and a 17-field `Cycle`
|
||||
- Locality: `bin/larv_review/main.py:173` `main`: the scoring-run rule is split over `plan.py`, unopened siblings and a wording match with SKILL.md
|
||||
- Self-sufficiency: `skills/larv-review/SKILL.md:76` "Round cap": mechanical rules duplicated in three code places, so no copy is authoritative
|
||||
|
||||
Inherited architect, would restructure first:
|
||||
|
||||
- Navigation, Shape: `README.md:96` `bin/`: about 100 entries at one level, with the README's two lists as the only map
|
||||
- Locality: `bin/review_rules/round_titles.py:1` `ROUND`: the commit-title protocol is parsed in five tools and written in SKILL.md
|
||||
- Shape: `bin/release_plan/release_standing.py:41` `Next`: `Next`, `Cut` and `LastCut` each carry more than one meaning
|
||||
- Shape: `bin/records/__init__.py:1` `records`: one name for two unrelated concepts, and "plan" and "ruling" also name several
|
||||
- Locality: `bin/loop_claude/cycle/judge.py:196` `quotes_checked`: the judge's rules are strings coupled to CLAUDE.md's text
|
||||
- Shape: `bin/rule_hook/rules.py:127` `check`: round-cap rules sit beside unrelated pin rules in 13 rules
|
||||
- Self-sufficiency: `bin/loop_claude/routing.py:84` `next_route`: the reasons cite decision titles the reader cannot see
|
||||
|
||||
## 2026-11-12T18:43:58Z, PR #510 rerun at fba48f3
|
||||
|
||||
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||
|---|---|---|---|---|---|
|
||||
| Junior A | 6.5 | 5 | 5.5 | 4.5 | 5.5 |
|
||||
| Mid A | 7 | 5.5 | 6.5 | 5 | 6 |
|
||||
| Maintainability senior | 7 | 5.5 | 6 | 5 | 6 |
|
||||
| Inherited architect | 7 | 6.5 | 6 | 5.5 | 6 |
|
||||
| Mean | 6.88 | 5.63 | 6.00 | 5.00 | 5.88 |
|
||||
|
||||
Junior A, hardest first:
|
||||
|
||||
- Self-sufficiency, Locality: `skills/larv-review/SKILL.md:80` "Round cap": nested rules that point at CLAUDE.md, `standards/`, `rules/` and decision titles, so three documents stay open at once
|
||||
- Locality, Shape: `bin/loop_claude/routing.py:93` `unfinished_route`: floor, cap, mark and unfinished count interact across `Route`, `Rung` and `escalation_mark`
|
||||
- Locality: `bin/release_plan/release_standing.py:145` `next_release`: no tag, dated headings, renames and `named_releases` meet in one function
|
||||
- Self-sufficiency, Shape: `bin/release_plan/ranking.py:271` `goal_weights`: paragraph-long docstrings carry the rules, and the constants cite a decision log
|
||||
- Locality, Shape: `bin/loop_claude/cycle/run.py:154` `rule`: one function with four near-identically named archive helpers beside it
|
||||
- Locality: `bin/loop_claude/cycle/judge.py:196` `quotes_checked`: ellipsis matching and a policy that only a misquoted evidence fails
|
||||
- Shape: `bin/review_replay/main.py:225` `code_of`: guesses which code was reviewed from archive times and prompt text
|
||||
|
||||
Mid A, hardest first:
|
||||
|
||||
- Locality, Shape: `bin/release_plan/ranking.py:56` `rank`: every helper forks on `SHAPE` versus `OLD_SHAPE`
|
||||
- Locality, Shape: `bin/release_plan/release_standing.py:145` `next_release`: three inputs and six `Pick` types
|
||||
- Locality: `bin/loop_claude/routing.py:93` `unfinished_route`: the rule that a rung never falls spans several functions
|
||||
- Locality: `bin/loop_claude/cycle/run.py:67` `run_cycle`: replaces `cycle.route` partway through its loop, out of sight of `transition`
|
||||
- Locality: `bin/loop_claude/cycle/judge.py:196` `quotes_checked`: each check silently demotes the verdict's type
|
||||
- Locality: `bin/review_rules/comprehension_history.py:240` `listings`: a Markdown format parsed by regex and shared with `larv_review` and `rank_todo`
|
||||
- Locality: `bin/rule_hook/repeat_read.py:119` `shown_lines`: rebuilds the agent's context from Claude Code transcripts
|
||||
- Self-sufficiency: `skills/larv-review/SKILL.md:80` "Round cap": needs `docs/decisions.md`, `rules/*` and `standards/*` open beside it
|
||||
|
||||
Maintainability senior, hardest first:
|
||||
|
||||
- Self-sufficiency, Locality: `skills/larv-review/SKILL.md:35` "Passes": a process spec in which nothing marks which sentences code enforces, and where
|
||||
- Locality: `bin/loop_claude/routing.py:93` `unfinished_route`: rung state shared with `escalation_mark.py` and `model_routing/ladder.py`
|
||||
- Locality: `bin/loop_claude/cycle/judge.py:196` `quotes_checked`: prompt strings are behaviour with no test-shaped boundary
|
||||
- Locality, Shape: `bin/loop_claude/cycle/run.py:154` `rule`: the route lives in `Cycle` outside the state machine, and archive order is only commented
|
||||
- Shape: `bin/release_plan/ranking.py:304` `score`: `OLD_SHAPE` exists only to read old history, and ranking reads a documentation file as data
|
||||
- Shape: `bin/release_plan/release_standing.py:145` `next_release`: six `Pick` variants and layered tag cases
|
||||
- Locality: `bin/larv_review/scoring_setup.py:65` `score_bullets`: parses SKILL.md's prose bullets and fails on a count change, so a prose edit is load-bearing
|
||||
|
||||
Inherited architect, would restructure first:
|
||||
|
||||
- Locality: `bin/review_rules/round_titles.py:59` `past_cap`: the round cap lives in four code places and in SKILL.md §3, and the hook counts commit titles, not launches
|
||||
- Shape, Locality: `bin/release_plan/ranking.py:56` `rank`: `OLD_SHAPE` branches in six functions, and the module also parses goals and checks decision citations
|
||||
- Locality: `bin/release_plan/release_standing.py:145` `next_release`: release standing is also read by `larv_review/plan.py`, `chunk_preflight` and `loop_claude/routing.py`
|
||||
- Navigation, Shape: `README.md:96` `bin/`: about 85 entries at one level, with the launcher-to-package rule as the only map
|
||||
- Shape: `bin/larv_review/main.py:173` `main`: a 145-line docstring doubles as help beside an elif chain
|
||||
- Shape: `bin/rule_hook/rules.py:14` `RuleName`: a Literal that repeats the keys of `RULES`, as `ReviewedPass` repeats `PASS_AGENTS`
|
||||
- Self-sufficiency: `bin/loop_claude/loop/chunk_start.py:83` `fetched_plan`: a comment cites a plan item that is deleted when finished
|
||||
|
||||
## 2026-11-12T19:51:29Z, PR #511 at 9a260d2, against 913accf
|
||||
|
||||
Ruling: better
|
||||
|
||||
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||
|---|---|---|---|---|---|
|
||||
| Mid A | better | better | better | better | better |
|
||||
| Inherited architect | better | better | better | same | better |
|
||||
|
||||
Mid A, decided by:
|
||||
|
||||
- Navigation, Shape, Overall: `bin/review_replay/main.py:75` `main`: the file is now CLI only, and each job sits in its own module under a docstring stating it; at 913accf one 359-line file mixed them
|
||||
- Locality, Shape, Overall: `bin/larv_review/main.py:211` `COMMANDS`: one table row per subcommand feeds dispatch, usage and `--help`, where 913accf had a 12-arm if/elif chain and a hand-written usage string
|
||||
- Locality, Navigation: `bin/transcript_archive/outcomes.py:63` `spent_block`: the Spent block's writer now sits beside its marker and kinds, not in another package
|
||||
- Locality: `bin/claude_code/entries.py:148` `messages`: one reader groups assistant turns by message, where three callers each deduplicated by hand with different keep-first and keep-last rules
|
||||
- Shape, Self-sufficiency: `bin/model_routing/prices.py:23` `PRICES`: the docstring states both uses of the price list and the comment says prices are archived as in force
|
||||
- Self-sufficiency, Locality: `bin/larv_review/scoring_setup.py:52` `score_bullets`: picks anchors and dimensions by how each bullet opens, and the docstring says so; 913accf took them by position and count
|
||||
- Shape: `bin/review_replay/omit_comparison.py:12` `compared`: returns the report and leaves printing to `main`, where 913accf printed, returned an exit code and needed a cast
|
||||
|
||||
Inherited architect, decided by:
|
||||
|
||||
- Navigation, Shape, Overall: `bin/review_replay/replay.py:1` `replay`: a failed clone or bad match leads to one file whose docstring names that job; `main.py` shrank from 359 to 114 lines of wiring
|
||||
- Locality, Shape: `bin/claude_code/entries.py:148` `messages`: one reader groups a message's entries, and the keep-first versus keep-last trap the old comment warned about is gone
|
||||
- Navigation, Locality: `bin/larv_review/main.py:211` `COMMANDS`: each subcommand's spelling, argument check and action sit in one row that usage and `--help` are built from
|
||||
- Locality: `bin/transcript_archive/outcomes.py:63` `spent_block`: the writer sits beside the marker and parser, and the loop no longer depends on the measuring package for an archive format
|
||||
- Shape: `bin/model_routing/prices.py:1` `prices`: the price list moved out of `routing_figures` once it gained a second reader, and its docstring states both uses
|
||||
|
||||
## 2026-11-12T20:22:47Z, PR #513 at d5a9576, against 0a26bcb
|
||||
|
||||
Ruling: better
|
||||
|
||||
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||
|---|---|---|---|---|---|
|
||||
| Mid A | same | better | same | same | better |
|
||||
| Inherited architect | same | better | better | same | better |
|
||||
|
||||
Mid A, decided by:
|
||||
|
||||
- Locality, Overall: `bin/larv_review/scoring.py:10` `is_floor_item`: the rule for what makes a plan item a floor item lives in one named predicate that both callers use, where 0a26bcb wrote the same test out twice
|
||||
- Locality: `bin/larv_review/plan.py:28` `scoring_run_due`: reads `is_floor_item(item)` and prints `a floor item`, so the trigger needs no knowledge of the tagline's format
|
||||
|
||||
Inherited architect, decided by:
|
||||
|
||||
- Locality, Shape, Overall: `bin/larv_review/scoring.py:10` `is_floor_item`: one named predicate that both `scoring_run_due` and `floor_step` call, where each spelled its own substring test at 0a26bcb
|
||||
- Shape: `bin/larv_review/scoring.py:7` `FLOOR_ITEM`: the constant is now the tagline's opening phrase and matched as one, where it was a bare substring that any mention matched
|
||||
- Locality: `bin/larv_review/plan.py:28` `scoring_run_due`: the reason line reads off the predicate, so the function no longer carries tagline matching
|
||||
|
||||
+41
-21
@@ -12,6 +12,7 @@ Each project principle states one rule that the decisions below apply; their ent
|
||||
|
||||
# Decisions no project principle covers
|
||||
|
||||
- bin/: a test parametrizes its cases with `subTest`, since pytest's `parametrize` doesn't reach a unittest `TestCase`
|
||||
- bin/: the tools run on the host's Python, with no container, and so do their tests outside CI
|
||||
- bin/: the tools support only the latest stable Python, and the tests, written in plain unittest, run on it in four pytest-xdist workers
|
||||
- deploy: this repo keeps no `AGENTS.md`, since `~/.claude` is its checkout; its principles and decision titles head `docs/decisions.md`, its working rules follow them there, and its `.claude/settings.json` excludes every `.claude/CLAUDE.md`, so a session in the clone loads only the clone's `CLAUDE.md`
|
||||
@@ -49,6 +50,10 @@ Settling a call is the human's. The chunk that settles the calls cites, in `docs
|
||||
|
||||
# Decisions
|
||||
|
||||
## bin/: a test parametrizes its cases with `subTest`, since pytest's `parametrize` doesn't reach a unittest `TestCase`
|
||||
|
||||
2026-11-12, lilleman, from the release review of 0.9.0. Applies `principles/technical-principles.md` → "Most code should have automated tests", whose "parametrize the cases" asks for one reported result per case. The tests are plain unittest, run by pytest, and pytest's `parametrize` doesn't work on a `TestCase` method; `subTest` is the unittest mechanism that does: each case reports and fails on its own, with its parameters named. A test that loops over its cases itself, outside `subTest`, or holds a branch, is still a breach. Valid while the tests stay in plain unittest.
|
||||
|
||||
## bin/: an outcome is an entry of a `.outcomes.md` file in loop-claude's archive, a record is a document tools or people keep entries in, and a place is what a comprehension seat names
|
||||
|
||||
2026-10-23, larv-review, through PR #367. Serves code health: a reader can trust that one word names one thing in every tool. Before, "record" and "outcome" each named different things in three modules, and "place" in two. Each word kept the meaning it already had where renaming costs most:
|
||||
@@ -75,7 +80,7 @@ The cap is 5, `bin/release_plan/todo_table.py`'s `BUNDLE_MAX_R`, from the same c
|
||||
|
||||
## comprehension floor: every dimension and the overall at 7.0 or above is the target, and no score blocks a merge or release
|
||||
|
||||
2026-09-27, lilleman, restating the 2026-09-24 target and extending it to the overall. Serves goal 1. 2026-10-13, lilleman: the floor blocks nothing, and `review: the comprehension check records …` says why. Valid while the scoring run keeps its four seats.
|
||||
2026-09-27, lilleman, restating the 2026-09-24 target and extending it to the overall. Serves goal 1. 2026-10-13, lilleman: the floor doesn't block anything, and `review: the comprehension check records …` says why. Valid while the scoring run keeps its four seats.
|
||||
|
||||
## deploy: `~/.claude` holds only a release, which `deploy-release` moves it to; this repo is developed in `~/code/claude-config`, where loop-claude runs its chunks like any project's
|
||||
|
||||
@@ -111,7 +116,7 @@ Valid while `~/.claude` is a checkout of this repo.
|
||||
|
||||
2026-10-03, lilleman. Serves goal 1.2. The judge reads `~/.claude/CLAUDE.md`, each file under `~/.claude/rules/` and each file under `~/.claude/skills/larv-review/standards/` whole. The worker follows them, so a question they answer should not reach the human. Reading whole is safe, because the judge may quote only words that appear in them, and a list of sections would need keeping current.
|
||||
|
||||
2026-10-03, lilleman. Serves goal 1.2. The judge rules a chunk finished only once every answer the human typed in it is recorded. A finished chunk's session is deleted, and its answers with it, so an answer recorded nowhere would be asked again in a later chunk. Claude settled two choices lilleman's ruling left open. First, an answer counts as recorded where the files the judge reads hold it, `~/.claude/CLAUDE.md` included, or where the transcript shows the worker writing it into `README.md`'s premises, `AGENTS.md`, `docs/decisions.md`, `todo.md` or a code comment. A worker's write to `~/.claude/CLAUDE.md`, `~/.claude/rules/` or `~/.claude/skills/larv-review/standards/` does not count: the judge reads the live `~/.claude`, which holds the write only once it merges and the checkout is pulled. The judge cannot read a code comment or `todo.md`. Yet `CLAUDE.md` → "Working loop", "Ask, don't guess" puts a standing choice made in one place in a comment there. And the human's approval of a release's items, which "Working loop" requires, is the set of rows `todo.md` names for that release. The judge also reads the records once a cycle from the main checkout. That checkout may not yet hold an answer the worker wrote and merged. A judge that refused any of these would hold the chunk open every cycle. Second, only an answer a later chunk could need must be recorded, so an approval such as "merge it" holds nothing open. The worker's resume prompt states the rule, so a worker whose chunk is held open knows it.
|
||||
2026-10-03, lilleman. Serves goal 1.2. The judge rules a chunk finished only once every answer the human typed in it is recorded. A finished chunk's session is deleted, and its answers with it, so an answer recorded nowhere would be asked again in a later chunk. Claude settled two choices lilleman's ruling left open. First, an answer counts as recorded where the files the judge reads hold it, `~/.claude/CLAUDE.md` included, or where the transcript shows the worker writing it into `README.md`'s premises, `AGENTS.md`, `docs/decisions.md`, `todo.md` or a code comment. A worker's write to `~/.claude/CLAUDE.md`, `~/.claude/rules/` or `~/.claude/skills/larv-review/standards/` does not count: the judge reads the live `~/.claude`, which holds the write only once it merges and the checkout is pulled. The judge cannot read a code comment or `todo.md`. Yet `CLAUDE.md` → "Working loop", "Ask, don't guess" puts a standing choice made in one place in a comment there. And the human's approval of a release's items, which "Working loop" requires, is the set of rows `todo.md` names for that release. The judge also reads the records once a cycle from the main checkout. That checkout may not yet hold an answer the worker wrote and merged. A judge that refused any of these would hold the chunk open every cycle. Second, only an answer a later chunk could need must be recorded, so an approval such as "merge it" doesn't hold anything open. The worker's resume prompt states the rule, so a worker whose chunk is held open knows it.
|
||||
|
||||
2026-10-17, lilleman, todo item 168. The human answers an interrupt on loop-claude's terminal, and the worker resumes headless with the answer in a `-p` prompt. The judge reads that answer as a `[human]` line, not a `[loop]` one, so it holds the chunk open until the answer is recorded, as it does for an answer typed in claude.
|
||||
|
||||
@@ -144,7 +149,7 @@ Valid while `~/.claude` is a checkout of this repo.
|
||||
2026-11-12, lilleman, todo item 305. Serves goals 1, 1.2 and 1.4. A change to the setup can be judged only by comparing chunks run before it with chunks run after, so each verdict, interrupt and quoted answer in loop-claude's archive records three things beside its judge lines.
|
||||
|
||||
- `Config: <release> (<commit>)`: `git describe` and the commit of `~/.claude`, so outcomes group by the setup that produced them. Where git can't tell, it records `unknown` and why, on one line.
|
||||
- A `Spent since` block: the raw tokens each thread spent, by model and by kind (input, cache write 5m, cache write 1h, cache read, output), then the list prices in force, from `bin/routing_figures/prices.py`. The threads are the worker's main thread, each subagent by its agent type and description, and the judge run that ruled. Each message counts once, by its id. The stretch runs from the previous outcome that recorded a spend, so what a `/talk` or a stopped run spent between rulings is counted once. It keeps tokens, since prices change. The prices recorded beside them give what the stretch cost when it ran. Claude Code doesn't report thinking apart from output, so it is left in output. The judge's tokens come from its json reply's `usage`, until item 303 archives the judge's own transcript.
|
||||
- A `Spent since` block: the raw tokens each thread spent, by model and by kind (input, cache write 5m, cache write 1h, cache read, output), then the list prices in force, from `bin/model_routing/prices.py`. The threads are the worker's main thread, each subagent by its agent type and description, and the judge run that ruled. Each message counts once, by its id. The stretch runs from the previous outcome that recorded a spend, so what a `/talk` or a stopped run spent between rulings is counted once. It keeps tokens, since prices change. The prices recorded beside them give what the stretch cost when it ran. Claude Code doesn't report thinking apart from output, so it is left in output. The judge's tokens come from its json reply's `usage`, until item 303 archives the judge's own transcript.
|
||||
- A `Reversed:` quote: the human's typed answer that overrides a choice the worker took on its own recommendation and recorded. The judge quotes the latest such `[human]` line; loop-claude keeps the whole typed answer that holds the quote verbatim, and drops a quote no typed answer holds. `score-outcomes` counts the distinct answers per finished chunk. That count is goal 1.2's counter-signal, and the 2026-11-08 entry of `loop-claude: a judge decides each interrupt…` is valid only while it stays low. It counts only chunks that record a Config line, since earlier judges didn't look for reversals.
|
||||
|
||||
Valid while score-outcomes reads the reversals from the archive.
|
||||
@@ -239,13 +244,13 @@ Valid while no published standard sets either number, the reading-cost window st
|
||||
|
||||
## 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.
|
||||
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 change only what a user wouldn't notice.
|
||||
|
||||
2026-10-13, lilleman through todo item 97. Serves goals 1.4 and 1.5. From round 2 a pass reviews only how the chunk answered its previous round, each fix and each dismissal with its reason, and reports only one that is plainly wrong or worse than the change it answered. A fix from another pass that re-enters it is still reviewed as a first round would review it, limited to its lines. Reviewing all that changed had a reviewer find new gaps in each round's fixes, so a pass ran to its cap. Valid while round-2 findings outside a round's answers keep changing nothing a user would notice.
|
||||
2026-10-13, lilleman through todo item 97. Serves goals 1.4 and 1.5. From round 2 a pass reviews only how the chunk answered its previous round, each fix and each dismissal with its reason, and reports only one that is plainly wrong or worse than the change it answered. A fix from another pass that re-enters it is still reviewed as a first round would review it, limited to its lines. Reviewing all that changed had a reviewer find new gaps in each round's fixes, so a pass ran to its cap. Valid while round-2 findings outside a round's answers change only what a user wouldn't notice.
|
||||
|
||||
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 325 stability reports of round 2 or later, from 13 projects, and 81 of those reports open with BLOCK. For each of the 325, the 🔴 and 🟡 lines of the round before were matched on mutant and test-failure wording. In 4 rounds before, every such line matched; read by hand, 1 of the 4 asked only that a failing test pass, and the round 2 after each of the 4 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.
|
||||
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 doesn't show anything. 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
|
||||
|
||||
@@ -267,11 +272,11 @@ Valid while the later fixes per finished chunk, which `score-outcomes` and the r
|
||||
|
||||
## review: a project decision may opt every chunk out of the architect, the product-owner pass or the comprehension check, and a project opting out of the comprehension check voids code health
|
||||
|
||||
2026-10-11, lilleman. Serves goal 1.4. A research repo's PR, in a repo with no consumer for the product-owner pass and no product for the architect, spent rounds of both, and of the comprehension check, on a probe. The opt-out is the project's to make, and only an entry titled `review opt-out:` makes it, so a project without one is reviewed as before (goal 1.3). No opted-out reviewer works against a goal or a technical principle: the principles audit, which has no opt-out, still judges KISS and every other principle, so the entry names no plan item that ends it. 2026-10-13, lilleman: an opt-out of the comprehension check no longer ends with a chunk that ships an item naming the floor, since the floor blocks nothing. 2026-10-18, lilleman, answering the review of PR #324: a project that opts out of the comprehension check voids code health in its README too: without the check the goal has no signal, and, never measured, it would weigh four times its weight forever. `rank_todo.py` refuses the plan of such a project until its README voids it. Valid while the principles audit judges every chunk that changes code, config or tests, and while the architect's and the product-owner's findings matter only to a product with consumers.
|
||||
2026-10-11, lilleman. Serves goal 1.4. A research repo's PR, in a repo with no consumer for the product-owner pass and no product for the architect, spent rounds of both, and of the comprehension check, on a probe. The opt-out is the project's to make, and only an entry titled `review opt-out:` makes it, so a project without one is reviewed as before (goal 1.3). No opted-out reviewer works against a goal or a technical principle: the principles audit, which has no opt-out, still judges KISS and every other principle, so the entry names no plan item that ends it. 2026-10-13, lilleman: an opt-out of the comprehension check no longer ends with a chunk that ships an item naming the floor, since the floor doesn't block anything. 2026-10-18, lilleman, answering the review of PR #324: a project that opts out of the comprehension check voids code health in its README too: without the check the goal has no signal, and, never measured, it would weigh four times its weight forever. `rank_todo.py` refuses the plan of such a project until its README voids it. Valid while the principles audit judges every chunk that changes code, config or tests, and while the architect's and the product-owner's findings matter only to a product with consumers.
|
||||
|
||||
## review: a project decision may suspend the comprehension check for the plan items it names
|
||||
|
||||
2026-10-04, lilleman. Serves goal 1.4. In a restructure, each step's scoring run measures code the next step deletes. It costs a run and, below the floor, blocks the step, yet says nothing about what the restructure buys. The scoring run after the last step measures that. 2026-10-08: the paired ruling replaced the scoring run in most chunks, and the suspension covers it too; the ruling after the last step compares with the commit measured before the first step. 2026-10-13, lilleman: the comprehension check blocks nothing now, so a suspension saves only the runs. Valid while such a decision names its items and the plan item that ends it.
|
||||
2026-10-04, lilleman. Serves goal 1.4. In a restructure, each step's scoring run measures code the next step deletes. It costs a run and, below the floor, blocks the step, yet doesn't say anything about what the restructure buys. The scoring run after the last step measures that. 2026-10-08: the paired ruling replaced the scoring run in most chunks, and the suspension covers it too; the ruling after the last step compares with the commit measured before the first step. 2026-10-13, lilleman: the comprehension check doesn't block anything now, so a suspension saves only the runs. Valid while such a decision names its items and the plan item that ends it.
|
||||
|
||||
## review: a release review fixes its findings in the release it reviews, and files under that release only a finding that needs a human answer, adds a feature or outlasts its five rounds
|
||||
|
||||
@@ -313,17 +318,17 @@ Claude Code's own subagent prompt tells a subagent to return findings rather tha
|
||||
|
||||
Before this change, reports took a median 19k tokens per chunk, 8% of the worker's peak context, and lines carrying a severity mark were 9–24% of a report (2026-10-08, over 68 archived transcripts). `review-replay` still counts each 🔴 and 🟡 by its line in the reviewer's reply, now a one-line summary. todo.md item 187 is to measure what the worker reads of the reports instead.
|
||||
|
||||
Valid while Claude Code passes `agent_type` to hooks inside a subagent. Without it, the rule refuses nothing, and a reviewer may write anywhere.
|
||||
Valid while Claude Code passes `agent_type` to hooks inside a subagent. Without it, the rule doesn't refuse anything, and a reviewer may write anywhere.
|
||||
|
||||
## review: stability and product-owner report only a defect, a broken requirement of the plan or the goals, a breach of a technical principle, or for stability a hard place the change touches; each architect finding names a later change the PR makes harder; prose runs only on a chunk that changes prose
|
||||
|
||||
2026-10-13, lilleman through todo item 97, implemented by claude. Serves goals 1.4 and 1.5. Anthropic's Claude Code best practices: "A reviewer prompted to find gaps will usually report some, even when the work is sound… Chasing every finding leads to over-engineering." 320 of this repo's 876 commits answered a review round. So stability and product-owner drop a finding that is none of these, and stability leaves the style of comments to prose, which reads every comment a chunk touches. An architect finding that names no later change it makes harder cannot be checked, so it is dropped. The architecture pass and the comprehension check keep their whole-project view, which guards goal 1.1 as a project grows. Valid while the findings these rules drop keep changing nothing a user would notice.
|
||||
2026-10-13, lilleman through todo item 97, implemented by claude. Serves goals 1.4 and 1.5. Anthropic's Claude Code best practices: "A reviewer prompted to find gaps will usually report some, even when the work is sound… Chasing every finding leads to over-engineering." 320 of this repo's 876 commits answered a review round. So stability and product-owner drop a finding that is none of these, and stability leaves the style of comments to prose, which reads every comment a chunk touches. An architect finding that names no later change it makes harder cannot be checked, so it is dropped. The architecture pass and the comprehension check keep their whole-project view, which guards goal 1.1 as a project grows. Valid while the findings these rules drop change only what a user wouldn't notice.
|
||||
|
||||
2026-10-28, lilleman: prose findings stay, since Claude's prose needs them, though prose's 105 first rounds since 2026-10-21 raised 498 🟡 and only 3 🔴.
|
||||
|
||||
## review: the comprehension check records how hard a project is to read, and no score blocks a merge: a paired ruling against the last measured commit in the release review, and the four-seat scoring run, once when an item names the floor and twice on one head when a release's items run out
|
||||
|
||||
2026-10-08, lilleman. Serves goals 1.1 and 1.4. Two independent four-seat runs moved up to 0.4 on near-identical code, so a fall within that noise forced rounds that changed nothing (PR #224). A seat reading both versions judges the difference on the same material, so the noise the versions share cancels. No conventional significance level lets a sign test settle with four votes, so the human chose a lead of two votes over every other ruling, same included. Two seats that agree settle it, so a PR that leaves the reading as it was costs two seats. A third seat alone can never settle it, so the third and fourth launch together. The scoring run also runs on a chunk shipping an item that names the floor, so the chunk that lifts a project to the floor can prove it. A chunk that removes a release's last item without shipping it runs the scoring run too, so no release ends unmeasured, unless `todo.md` marks that release renamed in a `## Renamed` section (`bin/release_plan/todo_table.py` → `renames`). Valid while seats reading both versions agree more often than two absolute runs do.
|
||||
2026-10-08, lilleman. Serves goals 1.1 and 1.4. Two independent four-seat runs moved up to 0.4 on near-identical code, so a fall within that noise forced rounds that didn't change anything (PR #224). A seat reading both versions judges the difference on the same material, so the noise the versions share cancels. No conventional significance level lets a sign test settle with four votes, so the human chose a lead of two votes over every other ruling, same included. Two seats that agree settle it, so a PR that leaves the reading as it was costs two seats. A third seat alone can never settle it, so the third and fourth launch together. The scoring run also runs on a chunk shipping an item that names the floor, so the chunk that lifts a project to the floor can prove it. A chunk that removes a release's last item without shipping it runs the scoring run too, so no release ends unmeasured, unless `todo.md` marks that release renamed in a `## Renamed` section (`bin/release_plan/todo_table.py` → `renames`). Valid while seats reading both versions agree more often than two absolute runs do.
|
||||
|
||||
2026-10-13, lilleman. No published study validates simulated reader panels as a measure of how easy code is to understand, and no test of whether the panel's signal beats its noise has run. So no ruling, score or floor blocks a merge. The runs go on, so the history keeps the scores and the places the seats found hard, for later measurement. The architect, the stability reviewer and a session filing an item read the newest places: the newest scoring run's and each later ruling's places a seat voted worse. Those are the places a chunk can improve. The check runs once per chunk, on the branch as review left it. A chunk that leaves a touched place as hard says why in its PR summary, not in a decline's record, which would outlive the place.
|
||||
|
||||
@@ -502,7 +507,7 @@ Valid while the archived verdicts show what a judge should return, and until a n
|
||||
|
||||
The rungs, least competent first: Sonnet 5.5 at high; Opus 5.5 at medium; Fable 5.2 at low and medium; Opus 5.5 at xhigh; Fable 5.2 at high and max. The 2026-11-11 note below put them so. Before it they were Sonnet 5.5 at high; Opus 5.5 at medium, high, xhigh and max; Fable 5.1 at max, after the 2026-10-29 note took Haiku 5.5 off. They first were: Haiku 5.5 at low, medium, high, xhigh and max; Sonnet 5.5 at high; Opus 5.5 at medium, high, xhigh and max; Fable 5.1 at max. The order and the cut come from the Artificial Analysis Intelligence Index (https://artificialanalysis.ai/leaderboards/models), which scores each model at each effort and gives a cost per task. A rung stays only where no cheaper rung scores as high, so a step up always buys more score (goal 1.4). The first cut, from the index read 2026-10-14, dropped Sonnet 5.5 at low, medium, xhigh and max, Opus 5.5 at low, and every Fable 5.1 rung, and every tie in the index fell among the dropped rungs. lilleman put Fable 5.1 at max back on top: the index scored it under Opus 5.5 at high, but Anthropic's model catalog names Fable the most capable model, and for the hardest tasks lilleman wants the highest quality at any price. Fable 5.2 at max tops the index outright, so that exception has ended.
|
||||
|
||||
A project's rung is its model's cheapest rung, which for Opus 5.5 is its default effort, medium. A model off the ladder routes nothing: claude runs it at the effort its settings give. A task's L steps its worker from the project's rung: 1 and 2 one down, 3 none, 4 one up. Its E + I steps its reviewers up from the project's rung: 4 or less none, 5 one up, 6 two up, 7 three up, 8 four up. A step past either end stops there. A worker errs more the more it changes and the newer that is, which L scores; review must look harder the further a defect would escape and the more it would break, which E + I scores (goals 1.1 and 1.4). Size raises L, so a large change runs its worker higher. The steps spread the values this repo's plan held when rescored on 2026-10-16, L 1 to 4 and E + I 2 to 7, so a worker on most items runs at or below the project's rung, and a review climbs only where a defect would escape far or break much. lilleman approved the steps on 2026-10-16 as a guess. `score-outcomes` reports how well L, E and I each order finished chunks by review rounds and 🔴 findings. A change to the ladder or the steps is lilleman's.
|
||||
A project's rung is its model's cheapest rung, which for Opus 5.5 is its default effort, medium. A model off the ladder doesn't route anything: claude runs it at the effort its settings give. A task's L steps its worker from the project's rung: 1 and 2 one down, 3 none, 4 one up. Its E + I steps its reviewers up from the project's rung: 4 or less none, 5 one up, 6 two up, 7 three up, 8 four up. A step past either end stops there. A worker errs more the more it changes and the newer that is, which L scores; review must look harder the further a defect would escape and the more it would break, which E + I scores (goals 1.1 and 1.4). Size raises L, so a large change runs its worker higher. The steps spread the values this repo's plan held when rescored on 2026-10-16, L 1 to 4 and E + I 2 to 7, so a worker on most items runs at or below the project's rung, and a review climbs only where a defect would escape far or break much. lilleman approved the steps on 2026-10-16 as a guess. `score-outcomes` reports how well L, E and I each order finished chunks by review rounds and 🔴 findings. A change to the ladder or the steps is lilleman's.
|
||||
|
||||
2026-10-21, lilleman, settling the routing calls stamped 2026-10-21T20:33:29Z: L 1 steps one rung down, not two as before, so an Opus 5.5 project runs no worker on Haiku 5.5. A delegated subagent takes the same steps, so an L 1 search moves off Haiku 5.5 too: lilleman chose one set of steps for chunk workers and subagents alike, so loop-claude, `subagent-rung` and rule-hook read one table (code health). No figure yet shows whether Sonnet 5.5 searches better than Haiku 5.5, so this costs more per search for a gain nobody has measured (goal 1.4). The calls came from loop-claude's routing figures, measured at cycle 165 over 46 chunks. Chunks started on Haiku 5.5 at max took a mean 7.8 review rounds past each pass's first, against 2.8 on Sonnet 5.5 at high, and 0.2 unfinished verdicts, against 0.1. The figures also called for moving workers off Sonnet 5.5 at high, whose chunks took 0.1 unfinished verdicts against 0.0 on Opus 5.5 at medium. lilleman kept L 2 on Sonnet 5.5, since that gap rests on one or two verdicts.
|
||||
|
||||
@@ -530,7 +535,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.
|
||||
|
||||
@@ -540,22 +545,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
|
||||
|
||||
@@ -579,7 +599,7 @@ Valid while Claude Code loads `~/.claude/rules/*.md` in every project, a path-sc
|
||||
|
||||
2026-11-09, larv-review, through todo item 12. Serves goal 1.1: a merge no longer rests on the worker's word. larv-review's gate was the local run alone, which it skips when the last stability round left the suite green, so an unattended chunk could merge on the worker's own report. gitea.larvit.se's runners labelled `docker-host` run `.gitea/workflows/ci.yml`, which runs `ci.sh` on the committed HEAD in a pinned Python container; the script's header says how. A run takes about 3 minutes.
|
||||
|
||||
The protection lives in Gitea's settings, outside the repo: rule `main`, required status check `CI / tests (pull_request)`. A pull request has no status until CI queues its run, so `deploy-release --cut` waits for each check the protection requires rather than reading no status as no checks, for 30 minutes at most. CI runs no rule-hook check, so a `rule-override` in the PR body has nothing to override. Whoever adds a rule check to CI must also let it read the PR body's `rule-override`. Valid while gitea.larvit.se runs a runner labelled `docker-host`.
|
||||
The protection lives in Gitea's settings, outside the repo: rule `main`, required status check `CI / tests (pull_request)`. A pull request has no status until CI queues its run, so `deploy-release --cut` waits for each check the protection requires rather than reading no status as no checks, for 30 minutes at most. CI runs no rule-hook check, so a `rule-override` in the PR body doesn't have anything to override. Whoever adds a rule check to CI must also let it read the PR body's `rule-override`. Valid while gitea.larvit.se runs a runner labelled `docker-host`.
|
||||
|
||||
## tests: each test earns its keep as the technical principles' test bullet says, and the worker takes a test's expected values from its item, never from the code
|
||||
|
||||
@@ -613,7 +633,7 @@ Valid while the worker writes the tests that larv-review's reviewers hold to the
|
||||
|
||||
2026-10-02, lilleman, on the `principle` exemption. A 🟡 against a technical principle is exempt as `principle`, because its audience value scores low and the bar would drop every one. A 🟢 against a principle is scored like any other finding.
|
||||
|
||||
2026-10-15, lilleman: the scores follow a researched method, built by `todo.md` items 149 and 151 after PR #283 shipped the ranking, PR #296 the risk scores and PR #298 the anchors each project names for each level in `docs/score-anchors.md`; the evidence is in `docs/scoring-and-goals-research.md`. R is L + E + I − 2: the chance the change holds a defect, set first by its size; the chance the defect escapes tests, review and monitoring; and the worst impact dimension, each about ×10 per level. I5, irreversible, holds R at 7 or more, and I4 at 5 or more, since a severe enough consequence outranks how unlikely it is. R stays out of the ranking and sets how carefully an item is done; an item that lowers risk scores it as value. A task's L and E + I pick its rungs in place of R (2026-10-16, lilleman), as `routing: one ladder` records. There is no C column: what it scored beyond size, spread and novelty, which L already holds, is complexity, and that adds almost nothing once size is accounted for. There is no A column either, since the Audience says whose value the goals serve. Each README goal is `maintain`, which vetoes an item that breaks it, or `achieve`, with a signal, a counter-signal and a one-line reason, as this README's Goals mark them. Two parts are not built yet and hold once their items ship: each release fills by priority up to a capacity it states (item 149), and each project keeps 10 to 20 settled decisions to test its goals against (item 151).
|
||||
2026-10-15, lilleman: the scores follow a researched method, built by `todo.md` items 149 and 151 after PR #283 shipped the ranking, PR #296 the risk scores and PR #298 the anchors each project names for each level in `docs/score-anchors.md`; the evidence is in `docs/scoring-and-goals-research.md`. R is L + E + I − 2: the chance the change holds a defect, set first by its size; the chance the defect escapes tests, review and monitoring; and the worst impact dimension, each about ×10 per level. I5, irreversible, holds R at 7 or more, and I4 at 5 or more, since a severe enough consequence outranks how unlikely it is. R stays out of the ranking and sets how carefully an item is done; an item that lowers risk scores it as value. A task's L and E + I pick its rungs in place of R (2026-10-16, lilleman), as `routing: one ladder` records. There is no C column: what it scored beyond size, spread and novelty, which L already holds, is complexity, and that adds almost no information once size is accounted for. There is no A column either, since the Audience says whose value the goals serve. Each README goal is `maintain`, which vetoes an item that breaks it, or `achieve`, with a signal, a counter-signal and a one-line reason, as this README's Goals mark them. Two parts are not built yet and hold once their items ship: each release fills by priority up to a capacity it states (item 149), and each project keeps 10 to 20 settled decisions to test its goals against (item 151).
|
||||
|
||||
2026-10-16, PR #283: items rank by `Score = 100 * V / (2**S + F)`. The 100 lets a score read to one decimal. 2**S is the cost. V sums, over the goals an item's Moves cell names, each goal's weight times how far the item moves it, 1 to 10. A Moves column holds `1.1 by 8, 1.2 by 5`. An item names a maintain goal only as a defect restoring it, or by the confidence a test, gate leg or probe adds to it, as the defect paragraph below and the 2026-11-09 paragraph after it say.
|
||||
|
||||
|
||||
@@ -1805,3 +1805,14 @@ Read most (opens and searches):
|
||||
- `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
|
||||
|
||||
@@ -22,7 +22,7 @@ Every study below predicts from the diff or history, none from a description, so
|
||||
6. **Live config or infrastructure as code.** About 70% of Google's outages come from changes to a live system (sre.google/sre-book/introduction). Syntax and configuration defects were 36.5–62.7% of IaC defects at four organisations (Rahman et al. 2018, arXiv:1809.07937).
|
||||
7. **New technology or AI-written code**, with mixed evidence (Pearce et al. 2022, S&P†; Perry et al. 2023, CCS†; Spracklen et al. 2025, USENIX Security).
|
||||
|
||||
Complexity metrics add almost nothing once size is accounted for (El Emam et al. 2001, TSE, doi:10.1109/32.935855†). So a separate difficulty score beside size, spread and novelty measures nothing new.
|
||||
Complexity metrics add almost no information once size is accounted for (El Emam et al. 2001, TSE, doi:10.1109/32.935855†). So a separate difficulty score beside size, spread and novelty measures nothing new.
|
||||
|
||||
## Value per cost, not a sum
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ The page lives at https://claude.ai/artifact/RJJwgRAke3viuqTYEgu1a9. To update i
|
||||
|
||||
## Who it is for
|
||||
|
||||
People in tech who want to build software factories, work with AI tools more efficiently, and stop fighting their agents. They know git, pull requests and the shell, and nothing about agent loops. Write for a tired reader on a Monday morning without coffee: one fact per sentence, each term explained before it is used, and no filler.
|
||||
People in tech who want to build software factories, work with AI tools more efficiently, and stop fighting their agents. They know git, pull requests and the shell, and don't know anything about agent loops. Write for a tired reader on a Monday morning without coffee: one fact per sentence, each term explained before it is used, and no filler.
|
||||
|
||||
## How the pages are built
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* Prefer deep modules: a small, intuitive interface in front of a lot of hidden work.
|
||||
- A caller should know what a call does and what it returns, without knowing how it does it. `fs.writeFile("notes.txt", data)` hides opening the file, encoding, buffering, permissions and the disk itself. Yet anyone reading that line knows the outcome: the data is written, or the call fails and says why.
|
||||
- A module hides how it works, never what it depends on: what "Functional core, imperative shell" injects stays injected.
|
||||
- A shallow module costs more to learn than it saves. BANNED: a wrapper that only renames the function it calls; a module whose callers must make three calls in an order nothing but their memory enforces. GOOD: one call that does the whole job and handles the order itself.
|
||||
- A shallow module costs more to learn than it saves. BANNED: a wrapper that only renames the function it calls; a module whose callers must make three calls in an order only their memory enforces. GOOD: one call that does the whole job and handles the order itself.
|
||||
- When this pulls against "Explicit over implicit", the deep module wins, unless hiding the work makes it harder for someone new to the project to tell what the call does.
|
||||
* Make invalid states unrepresentable.
|
||||
- Example: using a time-only type in the database when we actually want to store a time of day introduces risk for errors.
|
||||
@@ -30,7 +30,7 @@
|
||||
* One owner per value; a reader can name every writer.
|
||||
- At every scale, from a variable to a table, file or volume: two components writing the same one are one component with a seam nobody declared.
|
||||
- The test: from the code in front of them, can a reader list every writer to this value, and the order those writers run in?
|
||||
- BANNED: a record passed to 24 functions, 13 of which mutate it and return nothing. GOOD: one type owns the value, the rest call it and take a result.
|
||||
- BANNED: a record passed to 24 functions, 13 of which mutate it and don't return anything. GOOD: one type owns the value, the rest call it and take a result.
|
||||
- BANNED: `fill(set)` then `adjust(set)`, where swapping the two lines changes the output. GOOD: `const filled = fill(); const adjusted = adjust(filled);`
|
||||
- BANNED: `stack` and `edges`, two arrays a comment says must stay in step. GOOD: `edges` derived from `stack`, or one array whose element type holds both.
|
||||
- Allowed, never flag: mutation that never leaves the function that made it; a loop counter; data shared and never written; a state machine with named states and one transition function.
|
||||
|
||||
@@ -123,7 +123,7 @@ The 5 release reviews hold 64 archived findings: architecture 47, principles 17.
|
||||
|
||||
## Candidate 3: override-reviewer folded into stability
|
||||
|
||||
The archive holds 38 override-reviewer runs. None has a 🔴 or 🟡, so there is nothing to recover. Nothing was replayed.
|
||||
The archive holds 38 override-reviewer runs. None has a 🔴 or 🟡, so there isn't anything to recover. Nothing was replayed.
|
||||
|
||||
**Verdict: no data.**
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Run analyze.py's matching and new-finding count, and also sum what those calls cost. Usage: [BASELINE=<candidate>] analyze_metered.py <candidate> <variant>-<run>... [case ids...]"""
|
||||
import pathlib, runpy, sys, threading
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
|
||||
import analyze, review_replay.main as rm
|
||||
import analyze, review_replay.replay as rm
|
||||
from claude_code.reply import claude_reply
|
||||
SPENT = [0.0]; LOCK = threading.Lock()
|
||||
def metered(*a, **k):
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import concurrent.futures, json, os, pathlib, pickle, re, shutil, sys, tempfile
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1] / "bin"))
|
||||
from claude_code.reply import claude_reply, Limited
|
||||
from review_replay.main import clone_reviewed, Copies, copy_reports, match, redirected
|
||||
from review_replay.replay import clone_reviewed, Copies, copy_reports, match, redirected
|
||||
from failure import Failure
|
||||
from review_replay.rounds import lost_inputs, Round
|
||||
from review_rules.review_folder import REPORTS, review_folder
|
||||
from review_replay import main as rm
|
||||
from review_replay import replay as rm
|
||||
from model_routing.ladder import Rung
|
||||
from loop_effects.effects import system_effects
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Hold all of these or the comparison doesn't prove anything.
|
||||
one. Seats that read different amounts produce numbers nothing can compare.
|
||||
- **Blind.** Deny the project's own conclusions — the plan, a decision log, prior review
|
||||
output — and never show a panelist the metric under test. An anchored reader is a wasted one.
|
||||
- **Check what the harness pre-loads, before launching.** `CLAUDE.md` may be nothing but
|
||||
- **Check what the harness pre-loads, before launching.** `CLAUDE.md` may hold only
|
||||
`@AGENTS.md`, and an `@file` import lands in a subagent's context ahead of its first tool call.
|
||||
That is harmless for a reader who was going to read the charter anyway, and fatal to the
|
||||
architects' README-and-tree-only step. Read the project's `CLAUDE.md` and resolve its imports
|
||||
@@ -121,7 +121,7 @@ Identical shape for all seven:
|
||||
2. The single unit they would least want to be asked to modify, and why.
|
||||
3. What they expected to be hard and found easy.
|
||||
4. Prose debt: which documentation they needed, what it cost to find, and — separately — which
|
||||
prose they read that told them nothing the code was not already saying. Both halves matter.
|
||||
prose they read that didn't tell them anything the code wasn't already saying. Both halves matter.
|
||||
Panels reliably find that the answers exist and are unfindable, which is a different defect
|
||||
from prose that should not exist at all, and the fixes are opposite: index the first, delete
|
||||
the second.
|
||||
|
||||
@@ -51,7 +51,7 @@ Report, in this shape:
|
||||
1. Ranked 5–8 hardest places, hardest first. Each: path:line and the unit's name, one to three sentences on what specifically defeated you (branches held at once, length, a misleading name, missing context, state mutated out of sight, a rule you had to hunt for elsewhere) and whether anything resolved it (a comment, the charter, a test) or it stayed opaque.
|
||||
2. The single unit you would least want to be asked to modify, and why.
|
||||
3. What you expected to be hard and found easy.
|
||||
4. Prose debt: documentation you needed and what it cost to find; separately, prose you read that told you nothing the code was not already saying.
|
||||
4. Prose debt: documentation you needed and what it cost to find; separately, prose you read that didn't tell you anything the code wasn't already saying.
|
||||
5. Navigation, Locality, Shape, Self-sufficiency, overall — each with one sentence naming the anchor it sits against and the concrete thing that holds it there. A score with no named cause is discarded.
|
||||
```
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ A pass is one kind of review, a row of the table, named by its first column. Its
|
||||
| Product-owner | product-owner-reviewer | changes an external surface or contract: API routes and request/response shapes, events, webhooks, published file formats, CLI flags and exit codes, UI, error or deprecation text a consumer reads, README and docs an outside reader lands on |
|
||||
| Prose | prose-reviewer | changes prose a reader reads, such as docs, comments, help or error text, or the plan's text for an item the chunk ships, splits or answers; one round |
|
||||
|
||||
The table's first two columns are also code: `PASS_AGENTS` in `bin/review_rules/review_passes.py`, which `bin/repo_checks/test_reviewer_launches.py` holds to the table. Change a row in both.
|
||||
|
||||
A comment is prose, not code, in any file, and so is a docstring. A change to config is one that changes what runs, so a comment in a workflow or compose file fires only the prose pass. Markdown an agent follows is config: `CLAUDE.md`, `AGENTS.md`, `workflow-bench/*-prompt.md`, and files under `agents/`, `principles/`, `rules/` or `skills/`.
|
||||
|
||||
**Plan rows.** A `todo.md` row or detail that the chunk files from a finding, re-scores or moves between releases gets no review: the chunk that ships the item reads it.
|
||||
@@ -154,7 +156,7 @@ The comprehension check records how hard the project is for its contributor to r
|
||||
**Scoring run**, when `~/.claude/bin/larv-review needs-scoring-run <the IDs of the items the chunk ships, if any>` prints `Scoring run due:`. Run `needs-scoring-run` before removing the chunk's items from `todo.md`. `chunk-pr merge` refuses until the branch's committed history records every run the plan calls, which `larv-review scoring-run-owed` counts at merge time from the merge base; an earlier due line is only a snapshot.
|
||||
|
||||
- **Seats.** Junior A, Mid A, the maintainability senior and the inherited architect each score the project at the head from 1 to 10 overall and on four dimensions: Navigation, Locality, Shape and Self-sufficiency. Run `~/.claude/bin/larv-review prepare-scoring`, adding `--preloaded <text>` only where its default list of pre-loaded files is wrong. It makes the worktree the seats read and prints each seat's prompt file; launch each seat with its file's text as its prompt. Write their lines into a scores file and run `~/.claude/bin/larv-review record-scoring <scores file> <the same item IDs>`, which appends the run to the history and prints the four seats' means.
|
||||
- **Floor item.** Where `record-scoring` prints `Floor:`, a `Next:` line follows: file one floor item, or refresh the open one. A floor item is a plan item meant to bring every mean to 7.0. File it as one ambitious refactor, not touch-ups. It restructures the area behind the places `larv-review places` prints for this run, chosen where they bear on the lowest dimension, sized to bring every mean to 7.0, and quotes those places. Its tagline holds the words `comprehension floor`, so its own chunk runs a scoring run; while a mean stays under 7.0, that run's `Next:` line asks for the next floor item. Mark it `owner`, since the human asked that such a project always hold one, so no score deletes it. Put it in the earliest release the plan names after the one the chunk ships into, or else in the next version after that one that `~/.claude/rules/todo-items.md` allows, so the floor doesn't hold up any release. While one is open, refresh its places and aim from the newest run instead of filing another; the item the chunk ships doesn't count as open. Commit it with the run, as "Record" says.
|
||||
- **Floor item.** Where `record-scoring` prints `Floor:`, a `Next:` line follows: file one floor item, or refresh the open one. A floor item is a plan item meant to bring every mean to 7.0. File it as one ambitious refactor, not touch-ups. It restructures the area behind the places `larv-review places` prints for this run, chosen where they bear on the lowest dimension, sized to bring every mean to 7.0, and quotes those places. Its tagline opens with `Reach the comprehension floor:`, so its own chunk runs a scoring run; while a mean stays under 7.0, that run's `Next:` line asks for the next floor item. Mark it `owner`, since the human asked that such a project always hold one, so no score deletes it. Put it in the earliest release the plan names after the one the chunk ships into, or else in the next version after that one that `~/.claude/rules/todo-items.md` allows, so the floor doesn't hold up any release. While one is open, refresh its places and aim from the newest run instead of filing another; the item the chunk ships doesn't count as open. Commit it with the run, as "Record" says.
|
||||
- **Second run.** Where `needs-scoring-run` printed that the chunk `leaves release … with no plan item`, run `prepare-scoring` again and launch the same four seats afresh on the same head. Their scores file's first line is `<PR or branch> rerun at <commit>`. Record it with the same `record-scoring` command.
|
||||
- **Agreement.** After the second run, run `~/.claude/bin/larv-review agreement` and put its counts in the summary. On `Assumption fails:`, ask the user whether to keep the paired ruling or change the decision `review: the comprehension check records …`. Record the answer as a decision in the repo whose history was counted, with the counts that led to the ask. A later run asks again only when the rulings' rate falls, or the runs' rate rises, against the recorded counts.
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Default to NO comment. Delete one that is any of:
|
||||
|
||||
## Negation, history and limitations: name the action, or leave it out
|
||||
|
||||
Prose describing the code as it stands — a comment, a README, an `AGENTS.md`, an API spec — may narrate what is *not* done (a removed step, a call we don't make, a superseded version `we used to X, now Y`, a limitation) in one shape only: where a reader would otherwise **do** something harmful, and the sentence says what to do instead. GOOD: `wrap a direct ./tests/run.sh to put it under the same lock`. BANNED: `run.sh takes no host lock`. A limitation with nothing to do instead belongs in the PR or ticket, because **documenting a limitation is not fixing it**.
|
||||
Prose describing the code as it stands — a comment, a README, an `AGENTS.md`, an API spec — may narrate what is *not* done (a removed step, a call we don't make, a superseded version `we used to X, now Y`, a limitation) in one shape only: where a reader would otherwise **do** something harmful, and the sentence says what to do instead. GOOD: `wrap a direct ./tests/run.sh to put it under the same lock`. BANNED: `run.sh takes no host lock`. A limitation without a step to take instead belongs in the PR or ticket, because **documenting a limitation is not fixing it**.
|
||||
|
||||
## Links and pointers
|
||||
|
||||
|
||||
@@ -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,81 +12,60 @@
|
||||
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 311 | 0.9.0 | | | **Hand each worker's claude a Bash output ceiling that saves longer output to a file, and refuse a Read of a session transcript under `~/.claude/projects`.** | 2 | 2 | 3 | 5 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 316 | 0.9.0 | | | **Launch comprehension seats as an agent type of their own under `agents/`, without `CLAUDE.md` and the skill and agent listings a general-purpose subagent carries.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 339 | 0.9.0 | | | **Lower the reading cost of the files a chunk reads most before its first commit.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 306 | 0.10.0 | | | **Set a strategy that keeps loop-claude's archive and larv-review's review folders backed up and small over the years, compressing older entries without losing any.** | 3 | 2 | 4 | 7 | 5 | 3 by 5 | 3.9 |
|
||||
| 302 | 0.10.0 | | | **Call a scoring run for an item whose tagline makes the comprehension floor its target, and not for one that only names the floor, such as in a quoted decision title.** | 2 | 2 | 3 | 5 | 3 | code health by 2 | 3.6 |
|
||||
| 287 | 0.10.0 | | | **Move the forge helpers `Forge`, `forge_of`, `runner`, `open_pull`, `merged_pull`, `pull_at`, `gitea`, `checks_passed` and `required_checks` into one module that `chunk_preflight`, `chunk_pr`, `deploy_release` and `larv_review` all import from, so no tool imports another tool's internals for them.** | 3 | 1 | 3 | 5 | 5 | code health by 3 | 3.4 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 300 | 0.10.0 | | owner | **Restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Locality first: today the comprehension floor run at 52da15e scored Locality 6.00, Shape 6.25, Self-sufficiency 6.38 and Overall 6.38.** | 4 | 2 | 3 | 7 | 8 | code health by 8 | 2.0 |
|
||||
| 264 | 0.10.0 | | | **Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 5 | 2.0 |
|
||||
| 323 | 0.10.0 | | | **Count a release review as landed once its pull request has merged, whatever its commits are titled.** | 3 | 2 | 3 | 6 | 3 | 1.4 by 3, 1.5 by 2 | 2.0 |
|
||||
| 342 | 0.10.0 | | | **Research the tooling agents read, search and run commands with once more, and file an item for each tool that cuts tokens a replay shows keep quality.** | 1 | 2 | 1 | 2 | 3 | 1.4 by 3, 1.5 by 2 | 2.0 |
|
||||
| 149 | 0.10.0 | | decision | **Fill each release by priority up to a capacity it states, in place of the bar, and move what does not fit to a later release.** | 4 | 2 | 3 | 7 | 5 | 1.1 by 7 | 1.8 |
|
||||
| 165 | 0.10.0 | | | **Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 4, 1.4 by 3 | 1.8 |
|
||||
| 151 | 0.10.0 | | decision | **Keep 10 to 20 settled decisions per project as its goals' test set, and rerun them after a goal changes.** | 3 | 2 | 2 | 5 | 5 | 1.2 by 7 | 1.8 |
|
||||
| 68 | 0.10.0 | | principle | **Test `workflow-bench/compare.py`'s blinding and `bench.py`'s run plan.** | 2 | 1 | 1 | 2 | 4 | 1.1 by 5 | 1.8 |
|
||||
| 102 | 0.10.0 | | | **Give loop-claude's retry delay, and the file it reads the machine's memory from, environment overrides, so the black-box test stops replacing `time.sleep` and `machine_load.memory.MEMINFO` through `sitecustomize`.** | 1 | 1 | 2 | 2 | 3 | 1.1 by 4 | 1.7 |
|
||||
| 135 | 0.10.0 | | | **Fingerprint only the modules loop-claude imports, so editing another tool's code no longer reloads a running loop.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 4 | 1.7 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 267 | 0.10.0 | | | **Keep waiting when an interrupt gets an empty answer, at the terminal or in the claude opened for it, in place of stopping the loop.** | 2 | 1 | 3 | 4 | 2 | 1.5 by 3 | 1.3 |
|
||||
| 4 | 0.10.0 | | | **Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.** | 3 | 2 | 3 | 6 | 3 | 1.1 by 3 | 1.3 |
|
||||
| 324 | 0.10.0 | | | **Count in the routing figures the finished chunks whose worker wrote no `Chunk items:` line.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 2, 1.4 by 1 | 1.2 |
|
||||
| 187 | 0.10.0 | | | **Count the tokens a worker spends reading reviewers' reports, so goal 1.4's signal shows whether report files lowered what a review costs the worker's context.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 266 | 0.10.0 | | | **Move the chunks archived under the key `home/lilleman/.claude` to the key `claude-config`, so the routing figures and `score-outcomes` count this repo's chunks as one project.** | 3 | 2 | 2 | 5 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 181 | 0.10.0 | | principle | **Have the test of a quoted answer's step-up assert the stepped rung's facts as literals, not through `prompts.rungs_held`.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 1.0 |
|
||||
| 193 | 0.10.0 | | | **Narrow `readme_goals`'s mark to `Mark` by a typed lookup in place of `typing.cast`, so a mark added to the regex but not the lookup fails at run time, and one added to the lookup but not `Mark` fails mypy.** | 1 | 1 | 3 | 3 | 1 | 1.1 by 2 | 1.0 |
|
||||
| 194 | 0.10.0 | | | **Make `test_waits_out_a_usage_limit_which_ends_a_run_of_failures` expect a usage-limit wait independent of the wall-clock time that passes during the run.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 1.0 |
|
||||
| 265 | 0.10.0 | | | **Archive each wait that costs a chunk wall time, for a usage limit, low memory, a failed worker start or a heavy slot, with its start and end stamps, so goal 1.5's hours split waiting from work.** | 3 | 2 | 2 | 5 | 4 | 1.5 by 3 | 1.0 |
|
||||
| 169 | 0.10.0 | | | **Have rule-hook's `todo-rank-check` catch a `todo.md` that the same Bash call edits and then commits.** | 3 | 1 | 3 | 5 | 3 | 1.1 by 2 | 0.8 |
|
||||
| 197 | 0.10.0 | | | **Let the human edit what they type at loop-claude's terminal questions with the arrow keys, so Left moves the cursor in place of printing `^[[D`.** | 2 | 2 | 3 | 5 | 2 | 1.5 by 1 | 0.4 |
|
||||
| 1 | 0.11.0 | | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 1 | 2 | 1 | 2 | 1 | | 0.0 |
|
||||
| 319 | 0.10.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.10.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.10.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 |
|
||||
| 311 | 0.10.0 | | | **Hand each worker's claude a Bash output ceiling that saves longer output to a file, and refuse a Read of a session transcript under `~/.claude/projects`.** | 2 | 2 | 3 | 5 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 316 | 0.10.0 | | | **Launch comprehension seats as an agent type of their own under `agents/`, without `CLAUDE.md` and the skill and agent listings a general-purpose subagent carries.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 339 | 0.10.0 | | | **Lower the reading cost of the files a chunk reads most before its first commit.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 341 | 0.10.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.10.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.10.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.10.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.10.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.11.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.11.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 |
|
||||
| 306 | 0.11.0 | | | **Set a strategy that keeps loop-claude's archive and larv-review's review folders backed up and small over the years, compressing older entries without losing any.** | 3 | 2 | 4 | 7 | 5 | 3 by 5 | 3.9 |
|
||||
| 287 | 0.11.0 | | | **Move the forge helpers `Forge`, `forge_of`, `runner`, `open_pull`, `merged_pull`, `pull_at`, `gitea`, `checks_passed` and `required_checks` into one module that `chunk_preflight`, `chunk_pr`, `deploy_release` and `larv_review` all import from, so no tool imports another tool's internals for them.** | 3 | 1 | 3 | 5 | 5 | code health by 3 | 3.4 |
|
||||
| 338 | 0.11.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.11.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.11.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 |
|
||||
| 196 | 0.11.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.11.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.11.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.11.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.11.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 |
|
||||
| 300 | 0.11.0 | | owner | **Reach the comprehension floor: restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Self-sufficiency first; today the scoring run at fba48f3 scored Navigation 6.88, Locality 5.63, Shape 6.00, Self-sufficiency 5.00 and Overall 5.88.** | 4 | 2 | 3 | 7 | 8 | code health by 8 | 2.0 |
|
||||
| 264 | 0.11.0 | | | **Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 5 | 2.0 |
|
||||
| 323 | 0.11.0 | | | **Count a release review as landed once its pull request has merged, whatever its commits are titled.** | 3 | 2 | 3 | 6 | 3 | 1.4 by 3, 1.5 by 2 | 2.0 |
|
||||
| 342 | 0.11.0 | | | **Research the tooling agents read, search and run commands with once more, and file an item for each tool that cuts tokens a replay shows keep quality.** | 1 | 2 | 1 | 2 | 3 | 1.4 by 3, 1.5 by 2 | 2.0 |
|
||||
| 149 | 0.11.0 | | decision | **Fill each release by priority up to a capacity it states, in place of the bar, and move what does not fit to a later release.** | 4 | 2 | 3 | 7 | 5 | 1.1 by 7 | 1.8 |
|
||||
| 165 | 0.11.0 | | | **Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 4, 1.4 by 3 | 1.8 |
|
||||
| 151 | 0.11.0 | | decision | **Keep 10 to 20 settled decisions per project as its goals' test set, and rerun them after a goal changes.** | 3 | 2 | 2 | 5 | 5 | 1.2 by 7 | 1.8 |
|
||||
| 68 | 0.11.0 | | principle | **Test `workflow-bench/compare.py`'s blinding and `bench.py`'s run plan.** | 2 | 1 | 1 | 2 | 4 | 1.1 by 5 | 1.8 |
|
||||
| 102 | 0.11.0 | | | **Give loop-claude's retry delay, and the file it reads the machine's memory from, environment overrides, so the black-box test stops replacing `time.sleep` and `machine_load.memory.MEMINFO` through `sitecustomize`.** | 1 | 1 | 2 | 2 | 3 | 1.1 by 4 | 1.7 |
|
||||
| 135 | 0.11.0 | | | **Fingerprint only the modules loop-claude imports, so editing another tool's code no longer reloads a running loop.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 4 | 1.7 |
|
||||
| 5 | 0.11.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.11.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.11.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 |
|
||||
| 260 | 0.11.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.11.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.11.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 |
|
||||
| 267 | 0.11.0 | | | **Keep waiting when an interrupt gets an empty answer, at the terminal or in the claude opened for it, in place of stopping the loop.** | 2 | 1 | 3 | 4 | 2 | 1.5 by 3 | 1.3 |
|
||||
| 4 | 0.11.0 | | | **Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.** | 3 | 2 | 3 | 6 | 3 | 1.1 by 3 | 1.3 |
|
||||
| 324 | 0.11.0 | | | **Count in the routing figures the finished chunks whose worker wrote no `Chunk items:` line.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 2, 1.4 by 1 | 1.2 |
|
||||
| 187 | 0.11.0 | | | **Count the tokens a worker spends reading reviewers' reports, so goal 1.4's signal shows whether report files lowered what a review costs the worker's context.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 266 | 0.11.0 | | | **Move the chunks archived under the key `home/lilleman/.claude` to the key `claude-config`, so the routing figures and `score-outcomes` count this repo's chunks as one project.** | 3 | 2 | 2 | 5 | 3 | 1.4 by 3 | 1.2 |
|
||||
| 181 | 0.11.0 | | principle | **Have the test of a quoted answer's step-up assert the stepped rung's facts as literals, not through `prompts.rungs_held`.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 1.0 |
|
||||
| 193 | 0.11.0 | | | **Narrow `readme_goals`'s mark to `Mark` by a typed lookup in place of `typing.cast`, so a mark added to the regex but not the lookup fails at run time, and one added to the lookup but not `Mark` fails mypy.** | 1 | 1 | 3 | 3 | 1 | 1.1 by 2 | 1.0 |
|
||||
| 194 | 0.11.0 | | | **Make `test_waits_out_a_usage_limit_which_ends_a_run_of_failures` expect a usage-limit wait independent of the wall-clock time that passes during the run.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 1.0 |
|
||||
| 265 | 0.11.0 | | | **Archive each wait that costs a chunk wall time, for a usage limit, low memory, a failed worker start or a heavy slot, with its start and end stamps, so goal 1.5's hours split waiting from work.** | 3 | 2 | 2 | 5 | 4 | 1.5 by 3 | 1.0 |
|
||||
| 169 | 0.11.0 | | | **Have rule-hook's `todo-rank-check` catch a `todo.md` that the same Bash call edits and then commits.** | 3 | 1 | 3 | 5 | 3 | 1.1 by 2 | 0.8 |
|
||||
| 197 | 0.11.0 | | | **Let the human edit what they type at loop-claude's terminal questions with the arrow keys, so Left moves the cursor in place of printing `^[[D`.** | 2 | 2 | 3 | 5 | 2 | 1.5 by 1 | 0.4 |
|
||||
| 1 | 0.12.0 | | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 1 | 2 | 1 | 2 | 1 | | 0.0 |
|
||||
|
||||
## 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 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.
|
||||
|
||||
Recommendation: reword all four as above. They are decisions the repo held before item 292, so the rewording is lilleman's call.
|
||||
|
||||
### 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.
|
||||
@@ -127,7 +106,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.
|
||||
|
||||
@@ -141,6 +120,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.
|
||||
@@ -171,14 +161,6 @@ Write the strategy as a decision, then build it:
|
||||
- **Readers.** `bin/transcript_archive`, `routing_figures`, `score-outcomes`, `review-replay`, `judge-replay` and `reading-cost` must read compressed entries; test each on one.
|
||||
- Revise `loop-claude: the archive keeps the raw transcript`, whose validity is "while transcripts stay small enough to copy whole".
|
||||
|
||||
### 302. Call a scoring run for an item whose tagline makes the comprehension floor its target, and not for one that only names the floor, such as in a quoted decision title.
|
||||
|
||||
`bin/larv_review/scoring.py` sets `FLOOR_ITEM = "comprehension floor"` (line 7) and tests it as a substring of the tagline at line 35 and in `bin/larv_review/plan.py:28`. So any item whose tagline holds those words counts as a floor item. Item 301's tagline quoted the title of the decision "comprehension floor: …", so its chunk was due a scoring run it did not need. The deployed `chunk-pr` (release 0.7.0) did not refuse the merge, so it merged without one, and the run was recorded late, in PR #476.
|
||||
|
||||
Recommendation: a floor item's tagline opens with one fixed phrase, `Reach the comprehension floor:`, and both checks test that the tagline, with its leading `**` stripped, starts with it, in place of the substring test. Reason: a quoted title or a passing mention never sits at a tagline's start, so the check needs no parsing and keeps one constant. An Exempt reason such as `floor` was the alternative; it would change `rank_todo.py`'s schema and every project's table for the same effect.
|
||||
|
||||
The same chunk names the phrase where a floor item is filed: `skills/larv-review/SKILL.md` → "Floor item", the `Next:` lines `floor_step` prints, and `larv-review --help` (`bin/larv_review/main.py`, lines 35 and 89). It rewords open floor item 300's tagline to open with the phrase, and updates the tests in `bin/larv_review/test_larv_review.py` that use floor taglines (lines 120, 361, 435, 537), adding one where a tagline quotes the floor mid-sentence and is due no run.
|
||||
|
||||
### 287. Move the forge helpers `Forge`, `forge_of`, `runner`, `open_pull`, `merged_pull`, `pull_at`, `gitea`, `checks_passed` and `required_checks` into one module that `chunk_preflight`, `chunk_pr`, `deploy_release` and `larv_review` all import from, so no tool imports another tool's internals for them.
|
||||
|
||||
Today the helpers live in two tools. `Forge` is defined in `bin/chunk_preflight/gathered.py` and imported by `bin/chunk_preflight/choices.py`, `bin/chunk_preflight/facts.py`, `bin/chunk_preflight/main.py` and `bin/chunk_pr/main.py`, and again through `choices` by `bin/deploy_release/forge.py`. `forge_of` lives in `choices.py`, which `bin/chunk_pr/main.py`, `bin/deploy_release/cut.py` and `bin/larv_review/reviewer_header.py` import. `open_pull`, `runner` and `gitea` live in `bin/deploy_release/forge.py`, which `bin/chunk_pr/main.py` and `bin/larv_review/reviewer_header.py` import. So `deploy_release` imports `chunk_preflight`, and `chunk_pr` and `larv_review` import both.
|
||||
@@ -193,7 +175,7 @@ lilleman asked, on 2026-10-16, for a standing audit each release, so the loop ke
|
||||
|
||||
The 0.8.0 audit filed four steps, items 334, 335, 336 and 337, and found most other repeated steps already covered by items 295, 312, 325, 326 and 327.
|
||||
|
||||
The chunk that ships this item files a copy of this audit in release 0.11.0, the release after this item's own, to audit release 0.10.0, rewording "0.9.0" to "0.10.0", and marks the copy `owner`, so the audit recurs each release until lilleman drops it.
|
||||
The chunk that ships this item files a copy of this audit in release 0.12.0, the release after this item's own, to audit release 0.10.0, rewording "0.9.0" to "0.10.0", and marks the copy `owner`, so the audit recurs each release until lilleman drops it.
|
||||
|
||||
### 288. 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.
|
||||
|
||||
@@ -251,9 +233,9 @@ Releases are the human's, and `CLAUDE.md` → "Working loop" already ends the lo
|
||||
|
||||
Raised by the goals audit of PR #296. `bin/routing_figures/calls.py` groups a chunk's review rounds by the rung its worker started on, and calls for a routing change when a lower rung took more of them. Since PR #296 the reviewers may run above the worker's rung, on the one their item's E + I picks, and no figure groups rounds by it, though the archived worker line names the E + I it follows from. A cheap worker on an item of high E + I gets stronger reviewers, who may raise more rounds, and a call could then blame the worker's rung for them: an interrupt of lilleman that settles nothing (goal 1.2).
|
||||
|
||||
### 300. Restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Locality first: today the comprehension floor run at 52da15e scored Locality 6.00, Shape 6.25, Self-sufficiency 6.38 and Overall 6.38.
|
||||
### 300. Reach the comprehension floor: restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Self-sufficiency first; today the scoring run at fba48f3 scored Navigation 6.88, Locality 5.63, Shape 6.00, Self-sufficiency 5.00 and Overall 5.88.
|
||||
|
||||
Filed by the comprehension check of PR #473 at 13d1550 (`larv-review record-scoring`), which printed `Floor:` and `Next:`, and refreshed from the run of PR #475 at 52da15e. The lowest mean is Locality, 6.00. Refresh this item's places and aim from the newest run before the chunk starts; do not file a second floor item.
|
||||
Filed by the comprehension check of PR #473 at 13d1550 (`larv-review record-scoring`), which printed `Floor:` and `Next:`, and refreshed from the second run of PR #510 at fba48f3. The lowest mean is Self-sufficiency, 5.00: all four seats name a reason that sits in `docs/decisions.md`, in the vocabulary at the end of `CLAUDE.md` or in `skills/larv-review/SKILL.md` rather than beside the code. Refresh this item's places and aim from the newest run before the chunk starts; do not file a second floor item.
|
||||
|
||||
Aim: one ambitious refactor of the areas below, sized so every mean reaches 7.0 on the chunk's own scoring run. Where a place is already easier to read when the chunk starts, drop it.
|
||||
|
||||
@@ -277,8 +259,13 @@ Places the seats named, hardest first (`larv-review places`):
|
||||
- Shape: `bin/rule_hook/rules.py:25` `RULES`: rules sit inline in one module while five others have a module each.
|
||||
- Navigation, Shape: `README.md:116` `bin/`: about 64 entries in one flat list, some 35 of them packages, the worst fan-out level.
|
||||
- Self-sufficiency: `skills/larv-review/SKILL.md:147` "Scoring run": dense rule prose with many cross-references; three sections rebuild one rule.
|
||||
- Locality: `bin/review_rules/round_titles.py:1` `ROUND`: the commit-title protocol `Answer <pass> round <n>: …` is parsed in `round_titles.py`, `rule_hook/round_cap.py`, `score_outcomes`, `branch_chunks` and `routing_figures`, and written in SKILL.md.
|
||||
- Locality: `bin/larv_review/scoring_setup.py:156` `prepare_scoring`: code parses the headings and fences of SKILL.md and `seat-prompts.md`, so a prose edit can break it.
|
||||
- Shape: `bin/command_lines/shell_command.py:46` `segments`: a hand-written shell tokenizer whose regexes stay opaque.
|
||||
- Shape: `reviewer-merge-trials/driver.py:1` `driver`: one-off trial scripts space-indented and tersely named, against the repo's tabs and naming.
|
||||
- Self-sufficiency: the seats on this run name the decision-log titles that code cites for a constant's reason (`routing: …` in `routing.py`, `ladder.py`, `judge.py`) as the largest cost; state each reason beside its constant.
|
||||
|
||||
Scored L 4 because the refactor touches several components that hold known defects, E 2 because review and a manual check see a regression, I 3 because every session runs these tools. The chunk runs a scoring run, since its tagline names the comprehension floor.
|
||||
Scored L 4 because the refactor touches several components that hold known defects, E 2 because review and a manual check see a regression, I 3 because every session runs these tools. The chunk runs a scoring run, since it is a floor item.
|
||||
|
||||
### 264. Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.
|
||||
|
||||
@@ -369,7 +356,7 @@ Weigh the widely used tmux-resurrect and tmux-continuum plugins against a script
|
||||
|
||||
### 267. Keep waiting when an interrupt gets an empty answer, at the terminal or in the claude opened for it, in place of stopping the loop.
|
||||
|
||||
11 runs in the archive ended with "Stopped: the human is needed to answer the question above, but the interrupt ended with nothing typed", each leaving its chunk open until the human restarted the loop. That stop comes from `human_typed` in `bin/loop_claude/cycle/interrupt.py`, after the claude opened for `/talk` or for a release ready to cut ends with no human turn. An empty line at the terminal stops the loop the same way, in `first_answer`. Item 268 removes one of the cases that opens claude.
|
||||
11 runs in the archive ended with "Stopped: the human is needed to answer the question above, but the interrupt ended without anything typed", each leaving its chunk open until the human restarted the loop. That stop comes from `human_typed` in `bin/loop_claude/cycle/interrupt.py`, after the claude opened for `/talk` or for a release ready to cut ends with no human turn. An empty line at the terminal stops the loop the same way, in `first_answer`. Item 268 removes one of the cases that opens claude.
|
||||
|
||||
### 4. Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
You compare two code-review processes, A and B, on one real chunk of work. Each process reviewed the same chunk three times, independently: runs A1–A3 and B1–B3. Rule whether B reviews at least as well as A, and whether A reviews at least as well as B.
|
||||
|
||||
Everything is under `{dir}`; read nothing outside it:
|
||||
Everything is under `{dir}`; don't read anything outside it:
|
||||
|
||||
- `truth-issues.md`: what the chunk's real review found and fixed, one row per issue.
|
||||
- `truth.diff`: the real review's fixes.
|
||||
|
||||
@@ -9,7 +9,7 @@ Report: write it to `{report}`.
|
||||
- `VERSION_DIR/skills/larv-review/SKILL.md` is larv-review. Do not invoke the installed `larv-review` skill.
|
||||
- Wherever a text cites `~/.claude/<path>`, read `VERSION_DIR/<path>` instead. `VERSION_DIR/CLAUDE.md` replaces `~/.claude/CLAUDE.md`, which you already have loaded: where the two differ, VERSION_DIR's wins.
|
||||
- Launch every reviewer named `<name>` under `~/.claude/agents/` as a `general-purpose` agent whose prompt opens with the body of `VERSION_DIR/agents/<name>.md` (frontmatter dropped), then the task. A reviewer the process names that has no file there gets the process's own description of it as its prompt.
|
||||
- `/security-review`: launch a `general-purpose` agent that invokes the Skill tool's `security-review`, edits nothing, and replies with the skill's report, or that the skill is unavailable. Where that skill is unavailable, emulate it with a `general-purpose` agent, told to review the branch diff for exploitable vulnerabilities and report only those at ≥0.8 confidence.
|
||||
- `/security-review`: launch a `general-purpose` agent that invokes the Skill tool's `security-review`, doesn't edit anything, and replies with the skill's report, or that the skill is unavailable. Where that skill is unavailable, emulate it with a `general-purpose` agent, told to review the branch diff for exploitable vulnerabilities and report only those at ≥0.8 confidence.
|
||||
|
||||
## Bench rules
|
||||
|
||||
@@ -18,7 +18,7 @@ Report: write it to `{report}`.
|
||||
- Run every git command through `python3 {review_git} <subcommand> <args>`, never bare `git`: that wrapper is the only shell command allowed. It runs `log`, `diff`, `show`, `status`, `ls-files`, `add` and `commit`. Where the process asks for another git command, do without it and list it under Ambiguities. Run no other code or test suite. Where the process asks for a run, such as the stability pass's mutation test, review by reading and list the skipped run under Ambiguities.
|
||||
- Skip the comprehension check; say so in the report.
|
||||
- No human is reachable. Where the process names a no-human branch, take it; where it names none, take your recommendation and list the question in the report.
|
||||
- Commit each round's fixes on `chunk` with `python3 {review_git} commit -m <message>`, messages prefixed `{case} - review: `. Touch nothing outside this repository except the report.
|
||||
- Commit each round's fixes on `chunk` with `python3 {review_git} commit -m <message>`, messages prefixed `{case} - review: `. Don't touch anything outside this repository except the report.
|
||||
|
||||
## Report
|
||||
|
||||
|
||||
Reference in New Issue
Block a user