diff --git a/bin/rank_todo.py b/bin/rank_todo.py index f47725e7..a8286b38 100755 --- a/bin/rank_todo.py +++ b/bin/rank_todo.py @@ -87,7 +87,7 @@ from failure import Failure from markdown_text import listed, sections from file_writes import replace_file -# Each achieve goal weighs this much of the one above it, so a goal far down the list still counts almost as much as the first (lilleman, 2026-10-18). +# Each achieve goal weighs this much of the one above it, so a goal far down the list still counts almost as much as the first (lilleman, 2026-10-18, asked for a small step per rank; this step is the implementer's pick). GOAL_STEP = 0.97 LARGEST_FORMULA = 200 LONGEST_FORMULA = 4 * LARGEST_FORMULA diff --git a/bin/test_rank_todo.py b/bin/test_rank_todo.py index 56104c3b..3a187ad1 100644 --- a/bin/test_rank_todo.py +++ b/bin/test_rank_todo.py @@ -115,16 +115,22 @@ class Rank(unittest.TestCase): quoting = TODO.replace("Fast detail.", " ## Goals\n\nFast detail.") self.assertIn("### 3. Make it fast, `a | b`.\n\n ## Goals\n\nFast detail.\n", self.ranked(quoting).text) - def test_weighs_each_achieve_goal_3_percent_less_than_the_one_above_and_all_together_1(self): + def test_weighs_each_achieve_goal_97_percent_of_the_one_above_and_a_defects_maintain_goal_as_the_first(self): readme = "## Goals\n\n1. **Achieve:** A.\n 1. **Maintain:** B.\n 2. **Achieve:** C.\n2. **Achieve:** D.\n" self.assertEqual({goal: round(weight, 4) for goal, weight in rank_todo.goal_weights(rank_todo.readme_goals(readme)).items()}, {"1": 0.3435, "1.1": 0.3435, "1.2": 0.3332, "2": 0.3232}) + + def test_weighs_5_achieve_goals_from_0212_to_0188_and_15_from_0082_to_0053_as_the_help_says(self): for count, first, last in ((5, 0.212, 0.188), (15, 0.082, 0.053)): - goals = rank_todo.readme_goals("## Goals\n\n" + "".join(f"{number}. **Achieve:** G.\n" for number in range(1, count + 1))) - weights = list(rank_todo.goal_weights(goals).values()) - self.assertEqual((round(weights[0], 3), round(weights[-1], 3), round(sum(weights), 6)), (first, last, 1)) + with self.subTest(count=count): + goals = rank_todo.readme_goals("## Goals\n\n" + "".join(f"{number}. **Achieve:** G.\n" for number in range(1, count + 1))) + weights = list(rank_todo.goal_weights(goals).values()) + self.assertEqual((round(weights[0], 3), round(weights[-1], 3), round(sum(weights), 6)), (first, last, 1)) + self.assertTrue(str(first) in rank_todo.__doc__ and str(last) in rank_todo.__doc__) + + def test_scores_an_item_by_the_weights_of_the_goals_it_moves(self): + readme = "## Goals\n\n1. **Achieve:** A.\n 1. **Maintain:** B.\n 2. **Achieve:** C.\n2. **Achieve:** D.\n" todo = TODO.replace("2.1 by 8, 1 by 6", "1.2 by 2, 2 by 3").replace("| 2.1 by 1 |", "| 1 by 1 |") - ranked = self.ranked(todo, readme) - self.assertIn("| **Make it fast, `a \\| b`.** | 2 | 1 | 2 | 3 | 7 | 1.2 by 2, 2 by 3 | 1.3 |", ranked.text) + self.assertIn("| **Make it fast, `a \\| b`.** | 2 | 1 | 2 | 3 | 7 | 1.2 by 2, 2 by 3 | 1.3 |", self.ranked(todo, readme).text) def test_scores_an_item_that_moves_no_goal_zero(self): ranked = self.ranked(TODO.replace("| 1 | 2 | 1 | 2 | 4 | 2.1 by 1 |", "| 1 | 2 | 1 | 2 | 4 | |")) diff --git a/docs/decisions.md b/docs/decisions.md index 1d759cbd..2bf558c3 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -136,9 +136,9 @@ Valid while the ladder orders its rungs by competence. 2026-10-02, lilleman. Serves goal 1: findings were filed faster than chunks closed them, so the plan grew without telling what mattered. Each item is scored as `~/.claude/rules/todo-items.md` 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. 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. A finding under the bar is recorded nowhere, so a later review may raise it again, and the run rescores it. That costs one scoring; a ledger of dropped findings would regrow the list the bar caps. larv-review's "Round cap" → "Done" counts a finding named under the bar as settled, so one raised again holds no pass open. `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 1.3); the formula and bar are each project's own. A script ranks the table so a re-rank after each addition or edit is deterministic and cheap. 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-08, lilleman: the goal weights in `todo.md` depart from an even spread by position, which would weigh goal 4, leaking nothing, at 0.11. Valid while one human sets the bar and reads the ranking, and while the items marked `principle` stay few enough to rank. -2026-10-15, lilleman: the scores get a researched method, which `todo.md` items 149 and 151 build, 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 becomes 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. C goes from every table and tool: what it scored beyond size, spread and novelty, which L already holds, is complexity, which adds almost nothing once size is accounted for. Items rank by value per cost, V / 2^S, and V sums each cited achieve goal's sum-reciprocal weight times how far the item moves it. A goes, and the Audience says whose value the goals serve. R stays out of the ranking and sets how carefully an item is done; an item that lowers risk scores it as value. Each release fills by priority up to a capacity it states, in place of the bar. 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 now mark them; each project keeps settled decisions to test its goals against. Each part of this method holds once the item that builds it ships. 2026-10-16, lilleman: a task's L and E + I pick its rungs in place of R, as `routing: one ladder` records. +2026-10-15, lilleman: the scores get a researched method, which `todo.md` items 149 and 151 build, 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 becomes 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. C goes from every table and tool: what it scored beyond size, spread and novelty, which L already holds, is complexity, which adds almost nothing once size is accounted for. Items rank by value per cost, V / 2^S, and V sums each cited achieve goal's weight times how far the item moves it. A goes, and the Audience says whose value the goals serve. R stays out of the ranking and sets how carefully an item is done; an item that lowers risk scores it as value. Each release fills by priority up to a capacity it states, in place of the bar. 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 now mark them; each project keeps settled decisions to test its goals against. Each part of this method holds once the item that builds it ships. 2026-10-16, lilleman: a task's L and E + I pick its rungs in place of R, as `routing: one ladder` records. -2026-10-16, PR #283: items rank by `Score = 100 * V / 2**S`. 2**S is the cost; the 100 lets a score read to one decimal. V sums, over the achieve goals an item's Moves cell names, each goal's weight times how far the item moves it, 1 to 10. The goal ranked k of n achieve goals in reading order weighs 0.97 times the one ranked k - 1, the weights summing to 1 (lilleman, 2026-10-18, replacing the sum-reciprocal weight (1/k) / (1 + 1/2 + … + 1/n), under which the last of twelve goals weighed a twelfth of the first): goals matter almost as much as each other, 5 goals weighing 0.212 down to 0.188 and 15 goals 0.082 down to 0.053. A Moves column replaces A, G and Goals, and `rank_todo.py` derives the weights from README.md, so the goal weights table and the 2026-10-08 weights are gone. An item that cited only maintain goals now names the achieve goal it moves, or, as a defect restoring one, that maintain goal, as the entry below says. A panel of three readers seated as lilleman picked the spelling: two put a Moves column holding `1.1 by 8, 1.2 by 5` first, and one put `1.1: 8` first; two chose `2**S`, since a Python reader takes `^` for XOR; all three chose one decimal of `100 * V / 2**S` over three significant digits or a log. The bar moved to 0.1, lilleman's call answering the review of PR #283: on one-decimal scores it drops an item scoring under 0.05, in practice one that moves no achieve goal, and item 149 revisits it. A table in the old shape still ranks by the formula and weights it states, and ranking it says to reshape it, so no other project's commits stop; reshaping it is that project's only work until done, as `CLAUDE.md` → "Working loop" says. PR #296 dropped the C column, and put L, E and I right before R, which `rank_todo.py` writes from them: of three readers seated as lilleman, two ranked that order first, since a reader meets each level before the R it builds and R sits beside S, and the third ranked it second, after an order with S before the levels. The old shape's ranking is valid until `todo.md` item 156. +2026-10-16, PR #283: items rank by `Score = 100 * V / 2**S`. 2**S is the cost; the 100 lets a score read to one decimal. V sums, over the achieve goals an item's Moves cell names, each goal's weight times how far the item moves it, 1 to 10. The goal ranked k of n achieve goals in reading order weighs 0.97 times the one ranked k - 1, the weights summing to 1 (lilleman, 2026-10-18, replacing the sum-reciprocal weight (1/k) / (1 + 1/2 + … + 1/n), under which the last of twelve goals weighed a twelfth of the first): goals matter almost as much as each other, each a small step below the one above, 5 goals weighing 0.212 down to 0.188 and 15 goals 0.082 down to 0.053. lilleman asked for a small step and the implementer picked 0.97; change it with the one constant, `GOAL_STEP`. The choice departs from `docs/scoring-and-goals-research.md`, which found sum-reciprocal weights fit the weights people gave best: the goals here are meant to count nearly alike, not to fit given weights. A Moves column replaces A, G and Goals, and `rank_todo.py` derives the weights from README.md, so the goal weights table and the 2026-10-08 weights are gone. An item that cited only maintain goals now names the achieve goal it moves, or, as a defect restoring one, that maintain goal, as the entry below says. A panel of three readers seated as lilleman picked the spelling: two put a Moves column holding `1.1 by 8, 1.2 by 5` first, and one put `1.1: 8` first; two chose `2**S`, since a Python reader takes `^` for XOR; all three chose one decimal of `100 * V / 2**S` over three significant digits or a log. The bar moved to 0.1, lilleman's call answering the review of PR #283: on one-decimal scores it drops an item scoring under 0.05, in practice one that moves no achieve goal, and item 149 revisits it. A table in the old shape still ranks by the formula and weights it states, and ranking it says to reshape it, so no other project's commits stop; reshaping it is that project's only work until done, as `CLAUDE.md` → "Working loop" says. PR #296 dropped the C column, and put L, E and I right before R, which `rank_todo.py` writes from them: of three readers seated as lilleman, two ranked that order first, since a reader meets each level before the R it builds and R sits beside S, and the third ranked it second, after an order with S before the levels. The old shape's ranking is valid until `todo.md` item 156. 2026-10-16, lilleman, answering the review of PR #283. An item that restores a maintain goal the project breaks today is a defect: exempt as `defect`. Its Moves name that maintain goal and how much of it is broken, and the goal weighs as the heaviest achieve goal, since a broken maintain goal outranks any achieve goal. Every defect ranks by its score, so a trivial one waits behind valuable work. Only questions and then security findings rank first in their release: a question's answer may change other items, and a question waits for the human anyway, so ranking it first delays no chunk. An item names the most specific goal it moves, and a parent only for a move none of its sub-goals covers, so a sub-goal's move does not count twice; `rank_todo.py` refuses a goal named beside its own sub-goal. Each project reshapes its own `todo.md`; `CLAUDE.md` → "Working loop" makes the reshape the only work until done, as it makes writing missing premises. An item that makes this project easier to read moves goal 1.4 as well as 1.1, since reading cost is measured in tokens per chunk; a goal of its own for readability is left for later. Cost gains a fixed part, F in `Score = 100 * V / (2**S + F)`: every chunk carries a cost its size does not shrink, the reading before its first commit, about 130k tokens, and its review passes, so `2**S` alone overrated tiny items. F is 8, about one S 3 change, until `todo.md` item 158 measures it. diff --git a/todo.md b/todo.md index 7d5cee7d..6ec6a854 100644 --- a/todo.md +++ b/todo.md @@ -6,12 +6,13 @@ `Bar = 0.1` -`Next ID = 191` +`Next ID = 195` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| +| 191 | 0.2.0 | | question | **Decide whether an item marked `defect` keeps a clear lead over achieve goals now that their weights are nearly flat, and how `rank_todo.py` gives it one.** | 2 | 2 | 3 | 5 | 2 | 1.1 by 3 | 5.1 | | 180 | 0.2.0 | | | **Accept an escalation quote only from transcript entries after the worker's last step-up, so a trigger that fires after an interrupt or a quoted answer stepped the worker steps it again.** | 3 | 2 | 3 | 6 | 5 | 1.1 by 4 | 2.1 | | 159 | 0.2.0 | | decision | **Run each review pass on the lowest rung that a replay of its archived rounds shows finding every 🔴 and 🟡 the project's rung finds, even below the worker's rung.** | 4 | 2 | 3 | 7 | 6 | 1.4 by 7 | 1.9 | | 189 | 0.2.0 | | | **State one achieve goal for the health of a project's code in `~/.claude`, which every project's ranking weighs, most while its comprehension panel's overall is under 7.0, unless its README voids it.** | 4 | 2 | 3 | 7 | 6 | 1.1 by 6 | 1.7 | @@ -43,6 +44,9 @@ | 190 | 0.3.0 | | | **Rewrite the `docs/decisions.md` entries `todo.md: one table …` and `loop-claude: a judge decides …` as the current state, so a reader no longer replays superseded paragraphs to learn what holds.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3, 1.4 by 2 | 6.3 | | 171 | 0.3.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 | 4.9 | | 181 | 0.3.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 | 4.1 | +| 192 | 0.3.0 | | | **Sort `.gitignore`'s allowlist block, from `!.claude/` to `!workflow-bench/test_review_git.py`, by code point, so rule-hook's `ignorefile-sorted` checks later edits to it again.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 4.1 | +| 193 | 0.3.0 | | | **Narrow `readme_goals`'s mark to `Mark` by a checked lookup in place of `typing.cast`, so mypy catches a mark the regex gains but `goal_weights` does not handle.** | 1 | 1 | 3 | 3 | 1 | 1.1 by 2 | 4.1 | +| 194 | 0.3.0 | | | **Make `test_waits_out_a_usage_limit_which_ends_a_run_of_failures` expect a usage-limit wait that holds however much wall-clock time passes during the run.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 4.1 | | 187 | 0.3.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 | 3.6 | | 165 | 0.3.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 | 3.5 | | 182 | 0.3.0 | | | **Let the human edit an interrupt's answer with the arrow keys, so Left moves the cursor instead of typing ^[[D into the answer.** | 2 | 2 | 1 | 3 | 2 | 1.1 by 2 | 3.4 | @@ -89,6 +93,18 @@ ## Details +### 191. Decide whether an item marked `defect` keeps a clear lead over achieve goals now that their weights are nearly flat, and how `rank_todo.py` gives it one. + +Found by review of PR #317, which set `rank_todo.py`'s goal weights to a geometric step of 0.97. A maintain goal that a defect restores still weighs as the heaviest achieve goal, as that PR kept. With 5 achieve goals that is 0.212, against 0.206 for the second goal; under the old weights it was 0.438 against 0.219. So the lead a defect had is gone: items 80 and 21, first and second in release 0.3.0 before, now rank 18th and 25th by score. + +The question for lilleman: should a defect keep a clear lead over achieve goals, and if so, how? + +- **Keep it as is.** A defect competes on its Moves like any item. +- **A multiple of the heaviest weight.** A maintain goal weighs, say, twice the heaviest achieve goal. One constant, but it says nothing about how far ahead a defect lands. +- **Rank defects ahead of the rest of their release,** after questions and security items, as those already are. The lead holds whatever the weights. + +Recommendation: rank defects ahead, since a maintain goal vetoes rather than trades off, and a weight multiple only approximates that. The answer changes `rank_todo.py`, its `--help` and `rules/todo-items.md`. + ### 180. Accept an escalation quote only from transcript entries after the worker's last step-up, so a trigger that fires after an interrupt or a quoted answer stepped the worker steps it again. `docs/decisions.md` → `routing: a worker whose run ends asking for a higher rung…` says a trigger that fires after the human's answer waits for the next cycle. Today it doesn't step the worker: once an interrupt or a quoted answer has taken an escalation, `unspent` in `bin/loop_claude/cycle/run.py` drops the escalation of every later ruling of the cycle. The dropped request stays in the transcript, so in the next cycle the judge finds no trigger that fired since the worker's last request. A quoted answer resumes the worker headless up to three times a cycle, and so does an answer the human types at loop-claude's terminal, so the loss is reachable with no one watching. `unspent` exists because loop-claude cannot tell from the judge's quotes alone whether a trigger already bought a step. Instead, identify a trigger by where it sits in the transcript: @@ -236,6 +252,18 @@ Raised by the goals audit of PR #296. `bin/routing_figures/measure.py` groups a `bin/loop_claude/test_loop_claude.py`'s `test_a_quoted_answer_that_cites_an_escalation_trigger_steps_the_worker_up_before_it_resumes_and_archives_the_step` builds its expected prompt from `prompts.rungs_held`, the code under test, so a bug there passes it. The technical principles' test bullet bans that shape. Assert the new rung and one review launch as literals, as the typed answer's step-up test does. Raised by the principles audit of PR #308. +### 192. Sort `.gitignore`'s allowlist block, from `!.claude/` to `!workflow-bench/test_review_git.py`, by code point, so rule-hook's `ignorefile-sorted` checks later edits to it again. + +Found by review of PR #317. `.gitignore:56-58` holds `!bin/rule-hook` above `!bin/routing_figures/` and `!bin/routing_figures/*.py`, but `o` sorts before `u`. `ignore_breaches` in `bin/rule_hook/rules.py` skips a block that was already unsorted before an edit, so while this one stays unsorted no later edit to it is checked. + +### 193. Narrow `readme_goals`'s mark to `Mark` by a checked lookup in place of `typing.cast`, so mypy catches a mark the regex gains but `goal_weights` does not handle. + +Found by review of PR #317. `bin/rank_todo.py`'s `readme_goals` writes `typing.cast(Mark, mark or None)`, which asserts the type `goal_weights` branches on without checking it. A lookup such as a dict from each regex mark to its `Mark` value lets mypy check it. + +### 194. Make `test_waits_out_a_usage_limit_which_ends_a_run_of_failures` expect a usage-limit wait that holds however much wall-clock time passes during the run. + +Found by review of PR #317. `bin/loop_claude/test_black_box.py:569-575` sets `resets_at` from the test's `time.time()` and expects the wait, rounded to tens, to be 3720. When more than about 5 s pass between that read and the loop's, the wait rounds to 3710 and the test fails with no bug. Item 102 covers only replacing the `time.sleep` swap; this item changes the expected value, for example by asserting the wait against `resets_at + 120` minus the time the loop read, or a bound on it. + ### 187. 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. Before PR #310, reports reached the worker as the Agent call's result, a median 19k tokens per chunk (2026-10-08, 68 archived transcripts). Now a reviewer returns its verdict and one line per finding, and the worker reads a 🔴 or 🟡 finding's entry from the report file. `reading-cost` counts only tracked files (`bin/reading_cost/measure.py`), and `routing-figures` counts only the Agent call's result (`bin/routing_figures/measure.py`), so neither sees the report reads. Found by the architecture review of PR #310.