Answer the architecture, stability and product-owner rounds: errors as values, security first, defect rows, Next ID, the format in --help

This commit is contained in:
2026-10-02 20:16:01 +02:00
parent c0dba6625c
commit 798dfd781e
7 changed files with 309 additions and 174 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
## Unreleased
- `bin/rank_todo.py` scores and ranks a project's `todo.md`: one table of items, each scored by the formula, bar and goal weights the file states; it exits 1 on an item under the bar, and `--check` also on an unranked file.
- Every project's `todo.md` takes one shape, and larv-review's gate checks it: one table of items, each scored by the formula, bar and goal weights the file states, an item under the bar dropped unless its Exempt cell says why. `bin/rank_todo.py` ranks the table, and `rank_todo.py --help` shows a valid file.
- Run `loop-claude` only in a sandbox with no direct access to production: every claude it starts skips every permission prompt.
- First release: `README.md` states what the checkout holds and needs, `loop-claude --help` what `loop-claude` does.
- `settings.json`, the agents and the status line run unedited on any machine with README → Install's prerequisites; the status line shows reset times in the machine's own time zone.
+4 -4
View File
@@ -11,7 +11,7 @@ How work proceeds in any repo, unless the repo's `AGENTS.md` says otherwise. The
- **When the next release has no items and no work has landed towards it, plan it as this chunk.** Move the highest-scoring items of later releases into it, and get the human's approval of that set before writing any code.
- **When the next release has no items left and work has landed towards it, it is finished: stop.** Report what it holds and that it is ready to cut. Under `/loop`, this ends the loop. Until the human cuts it, only a security fix lands, into that release; never start a later release's items or plan a new one.
- **Open every chunk with one line:** the last version cut, what is unreleased (`CHANGELOG.md` → `## Unreleased`, or else the log since the last tag), and the release this chunk ships into. A repo that publishes nothing says so once.
- **Work one chunk at a time, and make it as large as one purpose allows.** Every review has a fixed cost, so a chunk takes the next plan item plus every other item for which three things hold: one PR title states what they achieve together, without listing them; they sit under one release; and they fire the same review passes (`larv-review` §3). Tiny items, a few lines of change each, need neither a shared purpose nor the same passes: bundle up to ten from one release into one chunk. Split a milestone into items in `todo.md` before starting it. Fix a finding in the chunk's own change within the chunk. File a finding about anything else in `todo.md`, scored, unless it scores under the bar.
- **Work one chunk at a time, and make it as large as one purpose allows.** Every review has a fixed cost, so a chunk takes the next plan item plus every other item for which three things hold: one PR title states what they achieve together, without listing them; they sit under one release; and they fire the same review passes (`larv-review` §3). Tiny items, a few lines of change each, need neither a shared purpose nor the same passes: bundle up to ten from one release into one chunk. Split a milestone into items in `todo.md` before starting it. Fix a finding in the chunk's own change within the chunk. File a finding about anything else in `todo.md` per "Todo items". A `question` row waits for the human: take the next row.
- **Ask, don't guess.** First check whether the goals already answer the question. If they nearly do, propose a change to the goals and show how it answers this case: an answer settles one question, a goal settles every question like it. Write every answer once, where it belongs, never only in chat: a goal in `README.md`, a working rule in `AGENTS.md`, a standing choice in a comment at the one place it governs, or in `docs/decisions.md` once made in more than one place. If an answer is a goal and something else too, write the goal, and record a choice only for what the goal leaves open.
- **Ship every chunk with `/larv-review`.**
- **Remove a finished item's row and detail from `todo.md`.** If the repo publishes something others consume — a package, an image, an API — reword the item for them and move it to `CHANGELOG.md` under `## Unreleased`. A changelog is for the public, never for the next agent. Otherwise delete it; git history is the record.
@@ -19,16 +19,16 @@ How work proceeds in any repo, unless the repo's `AGENTS.md` says otherwise. The
- **Releases follow semver read strictly** (`~/.claude/principles/technical-principles.md`).
### Todo items (`todo.md`, tickets, plans)
- **`todo.md` is mandatory in every project, in one shape**, which `~/.claude/bin/rank_todo.py` checks and ranks (its `--help` states the format): `## Scoring` holds the formula, the bar and the goal weights; `## Items` is one table of every item; `## Details` holds each item's detail under its ID. A new item takes the next unused ID, never a deleted one's; cite an item by its ID. The formula, bar and weights are the project's own to tune.
- **`todo.md` is mandatory in every project, in one shape**, which `~/.claude/bin/rank_todo.py` checks and ranks (its `--help` states the format): `## Scoring` holds the formula, the bar and the goal weights; `## Items` is one table of every item; `## Details` holds each item's detail under its ID. A new item takes the `Next ID` the file states, which then counts up; cite an item by its ID. The formula, bar and weights are the project's own to tune.
- **Score an item when it is filed or edited, then run `rank_todo.py`.** A deletion needs no run. Each score is a whole number from 1 to 10:
- **R** — the risk that the change creates serious bugs or issues.
- **S** — the size of the change.
- **A** — its value to the audience in `README.md` → `## Audience`.
- **G** — its value to the goals it cites in the Goals column; W is the weight of the heaviest of them.
- **An item scoring under the bar is not kept, unless its Exempt cell says why:** `security` for a security finding, `question` for a question only the human can answer, `decision` for an item a decision in `docs/decisions.md` names. Otherwise a finding under the bar is named in the chunk's summary, not filed, and an item that falls under it is deleted, together with any item that needs it.
- **An item scoring under the bar is not kept, unless its Exempt cell says why:** `security` for a security finding, `defect` for a 🔴 finding that a goal, a principle or correctness is broken, `question` for a question only the human can answer, `decision` for an item a decision in `docs/decisions.md` names. Otherwise a finding under the bar is not filed, and an item that falls under it is deleted, together with any item that needs it; the chunk's summary names each, with its score.
- **Goal weights default to position, the first goal weighing most;** `rank_todo.py` prints that table whenever the weights stop listing the README's goals.
- Open each item with a bold one-sentence tagline, so the taglines alone say what a release holds; detail follows it. The tagline states the target state, checkable when done: an imperative verb plus what holds afterwards. A present-tense fact reads as the current state and says nothing about what to do. Add "today X" only where the direction is otherwise ambiguous. GOOD: `**Accept undefined in MetadataValue and drop such keys on output.**` BANNED: `MetadataValue accepts undefined; such keys are dropped on output`.
- A security finding — a leaked credential, secret or PII, an auth bypass, an injection — is filed the moment it is found, as a row marked `security`, which `rank_todo.py` ranks first in its release, naming the exposure and the path it reaches. Never among additive or nice-to-have items, never only in a chunk's summary, and never as a question about where it belongs: file it, say you did, and I will move it down if I disagree. Fixing it inside an unrelated change is a separate call — say whether it is in the blast radius.
- A security finding — a leaked credential, secret or PII, an auth bypass, an injection — is filed the moment it is found, under the next release, as a row marked `security`, which `rank_todo.py` ranks first in its release, naming the exposure and the path it reaches. Never among additive or nice-to-have items, never only in a chunk's summary, and never as a question about where it belongs: file it, say you did, and I will move it down if I disagree. Fixing it inside an unrelated change is a separate call — say whether it is in the blast radius.
## Quality
+217 -114
View File
@@ -3,15 +3,50 @@
usage: rank_todo.py [--check] [todo.md]
Reads todo.md (default: ./todo.md) and the README.md beside it. Rewrites each item's Score from
`Score = <formula>` under ## Scoring, sorts the ## Items table by release, then exempt items first,
then score from highest, then ID, and orders ## Details to match, each heading `### <ID>. <tagline>`.
An item's Exempt cell is empty, or names why the bar does not apply to it: security, question or
decision. --check writes nothing and fails when the file is not ranked as it would be.
Reads todo.md (default: ./todo.md), the README.md beside it, and docs/decisions.md when there is
one. Rewrites each item's Score from the formula, sorts the items by release, then security rows,
then score from highest, then ID, and orders the details to match. --check writes nothing and fails
when the file is not ranked as it would be.
Exit 1, saying why, when todo.md breaks the format, its goal weights do not list README.md's goals,
an item that is not exempt scores under the `Bar = <number>` it states, judged on the Score as
shown, or --check finds it unranked.
A valid todo.md, every line shown required:
# todo
## Scoring
`Score = -R - S/4 + 2*A + 2*G*W`
`Bar = 9`
`Next ID = 2`
| Goal | W |
|---|---|
| 1 | 1.00 |
## Items
| ID | Release | Exempt | Item | R | S | A | G | Goals | Score |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 0.1.0 | | **Make the first thing work.** | 2 | 3 | 8 | 9 | 1 | 0 |
## Details
### 1. Make the first thing work.
What the tagline cannot say.
- The formula holds numbers, + - * / and parentheses over R, S, A, G and W.
- The bar is judged on the Score as shown, to one decimal.
- A new item takes Next ID, and Next ID then counts up; no row may reach it.
- The goal weights list README.md's numbered goals in order, a sub-goal such as 1.1 included.
- An item's R, S, A and G are whole numbers from 1 to 10; Goals lists goal numbers, comma separated.
- An item's Exempt cell is empty, or names why the bar does not apply: decision, defect, question
or security. An item docs/decisions.md cites as "`todo.md` item N" is marked decision.
- An item's Item cell is one bold tagline; its detail, if any, sits under its ID in ## Details.
Exit 1, saying why, when a file cannot be read, todo.md breaks the format, an item that is not
exempt scores under the bar, or --check finds the file unranked.
"""
import ast
import dataclasses
@@ -20,10 +55,14 @@ import pathlib
import re
import sys
EXEMPTIONS = ("", "decision", "question", "security")
from loop_claude.failure import Failure
from loop_claude.project.premises import sections
EXEMPTIONS = ("", "decision", "defect", "question", "security")
ITEMS_HEADER = "| ID | Release | Exempt | Item | R | S | A | G | Goals | Score |"
WEIGHTS_HEADER = "| Goal | W |"
OPERATORS = (ast.Add, ast.BinOp, ast.Div, ast.Expression, ast.Load, ast.Mult, ast.Sub, ast.UAdd, ast.UnaryOp, ast.USub)
VARIABLES = ("A", "G", "R", "S", "W")
WEIGHTS_HEADER = "| Goal | W |"
@dataclasses.dataclass(frozen=True)
@@ -36,8 +75,10 @@ class Item:
goals: tuple[str, ...]
class Malformed(Exception):
pass
@dataclasses.dataclass(frozen=True)
class Ranked:
text: str
under_bar: list[str]
def main(argv: list[str]) -> int:
@@ -47,87 +88,131 @@ def main(argv: list[str]) -> int:
check = "--check" in argv
paths = [arg for arg in argv if arg != "--check"]
if len(paths) > 1 or any(path.startswith("-") for path in paths):
print(__doc__.strip(), file=sys.stderr)
print(f"rank_todo.py: cannot read the arguments {' '.join(argv)}; usage: rank_todo.py [--check] [todo.md]", file=sys.stderr)
return 1
todo = pathlib.Path(paths[0] if paths else "todo.md")
try:
text = todo.read_text(encoding="utf-8")
readme = (todo.parent / "README.md").read_text(encoding="utf-8")
ranked, under_bar = rank(text, readme_goals(readme))
except (OSError, UnicodeDecodeError, Malformed) as failure:
print(failure if isinstance(failure, OSError) else f"{todo}: {failure}", file=sys.stderr)
decisions = todo.parent / "docs" / "decisions.md"
read_in = [read(todo), read(todo.parent / "README.md"), read(decisions) if decisions.exists() else ""]
unread = next((found for found in read_in if isinstance(found, Failure)), None)
if unread:
print(unread.reason, file=sys.stderr)
return 1
if check and ranked != text:
print(f"{todo}: not ranked; run rank_todo.py on it", file=sys.stderr)
text, readme, cited = (str(found) for found in read_in)
ranked = rank(text, readme, cited)
if isinstance(ranked, Failure):
print(ranked.reason, file=sys.stderr)
return 1
if not check and ranked != text:
todo.write_text(ranked, encoding="utf-8")
for line in under_bar:
if ranked.text != text:
if check:
print(f"{todo}: not ranked; run rank_todo.py on it", file=sys.stderr)
return 1
todo.write_text(ranked.text, encoding="utf-8")
for line in ranked.under_bar:
print(f"{todo}: {line}", file=sys.stderr)
return 1 if under_bar else 0
return 1 if ranked.under_bar else 0
def rank(text: str, goals: list[str]) -> tuple[str, list[str]]:
"""Returns todo.md ranked, and a line for each item under the bar."""
def read(path: pathlib.Path) -> str | Failure:
try:
return path.read_text(encoding="utf-8")
except FileNotFoundError:
return Failure(f"{path}: not found; every project keeps a todo.md beside its README.md, and rank_todo.py --help shows one")
except OSError as failure:
return Failure(f"{path}: {failure.strerror}")
except UnicodeDecodeError:
return Failure(f"{path}: not UTF-8")
def rank(text: str, readme: str, decisions: str) -> Ranked | Failure:
lines = text.split("\n")
if ITEMS_HEADER not in lines and "## Items" not in lines:
return Failure("todo.md is not in the scored-table format; rank_todo.py --help shows a valid one")
goals = readme_goals(readme)
if isinstance(goals, Failure):
return goals
formula = parse_formula(stated(text, "Score"))
if isinstance(formula, Failure):
return formula
bar = number(stated(text, "Bar"), "the bar")
if isinstance(bar, Failure):
return bar
next_id = number(stated(text, "Next ID"), "Next ID")
if isinstance(next_id, Failure):
return next_id
weights = parse_weights(lines, goals)
start, end = table_rows(lines, ITEMS_HEADER)
items = [parse_item(row, weights) for row in lines[start:end]]
if any(line.startswith("|") for line in section_lines(lines, end)):
raise Malformed("## Items holds a row outside its table; keep the rows together under the header")
if len({item.id for item in items}) < len(items):
raise Malformed("two items share an ID")
scored = sorted(((item, score(formula, item, weights)) for item in items), key=lambda pair: (pair[0].release, not pair[0].exempt, -pair[1], pair[0].id))
lines[start:end] = [render_item(item, value) for item, value in scored]
text = "\n".join(lines)
text = rank_details(text, [item for item, _ in scored])
under_bar = [f"item {item.id} scores {value:.1f}, under the bar {bar:g}; rescore it or delete it" for item, value in scored if not item.exempt and round(value, 1) < bar]
return text, under_bar
if isinstance(weights, Failure):
return weights
items = parse_items(lines, weights)
if isinstance(items, Failure):
return items
ids = [item.id for item in items]
if ids and max(ids) >= next_id:
return Failure(f"item {max(ids)} is not under Next ID {next_id:g}; raise Next ID past every ID")
marked = {item.id for item in items if item.exempt == "decision"}
if unmarked := sorted(set(cited_items(decisions)) - marked):
return Failure(f"docs/decisions.md cites todo.md item {', '.join(map(str, unmarked))}, which no row marked decision holds")
scored = []
for item in items:
value = score(formula, item, weights)
if isinstance(value, Failure):
return value
scored.append((item, value))
scored.sort(key=lambda pair: (pair[0].release, pair[0].exempt != "security", -pair[1], pair[0].id))
start = lines.index(ITEMS_HEADER) + 2
lines[start:start + len(scored)] = [render_item(item, value) for item, value in scored]
ranked = rank_details("\n".join(lines), [item for item, _ in scored])
if isinstance(ranked, Failure):
return ranked
under_bar = [f"item {item.id} scores {value:.1f}, under the bar {bar:g}; delete it and any item that needs it, or mark it with a reason the bar does not apply" for item, value in scored if not item.exempt and round(value, 1) < bar]
return Ranked(ranked, under_bar)
def readme_goals(readme: str) -> list[str]:
def readme_goals(readme: str) -> list[str] | Failure:
"""The numbers of README.md's goals in reading order, a sub-goal as 4.1."""
section = re.search(r"^## Goals\n(.*?)(?=^## |\Z)", readme, re.M | re.S)
if section is None:
raise Malformed("README.md has no ## Goals")
found = sections(readme).get("Goals", [])
if len(found) != 1:
return Failure(f"README.md has ## Goals {len(found)} times; it needs it once")
goals: list[str] = []
path: list[tuple[int, str]] = []
for indent, number in re.findall(r"^([ \t]*)(\d+)\. ", section.group(1).expandtabs(4), re.M):
for indent, number in re.findall(r"^([ \t]*)(\d+)\. ", found[0].expandtabs(4), re.M):
while path and path[-1][0] >= len(indent):
path.pop()
path.append((len(indent), number))
goals.append(".".join(part for _, part in path))
if not goals:
raise Malformed("README.md's ## Goals has no numbered goal")
return Failure("README.md's ## Goals has no numbered goal")
if len(set(goals)) < len(goals):
raise Malformed(f"README.md's ## Goals numbers {', '.join(goals)}; number each goal by its position")
return Failure(f"README.md's ## Goals numbers {', '.join(goals)}; number each goal by its position")
return goals
def stated(text: str, name: str) -> str:
def cited_items(decisions: str) -> list[int]:
return [int(id_) for cited in re.findall(r"`todo\.md` items? (\d+(?:(?:, | and )\d+)*)", decisions) for id_ in re.findall(r"\d+", cited)]
def stated(text: str, name: str) -> str | Failure:
found = re.findall(rf"^`{name} = ([^`]+)`$", text, re.M)
if len(found) != 1:
raise Malformed(f"todo.md states `{name} = ...` {len(found)} times; state it once, on a line of its own under ## Scoring")
return Failure(f"todo.md states `{name} = ...` {len(found)} times; state it once, on a line of its own under ## Scoring")
return found[0]
def parse_formula(source: str) -> ast.Expression:
def parse_formula(source: str | Failure) -> ast.Expression | Failure:
if isinstance(source, Failure):
return source
try:
tree = ast.parse(source, mode="eval")
except SyntaxError:
raise Malformed(f"the formula {source!r} does not parse") from None
return Failure(f"the formula {source!r} does not parse")
for node in ast.walk(tree):
allowed = isinstance(node, (ast.Expression, ast.BinOp, ast.UnaryOp, ast.Add, ast.Sub, ast.Mult, ast.Div, ast.USub, ast.UAdd, ast.Load))
allowed = allowed or (isinstance(node, ast.Constant) and type(node.value) in (int, float))
allowed = allowed or (isinstance(node, ast.Name) and node.id in VARIABLES)
if not allowed:
raise Malformed(f"the formula {source!r} may hold only numbers, {', '.join(VARIABLES)}, + - * / and parentheses")
numeric = isinstance(node, ast.Constant) and type(node.value) in (int, float)
if not (isinstance(node, OPERATORS) or numeric or (isinstance(node, ast.Name) and node.id in VARIABLES)):
return Failure(f"the formula {source!r} may hold only numbers, {', '.join(VARIABLES)}, + - * / and parentheses")
return tree
def evaluate(node: ast.AST, values: dict[str, float]) -> float:
"""Evaluates a tree parse_formula accepted; a division by zero gives nan."""
match node:
case ast.Expression(body):
return evaluate(body, values)
@@ -139,96 +224,114 @@ def evaluate(node: ast.AST, values: dict[str, float]) -> float:
return -evaluate(operand, values)
case ast.UnaryOp(ast.UAdd(), operand):
return evaluate(operand, values)
case ast.BinOp(left, operator, right):
a, b = evaluate(left, values), evaluate(right, values)
match operator:
case ast.Add():
return a + b
case ast.Sub():
return a - b
case ast.Mult():
return a * b
case ast.Div():
return a / b
raise Malformed(f"the formula holds {ast.dump(node)}")
case ast.BinOp(left, ast.Add(), right):
return evaluate(left, values) + evaluate(right, values)
case ast.BinOp(left, ast.Sub(), right):
return evaluate(left, values) - evaluate(right, values)
case ast.BinOp(left, ast.Mult(), right):
return evaluate(left, values) * evaluate(right, values)
case ast.BinOp(left, ast.Div(), right):
divisor = evaluate(right, values)
return evaluate(left, values) / divisor if divisor else math.nan
return math.nan
def score(formula: ast.Expression, item: Item, weights: dict[str, float]) -> float:
def score(formula: ast.Expression, item: Item, weights: dict[str, float]) -> float | Failure:
# An item serving several goals is weighed by the heaviest; summing them would reward citing more.
try:
return evaluate(formula, {**item.scores, "W": max(weights[goal] for goal in item.goals)})
except ZeroDivisionError:
raise Malformed(f"the formula divides by zero for item {item.id}") from None
value = evaluate(formula, {**item.scores, "W": max(weights[goal] for goal in item.goals)})
return value if math.isfinite(value) else Failure(f"the formula gives item {item.id} no finite score")
def number(text: str, what: str) -> float:
def number(text: str | Failure, what: str) -> float | Failure:
if isinstance(text, Failure):
return text
try:
value = float(text)
except ValueError:
value = math.nan
if not math.isfinite(value):
raise Malformed(f"{what} {text!r} is not a finite number")
return value
return value if math.isfinite(value) else Failure(f"{what} {text!r} is not a finite number")
def parse_weights(lines: list[str], goals: list[str]) -> dict[str, float]:
start, end = table_rows(lines, WEIGHTS_HEADER)
def parse_weights(lines: list[str], goals: list[str]) -> dict[str, float] | Failure:
rows = table_rows(lines, WEIGHTS_HEADER)
if isinstance(rows, Failure):
return rows
weights: dict[str, float] = {}
for row in lines[start:end]:
goal, weight = cells(row, 2)
weights[goal] = number(weight, f"goal {goal}'s weight")
for row in rows:
found = cells(row, 2)
if isinstance(found, Failure):
return found
weight = number(found[1], f"goal {found[0]}'s weight")
if isinstance(weight, Failure):
return weight
weights[found[0]] = weight
if list(weights) != goals:
default = "\n".join(f"| {goal} | {(len(goals) - index) / len(goals):.2f} |" for index, goal in enumerate(goals))
raise Malformed(f"the goal weights list {', '.join(weights) or 'no goal'}, but README.md's goals are {', '.join(goals)}; by position, (n + 1 - p) / n, they weigh:\n{WEIGHTS_HEADER}\n|---|---|\n{default}")
return Failure(f"the goal weights list {', '.join(weights) or 'no goal'}, but README.md's goals are {', '.join(goals)}; by position they weigh:\n{WEIGHTS_HEADER}\n|---|---|\n{default}")
return weights
def table_rows(lines: list[str], header: str) -> tuple[int, int]:
"""The index range of a table's body rows, below its header and divider."""
def parse_items(lines: list[str], weights: dict[str, float]) -> list[Item] | Failure:
rows = table_rows(lines, ITEMS_HEADER)
if isinstance(rows, Failure):
return rows
after = lines[lines.index(ITEMS_HEADER) + 2 + len(rows):]
if any(line.startswith("|") for line in section_lines(after)):
return Failure("## Items holds a row outside its table; keep the rows together under the header")
items = []
for row in rows:
item = parse_item(row, weights)
if isinstance(item, Failure):
return item
items.append(item)
if len({item.id for item in items}) < len(items):
return Failure("two items share an ID")
return items
def table_rows(lines: list[str], header: str) -> list[str] | Failure:
"""A table's body rows, below its header and divider."""
if lines.count(header) != 1:
raise Malformed(f"todo.md needs the table header {header} once")
return Failure(f"todo.md needs the table header {header} once")
start = lines.index(header) + 2
if start > len(lines) or not re.fullmatch(r"\|(-+\|)+", lines[start - 1].replace(" ", "")):
raise Malformed(f"the table under {header} has no |---| divider line")
return Failure(f"the table under {header} has no |---| divider line")
end = start
while end < len(lines) and lines[end].startswith("|"):
end += 1
return start, end
def section_lines(lines: list[str], start: int) -> list[str]:
"""The lines from start up to the next ## heading."""
end = start
while end < len(lines) and not lines[end].startswith("## "):
end += 1
return lines[start:end]
def cells(row: str, count: int) -> list[str]:
def section_lines(lines: list[str]) -> list[str]:
return lines[:next((index for index, line in enumerate(lines) if line.startswith("## ")), len(lines))]
def cells(row: str, count: int) -> list[str] | Failure:
found = [cell.strip() for cell in re.split(r"(?<!\\)\|", row.strip())[1:-1]]
if len(found) != count:
raise Malformed(f"this row needs {count} cells: {row}")
return found
return found if len(found) == count else Failure(f"this row needs {count} cells: {row}")
def parse_item(row: str, weights: dict[str, float]) -> Item:
id_, release, exempt, tagline, r, s, a, g, goals, _ = cells(row, 10)
def parse_item(row: str, weights: dict[str, float]) -> Item | Failure:
found = cells(row, 10)
if isinstance(found, Failure):
return found
id_, release, exempt, tagline, r, s, a, g, goals, _ = found
if not re.fullmatch(r"[0-9]+", id_) or int(id_) < 1:
raise Malformed(f"the ID {id_!r} is not a positive whole number: {row}")
if not re.fullmatch(r"\d+\.\d+\.\d+", release):
raise Malformed(f"item {id_}'s release {release!r} is not a semver version")
return Failure(f"the ID {id_!r} is not a positive whole number: {row}")
if not re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+", release):
return Failure(f"item {id_}'s release {release!r} is not a semver version")
if exempt not in EXEMPTIONS:
raise Malformed(f"item {id_}'s Exempt {exempt!r} is not empty or one of {', '.join(EXEMPTIONS[1:])}")
return Failure(f"item {id_}'s Exempt {exempt!r} is not empty or one of {', '.join(EXEMPTIONS[1:])}")
if not re.fullmatch(r"\*\*[^*].*[^*]\*\*", tagline):
raise Malformed(f"item {id_}'s Item cell is not one bold tagline: {tagline}")
return Failure(f"item {id_}'s Item cell is not one bold tagline: {tagline}")
scores = {}
for name, value in zip("RSAG", (r, s, a, g)):
if not re.fullmatch(r"[0-9]+", value) or not 1 <= int(value) <= 10:
raise Malformed(f"item {id_}'s {name} {value!r} is not a whole number from 1 to 10")
return Failure(f"item {id_}'s {name} {value!r} is not a whole number from 1 to 10")
scores[name] = int(value)
cited = tuple(goal.strip() for goal in goals.split(","))
if unknown := [goal for goal in cited if goal not in weights]:
raise Malformed(f"item {id_} cites goal {', '.join(unknown)}, which the goal weights do not list")
return Failure(f"item {id_} cites goal {', '.join(unknown)}, which the goal weights do not list")
major, minor, patch = (int(part) for part in release.split("."))
return Item(int(id_), (major, minor, patch), exempt, tagline, scores, cited)
@@ -239,25 +342,25 @@ def render_item(item: Item, value: float) -> str:
return f"| {item.id} | {release} | {item.exempt} | {item.tagline} | {scores} | {', '.join(item.goals)} | {value:.1f} |"
def rank_details(text: str, items: list[Item]) -> str:
def rank_details(text: str, items: list[Item]) -> str | Failure:
section = re.search(r"^## Details\n(.*?)(?=^## |\Z)", text, re.M | re.S)
if section is None:
return text
body = section.group(1)
# A fenced line such as "## Goals" or "### 2. x" would read as a heading and split a detail.
if re.search(r"^ {0,3}(```|~~~)", body, re.M):
raise Malformed("## Details holds a fenced code block; indent quoted markdown by four spaces instead")
return Failure("## Details holds a fenced code block; indent quoted markdown by four spaces instead")
parts = re.split(r"^### (\d+)\. [^\n]*\n", body, flags=re.M)
if parts[0].strip():
raise Malformed("## Details holds text before its first ### <ID>. heading")
details = {}
return Failure("## Details holds text before its first ### <ID>. heading")
details: dict[int, str] = {}
for id_, detail in zip(parts[1::2], parts[2::2]):
if int(id_) in details:
raise Malformed(f"## Details holds item {id_} twice")
return Failure(f"## Details holds item {id_} twice")
details[int(id_)] = detail.strip("\n")
if unknown := sorted(set(details) - {item.id for item in items}):
raise Malformed(f"## Details holds item {', '.join(map(str, unknown))}, which the items table does not")
headed = [f"### {item.id}. {item.tagline.strip('*')}\n\n{details[item.id]}\n" for item in items if item.id in details]
return Failure(f"## Details holds item {', '.join(map(str, unknown))}, which the items table does not")
headed = [f"### {item.id}. {item.tagline.strip('*').replace(chr(92) + '|', '|')}\n\n{details[item.id]}\n" for item in items if item.id in details]
ranked = "\n" + "\n".join(headed) if headed else "\n"
tail = "\n" if section.end() < len(text) else ""
return text[:section.start(1)] + ranked + tail + text[section.end():]
+56 -32
View File
@@ -8,10 +8,13 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
import rank_todo
from loop_claude.failure import Failure
from test_python_floor import ROOT
README = "# P\n\n## Goals\n\n1. Fast.\n2. Correct.\n 1. Tested.\n\n## Audience\n\nMe.\n"
DECISIONS = "## A choice\n\nStands until `todo.md` item 5 ends it.\n"
TODO = """# todo
## Scoring
@@ -20,6 +23,8 @@ TODO = """# todo
`Bar = 9`
`Next ID = 6`
| Goal | W |
|---|---|
| 1 | 1.00 |
@@ -32,8 +37,9 @@ TODO = """# todo
|---|---|---|---|---|---|---|---|---|---|
| 1 | 0.2.0 | | **Ship the later thing.** | 1 | 1 | 9 | 9 | 1 | 0 |
| 2 | 0.1.0 | | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 0 |
| 3 | 0.1.0 | | **Make it fast, `a \| b`.** | 3 | 8 | 6 | 8 | 2.1, 1 | 0 |
| 3 | 0.1.0 | | **Make it fast, `a \\| b`.** | 3 | 8 | 6 | 8 | 2.1, 1 | 0 |
| 4 | 0.1.0 | security | **Rotate the leaked key.** | 9 | 2 | 1 | 1 | 2.1 | 0 |
| 5 | 0.1.0 | decision | **Move the writes out.** | 5 | 5 | 4 | 5 | 2.1 | 0 |
## Details
@@ -52,74 +58,92 @@ Kept as written.
class Rank(unittest.TestCase):
def ranked(self, todo=TODO, readme=README):
return rank_todo.rank(todo, rank_todo.readme_goals(readme))
def ranked(self, todo=TODO, readme=README, decisions=DECISIONS):
return rank_todo.rank(todo, readme, decisions)
def test_scores_and_sorts_by_release_then_score_and_orders_the_details_to_match(self):
text, under_bar = self.ranked()
def test_scores_and_sorts_by_release_then_security_then_score_and_orders_the_details_to_match(self):
ranked = self.ranked()
self.assertIn("""| 4 | 0.1.0 | security | **Rotate the leaked key.** | 9 | 2 | 1 | 1 | 2.1 | -6.8 |
| 3 | 0.1.0 | | **Make it fast, `a \\| b`.** | 3 | 8 | 6 | 8 | 2.1, 1 | 23.0 |
| 2 | 0.1.0 | | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 10.3 |
| 5 | 0.1.0 | decision | **Move the writes out.** | 5 | 5 | 4 | 5 | 2.1 | 5.1 |
| 1 | 0.2.0 | | **Ship the later thing.** | 1 | 1 | 9 | 9 | 1 | 34.8 |
""", text)
self.assertTrue(text.endswith("## Details\n\n### 3. Make it fast, `a \\| b`.\n\nFast detail.\n\n### 1. Ship the later thing.\n\nLater detail.\n\n## Notes\n\nKept as written.\n"))
self.assertEqual(under_bar, [])
self.assertEqual(self.ranked(text), (text, []))
""", ranked.text)
self.assertTrue(ranked.text.endswith("## Details\n\n### 3. Make it fast, `a | b`.\n\nFast detail.\n\n### 1. Ship the later thing.\n\nLater detail.\n\n## Notes\n\nKept as written.\n"))
self.assertEqual(ranked.under_bar, [])
self.assertEqual(self.ranked(ranked.text), ranked)
def test_names_each_item_under_the_bar(self):
_, under_bar = self.ranked(TODO.replace("`Bar = 9`", "`Bar = 11`"))
self.assertEqual(under_bar, ["item 2 scores 10.3, under the bar 11; rescore it or delete it"])
def test_names_each_item_under_the_bar_that_is_not_exempt(self):
ranked = self.ranked(TODO.replace("`Bar = 9`", "`Bar = 11`"))
self.assertEqual(ranked.under_bar, ["item 2 scores 10.3, under the bar 11; delete it and any item that needs it, or mark it with a reason the bar does not apply"])
def test_reads_goals_and_sub_goals_in_reading_order(self):
self.assertEqual(rank_todo.readme_goals(README), ["1", "2", "2.1"])
self.assertEqual(rank_todo.readme_goals(README.replace(" 1.", "\t1.")), ["1", "2", "2.1"])
with self.assertRaises(rank_todo.Malformed):
rank_todo.readme_goals(README.replace("2. Correct.", "1. Correct."))
self.assertEqual(rank_todo.readme_goals(README.replace("2. Correct.", "```\n## Goals\n```\n2. Correct.")), ["1", "2", "2.1"])
self.assertIsInstance(rank_todo.readme_goals(README.replace("2. Correct.", "1. Correct.")), Failure)
def test_prints_the_positional_weights_when_they_stop_listing_the_readmes_goals(self):
with self.assertRaises(rank_todo.Malformed) as raised:
self.ranked(readme=README.replace(" 1. Tested.", " 1. Tested.\n3. Small."))
self.assertIn("| 1 | 1.00 |\n| 2 | 0.75 |\n| 2.1 | 0.50 |\n| 3 | 0.25 |", str(raised.exception))
failure = self.ranked(readme=README.replace(" 1. Tested.", " 1. Tested.\n3. Small."))
self.assertIn("| 1 | 1.00 |\n| 2 | 0.75 |\n| 2.1 | 0.50 |\n| 3 | 0.25 |", failure.reason)
def test_refuses_a_formula_that_is_more_than_arithmetic_over_the_scores(self):
for formula in ("__import__('os')", "R.real", "X + 1", "R ** 2", "R +"):
with self.subTest(formula=formula), self.assertRaises(rank_todo.Malformed):
self.ranked(TODO.replace("-R - S/4 + 2*A + 2*G*W", formula))
for formula in ("__import__('os')", "R.real", "X + 1", "R ** 2", "R +", "R / (S - 2)"):
with self.subTest(formula=formula):
self.assertIsInstance(self.ranked(TODO.replace("-R - S/4 + 2*A + 2*G*W", formula)), Failure)
def test_refuses_a_row_or_detail_off_the_format(self):
def test_refuses_a_file_off_the_format(self):
row = "| 2 | 0.1.0 | | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 0 |"
broken = {
row: row.replace("0.1.0", "0.1"),
row + "\n": row.replace("5 | 5", "5 | ²") + "\n",
"| 2.1 | 0 |\n\n## Details": "| 2.1 | 0 |\n\n| 9 | 0.1.0 | | **Stray.** | 1 | 1 | 1 | 1 | 1 | 0 |\n\n## Details",
"| 4 | 0.1.0 | security |": "| 4 | 0.1.0 | later |",
"| 5 | 0.1.0 | decision |": "| 5 | 0.1.0 | |",
"`Next ID = 6`": "`Next ID = 5`",
"Fast detail.": "```\n## Goals\n```",
"### 3. Make it fast.": "### 5. Make it fast.",
"### 3. Make it fast.": "### 7. Make it fast.",
"`Bar = 9`": "`Bar = nan`",
"-R - S/4 + 2*A + 2*G*W": "R / (S - 2)",
"## Items\n\n| ID | Release | Exempt |": "## Plan\n\n| ID | Release |",
}
for old, new in broken.items():
with self.subTest(new=new), self.assertRaises(rank_todo.Malformed):
self.ranked(TODO.replace(old, new))
with self.subTest(new=new):
self.assertIsInstance(self.ranked(TODO.replace(old, new)), Failure)
class Main(unittest.TestCase):
def run_main(self, *argv):
with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()) as said:
code = rank_todo.main(list(argv))
return code, said.getvalue()
def test_ranks_the_file_in_place_and_check_writes_nothing(self):
with tempfile.TemporaryDirectory() as temp:
todo = pathlib.Path(temp, "todo.md")
todo.write_text(TODO)
pathlib.Path(temp, "README.md").write_text(README)
self.assertEqual(rank_todo.main(["--check", str(todo)]), 1)
pathlib.Path(temp, "docs").mkdir()
pathlib.Path(temp, "docs", "decisions.md").write_text(DECISIONS)
self.assertEqual(self.run_main("--check", str(todo))[0], 1)
self.assertEqual(todo.read_text(), TODO)
self.assertEqual(rank_todo.main([str(todo)]), 0)
self.assertEqual(rank_todo.main(["--check", str(todo)]), 0)
self.assertEqual(self.run_main(str(todo)), (0, ""))
self.assertEqual(self.run_main("--check", str(todo)), (0, ""))
pathlib.Path(temp, "README.md").write_bytes(b"\xff")
self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: not UTF-8\n"))
pathlib.Path(temp, "README.md").unlink()
with contextlib.redirect_stderr(io.StringIO()) as said:
self.assertEqual(rank_todo.main([str(todo)]), 1)
self.assertIn("README.md", said.getvalue())
self.assertIn("README.md: not found", self.run_main(str(todo))[1])
def test_shows_a_valid_file_in_help_and_names_arguments_it_cannot_read(self):
self.assertEqual(self.run_main("--help")[0], 0)
skeleton = "\n".join(line[4:] for line in rank_todo.__doc__.split("\n") if line.startswith(" "))
ranked = rank_todo.rank(skeleton, "## Goals\n\n1. Work.\n", "")
self.assertIsInstance(ranked, rank_todo.Ranked)
self.assertEqual(ranked.under_bar, [])
self.assertEqual(self.run_main("--fix"), (1, "rank_todo.py: cannot read the arguments --fix; usage: rank_todo.py [--check] [todo.md]\n"))
class ThisRepo(unittest.TestCase):
def test_todo_md_is_ranked_with_nothing_under_the_bar(self):
text = (ROOT / "todo.md").read_text(encoding="utf-8")
self.assertEqual(rank_todo.rank(text, rank_todo.readme_goals((ROOT / "README.md").read_text(encoding="utf-8"))), (text, []))
ranked = rank_todo.rank(text, (ROOT / "README.md").read_text(encoding="utf-8"), (ROOT / "docs" / "decisions.md").read_text(encoding="utf-8"))
self.assertEqual(ranked, rank_todo.Ranked(text, []))
+3 -3
View File
@@ -6,11 +6,11 @@
## loop-claude: a judge decides each interrupt from the transcript and the README's premises; the worker's own account of which goal settles a choice decides nothing
2026-09-21, lilleman. Serves goal 4. Asked to name the goal behind each choice, the worker cites a real goal for a choice that goal does not settle, and under-reports its own decisions; the judge's bar is whether the README discriminates between the alternatives. On 2026-10-01 lilleman decided the judge is to read `docs/decisions.md` and `AGENTS.md` too, so an answer recorded there is not asked again (goal 4.2); `todo.md`'s "Give the judge the project's recorded decisions" ends the README-only bar. Valid while the worker's self-report stays unreliable.
2026-09-21, lilleman. Serves goal 4. Asked to name the goal behind each choice, the worker cites a real goal for a choice that goal does not settle, and under-reports its own decisions; the judge's bar is whether the README discriminates between the alternatives. On 2026-10-01 lilleman decided the judge is to read `docs/decisions.md` and `AGENTS.md` too, so an answer recorded there is not asked again (goal 4.2); `todo.md` item 7 ends the README-only bar. Valid while the worker's self-report stays unreliable.
## loop-claude: one session per project, its id derived from the checkout's path relative to `~/code`, or to `/` outside it
2026-09-21, lilleman; revised 2026-09-30 by lilleman. Serves goal 4. One fixed id per project keeps the session picker at one entry per project and makes any transcript under that id loop-claude's own to delete. A checkout outside `~/code` mirroring a path inside it shares that id, and a second loop on it is not refused. Once `todo.md`'s "Key a project on its checkout's full path" lands, the id comes from the full path, so no two checkouts share one, and `loop-claude` refuses to start while another session on that id is active. Moving the checkout orphans its open sessions, archive folder and models entry: sessions stay in the picker until the human deletes them, migration code not being worth a one-human audience. Valid while claude takes `--session-id` and resumes by it.
2026-09-21, lilleman; revised 2026-09-30 by lilleman. Serves goal 4. One fixed id per project keeps the session picker at one entry per project and makes any transcript under that id loop-claude's own to delete. A checkout outside `~/code` mirroring a path inside it shares that id, and a second loop on it is not refused. Once `todo.md` item 5 lands, the id comes from the full path, so no two checkouts share one, and `loop-claude` refuses to start while another session on that id is active. Moving the checkout orphans its open sessions, archive folder and models entry: sessions stay in the picker until the human deletes them, migration code not being worth a one-human audience. Valid while claude takes `--session-id` and resumes by it.
## loop-claude: before an interrupt, it marks the checkout and each of its worktrees trusted in `~/.claude.json`
@@ -78,4 +78,4 @@
## todo.md: one table of items scored by the formula, bar and goal weights it states, ranked by `bin/rank_todo.py`
2026-10-02, lilleman. Serves goal 4: findings were filed faster than chunks closed them, so the plan grew without telling what mattered. Each item scores R (the risk the change creates serious bugs), S (size), A (value to the audience) and G (value to its goals, weighted by goal position); this repo's formula, `-R - S/4 + 2*A + 2*G*W`, counts value highest and size least. An item under the bar is not kept; this repo's bar started at 10 and was set to 9 the same day, purging the 17 items under it. An Exempt cell keeps a row past the bar where a rule needs it to reach the human: a security finding, a question for the human, an item a decision names. The purge retired two decisions whose plans it removed: the stats line in the transcript archive, and three benches before a workflow change merges. `rank_todo.py --check` is part of larv-review's gate, since only a check keeps the stored Score from going stale. The format is mandatory in every project, as the premises are (goal 4.3); the formula, bar and weights are each project's own. A script ranks the table so a re-rank after each addition or edit is deterministic and cheap. Valid while one human sets the bar and reads the ranking.
2026-10-02, lilleman. Serves goal 4: findings were filed faster than chunks closed them, so the plan grew without telling what mattered. Each item is scored as `CLAUDE.md` → "Todo items" says; this repo's formula counts value highest and size least. An item under the bar is not kept; this repo's bar started at 10 and was set to 9 the same day, purging the 17 items under it. An Exempt cell keeps a row past the bar where a rule needs it kept: a security finding, a 🔴 defect, a question for the human, an item a decision names. lilleman retired the two decisions whose plans the purge removed, the stats line in the transcript archive and three benches before a workflow change merges, rather than keep plans scored under the bar. `rank_todo.py --check` is part of larv-review's gate, since only a check keeps the stored Score from going stale. The format is mandatory in every project, as the premises are (goal 4.3); the formula, bar and weights are each project's own. A script ranks the table so a re-rank after each addition or edit is deterministic and cheap. Valid while one human sets the bar and reads the ranking.
+9 -8
View File
@@ -50,7 +50,7 @@ A comment is prose, not code. Passes run in this order: line-level polish on cod
2. The architecture pass's round is the architect (unless skipped), the principles audit and the scoring run, so a fix to any of their findings reruns the whole round.
3. The external auto-reviewer (§4) is a pass of its own, each review it posts a round.
4. From round 2, prompt an agent under `~/.claude/agents/` with the previous round's findings verbatim and what changed since.
5. A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined or filed per "Findings". Resolve that round's 🟢s and ❓s per "Findings" too.
5. A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings". Resolve that round's 🟢s and ❓s per "Findings" too.
6. A pass takes at most three rounds per chunk. Instead of a fourth, list what is open and ask the user. For the auto-reviewer, ask before the push that would summon its fourth, and hold the fixes unpushed until the answer.
7. A yes grants that pass one more round, after which the ask repeats; a no leaves the PR unmerged.
@@ -61,7 +61,7 @@ A comment is prose, not code. Passes run in this order: line-level polish on cod
**Findings.**
1. A finding outside the chunk's change, whatever its pass or severity, is scored and filed in `todo.md` per `~/.claude/CLAUDE.md` → "Todo items"; one under the bar and not exempt is named in the summary with its score instead. A verified security HIGH is handled per "Security".
1. A finding outside the chunk's change, whatever its pass or severity, is scored and filed in `todo.md` per `~/.claude/CLAUDE.md` → "Todo items", a 🔴 marked `defect`; one under the bar and not exempt is named in the summary with its score instead. A verified security HIGH is handled per "Security".
2. A fix that would change a goal, or a decision the repo held before the chunk began, is asked; no user reachable → filed as a `question`, the goal or decision left as is.
3. A 🔴 is fixed, or shown factually wrong, and what disproved it recorded per `~/.claude/CLAUDE.md` → "Decisions: one home, each linked to a goal or a technical principle": in a comment at the code the finding concerns, or in `docs/decisions.md` when it concerns more than one place. Never declined.
4. A 🟡 is fixed, shown factually wrong like a 🔴, or declined. Decline one only where the reason is sound, consistent with the goals and the technical principles, and confidence is very high; the decline and its reason are recorded the same way. A reason neither speaks to is a gap in the goals: fix the finding, or ask per `~/.claude/CLAUDE.md` → "Working loop", "Ask, don't guess"; no user reachable → fix. Never drop one silently, and never decline one for convenience or the size of the fix.
@@ -78,7 +78,7 @@ Launch systems-architect: review the system as a whole entered through this chan
Then the principles audit: one principles-auditor per file in `~/.claude/principles/` and one for the README's goals, each over the whole project in every round.
Then the comprehension floor: the `comprehension-panel` skill's scoring run (`~/.claude/skills/comprehension-panel/SKILL.md` → "The scoring run") over the whole project, not the diff. With any dimension or the overall below 7.0 the chunk does not merge: fix the places the seats name under the capping dimension, or take the user's explicit decision to ship under the floor, record it in `docs/decisions.md` with the scores, and file the places in `todo.md`. No user reachable → fix. At the floor or above, the scores are still a ratchet — a later chunk may not lower any — and the four dimension scores and the overall go in the summary so the next run can see the direction of travel.
Then the comprehension floor: the `comprehension-panel` skill's scoring run (`~/.claude/skills/comprehension-panel/SKILL.md` → "The scoring run") over the whole project, not the diff. With any dimension or the overall below 7.0 the chunk does not merge: fix the places the seats name under the capping dimension, or take the user's explicit decision to ship under the floor, record it in `docs/decisions.md` with the scores, and file the places in `todo.md` per `~/.claude/CLAUDE.md` → "Todo items". No user reachable → fix. At the floor or above, the scores are still a ratchet — a later chunk may not lower any — and the four dimension scores and the overall go in the summary so the next run can see the direction of travel.
### Security
@@ -100,11 +100,12 @@ Launch prose-reviewer with what the diff touched and every section this review c
## 4. Gate
1. Run the project's test suite locally unless the last stability round already left it verified green, and `~/.claude/bin/rank_todo.py --check todo.md`.
2. Watch the forge's checks until every one passes. A red check is a finding.
3. No CI configured → the gate is local tests only; note it in the summary.
4. Everything green → mark the PR ready, dropping any `WIP:`/`Draft:` title prefix.
5. **External auto-reviewer**, when the repo has one — its config file (`.coderabbit.yaml` and the like), or its comments on earlier PRs; none → skip it, say so. Marking the PR ready is what summons it. Wait up to **10 minutes** for its first review, checking about once a minute; nothing by then → note it in the summary and carry on, never waiting twice. Its rounds, §3 → "Round cap". Once it has reviewed, each later return here, after a fix re-entered per §3, waits up to **5 minutes** for its re-review of the new commit.
1. Run `~/.claude/bin/rank_todo.py --check todo.md`.
2. Run the project's test suite locally unless the last stability round already left it verified green.
3. Watch the forge's checks until every one passes. A red check is a finding.
4. No CI configured → the gate is local tests only; note it in the summary.
5. Everything green → mark the PR ready, dropping any `WIP:`/`Draft:` title prefix.
6. **External auto-reviewer**, when the repo has one — its config file (`.coderabbit.yaml` and the like), or its comments on earlier PRs; none → skip it, say so. Marking the PR ready is what summons it. Wait up to **10 minutes** for its first review, checking about once a minute; nothing by then → note it in the summary and carry on, never waiting twice. Its rounds, §3 → "Round cap". Once it has reviewed, each later return here, after a fix re-entered per §3, waits up to **5 minutes** for its re-review of the new commit.
## 5. Goal alignment, then merge
+19 -12
View File
@@ -6,6 +6,8 @@
`Bar = 9`
`Next ID = 36`
| Goal | W |
|---|---|
| 1 | 1.00 |
@@ -22,30 +24,27 @@
| ID | Release | Exempt | Item | R | S | A | G | Goals | Score |
|---|---|---|---|---|---|---|---|---|---|
| 6 | 0.1.0 | decision | **Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.** | 5 | 5 | 4 | 5 | 4.1 | 7.4 |
| 1 | 0.1.0 | | **Copy the transcript archive off the machine, or say in README how it is backed up.** | 3 | 5 | 8 | 9 | 2, 3 | 27.8 |
| 2 | 0.1.0 | | **Add a test that `.gitignore` keeps credentials, transcripts and memory files out.** | 1 | 2 | 6 | 9 | 3 | 24.5 |
| 3 | 0.1.0 | | **Wait out a usage limit and retry however long it lasts, without counting it as a failed run.** | 4 | 5 | 9 | 8 | 4 | 23.5 |
| 7 | 0.1.0 | | **Give the judge the project's recorded decisions, and ask it whether anything the project records settles a choice.** | 3 | 4 | 8 | 8 | 4.2 | 19.0 |
| 7 | 0.1.0 | decision | **Give the judge the project's recorded decisions, and ask it whether anything the project records settles a choice.** | 3 | 4 | 8 | 8 | 4.2 | 19.0 |
| 9 | 0.1.0 | | **Give principles-auditor and prose-reviewer a way to list the project's files.** | 1 | 2 | 5 | 7 | 4.1 | 16.3 |
| 8 | 0.1.0 | | **Judge a cycle on more than the transcript's last 40,000 characters.** | 4 | 5 | 7 | 8 | 4.2 | 15.8 |
| 13 | 0.1.0 | | **Make larv-review §3 applicable on its own, cite its rules by name, and say where a pass's round count is recorded.** | 3 | 5 | 6 | 7 | 4.1 | 15.6 |
| 13 | 0.1.0 | decision | **Make larv-review §3 applicable on its own, cite its rules by name, and say where a pass's round count is recorded.** | 3 | 5 | 6 | 7 | 4.1 | 15.6 |
| 23 | 0.1.0 | | **Launch a principles auditor only for a principles file the project shows applies, and rerun only the reviewer whose finding a fix answers.** | 3 | 4 | 7 | 8 | 4.4 | 13.5 |
| 10 | 0.1.0 | | **Give the reviewer agents only the tools they need.** | 1 | 1 | 4 | 6 | 4.1 | 13.5 |
| 21 | 0.1.0 | | **Give `settings.json`'s model one writer, and sort its keys.** | 3 | 3 | 6 | 7 | 4.3 | 12.9 |
| 20 | 0.1.0 | | **Enable the `claude-security` plugin in `settings.json`, or drop larv-review's full-scan row.** | 1 | 1 | 4 | 5 | 4.1 | 12.4 |
| 12 | 0.1.0 | | **Run the test suite in CI on every PR, or record in `docs/decisions.md` why the local run is enough.** | 2 | 4 | 4 | 6 | 4.1 | 11.7 |
| 5 | 0.1.0 | | **Key a project on its checkout's full path, and refuse to start while another session uses that key.** | 5 | 5 | 5 | 6 | 4.1 | 10.5 |
| 35 | 0.1.0 | question | **Decide whether each project's model choice syncs between machines, so a new machine does not ask again.** | 3 | 3 | 5 | 6 | 4.2 | 11.5 |
| 5 | 0.1.0 | decision | **Key a project on its checkout's full path, and refuse to start while another session uses that key.** | 5 | 5 | 5 | 6 | 4.1 | 10.5 |
| 4 | 0.1.0 | | **Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.** | 3 | 2 | 4 | 3 | 2 | 9.8 |
| 29 | 0.1.0 | | **Make the small changes filed against the review's rules.** | 2 | 2 | 3 | 5 | 4.1, 4.4 | 9.1 |
| 17 | 0.1.0 | | **Make `JUDGE_RULES` and the Claude Code flags `loop-claude` passes readable without `CLAUDE.md` or Claude Code's docs open.** | 1 | 2 | 3 | 4 | 4.1 | 9.0 |
| 29 | 0.1.0 | | **Make the contributor a standing member of every project's audience, unless its `## Audience` says maintainability does not matter.** | 2 | 2 | 3 | 5 | 4.1, 4.4 | 9.1 |
| 17 | 0.1.0 | decision | **Make `JUDGE_RULES` and the Claude Code flags `loop-claude` passes readable without `CLAUDE.md` or Claude Code's docs open.** | 1 | 2 | 3 | 4 | 4.1 | 9.0 |
| 6 | 0.1.0 | decision | **Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.** | 5 | 5 | 4 | 5 | 4.1 | 7.4 |
## Details
### 6. Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.
Claude Code owns that file and writes it. `trust` reads it, changes it and writes it back, so a write that lands in between is lost.
### 1. Copy the transcript archive off the machine, or say in README how it is backed up.
It lives under `~/.claude`, which `.gitignore` keeps from the remote, so a lost disk loses every unattended run's record. Back it up only to a destination private to me and encrypted at rest: the worker runs with permissions bypassed, so the archived tool results can hold credentials it read.
@@ -94,6 +93,10 @@ No machine has it enabled, so every chunk that fires the pass skips it.
The repo has no CI, so larv-review's gate is the local run, and larv-review's Gate skips even that when the last stability round left the suite green: an unattended chunk can merge on the worker's own word.
### 35. Decide whether each project's model choice syncs between machines, so a new machine does not ask again.
The decision "loop-claude: each project's model lives in `~/.claude/loop-claude-models.json`, which only loop-claude writes" keeps the choice per machine, so every new machine asks once per project; goal 4.2 says never ask the same thing twice. Syncing it means a tracked file `loop-claude` writes, which dirties the checkout.
### 5. Key a project on its checkout's full path, and refuse to start while another session uses that key.
The key names the project's session, archive folder and models entry. `project_key` drops the leading `/`, so `~/code/a` and `/a` share all three, and one loop can resume or delete the other's session.
@@ -102,10 +105,14 @@ The key names the project's session, archive folder and models entry. `project_k
Today the folder is the SHA-256 of the transcript's first timestamped line, which tells the human nothing; that line carries the start time. Drop the fallback to the first line, which every chunk of a project shares, and give the tests' fake transcripts ISO timestamps.
### 29. Make the small changes filed against the review's rules.
### 29. Make the contributor a standing member of every project's audience, unless its `## Audience` says maintainability does not matter.
- Make the contributor a standing member of every project's audience. A project drops them only where its `## Audience` says maintainability does not matter. State that in `CLAUDE.md`'s goals-and-audience rule, and have larv-review's comprehension floor name the contributor as the reader it serves. The floor then gates every chunk while the contributor stands, and a project that drops them skips it.
State that in `CLAUDE.md`'s goals-and-audience rule, and have larv-review's comprehension floor name the contributor as the reader it serves. The floor then gates every chunk while the contributor stands, and a project that drops them skips it.
### 17. Make `JUDGE_RULES` and the Claude Code flags `loop-claude` passes readable without `CLAUDE.md` or Claude Code's docs open.
The 2026-10-02 scoring runs on PR #191 named both under Self-sufficiency: the judge's rules use "chunk" and "a release ready to cut" from `CLAUDE.md` with no link, and `--resume`, `--session-id`, `--no-session-persistence`, `--json-schema` and stream-json's result event go unexplained in `worker.py` and `judge.py`.
### 6. Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.
Claude Code owns that file and writes it. `trust` reads it, changes it and writes it back, so a write that lands in between is lost.